ui-ingredients 0.20.0 → 0.21.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. package/dist/accordion/accordion-item-content.svelte +55 -55
  2. package/dist/accordion/accordion-root.svelte +66 -66
  3. package/dist/alert-dialog/alert-dialog-backdrop.svelte +49 -49
  4. package/dist/alert-dialog/alert-dialog-root.svelte +48 -48
  5. package/dist/avatar/avatar-root.svelte +46 -46
  6. package/dist/carousel/carousel-root.svelte +56 -56
  7. package/dist/checkbox/checkbox-root.svelte +59 -59
  8. package/dist/clipboard/clipboard-root.svelte +52 -52
  9. package/dist/collapsible/collapsible-root.svelte +75 -75
  10. package/dist/color-picker/color-picker-root.svelte +87 -87
  11. package/dist/combobox/combobox-root.svelte +101 -101
  12. package/dist/combobox/combobox-trigger.svelte +41 -41
  13. package/dist/date-picker/date-picker-root.svelte +89 -89
  14. package/dist/dialog/dialog-backdrop.svelte +45 -45
  15. package/dist/dialog/dialog-root.svelte +48 -48
  16. package/dist/drawer/drawer-backdrop.svelte +45 -45
  17. package/dist/drawer/drawer-root.svelte +48 -48
  18. package/dist/editable/editable-root.svelte +74 -74
  19. package/dist/field/field-error-text.svelte +50 -50
  20. package/dist/field/field-root.svelte +63 -63
  21. package/dist/file-upload/file-upload-root.svelte +66 -66
  22. package/dist/floating-panel/floating-panel-root.svelte +47 -47
  23. package/dist/hover-card/hover-card-root.svelte +52 -52
  24. package/dist/menu/menu-root.svelte +74 -74
  25. package/dist/number-input/number-input-root.svelte +74 -74
  26. package/dist/pagination/pagination-root.svelte +57 -57
  27. package/dist/pin-input/pin-input-root.svelte +68 -68
  28. package/dist/popover/popover-root.svelte +60 -60
  29. package/dist/presence/presence.svelte +48 -48
  30. package/dist/progress/progress-root.svelte +54 -54
  31. package/dist/qr-code/qr-code-root.svelte +48 -48
  32. package/dist/radio-group/radio-group-root.svelte +56 -56
  33. package/dist/rating-group/rating-group-root.svelte +63 -63
  34. package/dist/segment-group/segment-group-root.svelte +58 -58
  35. package/dist/select/select-root.svelte +88 -88
  36. package/dist/signature-pad/signature-pad-root.svelte +59 -59
  37. package/dist/slider/slider-root.svelte +69 -69
  38. package/dist/splitter/splitter-root.svelte +53 -53
  39. package/dist/steps/steps-completed-content.svelte +51 -37
  40. package/dist/steps/steps-completed-content.svelte.d.ts +2 -1
  41. package/dist/steps/steps-content.svelte +55 -32
  42. package/dist/steps/steps-content.svelte.d.ts +2 -1
  43. package/dist/steps/steps-root.svelte +65 -55
  44. package/dist/steps/steps-root.svelte.d.ts +2 -1
  45. package/dist/switch/switch-root.svelte +59 -59
  46. package/dist/tabs/tabs-root.svelte +57 -57
  47. package/dist/tags-input/tags-input-root.svelte +74 -74
  48. package/dist/time-picker/time-picker-root.svelte +81 -81
  49. package/dist/timer/timer-root.svelte +55 -55
  50. package/dist/toast/create-toaster.svelte.d.ts +1 -1
  51. package/dist/toast/toast-actor.svelte +19 -19
  52. package/dist/toast/toast-actor.svelte.d.ts +3 -3
  53. package/dist/toast/toaster.svelte +19 -21
  54. package/dist/toast/toaster.svelte.d.ts +1 -1
  55. package/dist/toggle/toggle-root.svelte +50 -50
  56. package/dist/toggle-group/toggle-group-root.svelte +58 -58
  57. package/dist/tooltip/tooltip-root.svelte +44 -44
  58. package/dist/tour/tour-backdrop.svelte +44 -44
  59. package/dist/tour/tour-root.svelte +47 -47
  60. package/dist/tree-view/tree-view-branch-content.svelte +55 -55
  61. package/dist/tree-view/tree-view-root.svelte +68 -68
  62. package/package.json +5 -5
