ui-ingredients 0.0.17 → 0.0.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (283) hide show
  1. package/dist/accordion/create-accordion.svelte.d.ts +2 -1
  2. package/dist/accordion/create-accordion.svelte.js +11 -1
  3. package/dist/accordion/item-content.svelte +3 -2
  4. package/dist/accordion/item-indicator.svelte +3 -2
  5. package/dist/accordion/item-trigger.svelte +3 -2
  6. package/dist/accordion/item.svelte +2 -2
  7. package/dist/accordion/root.svelte +3 -15
  8. package/dist/avatar/create-avatar.svelte.d.ts +2 -1
  9. package/dist/avatar/create-avatar.svelte.js +11 -1
  10. package/dist/avatar/fallback.svelte +2 -2
  11. package/dist/avatar/image.svelte +2 -2
  12. package/dist/avatar/root.svelte +11 -14
  13. package/dist/carousel/create-carousel.svelte.d.ts +2 -1
  14. package/dist/carousel/create-carousel.svelte.js +11 -1
  15. package/dist/carousel/indicator-group.svelte +2 -2
  16. package/dist/carousel/indicator.svelte +2 -3
  17. package/dist/carousel/item-group.svelte +2 -2
  18. package/dist/carousel/item.svelte +2 -2
  19. package/dist/carousel/next-trigger.svelte +2 -2
  20. package/dist/carousel/prev-trigger.svelte +2 -2
  21. package/dist/carousel/root.svelte +3 -15
  22. package/dist/carousel/viewport.svelte +2 -2
  23. package/dist/checkbox/control.svelte +2 -2
  24. package/dist/checkbox/create-checkbox.svelte.d.ts +2 -1
  25. package/dist/checkbox/create-checkbox.svelte.js +11 -1
  26. package/dist/checkbox/hidden-input.svelte +2 -2
  27. package/dist/checkbox/indicator.svelte +2 -2
  28. package/dist/checkbox/label.svelte +2 -2
  29. package/dist/checkbox/root.svelte +3 -18
  30. package/dist/clipboard/control.svelte +2 -2
  31. package/dist/clipboard/create-clipboard.svelte.d.ts +2 -1
  32. package/dist/clipboard/create-clipboard.svelte.js +8 -1
  33. package/dist/clipboard/indicator.svelte +2 -2
  34. package/dist/clipboard/input.svelte +2 -2
  35. package/dist/clipboard/label.svelte +2 -2
  36. package/dist/clipboard/root.svelte +3 -11
  37. package/dist/clipboard/trigger.svelte +2 -2
  38. package/dist/collapsible/content.svelte +2 -2
  39. package/dist/collapsible/create-collapsible.svelte.d.ts +2 -1
  40. package/dist/collapsible/create-collapsible.svelte.js +12 -1
  41. package/dist/collapsible/root.svelte +3 -20
  42. package/dist/collapsible/trigger.svelte +2 -2
  43. package/dist/combobox/clear-trigger.svelte +2 -2
  44. package/dist/combobox/content.svelte +2 -2
  45. package/dist/combobox/control.svelte +2 -2
  46. package/dist/combobox/create-combobox.svelte.d.ts +2 -1
  47. package/dist/combobox/create-combobox.svelte.js +9 -0
  48. package/dist/combobox/input.svelte +2 -2
  49. package/dist/combobox/item-group-label.svelte +2 -2
  50. package/dist/combobox/item-group.svelte +2 -2
  51. package/dist/combobox/item-indicator.svelte +2 -2
  52. package/dist/combobox/item-text.svelte +2 -2
  53. package/dist/combobox/item.svelte +2 -3
  54. package/dist/combobox/label.svelte +2 -2
  55. package/dist/combobox/list.svelte +2 -2
  56. package/dist/combobox/positioner.svelte +2 -2
  57. package/dist/combobox/root.svelte +3 -20
  58. package/dist/combobox/trigger.svelte +2 -2
  59. package/dist/dialog/backdrop.svelte +2 -2
  60. package/dist/dialog/close-trigger.svelte +2 -2
  61. package/dist/dialog/content.svelte +2 -2
  62. package/dist/dialog/create-dialog.svelte.d.ts +2 -1
  63. package/dist/dialog/create-dialog.svelte.js +12 -1
  64. package/dist/dialog/description.svelte +2 -2
  65. package/dist/dialog/positioner.svelte +2 -2
  66. package/dist/dialog/root.svelte +3 -17
  67. package/dist/dialog/title.svelte +2 -2
  68. package/dist/dialog/trigger.svelte +2 -2
  69. package/dist/editable/area.svelte +2 -2
  70. package/dist/editable/cancel-trigger.svelte +2 -2
  71. package/dist/editable/control.svelte +2 -2
  72. package/dist/editable/create-editable.svelte.d.ts +2 -1
  73. package/dist/editable/create-editable.svelte.js +12 -1
  74. package/dist/editable/edit-trigger.svelte +2 -2
  75. package/dist/editable/input.svelte +2 -2
  76. package/dist/editable/label.svelte +2 -2
  77. package/dist/editable/preview.svelte +2 -2
  78. package/dist/editable/root.svelte +3 -17
  79. package/dist/editable/submit-trigger.svelte +2 -2
  80. package/dist/environment-provider/root.svelte +21 -5
  81. package/dist/hover-card/arrow-tip.svelte +2 -2
  82. package/dist/hover-card/arrow.svelte +2 -2
  83. package/dist/hover-card/content.svelte +2 -2
  84. package/dist/hover-card/create-hover-card.svelte.d.ts +2 -1
  85. package/dist/hover-card/create-hover-card.svelte.js +12 -1
  86. package/dist/hover-card/positioner.svelte +2 -2
  87. package/dist/hover-card/root.svelte +3 -17
  88. package/dist/hover-card/trigger.svelte +2 -2
  89. package/dist/menu/arrow-tip.svelte +2 -2
  90. package/dist/menu/arrow.svelte +2 -2
  91. package/dist/menu/content.svelte +2 -2
  92. package/dist/menu/context-trigger.svelte +2 -2
  93. package/dist/menu/create-menu.svelte.d.ts +2 -1
  94. package/dist/menu/create-menu.svelte.js +12 -1
  95. package/dist/menu/indicator.svelte +2 -2
  96. package/dist/menu/item-group-label.svelte +2 -2
  97. package/dist/menu/item-group.svelte +2 -2
  98. package/dist/menu/item.svelte +2 -3
  99. package/dist/menu/option-item-indicator.svelte +2 -2
  100. package/dist/menu/option-item-text.svelte +2 -2
  101. package/dist/menu/option-item.svelte +2 -2
  102. package/dist/menu/positioner.svelte +2 -2
  103. package/dist/menu/root.svelte +3 -57
  104. package/dist/menu/separator.svelte +2 -2
  105. package/dist/menu/trigger-item.svelte +2 -2
  106. package/dist/menu/trigger.svelte +2 -2
  107. package/dist/number-input/control.svelte +2 -2
  108. package/dist/number-input/create-number-input.svelte.d.ts +2 -1
  109. package/dist/number-input/create-number-input.svelte.js +12 -1
  110. package/dist/number-input/decrement-trigger.svelte +2 -2
  111. package/dist/number-input/increment-trigger.svelte +2 -2
  112. package/dist/number-input/input.svelte +2 -2
  113. package/dist/number-input/label.svelte +2 -2
  114. package/dist/number-input/root.svelte +3 -20
  115. package/dist/number-input/scrubber.svelte +2 -2
  116. package/dist/pagination/create-pagination.svelte.d.ts +2 -1
  117. package/dist/pagination/create-pagination.svelte.js +11 -1
  118. package/dist/pagination/ellipsis.svelte +2 -3
  119. package/dist/pagination/item.svelte +10 -9
  120. package/dist/pagination/next-trigger.svelte +2 -2
  121. package/dist/pagination/prev-trigger.svelte +2 -2
  122. package/dist/pagination/root.svelte +3 -18
  123. package/dist/pin-input/clear-trigger.svelte +2 -2
  124. package/dist/pin-input/create-pin-input.svelte.d.ts +2 -1
  125. package/dist/pin-input/create-pin-input.svelte.js +11 -1
  126. package/dist/pin-input/hidden-input.svelte +2 -2
  127. package/dist/pin-input/input.svelte +2 -2
  128. package/dist/pin-input/label.svelte +2 -2
  129. package/dist/pin-input/root.svelte +3 -15
  130. package/dist/popover/arrow-tip.svelte +2 -2
  131. package/dist/popover/arrow.svelte +2 -2
  132. package/dist/popover/close-trigger.svelte +2 -2
  133. package/dist/popover/content.svelte +2 -2
  134. package/dist/popover/create-popover.svelte.d.ts +2 -1
  135. package/dist/popover/create-popover.svelte.js +12 -1
  136. package/dist/popover/description.svelte +2 -2
  137. package/dist/popover/positioner.svelte +2 -2
  138. package/dist/popover/root.svelte +3 -17
  139. package/dist/popover/title.svelte +2 -2
  140. package/dist/popover/trigger.svelte +2 -2
  141. package/dist/portal/root.svelte +4 -4
  142. package/dist/presence/root.svelte +2 -3
  143. package/dist/progress/circle-range.svelte +2 -2
  144. package/dist/progress/circle-track.svelte +2 -2
  145. package/dist/progress/circle.svelte +2 -2
  146. package/dist/progress/create-progress.svelte.d.ts +2 -1
  147. package/dist/progress/create-progress.svelte.js +11 -1
  148. package/dist/progress/label.svelte +2 -2
  149. package/dist/progress/range.svelte +2 -2
  150. package/dist/progress/root.svelte +4 -15
  151. package/dist/progress/track.svelte +2 -2
  152. package/dist/progress/value-text.svelte +2 -2
  153. package/dist/qr-code/create-qr-code.svelte.d.ts +2 -1
  154. package/dist/qr-code/create-qr-code.svelte.js +11 -1
  155. package/dist/qr-code/frame.svelte +2 -2
  156. package/dist/qr-code/overlay.svelte +2 -2
  157. package/dist/qr-code/pattern.svelte +2 -2
  158. package/dist/qr-code/root.svelte +3 -15
  159. package/dist/radio-group/create-radio-group.svelte.d.ts +2 -1
  160. package/dist/radio-group/create-radio-group.svelte.js +11 -1
  161. package/dist/radio-group/indicator.svelte +2 -2
  162. package/dist/radio-group/item-control.svelte +2 -2
  163. package/dist/radio-group/item-hidden-input.svelte +2 -2
  164. package/dist/radio-group/item-text.svelte +2 -2
  165. package/dist/radio-group/item.svelte +2 -2
  166. package/dist/radio-group/label.svelte +2 -2
  167. package/dist/radio-group/root.svelte +3 -18
  168. package/dist/rating-group/control.svelte +2 -2
  169. package/dist/rating-group/create-rating-group.svelte.d.ts +2 -1
  170. package/dist/rating-group/create-rating-group.svelte.js +11 -1
  171. package/dist/rating-group/hidden-input.svelte +2 -2
  172. package/dist/rating-group/item.svelte +2 -2
  173. package/dist/rating-group/label.svelte +2 -2
  174. package/dist/rating-group/root.svelte +3 -18
  175. package/dist/segment-group/create-segment-group.svelte.d.ts +2 -1
  176. package/dist/segment-group/create-segment-group.svelte.js +11 -1
  177. package/dist/segment-group/indicator.svelte +2 -2
  178. package/dist/segment-group/item-control.svelte +2 -2
  179. package/dist/segment-group/item-hidden-input.svelte +2 -2
  180. package/dist/segment-group/item-text.svelte +2 -2
  181. package/dist/segment-group/item.svelte +2 -2
  182. package/dist/segment-group/label.svelte +2 -2
  183. package/dist/segment-group/root.svelte +4 -18
  184. package/dist/select/clear-trigger.svelte +2 -2
  185. package/dist/select/content.svelte +2 -2
  186. package/dist/select/control.svelte +2 -2
  187. package/dist/select/create-select.svelte.d.ts +2 -1
  188. package/dist/select/create-select.svelte.js +9 -0
  189. package/dist/select/hidden-select.svelte +2 -2
  190. package/dist/select/indicator.svelte +2 -2
  191. package/dist/select/item-group-label.svelte +2 -2
  192. package/dist/select/item-group.svelte +2 -2
  193. package/dist/select/item-indicator.svelte +2 -2
  194. package/dist/select/item-text.svelte +2 -2
  195. package/dist/select/item.svelte +2 -3
  196. package/dist/select/label.svelte +2 -2
  197. package/dist/select/list.svelte +2 -2
  198. package/dist/select/positioner.svelte +2 -2
  199. package/dist/select/root.svelte +3 -17
  200. package/dist/select/trigger.svelte +2 -2
  201. package/dist/select/value-text.svelte +2 -2
  202. package/dist/slider/control.svelte +2 -2
  203. package/dist/slider/create-slider.svelte.d.ts +2 -1
  204. package/dist/slider/create-slider.svelte.js +11 -1
  205. package/dist/slider/hidden-input.svelte +2 -2
  206. package/dist/slider/label.svelte +2 -2
  207. package/dist/slider/marker-group.svelte +2 -2
  208. package/dist/slider/marker.svelte +2 -2
  209. package/dist/slider/range.svelte +2 -2
  210. package/dist/slider/root.svelte +3 -15
  211. package/dist/slider/thumb.svelte +2 -2
  212. package/dist/slider/track.svelte +2 -2
  213. package/dist/slider/value-text.svelte +2 -2
  214. package/dist/steps/content.svelte +2 -2
  215. package/dist/steps/create-steps.svelte.d.ts +2 -1
  216. package/dist/steps/create-steps.svelte.js +11 -1
  217. package/dist/steps/indicator.svelte +2 -2
  218. package/dist/steps/item.svelte +2 -3
  219. package/dist/steps/list.svelte +2 -2
  220. package/dist/steps/next-trigger.svelte +2 -2
  221. package/dist/steps/prev-trigger.svelte +2 -2
  222. package/dist/steps/progress.svelte +2 -2
  223. package/dist/steps/root.svelte +3 -15
  224. package/dist/steps/separator.svelte +2 -2
  225. package/dist/steps/trigger.svelte +2 -2
  226. package/dist/switch/control.svelte +2 -2
  227. package/dist/switch/create-switch.svelte.d.ts +2 -1
  228. package/dist/switch/create-switch.svelte.js +11 -1
  229. package/dist/switch/hidden-input.svelte +2 -2
  230. package/dist/switch/label.svelte +2 -2
  231. package/dist/switch/root.svelte +3 -15
  232. package/dist/switch/thumb.svelte +2 -2
  233. package/dist/tabs/content.svelte +2 -2
  234. package/dist/tabs/create-tabs.svelte.d.ts +2 -1
  235. package/dist/tabs/create-tabs.svelte.js +11 -1
  236. package/dist/tabs/list.svelte +2 -2
  237. package/dist/tabs/root.svelte +3 -16
  238. package/dist/tabs/trigger.svelte +2 -2
  239. package/dist/tags-input/clear-trigger.svelte +2 -2
  240. package/dist/tags-input/control.svelte +2 -2
  241. package/dist/tags-input/create-tags-input.svelte.d.ts +2 -1
  242. package/dist/tags-input/create-tags-input.svelte.js +11 -1
  243. package/dist/tags-input/hidden-input.svelte +2 -2
  244. package/dist/tags-input/input.svelte +2 -2
  245. package/dist/tags-input/item-delete-trigger.svelte +2 -2
  246. package/dist/tags-input/item-input.svelte +2 -2
  247. package/dist/tags-input/item-preview.svelte +2 -2
  248. package/dist/tags-input/item-text.svelte +2 -2
  249. package/dist/tags-input/item.svelte +2 -2
  250. package/dist/tags-input/label.svelte +2 -2
  251. package/dist/tags-input/root.svelte +3 -15
  252. package/dist/timer/action-trigger.svelte +2 -2
  253. package/dist/timer/create-timer.svelte.d.ts +2 -1
  254. package/dist/timer/create-timer.svelte.js +8 -1
  255. package/dist/timer/item-label.svelte +2 -2
  256. package/dist/timer/item-value.svelte +2 -2
  257. package/dist/timer/item.svelte +2 -2
  258. package/dist/timer/root.svelte +3 -12
  259. package/dist/timer/separator.svelte +2 -2
  260. package/dist/toast/action-trigger.svelte +2 -2
  261. package/dist/toast/close-trigger.svelte +2 -2
  262. package/dist/toast/create-toaster.svelte.d.ts +2 -4
  263. package/dist/toast/create-toaster.svelte.js +4 -7
  264. package/dist/toast/description.svelte +2 -2
  265. package/dist/toast/index.d.ts +1 -1
  266. package/dist/toast/index.js +1 -1
  267. package/dist/toast/root.svelte +2 -2
  268. package/dist/toast/title.svelte +2 -2
  269. package/dist/toast/toaster.svelte +2 -2
  270. package/dist/toggle-group/create-toggle-group.svelte.d.ts +2 -1
  271. package/dist/toggle-group/create-toggle-group.svelte.js +11 -1
  272. package/dist/toggle-group/item.svelte +2 -2
  273. package/dist/toggle-group/root.svelte +3 -18
  274. package/dist/tooltip/arrow-tip.svelte +2 -2
  275. package/dist/tooltip/arrow.svelte +2 -2
  276. package/dist/tooltip/content.svelte +2 -2
  277. package/dist/tooltip/create-tooltip.svelte.d.ts +2 -1
  278. package/dist/tooltip/create-tooltip.svelte.js +12 -1
  279. package/dist/tooltip/positioner.svelte +2 -2
  280. package/dist/tooltip/root.svelte +3 -17
  281. package/dist/tooltip/trigger.svelte +2 -2
  282. package/dist/types.d.ts +1 -5
  283. package/package.json +4 -2
