ui-ingredients 0.0.30 → 0.0.32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (219) hide show
  1. package/README.md +1 -0
  2. package/dist/accordion/accordion.d.ts +0 -1
  3. package/dist/accordion/accordion.js +0 -1
  4. package/dist/accordion/create-accordion.svelte.js +2 -2
  5. package/dist/accordion/index.d.ts +1 -0
  6. package/dist/accordion/index.js +1 -0
  7. package/dist/avatar/avatar.d.ts +0 -1
  8. package/dist/avatar/avatar.js +0 -1
  9. package/dist/avatar/create-avatar.svelte.js +2 -2
  10. package/dist/avatar/index.d.ts +1 -0
  11. package/dist/avatar/index.js +1 -0
  12. package/dist/carousel/carousel.d.ts +0 -1
  13. package/dist/carousel/carousel.js +0 -1
  14. package/dist/carousel/create-carousel.svelte.js +2 -2
  15. package/dist/carousel/index.d.ts +1 -0
  16. package/dist/carousel/index.js +1 -0
  17. package/dist/checkbox/checkbox.d.ts +0 -1
  18. package/dist/checkbox/checkbox.js +0 -1
  19. package/dist/checkbox/create-checkbox.svelte.js +12 -2
  20. package/dist/checkbox/index.d.ts +1 -0
  21. package/dist/checkbox/index.js +1 -0
  22. package/dist/clipboard/clipboard.d.ts +0 -1
  23. package/dist/clipboard/clipboard.js +0 -1
  24. package/dist/clipboard/create-clipboard.svelte.js +2 -2
  25. package/dist/clipboard/index.d.ts +1 -0
  26. package/dist/clipboard/index.js +1 -0
  27. package/dist/collapsible/collapsible.d.ts +0 -1
  28. package/dist/collapsible/collapsible.js +0 -1
  29. package/dist/collapsible/create-collapsible.svelte.js +2 -2
  30. package/dist/collapsible/index.d.ts +1 -0
  31. package/dist/collapsible/index.js +1 -0
  32. package/dist/color-picker/color-picker.d.ts +1 -1
  33. package/dist/color-picker/color-picker.js +1 -1
  34. package/dist/color-picker/create-color-picker.svelte.js +2 -2
  35. package/dist/color-picker/index.d.ts +1 -0
  36. package/dist/color-picker/index.js +1 -0
  37. package/dist/combobox/combobox.d.ts +0 -1
  38. package/dist/combobox/combobox.js +0 -1
  39. package/dist/combobox/create-combobox.svelte.js +12 -2
  40. package/dist/combobox/index.d.ts +1 -0
  41. package/dist/combobox/index.js +1 -0
  42. package/dist/combobox/item-group.svelte +3 -3
  43. package/dist/date-picker/anatomy.d.ts +2 -0
  44. package/dist/date-picker/create-date-picker.svelte.js +2 -2
  45. package/dist/date-picker/date-picker.d.ts +0 -1
  46. package/dist/date-picker/date-picker.js +0 -1
  47. package/dist/date-picker/index.d.ts +1 -0
  48. package/dist/date-picker/index.js +1 -0
  49. package/dist/date-picker/range-text.svelte +1 -1
  50. package/dist/dialog/create-dialog.svelte.js +2 -2
  51. package/dist/dialog/dialog.d.ts +0 -1
  52. package/dist/dialog/dialog.js +0 -1
  53. package/dist/dialog/index.d.ts +1 -0
  54. package/dist/dialog/index.js +1 -0
  55. package/dist/editable/create-editable.svelte.js +12 -2
  56. package/dist/editable/editable.d.ts +0 -1
  57. package/dist/editable/editable.js +0 -1
  58. package/dist/editable/index.d.ts +1 -0
  59. package/dist/editable/index.js +1 -0
  60. package/dist/field/anatomy.d.ts +2 -0
  61. package/dist/field/anatomy.js +3 -0
  62. package/dist/field/context.svelte.d.ts +4 -0
  63. package/dist/field/context.svelte.js +3 -0
  64. package/dist/field/create-field.svelte.d.ts +39 -0
  65. package/dist/field/create-field.svelte.js +162 -0
  66. package/dist/field/error-text.svelte +26 -0
  67. package/dist/field/error-text.svelte.d.ts +18 -0
  68. package/dist/field/field.d.ts +7 -0
  69. package/dist/field/field.js +7 -0
  70. package/dist/field/helper-text.svelte +26 -0
  71. package/dist/field/helper-text.svelte.d.ts +18 -0
  72. package/dist/field/index.d.ts +9 -0
  73. package/dist/field/index.js +2 -0
  74. package/dist/field/input.svelte +24 -0
  75. package/dist/field/input.svelte.d.ts +18 -0
  76. package/dist/field/label.svelte +26 -0
  77. package/dist/field/label.svelte.d.ts +18 -0
  78. package/dist/field/root.svelte +44 -0
  79. package/dist/field/root.svelte.d.ts +18 -0
  80. package/dist/field/select.svelte +24 -0
  81. package/dist/field/select.svelte.d.ts +18 -0
  82. package/dist/field/textarea.svelte +24 -0
  83. package/dist/field/textarea.svelte.d.ts +18 -0
  84. package/dist/file-upload/create-file-upload.svelte.js +10 -2
  85. package/dist/file-upload/file-upload.d.ts +0 -1
  86. package/dist/file-upload/file-upload.js +0 -1
  87. package/dist/file-upload/index.d.ts +1 -0
  88. package/dist/file-upload/index.js +1 -0
  89. package/dist/hover-card/create-hover-card.svelte.js +2 -2
  90. package/dist/hover-card/hover-card.d.ts +0 -1
  91. package/dist/hover-card/hover-card.js +0 -1
  92. package/dist/hover-card/index.d.ts +1 -0
  93. package/dist/hover-card/index.js +1 -0
  94. package/dist/index.d.ts +1 -0
  95. package/dist/index.js +1 -0
  96. package/dist/menu/create-menu.svelte.js +2 -2
  97. package/dist/menu/index.d.ts +1 -0
  98. package/dist/menu/index.js +1 -0
  99. package/dist/menu/item-group.svelte +3 -3
  100. package/dist/menu/menu.d.ts +0 -1
  101. package/dist/menu/menu.js +0 -1
  102. package/dist/number-input/create-number-input.svelte.js +12 -2
  103. package/dist/number-input/index.d.ts +1 -0
  104. package/dist/number-input/index.js +1 -0
  105. package/dist/number-input/number-input.d.ts +0 -1
  106. package/dist/number-input/number-input.js +0 -1
  107. package/dist/pagination/create-pagination.svelte.js +2 -2
  108. package/dist/pagination/index.d.ts +1 -0
  109. package/dist/pagination/index.js +1 -0
  110. package/dist/pagination/pagination.d.ts +0 -1
  111. package/dist/pagination/pagination.js +0 -1
  112. package/dist/pin-input/anatomy.d.ts +2 -0
  113. package/dist/pin-input/create-pin-input.svelte.js +12 -2
  114. package/dist/pin-input/index.d.ts +1 -0
  115. package/dist/pin-input/index.js +1 -0
  116. package/dist/pin-input/pin-input.d.ts +0 -1
  117. package/dist/pin-input/pin-input.js +0 -1
  118. package/dist/popover/create-popover.svelte.js +2 -2
  119. package/dist/popover/popover.d.ts +1 -1
  120. package/dist/popover/popover.js +1 -1
  121. package/dist/progress/create-progress.svelte.js +2 -2
  122. package/dist/progress/index.d.ts +1 -0
  123. package/dist/progress/index.js +1 -0
  124. package/dist/progress/progress.d.ts +0 -1
  125. package/dist/progress/progress.js +0 -1
  126. package/dist/qr-code/create-qr-code.svelte.js +2 -2
  127. package/dist/qr-code/index.d.ts +1 -0
  128. package/dist/qr-code/index.js +1 -0
  129. package/dist/qr-code/qr-code.d.ts +0 -1
  130. package/dist/qr-code/qr-code.js +0 -1
  131. package/dist/radio-group/create-radio-group.svelte.js +2 -2
  132. package/dist/radio-group/index.d.ts +1 -0
  133. package/dist/radio-group/index.js +1 -0
  134. package/dist/radio-group/radio-group.d.ts +0 -1
  135. package/dist/radio-group/radio-group.js +0 -1
  136. package/dist/rating-group/create-rating-group.svelte.js +11 -2
  137. package/dist/rating-group/index.d.ts +1 -0
  138. package/dist/rating-group/index.js +1 -0
  139. package/dist/rating-group/item.svelte +2 -2
  140. package/dist/rating-group/rating-group.d.ts +0 -1
  141. package/dist/rating-group/rating-group.js +0 -1
  142. package/dist/segment-group/anatomy.d.ts +2 -0
  143. package/dist/segment-group/create-segment-group.svelte.js +2 -2
  144. package/dist/segment-group/index.d.ts +1 -0
  145. package/dist/segment-group/index.js +1 -0
  146. package/dist/segment-group/segment-group.d.ts +0 -1
  147. package/dist/segment-group/segment-group.js +0 -1
  148. package/dist/select/create-select.svelte.js +12 -2
  149. package/dist/select/index.d.ts +1 -0
  150. package/dist/select/index.js +1 -0
  151. package/dist/select/item-group.svelte +3 -3
  152. package/dist/select/select.d.ts +0 -1
  153. package/dist/select/select.js +0 -1
  154. package/dist/signature-pad/create-signature-pad.svelte.js +2 -2
  155. package/dist/signature-pad/index.d.ts +1 -0
  156. package/dist/signature-pad/index.js +1 -0
  157. package/dist/signature-pad/signature-pad.d.ts +0 -1
  158. package/dist/signature-pad/signature-pad.js +0 -1
  159. package/dist/slider/create-slider.svelte.js +2 -2
  160. package/dist/slider/index.d.ts +1 -0
  161. package/dist/slider/index.js +1 -0
  162. package/dist/slider/slider.d.ts +0 -1
  163. package/dist/slider/slider.js +0 -1
  164. package/dist/splitter/create-splitter.svelte.js +2 -2
  165. package/dist/splitter/index.d.ts +1 -0
  166. package/dist/splitter/index.js +1 -0
  167. package/dist/splitter/splitter.d.ts +0 -1
  168. package/dist/splitter/splitter.js +0 -1
  169. package/dist/steps/create-steps.svelte.js +2 -2
  170. package/dist/steps/index.d.ts +1 -0
  171. package/dist/steps/index.js +1 -0
  172. package/dist/steps/steps.d.ts +0 -1
  173. package/dist/steps/steps.js +0 -1
  174. package/dist/switch/create-switch.svelte.js +12 -2
  175. package/dist/switch/index.d.ts +1 -0
  176. package/dist/switch/index.js +1 -0
  177. package/dist/switch/switch.d.ts +0 -1
  178. package/dist/switch/switch.js +0 -1
  179. package/dist/tabs/create-tabs.svelte.js +2 -2
  180. package/dist/tabs/index.d.ts +1 -0
  181. package/dist/tabs/index.js +1 -0
  182. package/dist/tabs/tabs.d.ts +0 -1
  183. package/dist/tabs/tabs.js +0 -1
  184. package/dist/tags-input/create-tags-input.svelte.js +12 -2
  185. package/dist/tags-input/index.d.ts +1 -0
  186. package/dist/tags-input/index.js +1 -0
  187. package/dist/tags-input/tags-input.d.ts +0 -1
  188. package/dist/tags-input/tags-input.js +0 -1
  189. package/dist/time-picker/create-time-picker.svelte.js +2 -2
  190. package/dist/time-picker/index.d.ts +1 -0
  191. package/dist/time-picker/index.js +1 -0
  192. package/dist/time-picker/time-picker.d.ts +1 -1
  193. package/dist/time-picker/time-picker.js +1 -1
  194. package/dist/timer/create-timer.svelte.js +2 -2
  195. package/dist/timer/index.d.ts +2 -2
  196. package/dist/timer/index.js +1 -1
  197. package/dist/toast/create-toaster.svelte.js +2 -2
  198. package/dist/toast/index.d.ts +1 -0
  199. package/dist/toast/index.js +1 -0
  200. package/dist/toast/toast.d.ts +0 -1
  201. package/dist/toast/toast.js +0 -1
  202. package/dist/toggle-group/create-toggle-group.svelte.js +2 -2
  203. package/dist/toggle-group/index.d.ts +1 -0
  204. package/dist/toggle-group/index.js +1 -0
  205. package/dist/toggle-group/toggle-group.d.ts +0 -1
  206. package/dist/toggle-group/toggle-group.js +0 -1
  207. package/dist/tooltip/create-tooltip.svelte.js +2 -2
  208. package/dist/tooltip/index.d.ts +1 -0
  209. package/dist/tooltip/index.js +1 -0
  210. package/dist/tooltip/tooltip.d.ts +0 -1
  211. package/dist/tooltip/tooltip.js +0 -1
  212. package/dist/tree-view/create-tree-view.svelte.js +2 -2
  213. package/dist/tree-view/index.d.ts +1 -0
  214. package/dist/tree-view/index.js +1 -0
  215. package/dist/tree-view/tree-view.d.ts +0 -1
  216. package/dist/tree-view/tree-view.js +0 -1
  217. package/package.json +1 -1
  218. package/dist/create-unique-id.d.ts +0 -1
  219. package/dist/create-unique-id.js +0 -4