@@ -1,55 +1,55 @@
1
- <script lang="ts" module>
2
- import type {HtmlIngredientProps} from '../types.js';
3
- import type {Action} from 'svelte/action';
4
-
5
- export interface AccordionItemContentProps
6
- extends HtmlIngredientProps<'div', HTMLDivElement, never, Action> {}
7
- </script>
8
-
9
- <script lang="ts">
10
- import {mergeProps} from '../merge-props.js';
11
- import {createPresence} from '../presence/create-presence.svelte.js';
12
- import {getPresenceStrategyPropsContext} from '../presence/presence-context.svelte.js';
13
- import {reflect} from '@zag-js/svelte';
14
- import {
15
- getAccordionContext,
16
- getAccordionItemPropsContext,
17
- } from './accordion-context.svelte.js';
18
-
19
- let {
20
- ref = $bindable(null),
21
- asChild,
22
- children,
23
- ...props
24
- }: AccordionItemContentProps = $props();
25
-
26
- let accordion = getAccordionContext();
27
- let itemProps = getAccordionItemPropsContext();
28
- let itemsState = $derived(accordion.getItemState(itemProps));
29
-
30
- let presenceStrategyProps = getPresenceStrategyPropsContext();
31
- let presence = createPresence(
32
- reflect(() => ({
33
- ...presenceStrategyProps,
34
- present: itemsState.expanded,
35
- })),
36
- );
37
-
38
- let mergedProps = $derived(
39
- mergeProps(
40
- accordion.getItemContentProps(itemProps),
41
- presence.getPresenceProps(),
42
- props,
43
- ),
44
- );
45
- </script>
46
-
47
- {#if presence.mounted}
48
- {#if asChild}
49
- {@render asChild(presence.setReference, mergedProps)}
50
- {:else}
51
- <div bind:this={ref} use:presence.setReference {...mergedProps}>
52
- {@render children?.()}
53
- </div>
54
- {/if}
55
- {/if}
1
+ <script lang="ts" module>
2
+ import type {HtmlIngredientProps} from '../types.js';
3
+ import type {Action} from 'svelte/action';
4
+
5
+ export interface AccordionItemContentProps
6
+ extends HtmlIngredientProps<'div', HTMLDivElement, never, Action> {}
7
+ </script>
8
+
9
+ <script lang="ts">
10
+ import {mergeProps} from '../merge-props.js';
11
+ import {createPresence} from '../presence/create-presence.svelte.js';
12
+ import {getPresenceStrategyPropsContext} from '../presence/presence-context.svelte.js';
13
+ import {reflect} from '@zag-js/svelte';
14
+ import {
15
+ getAccordionContext,
16
+ getAccordionItemPropsContext,
17
+ } from './accordion-context.svelte.js';
18
+
19
+ let {
20
+ ref = $bindable(null),
21
+ asChild,
22
+ children,
23
+ ...props
24
+ }: AccordionItemContentProps = $props();
25
+
26
+ let accordion = getAccordionContext();
27
+ let itemProps = getAccordionItemPropsContext();
28
+ let itemsState = $derived(accordion.getItemState(itemProps));
29
+
30
+ let presenceStrategyProps = getPresenceStrategyPropsContext();
31
+ let presence = createPresence(
32
+ reflect(() => ({
33
+ ...presenceStrategyProps,
34
+ present: itemsState.expanded,
35
+ })),
36
+ );
37
+
38
+ let mergedProps = $derived(
39
+ mergeProps(
40
+ accordion.getItemContentProps(itemProps),
41
+ presence.getPresenceProps(),
42
+ props,
43
+ ),
44
+ );
45
+ </script>
46
+
47
+ {#if presence.mounted}
48
+ {#if asChild}
49
+ {@render asChild(presence.setReference, mergedProps)}
50
+ {:else}
51
+ <div bind:this={ref} use:presence.setReference {...mergedProps}>
52
+ {@render children?.()}
53
+ </div>
54
+ {/if}
55
+ {/if}
@@ -1,66 +1,66 @@
1
- <script lang="ts" module>
2
- import type {PresenceStrategyProps} from '../presence/create-presence.svelte.js';
3
- import type {Assign, HtmlIngredientProps} from '../types.js';
4
- import type {
5
- CreateAccordionProps,
6
- CreateAccordionReturn,
7
- } from './create-accordion.svelte.js';
8
-
9
- export interface AccordionProps
10
- extends Assign<
11
- HtmlIngredientProps<'div', HTMLDivElement, CreateAccordionReturn>,
12
- CreateAccordionProps
13
- >,
14
- PresenceStrategyProps {}
15
- </script>
16
-
17
- <script lang="ts">
18
- import {mergeProps} from '../merge-props.js';
19
- import {setPresenceStrategyPropsContext} from '../presence/presence-context.svelte.js';
20
- import {reflect} from '@zag-js/svelte';
21
- import {createSplitProps} from '@zag-js/utils';
22
- import {setAccordionContext} from './accordion-context.svelte.js';
23
- import {createAccordion} from './create-accordion.svelte.js';
24
-
25
- let {
26
- ref = $bindable(null),
27
- asChild,
28
- children,
29
- ...props
30
- }: AccordionProps = $props();
31
-
32
- let [presenceStrategyProps, rest] = $derived(
33
- createSplitProps<PresenceStrategyProps>(['lazyMount', 'keepMounted'])(
34
- props,
35
- ),
36
- );
37
-
38
- let [createAccordionProps, localProps] = $derived(
39
- createSplitProps<CreateAccordionProps>([
40
- 'id',
41
- 'ids',
42
- 'value',
43
- 'disabled',
44
- 'multiple',
45
- 'orientation',
46
- 'collapsible',
47
- 'onFocusChange',
48
- 'onValueChange',
49
- ])(rest),
50
- );
51
-
52
- let accordion = createAccordion(reflect(() => createAccordionProps));
53
-
54
- let mergedProps = $derived(mergeProps(accordion.getRootProps(), localProps));
55
-
56
- setAccordionContext(accordion);
57
- setPresenceStrategyPropsContext(() => presenceStrategyProps);
58
- </script>
59
-
60
- {#if asChild}
61
- {@render asChild(mergedProps, accordion)}
62
- {:else}
63
- <div bind:this={ref} {...mergedProps}>
64
- {@render children?.(accordion)}
65
- </div>
66
- {/if}
1
+ <script lang="ts" module>
2
+ import type {PresenceStrategyProps} from '../presence/create-presence.svelte.js';
3
+ import type {Assign, HtmlIngredientProps} from '../types.js';
4
+ import type {
5
+ CreateAccordionProps,
6
+ CreateAccordionReturn,
7
+ } from './create-accordion.svelte.js';
8
+
9
+ export interface AccordionProps
10
+ extends Assign<
11
+ HtmlIngredientProps<'div', HTMLDivElement, CreateAccordionReturn>,
12
+ CreateAccordionProps
13
+ >,
14
+ PresenceStrategyProps {}
15
+ </script>
16
+
17
+ <script lang="ts">
18
+ import {mergeProps} from '../merge-props.js';
19
+ import {setPresenceStrategyPropsContext} from '../presence/presence-context.svelte.js';
20
+ import {reflect} from '@zag-js/svelte';
21
+ import {createSplitProps} from '@zag-js/utils';
22
+ import {setAccordionContext} from './accordion-context.svelte.js';
23
+ import {createAccordion} from './create-accordion.svelte.js';
24
+
25
+ let {
26
+ ref = $bindable(null),
27
+ asChild,
28
+ children,
29
+ ...props
30
+ }: AccordionProps = $props();
31
+
32
+ let [presenceStrategyProps, rest] = $derived(
33
+ createSplitProps<PresenceStrategyProps>(['lazyMount', 'keepMounted'])(
34
+ props,
35
+ ),
36
+ );
37
+
38
+ let [createAccordionProps, localProps] = $derived(
39
+ createSplitProps<CreateAccordionProps>([
40
+ 'id',
41
+ 'ids',
42
+ 'value',
43
+ 'disabled',
44
+ 'multiple',
45
+ 'orientation',
46
+ 'collapsible',
47
+ 'onFocusChange',
48
+ 'onValueChange',
49
+ ])(rest),
50
+ );
51
+
52
+ let accordion = createAccordion(reflect(() => createAccordionProps));
53
+
54
+ let mergedProps = $derived(mergeProps(accordion.getRootProps(), localProps));
55
+
56
+ setAccordionContext(accordion);
57
+ setPresenceStrategyPropsContext(() => presenceStrategyProps);
58
+ </script>
59
+
60
+ {#if asChild}
61
+ {@render asChild(mergedProps, accordion)}
62
+ {:else}
63
+ <div bind:this={ref} {...mergedProps}>
64
+ {@render children?.(accordion)}
65
+ </div>
66
+ {/if}
@@ -1,49 +1,49 @@
1
- <script lang="ts" module>
2
- import type {HtmlIngredientProps} from '../types.js';
3
- import type {Action} from 'svelte/action';
4
-
5
- export interface AlertDialogBackdropProps
6
- extends HtmlIngredientProps<'div', HTMLDivElement, never, Action> {}
7
- </script>
8
-
9
- <script lang="ts">
10
- import {mergeProps} from '../merge-props.js';
11
- import {createPresence} from '../presence/create-presence.svelte.js';
12
- import {getPresenceStrategyPropsContext} from '../presence/presence-context.svelte.js';
13
- import {reflect} from '@zag-js/svelte';
14
- import {getAlertDialogContext} from './alert-dialog-context.svelte.js';
15
-
16
- let {
17
- ref = $bindable(null),
18
- asChild,
19
- children,
20
- ...props
21
- }: AlertDialogBackdropProps = $props();
22
-
23
- let alertDialog = getAlertDialogContext();
24
- let presenceStrategyProps = getPresenceStrategyPropsContext();
25
- let presence = createPresence(
26
- reflect(() => ({
27
- ...presenceStrategyProps,
28
- present: alertDialog.open,
29
- })),
30
- );
31
-
32
- let mergedProps = $derived(
33
- mergeProps(
34
- alertDialog.getBackdropProps(),
35
- presence.getPresenceProps(),
36
- props,
37
- ),
38
- );
39
- </script>
40
-
41
- {#if presence.mounted}
42
- {#if asChild}
43
- {@render asChild(presence.setReference, mergedProps)}
44
- {:else}
45
- <div bind:this={ref} use:presence.setReference {...mergedProps}>
46
- {@render children?.()}
47
- </div>
48
- {/if}
49
- {/if}
1
+ <script lang="ts" module>
2
+ import type {HtmlIngredientProps} from '../types.js';
3
+ import type {Action} from 'svelte/action';
4
+
5
+ export interface AlertDialogBackdropProps
6
+ extends HtmlIngredientProps<'div', HTMLDivElement, never, Action> {}
7
+ </script>
8
+
9
+ <script lang="ts">
10
+ import {mergeProps} from '../merge-props.js';
11
+ import {createPresence} from '../presence/create-presence.svelte.js';
12
+ import {getPresenceStrategyPropsContext} from '../presence/presence-context.svelte.js';
13
+ import {reflect} from '@zag-js/svelte';
14
+ import {getAlertDialogContext} from './alert-dialog-context.svelte.js';
15
+
16
+ let {
17
+ ref = $bindable(null),
18
+ asChild,
19
+ children,
20
+ ...props
21
+ }: AlertDialogBackdropProps = $props();
22
+
23
+ let alertDialog = getAlertDialogContext();
24
+ let presenceStrategyProps = getPresenceStrategyPropsContext();
25
+ let presence = createPresence(
26
+ reflect(() => ({
27
+ ...presenceStrategyProps,
28
+ present: alertDialog.open,
29
+ })),
30
+ );
31
+
32
+ let mergedProps = $derived(
33
+ mergeProps(
34
+ alertDialog.getBackdropProps(),
35
+ presence.getPresenceProps(),
36
+ props,
37
+ ),
38
+ );
39
+ </script>
40
+
41
+ {#if presence.mounted}
42
+ {#if asChild}
43
+ {@render asChild(presence.setReference, mergedProps)}
44
+ {:else}
45
+ <div bind:this={ref} use:presence.setReference {...mergedProps}>
46
+ {@render children?.()}
47
+ </div>
48
+ {/if}
49
+ {/if}
@@ -1,48 +1,48 @@
1
- <script lang="ts" module>
2
- import type {PresenceStrategyProps} from '../presence/create-presence.svelte.js';
3
- import type {Snippet} from 'svelte';
4
- import type {
5
- CreateAlertDialogProps,
6
- CreateAlertDialogReturn,
7
- } from './create-alert-dialog.svelte.js';
8
-
9
- export interface AlertDialogProps
10
- extends CreateAlertDialogProps,
11
- PresenceStrategyProps {
12
- children?: Snippet<[CreateAlertDialogReturn]>;
13
- }
14
- </script>
15
-
16
- <script lang="ts">
17
- import {createPresence} from '../presence/create-presence.svelte.js';
18
- import {
19
- setPresenceContext,
20
- setPresenceStrategyPropsContext,
21
- } from '../presence/presence-context.svelte.js';
22
- import {reflect} from '@zag-js/svelte';
23
- import {createSplitProps} from '@zag-js/utils';
24
- import {setAlertDialogContext} from './alert-dialog-context.svelte.js';
25
- import {createAlertDialog} from './create-alert-dialog.svelte.js';
26
-
27
- let {children, ...props}: AlertDialogProps = $props();
28
-
29
- let [presenceStrategyProps, createDialogProps] = $derived(
30
- createSplitProps<PresenceStrategyProps>(['lazyMount', 'keepMounted'])(
31
- props,
32
- ),
33
- );
34
-
35
- let alertDialog = createAlertDialog(reflect(() => createDialogProps));
36
- let presence = createPresence(
37
- reflect(() => ({
38
- ...presenceStrategyProps,
39
- present: alertDialog.open,
40
- })),
41
- );
42
-
43
- setAlertDialogContext(alertDialog);
44
- setPresenceContext(presence);
45
- setPresenceStrategyPropsContext(() => presenceStrategyProps);
46
- </script>
47
-
48
- {@render children?.(alertDialog)}
1
+ <script lang="ts" module>
2
+ import type {PresenceStrategyProps} from '../presence/create-presence.svelte.js';
3
+ import type {Snippet} from 'svelte';
4
+ import type {
5
+ CreateAlertDialogProps,
6
+ CreateAlertDialogReturn,
7
+ } from './create-alert-dialog.svelte.js';
8
+
9
+ export interface AlertDialogProps
10
+ extends CreateAlertDialogProps,
11
+ PresenceStrategyProps {
12
+ children?: Snippet<[CreateAlertDialogReturn]>;
13
+ }
14
+ </script>
15
+
16
+ <script lang="ts">
17
+ import {createPresence} from '../presence/create-presence.svelte.js';
18
+ import {
19
+ setPresenceContext,
20
+ setPresenceStrategyPropsContext,
21
+ } from '../presence/presence-context.svelte.js';
22
+ import {reflect} from '@zag-js/svelte';
23
+ import {createSplitProps} from '@zag-js/utils';
24
+ import {setAlertDialogContext} from './alert-dialog-context.svelte.js';
25
+ import {createAlertDialog} from './create-alert-dialog.svelte.js';
26
+
27
+ let {children, ...props}: AlertDialogProps = $props();
28
+
29
+ let [presenceStrategyProps, createDialogProps] = $derived(
30
+ createSplitProps<PresenceStrategyProps>(['lazyMount', 'keepMounted'])(
31
+ props,
32
+ ),
33
+ );
34
+
35
+ let alertDialog = createAlertDialog(reflect(() => createDialogProps));
36
+ let presence = createPresence(
37
+ reflect(() => ({
38
+ ...presenceStrategyProps,
39
+ present: alertDialog.open,
40
+ })),
41
+ );
42
+
43
+ setAlertDialogContext(alertDialog);
44
+ setPresenceContext(presence);
45
+ setPresenceStrategyPropsContext(() => presenceStrategyProps);
46
+ </script>
47
+
48
+ {@render children?.(alertDialog)}
@@ -1,46 +1,46 @@
1
- <script lang="ts" module>
2
- import type {Assign, HtmlIngredientProps} from '../types.js';
3
- import {
4
- type CreateAvatarProps,
5
- type CreateAvatarReturn,
6
- } from './create-avatar.svelte.js';
7
-
8
- export interface AvatarProps
9
- extends Assign<
10
- HtmlIngredientProps<'div', HTMLDivElement, CreateAvatarReturn>,
11
- CreateAvatarProps
12
- > {}
13
- </script>
14
-
15
- <script lang="ts">
16
- import {mergeProps} from '../merge-props.js';
17
- import {reflect} from '@zag-js/svelte';
18
- import {createSplitProps} from '@zag-js/utils';
19
- import {setAvatarContext} from './avatar-context.svelte.js';
20
- import {createAvatar} from './create-avatar.svelte.js';
21
-
22
- let {
23
- ref = $bindable(null),
24
- asChild,
25
- children,
26
- ...props
27
- }: AvatarProps = $props();
28
-
29
- let [createAvatarProps, localProps] = $derived(
30
- createSplitProps<CreateAvatarProps>(['id', 'ids', 'onStatusChange'])(props),
31
- );
32
-
33
- let avatar = createAvatar(reflect(() => createAvatarProps));
34
-
35
- let mergedProps = $derived(mergeProps(avatar.getRootProps(), localProps));
36
-
37
- setAvatarContext(avatar);
38
- </script>
39
-
40
- {#if asChild}
41
- {@render asChild(mergedProps, avatar)}
42
- {:else}
43
- <div bind:this={ref} {...mergedProps}>
44
- {@render children?.(avatar)}
45
- </div>
46
- {/if}
1
+ <script lang="ts" module>
2
+ import type {Assign, HtmlIngredientProps} from '../types.js';
3
+ import {
4
+ type CreateAvatarProps,
5
+ type CreateAvatarReturn,
6
+ } from './create-avatar.svelte.js';
7
+
8
+ export interface AvatarProps
9
+ extends Assign<
10
+ HtmlIngredientProps<'div', HTMLDivElement, CreateAvatarReturn>,
11
+ CreateAvatarProps
12
+ > {}
13
+ </script>
14
+
15
+ <script lang="ts">
16
+ import {mergeProps} from '../merge-props.js';
17
+ import {reflect} from '@zag-js/svelte';
18
+ import {createSplitProps} from '@zag-js/utils';
19
+ import {setAvatarContext} from './avatar-context.svelte.js';
20
+ import {createAvatar} from './create-avatar.svelte.js';
21
+
22
+ let {
23
+ ref = $bindable(null),
24
+ asChild,
25
+ children,
26
+ ...props
27
+ }: AvatarProps = $props();
28
+
29
+ let [createAvatarProps, localProps] = $derived(
30
+ createSplitProps<CreateAvatarProps>(['id', 'ids', 'onStatusChange'])(props),
31
+ );
32
+
33
+ let avatar = createAvatar(reflect(() => createAvatarProps));
34
+
35
+ let mergedProps = $derived(mergeProps(avatar.getRootProps(), localProps));
36
+
37
+ setAvatarContext(avatar);
38
+ </script>
39
+
40
+ {#if asChild}
41
+ {@render asChild(mergedProps, avatar)}
42
+ {:else}
43
+ <div bind:this={ref} {...mergedProps}>
44
+ {@render children?.(avatar)}
45
+ </div>
46
+ {/if}
@@ -1,56 +1,56 @@
1
- <script lang="ts" module>
2
- import type {Assign, HtmlIngredientProps} from '../types.js';
3
- import type {
4
- CreateCarouselProps,
5
- CreateCarouselReturn,
6
- } from './create-carousel.svelte.js';
7
-
8
- export interface CarouselProps
9
- extends Assign<
10
- HtmlIngredientProps<'div', HTMLDivElement, CreateCarouselReturn>,
11
- CreateCarouselProps
12
- > {}
13
- </script>
14
-
15
- <script lang="ts">
16
- import {mergeProps} from '../merge-props.js';
17
- import {reflect} from '@zag-js/svelte';
18
- import {createSplitProps} from '@zag-js/utils';
19
- import {setCarouselContext} from './carousel-context.svelte.js';
20
- import {createCarousel} from './create-carousel.svelte.js';
21
-
22
- let {
23
- ref = $bindable(null),
24
- asChild,
25
- children,
26
- ...props
27
- }: CarouselProps = $props();
28
-
29
- let [createCarouselProps, localProps] = $derived(
30
- createSplitProps<CreateCarouselProps>([
31
- 'id',
32
- 'ids',
33
- 'loop',
34
- 'align',
35
- 'index',
36
- 'spacing',
37
- 'orientation',
38
- 'slidesPerView',
39
- 'onIndexChange',
40
- ])(props),
41
- );
42
-
43
- let carousel = createCarousel(reflect(() => createCarouselProps));
44
-
45
- let mergedProps = $derived(mergeProps(carousel.getRootProps(), localProps));
46
-
47
- setCarouselContext(carousel);
48
- </script>
49
-
50
- {#if asChild}
51
- {@render asChild(mergedProps, carousel)}
52
- {:else}
53
- <div bind:this={ref} {...mergedProps}>
54
- {@render children?.(carousel)}
55
- </div>
56
- {/if}
1
+ <script lang="ts" module>
2
+ import type {Assign, HtmlIngredientProps} from '../types.js';
3
+ import type {
4
+ CreateCarouselProps,
5
+ CreateCarouselReturn,
6
+ } from './create-carousel.svelte.js';
7
+
8
+ export interface CarouselProps
9
+ extends Assign<
10
+ HtmlIngredientProps<'div', HTMLDivElement, CreateCarouselReturn>,
11
+ CreateCarouselProps
12
+ > {}
13
+ </script>
14
+
15
+ <script lang="ts">
16
+ import {mergeProps} from '../merge-props.js';
17
+ import {reflect} from '@zag-js/svelte';
18
+ import {createSplitProps} from '@zag-js/utils';
19
+ import {setCarouselContext} from './carousel-context.svelte.js';
20
+ import {createCarousel} from './create-carousel.svelte.js';
21
+
22
+ let {
23
+ ref = $bindable(null),
24
+ asChild,
25
+ children,
26
+ ...props
27
+ }: CarouselProps = $props();
28
+
29
+ let [createCarouselProps, localProps] = $derived(
30
+ createSplitProps<CreateCarouselProps>([
31
+ 'id',
32
+ 'ids',
33
+ 'loop',
34
+ 'align',
35
+ 'index',
36
+ 'spacing',
37
+ 'orientation',
38
+ 'slidesPerView',
39
+ 'onIndexChange',
40
+ ])(props),
41
+ );
42
+
43
+ let carousel = createCarousel(reflect(() => createCarouselProps));
44
+
45
+ let mergedProps = $derived(mergeProps(carousel.getRootProps(), localProps));
46
+
47
+ setCarouselContext(carousel);
48
+ </script>
49
+
50
+ {#if asChild}
51
+ {@render asChild(mergedProps, carousel)}
52
+ {:else}
53
+ <div bind:this={ref} {...mergedProps}>
54
+ {@render children?.(carousel)}
55
+ </div>
56
+ {/if}