@skeletonlabs/skeleton-svelte 2.0.0-next.1 → 2.0.0-next.2

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.
Files changed (102) hide show
  1. package/dist/components/accordion/anatomy/accordion-content.svelte +9 -2
  2. package/dist/components/accordion/anatomy/accordion-content.svelte.d.ts +4 -1
  3. package/dist/components/accordion/anatomy/accordion-heading.svelte +14 -1
  4. package/dist/components/accordion/anatomy/accordion-heading.svelte.d.ts +10 -1
  5. package/dist/components/accordion/anatomy/accordion-indicator.svelte +9 -2
  6. package/dist/components/accordion/anatomy/accordion-indicator.svelte.d.ts +4 -1
  7. package/dist/components/accordion/anatomy/accordion-item-context.svelte +17 -0
  8. package/dist/components/accordion/anatomy/accordion-item-context.svelte.d.ts +9 -0
  9. package/dist/components/accordion/anatomy/accordion-item.svelte +15 -4
  10. package/dist/components/accordion/anatomy/accordion-item.svelte.d.ts +5 -1
  11. package/dist/components/accordion/anatomy/accordion-root-context.svelte +17 -0
  12. package/dist/components/accordion/anatomy/accordion-root-context.svelte.d.ts +9 -0
  13. package/dist/components/accordion/anatomy/accordion-root.svelte +16 -6
  14. package/dist/components/accordion/anatomy/accordion-root.svelte.d.ts +5 -1
  15. package/dist/components/accordion/anatomy/accordion-trigger.svelte +9 -2
  16. package/dist/components/accordion/anatomy/accordion-trigger.svelte.d.ts +4 -1
  17. package/dist/components/accordion/index.d.ts +11 -2
  18. package/dist/components/accordion/index.js +1 -2
  19. package/dist/components/accordion/modules/accordion-anatomy.d.ts +9 -0
  20. package/dist/components/accordion/modules/{anatomy.js → accordion-anatomy.js} +5 -2
  21. package/dist/components/accordion/modules/accordion-item-context.d.ts +10 -0
  22. package/dist/components/accordion/modules/accordion-item-context.js +2 -0
  23. package/dist/components/accordion/modules/accordion-root-context.d.ts +9 -0
  24. package/dist/components/accordion/modules/accordion-root-context.js +2 -0
  25. package/dist/components/avatar/anatomy/avatar-fallback.svelte +8 -2
  26. package/dist/components/avatar/anatomy/avatar-fallback.svelte.d.ts +4 -1
  27. package/dist/components/avatar/anatomy/avatar-image.svelte +8 -2
  28. package/dist/components/avatar/anatomy/avatar-image.svelte.d.ts +4 -1
  29. package/dist/components/avatar/anatomy/avatar-root-context.svelte +17 -0
  30. package/dist/components/avatar/anatomy/avatar-root-context.svelte.d.ts +9 -0
  31. package/dist/components/avatar/anatomy/avatar-root.svelte +13 -6
  32. package/dist/components/avatar/anatomy/avatar-root.svelte.d.ts +5 -1
  33. package/dist/components/avatar/index.d.ts +6 -2
  34. package/dist/components/avatar/index.js +1 -2
  35. package/dist/components/avatar/modules/avatar-anatomy.d.ts +5 -0
  36. package/dist/components/avatar/modules/{anatomy.js → avatar-anatomy.js} +3 -2
  37. package/dist/components/avatar/modules/avatar-root-context.d.ts +9 -0
  38. package/dist/components/avatar/modules/avatar-root-context.js +2 -0
  39. package/dist/components/rating-group/anatomy/rating-group-control.svelte +31 -0
  40. package/dist/components/rating-group/anatomy/rating-group-control.svelte.d.ts +7 -0
  41. package/dist/components/rating-group/anatomy/rating-group-hidden-input.svelte +33 -0
  42. package/dist/components/rating-group/anatomy/rating-group-hidden-input.svelte.d.ts +7 -0
  43. package/dist/components/rating-group/anatomy/rating-group-item-context.svelte +17 -0
  44. package/dist/components/rating-group/anatomy/rating-group-item-context.svelte.d.ts +9 -0
  45. package/dist/components/rating-group/anatomy/rating-group-item.svelte +89 -0
  46. package/dist/components/rating-group/anatomy/rating-group-item.svelte.d.ts +27 -0
  47. package/dist/components/rating-group/anatomy/rating-group-label.svelte +31 -0
  48. package/dist/components/rating-group/anatomy/rating-group-label.svelte.d.ts +7 -0
  49. package/dist/components/rating-group/anatomy/rating-group-root-context.svelte +17 -0
  50. package/dist/components/rating-group/anatomy/rating-group-root-context.svelte.d.ts +9 -0
  51. package/dist/components/rating-group/anatomy/rating-group-root.svelte +52 -0
  52. package/dist/components/rating-group/anatomy/rating-group-root.svelte.d.ts +8 -0
  53. package/dist/components/rating-group/index.d.ts +10 -0
  54. package/dist/components/rating-group/index.js +1 -0
  55. package/dist/components/rating-group/modules/rating-group-anatomy.d.ts +8 -0
  56. package/dist/components/rating-group/modules/rating-group-anatomy.js +15 -0
  57. package/dist/components/rating-group/modules/rating-group-item-context.d.ts +9 -0
  58. package/dist/components/rating-group/modules/rating-group-item-context.js +2 -0
  59. package/dist/components/rating-group/modules/rating-group-root-context.d.ts +9 -0
  60. package/dist/components/rating-group/modules/rating-group-root-context.js +2 -0
  61. package/dist/components/tabs/anatomy/tabs-content.svelte +36 -0
  62. package/dist/components/tabs/anatomy/tabs-content.svelte.d.ts +8 -0
  63. package/dist/components/tabs/anatomy/tabs-indicator.svelte +31 -0
  64. package/dist/components/tabs/anatomy/tabs-indicator.svelte.d.ts +7 -0
  65. package/dist/components/tabs/anatomy/tabs-list.svelte +33 -0
  66. package/dist/components/tabs/anatomy/tabs-list.svelte.d.ts +7 -0
  67. package/dist/components/tabs/anatomy/tabs-root-context.svelte +17 -0
  68. package/dist/components/tabs/anatomy/tabs-root-context.svelte.d.ts +9 -0
  69. package/dist/components/tabs/anatomy/tabs-root.svelte +49 -0
  70. package/dist/components/tabs/anatomy/tabs-root.svelte.d.ts +8 -0
  71. package/dist/components/tabs/anatomy/tabs-trigger.svelte +36 -0
  72. package/dist/components/tabs/anatomy/tabs-trigger.svelte.d.ts +8 -0
  73. package/dist/components/tabs/index.d.ts +1 -0
  74. package/dist/components/tabs/index.js +1 -0
  75. package/dist/components/tabs/modules/tabs-anatomy.d.ts +7 -0
  76. package/dist/components/tabs/modules/tabs-anatomy.js +13 -0
  77. package/dist/components/tabs/modules/tabs-root-context.d.ts +9 -0
  78. package/dist/components/tabs/modules/tabs-root-context.js +2 -0
  79. package/dist/index.d.ts +2 -0
  80. package/dist/index.js +2 -0
  81. package/dist/internal/components/star-empty.svelte +12 -0
  82. package/dist/internal/components/star-empty.svelte.d.ts +26 -0
  83. package/dist/internal/components/star-full.svelte +12 -0
  84. package/dist/internal/components/star-full.svelte.d.ts +26 -0
  85. package/dist/internal/components/star-half.svelte +19 -0
  86. package/dist/internal/components/star-half.svelte.d.ts +26 -0
  87. package/dist/internal/create-context.d.ts +5 -6
  88. package/dist/internal/create-context.js +10 -9
  89. package/dist/internal/props-with-element.d.ts +3 -0
  90. package/package.json +2 -3
  91. package/dist/components/accordion/modules/anatomy.d.ts +0 -8
  92. package/dist/components/accordion/modules/context.d.ts +0 -12
  93. package/dist/components/accordion/modules/context.js +0 -4
  94. package/dist/components/accordion/modules/types.d.ts +0 -29
  95. package/dist/components/accordion/modules/types.js +0 -1
  96. package/dist/components/avatar/modules/anatomy.d.ts +0 -5
  97. package/dist/components/avatar/modules/context.d.ts +0 -7
  98. package/dist/components/avatar/modules/context.js +0 -3
  99. package/dist/components/avatar/modules/types.d.ts +0 -14
  100. package/dist/components/avatar/modules/types.js +0 -1
  101. package/dist/internal/create-context-new.d.ts +0 -5
  102. package/dist/internal/create-context-new.js +0 -13
