ui-ingredients 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -1
- package/dist/accordion/context.svelte.d.ts +2 -2
- package/dist/accordion/context.svelte.js +2 -2
- package/dist/accordion/item-content.svelte +28 -27
- package/dist/accordion/item-indicator.svelte +28 -27
- package/dist/accordion/item-trigger.svelte +28 -27
- package/dist/accordion/item.svelte +48 -48
- package/dist/accordion/root.svelte +68 -63
- package/dist/avatar/fallback.svelte +20 -20
- package/dist/avatar/image.svelte +18 -18
- package/dist/avatar/root.svelte +53 -48
- package/dist/carousel/indicator-group.svelte +21 -21
- package/dist/carousel/indicator.svelte +30 -30
- package/dist/carousel/item-group.svelte +20 -20
- package/dist/carousel/item.svelte +27 -27
- package/dist/carousel/next-trigger.svelte +21 -21
- package/dist/carousel/prev-trigger.svelte +21 -21
- package/dist/carousel/root.svelte +65 -60
- package/dist/carousel/viewport.svelte +20 -20
- package/dist/checkbox/control.svelte +20 -20
- package/dist/checkbox/hidden-input.svelte +19 -19
- package/dist/checkbox/indicator.svelte +20 -20
- package/dist/checkbox/label.svelte +20 -20
- package/dist/checkbox/root.svelte +69 -64
- package/dist/clipboard/control.svelte +20 -20
- package/dist/clipboard/indicator.svelte +22 -22
- package/dist/clipboard/input.svelte +18 -18
- package/dist/clipboard/label.svelte +20 -20
- package/dist/clipboard/root.svelte +56 -53
- package/dist/clipboard/trigger.svelte +21 -21
- package/dist/collapsible/content.svelte +20 -20
- package/dist/collapsible/root.svelte +64 -59
- package/dist/collapsible/trigger.svelte +19 -19
- package/dist/combobox/clear-trigger.svelte +21 -21
- package/dist/combobox/content.svelte +20 -20
- package/dist/combobox/context.svelte.d.ts +4 -4
- package/dist/combobox/context.svelte.js +4 -4
- package/dist/combobox/control.svelte +20 -20
- package/dist/combobox/input.svelte +18 -18
- package/dist/combobox/item-group-label.svelte +33 -32
- package/dist/combobox/item-group.svelte +32 -32
- package/dist/combobox/item-indicator.svelte +28 -27
- package/dist/combobox/item-text.svelte +29 -30
- package/dist/combobox/item.svelte +48 -48
- package/dist/combobox/label.svelte +20 -20
- package/dist/combobox/list.svelte +20 -20
- package/dist/combobox/positioner.svelte +20 -20
- package/dist/combobox/root.svelte +129 -124
- package/dist/combobox/trigger.svelte +20 -20
- package/dist/dialog/backdrop.svelte +20 -20
- package/dist/dialog/close-trigger.svelte +21 -21
- package/dist/dialog/content.svelte +20 -20
- package/dist/dialog/description.svelte +20 -20
- package/dist/dialog/positioner.svelte +20 -20
- package/dist/dialog/root.svelte +35 -28
- package/dist/dialog/title.svelte +20 -20
- package/dist/dialog/trigger.svelte +20 -20
- package/dist/editable/area.svelte +20 -20
- package/dist/editable/cancel-trigger.svelte +21 -21
- package/dist/editable/control.svelte +20 -20
- package/dist/editable/edit-trigger.svelte +21 -21
- package/dist/editable/input.svelte +18 -18
- package/dist/editable/label.svelte +20 -20
- package/dist/editable/preview.svelte +24 -24
- package/dist/editable/root.svelte +36 -29
- package/dist/editable/submit-trigger.svelte +21 -21
- package/dist/environment-provider/context.svelte.d.ts +14 -0
- package/dist/environment-provider/context.svelte.js +25 -0
- package/dist/environment-provider/index.d.ts +2 -0
- package/dist/environment-provider/index.js +2 -0
- package/dist/environment-provider/root.svelte +21 -0
- package/dist/environment-provider/root.svelte.d.ts +23 -0
- package/dist/hover-card/arrow-tip.svelte +20 -20
- package/dist/hover-card/arrow.svelte +20 -20
- package/dist/hover-card/content.svelte +20 -20
- package/dist/hover-card/positioner.svelte +21 -21
- package/dist/hover-card/root.svelte +39 -32
- package/dist/hover-card/trigger.svelte +20 -20
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/locale-provider/context.svelte.d.ts +11 -0
- package/dist/locale-provider/context.svelte.js +23 -0
- package/dist/locale-provider/index.d.ts +2 -0
- package/dist/locale-provider/index.js +2 -0
- package/dist/locale-provider/root.svelte +20 -0
- package/dist/locale-provider/root.svelte.d.ts +23 -0
- package/dist/menu/arrow-tip.svelte.d.ts +26 -0
- package/dist/menu/arrow.svelte +0 -0
- package/dist/menu/arrow.svelte.d.ts +26 -0
- package/dist/menu/content.svelte +0 -0
- package/dist/menu/content.svelte.d.ts +26 -0
- package/dist/menu/context-trigger.svelte +0 -0
- package/dist/menu/context-trigger.svelte.d.ts +26 -0
- package/dist/menu/context.svelte.d.ts +10 -0
- package/dist/menu/context.svelte.js +20 -0
- package/dist/menu/index.d.ts +1 -0
- package/dist/menu/index.js +1 -0
- package/dist/menu/indicator.svelte +0 -0
- package/dist/menu/indicator.svelte.d.ts +26 -0
- package/dist/menu/item-group-label.svelte +0 -0
- package/dist/menu/item-group-label.svelte.d.ts +26 -0
- package/dist/menu/item-group.svelte +0 -0
- package/dist/menu/item-group.svelte.d.ts +26 -0
- package/dist/menu/item-indicator.svelte +0 -0
- package/dist/menu/item-indicator.svelte.d.ts +26 -0
- package/dist/menu/item-text.svelte +0 -0
- package/dist/menu/item-text.svelte.d.ts +26 -0
- package/dist/menu/item.svelte +0 -0
- package/dist/menu/item.svelte.d.ts +26 -0
- package/dist/menu/menu.d.ts +1 -0
- package/dist/menu/menu.js +1 -0
- package/dist/menu/option-item.svelte +0 -0
- package/dist/menu/option-item.svelte.d.ts +26 -0
- package/dist/menu/positioner.svelte +0 -0
- package/dist/menu/positioner.svelte.d.ts +26 -0
- package/dist/menu/root.svelte +0 -0
- package/dist/menu/root.svelte.d.ts +26 -0
- package/dist/menu/separator.svelte +0 -0
- package/dist/menu/separator.svelte.d.ts +26 -0
- package/dist/menu/trigger-item.svelte +0 -0
- package/dist/menu/trigger-item.svelte.d.ts +26 -0
- package/dist/menu/trigger.svelte +0 -0
- package/dist/menu/trigger.svelte.d.ts +26 -0
- package/dist/number-input/control.svelte +21 -21
- package/dist/number-input/decrement-trigger.svelte +21 -21
- package/dist/number-input/increment-trigger.svelte +21 -21
- package/dist/number-input/input.svelte +18 -18
- package/dist/number-input/label.svelte +20 -20
- package/dist/number-input/root.svelte +100 -95
- package/dist/number-input/scrubber.svelte +21 -21
- package/dist/pagination/ellipsis.svelte +22 -22
- package/dist/pagination/item.svelte +30 -30
- package/dist/pagination/next-trigger.svelte +21 -21
- package/dist/pagination/prev-trigger.svelte +21 -21
- package/dist/pagination/root.svelte +70 -65
- package/dist/pin-input/clear-trigger.svelte +25 -25
- package/dist/pin-input/hidden-input.svelte +19 -19
- package/dist/pin-input/input.svelte +20 -20
- package/dist/pin-input/label.svelte +20 -20
- package/dist/pin-input/root.svelte +89 -84
- package/dist/popover/arrow-tip.svelte +20 -20
- package/dist/popover/arrow.svelte +20 -20
- package/dist/popover/close-trigger.svelte +21 -21
- package/dist/popover/content.svelte +20 -20
- package/dist/popover/description.svelte +20 -20
- package/dist/popover/positioner.svelte +20 -20
- package/dist/popover/root.svelte +35 -28
- package/dist/popover/title.svelte +20 -20
- package/dist/popover/trigger.svelte +20 -20
- package/dist/portal/root.svelte +20 -20
- package/dist/presence/root.svelte +46 -46
- package/dist/progress/circle-range.svelte +21 -21
- package/dist/progress/circle-track.svelte +21 -21
- package/dist/progress/circle.svelte +20 -20
- package/dist/progress/label.svelte +20 -20
- package/dist/progress/range.svelte +20 -20
- package/dist/progress/root.svelte +61 -56
- package/dist/progress/track.svelte +20 -20
- package/dist/progress/value-text.svelte +24 -24
- package/dist/qr-code/frame.svelte +20 -20
- package/dist/qr-code/overlay.svelte +20 -20
- package/dist/qr-code/pattern.svelte +20 -20
- package/dist/qr-code/root.svelte +55 -50
- package/dist/radio-group/context.svelte.d.ts +2 -2
- package/dist/radio-group/context.svelte.js +2 -2
- package/dist/radio-group/indicator.svelte +21 -21
- package/dist/radio-group/item-control.svelte +28 -27
- package/dist/radio-group/item-hidden-input.svelte +26 -25
- package/dist/radio-group/item-text.svelte +26 -27
- package/dist/radio-group/item.svelte +58 -58
- package/dist/radio-group/label.svelte +20 -20
- package/dist/radio-group/root.svelte +68 -63
- package/dist/rating-group/context.svelte.d.ts +0 -2
- package/dist/rating-group/context.svelte.js +0 -6
- package/dist/rating-group/control.svelte +20 -20
- package/dist/rating-group/hidden-input.svelte +19 -19
- package/dist/rating-group/item.svelte +27 -27
- package/dist/rating-group/label.svelte +20 -20
- package/dist/rating-group/root.svelte +78 -73
- package/dist/segment-group/context.svelte.d.ts +10 -0
- package/dist/segment-group/context.svelte.js +43 -0
- package/dist/segment-group/index.d.ts +9 -2
- package/dist/segment-group/index.js +2 -2
- package/dist/segment-group/indicator.svelte +21 -0
- package/dist/segment-group/indicator.svelte.d.ts +21 -0
- package/dist/segment-group/item-control.svelte +28 -0
- package/dist/segment-group/item-control.svelte.d.ts +21 -0
- package/dist/segment-group/item-hidden-input.svelte +26 -0
- package/dist/segment-group/item-hidden-input.svelte.d.ts +21 -0
- package/dist/segment-group/item-text.svelte +26 -0
- package/dist/segment-group/item-text.svelte.d.ts +21 -0
- package/dist/segment-group/item.svelte +58 -0
- package/dist/segment-group/item.svelte.d.ts +24 -0
- package/dist/segment-group/label.svelte +20 -0
- package/dist/segment-group/label.svelte.d.ts +21 -0
- package/dist/segment-group/root.svelte +68 -0
- package/dist/segment-group/root.svelte.d.ts +24 -0
- package/dist/segment-group/segment-group.d.ts +7 -0
- package/dist/segment-group/segment-group.js +7 -0
- package/dist/select/clear-trigger.svelte +21 -21
- package/dist/select/content.svelte +20 -20
- package/dist/select/context.svelte.d.ts +4 -7
- package/dist/select/context.svelte.js +4 -4
- package/dist/select/control.svelte +20 -20
- package/dist/select/hidden-select.svelte +21 -21
- package/dist/select/indicator.svelte +20 -20
- package/dist/select/item-group-label.svelte +31 -30
- package/dist/select/item-group.svelte +32 -32
- package/dist/select/item-indicator.svelte +28 -24
- package/dist/select/item-text.svelte +29 -27
- package/dist/select/item.svelte +48 -45
- package/dist/select/label.svelte +20 -20
- package/dist/select/list.svelte +20 -20
- package/dist/select/positioner.svelte +20 -20
- package/dist/select/root.svelte +103 -98
- package/dist/select/trigger.svelte +20 -20
- package/dist/select/value-text.svelte +26 -26
- package/dist/slider/context.svelte.d.ts +2 -2
- package/dist/slider/context.svelte.js +2 -2
- package/dist/slider/control.svelte +20 -20
- package/dist/slider/hidden-input.svelte +26 -22
- package/dist/slider/label.svelte +20 -20
- package/dist/slider/marker-group.svelte +20 -20
- package/dist/slider/marker.svelte +29 -29
- package/dist/slider/range.svelte +20 -20
- package/dist/slider/root.svelte +91 -86
- package/dist/slider/thumb.svelte +38 -35
- package/dist/slider/track.svelte +20 -20
- package/dist/slider/value-text.svelte +24 -24
- package/dist/steps/content.svelte +22 -22
- package/dist/steps/context.svelte.d.ts +2 -2
- package/dist/steps/context.svelte.js +2 -2
- package/dist/steps/indicator.svelte +22 -23
- package/dist/steps/item.svelte +29 -29
- package/dist/steps/list.svelte +20 -20
- package/dist/steps/next-trigger.svelte +21 -21
- package/dist/steps/prev-trigger.svelte +21 -21
- package/dist/steps/progress.svelte +20 -20
- package/dist/steps/root.svelte +62 -58
- package/dist/steps/separator.svelte +22 -23
- package/dist/steps/trigger.svelte +22 -21
- package/dist/switch/control.svelte +20 -20
- package/dist/switch/hidden-input.svelte +19 -19
- package/dist/switch/label.svelte +20 -20
- package/dist/switch/root.svelte +71 -66
- package/dist/switch/thumb.svelte +20 -20
- package/dist/tabs/content.svelte +22 -22
- package/dist/tabs/list.svelte +20 -20
- package/dist/tabs/root.svelte +67 -62
- package/dist/tabs/trigger.svelte +24 -24
- package/dist/tags-input/clear-trigger.svelte +21 -21
- package/dist/tags-input/context.svelte.d.ts +2 -2
- package/dist/tags-input/context.svelte.js +2 -2
- package/dist/tags-input/control.svelte +20 -20
- package/dist/tags-input/hidden-input.svelte +19 -19
- package/dist/tags-input/input.svelte +18 -18
- package/dist/tags-input/item-delete-trigger.svelte +28 -27
- package/dist/tags-input/item-input.svelte +24 -25
- package/dist/tags-input/item-preview.svelte +28 -27
- package/dist/tags-input/item-text.svelte +25 -26
- package/dist/tags-input/item.svelte +58 -52
- package/dist/tags-input/label.svelte +20 -20
- package/dist/tags-input/root.svelte +104 -99
- package/dist/timer/action-trigger.svelte +24 -24
- package/dist/timer/context.svelte.d.ts +2 -2
- package/dist/timer/context.svelte.js +2 -2
- package/dist/timer/item-label.svelte +22 -23
- package/dist/timer/item-value.svelte +26 -27
- package/dist/timer/item.svelte +24 -24
- package/dist/timer/root.svelte +59 -56
- package/dist/timer/separator.svelte +20 -20
- package/dist/toast/action-trigger.svelte +21 -21
- package/dist/toast/close-trigger.svelte +21 -21
- package/dist/toast/create-toaster.svelte.js +12 -1
- package/dist/toast/description.svelte +24 -24
- package/dist/toast/root.svelte +29 -29
- package/dist/toast/title.svelte +24 -24
- package/dist/toast/toaster.svelte +40 -40
- package/dist/toggle-group/item.svelte +29 -29
- package/dist/toggle-group/root.svelte +68 -63
- package/dist/tooltip/arrow-tip.svelte +20 -20
- package/dist/tooltip/arrow.svelte +20 -20
- package/dist/tooltip/content.svelte +20 -20
- package/dist/tooltip/positioner.svelte +20 -20
- package/dist/tooltip/root.svelte +35 -28
- package/dist/tooltip/trigger.svelte +20 -20
- package/package.json +3 -2
- /package/dist/menu/{.gitkeep → arrow-tip.svelte} +0 -0
@@ -1,20 +1,20 @@
|
|
1
|
-
<script lang="ts" context="module">
|
2
|
-
import type {HtmlIngredientProps} from '../types.js';
|
3
|
-
|
4
|
-
export interface RatingGroupControlProps extends HtmlIngredientProps<'div'> {}
|
5
|
-
</script>
|
6
|
-
|
7
|
-
<script lang="ts">
|
8
|
-
import {mergeProps} from '@zag-js/svelte';
|
9
|
-
import {useRatingGroupContext} from './context.svelte.js';
|
10
|
-
|
11
|
-
let {children, ...props}: RatingGroupControlProps = $props();
|
12
|
-
|
13
|
-
let context = useRatingGroupContext();
|
14
|
-
|
15
|
-
let attrs = $derived(mergeProps(props, context.getControlProps()));
|
16
|
-
</script>
|
17
|
-
|
18
|
-
<div {...attrs}>
|
19
|
-
{@render children?.()}
|
20
|
-
</div>
|
1
|
+
<script lang="ts" context="module">
|
2
|
+
import type {HtmlIngredientProps} from '../types.js';
|
3
|
+
|
4
|
+
export interface RatingGroupControlProps extends HtmlIngredientProps<'div'> {}
|
5
|
+
</script>
|
6
|
+
|
7
|
+
<script lang="ts">
|
8
|
+
import {mergeProps} from '@zag-js/svelte';
|
9
|
+
import {useRatingGroupContext} from './context.svelte.js';
|
10
|
+
|
11
|
+
let {children, ...props}: RatingGroupControlProps = $props();
|
12
|
+
|
13
|
+
let context = useRatingGroupContext();
|
14
|
+
|
15
|
+
let attrs = $derived(mergeProps(props, context.getControlProps()));
|
16
|
+
</script>
|
17
|
+
|
18
|
+
<div {...attrs}>
|
19
|
+
{@render children?.()}
|
20
|
+
</div>
|
@@ -1,19 +1,19 @@
|
|
1
|
-
<script lang="ts" context="module">
|
2
|
-
import type {HtmlIngredientProps} from '../types.js';
|
3
|
-
|
4
|
-
export interface RatingGroupHiddenInputProps
|
5
|
-
extends HtmlIngredientProps<'input'> {}
|
6
|
-
</script>
|
7
|
-
|
8
|
-
<script lang="ts">
|
9
|
-
import {mergeProps} from '@zag-js/svelte';
|
10
|
-
import {useRatingGroupContext} from './context.svelte.js';
|
11
|
-
|
12
|
-
let {...props}: RatingGroupHiddenInputProps = $props();
|
13
|
-
|
14
|
-
let context = useRatingGroupContext();
|
15
|
-
|
16
|
-
let attrs = $derived(mergeProps(props, context.getHiddenInputProps()));
|
17
|
-
</script>
|
18
|
-
|
19
|
-
<input {...attrs} />
|
1
|
+
<script lang="ts" context="module">
|
2
|
+
import type {HtmlIngredientProps} from '../types.js';
|
3
|
+
|
4
|
+
export interface RatingGroupHiddenInputProps
|
5
|
+
extends HtmlIngredientProps<'input'> {}
|
6
|
+
</script>
|
7
|
+
|
8
|
+
<script lang="ts">
|
9
|
+
import {mergeProps} from '@zag-js/svelte';
|
10
|
+
import {useRatingGroupContext} from './context.svelte.js';
|
11
|
+
|
12
|
+
let {...props}: RatingGroupHiddenInputProps = $props();
|
13
|
+
|
14
|
+
let context = useRatingGroupContext();
|
15
|
+
|
16
|
+
let attrs = $derived(mergeProps(props, context.getHiddenInputProps()));
|
17
|
+
</script>
|
18
|
+
|
19
|
+
<input {...attrs} />
|
@@ -1,27 +1,27 @@
|
|
1
|
-
<script lang="ts" context="module">
|
2
|
-
import type {Assign, HtmlIngredientProps} from '../types.js';
|
3
|
-
import type {ItemProps, ItemState} from '@zag-js/rating-group';
|
4
|
-
import type {Snippet} from 'svelte';
|
5
|
-
|
6
|
-
export interface RatingGroupItemProps
|
7
|
-
extends Assign<Omit<HtmlIngredientProps<'div'>, 'children'>, ItemProps> {
|
8
|
-
children: Snippet<[state: ItemState]>;
|
9
|
-
}
|
10
|
-
</script>
|
11
|
-
|
12
|
-
<script lang="ts">
|
13
|
-
import {mergeProps} from '@zag-js/svelte';
|
14
|
-
import {useRatingGroupContext} from './context.svelte.js';
|
15
|
-
|
16
|
-
let {index, children, ...props}: RatingGroupItemProps = $props();
|
17
|
-
|
18
|
-
let context = useRatingGroupContext();
|
19
|
-
|
20
|
-
let state = $derived(context.getItemState({index}));
|
21
|
-
|
22
|
-
let attrs = $derived(mergeProps(props, context.getItemProps({index})));
|
23
|
-
</script>
|
24
|
-
|
25
|
-
<div {...attrs}>
|
26
|
-
{@render children?.(state)}
|
27
|
-
</div>
|
1
|
+
<script lang="ts" context="module">
|
2
|
+
import type {Assign, HtmlIngredientProps} from '../types.js';
|
3
|
+
import type {ItemProps, ItemState} from '@zag-js/rating-group';
|
4
|
+
import type {Snippet} from 'svelte';
|
5
|
+
|
6
|
+
export interface RatingGroupItemProps
|
7
|
+
extends Assign<Omit<HtmlIngredientProps<'div'>, 'children'>, ItemProps> {
|
8
|
+
children: Snippet<[state: ItemState]>;
|
9
|
+
}
|
10
|
+
</script>
|
11
|
+
|
12
|
+
<script lang="ts">
|
13
|
+
import {mergeProps} from '@zag-js/svelte';
|
14
|
+
import {useRatingGroupContext} from './context.svelte.js';
|
15
|
+
|
16
|
+
let {index, children, ...props}: RatingGroupItemProps = $props();
|
17
|
+
|
18
|
+
let context = useRatingGroupContext();
|
19
|
+
|
20
|
+
let state = $derived(context.getItemState({index}));
|
21
|
+
|
22
|
+
let attrs = $derived(mergeProps(props, context.getItemProps({index})));
|
23
|
+
</script>
|
24
|
+
|
25
|
+
<div {...attrs}>
|
26
|
+
{@render children?.(state)}
|
27
|
+
</div>
|
@@ -1,20 +1,20 @@
|
|
1
|
-
<script lang="ts" context="module">
|
2
|
-
import type {HtmlIngredientProps} from '../types.js';
|
3
|
-
|
4
|
-
export interface RatingGroupLabelProps extends HtmlIngredientProps<'label'> {}
|
5
|
-
</script>
|
6
|
-
|
7
|
-
<script lang="ts">
|
8
|
-
import {mergeProps} from '@zag-js/svelte';
|
9
|
-
import {useRatingGroupContext} from './context.svelte.js';
|
10
|
-
|
11
|
-
let {children, ...props}: RatingGroupLabelProps = $props();
|
12
|
-
|
13
|
-
let context = useRatingGroupContext();
|
14
|
-
|
15
|
-
let attrs = $derived(mergeProps(props, context.getLabelProps()));
|
16
|
-
</script>
|
17
|
-
|
18
|
-
<label {...attrs}>
|
19
|
-
{@render children?.()}
|
20
|
-
</label>
|
1
|
+
<script lang="ts" context="module">
|
2
|
+
import type {HtmlIngredientProps} from '../types.js';
|
3
|
+
|
4
|
+
export interface RatingGroupLabelProps extends HtmlIngredientProps<'label'> {}
|
5
|
+
</script>
|
6
|
+
|
7
|
+
<script lang="ts">
|
8
|
+
import {mergeProps} from '@zag-js/svelte';
|
9
|
+
import {useRatingGroupContext} from './context.svelte.js';
|
10
|
+
|
11
|
+
let {children, ...props}: RatingGroupLabelProps = $props();
|
12
|
+
|
13
|
+
let context = useRatingGroupContext();
|
14
|
+
|
15
|
+
let attrs = $derived(mergeProps(props, context.getLabelProps()));
|
16
|
+
</script>
|
17
|
+
|
18
|
+
<label {...attrs}>
|
19
|
+
{@render children?.()}
|
20
|
+
</label>
|
@@ -1,73 +1,78 @@
|
|
1
|
-
<script lang="ts" context="module">
|
2
|
-
import type {Assign, HtmlIngredientProps} from '../types.js';
|
3
|
-
import type {Snippet} from 'svelte';
|
4
|
-
import type {
|
5
|
-
CreateRatingGroupContextProps,
|
6
|
-
CreateRatingGroupContextReturn,
|
7
|
-
} from './context.svelte.js';
|
8
|
-
|
9
|
-
export interface RatingGroupProps
|
10
|
-
extends Assign<
|
11
|
-
Omit<HtmlIngredientProps<'div'>, 'children'>,
|
12
|
-
Omit<CreateRatingGroupContextProps, 'id'>
|
13
|
-
> {
|
14
|
-
children?: Snippet<[context: CreateRatingGroupContextReturn]>;
|
15
|
-
}
|
16
|
-
</script>
|
17
|
-
|
18
|
-
<script lang="ts">
|
19
|
-
import {
|
20
|
-
import {
|
21
|
-
import {
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
1
|
+
<script lang="ts" context="module">
|
2
|
+
import type {Assign, HtmlIngredientProps} from '../types.js';
|
3
|
+
import type {Snippet} from 'svelte';
|
4
|
+
import type {
|
5
|
+
CreateRatingGroupContextProps,
|
6
|
+
CreateRatingGroupContextReturn,
|
7
|
+
} from './context.svelte.js';
|
8
|
+
|
9
|
+
export interface RatingGroupProps
|
10
|
+
extends Assign<
|
11
|
+
Omit<HtmlIngredientProps<'div'>, 'children'>,
|
12
|
+
Omit<CreateRatingGroupContextProps, 'id'>
|
13
|
+
> {
|
14
|
+
children?: Snippet<[context: CreateRatingGroupContextReturn]>;
|
15
|
+
}
|
16
|
+
</script>
|
17
|
+
|
18
|
+
<script lang="ts">
|
19
|
+
import {useEnvironmentContext} from '../environment-provider/index.js';
|
20
|
+
import {useLocaleContext} from '../locale-provider/index.js';
|
21
|
+
import {uuid} from '../utils.svelte.js';
|
22
|
+
import {mergeProps} from '@zag-js/svelte';
|
23
|
+
import {
|
24
|
+
createRatingGroupContext,
|
25
|
+
setRatingGroupContext,
|
26
|
+
} from './context.svelte.js';
|
27
|
+
|
28
|
+
let {
|
29
|
+
id,
|
30
|
+
ids,
|
31
|
+
dir,
|
32
|
+
form,
|
33
|
+
name,
|
34
|
+
count,
|
35
|
+
value,
|
36
|
+
disabled,
|
37
|
+
readOnly,
|
38
|
+
required,
|
39
|
+
autoFocus,
|
40
|
+
allowHalf,
|
41
|
+
translations,
|
42
|
+
onHoverChange,
|
43
|
+
onValueChange,
|
44
|
+
getRootNode,
|
45
|
+
children,
|
46
|
+
...props
|
47
|
+
}: RatingGroupProps = $props();
|
48
|
+
|
49
|
+
let localeContext = useLocaleContext();
|
50
|
+
let environmentContext = useEnvironmentContext();
|
51
|
+
|
52
|
+
let context = createRatingGroupContext({
|
53
|
+
id: id ?? uuid(),
|
54
|
+
ids,
|
55
|
+
dir: dir ?? localeContext?.dir,
|
56
|
+
form,
|
57
|
+
name,
|
58
|
+
count,
|
59
|
+
value: $state.snapshot(value),
|
60
|
+
disabled,
|
61
|
+
readOnly,
|
62
|
+
required,
|
63
|
+
autoFocus,
|
64
|
+
allowHalf,
|
65
|
+
translations,
|
66
|
+
onHoverChange,
|
67
|
+
onValueChange,
|
68
|
+
getRootNode: getRootNode ?? environmentContext?.getRootNode,
|
69
|
+
});
|
70
|
+
|
71
|
+
let attrs = $derived(mergeProps(props, context.getRootProps()));
|
72
|
+
|
73
|
+
setRatingGroupContext(context);
|
74
|
+
</script>
|
75
|
+
|
76
|
+
<div {...attrs}>
|
77
|
+
{@render children?.(context)}
|
78
|
+
</div>
|
@@ -0,0 +1,10 @@
|
|
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;
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import * as segmentGroup from '@zag-js/radio-group';
|
2
|
+
import { mergeProps, normalizeProps, reflect, useMachine } from '@zag-js/svelte';
|
3
|
+
import { getContext, setContext } from 'svelte';
|
4
|
+
import { segmentGroupAnatomy } from './anatomy.js';
|
5
|
+
export function createSegmentGroupContext(props) {
|
6
|
+
const parts = $derived(segmentGroupAnatomy.build());
|
7
|
+
const [state, send] = useMachine(segmentGroup.machine(props));
|
8
|
+
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;
|
31
|
+
}
|
32
|
+
export function setSegmentGroupContext(value) {
|
33
|
+
setContext('SegmentGroup', value);
|
34
|
+
}
|
35
|
+
export function useSegmentGroupContext() {
|
36
|
+
return getContext('SegmentGroup');
|
37
|
+
}
|
38
|
+
export function setSegmentGroupItemPropsContext(value) {
|
39
|
+
setContext('SegmentGroupItem', value);
|
40
|
+
}
|
41
|
+
export function useSegmentGroupItemPropsContext() {
|
42
|
+
return getContext('SegmentGroupItem');
|
43
|
+
}
|
@@ -1,2 +1,9 @@
|
|
1
|
-
export {
|
2
|
-
export
|
1
|
+
export { segmentGroupAnatomy } from './anatomy.js';
|
2
|
+
export type { SegmentGroupIndicatorProps } from './indicator.svelte';
|
3
|
+
export type { SegmentGroupItemControlProps } from './item-control.svelte';
|
4
|
+
export type { SegmentGroupItemHiddenInputProps } from './item-hidden-input.svelte';
|
5
|
+
export type { SegmentGroupItemTextProps } from './item-text.svelte';
|
6
|
+
export type { SegmentGroupItemProps } from './item.svelte';
|
7
|
+
export type { SegmentGroupLabelProps } from './label.svelte';
|
8
|
+
export type { SegmentGroupProps } from './root.svelte';
|
9
|
+
export * as SegmentGroup from './segment-group.js';
|
@@ -1,2 +1,2 @@
|
|
1
|
-
export {
|
2
|
-
export * from './
|
1
|
+
export { segmentGroupAnatomy } from './anatomy.js';
|
2
|
+
export * as SegmentGroup from './segment-group.js';
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<script lang="ts" context="module">
|
2
|
+
import type {HtmlIngredientProps} from '../types.js';
|
3
|
+
|
4
|
+
export interface SegmentGroupIndicatorProps
|
5
|
+
extends HtmlIngredientProps<'span'> {}
|
6
|
+
</script>
|
7
|
+
|
8
|
+
<script lang="ts">
|
9
|
+
import {mergeProps} from '@zag-js/svelte';
|
10
|
+
import {useSegmentGroupContext} from './context.svelte.js';
|
11
|
+
|
12
|
+
let {children, ...props}: SegmentGroupIndicatorProps = $props();
|
13
|
+
|
14
|
+
let context = useSegmentGroupContext();
|
15
|
+
|
16
|
+
let attrs = $derived(mergeProps(props, context.getIndicatorProps()));
|
17
|
+
</script>
|
18
|
+
|
19
|
+
<span {...attrs}>
|
20
|
+
{@render children?.()}
|
21
|
+
</span>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import type { HtmlIngredientProps } from '../types.js';
|
2
|
+
export interface SegmentGroupIndicatorProps extends HtmlIngredientProps<'span'> {
|
3
|
+
}
|
4
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
5
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
6
|
+
$$bindings?: Bindings;
|
7
|
+
} & Exports;
|
8
|
+
(internal: unknown, props: Props & {
|
9
|
+
$$events?: Events;
|
10
|
+
$$slots?: Slots;
|
11
|
+
}): Exports & {
|
12
|
+
$set?: any;
|
13
|
+
$on?: any;
|
14
|
+
};
|
15
|
+
z_$$bindings?: Bindings;
|
16
|
+
}
|
17
|
+
declare const Indicator: $$__sveltets_2_IsomorphicComponent<SegmentGroupIndicatorProps, {
|
18
|
+
[evt: string]: CustomEvent<any>;
|
19
|
+
}, {}, {}, "">;
|
20
|
+
type Indicator = InstanceType<typeof Indicator>;
|
21
|
+
export default Indicator;
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<script lang="ts" context="module">
|
2
|
+
import type {HtmlIngredientProps} from '../types.js';
|
3
|
+
|
4
|
+
export interface SegmentGroupItemControlProps
|
5
|
+
extends HtmlIngredientProps<'div'> {}
|
6
|
+
</script>
|
7
|
+
|
8
|
+
<script lang="ts">
|
9
|
+
import {mergeProps} from '@zag-js/svelte';
|
10
|
+
import {
|
11
|
+
useSegmentGroupContext,
|
12
|
+
useSegmentGroupItemPropsContext,
|
13
|
+
} from './context.svelte.js';
|
14
|
+
|
15
|
+
let {children, ...props}: SegmentGroupItemControlProps = $props();
|
16
|
+
|
17
|
+
let context = useSegmentGroupContext();
|
18
|
+
|
19
|
+
let itemProps = useSegmentGroupItemPropsContext();
|
20
|
+
|
21
|
+
let attrs = $derived(
|
22
|
+
mergeProps(props, context.getItemControlProps(itemProps)),
|
23
|
+
);
|
24
|
+
</script>
|
25
|
+
|
26
|
+
<div {...attrs}>
|
27
|
+
{@render children?.()}
|
28
|
+
</div>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import type { HtmlIngredientProps } from '../types.js';
|
2
|
+
export interface SegmentGroupItemControlProps extends HtmlIngredientProps<'div'> {
|
3
|
+
}
|
4
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
5
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
6
|
+
$$bindings?: Bindings;
|
7
|
+
} & Exports;
|
8
|
+
(internal: unknown, props: Props & {
|
9
|
+
$$events?: Events;
|
10
|
+
$$slots?: Slots;
|
11
|
+
}): Exports & {
|
12
|
+
$set?: any;
|
13
|
+
$on?: any;
|
14
|
+
};
|
15
|
+
z_$$bindings?: Bindings;
|
16
|
+
}
|
17
|
+
declare const ItemControl: $$__sveltets_2_IsomorphicComponent<SegmentGroupItemControlProps, {
|
18
|
+
[evt: string]: CustomEvent<any>;
|
19
|
+
}, {}, {}, "">;
|
20
|
+
type ItemControl = InstanceType<typeof ItemControl>;
|
21
|
+
export default ItemControl;
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<script lang="ts" context="module">
|
2
|
+
import type {HtmlIngredientProps} from '../types.js';
|
3
|
+
|
4
|
+
export interface SegmentGroupItemHiddenInputProps
|
5
|
+
extends HtmlIngredientProps<'input'> {}
|
6
|
+
</script>
|
7
|
+
|
8
|
+
<script lang="ts">
|
9
|
+
import {mergeProps} from '@zag-js/svelte';
|
10
|
+
import {
|
11
|
+
useSegmentGroupContext,
|
12
|
+
useSegmentGroupItemPropsContext,
|
13
|
+
} from './context.svelte.js';
|
14
|
+
|
15
|
+
let {...props}: SegmentGroupItemHiddenInputProps = $props();
|
16
|
+
|
17
|
+
let context = useSegmentGroupContext();
|
18
|
+
|
19
|
+
let itemProps = useSegmentGroupItemPropsContext();
|
20
|
+
|
21
|
+
let attrs = $derived(
|
22
|
+
mergeProps(props, context.getItemHiddenInputProps(itemProps)),
|
23
|
+
);
|
24
|
+
</script>
|
25
|
+
|
26
|
+
<input {...attrs} />
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import type { HtmlIngredientProps } from '../types.js';
|
2
|
+
export interface SegmentGroupItemHiddenInputProps extends HtmlIngredientProps<'input'> {
|
3
|
+
}
|
4
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
5
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
6
|
+
$$bindings?: Bindings;
|
7
|
+
} & Exports;
|
8
|
+
(internal: unknown, props: Props & {
|
9
|
+
$$events?: Events;
|
10
|
+
$$slots?: Slots;
|
11
|
+
}): Exports & {
|
12
|
+
$set?: any;
|
13
|
+
$on?: any;
|
14
|
+
};
|
15
|
+
z_$$bindings?: Bindings;
|
16
|
+
}
|
17
|
+
declare const ItemHiddenInput: $$__sveltets_2_IsomorphicComponent<SegmentGroupItemHiddenInputProps, {
|
18
|
+
[evt: string]: CustomEvent<any>;
|
19
|
+
}, {}, {}, "">;
|
20
|
+
type ItemHiddenInput = InstanceType<typeof ItemHiddenInput>;
|
21
|
+
export default ItemHiddenInput;
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<script lang="ts" context="module">
|
2
|
+
import type {HtmlIngredientProps} from '../types.js';
|
3
|
+
|
4
|
+
export interface SegmentGroupItemTextProps
|
5
|
+
extends HtmlIngredientProps<'span'> {}
|
6
|
+
</script>
|
7
|
+
|
8
|
+
<script lang="ts">
|
9
|
+
import {mergeProps} from '@zag-js/svelte';
|
10
|
+
import {
|
11
|
+
useSegmentGroupContext,
|
12
|
+
useSegmentGroupItemPropsContext,
|
13
|
+
} from './context.svelte.js';
|
14
|
+
|
15
|
+
let {children, ...props}: SegmentGroupItemTextProps = $props();
|
16
|
+
|
17
|
+
let context = useSegmentGroupContext();
|
18
|
+
|
19
|
+
let itemProps = useSegmentGroupItemPropsContext();
|
20
|
+
|
21
|
+
let attrs = $derived(mergeProps(props, context.getItemTextProps(itemProps)));
|
22
|
+
</script>
|
23
|
+
|
24
|
+
<span {...attrs}>
|
25
|
+
{@render children?.()}
|
26
|
+
</span>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import type { HtmlIngredientProps } from '../types.js';
|
2
|
+
export interface SegmentGroupItemTextProps extends HtmlIngredientProps<'span'> {
|
3
|
+
}
|
4
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
5
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
6
|
+
$$bindings?: Bindings;
|
7
|
+
} & Exports;
|
8
|
+
(internal: unknown, props: Props & {
|
9
|
+
$$events?: Events;
|
10
|
+
$$slots?: Slots;
|
11
|
+
}): Exports & {
|
12
|
+
$set?: any;
|
13
|
+
$on?: any;
|
14
|
+
};
|
15
|
+
z_$$bindings?: Bindings;
|
16
|
+
}
|
17
|
+
declare const ItemText: $$__sveltets_2_IsomorphicComponent<SegmentGroupItemTextProps, {
|
18
|
+
[evt: string]: CustomEvent<any>;
|
19
|
+
}, {}, {}, "">;
|
20
|
+
type ItemText = InstanceType<typeof ItemText>;
|
21
|
+
export default ItemText;
|
@@ -0,0 +1,58 @@
|
|
1
|
+
<script lang="ts" context="module">
|
2
|
+
import type {Assign, HtmlIngredientProps} from '../types.js';
|
3
|
+
import type {ItemProps, ItemState} from '@zag-js/radio-group';
|
4
|
+
import type {Snippet} from 'svelte';
|
5
|
+
|
6
|
+
export interface SegmentGroupItemProps
|
7
|
+
extends Assign<Omit<HtmlIngredientProps<'label'>, 'children'>, ItemProps> {
|
8
|
+
children?: Snippet<[state: ItemState]>;
|
9
|
+
}
|
10
|
+
</script>
|
11
|
+
|
12
|
+
<script lang="ts">
|
13
|
+
import {mergeProps} from '@zag-js/svelte';
|
14
|
+
import {
|
15
|
+
setSegmentGroupItemPropsContext,
|
16
|
+
useSegmentGroupContext,
|
17
|
+
} from './context.svelte.js';
|
18
|
+
|
19
|
+
let {
|
20
|
+
/**/
|
21
|
+
value,
|
22
|
+
invalid,
|
23
|
+
disabled,
|
24
|
+
children,
|
25
|
+
...props
|
26
|
+
}: SegmentGroupItemProps = $props();
|
27
|
+
|
28
|
+
let context = useSegmentGroupContext();
|
29
|
+
|
30
|
+
let state = $derived(
|
31
|
+
context.getItemState({
|
32
|
+
value,
|
33
|
+
invalid,
|
34
|
+
disabled,
|
35
|
+
}),
|
36
|
+
);
|
37
|
+
|
38
|
+
let attrs = $derived(
|
39
|
+
mergeProps(
|
40
|
+
props,
|
41
|
+
context.getItemProps({
|
42
|
+
value,
|
43
|
+
invalid,
|
44
|
+
disabled,
|
45
|
+
}),
|
46
|
+
),
|
47
|
+
);
|
48
|
+
|
49
|
+
setSegmentGroupItemPropsContext({
|
50
|
+
value,
|
51
|
+
invalid,
|
52
|
+
disabled,
|
53
|
+
});
|
54
|
+
</script>
|
55
|
+
|
56
|
+
<label {...attrs}>
|
57
|
+
{@render children?.(state)}
|
58
|
+
</label>
|