ui-ingredients 0.0.5 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (168) hide show
  1. package/README.md +75 -75
  2. package/dist/accordion/context.svelte.js +1 -1
  3. package/dist/accordion/item-content.svelte +22 -13
  4. package/dist/accordion/item-indicator.svelte +22 -13
  5. package/dist/accordion/item-trigger.svelte +22 -13
  6. package/dist/accordion/item.svelte +35 -24
  7. package/dist/accordion/root.svelte +61 -40
  8. package/dist/avatar/fallback.svelte +21 -12
  9. package/dist/avatar/image.svelte +19 -10
  10. package/dist/avatar/root.svelte +46 -29
  11. package/dist/carousel/indicator-group.svelte +21 -12
  12. package/dist/carousel/indicator.svelte +31 -20
  13. package/dist/carousel/item-group.svelte +21 -12
  14. package/dist/carousel/item.svelte +22 -12
  15. package/dist/carousel/next-trigger.svelte +21 -12
  16. package/dist/carousel/prev-trigger.svelte +21 -12
  17. package/dist/carousel/root.svelte +58 -40
  18. package/dist/carousel/viewport.svelte +21 -12
  19. package/dist/checkbox/control.svelte +21 -12
  20. package/dist/checkbox/hidden-input.svelte +19 -10
  21. package/dist/checkbox/indicator.svelte +21 -12
  22. package/dist/checkbox/label.svelte +21 -12
  23. package/dist/checkbox/root.svelte +62 -44
  24. package/dist/clipboard/control.svelte +21 -12
  25. package/dist/clipboard/indicator.svelte +23 -12
  26. package/dist/clipboard/input.svelte +19 -10
  27. package/dist/clipboard/label.svelte +21 -12
  28. package/dist/clipboard/root.svelte +51 -30
  29. package/dist/clipboard/trigger.svelte +21 -12
  30. package/dist/collapsible/content.svelte +21 -12
  31. package/dist/collapsible/root.svelte +57 -36
  32. package/dist/collapsible/trigger.svelte +19 -12
  33. package/dist/combobox/clear-trigger.svelte +21 -12
  34. package/dist/combobox/content.svelte +21 -12
  35. package/dist/combobox/context.svelte.js +3 -3
  36. package/dist/combobox/control.svelte +21 -12
  37. package/dist/combobox/input.svelte +19 -10
  38. package/dist/combobox/item-group-label.svelte +29 -20
  39. package/dist/combobox/item-group.svelte +26 -14
  40. package/dist/combobox/item-indicator.svelte +22 -13
  41. package/dist/combobox/item-text.svelte +26 -17
  42. package/dist/combobox/item.svelte +35 -24
  43. package/dist/combobox/label.svelte +21 -12
  44. package/dist/combobox/list.svelte +21 -12
  45. package/dist/combobox/positioner.svelte +21 -12
  46. package/dist/combobox/root.svelte +122 -104
  47. package/dist/combobox/trigger.svelte +21 -12
  48. package/dist/dialog/backdrop.svelte +21 -12
  49. package/dist/dialog/close-trigger.svelte +21 -12
  50. package/dist/dialog/content.svelte +21 -12
  51. package/dist/dialog/description.svelte +21 -12
  52. package/dist/dialog/positioner.svelte +21 -12
  53. package/dist/dialog/root.svelte +22 -10
  54. package/dist/dialog/title.svelte +21 -12
  55. package/dist/dialog/trigger.svelte +21 -12
  56. package/dist/hover-card/arrow-tip.svelte +21 -12
  57. package/dist/hover-card/arrow.svelte +21 -12
  58. package/dist/hover-card/content.svelte +21 -12
  59. package/dist/hover-card/positioner.svelte +21 -12
  60. package/dist/hover-card/root.svelte +25 -10
  61. package/dist/hover-card/trigger.svelte +21 -12
  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/radio-group/context.svelte.js +1 -1
  99. package/dist/radio-group/indicator.svelte +21 -12
  100. package/dist/radio-group/item-control.svelte +22 -13
  101. package/dist/radio-group/item-hidden-input.svelte +20 -11
  102. package/dist/radio-group/item-text.svelte +22 -13
  103. package/dist/radio-group/item.svelte +37 -26
  104. package/dist/radio-group/label.svelte +21 -12
  105. package/dist/radio-group/root.svelte +61 -40
  106. package/dist/select/clear-trigger.svelte +21 -12
  107. package/dist/select/content.svelte +21 -12
  108. package/dist/select/context.svelte.js +3 -3
  109. package/dist/select/control.svelte +21 -12
  110. package/dist/select/hidden-select.svelte +21 -12
  111. package/dist/select/indicator.svelte +21 -12
  112. package/dist/select/item-group-label.svelte +24 -15
  113. package/dist/select/item-group.svelte +26 -14
  114. package/dist/select/item-indicator.svelte +22 -13
  115. package/dist/select/item-text.svelte +26 -17
  116. package/dist/select/item.svelte +35 -24
  117. package/dist/select/label.svelte +21 -12
  118. package/dist/select/list.svelte +21 -12
  119. package/dist/select/positioner.svelte +21 -12
  120. package/dist/select/root.svelte +96 -78
  121. package/dist/select/trigger.svelte +21 -12
  122. package/dist/select/value-text.svelte +27 -18
  123. package/dist/slider/context.svelte.js +1 -1
  124. package/dist/slider/control.svelte +21 -12
  125. package/dist/slider/hidden-input.svelte +20 -11
  126. package/dist/slider/label.svelte +21 -12
  127. package/dist/slider/marker-group.svelte +21 -12
  128. package/dist/slider/marker.svelte +29 -19
  129. package/dist/slider/range.svelte +21 -12
  130. package/dist/slider/root.svelte +84 -66
  131. package/dist/slider/thumb.svelte +35 -24
  132. package/dist/slider/track.svelte +21 -12
  133. package/dist/slider/value-text.svelte +25 -16
  134. package/dist/steps/content.svelte +22 -12
  135. package/dist/steps/indicator.svelte +22 -13
  136. package/dist/steps/item.svelte +24 -13
  137. package/dist/steps/list.svelte +21 -12
  138. package/dist/steps/next-trigger.svelte +21 -12
  139. package/dist/steps/prev-trigger.svelte +21 -12
  140. package/dist/steps/progress.svelte +21 -12
  141. package/dist/steps/root.svelte +56 -38
  142. package/dist/steps/separator.svelte +22 -13
  143. package/dist/steps/trigger.svelte +22 -13
  144. package/dist/switch/control.svelte +21 -12
  145. package/dist/switch/hidden-input.svelte +19 -10
  146. package/dist/switch/label.svelte +21 -12
  147. package/dist/switch/root.svelte +64 -46
  148. package/dist/switch/thumb.svelte +21 -12
  149. package/dist/tabs/content.svelte +22 -12
  150. package/dist/tabs/list.svelte +21 -12
  151. package/dist/tabs/root.svelte +57 -42
  152. package/dist/tabs/trigger.svelte +22 -12
  153. package/dist/toast/action-trigger.svelte +21 -12
  154. package/dist/toast/actor.svelte +22 -11
  155. package/dist/toast/close-trigger.svelte +21 -12
  156. package/dist/toast/description.svelte +25 -16
  157. package/dist/toast/root.svelte +25 -16
  158. package/dist/toast/title.svelte +25 -16
  159. package/dist/toast/toaster.svelte +40 -25
  160. package/dist/toggle-group/item.svelte +22 -12
  161. package/dist/toggle-group/root.svelte +61 -40
  162. package/dist/tooltip/arrow-tip.svelte +21 -12
  163. package/dist/tooltip/arrow.svelte +21 -12
  164. package/dist/tooltip/content.svelte +21 -12
  165. package/dist/tooltip/positioner.svelte +21 -12
  166. package/dist/tooltip/root.svelte +22 -10
  167. package/dist/tooltip/trigger.svelte +21 -12
  168. package/package.json +6 -14