@@ -0,0 +1,7 @@
1
+ import type { HTMLInputAttributes } from 'svelte/elements';
2
+ import type { PropsWithElement } from '../../../internal/props-with-element.js';
3
+ export interface RatingGroupHiddenInputProps extends PropsWithElement, Omit<HTMLInputAttributes, 'id' | 'defaultValue' | 'dir' | 'children'> {
4
+ }
5
+ declare const RatingGroupHiddenInput: import("svelte").Component<RatingGroupHiddenInputProps, {}, "">;
6
+ type RatingGroupHiddenInput = ReturnType<typeof RatingGroupHiddenInput>;
7
+ export default RatingGroupHiddenInput;
@@ -0,0 +1,17 @@
1
+ <script lang="ts" module>
2
+ import type { Snippet } from 'svelte';
3
+ import type { RatingGroupItemContextType } from '../modules/rating-group-item-context.js';
4
+
5
+ export interface RatingGroupItemContextProps {
6
+ children: Snippet<[RatingGroupItemContextType]>;
7
+ }
8
+ </script>
9
+
10
+ <script lang="ts">
11
+ import { RatingGroupItemContext } from '../modules/rating-group-item-context.js';
12
+
13
+ const props: RatingGroupItemContextProps = $props();
14
+ const itemContext = RatingGroupItemContext.consume();
15
+ </script>
16
+
17
+ {@render props.children(itemContext)}
@@ -0,0 +1,9 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { RatingGroupItemContextType } from '../modules/rating-group-item-context.js';
3
+ export interface RatingGroupItemContextProps {
4
+ children: Snippet<[RatingGroupItemContextType]>;
5
+ }
6
+ import { RatingGroupItemContext } from '../modules/rating-group-item-context.js';
7
+ declare const RatingGroupItemContext: import("svelte").Component<RatingGroupItemContextProps, {}, "">;
8
+ type RatingGroupItemContext = ReturnType<typeof RatingGroupItemContext>;
9
+ export default RatingGroupItemContext;
@@ -0,0 +1,89 @@
1
+ <script lang="ts" module>
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ import type { PropsWithElement } from '../../../internal/props-with-element.js';
4
+ import type { ItemProps } from '@zag-js/rating-group';
5
+
6
+ export interface RatingGroupItemProps
7
+ extends PropsWithElement,
8
+ ItemProps,
9
+ Omit<HTMLAttributes<HTMLSpanElement>, 'id' | 'defaultValue' | 'dir'> {
10
+ /**
11
+ * The content to render when the item is in the empty state.
12
+ *
13
+ * @default StarEmpty (SVG)
14
+ */
15
+ empty?: Snippet;
16
+ /**
17
+ * The content to render when the item is in the half state.
18
+ *
19
+ * @default StarHalf (SVG)
20
+ */
21
+ half?: Snippet;
22
+ /**
23
+ * The content to render when the item is in the full state.
24
+ *
25
+ * @default StarFull (SVG)
26
+ */
27
+ full?: Snippet;
28
+ }
29
+ </script>
30
+
31
+ <script lang="ts">
32
+ import { mergeProps } from '@zag-js/svelte';
33
+ import { classesRatingGroup } from '@skeletonlabs/skeleton-common';
34
+ import { splitItemProps } from '@zag-js/rating-group';
35
+ import { RatingGroupRootContext } from '../modules/rating-group-root-context.js';
36
+ import { RatingGroupItemContext } from '../modules/rating-group-item-context.js';
37
+ import StarFull from '../../../internal/components/star-full.svelte';
38
+ import StarEmpty from '../../../internal/components/star-empty.svelte';
39
+ import StarHalf from '../../../internal/components/star-half.svelte';
40
+ import type { Snippet } from 'svelte';
41
+
42
+ const rootContext = RatingGroupRootContext.consume();
43
+ const props: RatingGroupItemProps = $props();
44
+ const [itemProps, componentProps] = $derived(splitItemProps(props));
45
+ const { element, children, empty = starEmpty, half = starHalf, full = starFull, ...restAttributes } = $derived(componentProps);
46
+ const attributes = $derived(
47
+ mergeProps(
48
+ rootContext.api.getItemProps(itemProps),
49
+ {
50
+ class: classesRatingGroup.item
51
+ },
52
+ restAttributes
53
+ )
54
+ );
55
+ const itemState = $derived(rootContext.api.getItemState(itemProps));
56
+ RatingGroupItemContext.provide({
57
+ get itemState() {
58
+ return itemState;
59
+ }
60
+ });
61
+ </script>
62
+
63
+ {#snippet starEmpty()}
64
+ <StarEmpty />
65
+ {/snippet}
66
+
67
+ {#snippet starHalf()}
68
+ <StarHalf />
69
+ {/snippet}
70
+
71
+ {#snippet starFull()}
72
+ <StarFull />
73
+ {/snippet}
74
+
75
+ {#if element}
76
+ {@render element({ attributes })}
77
+ {:else}
78
+ <div {...attributes}>
79
+ {#if children}
80
+ {@render children()}
81
+ {:else if !itemState.highlighted}
82
+ {@render empty?.()}
83
+ {:else if itemState.half}
84
+ {@render half?.()}
85
+ {:else}
86
+ {@render full?.()}
87
+ {/if}
88
+ </div>
89
+ {/if}
@@ -0,0 +1,27 @@
1
+ import type { HTMLAttributes } from 'svelte/elements';
2
+ import type { PropsWithElement } from '../../../internal/props-with-element.js';
3
+ import type { ItemProps } from '@zag-js/rating-group';
4
+ export interface RatingGroupItemProps extends PropsWithElement, ItemProps, Omit<HTMLAttributes<HTMLSpanElement>, 'id' | 'defaultValue' | 'dir'> {
5
+ /**
6
+ * The content to render when the item is in the empty state.
7
+ *
8
+ * @default StarEmpty (SVG)
9
+ */
10
+ empty?: Snippet;
11
+ /**
12
+ * The content to render when the item is in the half state.
13
+ *
14
+ * @default StarHalf (SVG)
15
+ */
16
+ half?: Snippet;
17
+ /**
18
+ * The content to render when the item is in the full state.
19
+ *
20
+ * @default StarFull (SVG)
21
+ */
22
+ full?: Snippet;
23
+ }
24
+ import type { Snippet } from 'svelte';
25
+ declare const RatingGroupItem: import("svelte").Component<RatingGroupItemProps, {}, "">;
26
+ type RatingGroupItem = ReturnType<typeof RatingGroupItem>;
27
+ export default RatingGroupItem;
@@ -0,0 +1,31 @@
1
+ <script lang="ts" module>
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ import type { PropsWithElement } from '../../../internal/props-with-element.js';
4
+
5
+ export interface RatingGroupLabelProps extends PropsWithElement, Omit<HTMLAttributes<HTMLLabelElement>, 'id' | 'defaultValue' | 'dir'> {}
6
+ </script>
7
+
8
+ <script lang="ts">
9
+ import { mergeProps } from '@zag-js/svelte';
10
+ import { classesRatingGroup } from '@skeletonlabs/skeleton-common';
11
+ import { RatingGroupRootContext } from '../modules/rating-group-root-context.js';
12
+
13
+ const rootContext = RatingGroupRootContext.consume();
14
+ const props: RatingGroupLabelProps = $props();
15
+ const { element, children, ...restAttributes } = $derived(props);
16
+ const attributes = $derived(
17
+ mergeProps(
18
+ rootContext.api.getControlProps(),
19
+ {
20
+ class: classesRatingGroup.label
21
+ },
22
+ restAttributes
23
+ )
24
+ );
25
+ </script>
26
+
27
+ {#if element}
28
+ {@render element({ attributes })}
29
+ {:else}
30
+ <label {...attributes}>{@render children?.()}</label>
31
+ {/if}
@@ -0,0 +1,7 @@
1
+ import type { HTMLAttributes } from 'svelte/elements';
2
+ import type { PropsWithElement } from '../../../internal/props-with-element.js';
3
+ export interface RatingGroupLabelProps extends PropsWithElement, Omit<HTMLAttributes<HTMLLabelElement>, 'id' | 'defaultValue' | 'dir'> {
4
+ }
5
+ declare const RatingGroupLabel: import("svelte").Component<RatingGroupLabelProps, {}, "">;
6
+ type RatingGroupLabel = ReturnType<typeof RatingGroupLabel>;
7
+ export default RatingGroupLabel;
@@ -0,0 +1,17 @@
1
+ <script lang="ts" module>
2
+ import type { Snippet } from 'svelte';
3
+ import type { RatingGroupRootContextType } from '../modules/rating-group-root-context.js';
4
+
5
+ export interface RatingGroupRootContextProps {
6
+ children: Snippet<[RatingGroupRootContextType]>;
7
+ }
8
+ </script>
9
+
10
+ <script lang="ts">
11
+ import { RatingGroupRootContext } from '../modules/rating-group-root-context.js';
12
+
13
+ const props: RatingGroupRootContextProps = $props();
14
+ const rootContext = RatingGroupRootContext.consume();
15
+ </script>
16
+
17
+ {@render props.children(rootContext)}
@@ -0,0 +1,9 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { RatingGroupRootContextType } from '../modules/rating-group-root-context.js';
3
+ export interface RatingGroupRootContextProps {
4
+ children: Snippet<[RatingGroupRootContextType]>;
5
+ }
6
+ import { RatingGroupRootContext } from '../modules/rating-group-root-context.js';
7
+ declare const RatingGroupRootContext: import("svelte").Component<RatingGroupRootContextProps, {}, "">;
8
+ type RatingGroupRootContext = ReturnType<typeof RatingGroupRootContext>;
9
+ export default RatingGroupRootContext;
@@ -0,0 +1,52 @@
1
+ <script lang="ts" module>
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ import type { PropsWithElement } from '../../../internal/props-with-element.js';
4
+ import type { Props } from '@zag-js/rating-group';
5
+
6
+ export interface RatingGroupRootProps
7
+ extends PropsWithElement,
8
+ Omit<Props, 'id'>,
9
+ Omit<HTMLAttributes<HTMLDivElement>, 'id' | 'defaultValue' | 'dir'> {}
10
+ </script>
11
+
12
+ <script lang="ts">
13
+ import { mergeProps, normalizeProps, useMachine } from '@zag-js/svelte';
14
+ import { splitProps, machine, connect } from '@zag-js/rating-group';
15
+ import { classesRatingGroup } from '@skeletonlabs/skeleton-common';
16
+ import { RatingGroupRootContext } from '../modules/rating-group-root-context.js';
17
+
18
+ const props: RatingGroupRootProps = $props();
19
+ // @ts-expect-error - https://github.com/chakra-ui/zag/issues/2672
20
+ const [machineProps, componentProps] = $derived(splitProps(props));
21
+ // @ts-expect-error - https://github.com/chakra-ui/zag/issues/2672
22
+ const { element, children, ...restAttributes } = $derived(componentProps);
23
+ const id = $props.id();
24
+ const service = useMachine(machine, () => ({
25
+ // @ts-expect-error - https://github.com/chakra-ui/zag/issues/2672
26
+ id: id,
27
+ ...machineProps
28
+ }));
29
+ const api = $derived(connect(service, normalizeProps));
30
+ const attributes = $derived(
31
+ mergeProps(
32
+ api.getRootProps(),
33
+ {
34
+ class: classesRatingGroup.root
35
+ },
36
+ restAttributes
37
+ )
38
+ );
39
+ RatingGroupRootContext.provide({
40
+ get api() {
41
+ return api;
42
+ }
43
+ });
44
+ </script>
45
+
46
+ {#if element}
47
+ {@render element({ attributes })}
48
+ {:else}
49
+ <div {...attributes}>
50
+ {@render children?.()}
51
+ </div>
52
+ {/if}
@@ -0,0 +1,8 @@
1
+ import type { HTMLAttributes } from 'svelte/elements';
2
+ import type { PropsWithElement } from '../../../internal/props-with-element.js';
3
+ import type { Props } from '@zag-js/rating-group';
4
+ export interface RatingGroupRootProps extends PropsWithElement, Omit<Props, 'id'>, Omit<HTMLAttributes<HTMLDivElement>, 'id' | 'defaultValue' | 'dir'> {
5
+ }
6
+ declare const RatingGroupRoot: import("svelte").Component<RatingGroupRootProps, {}, "">;
7
+ type RatingGroupRoot = ReturnType<typeof RatingGroupRoot>;
8
+ export default RatingGroupRoot;
@@ -0,0 +1,10 @@
1
+ export { RatingGroup } from './modules/rating-group-anatomy';
2
+ export type { RatingGroupRootProps } from './anatomy/rating-group-root.svelte';
3
+ export type { RatingGroupRootContextProps } from './anatomy/rating-group-root-context.svelte';
4
+ export type { RatingGroupLabelProps } from './anatomy/rating-group-label.svelte';
5
+ export type { RatingGroupControlProps } from './anatomy/rating-group-control.svelte';
6
+ export type { RatingGroupItemProps } from './anatomy/rating-group-item.svelte';
7
+ export type { RatingGroupItemContextProps } from './anatomy/rating-group-item-context.svelte';
8
+ export type { RatingGroupHiddenInputProps } from './anatomy/rating-group-hidden-input.svelte';
9
+ export type { RatingGroupRootContextType as RatingGroupRootContext } from './modules/rating-group-root-context.js';
10
+ export type { RatingGroupItemContextType as RatingGroupItemContext } from './modules/rating-group-item-context.js';
@@ -0,0 +1 @@
1
+ export { RatingGroup } from './modules/rating-group-anatomy';
@@ -0,0 +1,8 @@
1
+ export declare const RatingGroup: import("svelte").Component<import("../anatomy/rating-group-root.svelte").RatingGroupRootProps, {}, ""> & {
2
+ Context: import("svelte").Component<import("../anatomy/rating-group-root-context.svelte").RatingGroupRootContextProps, {}, "">;
3
+ Label: import("svelte").Component<import("../anatomy/rating-group-label.svelte").RatingGroupLabelProps, {}, "">;
4
+ Control: import("svelte").Component<import("../anatomy/rating-group-control.svelte").RatingGroupControlProps, {}, "">;
5
+ Item: import("svelte").Component<import("../anatomy/rating-group-item.svelte").RatingGroupItemProps, {}, "">;
6
+ ItemContext: import("svelte").Component<import("../anatomy/rating-group-item-context.svelte").RatingGroupItemContextProps, {}, "">;
7
+ HiddenInput: import("svelte").Component<import("../anatomy/rating-group-hidden-input.svelte").RatingGroupHiddenInputProps, {}, "">;
8
+ };
@@ -0,0 +1,15 @@
1
+ import RatingGroupRoot from '../anatomy/rating-group-root.svelte';
2
+ import RatingGroupLabel from '../anatomy/rating-group-label.svelte';
3
+ import RatingGroupControl from '../anatomy/rating-group-control.svelte';
4
+ import RatingGroupItem from '../anatomy/rating-group-item.svelte';
5
+ import RatingGroupHiddenInput from '../anatomy/rating-group-hidden-input.svelte';
6
+ import RatingGroupRootContext from '../anatomy/rating-group-root-context.svelte';
7
+ import RatingGroupItemContext from '../anatomy/rating-group-item-context.svelte';
8
+ export const RatingGroup = Object.assign(RatingGroupRoot, {
9
+ Context: RatingGroupRootContext,
10
+ Label: RatingGroupLabel,
11
+ Control: RatingGroupControl,
12
+ Item: RatingGroupItem,
13
+ ItemContext: RatingGroupItemContext,
14
+ HiddenInput: RatingGroupHiddenInput
15
+ });
@@ -0,0 +1,9 @@
1
+ import type { ItemState } from '@zag-js/rating-group';
2
+ export interface RatingGroupItemContextType {
3
+ itemState: ItemState;
4
+ }
5
+ export declare const RatingGroupItemContext: {
6
+ key: symbol;
7
+ consume(): RatingGroupItemContextType;
8
+ provide(value: RatingGroupItemContextType): RatingGroupItemContextType;
9
+ };
@@ -0,0 +1,2 @@
1
+ import { createContext } from '../../../internal/create-context.js';
2
+ export const RatingGroupItemContext = createContext();
@@ -0,0 +1,9 @@
1
+ import type { Api } from '@zag-js/rating-group';
2
+ export interface RatingGroupRootContextType {
3
+ api: Api;
4
+ }
5
+ export declare const RatingGroupRootContext: {
6
+ key: symbol;
7
+ consume(): RatingGroupRootContextType;
8
+ provide(value: RatingGroupRootContextType): RatingGroupRootContextType;
9
+ };
@@ -0,0 +1,2 @@
1
+ import { createContext } from '../../../internal/create-context.js';
2
+ export const RatingGroupRootContext = createContext();
@@ -0,0 +1,36 @@
1
+ <script lang="ts" module>
2
+ import type { ContentProps } from '@zag-js/tabs';
3
+ import type { HTMLAttributes } from 'svelte/elements';
4
+ import type { PropsWithElement } from '../../../internal/props-with-element.js';
5
+
6
+ export interface TabsContentProps extends ContentProps, PropsWithElement, HTMLAttributes<HTMLDivElement> {}
7
+ </script>
8
+
9
+ <script lang="ts">
10
+ import { TabsRootContext } from '../modules/tabs-root-context.js';
11
+ import { mergeProps } from '@zag-js/svelte';
12
+ import { classesTabs } from '@skeletonlabs/skeleton-common';
13
+ import { splitContentProps } from '@zag-js/tabs';
14
+
15
+ const props: TabsContentProps = $props();
16
+ const rootContext = TabsRootContext.consume();
17
+ const [contentProps, componentProps] = $derived(splitContentProps(props));
18
+ const { element, children, ...restAttributes } = $derived(componentProps);
19
+ const attributes = $derived(
20
+ mergeProps(
21
+ rootContext.api.getContentProps(contentProps),
22
+ {
23
+ class: classesTabs.content
24
+ },
25
+ restAttributes
26
+ )
27
+ );
28
+ </script>
29
+
30
+ {#if element}
31
+ {@render element({ attributes })}
32
+ {:else}
33
+ <div {...attributes}>
34
+ {@render children?.()}
35
+ </div>
36
+ {/if}
@@ -0,0 +1,8 @@
1
+ import type { ContentProps } from '@zag-js/tabs';
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ import type { PropsWithElement } from '../../../internal/props-with-element.js';
4
+ export interface TabsContentProps extends ContentProps, PropsWithElement, HTMLAttributes<HTMLDivElement> {
5
+ }
6
+ declare const TabsContent: import("svelte").Component<TabsContentProps, {}, "">;
7
+ type TabsContent = ReturnType<typeof TabsContent>;
8
+ export default TabsContent;
@@ -0,0 +1,31 @@
1
+ <script lang="ts" module>
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ import type { PropsWithElement } from '../../../internal/props-with-element.js';
4
+
5
+ export interface TabsIndicatorProps extends PropsWithElement, Omit<HTMLAttributes<HTMLDivElement>, 'children'> {}
6
+ </script>
7
+
8
+ <script lang="ts">
9
+ import { TabsRootContext } from '../modules/tabs-root-context.js';
10
+ import { mergeProps } from '@zag-js/svelte';
11
+ import { classesTabs } from '@skeletonlabs/skeleton-common';
12
+
13
+ const props: TabsIndicatorProps = $props();
14
+ const rootContext = TabsRootContext.consume();
15
+ const { element, ...restAttributes } = $derived(props);
16
+ const attributes = $derived(
17
+ mergeProps(
18
+ rootContext.api.getIndicatorProps(),
19
+ {
20
+ class: classesTabs.indicator
21
+ },
22
+ restAttributes
23
+ )
24
+ );
25
+ </script>
26
+
27
+ {#if element}
28
+ {@render element({ attributes })}
29
+ {:else}
30
+ <div {...attributes}></div>
31
+ {/if}
@@ -0,0 +1,7 @@
1
+ import type { HTMLAttributes } from 'svelte/elements';
2
+ import type { PropsWithElement } from '../../../internal/props-with-element.js';
3
+ export interface TabsIndicatorProps extends PropsWithElement, Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
4
+ }
5
+ declare const TabsIndicator: import("svelte").Component<TabsIndicatorProps, {}, "">;
6
+ type TabsIndicator = ReturnType<typeof TabsIndicator>;
7
+ export default TabsIndicator;
@@ -0,0 +1,33 @@
1
+ <script lang="ts" module>
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ import type { PropsWithElement } from '../../../internal/props-with-element.js';
4
+
5
+ export interface TabsListProps extends PropsWithElement, HTMLAttributes<HTMLDivElement> {}
6
+ </script>
7
+
8
+ <script lang="ts">
9
+ import { TabsRootContext } from '../modules/tabs-root-context';
10
+ import { mergeProps } from '@zag-js/svelte';
11
+ import { classesTabs } from '@skeletonlabs/skeleton-common';
12
+
13
+ const props: TabsListProps = $props();
14
+ const rootContext = TabsRootContext.consume();
15
+ const { element, children, ...restAttributes } = $derived(props);
16
+ const attributes = $derived(
17
+ mergeProps(
18
+ rootContext.api.getListProps(),
19
+ {
20
+ class: classesTabs.list
21
+ },
22
+ restAttributes
23
+ )
24
+ );
25
+ </script>
26
+
27
+ {#if element}
28
+ {@render element({ attributes })}
29
+ {:else}
30
+ <div {...attributes}>
31
+ {@render children?.()}
32
+ </div>
33
+ {/if}
@@ -0,0 +1,7 @@
1
+ import type { HTMLAttributes } from 'svelte/elements';
2
+ import type { PropsWithElement } from '../../../internal/props-with-element.js';
3
+ export interface TabsListProps extends PropsWithElement, HTMLAttributes<HTMLDivElement> {
4
+ }
5
+ declare const TabsList: import("svelte").Component<TabsListProps, {}, "">;
6
+ type TabsList = ReturnType<typeof TabsList>;
7
+ export default TabsList;
@@ -0,0 +1,17 @@
1
+ <script lang="ts" module>
2
+ import type { Snippet } from 'svelte';
3
+ import type { TabsRootContextType } from '../modules/tabs-root-context.js';
4
+
5
+ export interface TabsRootContextProps {
6
+ children: Snippet<[TabsRootContextType]>;
7
+ }
8
+ </script>
9
+
10
+ <script lang="ts">
11
+ import { TabsRootContext } from '../modules/tabs-root-context.js';
12
+
13
+ const props: TabsRootContextProps = $props();
14
+ const rootContext = TabsRootContext.consume();
15
+ </script>
16
+
17
+ {@render props.children(rootContext)}
@@ -0,0 +1,9 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { TabsRootContextType } from '../modules/tabs-root-context.js';
3
+ export interface TabsRootContextProps {
4
+ children: Snippet<[TabsRootContextType]>;
5
+ }
6
+ import { TabsRootContext } from '../modules/tabs-root-context.js';
7
+ declare const TabsRootContext: import("svelte").Component<TabsRootContextProps, {}, "">;
8
+ type TabsRootContext = ReturnType<typeof TabsRootContext>;
9
+ export default TabsRootContext;
@@ -0,0 +1,49 @@
1
+ <script lang="ts" module>
2
+ import type { Props } from '@zag-js/tabs';
3
+ import type { HTMLAttributes } from 'svelte/elements';
4
+ import type { PropsWithElement } from '../../../internal/props-with-element.js';
5
+
6
+ export interface TabsRootProps
7
+ extends Omit<Props, 'id'>,
8
+ PropsWithElement,
9
+ Omit<HTMLAttributes<HTMLDivElement>, 'id' | 'defaultValue' | 'dir'> {}
10
+ </script>
11
+
12
+ <script lang="ts">
13
+ import { connect, machine, splitProps } from '@zag-js/tabs';
14
+ import { classesTabs } from '@skeletonlabs/skeleton-common';
15
+ import { useMachine, normalizeProps, mergeProps } from '@zag-js/svelte';
16
+ import { TabsRootContext } from '../modules/tabs-root-context.js';
17
+
18
+ const props: TabsRootProps = $props();
19
+ const [machineProps, componentProps] = $derived(splitProps(props));
20
+ const { element, children, ...restAttributes } = $derived(componentProps);
21
+ const id = $props.id();
22
+ const service = useMachine(machine, () => ({
23
+ id: id,
24
+ ...machineProps
25
+ }));
26
+ const api = $derived(connect(service, normalizeProps));
27
+ const attributes = $derived(
28
+ mergeProps(
29
+ api.getRootProps(),
30
+ {
31
+ class: classesTabs.root
32
+ },
33
+ restAttributes
34
+ )
35
+ );
36
+ TabsRootContext.provide({
37
+ get api() {
38
+ return api;
39
+ }
40
+ });
41
+ </script>
42
+
43
+ {#if element}
44
+ {@render element({ attributes })}
45
+ {:else}
46
+ <div {...attributes}>
47
+ {@render children?.()}
48
+ </div>
49
+ {/if}
@@ -0,0 +1,8 @@
1
+ import type { Props } from '@zag-js/tabs';
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ import type { PropsWithElement } from '../../../internal/props-with-element.js';
4
+ export interface TabsRootProps extends Omit<Props, 'id'>, PropsWithElement, Omit<HTMLAttributes<HTMLDivElement>, 'id' | 'defaultValue' | 'dir'> {
5
+ }
6
+ declare const TabsRoot: import("svelte").Component<TabsRootProps, {}, "">;
7
+ type TabsRoot = ReturnType<typeof TabsRoot>;
8
+ export default TabsRoot;
@@ -0,0 +1,36 @@
1
+ <script lang="ts" module>
2
+ import type { TriggerProps } from '@zag-js/tabs';
3
+ import type { HTMLButtonAttributes } from 'svelte/elements';
4
+ import type { PropsWithElement } from '../../../internal/props-with-element.js';
5
+
6
+ export interface TabsTriggerProps extends TriggerProps, PropsWithElement, Omit<HTMLButtonAttributes, 'value' | 'disabled'> {}
7
+ </script>
8
+
9
+ <script lang="ts">
10
+ import { TabsRootContext } from '../modules/tabs-root-context';
11
+ import { mergeProps } from '@zag-js/svelte';
12
+ import { classesTabs } from '@skeletonlabs/skeleton-common';
13
+ import { splitTriggerProps } from '@zag-js/tabs';
14
+
15
+ const props: TabsTriggerProps = $props();
16
+ const rootContext = TabsRootContext.consume();
17
+ const [triggerProps, componentProps] = $derived(splitTriggerProps(props));
18
+ const { element, children, ...restAttributes } = $derived(componentProps);
19
+ const attributes = $derived(
20
+ mergeProps(
21
+ rootContext.api.getTriggerProps(triggerProps),
22
+ {
23
+ class: classesTabs.trigger
24
+ },
25
+ restAttributes
26
+ )
27
+ );
28
+ </script>
29
+
30
+ {#if element}
31
+ {@render element({ attributes })}
32
+ {:else}
33
+ <button {...attributes}>
34
+ {@render children?.()}
35
+ </button>
36
+ {/if}
@@ -0,0 +1,8 @@
1
+ import type { TriggerProps } from '@zag-js/tabs';
2
+ import type { HTMLButtonAttributes } from 'svelte/elements';
3
+ import type { PropsWithElement } from '../../../internal/props-with-element.js';
4
+ export interface TabsTriggerProps extends TriggerProps, PropsWithElement, Omit<HTMLButtonAttributes, 'value' | 'disabled'> {
5
+ }
6
+ declare const TabsTrigger: import("svelte").Component<TabsTriggerProps, {}, "">;
7
+ type TabsTrigger = ReturnType<typeof TabsTrigger>;
8
+ export default TabsTrigger;
@@ -0,0 +1 @@
1
+ export * from './modules/tabs-anatomy.js';
@@ -0,0 +1 @@
1
+ export * from './modules/tabs-anatomy.js';
@@ -0,0 +1,7 @@
1
+ export declare const Tabs: import("svelte").Component<import("../anatomy/tabs-root.svelte").TabsRootProps, {}, ""> & {
2
+ Context: import("svelte").Component<import("../anatomy/tabs-root-context.svelte").TabsRootContextProps, {}, "">;
3
+ List: import("svelte").Component<import("../anatomy/tabs-list.svelte").TabsListProps, {}, "">;
4
+ Trigger: import("svelte").Component<import("../anatomy/tabs-trigger.svelte").TabsTriggerProps, {}, "">;
5
+ Indicator: import("svelte").Component<import("../anatomy/tabs-indicator.svelte").TabsIndicatorProps, {}, "">;
6
+ Content: import("svelte").Component<import("../anatomy/tabs-content.svelte").TabsContentProps, {}, "">;
7
+ };