@@ -1,17 +1,15 @@
1
1
  <script lang="ts" module>
2
- import type {Assign, HtmlIngredientProps} from '../types.js';
2
+ import type {Assign, HtmlProps} from '../types.js';
3
3
  import type {Snippet} from 'svelte';
4
4
  import type {CreateClipboardProps, CreateClipboardReturn} from './create-clipboard.svelte.js';
5
5
 
6
6
  export interface ClipboardProps
7
- extends Assign<Omit<HtmlIngredientProps<'div'>, 'children'>, Omit<CreateClipboardProps, 'id'>> {
7
+ extends Assign<Omit<HtmlProps<'div'>, 'children'>, CreateClipboardProps> {
8
8
  children?: Snippet<[api: CreateClipboardReturn]>;
9
9
  }
10
10
  </script>
11
11
 
12
12
  <script lang="ts">
13
- import {getEnvironmentContext} from '../environment-provider/index.js';
14
- import {createUniqueId} from '../utils.svelte.js';
15
13
  import {mergeProps} from '@zag-js/svelte';
16
14
  import {clipboardContext} from './context.svelte.js';
17
15
  import {createClipboard} from './create-clipboard.svelte.js';
@@ -23,22 +21,16 @@
23
21
  value,
24
22
  timeout,
25
23
  onStatusChange,
26
- getRootNode,
27
24
  children,
28
25
  ...props
29
26
  }: ClipboardProps = $props();