@@ -1,12 +1,21 @@
1
- <script lang="ts" context="module"></script>
2
-
3
- <script lang="ts">import { mergeProps } from "@zag-js/svelte";
4
- import { usePopoverContext } from "./context.svelte.js";
5
- let { children, ...props } = $props();
6
- let context = usePopoverContext();
7
- let attrs = $derived(mergeProps(props, context.getContentProps()));
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 PopoverContentProps extends Assign<SvelteHTMLElements['div'], {}> {}
6
+ </script>
7
+
8
+ <script lang="ts">
9
+ import {mergeProps} from '@zag-js/svelte';
10
+ import {usePopoverContext} from './context.svelte.js';
11
+
12
+ let {children, ...props}: PopoverContentProps = $props();
13
+
14
+ let context = usePopoverContext();
15
+
16
+ let attrs = $derived(mergeProps(props, context.getContentProps()));
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 { usePopoverContext } from "./context.svelte.js";
5
- let { children, ...props } = $props();
6
- let context = usePopoverContext();
7
- let attrs = $derived(mergeProps(props, context.getDescriptionProps()));
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 PopoverDescriptionProps extends Assign<SvelteHTMLElements['div'], {}> {}
6
+ </script>
7
+
8
+ <script lang="ts">
9
+ import {mergeProps} from '@zag-js/svelte';
10
+ import {usePopoverContext} from './context.svelte.js';
11
+
12
+ let {children, ...props}: PopoverDescriptionProps = $props();
13
+
14
+ let context = usePopoverContext();
15
+
16
+ let attrs = $derived(mergeProps(props, context.getDescriptionProps()));
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 { usePopoverContext } from "./context.svelte.js";
5
- let { children, ...props } = $props();
6
- let context = usePopoverContext();
7
- let attrs = $derived(mergeProps(props, context.getPositionerProps()));
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 PopoverPositionerProps extends Assign<SvelteHTMLElements['div'], {}> {}
6
+ </script>
7
+
8
+ <script lang="ts">
9
+ import {mergeProps} from '@zag-js/svelte';
10
+ import {usePopoverContext} from './context.svelte.js';
11
+
12
+ let {children, ...props}: PopoverPositionerProps = $props();
13
+
14
+ let context = usePopoverContext();
15
+
16
+ let attrs = $derived(mergeProps(props, context.getPositionerProps()));
17
+ </script>
18
+
19
+ <div {...attrs}>
20
+ {@render children?.()}
21
+ </div>
@@ -1,10 +1,22 @@
1
- <script lang="ts" context="module"></script>
2
-
3
- <script lang="ts">import { uuid } from "../utils.svelte.js";
4
- import { createPopoverContext, setPopoverContext } from "./context.svelte.js";
5
- let { id = uuid(), children, ...props } = $props();
6
- let context = createPopoverContext({ id, ...props });
7
- setPopoverContext(context);
8
- </script>
9
-
10
- {@render children?.(context)}
1
+ <script lang="ts" context="module">
2
+ import type {OptionalId} from '../types.js';
3
+ import type {Snippet} from 'svelte';
4
+ import type {CreatePopoverContextProps, CreatePopoverContextReturn} from './context.svelte.js';
5
+
6
+ export interface PopoverProps extends OptionalId<CreatePopoverContextProps> {
7
+ children?: Snippet<[CreatePopoverContextReturn]>;
8
+ }
9
+ </script>
10
+
11
+ <script lang="ts">
12
+ import {uuid} from '../utils.svelte.js';
13
+ import {createPopoverContext, setPopoverContext} from './context.svelte.js';
14
+
15
+ let {id = uuid(), children, ...props}: PopoverProps = $props();
16
+
17
+ let context = createPopoverContext({id, ...props});
18
+
19
+ setPopoverContext(context);
20
+ </script>
21
+
22
+ {@render children?.(context)}
@@ -1,12 +1,21 @@
1
- <script lang="ts" context="module"></script>
2
-
3
- <script lang="ts">import { mergeProps } from "@zag-js/svelte";
4
- import { usePopoverContext } from "./context.svelte.js";
5
- let { children, ...props } = $props();
6
- let context = usePopoverContext();
7
- let attrs = $derived(mergeProps(props, context.getTitleProps()));
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 PopoverTitleProps extends Assign<SvelteHTMLElements['div'], {}> {}
6
+ </script>
7
+
8
+ <script lang="ts">
9
+ import {mergeProps} from '@zag-js/svelte';
10
+ import {usePopoverContext} from './context.svelte.js';
11
+
12
+ let {children, ...props}: PopoverTitleProps = $props();
13
+
14
+ let context = usePopoverContext();
15
+
16
+ let attrs = $derived(mergeProps(props, context.getTitleProps()));
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 { usePopoverContext } from "./context.svelte.js";
5
- let { children, ...props } = $props();
6
- let context = usePopoverContext();
7
- let attrs = $derived(mergeProps(props, context.getTriggerProps()));
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 PopoverTriggerProps extends Assign<SvelteHTMLElements['button'], {}> {}
6
+ </script>
7
+
8
+ <script lang="ts">
9
+ import {mergeProps} from '@zag-js/svelte';
10
+ import {usePopoverContext} from './context.svelte.js';
11
+
12
+ let {children, ...props}: PopoverTriggerProps = $props();
13
+
14
+ let context = usePopoverContext();
15
+
16
+ let attrs = $derived(mergeProps(props, context.getTriggerProps()));
17
+ </script>
18
+
19
+ <button type="button" {...attrs}>
20
+ {@render children?.()}
21
+ </button>
@@ -1,10 +1,20 @@
1
- <script context="module" lang="ts">import {} from "svelte";
2
- </script>
3
-
4
- <script lang="ts">import { portal } from "@zag-js/svelte";
5
- let { children, ...props } = $props();
6
- </script>
7
-
8
- <div use:portal={props} data-portal>
9
- {@render children?.()}
10
- </div>
1
+ <script context="module" lang="ts">
2
+ import {type Snippet} from 'svelte';
3
+
4
+ export interface PortalProps {
5
+ container?: HTMLElement;
6
+ disabled?: boolean;
7
+ getRootNode?: () => ShadowRoot | Document | Node;
8
+ children: Snippet;
9
+ }
10
+ </script>
11
+
12
+ <script lang="ts">
13
+ import {portal} from '@zag-js/svelte';
14
+
15
+ let {children, ...props}: PortalProps = $props();
16
+ </script>
17
+
18
+ <div use:portal={props} data-portal>
19
+ {@render children?.()}
20
+ </div>
@@ -1,27 +1,39 @@
1
- <script lang="ts" context="module"></script>
2
-
3
- <script lang="ts">import * as presence from "@zag-js/presence";
4
- import { normalizeProps, useMachine } from "@zag-js/svelte";
5
- let { present, immediate, onExitComplete, children, ...props } = $props();
6
- let [machineState, send] = useMachine(
7
- presence.machine({
8
- present,
9
- immediate,
10
- onExitComplete
11
- })
12
- );
13
- let api = $derived(presence.connect(machineState, send, normalizeProps));
14
- let node = $state(null);
15
- $effect(() => {
16
- api.setNode(node);
17
- });
18
- </script>
19
-
20
- <div
21
- bind:this={node}
22
- hidden={!api.present}
23
- data-state={api.skip ? undefined : present ? 'open' : 'closed'}
24
- {...props}
25
- >
26
- {@render children?.()}
27
- </div>
1
+ <script lang="ts" context="module">
2
+ import type {Assign} from '../types.js';
3
+ import type {Context} from '@zag-js/presence';
4
+ import type {SvelteHTMLElements} from 'svelte/elements';
5
+
6
+ export interface PresenceProps extends Assign<SvelteHTMLElements['div'], Context> {}
7
+ </script>
8
+
9
+ <script lang="ts">
10
+ import * as presence from '@zag-js/presence';
11
+ import {normalizeProps, useMachine} from '@zag-js/svelte';
12
+
13
+ let {present, immediate, onExitComplete, children, ...props}: PresenceProps = $props();
14
+
15
+ let [machineState, send] = useMachine(
16
+ presence.machine({
17
+ present,
18
+ immediate,
19
+ onExitComplete,
20
+ }),
21
+ );
22
+
23
+ let api = $derived(presence.connect(machineState, send, normalizeProps));
24
+
25
+ let node: HTMLElement | null = $state(null);
26
+
27
+ $effect(() => {
28
+ api.setNode(node);
29
+ });
30
+ </script>
31
+
32
+ <div
33
+ bind:this={node}
34
+ hidden={!api.present}
35
+ data-state={api.skip ? undefined : present ? 'open' : 'closed'}
36
+ {...props}
37
+ >
38
+ {@render children?.()}
39
+ </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 { useProgressContext } from "./context.svelte.js";
5
- let { children, ...props } = $props();
6
- let context = useProgressContext();
7
- let attrs = $derived(mergeProps(props, context.getCircleRangeProps()));
8
- </script>
9
-
10
- <circle {...attrs}>
11
- {@render children?.()}
12
- </circle>
1
+ <script lang="ts" context="module">
2
+ import type {Assign} from '../types.js';
3
+ import type {SvelteHTMLElements} from 'svelte/elements';
4
+
5
+ export interface ProgressCircleRangeProps extends Assign<SvelteHTMLElements['circle'], {}> {}
6
+ </script>
7
+
8
+ <script lang="ts">
9
+ import {mergeProps} from '@zag-js/svelte';
10
+ import {useProgressContext} from './context.svelte.js';
11
+
12
+ let {children, ...props}: ProgressCircleRangeProps = $props();
13
+
14
+ let context = useProgressContext();
15
+
16
+ let attrs = $derived(mergeProps(props, context.getCircleRangeProps()));
17
+ </script>
18
+
19
+ <circle {...attrs}>
20
+ {@render children?.()}
21
+ </circle>
@@ -1,12 +1,21 @@
1
- <script lang="ts" context="module"></script>
2
-
3
- <script lang="ts">import { mergeProps } from "@zag-js/svelte";
4
- import { useProgressContext } from "./context.svelte.js";
5
- let { children, ...props } = $props();
6
- let context = useProgressContext();
7
- let attrs = $derived(mergeProps(props, context.getCircleTrackProps()));
8
- </script>
9
-
10
- <circle {...attrs}>
11
- {@render children?.()}
12
- </circle>
1
+ <script lang="ts" context="module">
2
+ import type {Assign} from '../types.js';
3
+ import type {SvelteHTMLElements} from 'svelte/elements';
4
+
5
+ export interface ProgressCircleTrackProps extends Assign<SvelteHTMLElements['circle'], {}> {}
6
+ </script>
7
+
8
+ <script lang="ts">
9
+ import {mergeProps} from '@zag-js/svelte';
10
+ import {useProgressContext} from './context.svelte.js';
11
+
12
+ let {children, ...props}: ProgressCircleTrackProps = $props();
13
+
14
+ let context = useProgressContext();
15
+
16
+ let attrs = $derived(mergeProps(props, context.getCircleTrackProps()));
17
+ </script>
18
+
19
+ <circle {...attrs}>
20
+ {@render children?.()}
21
+ </circle>
@@ -1,12 +1,21 @@
1
- <script lang="ts" context="module"></script>
2
-
3
- <script lang="ts">import { mergeProps } from "@zag-js/svelte";
4
- import { useProgressContext } from "./context.svelte.js";
5
- let { children, ...props } = $props();
6
- let context = useProgressContext();
7
- let attrs = $derived(mergeProps(props, context.getCircleProps()));
8
- </script>
9
-
10
- <svg {...attrs}>
11
- {@render children?.()}
12
- </svg>
1
+ <script lang="ts" context="module">
2
+ import type {Assign} from '../types.js';
3
+ import type {SvelteHTMLElements} from 'svelte/elements';
4
+
5
+ export interface ProgressCircleProps extends Assign<SvelteHTMLElements['svg'], {}> {}
6
+ </script>
7
+
8
+ <script lang="ts">
9
+ import {mergeProps} from '@zag-js/svelte';
10
+ import {useProgressContext} from './context.svelte.js';
11
+
12
+ let {children, ...props}: ProgressCircleProps = $props();
13
+
14
+ let context = useProgressContext();
15
+
16
+ let attrs = $derived(mergeProps(props, context.getCircleProps()));
17
+ </script>
18
+
19
+ <svg {...attrs}>
20
+ {@render children?.()}
21
+ </svg>
@@ -1,12 +1,21 @@
1
- <script lang="ts" context="module"></script>
2
-
3
- <script lang="ts">import { mergeProps } from "@zag-js/svelte";
4
- import { useProgressContext } from "./context.svelte.js";
5
- let { children, ...props } = $props();
6
- let context = useProgressContext();
7
- let attrs = $derived(mergeProps(props, context.getLabelProps()));
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 ProgressLabelProps extends Assign<SvelteHTMLElements['div'], {}> {}
6
+ </script>
7
+
8
+ <script lang="ts">
9
+ import {mergeProps} from '@zag-js/svelte';
10
+ import {useProgressContext} from './context.svelte.js';
11
+
12
+ let {children, ...props}: ProgressLabelProps = $props();
13
+
14
+ let context = useProgressContext();
15
+
16
+ let attrs = $derived(mergeProps(props, context.getLabelProps()));
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 { useProgressContext } from "./context.svelte.js";
5
- let { children, ...props } = $props();
6
- let context = useProgressContext();
7
- let attrs = $derived(mergeProps(props, context.getRangeProps()));
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 ProgressRangeProps extends Assign<SvelteHTMLElements['div'], {}> {}
6
+ </script>
7
+
8
+ <script lang="ts">
9
+ import {mergeProps} from '@zag-js/svelte';
10
+ import {useProgressContext} from './context.svelte.js';
11
+
12
+ let {children, ...props}: ProgressRangeProps = $props();
13
+
14
+ let context = useProgressContext();
15
+
16
+ let attrs = $derived(mergeProps(props, context.getRangeProps()));
17
+ </script>
18
+
19
+ <div {...attrs}>
20
+ {@render children?.()}
21
+ </div>
@@ -1,36 +1,54 @@
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 { createProgressContext, setProgressContext } from "./context.svelte.js";
6
- let {
7
- id = uuid(),
8
- ids,
9
- dir,
10
- max,
11
- min,
12
- value,
13
- orientation,
14
- translations,
15
- getRootNode,
16
- children,
17
- ...props
18
- } = $props();
19
- let context = createProgressContext({
20
- id,
21
- ids,
22
- dir,
23
- max,
24
- min,
25
- value: $state.snapshot(value),
26
- orientation,
27
- translations,
28
- getRootNode
29
- });
30
- let attrs = $derived(mergeProps(props, context.getRootProps()));
31
- setProgressContext(context);
32
- </script>
33
-
34
- <div {...attrs}>
35
- {@render children?.(context)}
36
- </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 {CreateProgressContextProps, CreateProgressContextReturn} from './context.svelte.js';
6
+
7
+ export interface ProgressProps
8
+ extends Assign<
9
+ WithoutChildren<SvelteHTMLElements['div']>,
10
+ OptionalId<CreateProgressContextProps>
11
+ > {
12
+ children?: Snippet<[CreateProgressContextReturn]>;
13
+ }
14
+ </script>
15
+
16
+ <script lang="ts">
17
+ import {uuid} from '../utils.svelte.js';
18
+ import {mergeProps} from '@zag-js/svelte';
19
+ import {createProgressContext, setProgressContext} from './context.svelte.js';
20
+
21
+ let {
22
+ id = uuid(),
23
+ ids,
24
+ dir,
25
+ max,
26
+ min,
27
+ value,
28
+ orientation,
29
+ translations,
30
+ getRootNode,
31
+ children,
32
+ ...props
33
+ }: ProgressProps = $props();
34
+
35
+ let context = createProgressContext({
36
+ id,
37
+ ids,
38
+ dir,
39
+ max,
40
+ min,
41
+ value: $state.snapshot(value),
42
+ orientation,
43
+ translations,
44
+ getRootNode,
45
+ });
46
+
47
+ let attrs = $derived(mergeProps(props, context.getRootProps()));
48
+
49
+ setProgressContext(context);
50
+ </script>
51
+
52
+ <div {...attrs}>
53
+ {@render children?.(context)}
54
+ </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 { useProgressContext } from "./context.svelte.js";
5
- let { children, ...props } = $props();
6
- let context = useProgressContext();
7
- let attrs = $derived(mergeProps(props, context.getTrackProps()));
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 ProgressTrackProps extends Assign<SvelteHTMLElements['div'], {}> {}
6
+ </script>
7
+
8
+ <script lang="ts">
9
+ import {mergeProps} from '@zag-js/svelte';
10
+ import {useProgressContext} from './context.svelte.js';
11
+
12
+ let {children, ...props}: ProgressTrackProps = $props();
13
+
14
+ let context = useProgressContext();
15
+
16
+ let attrs = $derived(mergeProps(props, context.getTrackProps()));
17
+ </script>
18
+
19
+ <div {...attrs}>
20
+ {@render children?.()}
21
+ </div>
@@ -1,16 +1,25 @@
1
- <script lang="ts" context="module"></script>
2
-
3
- <script lang="ts">import { mergeProps } from "@zag-js/svelte";
4
- import { useProgressContext } from "./context.svelte.js";
5
- let { children, ...props } = $props();
6
- let context = useProgressContext();
7
- let attrs = $derived(mergeProps(props, context.getValueTextProps()));
8
- </script>
9
-
10
- <div {...attrs}>
11
- {#if children}
12
- {@render children()}
13
- {:else}
14
- {context.percentAsString}
15
- {/if}
16
- </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 ProgressValueTextProps extends Assign<SvelteHTMLElements['div'], {}> {}
6
+ </script>
7
+
8
+ <script lang="ts">
9
+ import {mergeProps} from '@zag-js/svelte';
10
+ import {useProgressContext} from './context.svelte.js';
11
+
12
+ let {children, ...props}: ProgressValueTextProps = $props();
13
+
14
+ let context = useProgressContext();
15
+
16
+ let attrs = $derived(mergeProps(props, context.getValueTextProps()));
17
+ </script>
18
+
19
+ <div {...attrs}>
20
+ {#if children}
21
+ {@render children()}
22
+ {:else}
23
+ {context.percentAsString}
24
+ {/if}
25
+ </div>