-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(Toggle): forward all events including child components
- Loading branch information
Showing
6 changed files
with
65 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,18 @@ | ||
<script lang="ts"> | ||
import { twMerge } from 'tailwind-merge'; | ||
import { get_current_component } from 'svelte/internal'; | ||
import { forwardEventsBuilder, useActions, type ActionArray } from '../../actions'; | ||
export let use: ActionArray = []; | ||
import { exclude } from '../../utils/exclude'; | ||
const forwardEvents = forwardEventsBuilder(get_current_component()); | ||
const defaultClass = 'text-sm text-light-secondary-content dark:text-dark-secondary-content'; | ||
$: finalClass = twMerge(defaultClass, $$props.class); | ||
</script> | ||
|
||
<span class={finalClass} style={$$props.style}><slot /></span> | ||
<span | ||
class={finalClass} | ||
use:useActions={use} | ||
use:forwardEvents | ||
{...exclude($$props, ['use', 'class'])}><slot /></span | ||
> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,19 @@ | ||
<script lang="ts"> | ||
import { twMerge } from 'tailwind-merge'; | ||
import { get_current_component } from 'svelte/internal'; | ||
import { forwardEventsBuilder, useActions, type ActionArray } from '../../actions'; | ||
export let use: ActionArray = []; | ||
import { exclude } from '../../utils/exclude'; | ||
const forwardEvents = forwardEventsBuilder(get_current_component()); | ||
const defaultClass = 'text-sm font-medium text-light-content dark:text-dark-content'; | ||
$: finalClass = twMerge(defaultClass, $$props.class); | ||
</script> | ||
|
||
<span class={finalClass} style={$$props.style}><slot /> </span> | ||
<span | ||
class={finalClass} | ||
use:useActions={use} | ||
use:forwardEvents | ||
{...exclude($$props, ['use', 'class'])} | ||
><slot /> | ||
</span> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,21 @@ | ||
<script lang="ts"> | ||
import { twMerge } from 'tailwind-merge'; | ||
import type { MaterialIcon } from '../../types'; | ||
import { get_current_component } from 'svelte/internal'; | ||
import { forwardEventsBuilder, useActions, type ActionArray } from '../../actions'; | ||
export let use: ActionArray = []; | ||
import { exclude } from '../../utils/exclude'; | ||
const forwardEvents = forwardEventsBuilder(get_current_component()); | ||
export let icon: MaterialIcon; | ||
const defaultClass = 'material-icons text-sm absolute left-0.5'; | ||
$: finalClass = twMerge(defaultClass, $$props.class); | ||
</script> | ||
|
||
<span class={finalClass} style={$$props.style}>{icon}</span> | ||
<span | ||
class={finalClass} | ||
use:useActions={use} | ||
use:forwardEvents | ||
{...exclude($$props, ['use', 'class'])}>{icon}</span | ||
> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,21 @@ | ||
<script lang="ts"> | ||
import { twMerge } from 'tailwind-merge'; | ||
import type { MaterialIcon } from '../../types'; | ||
import { get_current_component } from 'svelte/internal'; | ||
import { forwardEventsBuilder, useActions, type ActionArray } from '../../actions'; | ||
export let use: ActionArray = []; | ||
import { exclude } from '../../utils/exclude'; | ||
const forwardEvents = forwardEventsBuilder(get_current_component()); | ||
export let icon: MaterialIcon; | ||
const defaultClass = 'material-icons text-sm absolute right-0.5'; | ||
$: finalClass = twMerge(defaultClass, $$props.class); | ||
</script> | ||
|
||
<span class={finalClass} style={$$props.style}>{icon}</span> | ||
<span | ||
class={finalClass} | ||
use:useActions={use} | ||
use:forwardEvents | ||
{...exclude($$props, ['use', 'class'])}>{icon}</span | ||
> |
23d208f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
stwui – ./
stwui-n00nday.vercel.app
stwui.vercel.app
stwui-git-main-n00nday.vercel.app