30
27
 
31
- let environmentContext = getEnvironmentContext();
32
-
33
- let uid = createUniqueId();
34
-
35
28
  let context = createClipboard({
36
- id: id ?? uid,
29
+ id,
37
30
  ids,
38
31
  value: $state.snapshot(value),
39
32
  timeout,
40
33
  onStatusChange,
41
- getRootNode: getRootNode ?? environmentContext?.getRootNode,
42
34
  });
43
35
 
44
36
  let attrs = $derived(mergeProps(props, context.getRootProps()));
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" module>
2
- import type {HtmlIngredientProps} from '../types.js';
2
+ import type {HtmlProps} from '../types.js';
3
3
 
4
- export interface ClipboardTriggerProps extends HtmlIngredientProps<'button'> {}
4
+ export interface ClipboardTriggerProps extends HtmlProps<'button'> {}
5
5
  </script>
6
6
 
7
7
  <script lang="ts">
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" module>
2
- import type {HtmlIngredientProps} from '../types.js';
2
+ import type {HtmlProps} from '../types.js';
3
3
 
4
- export interface CollapsibleContentProps extends HtmlIngredientProps<'div'> {}
4
+ export interface CollapsibleContentProps extends HtmlProps<'div'> {}
5
5
  </script>
6
6
 
7
7
  <script lang="ts">
