ui-ingredients 0.0.6 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (222) hide show
  1. package/README.md +75 -75
  2. package/dist/accordion/item-content.svelte +22 -13
  3. package/dist/accordion/item-indicator.svelte +22 -13
  4. package/dist/accordion/item-trigger.svelte +22 -13
  5. package/dist/accordion/item.svelte +35 -24
  6. package/dist/accordion/root.svelte +61 -40
  7. package/dist/avatar/fallback.svelte +21 -12
  8. package/dist/avatar/image.svelte +19 -10
  9. package/dist/avatar/root.svelte +46 -29
  10. package/dist/carousel/indicator-group.svelte +21 -12
  11. package/dist/carousel/indicator.svelte +31 -20
  12. package/dist/carousel/item-group.svelte +21 -12
  13. package/dist/carousel/item.svelte +22 -12
  14. package/dist/carousel/next-trigger.svelte +21 -12
  15. package/dist/carousel/prev-trigger.svelte +21 -12
  16. package/dist/carousel/root.svelte +58 -40
  17. package/dist/carousel/viewport.svelte +21 -12
  18. package/dist/checkbox/control.svelte +21 -12
  19. package/dist/checkbox/hidden-input.svelte +19 -10
  20. package/dist/checkbox/indicator.svelte +21 -12
  21. package/dist/checkbox/label.svelte +21 -12
  22. package/dist/checkbox/root.svelte +62 -44
  23. package/dist/clipboard/control.svelte +21 -12
  24. package/dist/clipboard/indicator.svelte +23 -12
  25. package/dist/clipboard/input.svelte +19 -10
  26. package/dist/clipboard/label.svelte +21 -12
  27. package/dist/clipboard/root.svelte +51 -30
  28. package/dist/clipboard/trigger.svelte +21 -12
  29. package/dist/collapsible/content.svelte +21 -12
  30. package/dist/collapsible/root.svelte +57 -36
  31. package/dist/collapsible/trigger.svelte +19 -12
  32. package/dist/combobox/clear-trigger.svelte +21 -12
  33. package/dist/combobox/content.svelte +21 -12
  34. package/dist/combobox/control.svelte +21 -12
  35. package/dist/combobox/input.svelte +19 -10
  36. package/dist/combobox/item-group-label.svelte +29 -20
  37. package/dist/combobox/item-group.svelte +26 -14
  38. package/dist/combobox/item-indicator.svelte +22 -13
  39. package/dist/combobox/item-text.svelte +26 -17
  40. package/dist/combobox/item.svelte +35 -24
  41. package/dist/combobox/label.svelte +21 -12
  42. package/dist/combobox/list.svelte +21 -12
  43. package/dist/combobox/positioner.svelte +21 -12
  44. package/dist/combobox/root.svelte +122 -104
  45. package/dist/combobox/trigger.svelte +21 -12
  46. package/dist/dialog/backdrop.svelte +21 -12
  47. package/dist/dialog/close-trigger.svelte +21 -12
  48. package/dist/dialog/content.svelte +21 -12
  49. package/dist/dialog/description.svelte +21 -12
  50. package/dist/dialog/positioner.svelte +21 -12
  51. package/dist/dialog/root.svelte +22 -10
  52. package/dist/dialog/title.svelte +21 -12
  53. package/dist/dialog/trigger.svelte +21 -12
  54. package/dist/hover-card/arrow-tip.svelte +21 -12
  55. package/dist/hover-card/arrow.svelte +21 -12
  56. package/dist/hover-card/content.svelte +21 -12
  57. package/dist/hover-card/positioner.svelte +21 -12
  58. package/dist/hover-card/root.svelte +25 -10
  59. package/dist/hover-card/trigger.svelte +21 -12
  60. package/dist/index.d.ts +11 -0
  61. package/dist/index.js +8 -0
  62. package/dist/number-input/control.svelte +21 -12
  63. package/dist/number-input/decrement-trigger.svelte +22 -12
  64. package/dist/number-input/increment-trigger.svelte +22 -12
  65. package/dist/number-input/input.svelte +19 -10
  66. package/dist/number-input/label.svelte +21 -12
  67. package/dist/number-input/root.svelte +93 -72
  68. package/dist/number-input/scrubber.svelte +21 -12
  69. package/dist/pagination/ellipsis.svelte +23 -12
  70. package/dist/pagination/item.svelte +31 -20
  71. package/dist/pagination/next-trigger.svelte +21 -12
  72. package/dist/pagination/prev-trigger.svelte +21 -12
  73. package/dist/pagination/root.svelte +63 -42
  74. package/dist/pin-input/clear-trigger.svelte +25 -17
  75. package/dist/pin-input/hidden-input.svelte +19 -10
  76. package/dist/pin-input/input.svelte +20 -10
  77. package/dist/pin-input/label.svelte +21 -12
  78. package/dist/pin-input/root.svelte +82 -64
  79. package/dist/popover/arrow-tip.svelte +21 -12
  80. package/dist/popover/arrow.svelte +21 -12
  81. package/dist/popover/close-trigger.svelte +21 -12
  82. package/dist/popover/content.svelte +21 -12
  83. package/dist/popover/description.svelte +21 -12
  84. package/dist/popover/positioner.svelte +21 -12
  85. package/dist/popover/root.svelte +22 -10
  86. package/dist/popover/title.svelte +21 -12
  87. package/dist/popover/trigger.svelte +21 -12
  88. package/dist/portal/root.svelte +20 -10
  89. package/dist/presence/root.svelte +39 -27
  90. package/dist/progress/circle-range.svelte +21 -12
  91. package/dist/progress/circle-track.svelte +21 -12
  92. package/dist/progress/circle.svelte +21 -12
  93. package/dist/progress/label.svelte +21 -12
  94. package/dist/progress/range.svelte +21 -12
  95. package/dist/progress/root.svelte +54 -36
  96. package/dist/progress/track.svelte +21 -12
  97. package/dist/progress/value-text.svelte +25 -16
  98. package/dist/qr-code/context.svelte.d.ts +8 -0
  99. package/dist/qr-code/context.svelte.js +14 -0
  100. package/dist/qr-code/frame.svelte +21 -0
  101. package/dist/qr-code/frame.svelte.d.ts +22 -0
  102. package/dist/qr-code/index.d.ts +4 -0
  103. package/dist/qr-code/index.js +4 -0
  104. package/dist/qr-code/overlay.svelte +21 -0
  105. package/dist/qr-code/overlay.svelte.d.ts +22 -0
  106. package/dist/qr-code/pattern.svelte +21 -0
  107. package/dist/qr-code/pattern.svelte.d.ts +22 -0
  108. package/dist/qr-code/root.svelte +48 -0
  109. package/dist/qr-code/root.svelte.d.ts +25 -0
  110. package/dist/radio-group/indicator.svelte +21 -12
  111. package/dist/radio-group/item-control.svelte +22 -13
  112. package/dist/radio-group/item-hidden-input.svelte +20 -11
  113. package/dist/radio-group/item-text.svelte +22 -13
  114. package/dist/radio-group/item.svelte +37 -26
  115. package/dist/radio-group/label.svelte +21 -12
  116. package/dist/radio-group/root.svelte +61 -40
  117. package/dist/select/clear-trigger.svelte +21 -12
  118. package/dist/select/content.svelte +21 -12
  119. package/dist/select/control.svelte +21 -12
  120. package/dist/select/hidden-select.svelte +21 -12
  121. package/dist/select/indicator.svelte +21 -12
  122. package/dist/select/item-group-label.svelte +24 -15
  123. package/dist/select/item-group.svelte +26 -14
  124. package/dist/select/item-indicator.svelte +22 -13
  125. package/dist/select/item-text.svelte +26 -17
  126. package/dist/select/item.svelte +35 -24
  127. package/dist/select/label.svelte +21 -12
  128. package/dist/select/list.svelte +21 -12
  129. package/dist/select/positioner.svelte +21 -12
  130. package/dist/select/root.svelte +96 -78
  131. package/dist/select/trigger.svelte +21 -12
  132. package/dist/select/value-text.svelte +27 -18
  133. package/dist/slider/control.svelte +21 -12
  134. package/dist/slider/hidden-input.svelte +20 -11
  135. package/dist/slider/label.svelte +21 -12
  136. package/dist/slider/marker-group.svelte +21 -12
  137. package/dist/slider/marker.svelte +29 -19
  138. package/dist/slider/range.svelte +21 -12
  139. package/dist/slider/root.svelte +84 -66
  140. package/dist/slider/thumb.svelte +35 -24
  141. package/dist/slider/track.svelte +21 -12
  142. package/dist/slider/value-text.svelte +25 -16
  143. package/dist/steps/content.svelte +22 -12
  144. package/dist/steps/indicator.svelte +22 -13
  145. package/dist/steps/item.svelte +24 -13
  146. package/dist/steps/list.svelte +21 -12
  147. package/dist/steps/next-trigger.svelte +21 -12
  148. package/dist/steps/prev-trigger.svelte +21 -12
  149. package/dist/steps/progress.svelte +21 -12
  150. package/dist/steps/root.svelte +56 -38
  151. package/dist/steps/separator.svelte +22 -13
  152. package/dist/steps/trigger.svelte +22 -13
  153. package/dist/switch/control.svelte +21 -12
  154. package/dist/switch/hidden-input.svelte +19 -10
  155. package/dist/switch/label.svelte +21 -12
  156. package/dist/switch/root.svelte +64 -46
  157. package/dist/switch/thumb.svelte +21 -12
  158. package/dist/tabs/content.svelte +22 -12
  159. package/dist/tabs/list.svelte +21 -12
  160. package/dist/tabs/root.svelte +57 -42
  161. package/dist/tabs/trigger.svelte +22 -12
  162. package/dist/tags-input/clear-trigger.svelte +21 -0
  163. package/dist/tags-input/clear-trigger.svelte.d.ts +22 -0
  164. package/dist/tags-input/context.svelte.d.ts +10 -0
  165. package/dist/tags-input/context.svelte.js +20 -0
  166. package/dist/tags-input/control.svelte +21 -0
  167. package/dist/tags-input/control.svelte.d.ts +22 -0
  168. package/dist/tags-input/hidden-input.svelte +19 -0
  169. package/dist/tags-input/hidden-input.svelte.d.ts +22 -0
  170. package/dist/tags-input/index.d.ts +11 -0
  171. package/dist/tags-input/index.js +11 -0
  172. package/dist/tags-input/input.svelte +19 -0
  173. package/dist/tags-input/input.svelte.d.ts +22 -0
  174. package/dist/tags-input/item-delete-trigger.svelte +23 -0
  175. package/dist/tags-input/item-delete-trigger.svelte.d.ts +22 -0
  176. package/dist/tags-input/item-input.svelte +20 -0
  177. package/dist/tags-input/item-input.svelte.d.ts +22 -0
  178. package/dist/tags-input/item-preview.svelte +22 -0
  179. package/dist/tags-input/item-preview.svelte.d.ts +22 -0
  180. package/dist/tags-input/item-text.svelte +22 -0
  181. package/dist/tags-input/item-text.svelte.d.ts +22 -0
  182. package/dist/tags-input/item.svelte +37 -0
  183. package/dist/tags-input/item.svelte.d.ts +23 -0
  184. package/dist/tags-input/label.svelte +21 -0
  185. package/dist/tags-input/label.svelte.d.ts +22 -0
  186. package/dist/tags-input/root.svelte +97 -0
  187. package/dist/tags-input/root.svelte.d.ts +25 -0
  188. package/dist/timer/action-trigger.svelte +23 -0
  189. package/dist/timer/action-trigger.svelte.d.ts +23 -0
  190. package/dist/timer/context.svelte.d.ts +10 -0
  191. package/dist/timer/context.svelte.js +20 -0
  192. package/dist/timer/index.d.ts +6 -0
  193. package/dist/timer/index.js +6 -0
  194. package/dist/timer/item-label.svelte +22 -0
  195. package/dist/timer/item-label.svelte.d.ts +22 -0
  196. package/dist/timer/item-value.svelte +26 -0
  197. package/dist/timer/item-value.svelte.d.ts +22 -0
  198. package/dist/timer/item.svelte +24 -0
  199. package/dist/timer/item.svelte.d.ts +23 -0
  200. package/dist/timer/root.svelte +54 -0
  201. package/dist/timer/root.svelte.d.ts +25 -0
  202. package/dist/timer/separator.svelte +21 -0
  203. package/dist/timer/separator.svelte.d.ts +22 -0
  204. package/dist/toast/action-trigger.svelte +21 -12
  205. package/dist/toast/actor.svelte +22 -11
  206. package/dist/toast/close-trigger.svelte +21 -12
  207. package/dist/toast/description.svelte +25 -16
  208. package/dist/toast/root.svelte +25 -16
  209. package/dist/toast/title.svelte +25 -16
  210. package/dist/toast/toaster.svelte +40 -25
  211. package/dist/toggle-group/item.svelte +22 -12
  212. package/dist/toggle-group/root.svelte +61 -40
  213. package/dist/tooltip/arrow-tip.svelte +21 -12
  214. package/dist/tooltip/arrow.svelte +21 -12
  215. package/dist/tooltip/content.svelte +21 -12
  216. package/dist/tooltip/positioner.svelte +21 -12
  217. package/dist/tooltip/root.svelte +22 -10
  218. package/dist/tooltip/trigger.svelte +21 -12
  219. package/package.json +6 -14
  220. package/dist/qr-code/.gitkeep +0 -0
  221. package/dist/tags-input/.gitkeep +0 -0
  222. package/dist/timer/.gitkeep +0 -0