package/README.md CHANGED
@@ -46,6 +46,7 @@ npm install ui-ingredients
46
46
  - 🟢 DatePicker
47
47
  - 🟢 Dialog
48
48
  - 🟢 Editable
49
+ - 🟢 Field
49
50
  - 🟢 FileUpload
50
51
  - ⚪ FloatingPanel
51
52
  - 🟢 HoverCard
@@ -1,4 +1,3 @@
1
- export { anatomy } from '@zag-js/accordion';
2
1
  export { default as ItemContent } from './item-content.svelte';
3
2
  export { default as ItemIndicator } from './item-indicator.svelte';
4
3
  export { default as ItemTrigger } from './item-trigger.svelte';
@@ -1,4 +1,3 @@
1
- export { anatomy } from '@zag-js/accordion';
2
1
  export { default as ItemContent } from './item-content.svelte';
3
2
  export { default as ItemIndicator } from './item-indicator.svelte';
4
3
  export { default as ItemTrigger } from './item-trigger.svelte';
@@ -1,14 +1,14 @@
1
- import { createUniqueId } from '../create-unique-id.js';
2
1
  import { getEnvironmentContext } from '../environment-provider/context.svelte.js';
3
2
  import { getLocaleContext } from '../locale-provider/context.svelte.js';
4
3
  import * as accordion from '@zag-js/accordion';
