ui-ingredients 0.0.13 → 0.0.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. package/README.md +1 -1
  2. package/dist/accordion/root.svelte +2 -2
  3. package/dist/avatar/root.svelte +2 -2
  4. package/dist/carousel/root.svelte +2 -2
  5. package/dist/checkbox/root.svelte +2 -2
  6. package/dist/clipboard/root.svelte +2 -2
  7. package/dist/collapsible/root.svelte +2 -2
  8. package/dist/combobox/item-group.svelte +2 -2
  9. package/dist/combobox/root.svelte +2 -2
  10. package/dist/dialog/root.svelte +2 -2
  11. package/dist/editable/root.svelte +2 -2
  12. package/dist/hover-card/root.svelte +2 -2
  13. package/dist/number-input/root.svelte +2 -2
  14. package/dist/pagination/root.svelte +2 -2
  15. package/dist/pin-input/root.svelte +2 -2
  16. package/dist/popover/root.svelte +2 -2
  17. package/dist/presence/root.svelte +1 -7
  18. package/dist/progress/root.svelte +2 -2
  19. package/dist/qr-code/root.svelte +2 -2
  20. package/dist/radio-group/root.svelte +2 -2
  21. package/dist/rating-group/root.svelte +2 -2
  22. package/dist/segment-group/anatomy.js +1 -0
  23. package/dist/segment-group/context.svelte.js +2 -25
  24. package/dist/segment-group/indicator.svelte +2 -1
  25. package/dist/segment-group/item-control.svelte +2 -1
  26. package/dist/segment-group/item-text.svelte +2 -1
  27. package/dist/segment-group/item.svelte +2 -1
  28. package/dist/segment-group/label.svelte +2 -1
  29. package/dist/segment-group/root.svelte +4 -3
  30. package/dist/select/item-group.svelte +2 -2
  31. package/dist/select/root.svelte +2 -2
  32. package/dist/slider/root.svelte +2 -2
  33. package/dist/steps/root.svelte +2 -2
  34. package/dist/switch/root.svelte +2 -2
  35. package/dist/tabs/root.svelte +2 -2
  36. package/dist/tags-input/root.svelte +2 -2
  37. package/dist/timer/root.svelte +2 -2
  38. package/dist/toast/create-toaster.svelte.js +2 -2
  39. package/dist/toggle-group/root.svelte +2 -2
  40. package/dist/tooltip/root.svelte +2 -2
  41. package/dist/utils.svelte.d.ts +1 -1
  42. package/dist/utils.svelte.js +2 -2
  43. package/package.json +2 -2
  44. package/dist/segment-group/context.svelte.d.ts +0 -10
package/README.md CHANGED
@@ -60,7 +60,7 @@ npm install ui-ingredients
60
60
  - 🟢 RadioGroup
61
61
  - 🟢 RatingGroup
62
62
  - 🟢 Select
63
- - 🟡 SegmentGroup
63
+ - 🟢 SegmentGroup
64
64
  - ⚪ SignaturePad
65
65
  - 🟢 Slider
66
66
  - ⚪ Splitter
@@ -18,7 +18,7 @@
18
18
  <script lang="ts">
19
19
  import {useEnvironmentContext} from '../environment-provider/index.js';
20
20
  import {useLocaleContext} from '../locale-provider/index.js';
21
- import {uuid} from '../utils.svelte.js';
21
+ import {createUniqueId} from '../utils.svelte.js';
22
22
  import {mergeProps} from '@zag-js/svelte';
