@skeletonlabs/skeleton-svelte 2.0.0-next.3 → 2.0.0-next.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/accordion/anatomy/content.svelte +9 -7
- package/dist/components/accordion/anatomy/content.svelte.d.ts +2 -2
- package/dist/components/accordion/anatomy/heading.svelte +9 -5
- package/dist/components/accordion/anatomy/heading.svelte.d.ts +2 -2
- package/dist/components/accordion/anatomy/indicator.svelte +7 -9
- package/dist/components/accordion/anatomy/indicator.svelte.d.ts +2 -2
- package/dist/components/accordion/anatomy/item.svelte +13 -16
- package/dist/components/accordion/anatomy/item.svelte.d.ts +2 -2
- package/dist/components/accordion/anatomy/root-context.svelte +6 -4
- package/dist/components/accordion/anatomy/root-context.svelte.d.ts +2 -2
- package/dist/components/accordion/anatomy/root-provider.svelte +31 -0
- package/dist/components/accordion/anatomy/root-provider.svelte.d.ts +9 -0
- package/dist/components/accordion/anatomy/root.svelte +17 -19
- package/dist/components/accordion/anatomy/root.svelte.d.ts +2 -2
- package/dist/components/accordion/anatomy/trigger.svelte +9 -7
- package/dist/components/accordion/anatomy/trigger.svelte.d.ts +2 -2
- package/dist/components/accordion/index.d.ts +2 -3
- package/dist/components/accordion/index.js +1 -0
- package/dist/components/accordion/modules/anatomy.d.ts +1 -1
- package/dist/components/accordion/modules/anatomy.js +2 -2
- package/dist/components/accordion/modules/item-context.d.ts +3 -7
- package/dist/components/accordion/modules/use-accordion.svelte.js +7 -0
- package/dist/components/avatar/anatomy/fallback.svelte +10 -6
- package/dist/components/avatar/anatomy/fallback.svelte.d.ts +2 -2
- package/dist/components/avatar/anatomy/image.svelte +10 -6
- package/dist/components/avatar/anatomy/image.svelte.d.ts +2 -2
- package/dist/components/avatar/anatomy/root-context.svelte +6 -4
- package/dist/components/avatar/anatomy/root-context.svelte.d.ts +2 -2
- package/dist/components/avatar/anatomy/root-provider.svelte +35 -0
- package/dist/components/avatar/anatomy/root-provider.svelte.d.ts +9 -0
- package/dist/components/avatar/anatomy/root.svelte +17 -16
- package/dist/components/avatar/anatomy/root.svelte.d.ts +2 -2
- package/dist/components/avatar/index.d.ts +2 -1
- package/dist/components/avatar/index.js +1 -0
- package/dist/components/avatar/modules/anatomy.d.ts +1 -0
- package/dist/components/avatar/modules/anatomy.js +2 -0
- package/dist/components/avatar/modules/use-avatar.svelte.js +7 -0
- package/dist/components/progress-linear/anatomy/label.svelte +8 -12
- package/dist/components/progress-linear/anatomy/label.svelte.d.ts +2 -2
- package/dist/components/progress-linear/anatomy/range.svelte +8 -12
- package/dist/components/progress-linear/anatomy/range.svelte.d.ts +2 -2
- package/dist/components/progress-linear/anatomy/root-context.svelte +6 -4
- package/dist/components/progress-linear/anatomy/root-context.svelte.d.ts +2 -2
- package/dist/components/progress-linear/anatomy/root-provider.svelte +35 -0
- package/dist/components/progress-linear/anatomy/root-provider.svelte.d.ts +9 -0
- package/dist/components/progress-linear/anatomy/root.svelte +14 -25
- package/dist/components/progress-linear/anatomy/root.svelte.d.ts +2 -2
- package/dist/components/progress-linear/anatomy/track.svelte +10 -6
- package/dist/components/progress-linear/anatomy/track.svelte.d.ts +2 -2
- package/dist/components/progress-linear/index.d.ts +2 -1
- package/dist/components/progress-linear/index.js +1 -0
- package/dist/components/progress-linear/modules/use-progress-linear.svelte.js +7 -0
- package/dist/components/rating-group/anatomy/control.svelte +13 -7
- package/dist/components/rating-group/anatomy/control.svelte.d.ts +2 -2
- package/dist/components/rating-group/anatomy/hidden-input.svelte +10 -8
- package/dist/components/rating-group/anatomy/hidden-input.svelte.d.ts +2 -2
- package/dist/components/rating-group/anatomy/item.svelte +11 -17
- package/dist/components/rating-group/anatomy/item.svelte.d.ts +2 -2
- package/dist/components/rating-group/anatomy/label.svelte +13 -7
- package/dist/components/rating-group/anatomy/label.svelte.d.ts +2 -2
- package/dist/components/rating-group/anatomy/root-context.svelte +6 -4
- package/dist/components/rating-group/anatomy/root-context.svelte.d.ts +2 -2
- package/dist/components/rating-group/anatomy/root-provider.svelte +35 -0
- package/dist/components/rating-group/anatomy/root-provider.svelte.d.ts +9 -0
- package/dist/components/rating-group/anatomy/root.svelte +18 -23
- package/dist/components/rating-group/anatomy/root.svelte.d.ts +3 -3
- package/dist/components/rating-group/index.d.ts +2 -3
- package/dist/components/rating-group/index.js +1 -0
- package/dist/components/rating-group/modules/anatomy.d.ts +1 -1
- package/dist/components/rating-group/modules/anatomy.js +2 -2
- package/dist/components/rating-group/modules/use-rating-group.svelte.js +7 -0
- package/dist/components/switch/anatomy/control.svelte +32 -0
- package/dist/components/switch/anatomy/control.svelte.d.ts +7 -0
- package/dist/components/switch/anatomy/hidden-input.svelte +30 -0
- package/dist/components/switch/anatomy/hidden-input.svelte.d.ts +7 -0
- package/dist/components/switch/anatomy/label.svelte +32 -0
- package/dist/components/switch/anatomy/label.svelte.d.ts +7 -0
- package/dist/components/switch/anatomy/root-context.svelte +20 -0
- package/dist/components/switch/anatomy/root-context.svelte.d.ts +8 -0
- package/dist/components/switch/anatomy/root-provider.svelte +35 -0
- package/dist/components/switch/anatomy/root-provider.svelte.d.ts +9 -0
- package/dist/components/switch/anatomy/root.svelte +42 -0
- package/dist/components/switch/anatomy/root.svelte.d.ts +8 -0
- package/dist/components/switch/anatomy/thumb.svelte +32 -0
- package/dist/components/switch/anatomy/thumb.svelte.d.ts +7 -0
- package/dist/components/switch/index.d.ts +9 -0
- package/dist/components/switch/index.js +2 -0
- package/dist/components/switch/modules/anatomy.d.ts +8 -0
- package/dist/components/switch/modules/anatomy.js +15 -0
- package/dist/components/{rating-group/modules/item-context.js → switch/modules/root-context.js} +1 -1
- package/dist/components/switch/modules/use-switch.svelte.js +7 -0
- package/dist/components/tabs/anatomy/content.svelte +10 -6
- package/dist/components/tabs/anatomy/content.svelte.d.ts +2 -2
- package/dist/components/tabs/anatomy/indicator.svelte +10 -6
- package/dist/components/tabs/anatomy/indicator.svelte.d.ts +2 -2
- package/dist/components/tabs/anatomy/list.svelte +10 -6
- package/dist/components/tabs/anatomy/list.svelte.d.ts +2 -2
- package/dist/components/tabs/anatomy/root-context.svelte +6 -4
- package/dist/components/tabs/anatomy/root-context.svelte.d.ts +2 -2
- package/dist/components/tabs/anatomy/root-provider.svelte +34 -0
- package/dist/components/tabs/anatomy/root-provider.svelte.d.ts +9 -0
- package/dist/components/tabs/anatomy/root.svelte +16 -19
- package/dist/components/tabs/anatomy/root.svelte.d.ts +2 -2
- package/dist/components/tabs/anatomy/trigger.svelte +10 -6
- package/dist/components/tabs/anatomy/trigger.svelte.d.ts +2 -2
- package/dist/components/tabs/index.d.ts +9 -1
- package/dist/components/tabs/index.js +2 -1
- package/dist/components/tabs/modules/anatomy.d.ts +1 -0
- package/dist/components/tabs/modules/anatomy.js +2 -0
- package/dist/components/tabs/modules/use-tabs.svelte.js +7 -0
- package/dist/components/toast/anatomy/action-trigger.svelte +32 -0
- package/dist/components/toast/anatomy/action-trigger.svelte.d.ts +7 -0
- package/dist/components/toast/anatomy/close-trigger.svelte +37 -0
- package/dist/components/toast/anatomy/close-trigger.svelte.d.ts +7 -0
- package/dist/components/toast/anatomy/description.svelte +32 -0
- package/dist/components/toast/anatomy/description.svelte.d.ts +7 -0
- package/dist/components/toast/anatomy/group.svelte +47 -0
- package/dist/components/toast/anatomy/group.svelte.d.ts +11 -0
- package/dist/components/toast/anatomy/message.svelte +29 -0
- package/dist/components/toast/anatomy/message.svelte.d.ts +7 -0
- package/dist/components/toast/anatomy/root-context.svelte +20 -0
- package/dist/components/toast/anatomy/root-context.svelte.d.ts +8 -0
- package/dist/components/toast/anatomy/root.svelte +74 -0
- package/dist/components/toast/anatomy/root.svelte.d.ts +9 -0
- package/dist/components/toast/anatomy/title.svelte +32 -0
- package/dist/components/toast/anatomy/title.svelte.d.ts +7 -0
- package/dist/components/toast/index.d.ts +9 -0
- package/dist/components/toast/index.js +2 -0
- package/dist/components/toast/modules/anatomy.d.ts +9 -0
- package/dist/components/toast/modules/anatomy.js +17 -0
- package/dist/components/toast/modules/group-context.d.ts +6 -0
- package/dist/components/toast/modules/group-context.js +2 -0
- package/dist/components/toast/modules/root-context.d.ts +6 -0
- package/dist/components/toast/modules/root-context.js +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/internal/components/x.svelte +14 -0
- package/dist/internal/components/x.svelte.d.ts +26 -0
- package/dist/internal/html-attributes.d.ts +2 -0
- package/dist/internal/html-attributes.js +1 -0
- package/dist/internal/props-with-element.d.ts +4 -4
- package/package.json +19 -19
- package/dist/components/accordion/anatomy/item-context.svelte +0 -18
- package/dist/components/accordion/anatomy/item-context.svelte.d.ts +0 -8
- package/dist/components/accordion/modules/root-context.d.ts +0 -9
- package/dist/components/avatar/modules/root-context.d.ts +0 -9
- package/dist/components/progress-linear/modules/root-context.d.ts +0 -9
- package/dist/components/rating-group/anatomy/item-context.svelte +0 -18
- package/dist/components/rating-group/anatomy/item-context.svelte.d.ts +0 -8
- package/dist/components/rating-group/modules/item-context.d.ts +0 -9
- package/dist/components/rating-group/modules/root-context.d.ts +0 -9
- package/dist/components/tabs/modules/root-context.d.ts +0 -9
- package/dist/internal/test-utils.d.ts +0 -3
- package/dist/internal/test-utils.js +0 -9
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
import type { ContentProps } from '@zag-js/tabs';
|
|
3
|
-
import type { HTMLAttributes } from '
|
|
3
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
4
4
|
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
5
5
|
|
|
6
|
-
export interface TabsContentProps extends ContentProps, PropsWithElement
|
|
6
|
+
export interface TabsContentProps extends ContentProps, PropsWithElement<'div'>, HTMLAttributes<'div'> {}
|
|
7
7
|
</script>
|
|
8
8
|
|
|
9
9
|
<script lang="ts">
|
|
@@ -14,16 +14,20 @@
|
|
|
14
14
|
|
|
15
15
|
const props: TabsContentProps = $props();
|
|
16
16
|
|
|
17
|
-
const
|
|
17
|
+
const tabs = TabsRootContext.consume();
|
|
18
18
|
|
|
19
19
|
const [contentProps, componentProps] = $derived(splitContentProps(props));
|
|
20
|
-
const { element, children, ...
|
|
20
|
+
const { element, children, ...rest } = $derived(componentProps);
|
|
21
21
|
|
|
22
|
-
const attributes = $derived(
|
|
22
|
+
const attributes = $derived(
|
|
23
|
+
mergeProps(tabs().getContentProps(contentProps), rest, {
|
|
24
|
+
class: classesTabs.content
|
|
25
|
+
})
|
|
26
|
+
);
|
|
23
27
|
</script>
|
|
24
28
|
|
|
25
29
|
{#if element}
|
|
26
|
-
{@render element(
|
|
30
|
+
{@render element(attributes)}
|
|
27
31
|
{:else}
|
|
28
32
|
<div {...attributes}>
|
|
29
33
|
{@render children?.()}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ContentProps } from '@zag-js/tabs';
|
|
2
|
-
import type { HTMLAttributes } from '
|
|
2
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
3
3
|
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
4
|
-
export interface TabsContentProps extends ContentProps, PropsWithElement
|
|
4
|
+
export interface TabsContentProps extends ContentProps, PropsWithElement<'div'>, HTMLAttributes<'div'> {
|
|
5
5
|
}
|
|
6
6
|
declare const Content: import("svelte").Component<TabsContentProps, {}, "">;
|
|
7
7
|
type Content = ReturnType<typeof Content>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
-
import type { HTMLAttributes } from '
|
|
2
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
3
3
|
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
4
4
|
|
|
5
|
-
export interface TabsIndicatorProps extends PropsWithElement
|
|
5
|
+
export interface TabsIndicatorProps extends PropsWithElement<'div'>, HTMLAttributes<'div', 'children'> {}
|
|
6
6
|
</script>
|
|
7
7
|
|
|
8
8
|
<script lang="ts">
|
|
@@ -12,15 +12,19 @@
|
|
|
12
12
|
|
|
13
13
|
const props: TabsIndicatorProps = $props();
|
|
14
14
|
|
|
15
|
-
const
|
|
15
|
+
const tabs = TabsRootContext.consume();
|
|
16
16
|
|
|
17
|
-
const { element, ...
|
|
17
|
+
const { element, ...rest } = $derived(props);
|
|
18
18
|
|
|
19
|
-
const attributes = $derived(
|
|
19
|
+
const attributes = $derived(
|
|
20
|
+
mergeProps(tabs().getIndicatorProps(), rest, {
|
|
21
|
+
class: classesTabs.indicator
|
|
22
|
+
})
|
|
23
|
+
);
|
|
20
24
|
</script>
|
|
21
25
|
|
|
22
26
|
{#if element}
|
|
23
|
-
{@render element(
|
|
27
|
+
{@render element(attributes)}
|
|
24
28
|
{:else}
|
|
25
29
|
<div {...attributes}></div>
|
|
26
30
|
{/if}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { HTMLAttributes } from '
|
|
1
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
2
2
|
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
3
|
-
export interface TabsIndicatorProps extends PropsWithElement
|
|
3
|
+
export interface TabsIndicatorProps extends PropsWithElement<'div'>, HTMLAttributes<'div', 'children'> {
|
|
4
4
|
}
|
|
5
5
|
declare const Indicator: import("svelte").Component<TabsIndicatorProps, {}, "">;
|
|
6
6
|
type Indicator = ReturnType<typeof Indicator>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
-
import type { HTMLAttributes } from '
|
|
2
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
3
3
|
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
4
4
|
|
|
5
|
-
export interface TabsListProps extends PropsWithElement
|
|
5
|
+
export interface TabsListProps extends PropsWithElement<'div'>, HTMLAttributes<'div'> {}
|
|
6
6
|
</script>
|
|
7
7
|
|
|
8
8
|
<script lang="ts">
|
|
@@ -12,15 +12,19 @@
|
|
|
12
12
|
|
|
13
13
|
const props: TabsListProps = $props();
|
|
14
14
|
|
|
15
|
-
const
|
|
15
|
+
const tabs = TabsRootContext.consume();
|
|
16
16
|
|
|
17
|
-
const { element, children, ...
|
|
17
|
+
const { element, children, ...rest } = $derived(props);
|
|
18
18
|
|
|
19
|
-
const attributes = $derived(
|
|
19
|
+
const attributes = $derived(
|
|
20
|
+
mergeProps(tabs().getListProps(), rest, {
|
|
21
|
+
class: classesTabs.list
|
|
22
|
+
})
|
|
23
|
+
);
|
|
20
24
|
</script>
|
|
21
25
|
|
|
22
26
|
{#if element}
|
|
23
|
-
{@render element(
|
|
27
|
+
{@render element(attributes)}
|
|
24
28
|
{:else}
|
|
25
29
|
<div {...attributes}>
|
|
26
30
|
{@render children?.()}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { HTMLAttributes } from '
|
|
1
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
2
2
|
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
3
|
-
export interface TabsListProps extends PropsWithElement
|
|
3
|
+
export interface TabsListProps extends PropsWithElement<'div'>, HTMLAttributes<'div'> {
|
|
4
4
|
}
|
|
5
5
|
declare const List: import("svelte").Component<TabsListProps, {}, "">;
|
|
6
6
|
type List = ReturnType<typeof List>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
-
import type {
|
|
3
|
+
import type { useTabs } from '../modules/use-tabs.svelte';
|
|
4
4
|
|
|
5
5
|
export interface TabsRootContextProps {
|
|
6
|
-
children: Snippet<[
|
|
6
|
+
children: Snippet<[ReturnType<typeof useTabs>]>;
|
|
7
7
|
}
|
|
8
8
|
</script>
|
|
9
9
|
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
|
|
13
13
|
const props: TabsRootContextProps = $props();
|
|
14
14
|
|
|
15
|
-
const
|
|
15
|
+
const tabs = TabsRootContext.consume();
|
|
16
|
+
|
|
17
|
+
const { children } = $derived(props);
|
|
16
18
|
</script>
|
|
17
19
|
|
|
18
|
-
{@render
|
|
20
|
+
{@render children(tabs)}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
import type {
|
|
2
|
+
import type { useTabs } from '../modules/use-tabs.svelte';
|
|
3
3
|
export interface TabsRootContextProps {
|
|
4
|
-
children: Snippet<[
|
|
4
|
+
children: Snippet<[ReturnType<typeof useTabs>]>;
|
|
5
5
|
}
|
|
6
6
|
declare const RootContext: import("svelte").Component<TabsRootContextProps, {}, "">;
|
|
7
7
|
type RootContext = ReturnType<typeof RootContext>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
3
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
4
|
+
import type { useTabs } from '../modules/use-tabs.svelte';
|
|
5
|
+
|
|
6
|
+
export interface TabsRootProviderProps extends PropsWithElement<'div'>, HTMLAttributes<'div', 'id' | 'dir'> {
|
|
7
|
+
value: ReturnType<typeof useTabs>;
|
|
8
|
+
}
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<script lang="ts">
|
|
12
|
+
import { classesTabs } from '@skeletonlabs/skeleton-common';
|
|
13
|
+
import { mergeProps } from '@zag-js/svelte';
|
|
14
|
+
import { TabsRootContext } from '../modules/root-context';
|
|
15
|
+
|
|
16
|
+
const props: TabsRootProviderProps = $props();
|
|
17
|
+
const { element, children, value: tabs, ...rest } = $derived(props);
|
|
18
|
+
|
|
19
|
+
const attributes = $derived(
|
|
20
|
+
mergeProps(tabs().getRootProps(), rest, {
|
|
21
|
+
class: classesTabs.root
|
|
22
|
+
})
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
TabsRootContext.provide(() => tabs());
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
{#if element}
|
|
29
|
+
{@render element(attributes)}
|
|
30
|
+
{:else}
|
|
31
|
+
<div {...attributes}>
|
|
32
|
+
{@render children?.()}
|
|
33
|
+
</div>
|
|
34
|
+
{/if}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
2
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
3
|
+
import type { useTabs } from '../modules/use-tabs.svelte';
|
|
4
|
+
export interface TabsRootProviderProps extends PropsWithElement<'div'>, HTMLAttributes<'div', 'id' | 'dir'> {
|
|
5
|
+
value: ReturnType<typeof useTabs>;
|
|
6
|
+
}
|
|
7
|
+
declare const RootProvider: import("svelte").Component<TabsRootProviderProps, {}, "">;
|
|
8
|
+
type RootProvider = ReturnType<typeof RootProvider>;
|
|
9
|
+
export default RootProvider;
|
|
@@ -1,42 +1,39 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
import type { Props } from '@zag-js/tabs';
|
|
3
|
-
import type { HTMLAttributes } from '
|
|
3
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
4
4
|
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
5
5
|
|
|
6
|
-
export interface TabsRootProps
|
|
7
|
-
extends Omit<Props, 'id'>,
|
|
8
|
-
PropsWithElement,
|
|
9
|
-
Omit<HTMLAttributes<HTMLDivElement>, 'id' | 'defaultValue' | 'dir'> {}
|
|
6
|
+
export interface TabsRootProps extends Omit<Props, 'id'>, PropsWithElement<'div'>, HTMLAttributes<'div', 'id' | 'dir'> {}
|
|
10
7
|
</script>
|
|
11
8
|
|
|
12
9
|
<script lang="ts">
|
|
13
|
-
import {
|
|
10
|
+
import { splitProps } from '@zag-js/tabs';
|
|
14
11
|
import { classesTabs } from '@skeletonlabs/skeleton-common';
|
|
15
|
-
import {
|
|
12
|
+
import { mergeProps } from '@zag-js/svelte';
|
|
16
13
|
import { TabsRootContext } from '../modules/root-context';
|
|
14
|
+
import { useTabs } from '../modules/use-tabs.svelte';
|
|
17
15
|
|
|
18
16
|
const props: TabsRootProps = $props();
|
|
19
|
-
const [
|
|
20
|
-
const { element, children, ...
|
|
17
|
+
const [tabsProps, componentProps] = $derived(splitProps(props));
|
|
18
|
+
const { element, children, ...rest } = $derived(componentProps);
|
|
21
19
|
|
|
22
20
|
const id = $props.id();
|
|
23
|
-
const
|
|
21
|
+
const tabs = useTabs(() => ({
|
|
24
22
|
id: id,
|
|
25
|
-
...
|
|
23
|
+
...tabsProps
|
|
26
24
|
}));
|
|
27
|
-
const api = $derived(connect(service, normalizeProps));
|
|
28
25
|
|
|
29
|
-
const attributes = $derived(
|
|
26
|
+
const attributes = $derived(
|
|
27
|
+
mergeProps(tabs().getRootProps(), rest, {
|
|
28
|
+
class: classesTabs.root
|
|
29
|
+
})
|
|
30
|
+
);
|
|
30
31
|
|
|
31
|
-
TabsRootContext.provide(
|
|
32
|
-
get api() {
|
|
33
|
-
return api;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
32
|
+
TabsRootContext.provide(() => tabs());
|
|
36
33
|
</script>
|
|
37
34
|
|
|
38
35
|
{#if element}
|
|
39
|
-
{@render element(
|
|
36
|
+
{@render element(attributes)}
|
|
40
37
|
{:else}
|
|
41
38
|
<div {...attributes}>
|
|
42
39
|
{@render children?.()}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Props } from '@zag-js/tabs';
|
|
2
|
-
import type { HTMLAttributes } from '
|
|
2
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
3
3
|
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
4
|
-
export interface TabsRootProps extends Omit<Props, 'id'>, PropsWithElement
|
|
4
|
+
export interface TabsRootProps extends Omit<Props, 'id'>, PropsWithElement<'div'>, HTMLAttributes<'div', 'id' | 'dir'> {
|
|
5
5
|
}
|
|
6
6
|
declare const Root: import("svelte").Component<TabsRootProps, {}, "">;
|
|
7
7
|
type Root = ReturnType<typeof Root>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
import type { TriggerProps } from '@zag-js/tabs';
|
|
3
|
-
import type {
|
|
3
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
4
4
|
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
5
5
|
|
|
6
|
-
export interface TabsTriggerProps extends TriggerProps, PropsWithElement
|
|
6
|
+
export interface TabsTriggerProps extends TriggerProps, PropsWithElement<'button'>, HTMLAttributes<'button', 'value' | 'disabled'> {}
|
|
7
7
|
</script>
|
|
8
8
|
|
|
9
9
|
<script lang="ts">
|
|
@@ -14,16 +14,20 @@
|
|
|
14
14
|
|
|
15
15
|
const props: TabsTriggerProps = $props();
|
|
16
16
|
|
|
17
|
-
const
|
|
17
|
+
const tabs = TabsRootContext.consume();
|
|
18
18
|
|
|
19
19
|
const [triggerProps, componentProps] = $derived(splitTriggerProps(props));
|
|
20
|
-
const { element, children, ...
|
|
20
|
+
const { element, children, ...rest } = $derived(componentProps);
|
|
21
21
|
|
|
22
|
-
const attributes = $derived(
|
|
22
|
+
const attributes = $derived(
|
|
23
|
+
mergeProps(tabs().getTriggerProps(triggerProps), rest, {
|
|
24
|
+
class: classesTabs.trigger
|
|
25
|
+
})
|
|
26
|
+
);
|
|
23
27
|
</script>
|
|
24
28
|
|
|
25
29
|
{#if element}
|
|
26
|
-
{@render element(
|
|
30
|
+
{@render element(attributes)}
|
|
27
31
|
{:else}
|
|
28
32
|
<button {...attributes}>
|
|
29
33
|
{@render children?.()}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { TriggerProps } from '@zag-js/tabs';
|
|
2
|
-
import type {
|
|
2
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
3
3
|
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
4
|
-
export interface TabsTriggerProps extends TriggerProps, PropsWithElement
|
|
4
|
+
export interface TabsTriggerProps extends TriggerProps, PropsWithElement<'button'>, HTMLAttributes<'button', 'value' | 'disabled'> {
|
|
5
5
|
}
|
|
6
6
|
declare const Trigger: import("svelte").Component<TabsTriggerProps, {}, "">;
|
|
7
7
|
type Trigger = ReturnType<typeof Trigger>;
|
|
@@ -1 +1,9 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { Tabs } from './modules/anatomy';
|
|
2
|
+
export { useTabs } from './modules/use-tabs.svelte';
|
|
3
|
+
export type { TabsRootProps } from './anatomy/root.svelte';
|
|
4
|
+
export type { TabsRootProviderProps } from './anatomy/root-provider.svelte';
|
|
5
|
+
export type { TabsRootContextProps } from './anatomy/root-context.svelte';
|
|
6
|
+
export type { TabsListProps } from './anatomy/list.svelte';
|
|
7
|
+
export type { TabsTriggerProps } from './anatomy/trigger.svelte';
|
|
8
|
+
export type { TabsIndicatorProps } from './anatomy/indicator.svelte';
|
|
9
|
+
export type { TabsContentProps } from './anatomy/content.svelte';
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { Tabs } from './modules/anatomy';
|
|
2
|
+
export { useTabs } from './modules/use-tabs.svelte';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare const Tabs: import("svelte").Component<import("../anatomy/root.svelte").TabsRootProps, {}, ""> & {
|
|
2
|
+
Provider: import("svelte").Component<import("../anatomy/root-provider.svelte").TabsRootProviderProps, {}, "">;
|
|
2
3
|
Context: import("svelte").Component<import("../anatomy/root-context.svelte").TabsRootContextProps, {}, "">;
|
|
3
4
|
List: import("svelte").Component<import("../anatomy/list.svelte").TabsListProps, {}, "">;
|
|
4
5
|
Trigger: import("svelte").Component<import("../anatomy/trigger.svelte").TabsTriggerProps, {}, "">;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import Root from '../anatomy/root.svelte';
|
|
2
|
+
import RootProvider from '../anatomy/root-provider.svelte';
|
|
2
3
|
import RootContext from '../anatomy/root-context.svelte';
|
|
3
4
|
import List from '../anatomy/list.svelte';
|
|
4
5
|
import Trigger from '../anatomy/trigger.svelte';
|
|
5
6
|
import Indicator from '../anatomy/indicator.svelte';
|
|
6
7
|
import Content from '../anatomy/content.svelte';
|
|
7
8
|
export const Tabs = Object.assign(Root, {
|
|
9
|
+
Provider: RootProvider,
|
|
8
10
|
Context: RootContext,
|
|
9
11
|
List: List,
|
|
10
12
|
Trigger: Trigger,
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { connect, machine } from '@zag-js/tabs';
|
|
2
|
+
import { useMachine, normalizeProps } from '@zag-js/svelte';
|
|
3
|
+
export function useTabs(props) {
|
|
4
|
+
const service = useMachine(machine, props);
|
|
5
|
+
const tabs = $derived(connect(service, normalizeProps));
|
|
6
|
+
return () => tabs;
|
|
7
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
3
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
4
|
+
|
|
5
|
+
export interface ToastActionTriggerProps extends PropsWithElement<'button'>, HTMLAttributes<'button'> {}
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import { mergeProps } from '@zag-js/svelte';
|
|
10
|
+
import { classesToast } from '@skeletonlabs/skeleton-common';
|
|
11
|
+
import { ToastRootContext } from '../modules/root-context';
|
|
12
|
+
|
|
13
|
+
const props: ToastActionTriggerProps = $props();
|
|
14
|
+
|
|
15
|
+
const toast = ToastRootContext.consume();
|
|
16
|
+
|
|
17
|
+
const { element, children, ...rest } = $derived(props);
|
|
18
|
+
|
|
19
|
+
const attributes = $derived(
|
|
20
|
+
mergeProps(toast().getActionTriggerProps(), rest, {
|
|
21
|
+
class: classesToast.actionTrigger
|
|
22
|
+
})
|
|
23
|
+
);
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
{#if element}
|
|
27
|
+
{@render element(attributes)}
|
|
28
|
+
{:else}
|
|
29
|
+
<button {...attributes}>
|
|
30
|
+
{@render children?.()}
|
|
31
|
+
</button>
|
|
32
|
+
{/if}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
2
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
3
|
+
export interface ToastActionTriggerProps extends PropsWithElement<'button'>, HTMLAttributes<'button'> {
|
|
4
|
+
}
|
|
5
|
+
declare const ActionTrigger: import("svelte").Component<ToastActionTriggerProps, {}, "">;
|
|
6
|
+
type ActionTrigger = ReturnType<typeof ActionTrigger>;
|
|
7
|
+
export default ActionTrigger;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
3
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
4
|
+
|
|
5
|
+
export interface ToastCloseTriggerProps extends PropsWithElement<'button'>, HTMLAttributes<'button'> {}
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import { mergeProps } from '@zag-js/svelte';
|
|
10
|
+
import { classesToast } from '@skeletonlabs/skeleton-common';
|
|
11
|
+
import { ToastRootContext } from '../modules/root-context';
|
|
12
|
+
import X from '../../../internal/components/x.svelte';
|
|
13
|
+
|
|
14
|
+
const props: ToastCloseTriggerProps = $props();
|
|
15
|
+
|
|
16
|
+
const toast = ToastRootContext.consume();
|
|
17
|
+
|
|
18
|
+
const { element, children = x, ...rest } = $derived(props);
|
|
19
|
+
|
|
20
|
+
const attributes = $derived(
|
|
21
|
+
mergeProps(toast().getCloseTriggerProps(), rest, {
|
|
22
|
+
class: classesToast.closeTrigger
|
|
23
|
+
})
|
|
24
|
+
);
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
{#snippet x()}
|
|
28
|
+
<X />
|
|
29
|
+
{/snippet}
|
|
30
|
+
|
|
31
|
+
{#if element}
|
|
32
|
+
{@render element(attributes)}
|
|
33
|
+
{:else}
|
|
34
|
+
<button {...attributes}>
|
|
35
|
+
{@render children?.()}
|
|
36
|
+
</button>
|
|
37
|
+
{/if}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
2
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
3
|
+
export interface ToastCloseTriggerProps extends PropsWithElement<'button'>, HTMLAttributes<'button'> {
|
|
4
|
+
}
|
|
5
|
+
declare const CloseTrigger: import("svelte").Component<ToastCloseTriggerProps, {}, "">;
|
|
6
|
+
type CloseTrigger = ReturnType<typeof CloseTrigger>;
|
|
7
|
+
export default CloseTrigger;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
3
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
4
|
+
|
|
5
|
+
export interface ToastDescriptionProps extends PropsWithElement<'div'>, HTMLAttributes<'div'> {}
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import { mergeProps } from '@zag-js/svelte';
|
|
10
|
+
import { classesToast } from '@skeletonlabs/skeleton-common';
|
|
11
|
+
import { ToastRootContext } from '../modules/root-context';
|
|
12
|
+
|
|
13
|
+
const props: ToastDescriptionProps = $props();
|
|
14
|
+
|
|
15
|
+
const toast = ToastRootContext.consume();
|
|
16
|
+
|
|
17
|
+
const { element, children, ...rest } = $derived(props);
|
|
18
|
+
|
|
19
|
+
const attributes = $derived(
|
|
20
|
+
mergeProps(toast().getDescriptionProps(), rest, {
|
|
21
|
+
class: classesToast.description
|
|
22
|
+
})
|
|
23
|
+
);
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
{#if element}
|
|
27
|
+
{@render element(attributes)}
|
|
28
|
+
{:else}
|
|
29
|
+
<div {...attributes}>
|
|
30
|
+
{@render children?.()}
|
|
31
|
+
</div>
|
|
32
|
+
{/if}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
2
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
3
|
+
export interface ToastDescriptionProps extends PropsWithElement<'div'>, HTMLAttributes<'div'> {
|
|
4
|
+
}
|
|
5
|
+
declare const Description: import("svelte").Component<ToastDescriptionProps, {}, "">;
|
|
6
|
+
type Description = ReturnType<typeof Description>;
|
|
7
|
+
export default Description;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
3
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
4
|
+
import type { Store, Props } from '@zag-js/toast';
|
|
5
|
+
import type { Snippet } from 'svelte';
|
|
6
|
+
|
|
7
|
+
export interface ToastGroupProps extends PropsWithElement<'div'>, HTMLAttributes<'div', 'id' | 'dir' | 'children'> {
|
|
8
|
+
toaster: Store;
|
|
9
|
+
children?: Snippet<[Props]>;
|
|
10
|
+
}
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<script lang="ts">
|
|
14
|
+
import { useMachine, normalizeProps, mergeProps } from '@zag-js/svelte';
|
|
15
|
+
import { classesToast } from '@skeletonlabs/skeleton-common';
|
|
16
|
+
import { ToastGroupContext } from '../modules/group-context';
|
|
17
|
+
import { group } from '@zag-js/toast';
|
|
18
|
+
|
|
19
|
+
const props: ToastGroupProps = $props();
|
|
20
|
+
|
|
21
|
+
const { element, children, toaster, ...rest } = $derived(props);
|
|
22
|
+
|
|
23
|
+
const id = $props.id();
|
|
24
|
+
const service = useMachine(group.machine, () => ({
|
|
25
|
+
id: id,
|
|
26
|
+
store: toaster
|
|
27
|
+
}));
|
|
28
|
+
const api = $derived(group.connect(service, normalizeProps));
|
|
29
|
+
|
|
30
|
+
const attributes = $derived(
|
|
31
|
+
mergeProps(api.getGroupProps(), rest, {
|
|
32
|
+
class: classesToast.group
|
|
33
|
+
})
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
ToastGroupContext.provide(() => service);
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
{#if element}
|
|
40
|
+
{@render element(attributes)}
|
|
41
|
+
{:else}
|
|
42
|
+
<div {...attributes}>
|
|
43
|
+
{#each api.getToasts() as toast (toast.id)}
|
|
44
|
+
{@render children?.(toast)}
|
|
45
|
+
{/each}
|
|
46
|
+
</div>
|
|
47
|
+
{/if}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
2
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
3
|
+
import type { Store, Props } from '@zag-js/toast';
|
|
4
|
+
import type { Snippet } from 'svelte';
|
|
5
|
+
export interface ToastGroupProps extends PropsWithElement<'div'>, HTMLAttributes<'div', 'id' | 'dir' | 'children'> {
|
|
6
|
+
toaster: Store;
|
|
7
|
+
children?: Snippet<[Props]>;
|
|
8
|
+
}
|
|
9
|
+
declare const Group: import("svelte").Component<ToastGroupProps, {}, "">;
|
|
10
|
+
type Group = ReturnType<typeof Group>;
|
|
11
|
+
export default Group;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
3
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
4
|
+
|
|
5
|
+
export interface ToastMessageProps extends PropsWithElement<'div'>, HTMLAttributes<'div'> {}
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import { mergeProps } from '@zag-js/svelte';
|
|
10
|
+
import { classesToast } from '@skeletonlabs/skeleton-common';
|
|
11
|
+
|
|
12
|
+
const props: ToastMessageProps = $props();
|
|
13
|
+
|
|
14
|
+
const { element, children, ...rest } = $derived(props);
|
|
15
|
+
|
|
16
|
+
const attributes = $derived(
|
|
17
|
+
mergeProps(rest, {
|
|
18
|
+
class: classesToast.message
|
|
19
|
+
})
|
|
20
|
+
);
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
{#if element}
|
|
24
|
+
{@render element(attributes)}
|
|
25
|
+
{:else}
|
|
26
|
+
<div {...attributes}>
|
|
27
|
+
{@render children?.()}
|
|
28
|
+
</div>
|
|
29
|
+
{/if}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PropsWithElement } from '../../../internal/props-with-element';
|
|
2
|
+
import type { HTMLAttributes } from '../../../internal/html-attributes';
|
|
3
|
+
export interface ToastMessageProps extends PropsWithElement<'div'>, HTMLAttributes<'div'> {
|
|
4
|
+
}
|
|
5
|
+
declare const Message: import("svelte").Component<ToastMessageProps, {}, "">;
|
|
6
|
+
type Message = ReturnType<typeof Message>;
|
|
7
|
+
export default Message;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { Api } from '@zag-js/toast';
|
|
4
|
+
|
|
5
|
+
export interface ToastRootContextProps {
|
|
6
|
+
children: Snippet<[() => Api]>;
|
|
7
|
+
}
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<script lang="ts">
|
|
11
|
+
import { ToastRootContext } from '../modules/root-context';
|
|
12
|
+
|
|
13
|
+
const props: ToastRootContextProps = $props();
|
|
14
|
+
|
|
15
|
+
const toast = ToastRootContext.consume();
|
|
16
|
+
|
|
17
|
+
const { children } = $derived(props);
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
{@render children(toast)}
|