5
4
  import { normalizeProps, reflect, useMachine } from '@zag-js/svelte';
5
+ import { uid } from 'uid';
6
6
  export function createAccordion(props) {
7
7
  const locale = getLocaleContext();
8
8
  const environment = getEnvironmentContext();
9
9
  const [state, send] = useMachine(accordion.machine({
10
10
  ...props,
11
- id: props.id ?? createUniqueId(),
11
+ id: props.id ?? uid(),
12
12
  dir: locale?.dir,
13
13
  getRootNode: environment?.getRootNode,
14
14
  }));
@@ -4,3 +4,4 @@ export type { AccordionIndicatorProps } from './item-indicator.svelte';
4
4
  export type { AccordionItemTriggerProps } from './item-trigger.svelte';
5
5
  export type { AccordionItemProps } from './item.svelte';
6
6
  export type { AccordionProps } from './root.svelte';
7
+ export { anatomy as accordionAnatomy } from '@zag-js/accordion';
@@ -1 +1,2 @@
1
1
  export * as Accordion from './accordion.js';
2
+ export { anatomy as accordionAnatomy } from '@zag-js/accordion';
@@ -1,4 +1,3 @@
1
- export { anatomy } from '@zag-js/avatar';
2
1
  export { default as Fallback } from './fallback.svelte';
3
2
  export { default as Image } from './image.svelte';
4
3
  export { default as Root } from './root.svelte';
@@ -1,4 +1,3 @@
1
- export { anatomy } from '@zag-js/avatar';
2
1
  export { default as Fallback } from './fallback.svelte';
3
2
  export { default as Image } from './image.svelte';
4
3
  export { default as Root } from './root.svelte';
@@ -1,14 +1,14 @@
1
- import { createUniqueId } from '../create-unique-id.js';
2
1
  import { getEnvironmentContext } from '../environment-provider/context.svelte.js';
3
2
  import { getLocaleContext } from '../locale-provider/context.svelte.js';
4
3
  import * as avatar from '@zag-js/avatar';
5
4
  import { normalizeProps, reflect, useMachine } from '@zag-js/svelte';
5
+ import { uid } from 'uid';
6
6
  export function createAvatar(props) {
7
7
  const locale = getLocaleContext();
8
8
  const environment = getEnvironmentContext();
9
9
  const [state, send] = useMachine(avatar.machine({
10
10
  ...props,
11
- id: props.id ?? createUniqueId(),
11
+ id: props.id ?? uid(),
12
12
  dir: locale?.dir,
13
13
  getRootNode: environment?.getRootNode,
14
14
  }));
@@ -2,3 +2,4 @@ export * as Avatar from './avatar.js';
2
2
  export type { AvatarFallbackProps } from './fallback.svelte';
3
3
  export type { AvatarImageProps } from './image.svelte';
4
4
  export type { AvatarProps } from './root.svelte';
5
+ export { anatomy as AvatarAnatomy } from '@zag-js/avatar';
@@ -1 +1,2 @@
1
1
  export * as Avatar from './avatar.js';
2
+ export { anatomy as AvatarAnatomy } from '@zag-js/avatar';
@@ -1,4 +1,3 @@
1
- export { anatomy } from '@zag-js/carousel';
2
1
  export { default as IndicatorGroup } from './indicator-group.svelte';
3
2
  export { default as Indicator } from './indicator.svelte';
4
3
  export { default as ItemGroup } from './item-group.svelte';
@@ -1,4 +1,3 @@
1
- export { anatomy } from '@zag-js/carousel';
2
1
  export { default as IndicatorGroup } from './indicator-group.svelte';
3
2
  export { default as Indicator } from './indicator.svelte';
4
3
  export { default as ItemGroup } from './item-group.svelte';
@@ -1,14 +1,14 @@
1
- import { createUniqueId } from '../create-unique-id.js';
2
1
  import { getEnvironmentContext } from '../environment-provider/context.svelte.js';
3
2
  import { getLocaleContext } from '../locale-provider/context.svelte.js';
4
3
  import * as carousel from '@zag-js/carousel';
5
4
  import { normalizeProps, reflect, useMachine } from '@zag-js/svelte';
5
+ import { uid } from 'uid';
6
6
  export function createCarousel(props) {
7
7
  const locale = getLocaleContext();
8
8
  const environment = getEnvironmentContext();
9
9
  const [state, send] = useMachine(carousel.machine({
10
10
  ...props,
11
- id: props.id ?? createUniqueId(),
11
+ id: props.id ?? uid(),
12
12
  dir: locale?.dir,
13
13
  getRootNode: environment?.getRootNode,
14
14
  }));
@@ -7,3 +7,4 @@ export type { CarouselNextTriggerProps } from './next-trigger.svelte';
7
7
  export type { CarouselPrevTriggerProps } from './prev-trigger.svelte';
8
8
  export type { CarouselProps } from './root.svelte';
9
9
  export type { CarouselViewportProps } from './viewport.svelte';
10
+ export { anatomy as carouselAnatomy } from '@zag-js/carousel';
@@ -1 +1,2 @@
1
1
  export * as Carousel from './carousel.js';
2
+ export { anatomy as carouselAnatomy } from '@zag-js/carousel';
@@ -1,4 +1,3 @@
1
- export { anatomy } from '@zag-js/checkbox';
2
1
  export { default as Control } from './control.svelte';
3
2
  export { default as HiddenInput } from './hidden-input.svelte';
4
3
  export { default as Indicator } from './indicator.svelte';
@@ -1,4 +1,3 @@
1
- export { anatomy } from '@zag-js/checkbox';
2
1
  export { default as Control } from './control.svelte';
3
2
  export { default as HiddenInput } from './hidden-input.svelte';
4
3
  export { default as Indicator } from './indicator.svelte';
@@ -1,14 +1,24 @@
1
- import { createUniqueId } from '../create-unique-id.js';
2
1
  import { getEnvironmentContext } from '../environment-provider/context.svelte.js';
2
+ import { getFieldContext } from '../field/context.svelte.js';
3
3
  import { getLocaleContext } from '../locale-provider/context.svelte.js';
4
4
  import * as checkbox from '@zag-js/checkbox';
5
5
  import { normalizeProps, reflect, useMachine } from '@zag-js/svelte';
6
+ import { uid } from 'uid';
6
7
  export function createCheckbox(props) {
8
+ const field = getFieldContext();
7
9
  const locale = getLocaleContext();
8
10
  const environment = getEnvironmentContext();
9
11
  const [state, send] = useMachine(checkbox.machine({
12
+ ids: {
13
+ label: field?.ids.label,
14
+ hiddenInput: field?.ids.control,
15
+ },
16
+ invalid: field?.invalid,
17
+ disabled: field?.disabled,
18
+ readOnly: field?.readOnly,
19
+ required: field?.required,
10
20
  ...props,
11
- id: props.id ?? createUniqueId(),
21
+ id: props.id ?? uid(),
12
22
  dir: locale?.dir,
13
23
  getRootNode: environment?.getRootNode,
14
24
  }));
@@ -4,3 +4,4 @@ export type { CheckboxHiddenInputProps } from './hidden-input.svelte';
4
4
  export type { CheckboxIndicatorProps } from './indicator.svelte';
5
5
  export type { CheckboxLabelProps } from './label.svelte';
6
6
  export type { CheckboxProps } from './root.svelte';
7
+ export { anatomy as checkboxAnatomy } from '@zag-js/checkbox';
@@ -1 +1,2 @@
1
1
  export * as Checkbox from './checkbox.js';
2
+ export { anatomy as checkboxAnatomy } from '@zag-js/checkbox';
@@ -1,4 +1,3 @@
1
- export { anatomy } from '@zag-js/clipboard';
2
1
  export { default as Control } from './control.svelte';
3
2
  export { default as Indicator } from './indicator.svelte';
4
3
  export { default as Input } from './input.svelte';
@@ -1,4 +1,3 @@
1
- export { anatomy } from '@zag-js/clipboard';
2
1
  export { default as Control } from './control.svelte';
3
2
  export { default as Indicator } from './indicator.svelte';
4
3
  export { default as Input } from './input.svelte';
@@ -1,12 +1,12 @@
1
- import { createUniqueId } from '../create-unique-id.js';
2
1
  import { getEnvironmentContext } from '../environment-provider/context.svelte.js';
3
2
  import * as clipboard from '@zag-js/clipboard';
4
3
  import { normalizeProps, reflect, useMachine } from '@zag-js/svelte';
4
+ import { uid } from 'uid';
5
5
  export function createClipboard(props) {
6
6
  const environment = getEnvironmentContext();
7
7
  const [state, send] = useMachine(clipboard.machine({
8
8
  ...props,
9
- id: props.id ?? createUniqueId(),
9
+ id: props.id ?? uid(),
10
10
  getRootNode: environment?.getRootNode,
11
11
  }));
12
12
  const api = $derived(reflect(() => clipboard.connect(state, send, normalizeProps)));
@@ -5,3 +5,4 @@ export type { ClipboardInputProps } from './input.svelte';
5
5
  export type { ClipboardLabelProps } from './label.svelte';
6
6
  export type { ClipboardProps } from './root.svelte';
7
7
  export type { ClipboardTriggerProps } from './trigger.svelte';
8
+ export { anatomy as clipboardAnatomy } from '@zag-js/clipboard';
@@ -1 +1,2 @@
1
1
  export * as Clipboard from './clipboard.js';
2
+ export { anatomy as clipboardAnatomy } from '@zag-js/clipboard';
@@ -1,4 +1,3 @@
1
- export { anatomy } from '@zag-js/collapsible';
2
1
  export { default as Content } from './content.svelte';
3
2
  export { default as Root } from './root.svelte';
4
3
  export { default as Trigger } from './trigger.svelte';
@@ -1,4 +1,3 @@
1
- export { anatomy } from '@zag-js/collapsible';
2
1
  export { default as Content } from './content.svelte';
3
2
  export { default as Root } from './root.svelte';
4
3
  export { default as Trigger } from './trigger.svelte';
@@ -1,14 +1,14 @@
1
- import { createUniqueId } from '../create-unique-id.js';
2
1
  import { getEnvironmentContext } from '../environment-provider/context.svelte.js';
3
2
  import { getLocaleContext } from '../locale-provider/context.svelte.js';
4
3
  import * as collapsible from '@zag-js/collapsible';
5
4
  import { normalizeProps, reflect, useMachine } from '@zag-js/svelte';
5
+ import { uid } from 'uid';
6
6
  export function createCollapsible(props) {
7
7
  const locale = getLocaleContext();
8
8
  const environment = getEnvironmentContext();
9
9
  const [state, send] = useMachine(collapsible.machine({
10
10
  ...props,
11
- id: props.id ?? createUniqueId(),
11
+ id: props.id ?? uid(),
12
12
  dir: locale?.dir,
13
13
  open: props.defaultOpen ?? props.open,
14
14
  getRootNode: environment?.getRootNode,
@@ -2,3 +2,4 @@ export * as Collapsible from './collapsible.js';
2
2
  export type { CollapsibleContentProps } from './content.svelte';
3
3
  export type { CollapsibleProps } from './root.svelte';
4
4
  export type { CollapsibleTriggerProps } from './trigger.svelte';
5
+ export { anatomy as collapsibleAnatomy } from '@zag-js/collapsible';
@@ -1 +1,2 @@
1
1
  export * as Collapsible from './collapsible.js';
2
+ export { anatomy as collapsibleAnatomy } from '@zag-js/collapsible';
@@ -1,4 +1,4 @@
1
- export { anatomy, parse } from '@zag-js/color-picker';
1
+ export { parse } from '@zag-js/color-picker';
2
2
  export { default as AreaBackground } from './area-background.svelte';
3
3
  export { default as AreaThumb } from './area-thumb.svelte';
4
4
  export { default as Area } from './area.svelte';
@@ -1,4 +1,4 @@
1
- export { anatomy, parse } from '@zag-js/color-picker';
1
+ export { parse } from '@zag-js/color-picker';
2
2
  export { default as AreaBackground } from './area-background.svelte';
3
3
  export { default as AreaThumb } from './area-thumb.svelte';
4
4
  export { default as Area } from './area.svelte';
@@ -1,14 +1,14 @@
1
- import { createUniqueId } from '../create-unique-id.js';
2
1
  import { getEnvironmentContext } from '../environment-provider/context.svelte.js';
3
2
  import { getLocaleContext } from '../locale-provider/context.svelte.js';
4
3
  import * as colorPicker from '@zag-js/color-picker';
5
4
  import { normalizeProps, reflect, useMachine } from '@zag-js/svelte';
5
+ import { uid } from 'uid';
6
6
  export function createColorPicker(props) {
7
7
  const locale = getLocaleContext();
8
8
  const environment = getEnvironmentContext();
9
9
  const [state, send] = useMachine(colorPicker.machine({
10
10
  ...props,
11
- id: props.id ?? createUniqueId(),
11
+ id: props.id ?? uid(),
12
12
  dir: locale?.dir,
13
13
  open: props.defaultOpen ?? props.open,
14
14
  value: props.value ? colorPicker.parse(props.value) : undefined,
@@ -24,3 +24,4 @@ export type { ColorPickerSwatchProps } from './swatch.svelte';
24
24
  export type { ColorPickerTransparencyGridProps } from './transparency-grid.svelte';
25
25
  export type { ColorPickerTriggerProps } from './trigger.svelte';
26
26
  export type { ColorPickerValueTextProps } from './value-text.svelte';
27
+ export { anatomy as colorPickerAnatomy } from '@zag-js/color-picker';
@@ -1 +1,2 @@
1
1
  export * as ColorPicker from './color-picker.js';
2
+ export { anatomy as colorPickerAnatomy } from '@zag-js/color-picker';
@@ -1,4 +1,3 @@
1
- export { anatomy } from '@zag-js/combobox';
2
1
  export { default as ClearTrigger } from './clear-trigger.svelte';
3
2
  export { default as Content } from './content.svelte';
4
3
  export { default as Control } from './control.svelte';
@@ -1,4 +1,3 @@
1
- export { anatomy } from '@zag-js/combobox';
2
1
  export { default as ClearTrigger } from './clear-trigger.svelte';
3
2
  export { default as Content } from './content.svelte';
4
3
  export { default as Control } from './control.svelte';
@@ -1,8 +1,9 @@
1
- import { createUniqueId } from '../create-unique-id.js';
2
1
  import { getEnvironmentContext } from '../environment-provider/context.svelte.js';
2
+ import { getFieldContext } from '../field/context.svelte.js';
3
3
  import { getLocaleContext } from '../locale-provider/context.svelte.js';
4
4
  import * as combobox from '@zag-js/combobox';
5
5
  import { normalizeProps, reflect, useMachine } from '@zag-js/svelte';
6
+ import { uid } from 'uid';
6
7
  export function createCombobox(props) {
7
8
  const collection = $derived(combobox.collection({
8
9
  items: props.items,
@@ -10,11 +11,20 @@ export function createCombobox(props) {
10
11
  itemToString: (item) => props.itemToString ? props.itemToString(item) : String(item),
11
12
  isItemDisabled: (item) => props.isItemDisabled ? props.isItemDisabled(item) : false,
12
13
  }));
14
+ const field = getFieldContext();
13
15
  const locale = getLocaleContext();
14
16
  const environment = getEnvironmentContext();
15
17
  const [state, send] = useMachine(combobox.machine({
18
+ ids: {
19
+ label: field?.ids.label,
20
+ input: field?.ids.control,
21
+ },
22
+ invalid: field?.invalid,
23
+ required: field?.required,
24
+ disabled: field?.disabled,
25
+ readOnly: field?.readOnly,
16
26
  ...props,
17
- id: props.id ?? createUniqueId(),
27
+ id: props.id ?? uid(),
18
28
  dir: locale?.dir,
19
29
  open: props.defaultOpen ?? props.open,
20
30
  getRootNode: environment?.getRootNode,
@@ -13,3 +13,4 @@ export type { ComboboxListProps } from './list.svelte';
13
13
  export type { ComboboxPositionerProps } from './positioner.svelte';
14
14
  export type { ComboboxProps } from './root.svelte';
15
15
  export type { ComboboxTriggerProps } from './trigger.svelte';
16
+ export { anatomy as comboboxAnatomy } from '@zag-js/combobox';
@@ -1 +1,2 @@
1
1
  export * as Combobox from './combobox.js';
2
+ export { anatomy as comboboxAnatomy } from '@zag-js/combobox';
@@ -7,8 +7,8 @@
7
7
  </script>
8
8
 
9
9
  <script lang="ts">
10
- import {createUniqueId} from '../create-unique-id.js';
11
10
  import {mergeProps} from '../merge-props.js';
11
+ import {uid} from 'uid';
12
12
  import {
13
13
  comboboxContext,
14
14
  comboboxItemGroupPropsContext,
@@ -18,10 +18,10 @@
18
18
 
19
19
  let combobox = comboboxContext.get();
20
20
 
21
- let uid = createUniqueId();
21
+ let id_ = uid();
22
22
 
23
23
  let comboboxItemGroupProps = $derived({
24
- id: id ?? uid,
24
+ id: id ?? id_,
25
25
  });
26
26
 
27
27
  let mergedProps = $derived(
@@ -0,0 +1,2 @@
1
+ export declare const anatomy: import("@zag-js/anatomy").AnatomyInstance<"input" | "label" | "table" | "view" | "root" | "control" | "content" | "trigger" | "clearTrigger" | "positioner" | "monthSelect" | "nextTrigger" | "prevTrigger" | "rangeText" | "tableBody" | "tableCell" | "tableCellTrigger" | "tableHead" | "tableHeader" | "tableRow" | "viewTrigger" | "viewControl" | "yearSelect" | "presetTrigger">;
2
+ export declare const parts: Record<"input" | "label" | "table" | "view" | "root" | "control" | "content" | "trigger" | "clearTrigger" | "positioner" | "monthSelect" | "nextTrigger" | "prevTrigger" | "rangeText" | "tableBody" | "tableCell" | "tableCellTrigger" | "tableHead" | "tableHeader" | "tableRow" | "viewTrigger" | "viewControl" | "yearSelect" | "presetTrigger", import("@zag-js/anatomy").AnatomyPart>;
@@ -1,15 +1,15 @@
1
- import { createUniqueId } from '../create-unique-id.js';
2
1
  import { getEnvironmentContext } from '../environment-provider/context.svelte.js';
3
2
  import { getLocaleContext } from '../locale-provider/context.svelte.js';
4
3
  import * as datePicker from '@zag-js/date-picker';
5
4
  import { normalizeProps, reflect, useMachine } from '@zag-js/svelte';
5
+ import { uid } from 'uid';
6
6
  import { parts } from './anatomy.js';
7
7
  export function createDatePicker(props) {
8
8
  const locale = getLocaleContext();
9
9
  const environment = getEnvironmentContext();
10
10
  const [state, send] = useMachine(datePicker.machine({
11
11
  ...props,
12
- id: props.id ?? createUniqueId(),
12
+ id: props.id ?? uid(),
13
13
  dir: locale?.dir,
14
14
  min: props.min ? datePicker.parse(props.min) : undefined,
15
15
  max: props.max ? datePicker.parse(props.max) : undefined,
@@ -1,5 +1,4 @@
1
1
  export { parse } from '@zag-js/date-picker';
2
- export { anatomy } from './anatomy.js';
3
2
  export { default as ClearTrigger } from './clear-trigger.svelte';
4
3
  export { default as Content } from './content.svelte';
5
4
  export { default as Control } from './control.svelte';
@@ -1,5 +1,4 @@
1
1
  export { parse } from '@zag-js/date-picker';
2
- export { anatomy } from './anatomy.js';
3
2
  export { default as ClearTrigger } from './clear-trigger.svelte';
4
3
  export { default as Content } from './content.svelte';
5
4
  export { default as Control } from './control.svelte';
@@ -27,3 +27,4 @@ export type { DatePickerViewProps } from './view.svelte';
27
27
  export type { DatePickerYearSelectProps } from './year-select.svelte';
28
28
  export type { DatePickerYearTableCellTriggerProps } from './year-table-cell-trigger.svelte';
29
29
  export type { DatePickerYearTableCellProps } from './year-table-cell.svelte';
30
+ export { anatomy as datePickerAnatomy } from './anatomy.js';
@@ -1 +1,2 @@
1
1
  export * as DatePicker from './date-picker.js';
2
+ export { anatomy as datePickerAnatomy } from './anatomy.js';
@@ -24,7 +24,7 @@
24
24
  {#if children}
25
25
  {@render children()}
26
26
  {:else}
27
- {datePicker.visibleRangeText.formatted}
27
+ {datePicker.visibleRangeText.start}
28
28
  {/if}
29
29
  </span>
30
30
  {/if}
@@ -1,14 +1,14 @@
1
- import { createUniqueId } from '../create-unique-id.js';
2
1
  import { getEnvironmentContext } from '../environment-provider/context.svelte.js';
3
2
  import { getLocaleContext } from '../locale-provider/context.svelte.js';
4
3
  import * as dialog from '@zag-js/dialog';
5
4
  import { normalizeProps, reflect, useMachine } from '@zag-js/svelte';
5
+ import { uid } from 'uid';
6
6
  export function createDialog(props) {
7
7
  const locale = getLocaleContext();
8
8
  const environment = getEnvironmentContext();
9
9
  const [state, send] = useMachine(dialog.machine({
10
10
  ...props,
11
- id: props.id ?? createUniqueId(),
11
+ id: props.id ?? uid(),
12
12
  dir: locale?.dir,
13
13
  open: props.defaultOpen ?? props.open,
14
14
  getRootNode: environment?.getRootNode,
@@ -1,4 +1,3 @@
1
- export { anatomy } from '@zag-js/dialog';
2
1
  export { default as Backdrop } from './backdrop.svelte';
3
2
  export { default as CloseTrigger } from './close-trigger.svelte';
4
3
  export { default as Content } from './content.svelte';
@@ -1,4 +1,3 @@
1
- export { anatomy } from '@zag-js/dialog';
2
1
  export { default as Backdrop } from './backdrop.svelte';
3
2
  export { default as CloseTrigger } from './close-trigger.svelte';
4
3
  export { default as Content } from './content.svelte';
@@ -7,3 +7,4 @@ export type { DialogPositionerProps } from './positioner.svelte';
7
7
  export type { DialogProps } from './root.svelte';
8
8
  export type { DialogTitleProps } from './title.svelte';
9
9
  export type { DialogTriggerProps } from './trigger.svelte';
10
+ export { anatomy as dialogAnatomy } from '@zag-js/dialog';
@@ -1 +1,2 @@
1
1
  export * as Dialog from './dialog.js';
2
+ export { anatomy as dialogAnatomy } from '@zag-js/dialog';
@@ -1,14 +1,24 @@
1
- import { createUniqueId } from '../create-unique-id.js';
2
1
  import { getEnvironmentContext } from '../environment-provider/context.svelte.js';
2
+ import { getFieldContext } from '../field/context.svelte.js';
3
3
  import { getLocaleContext } from '../locale-provider/context.svelte.js';
4
4
  import * as editable from '@zag-js/editable';
5
5
  import { normalizeProps, reflect, useMachine } from '@zag-js/svelte';
6
+ import { uid } from 'uid';
6
7
  export function createEditable(props) {
8
+ const field = getFieldContext();
7
9
  const locale = getLocaleContext();
8
10
  const environment = getEnvironmentContext();
9
11
  const [state, send] = useMachine(editable.machine({
12
+ ids: {
13
+ label: field?.ids.label,
14
+ input: field?.ids.control,
15
+ },
16
+ invalid: field?.invalid,
17
+ disabled: field?.disabled,
18
+ readOnly: field?.readOnly,
19
+ required: field?.required,
10
20
  ...props,
11
- id: props.id ?? createUniqueId(),
21
+ id: props.id ?? uid(),
12
22
  dir: locale?.dir,
13
23
  edit: props.defaultEdit ?? props.edit,
14
24
  getRootNode: environment?.getRootNode,
@@ -1,4 +1,3 @@
1
- export { anatomy } from '@zag-js/editable';
2
1
  export { default as Area } from './area.svelte';
3
2
  export { default as CancelTrigger } from './cancel-trigger.svelte';
4
3
  export { default as Control } from './control.svelte';
@@ -1,4 +1,3 @@
1
- export { anatomy } from '@zag-js/editable';
2
1
  export { default as Area } from './area.svelte';
3
2
  export { default as CancelTrigger } from './cancel-trigger.svelte';
4
3
  export { default as Control } from './control.svelte';
@@ -8,3 +8,4 @@ export type { EditableLabelProps } from './label.svelte';
8
8
  export type { EditablePreviewProps } from './preview.svelte';
9
9
  export type { EditableProps } from './root.svelte';
10
10
  export type { EditableSubmitTriggerProps } from './submit-trigger.svelte';
11
+ export { anatomy as editableAnatomy } from '@zag-js/editable';
@@ -1 +1,2 @@
1
1
  export * as Editable from './editable.js';
2
+ export { anatomy as editableAnatomy } from '@zag-js/editable';
@@ -0,0 +1,2 @@
1
+ export declare const anatomy: import("@zag-js/anatomy").AnatomyInstance<"input" | "label" | "select" | "textarea" | "root" | "errorText" | "helperText">;
2
+ export declare const parts: Record<"input" | "label" | "select" | "textarea" | "root" | "errorText" | "helperText", import("@zag-js/anatomy").AnatomyPart>;
@@ -0,0 +1,3 @@
1
+ import { createAnatomy } from '@zag-js/anatomy';
2
+ export const anatomy = createAnatomy('field').parts('root', 'label', 'input', 'select', 'textarea', 'errorText', 'helperText');
3
+ export const parts = anatomy.build();
@@ -0,0 +1,4 @@
1
+ import { Context } from '../context.svelte.js';
2
+ import type { CreateFieldReturn } from './create-field.svelte.js';
3
+ export declare const fieldContext: Context<CreateFieldReturn>;
4
+ export declare const getFieldContext: () => CreateFieldReturn | null;
@@ -0,0 +1,3 @@
1
+ import { Context } from '../context.svelte.js';
2
+ export const fieldContext = new Context('Field', false);
3
+ export const getFieldContext = () => fieldContext.get();
@@ -0,0 +1,39 @@
1
+ import type { HTMLProps } from '../types.js';
2
+ interface ElementIds {
3
+ root?: string;
4
+ label?: string;
5
+ control?: string;
6
+ errorText?: string;
7
+ helperText?: string;
8
+ }
9
+ export interface CreateFieldProps {
10
+ id?: string | null;
11
+ ids?: ElementIds;
12
+ invalid?: boolean;
13
+ required?: boolean;
14
+ disabled?: boolean;
15
+ readOnly?: boolean;
16
+ }
17
+ export interface CreateFieldReturn extends ReturnType<typeof createField> {
18
+ }
19
+ export declare function createField(props: CreateFieldProps): {
20
+ readonly ids: {
21
+ root: string;
22
+ label: string;
23
+ control: string;
24
+ errorText: string;
25
+ helperText: string;
26
+ };
27
+ readonly disabled: boolean;
28
+ readonly required: boolean;
29
+ readonly readOnly: boolean;
30
+ readonly invalid: boolean;
31
+ getRootProps: () => HTMLProps<"div">;
32
+ getLabelProps: () => HTMLProps<"label">;
33
+ getErrorTextProps: () => HTMLProps<"div">;
34
+ getHelperTextProps: () => HTMLProps<"div">;
35
+ getInputProps: () => HTMLProps<"input">;
36
+ getSelectProps: () => HTMLProps<"select">;
37
+ getTextareaProps: () => HTMLProps<"textarea">;
38
+ };
39
+ export {};