23
23
  import {
24
24
  createAccordionContext,
@@ -45,7 +45,7 @@
45
45
  let environmentContext = useEnvironmentContext();
46
46
 
47
47
  let context = createAccordionContext({
48
- id: id ?? uuid(),
48
+ id: id ?? createUniqueId(),
49
49
  ids,
50
50
  dir: dir ?? localeContext?.dir,
51
51
  value: $state.snapshot(value),
@@ -18,7 +18,7 @@
18
18
  <script lang="ts">
19
19
  import {useEnvironmentContext} from '../environment-provider/index.js';
20
20
  import {useLocaleContext} from '../locale-provider/index.js';
21
- import {uuid} from '../utils.svelte.js';
21
+ import {createUniqueId} from '../utils.svelte.js';
22
22
  import {mergeProps} from '@zag-js/svelte';
23
23
  import {createAvatarContext, setAvatarContext} from './context.svelte.js';
24
24
 
@@ -36,7 +36,7 @@
36
36
  let environmentContext = useEnvironmentContext();
37
37
 
38
38
  let context = createAvatarContext({
39
- id: id ?? uuid(),
39
+ id: id ?? createUniqueId(),
40
40
  ids,
41
41
  dir: dir ?? localeContext?.dir,
42
42
  onStatusChange,
@@ -18,7 +18,7 @@
18
18
  <script lang="ts">
19
19
  import {useEnvironmentContext} from '../environment-provider/index.js';
20
20
  import {useLocaleContext} from '../locale-provider/index.js';
21
- import {uuid} from '../utils.svelte.js';
21
+ import {createUniqueId} from '../utils.svelte.js';
22
22
  import {mergeProps} from '@zag-js/svelte';
23
23
  import {createCarouselContext, setCarouselContext} from './context.svelte.js';
24
24
 
@@ -42,7 +42,7 @@
42
42
  let environmentContext = useEnvironmentContext();
43
43
 
44
44
  let context = createCarouselContext({
45
- id: id ?? uuid(),
45
+ id: id ?? createUniqueId(),
46
46
  ids,
47
47
  dir: dir ?? localeContext?.dir,
48
48
  loop,
@@ -18,7 +18,7 @@
18
18
  <script lang="ts">
19
19
  import {useEnvironmentContext} from '../environment-provider/index.js';
20
20
  import {useLocaleContext} from '../locale-provider/index.js';
21
- import {uuid} from '../utils.svelte.js';
21
+ import {createUniqueId} from '../utils.svelte.js';
22
22
  import {mergeProps} from '@zag-js/svelte';
23
23
  import {createCheckboxContext, setCheckboxContext} from './context.svelte.js';
24
24
 
@@ -44,7 +44,7 @@
44
44
  let environmentContext = useEnvironmentContext();
45
45
 
46
46
  let context = createCheckboxContext({
47
- id: id ?? uuid(),
47
+ id: id ?? createUniqueId(),
48
48
  ids,
49
49
  dir: dir ?? localeContext?.dir,
50
50
  form,
@@ -17,7 +17,7 @@
17
17
 
18
18
  <script lang="ts">
19
19
  import {useEnvironmentContext} from '../environment-provider/index.js';
20
- import {uuid} from '../utils.svelte.js';
20
+ import {createUniqueId} from '../utils.svelte.js';
21
21
  import {mergeProps} from '@zag-js/svelte';
22
22
  import {
23
23
  createClipboardContext,
@@ -38,7 +38,7 @@
38
38
  let environmentContext = useEnvironmentContext();
39
39
 
40
40
  let context = createClipboardContext({
41
- id: id ?? uuid(),
41
+ id: id ?? createUniqueId(),
42
42
  ids,
43
43
  value: $state.snapshot(value),
44
44
  timeout,
@@ -18,7 +18,7 @@
18
18
  <script lang="ts">
19
19
  import {useEnvironmentContext} from '../environment-provider/index.js';
20
20
  import {useLocaleContext} from '../locale-provider/index.js';
21
- import {uuid} from '../utils.svelte.js';
21
+ import {createUniqueId} from '../utils.svelte.js';
22
22
  import {mergeProps} from '@zag-js/svelte';
23
23
  import {
24
24
  createCollapsibleContext,
@@ -43,7 +43,7 @@
43
43
  let environmentContext = useEnvironmentContext();
44
44
 
45
45
  let context = createCollapsibleContext({
46
- id: id ?? uuid(),
46
+ id: id ?? createUniqueId(),
47
47
  ids,
48
48
  dir: dir ?? localeContext?.dir,
49
49
  open,
@@ -7,7 +7,7 @@
7
7
  </script>
8
8
 
9
9
  <script lang="ts">
10
- import {uuid} from '../utils.svelte.js';
10
+ import {createUniqueId} from '../utils.svelte.js';
11
11
  import {mergeProps} from '@zag-js/svelte';
12
12
  import {
13
13
  setComboboxItemGroupPropsContext,
@@ -18,7 +18,7 @@
18
18
 
19
19
  let context = useComboboxContext();
20
20
 
21
- let uid = uuid();
21
+ let uid = createUniqueId();
22
22
 
23
23
  let attrs = $derived(
24
24
  mergeProps(props, context.getItemGroupProps({id: id ?? uid})),
@@ -18,7 +18,7 @@
18
18
  <script lang="ts" generics="T">
19
19
  import {useEnvironmentContext} from '../environment-provider/index.js';
20
20
  import {useLocaleContext} from '../locale-provider/index.js';
21
- import {uuid} from '../utils.svelte.js';
21
+ import {createUniqueId} from '../utils.svelte.js';
22
22
  import {mergeProps} from '@zag-js/svelte';
23
23
  import {createComboboxContext, setComboboxContext} from './context.svelte.js';
24
24
 
@@ -74,7 +74,7 @@
74
74
  let environmentContext = useEnvironmentContext();
75
75
 
76
76
  let context = createComboboxContext({
77
- id: id ?? uuid(),
77
+ id: id ?? createUniqueId(),
78
78
  ids,
79
79
  dir: dir ?? localeContext?.dir,
80
80
  name,
@@ -14,7 +14,7 @@
14
14
  <script lang="ts">
15
15
  import {useEnvironmentContext} from '../environment-provider/index.js';
16
16
  import {useLocaleContext} from '../locale-provider/index.js';
17
- import {uuid} from '../utils.svelte.js';
17
+ import {createUniqueId} from '../utils.svelte.js';
18
18
  import {createDialogContext, setDialogContext} from './context.svelte.js';
19
19
 
20
20
  let {id, dir, getRootNode, children, ...props}: DialogProps = $props();
@@ -23,7 +23,7 @@
23
23
  let environmentContext = useEnvironmentContext();
24
24
 
25
25
  let context = createDialogContext({
26
- id: id ?? uuid(),
26
+ id: id ?? createUniqueId(),
27
27
  dir: dir ?? localeContext?.dir,
28
28
  getRootNode: getRootNode ?? environmentContext?.getRootNode,
29
29
  ...props,
@@ -15,7 +15,7 @@
15
15
  <script lang="ts">
16
16
  import {useEnvironmentContext} from '../environment-provider/index.js';
17
17
  import {useLocaleContext} from '../locale-provider/index.js';
18
- import {uuid} from '../utils.svelte.js';
18
+ import {createUniqueId} from '../utils.svelte.js';
19
19
  import {createEditableContext, setEditableContext} from './context.svelte.js';
20
20
 
21
21
  let {id, dir, getRootNode, children, ...props}: EditableProps = $props();
@@ -24,7 +24,7 @@
24
24
  let environmentContext = useEnvironmentContext();
25
25
 
26
26
  let context = createEditableContext({
27
- id: id ?? uuid(),
27
+ id: id ?? createUniqueId(),
28
28
  dir: dir ?? localeContext?.dir,
29
29
  getRootNode: getRootNode ?? environmentContext?.getRootNode,
30
30
  ...props,
@@ -15,7 +15,7 @@
15
15
  <script lang="ts">
16
16
  import {useEnvironmentContext} from '../environment-provider/index.js';
17
17
  import {useLocaleContext} from '../locale-provider/index.js';
18
- import {uuid} from '../utils.svelte.js';
18
+ import {createUniqueId} from '../utils.svelte.js';
19
19
  import {
20
20
  createHoverCardContext,
21
21
  setHoverCardContext,
@@ -27,7 +27,7 @@
27
27
  let environmentContext = useEnvironmentContext();
28
28
 
29
29
  let context = createHoverCardContext({
30
- id: id ?? uuid(),
30
+ id: id ?? createUniqueId(),
31
31
  dir: dir ?? localeContext?.dir,
32
32
  getRootNode: getRootNode ?? environmentContext?.getRootNode,
33
33
  ...props,
@@ -18,7 +18,7 @@
18
18
  <script lang="ts">
19
19
  import {useEnvironmentContext} from '../environment-provider/index.js';
20
20
  import {useLocaleContext} from '../locale-provider/index.js';
21
- import {uuid} from '../utils.svelte.js';
21
+ import {createUniqueId} from '../utils.svelte.js';
22
22
  import {mergeProps} from '@zag-js/svelte';
23
23
  import {
24
24
  createNumberInputContext,
@@ -61,7 +61,7 @@
61
61
  let environmentContext = useEnvironmentContext();
62
62
 
63
63
  let context = createNumberInputContext({
64
- id: id ?? uuid(),
64
+ id: id ?? createUniqueId(),
65
65
  ids,
66
66
  dir: dir ?? localeContext?.dir,
67
67
  max,
@@ -18,7 +18,7 @@
18
18
  <script lang="ts">
19
19
  import {useEnvironmentContext} from '../environment-provider/index.js';
20
20
  import {useLocaleContext} from '../locale-provider/index.js';
21
- import {uuid} from '../utils.svelte.js';
21
+ import {createUniqueId} from '../utils.svelte.js';
22
22
  import {mergeProps} from '@zag-js/svelte';
23
23
  import {
24
24
  createPaginationContext,
@@ -46,7 +46,7 @@
46
46
  let environmentContext = useEnvironmentContext();
47
47
 
48
48
  let context = createPaginationContext({
49
- id: id ?? uuid(),
49
+ id: id ?? createUniqueId(),
50
50
  ids,
51
51
  dir: dir ?? localeContext?.dir,
52
52
  type,
@@ -18,7 +18,7 @@
18
18
  <script lang="ts">
19
19
  import {useEnvironmentContext} from '../environment-provider/index.js';
20
20
  import {useLocaleContext} from '../locale-provider/index.js';
21
- import {uuid} from '../utils.svelte.js';
21
+ import {createUniqueId} from '../utils.svelte.js';
22
22
  import {mergeProps} from '@zag-js/svelte';
23
23
  import {createPinInputContext, setPinInputContext} from './context.svelte.js';
24
24
 
@@ -54,7 +54,7 @@
54
54
  let environmentContext = useEnvironmentContext();
55
55
 
56
56
  let context = createPinInputContext({
57
- id: id ?? uuid(),
57
+ id: id ?? createUniqueId(),
58
58
  ids,
59
59
  dir: dir ?? localeContext?.dir,
60
60
  otp,
@@ -14,7 +14,7 @@
14
14
  <script lang="ts">
15
15
  import {useEnvironmentContext} from '../environment-provider/index.js';
16
16
  import {useLocaleContext} from '../locale-provider/index.js';
17
- import {uuid} from '../utils.svelte.js';
17
+ import {createUniqueId} from '../utils.svelte.js';
18
18
  import {createPopoverContext, setPopoverContext} from './context.svelte.js';
19
19
 
20
20
  let {id, dir, getRootNode, children, ...props}: PopoverProps = $props();
@@ -23,7 +23,7 @@
23
23
  let environmentContext = useEnvironmentContext();
24
24
 
25
25
  let context = createPopoverContext({
26
- id: id ?? uuid(),
26
+ id: id ?? createUniqueId(),
27
27
  dir: dir ?? localeContext?.dir,
28
28
  getRootNode: getRootNode ?? environmentContext?.getRootNode,
29
29
  ...props,
@@ -28,16 +28,10 @@
28
28
  );
29
29
 
30
30
  let api = $derived(presence.connect(machineState, send, normalizeProps));
31
-
32
- let node: HTMLElement | null = $state(null);
33
-
34
- $effect(() => {
35
- api.setNode(node);
36
- });
37
31
  </script>
38
32
 
39
33
  <div
40
- bind:this={node}
34
+ use:api.setNode
41
35
  hidden={!api.present}
42
36
  data-state={api.skip ? undefined : present ? 'open' : 'closed'}
43
37
  {...props}
@@ -18,7 +18,7 @@
18
18
  <script lang="ts">
19
19
  import {useEnvironmentContext} from '../environment-provider/index.js';
20
20
  import {useLocaleContext} from '../locale-provider/index.js';
21
- import {uuid} from '../utils.svelte.js';
21
+ import {createUniqueId} from '../utils.svelte.js';
22
22
  import {mergeProps} from '@zag-js/svelte';
23
23
  import {createProgressContext, setProgressContext} from './context.svelte.js';
24
24
 
@@ -40,7 +40,7 @@
40
40
  let environmentContext = useEnvironmentContext();
41
41
 
42
42
  let context = createProgressContext({
43
- id: id ?? uuid(),
43
+ id: id ?? createUniqueId(),
44
44
  ids,
45
45
  dir: dir ?? localeContext?.dir,
46
46
  max,
@@ -18,7 +18,7 @@
18
18
  <script lang="ts">
19
19
  import {useEnvironmentContext} from '../environment-provider/index.js';
20
20
  import {useLocaleContext} from '../locale-provider/index.js';
21
- import {uuid} from '../utils.svelte.js';
21
+ import {createUniqueId} from '../utils.svelte.js';
22
22
  import {mergeProps} from '@zag-js/svelte';
23
23
  import {createQRCodeContext, setQRCodeContext} from './context.svelte.js';
24
24
 
@@ -37,7 +37,7 @@
37
37
  let environmentContext = useEnvironmentContext();
38
38
 
39
39
  let context = createQRCodeContext({
40
- id: id ?? uuid(),
40
+ id: id ?? createUniqueId(),
41
41
  ids,
42
42
  dir: dir ?? localeContext?.dir,
43
43
  value: $state.snapshot(value),
@@ -18,7 +18,7 @@
18
18
  <script lang="ts">
19
19
  import {useEnvironmentContext} from '../environment-provider/index.js';
20
20
  import {useLocaleContext} from '../locale-provider/index.js';
21
- import {uuid} from '../utils.svelte.js';
21
+ import {createUniqueId} from '../utils.svelte.js';
22
22
  import {mergeProps} from '@zag-js/svelte';
23
23
  import {
24
24
  createRadioGroupContext,
@@ -45,7 +45,7 @@
45
45
  let environmentContext = useEnvironmentContext();
46
46
 
47
47
  let context = createRadioGroupContext({
48
- id: id ?? uuid(),
48
+ id: id ?? createUniqueId(),
49
49
  ids,
50
50
  dir: dir ?? localeContext?.dir,
51
51
  form,
@@ -18,7 +18,7 @@
18
18
  <script lang="ts">
19
19
  import {useEnvironmentContext} from '../environment-provider/index.js';
20
20
  import {useLocaleContext} from '../locale-provider/index.js';
21
- import {uuid} from '../utils.svelte.js';
21
+ import {createUniqueId} from '../utils.svelte.js';
22
22
  import {mergeProps} from '@zag-js/svelte';
23
23
  import {
24
24
  createRatingGroupContext,
@@ -50,7 +50,7 @@
50
50
  let environmentContext = useEnvironmentContext();
51
51
 
52
52
  let context = createRatingGroupContext({
53
- id: id ?? uuid(),
53
+ id: id ?? createUniqueId(),
54
54
  ids,
55
55
  dir: dir ?? localeContext?.dir,
56
56
  form,
@@ -1,2 +1,3 @@
1
1
  import { anatomy } from '@zag-js/radio-group';
2
2
  export const segmentGroupAnatomy = anatomy.rename('segment-group');
3
+ export const parts = segmentGroupAnatomy.build();
@@ -1,33 +1,10 @@
1
1
  import * as segmentGroup from '@zag-js/radio-group';
2
- import { mergeProps, normalizeProps, reflect, useMachine } from '@zag-js/svelte';
2
+ import { normalizeProps, useMachine } from '@zag-js/svelte';
3
3
  import { getContext, setContext } from 'svelte';
4
- import { segmentGroupAnatomy } from './anatomy.js';
5
4
  export function createSegmentGroupContext(props) {
6
- const parts = $derived(segmentGroupAnatomy.build());
7
5
  const [state, send] = useMachine(segmentGroup.machine(props));
8
6
  const api = $derived(segmentGroup.connect(state, send, normalizeProps));
9
- const modified = $derived(reflect(() => ({
10
- ...api,
11
- getIndicatorProps() {
12
- return mergeProps(api.getIndicatorProps(), parts.indicator.attrs);
13
- },
14
- getItemControlProps(props) {
15
- return mergeProps(api.getItemControlProps(props), parts.itemControl.attrs);
16
- },
17
- getItemProps(props) {
18
- return mergeProps(api.getItemProps(props), parts.item.attrs);
19
- },
20
- getItemTextProps(props) {
21
- return mergeProps(api.getItemTextProps(props), parts.itemText.attrs);
22
- },
23
- getLabelProps() {
24
- return mergeProps(api.getLabelProps(), parts.label.attrs);
25
- },
26
- getRootProps() {
27
- return mergeProps(api.getRootProps(), parts.root.attrs);
28
- },
29
- })));
30
- return modified;
7
+ return api;
31
8
  }
32
9
  export function setSegmentGroupContext(value) {
33
10
  setContext('SegmentGroup', value);
@@ -7,6 +7,7 @@
7
7
 
8
8
  <script lang="ts">
9
9
  import {mergeProps} from '@zag-js/svelte';
10
+ import {parts} from './anatomy.js';
10
11
  import {useSegmentGroupContext} from './context.svelte.js';
11
12
 
12
13
  let {children, ...props}: SegmentGroupIndicatorProps = $props();
@@ -16,6 +17,6 @@
16
17
  let attrs = $derived(mergeProps(props, context.getIndicatorProps()));
17
18
  </script>
18
19
 
19
- <span {...attrs}>
20
+ <span {...attrs} {...parts.indicator.attrs}>
20
21
  {@render children?.()}
21
22
  </span>
@@ -7,6 +7,7 @@
7
7
 
8
8
  <script lang="ts">
9
9
  import {mergeProps} from '@zag-js/svelte';
10
+ import {parts} from './anatomy.js';
10
11
  import {
11
12
  useSegmentGroupContext,
12
13
  useSegmentGroupItemPropsContext,
@@ -23,6 +24,6 @@
23
24
  );
24
25
  </script>
25
26
 
26
- <div {...attrs}>
27
+ <div {...attrs} {...parts.itemControl.attrs}>
27
28
  {@render children?.()}
28
29
  </div>
@@ -7,6 +7,7 @@
7
7
 
8
8
  <script lang="ts">
9
9
  import {mergeProps} from '@zag-js/svelte';
10
+ import {parts} from './anatomy.js';
10
11
  import {
11
12
  useSegmentGroupContext,
12
13
  useSegmentGroupItemPropsContext,
@@ -21,6 +22,6 @@
21
22
  let attrs = $derived(mergeProps(props, context.getItemTextProps(itemProps)));
22
23
  </script>
23
24
 
24
- <span {...attrs}>
25
+ <span {...attrs} {...parts.itemText.attrs}>
25
26
  {@render children?.()}
26
27
  </span>
@@ -11,6 +11,7 @@
11
11
 
12
12
  <script lang="ts">
13
13
  import {mergeProps} from '@zag-js/svelte';
14
+ import {parts} from './anatomy.js';
14
15
  import {
15
16
  setSegmentGroupItemPropsContext,
16
17
  useSegmentGroupContext,
@@ -53,6 +54,6 @@
53
54
  });
54
55
  </script>
55
56
 
56
- <label {...attrs}>
57
+ <label {...attrs} {...parts.item.attrs}>
57
58
  {@render children?.(state)}
58
59
  </label>
@@ -6,6 +6,7 @@
6
6
 
7
7
  <script lang="ts">
8
8
  import {mergeProps} from '@zag-js/svelte';
9
+ import {parts} from './anatomy.js';
9
10
  import {useSegmentGroupContext} from './context.svelte.js';
10
11
 
11
12
  let {children, ...props}: SegmentGroupLabelProps = $props();
@@ -15,6 +16,6 @@
15
16
  let attrs = $derived(mergeProps(props, context.getLabelProps()));
16
17
  </script>
17
18
 
18
- <span {...attrs}>
19
+ <span {...attrs} {...parts.label.attrs}>
19
20
  {@render children?.()}
20
21
  </span>
@@ -18,8 +18,9 @@
18
18
  <script lang="ts">
19
19
  import {useEnvironmentContext} from '../environment-provider/index.js';
20
20
  import {useLocaleContext} from '../locale-provider/index.js';
21
- import {uuid} from '../utils.svelte.js';
21
+ import {createUniqueId} from '../utils.svelte.js';
22
22
  import {mergeProps} from '@zag-js/svelte';
23
+ import {parts} from './anatomy.js';
23
24
  import {
24
25
  createSegmentGroupContext,
25
26
  setSegmentGroupContext,
@@ -45,7 +46,7 @@
45
46
  let environmentContext = useEnvironmentContext();
46
47
 
47
48
  let context = createSegmentGroupContext({
48
- id: id ?? uuid(),
49
+ id: id ?? createUniqueId(),
49
50
  ids,
50
51
  dir: dir ?? localeContext?.dir,
51
52
  form,
@@ -63,6 +64,6 @@
63
64
  setSegmentGroupContext(context);
64
65
  </script>
65
66
 
66
- <div {...attrs}>
67
+ <div {...attrs} {...parts.root.attrs}>
67
68
  {@render children?.(context)}
68
69
  </div>
@@ -7,7 +7,7 @@
7
7
  </script>
8
8
 
9
9
  <script lang="ts">
10
- import {uuid} from '../utils.svelte.js';
10
+ import {createUniqueId} from '../utils.svelte.js';
11
11
  import {mergeProps} from '@zag-js/svelte';
12
12
  import {
13
13
  setSelectItemGroupPropsContext,
@@ -18,7 +18,7 @@
18
18
 
19
19
  let context = useSelectContext();
20
20
 
21
- let uid = uuid();
21
+ let uid = createUniqueId();
22
22
 
23
23
  let attrs = $derived(
24
24
  mergeProps(props, context.getItemGroupProps({id: id ?? uid})),
@@ -18,7 +18,7 @@
18
18
  <script lang="ts" generics="T">
19
19
  import {useEnvironmentContext} from '../environment-provider/index.js';
20
20
  import {useLocaleContext} from '../locale-provider/index.js';
21
- import {uuid} from '../utils.svelte.js';
21
+ import {createUniqueId} from '../utils.svelte.js';
22
22
  import {mergeProps} from '@zag-js/svelte';
23
23
  import {createSelectContext, setSelectContext} from './context.svelte.js';
24
24
 
@@ -61,7 +61,7 @@
61
61
  let environmentContext = useEnvironmentContext();
62
62
 
63
63
  let context = createSelectContext({
64
- id: id ?? uuid(),
64
+ id: id ?? createUniqueId(),
65
65
  ids,
66
66
  dir: dir ?? localeContext?.dir,
67
67
  form,
@@ -18,7 +18,7 @@
18
18
  <script lang="ts">
19
19
  import {useEnvironmentContext} from '../environment-provider/index.js';
20
20
  import {useLocaleContext} from '../locale-provider/index.js';
21
- import {uuid} from '../utils.svelte.js';
21
+ import {createUniqueId} from '../utils.svelte.js';
22
22
  import {mergeProps} from '@zag-js/svelte';
23
23
  import {createSliderContext, setSliderContext} from './context.svelte.js';
24
24
 
@@ -55,7 +55,7 @@
55
55
  let environmentContext = useEnvironmentContext();
56
56
 
57
57
  let context = createSliderContext({
58
- id: id ?? uuid(),
58
+ id: id ?? createUniqueId(),
59
59
  ids,
60
60
  dir: dir ?? localeContext?.dir,
61
61
  max,
@@ -18,7 +18,7 @@
18
18
  <script lang="ts">
19
19
  import {useEnvironmentContext} from '../environment-provider/index.js';
20
20
  import {useLocaleContext} from '../locale-provider/index.js';
21
- import {uuid} from '../utils.svelte.js';
21
+ import {createUniqueId} from '../utils.svelte.js';
22
22
  import {mergeProps} from '@zag-js/svelte';
23
23
  import {createStepsContext, setStepsContext} from './context.svelte.js';
24
24
 
@@ -40,7 +40,7 @@
40
40
  let localeContext = useLocaleContext();
41
41
 
42
42
  let context = createStepsContext({
43
- id: id ?? uuid(),
43
+ id: id ?? createUniqueId(),
44
44
  ids,
45
45
  dir: dir ?? localeContext?.dir,
46
46
  step,
@@ -18,7 +18,7 @@
18
18
  <script lang="ts">
19
19
  import {useEnvironmentContext} from '../environment-provider/index.js';
20
20
  import {useLocaleContext} from '../locale-provider/index.js';
21
- import {uuid} from '../utils.svelte.js';
21
+ import {createUniqueId} from '../utils.svelte.js';
22
22
  import {mergeProps} from '@zag-js/svelte';
23
23
  import {createSwitchContext, setSwitchContext} from './context.svelte.js';
24
24
 
@@ -45,7 +45,7 @@
45
45
  let environmentContext = useEnvironmentContext();
46
46
 
47
47
  let context = createSwitchContext({
48
- id: id ?? uuid(),
48
+ id: id ?? createUniqueId(),
49
49
  ids,
50
50
  dir: dir ?? localeContext?.dir,
51
51
  form,
@@ -18,7 +18,7 @@
18
18
  <script lang="ts">
19
19
  import {useEnvironmentContext} from '../environment-provider/index.js';
20
20
  import {useLocaleContext} from '../locale-provider/index.js';
21
- import {uuid} from '../utils.svelte.js';
21
+ import {createUniqueId} from '../utils.svelte.js';
22
22
  import {mergeProps} from '@zag-js/svelte';
23
23
  import {createTabsContext, setTabsContext} from './context.svelte.js';
24
24
 
@@ -43,7 +43,7 @@
43
43
  let environmentContext = useEnvironmentContext();
44
44
 
45
45
  let context = createTabsContext({
46
- id: id ?? uuid(),
46
+ id: id ?? createUniqueId(),
47
47
  ids,
48
48
  dir: dir ?? localeContext?.dir,
49
49
  value: $state.snapshot(value),
@@ -18,7 +18,7 @@
18
18
  <script lang="ts">
19
19
  import {useEnvironmentContext} from '../environment-provider/index.js';
20
20
  import {useLocaleContext} from '../locale-provider/index.js';
21
- import {uuid} from '../utils.svelte.js';
21
+ import {createUniqueId} from '../utils.svelte.js';
22
22
  import {mergeProps} from '@zag-js/svelte';
23
23
  import {
24
24
  createTagsInputContext,
@@ -63,7 +63,7 @@
63
63
  let environmentContext = useEnvironmentContext();
64
64
 
65
65
  let context = createTagsInputContext({
66
- id: id ?? uuid(),
66
+ id: id ?? createUniqueId(),
67
67
  ids,
68
68
  dir: dir ?? localeContext?.dir,
69
69
  max,
@@ -17,7 +17,7 @@
17
17
 
18
18
  <script lang="ts">
19
19
  import {useEnvironmentContext} from '../environment-provider/index.js';
20
- import {uuid} from '../utils.svelte.js';
20
+ import {createUniqueId} from '../utils.svelte.js';
21
21
  import {mergeProps} from '@zag-js/svelte';
22
22
  import {createTimerContext, setTimerContext} from './context.svelte.js';
23
23
 
@@ -38,7 +38,7 @@
38
38
  let environmentContext = useEnvironmentContext();
39
39
 
40
40
  let context = createTimerContext({
41
- id: id ?? uuid(),
41
+ id: id ?? createUniqueId(),
42
42
  startMs,
43
43
  targetMs,
44
44
  interval,
@@ -1,12 +1,12 @@
1
1
  import { useEnvironmentContext } from '../environment-provider/index.js';
2
2
  import { useLocaleContext } from '../locale-provider/index.js';
3
- import { uuid } from '../utils.svelte.js';
3
+ import { createUniqueId } from '../utils.svelte.js';
4
4
  import { normalizeProps, reflect } from '@zag-js/svelte';
5
5
  import * as toast from '@zag-js/toast';
6
6
  export default function createToaster(props) {
7
7
  const localContext = useLocaleContext();
8
8
  const environmentContext = useEnvironmentContext();
9
- const id = $derived(props?.id ?? uuid());
9
+ const id = $derived(props?.id ?? createUniqueId());
10
10
  const dir = $derived(props?.dir ?? localContext?.dir);
11
11
  const getRootNode = $derived(props?.getRootNode ?? environmentContext?.getRootNode);
12
12
  const machine = $derived(toast.group.machine({
@@ -18,7 +18,7 @@
18
18
  <script lang="ts">
19
19
  import {useEnvironmentContext} from '../environment-provider/index.js';
20
20
  import {useLocaleContext} from '../locale-provider/index.js';
21
- import {uuid} from '../utils.svelte.js';
21
+ import {createUniqueId} from '../utils.svelte.js';
22
22
  import {mergeProps} from '@zag-js/svelte';
23
23
  import {
24
24
  createToggleGroupContext,
@@ -45,7 +45,7 @@
45
45
  let environmentContext = useEnvironmentContext();
46
46
 
47
47
  let context = createToggleGroupContext({
48
- id: id ?? uuid(),
48
+ id: id ?? createUniqueId(),
49
49
  ids,
50
50
  dir: dir ?? localeContext?.dir,
51
51
  value: $state.snapshot(value),
@@ -14,7 +14,7 @@
14
14
  <script lang="ts">
15
15
  import {useEnvironmentContext} from '../environment-provider/index.js';
16
16
  import {useLocaleContext} from '../locale-provider/index.js';
17
- import {uuid} from '../utils.svelte.js';
17
+ import {createUniqueId} from '../utils.svelte.js';
18
18
  import {createTooltipContext, setTooltipContext} from './context.svelte.js';
19
19
 
20
20
  let {id, dir, getRootNode, children, ...props}: TooltipProps = $props();
@@ -23,7 +23,7 @@
23
23
  let environmentContext = useEnvironmentContext();
24
24
 
25
25
  let context = createTooltipContext({
26
- id: id ?? uuid(),
26
+ id: id ?? createUniqueId(),
27
27
  dir: dir ?? localeContext?.dir,
28
28
  getRootNode: getRootNode ?? environmentContext?.getRootNode,
29
29
  ...props,
@@ -1 +1 @@
1
- export declare const uuid: () => string;
1
+ export declare const createUniqueId: () => string;
@@ -1,2 +1,2 @@
1
- import { nanoid } from 'nanoid/non-secure';
2
- export const uuid = () => nanoid(8);
1
+ import { uid } from 'uid';
2
+ export const createUniqueId = () => uid();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ui-ingredients",
3
3
  "type": "module",
4
- "version": "0.0.13",
4
+ "version": "0.0.15",
5
5
  "packageManager": "pnpm@9.7.0",
6
6
  "svelte": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
@@ -123,7 +123,7 @@
123
123
  "@zag-js/toggle-group": "0.65.1",
124
124
  "@zag-js/tooltip": "0.65.1",
125
125
  "@zag-js/tree-view": "0.65.1",
126
- "nanoid": "5.0.7"
126
+ "uid": "2.0.2"
127
127
  },
128
128
  "peerDependencies": {
129
129
  "svelte": "^5.0.0-next.1"
@@ -1,10 +0,0 @@
1
- import * as segmentGroup from '@zag-js/radio-group';
2
- export interface CreateSegmentGroupContextProps extends segmentGroup.Context {
3
- }
4
- export interface CreateSegmentGroupContextReturn extends ReturnType<typeof createSegmentGroupContext> {
5
- }
6
- export declare function createSegmentGroupContext(props: CreateSegmentGroupContextProps): any;
7
- export declare function setSegmentGroupContext(value: CreateSegmentGroupContextReturn): void;
8
- export declare function useSegmentGroupContext(): CreateSegmentGroupContextReturn;
9
- export declare function setSegmentGroupItemPropsContext(value: segmentGroup.ItemProps): void;
10
- export declare function useSegmentGroupItemPropsContext(): segmentGroup.ItemProps;