@@ -1,5 +1,6 @@
1
1
  import * as collapsible from '@zag-js/collapsible';
2
- export interface CreateCollapsibleProps extends collapsible.Context {
2
+ export interface CreateCollapsibleProps extends Omit<collapsible.Context, 'id' | 'dir' | 'getRootNode' | 'open.controlled'> {
3
+ id?: string | null;
3
4
  }
4
5
  export interface CreateCollapsibleReturn extends collapsible.Api {
5
6
  }
@@ -1,7 +1,18 @@
1
+ import { getEnvironmentContext } from '../environment-provider/context.svelte.js';
2
+ import { getLocaleContext } from '../locale-provider/context.svelte.js';
3
+ import { createUniqueId } from '../utils.svelte.js';
1
4
  import * as collapsible from '@zag-js/collapsible';
2
5
  import { normalizeProps, reflect, useMachine } from '@zag-js/svelte';
3
6
  export function createCollapsible(props) {
4
- const [state, send] = useMachine(collapsible.machine(props));
7
+ const localeContext = getLocaleContext();
8
+ const environmentContext = getEnvironmentContext();
9
+ const [state, send] = useMachine(collapsible.machine({
10
+ ...props,
11
+ id: props.id ?? createUniqueId(),
12
+ dir: localeContext?.dir,
13
+ getRootNode: environmentContext?.getRootNode,
14
+ 'open.controlled': props.open != null,
15
+ }));
5
16
  const api = $derived(reflect(() => collapsible.connect(state, send, normalizeProps)));
6
17
  return api;
7
18
  }
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" module>
2
- import type {Assign, HtmlIngredientProps} from '../types.js';
2
+ import type {Assign, HtmlProps} from '../types.js';
3
3
  import type {Snippet} from 'svelte';
4
4
  import type {
5
5
  CreateCollapsibleProps,
@@ -7,18 +7,12 @@
7
7
  } from './create-collapsible.svelte.js';
8
8
 
9
9
  export interface CollapsibleProps
10
- extends Assign<
11
- Omit<HtmlIngredientProps<'div'>, 'children'>,
12
- Omit<CreateCollapsibleProps, 'id'>
13
- > {
10
+ extends Assign<Omit<HtmlProps<'div'>, 'children'>, CreateCollapsibleProps> {
14
11
  children?: Snippet<[api: CreateCollapsibleReturn]>;
15
12
  }
16
13
  </script>
17
14
 
18
15
  <script lang="ts">
19
- import {getEnvironmentContext} from '../environment-provider/index.js';
20
- import {getLocaleContext} from '../locale-provider/index.js';
21
- import {createUniqueId} from '../utils.svelte.js';
22
16
  import {mergeProps} from '@zag-js/svelte';
23
17
  import {collapsibleContext} from './context.svelte.js';
24
18
  import {createCollapsible} from './create-collapsible.svelte.js';
@@ -26,32 +20,21 @@
26
20
  let {
27
21
  id,
28
22
  ids,
29
- dir,
30
23
  open,
31
- 'open.controlled': openControlled,
32
24
  disabled,
33
25
  onOpenChange,
34
26
  onExitComplete,
35
- getRootNode,
36
27
  children,
37
28
  ...props
38
29
  }: CollapsibleProps = $props();
39
30
 
40
- let localeContext = getLocaleContext();
41
- let environmentContext = getEnvironmentContext();
42
-
43
- let uid = createUniqueId();
44
-
45
31
  let context = createCollapsible({
46
- id: id ?? uid,
32
+ id,
47
33
  ids,
48
- dir: dir ?? localeContext?.dir,
49
34
  open,
50
- 'open.controlled': openControlled,
51
35
  disabled,
52
36
  onOpenChange,
53
37
  onExitComplete,
54
- getRootNode: getRootNode ?? environmentContext?.getRootNode,
55
38
  });
56
39
 
57
40
  let mergedProps = $derived(mergeProps(props, context.getRootProps()));
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" module>
2
- import type {HtmlIngredientProps} from '../types.js';
2
+ import type {HtmlProps} from '../types.js';
3
3
 
4
- export interface CollapsibleTriggerProps extends HtmlIngredientProps<'button'> {}
4
+ export interface CollapsibleTriggerProps extends HtmlProps<'button'> {}
5
5
  </script>
6
6
 
7
7
  <script lang="ts">
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" module>
2
- import type {HtmlIngredientProps} from '../types.js';
2
+ import type {HtmlProps} from '../types.js';
3
3
 
4
- export interface ComboboxClearTriggerProps extends HtmlIngredientProps<'button'> {}
4
+ export interface ComboboxClearTriggerProps extends HtmlProps<'button'> {}
5
5
  </script>
6
6
 
7
7
  <script lang="ts">
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" module>
2
- import type {HtmlIngredientProps} from '../types.js';
2
+ import type {HtmlProps} from '../types.js';
3
3
 
4
- export interface ComboboxContentProps extends HtmlIngredientProps<'div'> {}
4
+ export interface ComboboxContentProps extends HtmlProps<'div'> {}
5
5
  </script>
6
6
 
7
7
  <script lang="ts">
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" module>
2
- import type {HtmlIngredientProps} from '../types.js';
2
+ import type {HtmlProps} from '../types.js';
3
3
 
4
- export interface ComboboxControlProps extends HtmlIngredientProps<'div'> {}
4
+ export interface ComboboxControlProps extends HtmlProps<'div'> {}
5
5
  </script>
6
6
 
7
7
  <script lang="ts">
@@ -1,5 +1,6 @@
1
1
  import * as combobox from '@zag-js/combobox';
2
- export interface CreateComboboxProps<T> extends Omit<combobox.Context, 'collection'> {
2
+ export interface CreateComboboxProps<T> extends Omit<combobox.Context, 'id' | 'dir' | 'collection' | 'getRootNode' | 'open.controlled'> {
3
+ id?: string | null;
3
4
  items: T[];
4
5
  itemToString?: (item: T) => string;
5
6
  itemToValue?: (item: T) => string;
@@ -1,3 +1,6 @@
1
+ import { getEnvironmentContext } from '../environment-provider/context.svelte.js';
2
+ import { getLocaleContext } from '../locale-provider/context.svelte.js';
3
+ import { createUniqueId } from '../utils.svelte.js';
1
4
  import * as combobox from '@zag-js/combobox';
2
5
  import { normalizeProps, reflect, useMachine } from '@zag-js/svelte';
3
6
  export function createCombobox(props) {
@@ -7,8 +10,14 @@ export function createCombobox(props) {
7
10
  itemToString: (item) => (props.itemToString ? props.itemToString(item) : String(item)),
8
11
  isItemDisabled: (item) => (props.isItemDisabled ? props.isItemDisabled(item) : false),
9
12
  }));
13
+ const localeContext = getLocaleContext();
14
+ const environmentContext = getEnvironmentContext();
10
15
  const [state, send] = useMachine(combobox.machine({
11
16
  ...props,
17
+ id: props.id ?? createUniqueId(),
18
+ dir: localeContext?.dir,
19
+ getRootNode: environmentContext?.getRootNode,
20
+ 'open.controlled': props.open != null,
12
21
  collection,
13
22
  }));
14
23
  const api = $derived(reflect(() => ({
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" module>
2
- import type {HtmlIngredientProps} from '../types.js';
2
+ import type {HtmlProps} from '../types.js';
3
3
 
4
- export interface ComboboxInputProps extends HtmlIngredientProps<'input'> {}
4
+ export interface ComboboxInputProps extends HtmlProps<'input'> {}
5
5
  </script>
6
6
 
7
7
  <script lang="ts">
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" module>
2
- import type {HtmlIngredientProps} from '../types.js';
2
+ import type {HtmlProps} from '../types.js';
3
3
 
4
- export interface ComboboxItemGroupLabelProps extends HtmlIngredientProps<'span'> {}
4
+ export interface ComboboxItemGroupLabelProps extends HtmlProps<'span'> {}
5
5
  </script>
6
6
 
7
7
  <script lang="ts">
@@ -1,9 +1,9 @@
1
1
  <script lang="ts" module>
2
- import type {Assign, HtmlIngredientProps} from '../types.js';
2
+ import type {Assign, HtmlProps} from '../types.js';
3
3
  import type {ItemGroupProps} from '@zag-js/combobox';
4
4
 
5
5
  export interface ComboboxItemGroupProps
6
- extends Assign<HtmlIngredientProps<'div'>, Omit<ItemGroupProps, 'id'>> {}
6
+ extends Assign<HtmlProps<'div'>, Omit<ItemGroupProps, 'id'>> {}
7
7
  </script>
8
8
 
9
9
  <script lang="ts">
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" module>
2
- import type {HtmlIngredientProps} from '../types.js';
2
+ import type {HtmlProps} from '../types.js';
3
3
 
4
- export interface ComboboxItemIndicatorProps extends HtmlIngredientProps<'span'> {}
4
+ export interface ComboboxItemIndicatorProps extends HtmlProps<'span'> {}
5
5
  </script>
6
6
 
7
7
  <script lang="ts">
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" module>
2
- import type {HtmlIngredientProps} from '../types.js';
2
+ import type {HtmlProps} from '../types.js';
3
3
 
4
- export interface ComboboxItemTextProps extends HtmlIngredientProps<'span'> {}
4
+ export interface ComboboxItemTextProps extends HtmlProps<'span'> {}
5
5
  </script>
6
6
 
7
7
  <script lang="ts">
@@ -1,10 +1,9 @@
1
1
  <script lang="ts" module>
2
- import type {Assign, HtmlIngredientProps} from '../types.js';
2
+ import type {Assign, HtmlProps} from '../types.js';
3
3
  import type {ItemProps, ItemState} from '@zag-js/combobox';
4
4
  import type {Snippet} from 'svelte';
5
5
 
6
- export interface ComboboxItemProps
7
- extends Assign<Omit<HtmlIngredientProps<'div'>, 'children'>, ItemProps> {
6
+ export interface ComboboxItemProps extends Assign<Omit<HtmlProps<'div'>, 'children'>, ItemProps> {
8
7
  children?: Snippet<[state: ItemState]>;
9
8
  }
10
9
  </script>
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" module>
2
- import type {HtmlIngredientProps} from '../types.js';
2
+ import type {HtmlProps} from '../types.js';
3
3
 
4
- export interface ComboboxLabelProps extends HtmlIngredientProps<'label'> {}
4
+ export interface ComboboxLabelProps extends HtmlProps<'label'> {}
5
5
  </script>
6
6
 
7
7
  <script lang="ts">
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" module>
2
- import type {HtmlIngredientProps} from '../types.js';
2
+ import type {HtmlProps} from '../types.js';
3
3
 
4
- export interface ComboboxListProps extends HtmlIngredientProps<'div'> {}
4
+ export interface ComboboxListProps extends HtmlProps<'div'> {}
5
5
  </script>
6
6
 
7
7
  <script lang="ts">
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" module>
2
- import type {HtmlIngredientProps} from '../types.js';
2
+ import type {HtmlProps} from '../types.js';
3
3
 
4
- export interface ComboboxPositionerProps extends HtmlIngredientProps<'div'> {}
4
+ export interface ComboboxPositionerProps extends HtmlProps<'div'> {}
5
5
  </script>
6
6
 
7
7
  <script lang="ts">
@@ -1,21 +1,15 @@
1
1
  <script lang="ts" module>
2
- import type {Assign, HtmlIngredientProps} from '../types.js';
2
+ import type {Assign, HtmlProps} from '../types.js';
3
3
  import type {Snippet} from 'svelte';
4
4
  import type {CreateComboboxProps, CreateComboboxReturn} from './create-combobox.svelte.js';
5
5
 
6
6
  export interface ComboboxProps<T>
7
- extends Assign<
8
- Omit<HtmlIngredientProps<'div'>, 'children'>,
9
- Omit<CreateComboboxProps<T>, 'id'>
10
- > {
7
+ extends Assign<Omit<HtmlProps<'div'>, 'children'>, CreateComboboxProps<T>> {
11
8
  children?: Snippet<[api: CreateComboboxReturn]>;
12
9
  }
13
10
  </script>
14
11
 
15
12
  <script lang="ts" generics="T">
16
- import {getEnvironmentContext} from '../environment-provider/index.js';
17
- import {getLocaleContext} from '../locale-provider/index.js';
18
- import {createUniqueId} from '../utils.svelte.js';
19
13
  import {mergeProps} from '@zag-js/svelte';
20
14
  import {comboboxContext} from './context.svelte.js';
21
15
  import {createCombobox} from './create-combobox.svelte.js';
@@ -23,11 +17,9 @@
23
17
  let {
24
18
  id,
25
19
  ids,
26
- dir,
27
20
  name,
28
21
  form,
29
22
  open,
30
- 'open.controlled': openControlled,
31
23
  items,
32
24
  value,
33
25
  invalid,
@@ -63,24 +55,16 @@
63
55
  onPointerDownOutside,
64
56
  getSelectionValue,
65
57
  scrollToIndexFn,
66
- getRootNode,
67
58
  children,
68
59
  ...props
69
60
  }: ComboboxProps<T> = $props();
70
61
 
71
- let localeContext = getLocaleContext();
72
- let environmentContext = getEnvironmentContext();
73
-
74
- let uid = createUniqueId();
75
-
76
62
  let context = createCombobox({
77
- id: id ?? uid,
63
+ id,
78
64
  ids,
79
- dir: dir ?? localeContext?.dir,
80
65
  name,
81
66
  form,
82
67
  open,
83
- 'open.controlled': openControlled,
84
68
  items,
85
69
  value: $state.snapshot(value),
86
70
  invalid,
@@ -116,7 +100,6 @@
116
100
  onPointerDownOutside,
117
101
  getSelectionValue,
118
102
  scrollToIndexFn,
119
- getRootNode: getRootNode ?? environmentContext?.getRootNode,
120
103
  });
121
104
 
122
105
  let attrs = $derived(mergeProps(props, context.getRootProps()));
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" module>
2
- import type {HtmlIngredientProps} from '../types.js';
2
+ import type {HtmlProps} from '../types.js';
3
3
 
4
- export interface ComboboxTriggerProps extends HtmlIngredientProps<'button'> {}
4
+ export interface ComboboxTriggerProps extends HtmlProps<'button'> {}
5
5
  </script>
6
6
 
7
7
  <script lang="ts">
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" module>
2
- import type {HtmlIngredientProps} from '../types.js';
2
+ import type {HtmlProps} from '../types.js';
3
3
 
4
- export interface DialogBackdropProps extends HtmlIngredientProps<'div'> {}
4
+ export interface DialogBackdropProps extends HtmlProps<'div'> {}
5
5
  </script>
6
6
 
7
7
  <script lang="ts">
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" module>
2
- import type {HtmlIngredientProps} from '../types.js';
2
+ import type {HtmlProps} from '../types.js';
3
3
 
4
- export interface DialogCloseTriggerProps extends HtmlIngredientProps<'button'> {}
4
+ export interface DialogCloseTriggerProps extends HtmlProps<'button'> {}
5
5
  </script>
6
6
 
7
7
  <script lang="ts">
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" module>
2
- import type {HtmlIngredientProps} from '../types.js';
2
+ import type {HtmlProps} from '../types.js';
3
3
 
4
- export interface DialogContentProps extends HtmlIngredientProps<'div'> {}
4
+ export interface DialogContentProps extends HtmlProps<'div'> {}
5
5
  </script>
6
6
 
7
7
  <script lang="ts">
@@ -1,5 +1,6 @@
1
1
  import * as dialog from '@zag-js/dialog';
2
- export interface CreateDialogProps extends dialog.Context {
2
+ export interface CreateDialogProps extends Omit<dialog.Context, 'id' | 'dir' | 'getRootNode' | 'open.controlled'> {
3
+ id?: string | null;
3
4
  }
4
5
  export interface CreateDialogReturn extends dialog.Api {
5
6
  }
@@ -1,7 +1,18 @@
1
+ import { getEnvironmentContext } from '../environment-provider/context.svelte.js';
2
+ import { getLocaleContext } from '../locale-provider/context.svelte.js';
3
+ import { createUniqueId } from '../utils.svelte.js';
1
4
  import * as dialog from '@zag-js/dialog';
2
5
  import { normalizeProps, reflect, useMachine } from '@zag-js/svelte';
3
6
  export function createDialog(props) {
4
- const [state, send] = useMachine(dialog.machine(props));
7
+ const localeContext = getLocaleContext();
8
+ const environmentContext = getEnvironmentContext();
9
+ const [state, send] = useMachine(dialog.machine({
10
+ ...props,
11
+ id: props.id ?? createUniqueId(),
12
+ dir: localeContext?.dir,
13
+ getRootNode: environmentContext?.getRootNode,
14
+ 'open.controlled': props.open != null,
15
+ }));
5
16
  const api = $derived(reflect(() => dialog.connect(state, send, normalizeProps)));
6
17
  return api;
7
18
  }
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" module>
2
- import type {HtmlIngredientProps} from '../types.js';
2
+ import type {HtmlProps} from '../types.js';
3
3
 
4
- export interface DialogDescriptionProps extends HtmlIngredientProps<'div'> {}
4
+ export interface DialogDescriptionProps extends HtmlProps<'div'> {}
5
5
  </script>
6
6
 
7
7
  <script lang="ts">
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" module>
2
- import type {HtmlIngredientProps} from '../types.js';
2
+ import type {HtmlProps} from '../types.js';
3
3
 
4
- export interface DialogPositionerProps extends HtmlIngredientProps<'div'> {}
4
+ export interface DialogPositionerProps extends HtmlProps<'div'> {}
5
5
  </script>
6
6
 
7
7
  <script lang="ts">
@@ -2,32 +2,18 @@
2
2
  import type {Snippet} from 'svelte';
3
3
  import type {CreateDialogProps, CreateDialogReturn} from './create-dialog.svelte.js';
4
4
 
5
- export interface DialogProps extends Omit<CreateDialogProps, 'id'> {
6
- id?: string | null;
5
+ export interface DialogProps extends CreateDialogProps {
7
6
  children?: Snippet<[api: CreateDialogReturn]>;
8
7
  }
9
8
  </script>
10
9
 
11
10
  <script lang="ts">
12
- import {getEnvironmentContext} from '../environment-provider/index.js';
13
- import {getLocaleContext} from '../locale-provider/index.js';
14
- import {createUniqueId} from '../utils.svelte.js';
15
11
  import {dialogContext} from './context.svelte.js';
16
12
  import {createDialog} from './create-dialog.svelte.js';
17
13
 
18
- let {id, dir, getRootNode, children, ...props}: DialogProps = $props();
14
+ let {children, ...props}: DialogProps = $props();
19
15
 
20
- let localeContext = getLocaleContext();
21
- let environmentContext = getEnvironmentContext();
22
-
23
- let uid = createUniqueId();
24
-
25
- let context = createDialog({
26
- id: id ?? uid,
27
- dir: dir ?? localeContext?.dir,
28
- getRootNode: getRootNode ?? environmentContext?.getRootNode,
29
- ...props,
30
- });
16
+ let context = createDialog(props);
31
17
 
32
18
  dialogContext.set(context);
33
19
  </script>
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" module>
2
- import type {HtmlIngredientProps} from '../types.js';
2
+ import type {HtmlProps} from '../types.js';
3
3
 
4
- export interface DialogTitleProps extends HtmlIngredientProps<'div'> {}
4
+ export interface DialogTitleProps extends HtmlProps<'div'> {}
5
5
  </script>
6
6
 
7
7
  <script lang="ts">
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" module>
2
- import type {HtmlIngredientProps} from '../types.js';
2
+ import type {HtmlProps} from '../types.js';
3
3
 
4
- export interface DialogTriggerProps extends HtmlIngredientProps<'button'> {}
4
+ export interface DialogTriggerProps extends HtmlProps<'button'> {}
5
5
  </script>
6
6
 
7
7
  <script lang="ts">
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" module>
2
- import type {HtmlIngredientProps} from '../types.js';
2
+ import type {HtmlProps} from '../types.js';
3
3
 
4
- export interface EditableAreaProps extends HtmlIngredientProps<'div'> {}
4
+ export interface EditableAreaProps extends HtmlProps<'div'> {}
5
5
  </script>
6
6
 
7
7
  <script lang="ts">
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" module>
2
- import type {HtmlIngredientProps} from '../types.js';
2
+ import type {HtmlProps} from '../types.js';
3
3
 
4
- export interface EditableCancelTriggerProps extends HtmlIngredientProps<'button'> {}
4
+ export interface EditableCancelTriggerProps extends HtmlProps<'button'> {}
5
5
  </script>
6
6
 
7
7
  <script lang="ts">
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" module>
2
- import type {HtmlIngredientProps} from '../types.js';
2
+ import type {HtmlProps} from '../types.js';
3
3
 
4
- export interface EditableControlProps extends HtmlIngredientProps<'div'> {}
4
+ export interface EditableControlProps extends HtmlProps<'div'> {}
5
5
  </script>
6
6
 
7
7
  <script lang="ts">
@@ -1,5 +1,6 @@
1
1
  import * as editable from '@zag-js/editable';
2
- export interface CreateEditableProps extends editable.Context {
2
+ export interface CreateEditableProps extends Omit<editable.Context, 'id' | 'dir' | 'getRootNode' | 'edit.controlled'> {
3
+ id?: string | null;
3
4
  }
4
5
  export interface CreateEditableReturn extends editable.Api {
5
6
  }
@@ -1,7 +1,18 @@
1
+ import { getEnvironmentContext } from '../environment-provider/context.svelte.js';
2
+ import { getLocaleContext } from '../locale-provider/context.svelte.js';
3
+ import { createUniqueId } from '../utils.svelte.js';
1
4
  import * as editable from '@zag-js/editable';
2
5
  import { normalizeProps, reflect, useMachine } from '@zag-js/svelte';
3
6
  export function createEditable(props) {
4
- const [state, send] = useMachine(editable.machine(props));
7
+ const localeContext = getLocaleContext();
8
+ const environmentContext = getEnvironmentContext();
9
+ const [state, send] = useMachine(editable.machine({
10
+ ...props,
11
+ id: props.id ?? createUniqueId(),
12
+ dir: localeContext?.dir,
13
+ getRootNode: environmentContext?.getRootNode,
14
+ 'edit.controlled': props.edit != null,
15
+ }));
5
16
  const api = $derived(reflect(() => editable.connect(state, send, normalizeProps)));
6
17
  return api;
7
18
  }
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" module>
2
- import type {HtmlIngredientProps} from '../types.js';
2
+ import type {HtmlProps} from '../types.js';
3
3
 
4
- export interface EditableEditTriggerProps extends HtmlIngredientProps<'button'> {}
4
+ export interface EditableEditTriggerProps extends HtmlProps<'button'> {}
5
5
  </script>
6
6
 
7
7
  <script lang="ts">