diff --git a/demo/components/DemoTabs.svelte b/demo/components/DemoTabs.svelte index 714afae..eaa2038 100644 --- a/demo/components/DemoTabs.svelte +++ b/demo/components/DemoTabs.svelte @@ -14,9 +14,9 @@ import NeoTab from '~/nav/NeoTab.svelte'; import NeoTabs from '~/nav/NeoTabs.svelte'; - const { onClick, loading: loading$, onLoading, skeleton: skeleton$, onSkeleton } = useButtonState('DemoTabsClicked'); + const { onClick, loading: loading$, onLoading } = useButtonState('DemoTabsClicked'); const loading = $derived.by(loading$); - const skeleton = $derived.by(skeleton$); + let skeleton = $state(false); const { matches } = useWatchMedia('(max-width: 1550px)'); const vertical = $derived.by(matches); @@ -36,12 +36,14 @@ let active: unknown | undefined = $state('button'); let value: unknown | undefined = $state('button'); - const onChange = (id: TabId, _value?: unknown) => { + const onChange = (id?: TabId, _value?: unknown) => { active = id; value = _value; }; - const options = $state({ disabled: false, close: true, add: true, slide: false }); + const onClear = () => onChange(); + + const options = $state({ disabled: false, close: true, add: true, slide: true }); const columns = [ { label: 'Default' }, @@ -63,13 +65,12 @@ Icon Reversed - Skeleton {/snippet} {#snippet group(props: NeoButtonGroupContext = {})} {@render buttons()} - {#each added as { text, ...tab }} + {#each added as { text, ...tab } (tab.tabId)} {text} {/each} @@ -87,6 +88,8 @@ Add Close Slide + Skeleton + Clear diff --git a/src/lib/buttons/NeoButton.svelte b/src/lib/buttons/NeoButton.svelte index 561910f..92f19ac 100644 --- a/src/lib/buttons/NeoButton.svelte +++ b/src/lib/buttons/NeoButton.svelte @@ -160,7 +160,7 @@ color: var(--neo-btn-text-color, inherit); text-decoration: inherit; background-color: var(--neo-btn-bg-color, var(--background-color)); - border: 1px var(--neo-btn-border-color, transparent) solid; + border: var(--border-width, 1px) var(--neo-btn-border-color, transparent) solid; border-radius: var(--neo-btn-border-radius, var(--border-radius)); box-shadow: var(--box-shadow-raised-2); cursor: pointer; diff --git a/src/lib/buttons/NeoButtonGroup.svelte b/src/lib/buttons/NeoButtonGroup.svelte index 3751215..b83c343 100644 --- a/src/lib/buttons/NeoButtonGroup.svelte +++ b/src/lib/buttons/NeoButtonGroup.svelte @@ -78,7 +78,7 @@ margin: 0.25rem; padding: 0.25rem; background-color: var(--neo-btn-bg-color, var(--background-color)); - border: 1px var(--neo-btn-border-color, transparent) solid; + border: var(--border-width, 1px) var(--neo-btn-border-color, transparent) solid; border-radius: calc(var(--neo-btn-border-radius, var(--border-radius)) + 0.25rem); transition: color 0.3s ease, diff --git a/src/lib/nav/NeoTab.svelte b/src/lib/nav/NeoTab.svelte index 216ddbb..00b3959 100644 --- a/src/lib/nav/NeoTab.svelte +++ b/src/lib/nav/NeoTab.svelte @@ -1,11 +1,14 @@ -
+
{@render children?.({ active, tabId, value })} {#if closeable} - {/if} @@ -83,6 +95,13 @@ opacity: 1; } } + + &.slide { + :global(.neo-button:active .icon-close), + :global(.neo-button.pressed .icon-close) { + transition-delay: 0.3s; + } + } } .neo-tab-close { diff --git a/src/lib/nav/NeoTabs.svelte b/src/lib/nav/NeoTabs.svelte index c3f3881..b3fa47d 100644 --- a/src/lib/nav/NeoTabs.svelte +++ b/src/lib/nav/NeoTabs.svelte @@ -1,12 +1,15 @@