@@ -1,12 +1,21 @@
1
- <script lang="ts" context="module"></script>
2
-
3
- <script lang="ts">import { mergeProps } from "@zag-js/svelte";
4
- import { useCarouselContext } from "./context.svelte.js";
5
- let { children, ...props } = $props();
6
- let context = useCarouselContext();
7
- let attrs = $derived(mergeProps(props, context.getItemGroupProps()));
8
- </script>
9
-
10
- <div {...attrs}>
11
- {@render children?.()}
12
- </div>
1
+ <script lang="ts" context="module">
2
+ import type {Assign} from '../types.js';
3
+ import type {SvelteHTMLElements} from 'svelte/elements';
4
+
5
+ export interface CarouselItemGroupProps extends Assign<SvelteHTMLElements['div'], {}> {}
6
+ </script>
7
+
8
+ <script lang="ts">
9
+ import {mergeProps} from '@zag-js/svelte';
10
+ import {useCarouselContext} from './context.svelte.js';
11
+
12
+ let {children, ...props}: CarouselItemGroupProps = $props();
13
+
14
+ let context = useCarouselContext();
15
+
16
+ let attrs = $derived(mergeProps(props, context.getItemGroupProps()));
17
+ </script>
18
+
19
+ <div {...attrs}>
20
+ {@render children?.()}
21
+ </div>
@@ -1,12 +1,22 @@
1
- <script lang="ts" context="module"></script>
2
-
3
- <script lang="ts">import { mergeProps } from "@zag-js/svelte";
4
- import { useCarouselContext } from "./context.svelte.js";
5
- let { index, children, ...props } = $props();
6
- let context = useCarouselContext();
7
- let attrs = $derived(mergeProps(props, context.getItemProps({ index })));
8
- </script>
9
-
10
- <button type="button" {...attrs}>
11
- {@render children?.()}
12
- </button>
1
+ <script lang="ts" context="module">
2
+ import type {Assign} from '../types.js';
3
+ import type {ItemProps} from '@zag-js/carousel';
4
+ import type {SvelteHTMLElements} from 'svelte/elements';
5
+
6
+ export interface CarouselItemProps extends Assign<SvelteHTMLElements['button'], ItemProps> {}
7
+ </script>
8
+
9
+ <script lang="ts">
10
+ import {mergeProps} from '@zag-js/svelte';
11
+ import {useCarouselContext} from './context.svelte.js';
12
+
13
+ let {index, children, ...props}: CarouselItemProps = $props();
14
+
15
+ let context = useCarouselContext();
16
+
17
+ let attrs = $derived(mergeProps(props, context.getItemProps({index})));
18
+ </script>
19
+
20
+ <button type="button" {...attrs}>
21
+ {@render children?.()}
22
+ </button>
@@ -1,12 +1,21 @@
1
- <script lang="ts" context="module"></script>
2
-
3
- <script lang="ts">import { mergeProps } from "@zag-js/svelte";
4
- import { useCarouselContext } from "./context.svelte.js";
5
- let { children, ...props } = $props();
6
- let context = useCarouselContext();
7
- let attrs = $derived(mergeProps(props, context.getNextTriggerProps()));
8
- </script>
9
-
10
- <button type="button" {...attrs}>
11
- {@render children?.()}
12
- </button>
1
+ <script lang="ts" context="module">
2
+ import type {Assign} from '../types.js';
3
+ import type {SvelteHTMLElements} from 'svelte/elements';
4
+
5
+ export interface CarouselNextTriggerProps extends Assign<SvelteHTMLElements['button'], {}> {}
6
+ </script>
7
+
8
+ <script lang="ts">
9
+ import {mergeProps} from '@zag-js/svelte';
10
+ import {useCarouselContext} from './context.svelte.js';
11
+
12
+ let {children, ...props}: CarouselNextTriggerProps = $props();
13
+
14
+ let context = useCarouselContext();
15
+
16
+ let attrs = $derived(mergeProps(props, context.getNextTriggerProps()));
17
+ </script>
18
+
19
+ <button type="button" {...attrs}>
20
+ {@render children?.()}
21
+ </button>
@@ -1,12 +1,21 @@
1
- <script lang="ts" context="module"></script>
2
-
3
- <script lang="ts">import { mergeProps } from "@zag-js/svelte";
4
- import { useCarouselContext } from "./context.svelte.js";
5
- let { children, ...props } = $props();
6
- let context = useCarouselContext();
7
- let attrs = $derived(mergeProps(props, context.getPrevTriggerProps()));
8
- </script>
9
-
10
- <button type="button" {...attrs}>
11
- {@render children?.()}
12
- </button>
1
+ <script lang="ts" context="module">
2
+ import type {Assign} from '../types.js';
3
+ import type {SvelteHTMLElements} from 'svelte/elements';
4
+
5
+ export interface CarouselPrevTriggerProps extends Assign<SvelteHTMLElements['button'], {}> {}
6
+ </script>
7
+
8
+ <script lang="ts">
9
+ import {mergeProps} from '@zag-js/svelte';
10
+ import {useCarouselContext} from './context.svelte.js';
11
+
12
+ let {children, ...props}: CarouselPrevTriggerProps = $props();
13
+
14
+ let context = useCarouselContext();
15
+
16
+ let attrs = $derived(mergeProps(props, context.getPrevTriggerProps()));
17
+ </script>
18
+
19
+ <button type="button" {...attrs}>
20
+ {@render children?.()}
21
+ </button>
@@ -1,40 +1,58 @@
1
- <script lang="ts" context="module"></script>
2
-
3
- <script lang="ts">import { uuid } from "../utils.svelte.js";
4
- import { mergeProps } from "@zag-js/svelte";
5
- import { createCarouselContext, setCarouselContext } from "./context.svelte.js";
6
- let {
7
- id = uuid(),
8
- ids,
9
- dir,
10
- loop,
11
- align,
12
- index,
13
- spacing,
14
- orientation,
15
- slidesPerView,
16
- onIndexChange,
17
- getRootNode,
18
- children,
19
- ...props
20
- } = $props();
21
- let context = createCarouselContext({
22
- id,
23
- ids,
24
- dir,
25
- loop,
26
- align,
27
- index: $state.snapshot(index),
28
- spacing,
29
- orientation,
30
- slidesPerView,
31
- onIndexChange,
32
- getRootNode
33
- });
34
- let attrs = $derived(mergeProps(props, context.getRootProps()));
35
- setCarouselContext(context);
36
- </script>
37
-
38
- <div {...attrs}>
39
- {@render children?.(context)}
40
- </div>
1
+ <script lang="ts" context="module">
2
+ import type {Assign, OptionalId, WithoutChildren} from '../types.js';
3
+ import type {Snippet} from 'svelte';
4
+ import type {SvelteHTMLElements} from 'svelte/elements';
5
+ import type {CreateCarouselContextProps, CreateCarouselContextReturn} from './context.svelte.js';
6
+
7
+ export interface CarouselProps
8
+ extends Assign<
9
+ WithoutChildren<SvelteHTMLElements['div']>,
10
+ OptionalId<CreateCarouselContextProps>
11
+ > {
12
+ children?: Snippet<[context: CreateCarouselContextReturn]>;
13
+ }
14
+ </script>
15
+
16
+ <script lang="ts">
17
+ import {uuid} from '../utils.svelte.js';
18
+ import {mergeProps} from '@zag-js/svelte';
19
+ import {createCarouselContext, setCarouselContext} from './context.svelte.js';
20
+
21
+ let {
22
+ id = uuid(),
23
+ ids,
24
+ dir,
25
+ loop,
26
+ align,
27
+ index,
28
+ spacing,
29
+ orientation,
30
+ slidesPerView,
31
+ onIndexChange,
32
+ getRootNode,
33
+ children,
34
+ ...props
35
+ }: CarouselProps = $props();
36
+
37
+ let context = createCarouselContext({
38
+ id,
39
+ ids,
40
+ dir,
41
+ loop,
42
+ align,
43
+ index: $state.snapshot(index),
44
+ spacing,
45
+ orientation,
46
+ slidesPerView,
47
+ onIndexChange,
48
+ getRootNode,
49
+ });
50
+
51
+ let attrs = $derived(mergeProps(props, context.getRootProps()));
52
+
53
+ setCarouselContext(context);
54
+ </script>
55
+
56
+ <div {...attrs}>
57
+ {@render children?.(context)}
58
+ </div>
@@ -1,12 +1,21 @@
1
- <script lang="ts" context="module"></script>
2
-
3
- <script lang="ts">import { mergeProps } from "@zag-js/svelte";
4
- import { useCarouselContext } from "./context.svelte.js";
5
- let { children, ...props } = $props();
6
- let context = useCarouselContext();
7
- let attrs = $derived(mergeProps(props, context.getViewportProps()));
8
- </script>
9
-
10
- <div {...attrs}>
11
- {@render children?.()}
12
- </div>
1
+ <script lang="ts" context="module">
2
+ import type {Assign} from '../types.js';
3
+ import type {SvelteHTMLElements} from 'svelte/elements';
4
+
5
+ export interface CarouselViewportProps extends Assign<SvelteHTMLElements['div'], {}> {}
6
+ </script>
7
+
8
+ <script lang="ts">
9
+ import {mergeProps} from '@zag-js/svelte';
10
+ import {useCarouselContext} from './context.svelte.js';
11
+
12
+ let {children, ...props}: CarouselViewportProps = $props();
13
+
14
+ let context = useCarouselContext();
15
+
16
+ let attrs = $derived(mergeProps(props, context.getViewportProps()));
17
+ </script>
18
+
19
+ <div {...attrs}>
20
+ {@render children?.()}
21
+ </div>
@@ -1,12 +1,21 @@
1
- <script lang="ts" context="module"></script>
2
-
3
- <script lang="ts">import { mergeProps } from "@zag-js/svelte";
4
- import { useCheckboxContext } from "./context.svelte.js";
5
- let { children, ...props } = $props();
6
- let context = useCheckboxContext();
7
- let attrs = $derived(mergeProps(props, context.getControlProps()));
8
- </script>
9
-
10
- <div {...attrs}>
11
- {@render children?.()}
12
- </div>
1
+ <script lang="ts" context="module">
2
+ import type {Assign} from '../types.js';
3
+ import type {SvelteHTMLElements} from 'svelte/elements';
4
+
5
+ export interface CheckboxControlProps extends Assign<SvelteHTMLElements['div'], {}> {}
6
+ </script>
7
+
8
+ <script lang="ts">
9
+ import {mergeProps} from '@zag-js/svelte';
10
+ import {useCheckboxContext} from './context.svelte.js';
11
+
12
+ let {children, ...props}: CheckboxControlProps = $props();
13
+
14
+ let context = useCheckboxContext();
15
+
16
+ let attrs = $derived(mergeProps(props, context.getControlProps()));
17
+ </script>
18
+
19
+ <div {...attrs}>
20
+ {@render children?.()}
21
+ </div>
@@ -1,10 +1,19 @@
1
- <script lang="ts" context="module"></script>
2
-
3
- <script lang="ts">import { mergeProps } from "@zag-js/svelte";
4
- import { useCheckboxContext } from "./context.svelte.js";
5
- let { ...props } = $props();
6
- let context = useCheckboxContext();
7
- let attrs = $derived(mergeProps(props, context.getHiddenInputProps()));
8
- </script>
9
-
10
- <input {...attrs} />
1
+ <script lang="ts" context="module">
2
+ import type {Assign} from '../types.js';
3
+ import type {SvelteHTMLElements} from 'svelte/elements';
4
+
5
+ export interface CheckboxHiddenInputProps extends Assign<SvelteHTMLElements['input'], {}> {}
6
+ </script>
7
+
8
+ <script lang="ts">
9
+ import {mergeProps} from '@zag-js/svelte';
10
+ import {useCheckboxContext} from './context.svelte.js';
11
+
12
+ let {...props}: CheckboxHiddenInputProps = $props();
13
+
14
+ let context = useCheckboxContext();
15
+
16
+ let attrs = $derived(mergeProps(props, context.getHiddenInputProps()));
17
+ </script>
18
+
19
+ <input {...attrs} />
@@ -1,12 +1,21 @@
1
- <script lang="ts" context="module"></script>
2
-
3
- <script lang="ts">import { mergeProps } from "@zag-js/svelte";
4
- import { useCheckboxContext } from "./context.svelte.js";
5
- let { children, ...props } = $props();
6
- let context = useCheckboxContext();
7
- let attrs = $derived(mergeProps(props, context.getIndicatorProps()));
8
- </script>
9
-
10
- <span {...attrs}>
11
- {@render children?.()}
12
- </span>
1
+ <script lang="ts" context="module">
2
+ import type {Assign} from '../types.js';
3
+ import type {SvelteHTMLElements} from 'svelte/elements';
4
+
5
+ export interface CheckboxIndicatorProps extends Assign<SvelteHTMLElements['span'], {}> {}
6
+ </script>
7
+
8
+ <script lang="ts">
9
+ import {mergeProps} from '@zag-js/svelte';
10
+ import {useCheckboxContext} from './context.svelte.js';
11
+
12
+ let {children, ...props}: CheckboxIndicatorProps = $props();
13
+
14
+ let context = useCheckboxContext();
15
+
16
+ let attrs = $derived(mergeProps(props, context.getIndicatorProps()));
17
+ </script>
18
+
19
+ <span {...attrs}>
20
+ {@render children?.()}
21
+ </span>
@@ -1,12 +1,21 @@
1
- <script lang="ts" context="module"></script>
2
-
3
- <script lang="ts">import { mergeProps } from "@zag-js/svelte";
4
- import { useCheckboxContext } from "./context.svelte.js";
5
- let { children, ...props } = $props();
6
- let context = useCheckboxContext();
7
- let attrs = $derived(mergeProps(props, context.getLabelProps()));
8
- </script>
9
-
10
- <span {...attrs}>
11
- {@render children?.()}
12
- </span>
1
+ <script lang="ts" context="module">
2
+ import type {Assign} from '../types.js';
3
+ import type {SvelteHTMLElements} from 'svelte/elements';
4
+
5
+ export interface CheckboxLabelProps extends Assign<SvelteHTMLElements['span'], {}> {}
6
+ </script>
7
+
8
+ <script lang="ts">
9
+ import {mergeProps} from '@zag-js/svelte';
10
+ import {useCheckboxContext} from './context.svelte.js';
11
+
12
+ let {children, ...props}: CheckboxLabelProps = $props();
13
+
14
+ let context = useCheckboxContext();
15
+
16
+ let attrs = $derived(mergeProps(props, context.getLabelProps()));
17
+ </script>
18
+
19
+ <span {...attrs}>
20
+ {@render children?.()}
21
+ </span>
@@ -1,44 +1,62 @@
1
- <script lang="ts" context="module"></script>
2
-
3
- <script lang="ts">import { uuid } from "../utils.svelte.js";
4
- import { mergeProps } from "@zag-js/svelte";
5
- import { createCheckboxContext, setCheckboxContext } from "./context.svelte.js";
6
- let {
7
- id = uuid(),
8
- ids,
9
- dir,
10
- form,
11
- name,
12
- value,
13
- checked,
14
- invalid,
15
- disabled,
16
- readOnly,
17
- required,
18
- onCheckedChange,
19
- getRootNode,
20
- children,
21
- ...props
22
- } = $props();
23
- let context = createCheckboxContext({
24
- id,
25
- ids,
26
- dir,
27
- form,
28
- name,
29
- value: $state.snapshot(value),
30
- checked,
31
- invalid,
32
- disabled,
33
- readOnly,
34
- required,
35
- onCheckedChange,
36
- getRootNode
37
- });
38
- let attrs = $derived(mergeProps(props, context.getRootProps()));
39
- setCheckboxContext(context);
40
- </script>
41
-
42
- <label {...attrs}>
43
- {@render children?.(context)}
44
- </label>
1
+ <script lang="ts" context="module">
2
+ import type {Assign, OptionalId, WithoutChildren} from '../types.js';
3
+ import type {Snippet} from 'svelte';
4
+ import type {SvelteHTMLElements} from 'svelte/elements';
5
+ import type {CreateCheckboxContextProps, CreateCheckboxContextReturn} from './context.svelte.js';
6
+
7
+ export interface CheckboxProps
8
+ extends Assign<
9
+ WithoutChildren<SvelteHTMLElements['label']>,
10
+ OptionalId<CreateCheckboxContextProps>
11
+ > {
12
+ children?: Snippet<[CreateCheckboxContextReturn]>;
13
+ }
14
+ </script>
15
+
16
+ <script lang="ts">
17
+ import {uuid} from '../utils.svelte.js';
18
+ import {mergeProps} from '@zag-js/svelte';
19
+ import {createCheckboxContext, setCheckboxContext} from './context.svelte.js';
20
+
21
+ let {
22
+ id = uuid(),
23
+ ids,
24
+ dir,
25
+ form,
26
+ name,
27
+ value,
28
+ checked,
29
+ invalid,
30
+ disabled,
31
+ readOnly,
32
+ required,
33
+ onCheckedChange,
34
+ getRootNode,
35
+ children,
36
+ ...props
37
+ }: CheckboxProps = $props();
38
+
39
+ let context = createCheckboxContext({
40
+ id,
41
+ ids,
42
+ dir,
43
+ form,
44
+ name,
45
+ value: $state.snapshot(value),
46
+ checked,
47
+ invalid,
48
+ disabled,
49
+ readOnly,
50
+ required,
51
+ onCheckedChange,
52
+ getRootNode,
53
+ });
54
+
55
+ let attrs = $derived(mergeProps(props, context.getRootProps()));
56
+
57
+ setCheckboxContext(context);
58
+ </script>
59
+
60
+ <label {...attrs}>
61
+ {@render children?.(context)}
62
+ </label>
@@ -1,12 +1,21 @@
1
- <script lang="ts" context="module"></script>
2
-
3
- <script lang="ts">import { mergeProps } from "@zag-js/svelte";
4
- import { useClipboardContext } from "./context.svelte.js";
5
- let { children, ...props } = $props();
6
- let context = useClipboardContext();
7
- let attrs = $derived(mergeProps(props, context.getControlProps()));
8
- </script>
9
-
10
- <div {...attrs}>
11
- {@render children?.()}
12
- </div>
1
+ <script lang="ts" context="module">
2
+ import type {Assign} from '../types.js';
3
+ import type {SvelteHTMLElements} from 'svelte/elements';
4
+
5
+ export interface ClipboardControlProps extends Assign<SvelteHTMLElements['div'], {}> {}
6
+ </script>
7
+
8
+ <script lang="ts">
9
+ import {mergeProps} from '@zag-js/svelte';
10
+ import {useClipboardContext} from './context.svelte.js';
11
+
12
+ let {children, ...props}: ClipboardControlProps = $props();
13
+
14
+ let context = useClipboardContext();
15
+
16
+ let attrs = $derived(mergeProps(props, context.getControlProps()));
17
+ </script>
18
+
19
+ <div {...attrs}>
20
+ {@render children?.()}
21
+ </div>
@@ -1,12 +1,23 @@
1
- <script lang="ts" context="module"></script>
2
-
3
- <script lang="ts">import { mergeProps } from "@zag-js/svelte";
4
- import { useClipboardContext } from "./context.svelte.js";
5
- let { copied = false, children, ...props } = $props();
6
- let context = useClipboardContext();
7
- let attrs = $derived(mergeProps(props, context.getIndicatorProps({ copied })));
8
- </script>
9
-
10
- <span {...attrs}>
11
- {@render children?.()}
12
- </span>
1
+ <script lang="ts" context="module">
2
+ import type {Assign} from '../types.js';
3
+ import type {IndicatorProps} from '@zag-js/clipboard';
4
+ import type {SvelteHTMLElements} from 'svelte/elements';
5
+
6
+ export interface ClipboardIndicatorProps
7
+ extends Assign<SvelteHTMLElements['span'], Partial<IndicatorProps>> {}
8
+ </script>
9
+
10
+ <script lang="ts">
11
+ import {mergeProps} from '@zag-js/svelte';
12
+ import {useClipboardContext} from './context.svelte.js';
13
+
14
+ let {copied = false, children, ...props}: ClipboardIndicatorProps = $props();
15
+
16
+ let context = useClipboardContext();
17
+
18
+ let attrs = $derived(mergeProps(props, context.getIndicatorProps({copied})));
19
+ </script>
20
+
21
+ <span {...attrs}>
22
+ {@render children?.()}
23
+ </span>
@@ -1,10 +1,19 @@
1
- <script lang="ts" context="module"></script>
2
-
3
- <script lang="ts">import { mergeProps } from "@zag-js/svelte";
4
- import { useClipboardContext } from "./context.svelte.js";
5
- let { children, ...props } = $props();
6
- let context = useClipboardContext();
7
- let attrs = $derived(mergeProps(props, context.getInputProps()));
8
- </script>
9
-
10
- <input {...attrs} />
1
+ <script lang="ts" context="module">
2
+ import type {Assign} from '../types.js';
3
+ import type {SvelteHTMLElements} from 'svelte/elements';
4
+
5
+ export interface ClipboardInputProps extends Assign<SvelteHTMLElements['input'], {}> {}
6
+ </script>
7
+
8
+ <script lang="ts">
9
+ import {mergeProps} from '@zag-js/svelte';
10
+ import {useClipboardContext} from './context.svelte.js';
11
+
12
+ let {...props}: ClipboardInputProps = $props();
13
+
14
+ let context = useClipboardContext();
15
+
16
+ let attrs = $derived(mergeProps(props, context.getInputProps()));
17
+ </script>
18
+
19
+ <input {...attrs} />
@@ -1,12 +1,21 @@
1
- <script lang="ts" context="module"></script>
2
-
3
- <script lang="ts">import { mergeProps } from "@zag-js/svelte";
4
- import { useClipboardContext } from "./context.svelte.js";
5
- let { children, ...props } = $props();
6
- let context = useClipboardContext();
7
- let attrs = $derived(mergeProps(props, context.getLabelProps()));
8
- </script>
9
-
10
- <label {...attrs}>
11
- {@render children?.()}
12
- </label>
1
+ <script lang="ts" context="module">
2
+ import type {Assign} from '../types.js';
3
+ import type {SvelteHTMLElements} from 'svelte/elements';
4
+
5
+ export interface ClipboardLabelProps extends Assign<SvelteHTMLElements['label'], {}> {}
6
+ </script>
7
+
8
+ <script lang="ts">
9
+ import {mergeProps} from '@zag-js/svelte';
10
+ import {useClipboardContext} from './context.svelte.js';
11
+
12
+ let {children, ...props}: ClipboardLabelProps = $props();
13
+
14
+ let context = useClipboardContext();
15
+
16
+ let attrs = $derived(mergeProps(props, context.getLabelProps()));
17
+ </script>
18
+
19
+ <label {...attrs}>
20
+ {@render children?.()}
21
+ </label>