ui-ingredients 0.0.20 → 0.0.21
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +2 -2
- package/dist/accordion/create-accordion.svelte.js +4 -4
- package/dist/accordion/item-content.svelte +2 -3
- package/dist/accordion/item-indicator.svelte +2 -3
- package/dist/accordion/item-trigger.svelte +2 -3
- package/dist/accordion/item.svelte +3 -4
- package/dist/accordion/root.svelte +5 -5
- package/dist/avatar/create-avatar.svelte.js +4 -4
- package/dist/avatar/fallback.svelte +2 -2
- package/dist/avatar/image.svelte +2 -2
- package/dist/avatar/root.svelte +5 -5
- package/dist/carousel/create-carousel.svelte.js +4 -4
- package/dist/carousel/indicator-group.svelte +2 -2
- package/dist/carousel/indicator.svelte +2 -2
- package/dist/carousel/item-group.svelte +2 -2
- package/dist/carousel/item.svelte +3 -3
- package/dist/carousel/next-trigger.svelte +2 -2
- package/dist/carousel/prev-trigger.svelte +2 -2
- package/dist/carousel/root.svelte +5 -5
- package/dist/carousel/viewport.svelte +2 -2
- package/dist/checkbox/control.svelte +2 -2
- package/dist/checkbox/create-checkbox.svelte.js +4 -4
- package/dist/checkbox/hidden-input.svelte +2 -2
- package/dist/checkbox/indicator.svelte +2 -2
- package/dist/checkbox/label.svelte +2 -2
- package/dist/checkbox/root.svelte +5 -5
- package/dist/clipboard/control.svelte +2 -2
- package/dist/clipboard/create-clipboard.svelte.js +2 -2
- package/dist/clipboard/indicator.svelte +2 -2
- package/dist/clipboard/input.svelte +2 -2
- package/dist/clipboard/label.svelte +2 -2
- package/dist/clipboard/root.svelte +5 -5
- package/dist/clipboard/trigger.svelte +2 -2
- package/dist/collapsible/content.svelte +2 -2
- package/dist/collapsible/create-collapsible.svelte.js +4 -4
- package/dist/collapsible/root.svelte +4 -4
- package/dist/collapsible/trigger.svelte +2 -2
- package/dist/combobox/clear-trigger.svelte +2 -2
- package/dist/combobox/content.svelte +2 -2
- package/dist/combobox/control.svelte +2 -2
- package/dist/combobox/create-combobox.svelte.js +4 -4
- package/dist/combobox/input.svelte +2 -2
- package/dist/combobox/item-group-label.svelte +2 -3
- package/dist/combobox/item-group.svelte +2 -2
- package/dist/combobox/item-indicator.svelte +2 -3
- package/dist/combobox/item-text.svelte +3 -4
- package/dist/combobox/item.svelte +3 -4
- package/dist/combobox/label.svelte +2 -2
- package/dist/combobox/list.svelte +2 -2
- package/dist/combobox/positioner.svelte +2 -2
- package/dist/combobox/root.svelte +5 -5
- package/dist/combobox/trigger.svelte +2 -2
- package/dist/date-picker/clear-trigger.svelte +2 -2
- package/dist/date-picker/content.svelte +2 -2
- package/dist/date-picker/control.svelte +2 -2
- package/dist/date-picker/create-date-picker.svelte.d.ts +1 -1
- package/dist/date-picker/create-date-picker.svelte.js +5 -5
- package/dist/date-picker/day-table-cell-trigger.svelte +2 -3
- package/dist/date-picker/day-table-cell.svelte +3 -4
- package/dist/date-picker/input.svelte +2 -2
- package/dist/date-picker/label.svelte +2 -2
- package/dist/date-picker/month-select.svelte +2 -2
- package/dist/date-picker/month-table-cell-trigger.svelte +2 -3
- package/dist/date-picker/month-table-cell.svelte +3 -4
- package/dist/date-picker/next-trigger.svelte +2 -3
- package/dist/date-picker/positioner.svelte +2 -2
- package/dist/date-picker/preset-trigger.svelte +2 -2
- package/dist/date-picker/prev-trigger.svelte +2 -3
- package/dist/date-picker/range-text.svelte +3 -3
- package/dist/date-picker/root.svelte +7 -5
- package/dist/date-picker/table-body.svelte +2 -3
- package/dist/date-picker/table-head.svelte +2 -3
- package/dist/date-picker/table-header.svelte +2 -3
- package/dist/date-picker/table-row.svelte +2 -3
- package/dist/date-picker/table.svelte +2 -4
- package/dist/date-picker/trigger.svelte +2 -2
- package/dist/date-picker/view-control.svelte +2 -3
- package/dist/date-picker/view.svelte +2 -2
- package/dist/date-picker/year-select.svelte +2 -2
- package/dist/date-picker/year-table-cell-trigger.svelte +2 -3
- package/dist/date-picker/year-table-cell.svelte +3 -4
- package/dist/dialog/backdrop.svelte +2 -2
- package/dist/dialog/close-trigger.svelte +2 -2
- package/dist/dialog/content.svelte +2 -2
- package/dist/dialog/create-dialog.svelte.js +4 -4
- package/dist/dialog/description.svelte +2 -2
- package/dist/dialog/positioner.svelte +2 -2
- package/dist/dialog/root.svelte +4 -4
- package/dist/dialog/title.svelte +2 -2
- package/dist/dialog/trigger.svelte +2 -2
- package/dist/editable/area.svelte +2 -2
- package/dist/editable/cancel-trigger.svelte +2 -2
- package/dist/editable/control.svelte +2 -2
- package/dist/editable/create-editable.svelte.js +4 -4
- package/dist/editable/edit-trigger.svelte +2 -2
- package/dist/editable/input.svelte +2 -2
- package/dist/editable/label.svelte +2 -2
- package/dist/editable/preview.svelte +3 -3
- package/dist/editable/root.svelte +4 -4
- package/dist/editable/submit-trigger.svelte +2 -2
- package/dist/environment-provider/root.svelte +2 -2
- package/dist/file-upload/context.svelte.d.ts +5 -8
- package/dist/file-upload/context.svelte.js +3 -14
- package/dist/file-upload/create-file-upload.svelte.d.ts +7 -0
- package/dist/file-upload/create-file-upload.svelte.js +18 -0
- package/dist/file-upload/dropzone.svelte +19 -2
- package/dist/file-upload/dropzone.svelte.d.ts +3 -3
- package/dist/file-upload/hidden-input.svelte +17 -2
- package/dist/file-upload/hidden-input.svelte.d.ts +3 -3
- package/dist/file-upload/index.d.ts +13 -0
- package/dist/file-upload/index.js +1 -0
- package/dist/file-upload/item-delete-trigger.svelte +20 -2
- package/dist/file-upload/item-delete-trigger.svelte.d.ts +3 -3
- package/dist/file-upload/item-group.svelte +19 -2
- package/dist/file-upload/item-group.svelte.d.ts +3 -3
- package/dist/file-upload/item-name.svelte +24 -2
- package/dist/file-upload/item-name.svelte.d.ts +3 -3
- package/dist/file-upload/item-preview-image.svelte +26 -2
- package/dist/file-upload/item-preview-image.svelte.d.ts +3 -3
- package/dist/file-upload/item-preview.svelte +20 -2
- package/dist/file-upload/item-preview.svelte.d.ts +3 -3
- package/dist/file-upload/item-size-text.svelte +24 -2
- package/dist/file-upload/item-size-text.svelte.d.ts +3 -3
- package/dist/file-upload/item.svelte +25 -2
- package/dist/file-upload/item.svelte.d.ts +3 -3
- package/dist/file-upload/label.svelte +19 -2
- package/dist/file-upload/label.svelte.d.ts +3 -3
- package/dist/file-upload/root.svelte +67 -2
- package/dist/file-upload/root.svelte.d.ts +3 -3
- package/dist/file-upload/trigger.svelte +19 -2
- package/dist/file-upload/trigger.svelte.d.ts +3 -3
- package/dist/hover-card/arrow-tip.svelte +2 -2
- package/dist/hover-card/arrow.svelte +2 -2
- package/dist/hover-card/content.svelte +2 -2
- package/dist/hover-card/create-hover-card.svelte.js +4 -4
- package/dist/hover-card/positioner.svelte +2 -2
- package/dist/hover-card/root.svelte +4 -4
- package/dist/hover-card/trigger.svelte +2 -2
- package/dist/locale-provider/root.svelte +2 -2
- package/dist/menu/arrow-tip.svelte +2 -2
- package/dist/menu/arrow.svelte +2 -2
- package/dist/menu/context-trigger.svelte +2 -2
- package/dist/menu/create-menu.svelte.js +4 -4
- package/dist/menu/indicator.svelte +2 -2
- package/dist/menu/item-group-label.svelte +2 -3
- package/dist/menu/item-group.svelte +2 -2
- package/dist/menu/item.svelte +3 -4
- package/dist/menu/option-item-indicator.svelte +2 -3
- package/dist/menu/option-item-text.svelte +2 -3
- package/dist/menu/option-item.svelte +3 -4
- package/dist/menu/positioner.svelte +2 -2
- package/dist/menu/root.svelte +4 -4
- package/dist/menu/separator.svelte +2 -2
- package/dist/menu/trigger-item.svelte +2 -2
- package/dist/menu/trigger.svelte +2 -2
- package/dist/number-input/control.svelte +2 -2
- package/dist/number-input/create-number-input.svelte.d.ts +1 -1
- package/dist/number-input/create-number-input.svelte.js +5 -5
- package/dist/number-input/decrement-trigger.svelte +2 -2
- package/dist/number-input/increment-trigger.svelte +2 -2
- package/dist/number-input/input.svelte +2 -2
- package/dist/number-input/label.svelte +2 -2
- package/dist/number-input/root.svelte +7 -5
- package/dist/number-input/scrubber.svelte +2 -2
- package/dist/pagination/create-pagination.svelte.js +4 -4
- package/dist/pagination/ellipsis.svelte +2 -2
- package/dist/pagination/item.svelte +2 -2
- package/dist/pagination/next-trigger.svelte +2 -2
- package/dist/pagination/prev-trigger.svelte +2 -2
- package/dist/pagination/root.svelte +5 -5
- package/dist/pin-input/clear-trigger.svelte +2 -2
- package/dist/pin-input/create-pin-input.svelte.js +4 -4
- package/dist/pin-input/hidden-input.svelte +2 -2
- package/dist/pin-input/input.svelte +2 -2
- package/dist/pin-input/label.svelte +2 -2
- package/dist/pin-input/root.svelte +5 -5
- package/dist/popover/arrow-tip.svelte +2 -2
- package/dist/popover/arrow.svelte +2 -2
- package/dist/popover/close-trigger.svelte +2 -2
- package/dist/popover/content.svelte +2 -2
- package/dist/popover/create-popover.svelte.js +4 -4
- package/dist/popover/description.svelte +2 -2
- package/dist/popover/positioner.svelte +2 -2
- package/dist/popover/root.svelte +4 -4
- package/dist/popover/title.svelte +2 -2
- package/dist/popover/trigger.svelte +2 -2
- package/dist/portal/root.svelte +2 -4
- package/dist/presence/create-presence.svelte.d.ts +10 -0
- package/dist/presence/create-presence.svelte.js +19 -0
- package/dist/presence/root.svelte +11 -20
- package/dist/progress/circle-range.svelte +2 -2
- package/dist/progress/circle-track.svelte +2 -2
- package/dist/progress/circle.svelte +2 -2
- package/dist/progress/create-progress.svelte.js +4 -4
- package/dist/progress/label.svelte +2 -2
- package/dist/progress/range.svelte +2 -2
- package/dist/progress/root.svelte +5 -5
- package/dist/progress/track.svelte +2 -2
- package/dist/progress/value-text.svelte +3 -3
- package/dist/qr-code/create-qr-code.svelte.js +4 -4
- package/dist/qr-code/frame.svelte +2 -2
- package/dist/qr-code/overlay.svelte +2 -2
- package/dist/qr-code/pattern.svelte +2 -2
- package/dist/qr-code/root.svelte +5 -5
- package/dist/radio-group/create-radio-group.svelte.js +4 -4
- package/dist/radio-group/indicator.svelte +2 -2
- package/dist/radio-group/item-control.svelte +2 -3
- package/dist/radio-group/item-hidden-input.svelte +2 -3
- package/dist/radio-group/item-text.svelte +2 -3
- package/dist/radio-group/item.svelte +3 -4
- package/dist/radio-group/label.svelte +2 -2
- package/dist/radio-group/root.svelte +5 -5
- package/dist/rating-group/control.svelte +2 -2
- package/dist/rating-group/create-rating-group.svelte.js +4 -4
- package/dist/rating-group/hidden-input.svelte +2 -2
- package/dist/rating-group/item.svelte +3 -4
- package/dist/rating-group/label.svelte +2 -2
- package/dist/rating-group/root.svelte +5 -5
- package/dist/segment-group/create-segment-group.svelte.js +4 -4
- package/dist/segment-group/indicator.svelte +2 -2
- package/dist/segment-group/item-control.svelte +2 -3
- package/dist/segment-group/item-hidden-input.svelte +2 -3
- package/dist/segment-group/item-text.svelte +2 -3
- package/dist/segment-group/item.svelte +3 -4
- package/dist/segment-group/label.svelte +2 -2
- package/dist/segment-group/root.svelte +5 -5
- package/dist/select/clear-trigger.svelte +2 -2
- package/dist/select/content.svelte +2 -2
- package/dist/select/control.svelte +2 -2
- package/dist/select/create-select.svelte.js +4 -4
- package/dist/select/hidden-select.svelte +2 -2
- package/dist/select/indicator.svelte +2 -2
- package/dist/select/item-group-label.svelte +2 -3
- package/dist/select/item-group.svelte +2 -2
- package/dist/select/item-indicator.svelte +2 -3
- package/dist/select/item-text.svelte +3 -4
- package/dist/select/item.svelte +3 -4
- package/dist/select/label.svelte +2 -2
- package/dist/select/list.svelte +2 -2
- package/dist/select/positioner.svelte +2 -2
- package/dist/select/root.svelte +5 -5
- package/dist/select/trigger.svelte +2 -2
- package/dist/select/value-text.svelte +4 -4
- package/dist/slider/control.svelte +2 -2
- package/dist/slider/create-slider.svelte.js +4 -4
- package/dist/slider/hidden-input.svelte +2 -3
- package/dist/slider/label.svelte +2 -2
- package/dist/slider/marker-group.svelte +2 -2
- package/dist/slider/marker.svelte +2 -2
- package/dist/slider/range.svelte +2 -2
- package/dist/slider/root.svelte +5 -5
- package/dist/slider/thumb.svelte +2 -3
- package/dist/slider/track.svelte +2 -2
- package/dist/slider/value-text.svelte +3 -3
- package/dist/steps/content.svelte +2 -2
- package/dist/steps/create-steps.svelte.js +4 -4
- package/dist/steps/indicator.svelte +2 -3
- package/dist/steps/item.svelte +3 -4
- package/dist/steps/list.svelte +2 -2
- package/dist/steps/next-trigger.svelte +2 -2
- package/dist/steps/prev-trigger.svelte +2 -2
- package/dist/steps/progress.svelte +2 -2
- package/dist/steps/root.svelte +5 -5
- package/dist/steps/separator.svelte +2 -3
- package/dist/steps/trigger.svelte +2 -3
- package/dist/switch/control.svelte +2 -2
- package/dist/switch/create-switch.svelte.js +4 -4
- package/dist/switch/hidden-input.svelte +2 -2
- package/dist/switch/label.svelte +2 -2
- package/dist/switch/root.svelte +5 -5
- package/dist/switch/thumb.svelte +2 -2
- package/dist/tabs/content.svelte +2 -2
- package/dist/tabs/create-tabs.svelte.js +4 -4
- package/dist/tabs/list.svelte +2 -2
- package/dist/tabs/root.svelte +5 -5
- package/dist/tabs/trigger.svelte +2 -2
- package/dist/tags-input/clear-trigger.svelte +2 -2
- package/dist/tags-input/control.svelte +2 -2
- package/dist/tags-input/create-tags-input.svelte.js +4 -4
- package/dist/tags-input/hidden-input.svelte +2 -2
- package/dist/tags-input/input.svelte +2 -2
- package/dist/tags-input/item-delete-trigger.svelte +2 -3
- package/dist/tags-input/item-input.svelte +2 -3
- package/dist/tags-input/item-preview.svelte +2 -3
- package/dist/tags-input/item-text.svelte +2 -3
- package/dist/tags-input/item.svelte +3 -4
- package/dist/tags-input/label.svelte +2 -2
- package/dist/tags-input/root.svelte +5 -5
- package/dist/timer/action-trigger.svelte +2 -2
- package/dist/timer/create-timer.svelte.js +2 -2
- package/dist/timer/item-label.svelte +2 -3
- package/dist/timer/item-value.svelte +3 -4
- package/dist/timer/item.svelte +2 -3
- package/dist/timer/root.svelte +5 -5
- package/dist/timer/separator.svelte +2 -2
- package/dist/toast/create-toaster.svelte.js +4 -4
- package/dist/toggle-group/create-toggle-group.svelte.js +4 -4
- package/dist/toggle-group/item.svelte +3 -4
- package/dist/toggle-group/root.svelte +4 -4
- package/dist/tooltip/arrow-tip.svelte +2 -2
- package/dist/tooltip/arrow.svelte +2 -2
- package/dist/tooltip/content.svelte +2 -2
- package/dist/tooltip/create-tooltip.svelte.js +4 -4
- package/dist/tooltip/positioner.svelte +2 -2
- package/dist/tooltip/root.svelte +4 -4
- package/dist/tooltip/trigger.svelte +2 -2
- package/package.json +2 -1
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: PopoverTriggerProps = $props();
|
12
12
|
|
13
|
-
let
|
13
|
+
let popover = popoverContext.get();
|
14
14
|
|
15
|
-
let attrs = $derived(mergeProps(props,
|
15
|
+
let attrs = $derived(mergeProps(props, popover.getTriggerProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<button type="button" {...attrs}>
|
package/dist/portal/root.svelte
CHANGED
@@ -14,17 +14,15 @@
|
|
14
14
|
|
15
15
|
let {container, disabled, children}: PortalProps = $props();
|
16
16
|
|
17
|
-
let
|
17
|
+
let environment = getEnvironmentContext();
|
18
18
|
</script>
|
19
19
|
|
20
20
|
<div
|
21
21
|
use:portal={{
|
22
22
|
disabled,
|
23
23
|
container,
|
24
|
-
getRootNode:
|
24
|
+
getRootNode: environment?.getRootNode,
|
25
25
|
}}
|
26
|
-
data-scope="portal"
|
27
|
-
data-part="root"
|
28
26
|
>
|
29
27
|
{@render children?.()}
|
30
28
|
</div>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import * as presence from '@zag-js/presence';
|
2
|
+
export interface CreatePresenceProps extends presence.Context {
|
3
|
+
}
|
4
|
+
export declare function createPresence(props: CreatePresenceProps): {
|
5
|
+
ref: (node: HTMLElement) => void;
|
6
|
+
getRootProps: () => {
|
7
|
+
hidden: boolean;
|
8
|
+
'data-state': string;
|
9
|
+
};
|
10
|
+
};
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import * as presence from '@zag-js/presence';
|
2
|
+
import { normalizeProps, useMachine } from '@zag-js/svelte';
|
3
|
+
export function createPresence(props) {
|
4
|
+
const [state, send] = useMachine(presence.machine(props));
|
5
|
+
const api = $derived(presence.connect(state, send, normalizeProps));
|
6
|
+
function ref(node) {
|
7
|
+
api.setNode(node);
|
8
|
+
}
|
9
|
+
function getRootProps() {
|
10
|
+
return {
|
11
|
+
hidden: !api.present,
|
12
|
+
'data-state': api.present ? 'open' : 'closed',
|
13
|
+
};
|
14
|
+
}
|
15
|
+
return {
|
16
|
+
ref,
|
17
|
+
getRootProps,
|
18
|
+
};
|
19
|
+
}
|
@@ -1,13 +1,13 @@
|
|
1
1
|
<script lang="ts" module>
|
2
2
|
import type {Assign, HtmlProps} from '../types.js';
|
3
|
-
import type {
|
3
|
+
import type {CreatePresenceProps} from './create-presence.svelte.js';
|
4
4
|
|
5
|
-
export interface PresenceProps extends Assign<HtmlProps<'div'>,
|
5
|
+
export interface PresenceProps extends Assign<HtmlProps<'div'>, CreatePresenceProps> {}
|
6
6
|
</script>
|
7
7
|
|
8
8
|
<script lang="ts">
|
9
|
-
import
|
10
|
-
import {
|
9
|
+
import {mergeProps} from '@zag-js/svelte';
|
10
|
+
import {createPresence} from './create-presence.svelte.js';
|
11
11
|
|
12
12
|
let {
|
13
13
|
/**/
|
@@ -18,24 +18,15 @@
|
|
18
18
|
...props
|
19
19
|
}: PresenceProps = $props();
|
20
20
|
|
21
|
-
let
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
}),
|
27
|
-
);
|
21
|
+
let presence = createPresence({
|
22
|
+
present,
|
23
|
+
immediate,
|
24
|
+
onExitComplete,
|
25
|
+
});
|
28
26
|
|
29
|
-
let
|
27
|
+
let attrs = $derived(mergeProps(props, presence.getRootProps()));
|
30
28
|
</script>
|
31
29
|
|
32
|
-
<div
|
33
|
-
use:api.setNode
|
34
|
-
hidden={!api.present}
|
35
|
-
data-scope="presence"
|
36
|
-
data-part="root"
|
37
|
-
data-state={api.skip ? undefined : present ? 'open' : 'closed'}
|
38
|
-
{...props}
|
39
|
-
>
|
30
|
+
<div use:presence.ref {...attrs}>
|
40
31
|
{@render children?.()}
|
41
32
|
</div>
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: ProgressCircleRangeProps = $props();
|
12
12
|
|
13
|
-
let
|
13
|
+
let progress = progressContext.get();
|
14
14
|
|
15
|
-
let attrs = $derived(mergeProps(props,
|
15
|
+
let attrs = $derived(mergeProps(props, progress.getCircleRangeProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<circle {...attrs}>
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: ProgressCircleTrackProps = $props();
|
12
12
|
|
13
|
-
let
|
13
|
+
let progress = progressContext.get();
|
14
14
|
|
15
|
-
let attrs = $derived(mergeProps(props,
|
15
|
+
let attrs = $derived(mergeProps(props, progress.getCircleTrackProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<circle {...attrs}>
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: ProgressCircleProps = $props();
|
12
12
|
|
13
|
-
let
|
13
|
+
let progress = progressContext.get();
|
14
14
|
|
15
|
-
let attrs = $derived(mergeProps(props,
|
15
|
+
let attrs = $derived(mergeProps(props, progress.getCircleProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<svg {...attrs}>
|
@@ -4,13 +4,13 @@ import { createUniqueId } from '../utils.svelte.js';
|
|
4
4
|
import * as progress from '@zag-js/progress';
|
5
5
|
import { normalizeProps, reflect, useMachine } from '@zag-js/svelte';
|
6
6
|
export function createProgress(props) {
|
7
|
-
const
|
8
|
-
const
|
7
|
+
const locale = getLocaleContext();
|
8
|
+
const environment = getEnvironmentContext();
|
9
9
|
const [state, send] = useMachine(progress.machine({
|
10
10
|
...props,
|
11
11
|
id: props.id ?? createUniqueId(),
|
12
|
-
dir:
|
13
|
-
getRootNode:
|
12
|
+
dir: locale?.dir,
|
13
|
+
getRootNode: environment?.getRootNode,
|
14
14
|
}));
|
15
15
|
const api = $derived(reflect(() => progress.connect(state, send, normalizeProps)));
|
16
16
|
return api;
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: ProgressLabelProps = $props();
|
12
12
|
|
13
|
-
let
|
13
|
+
let progress = progressContext.get();
|
14
14
|
|
15
|
-
let attrs = $derived(mergeProps(props,
|
15
|
+
let attrs = $derived(mergeProps(props, progress.getLabelProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<div {...attrs}>
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: ProgressRangeProps = $props();
|
12
12
|
|
13
|
-
let
|
13
|
+
let progress = progressContext.get();
|
14
14
|
|
15
|
-
let attrs = $derived(mergeProps(props,
|
15
|
+
let attrs = $derived(mergeProps(props, progress.getRangeProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<div {...attrs}>
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
export interface ProgressProps
|
7
7
|
extends Assign<Omit<HtmlProps<'div'>, 'children'>, CreateProgressProps> {
|
8
|
-
children?: Snippet<[
|
8
|
+
children?: Snippet<[progress: CreateProgressReturn]>;
|
9
9
|
}
|
10
10
|
</script>
|
11
11
|
|
@@ -27,7 +27,7 @@
|
|
27
27
|
...props
|
28
28
|
}: ProgressProps = $props();
|
29
29
|
|
30
|
-
let
|
30
|
+
let progress = createProgress({
|
31
31
|
id,
|
32
32
|
ids,
|
33
33
|
max,
|
@@ -37,11 +37,11 @@
|
|
37
37
|
translations,
|
38
38
|
});
|
39
39
|
|
40
|
-
let attrs = $derived(mergeProps(props,
|
40
|
+
let attrs = $derived(mergeProps(props, progress.getRootProps()));
|
41
41
|
|
42
|
-
progressContext.set(
|
42
|
+
progressContext.set(progress);
|
43
43
|
</script>
|
44
44
|
|
45
45
|
<div {...attrs}>
|
46
|
-
{@render children?.(
|
46
|
+
{@render children?.(progress)}
|
47
47
|
</div>
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: ProgressTrackProps = $props();
|
12
12
|
|
13
|
-
let
|
13
|
+
let progress = progressContext.get();
|
14
14
|
|
15
|
-
let attrs = $derived(mergeProps(props,
|
15
|
+
let attrs = $derived(mergeProps(props, progress.getTrackProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<div {...attrs}>
|
@@ -10,15 +10,15 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: ProgressValueTextProps = $props();
|
12
12
|
|
13
|
-
let
|
13
|
+
let progress = progressContext.get();
|
14
14
|
|
15
|
-
let attrs = $derived(mergeProps(props,
|
15
|
+
let attrs = $derived(mergeProps(props, progress.getValueTextProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<div {...attrs}>
|
19
19
|
{#if children}
|
20
20
|
{@render children()}
|
21
21
|
{:else}
|
22
|
-
{
|
22
|
+
{progress.percentAsString}
|
23
23
|
{/if}
|
24
24
|
</div>
|
@@ -4,13 +4,13 @@ import { createUniqueId } from '../utils.svelte.js';
|
|
4
4
|
import * as qrCode from '@zag-js/qr-code';
|
5
5
|
import { normalizeProps, reflect, useMachine } from '@zag-js/svelte';
|
6
6
|
export function createQRCode(props) {
|
7
|
-
const
|
8
|
-
const
|
7
|
+
const locale = getLocaleContext();
|
8
|
+
const environment = getEnvironmentContext();
|
9
9
|
const [state, send] = useMachine(qrCode.machine({
|
10
10
|
...props,
|
11
11
|
id: props.id ?? createUniqueId(),
|
12
|
-
dir:
|
13
|
-
getRootNode:
|
12
|
+
dir: locale?.dir,
|
13
|
+
getRootNode: environment?.getRootNode,
|
14
14
|
}));
|
15
15
|
const api = $derived(reflect(() => qrCode.connect(state, send, normalizeProps)));
|
16
16
|
return api;
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: QRCodeFrameProps = $props();
|
12
12
|
|
13
|
-
let
|
13
|
+
let qrCode = qrCodeContext.get();
|
14
14
|
|
15
|
-
let attrs = $derived(mergeProps(props,
|
15
|
+
let attrs = $derived(mergeProps(props, qrCode.getFrameProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<svg {...attrs}>
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: QRCodeOverlayProps = $props();
|
12
12
|
|
13
|
-
let
|
13
|
+
let qrCode = qrCodeContext.get();
|
14
14
|
|
15
|
-
let attrs = $derived(mergeProps(props,
|
15
|
+
let attrs = $derived(mergeProps(props, qrCode.getOverlayProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<div {...attrs}>
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: QRCodePatternProps = $props();
|
12
12
|
|
13
|
-
let
|
13
|
+
let qrCode = qrCodeContext.get();
|
14
14
|
|
15
|
-
let attrs = $derived(mergeProps(props,
|
15
|
+
let attrs = $derived(mergeProps(props, qrCode.getPatternProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<path {...attrs}>
|
package/dist/qr-code/root.svelte
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
export interface QRCodeProps
|
7
7
|
extends Assign<Omit<HtmlProps<'div'>, 'children'>, CreateQRCodeProps> {
|
8
|
-
children?: Snippet<[
|
8
|
+
children?: Snippet<[qrCode: CreateQRCodeReturn]>;
|
9
9
|
}
|
10
10
|
</script>
|
11
11
|
|
@@ -24,18 +24,18 @@
|
|
24
24
|
...props
|
25
25
|
}: QRCodeProps = $props();
|
26
26
|
|
27
|
-
let
|
27
|
+
let qrCode = createQRCode({
|
28
28
|
id,
|
29
29
|
ids,
|
30
30
|
value: $state.snapshot(value),
|
31
31
|
encoding,
|
32
32
|
});
|
33
33
|
|
34
|
-
let attrs = $derived(mergeProps(props,
|
34
|
+
let attrs = $derived(mergeProps(props, qrCode.getRootProps()));
|
35
35
|
|
36
|
-
qrCodeContext.set(
|
36
|
+
qrCodeContext.set(qrCode);
|
37
37
|
</script>
|
38
38
|
|
39
39
|
<div {...attrs}>
|
40
|
-
{@render children?.(
|
40
|
+
{@render children?.(qrCode)}
|
41
41
|
</div>
|
@@ -4,13 +4,13 @@ import { createUniqueId } from '../utils.svelte.js';
|
|
4
4
|
import * as radioGroup from '@zag-js/radio-group';
|
5
5
|
import { normalizeProps, reflect, useMachine } from '@zag-js/svelte';
|
6
6
|
export function createRadioGroup(props) {
|
7
|
-
const
|
8
|
-
const
|
7
|
+
const locale = getLocaleContext();
|
8
|
+
const environment = getEnvironmentContext();
|
9
9
|
const [state, send] = useMachine(radioGroup.machine({
|
10
10
|
...props,
|
11
11
|
id: props.id ?? createUniqueId(),
|
12
|
-
dir:
|
13
|
-
getRootNode:
|
12
|
+
dir: locale?.dir,
|
13
|
+
getRootNode: environment?.getRootNode,
|
14
14
|
}));
|
15
15
|
const api = $derived(reflect(() => radioGroup.connect(state, send, normalizeProps)));
|
16
16
|
return api;
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: RadioGroupIndicatorProps = $props();
|
12
12
|
|
13
|
-
let
|
13
|
+
let radioGroup = radioGroupContext.get();
|
14
14
|
|
15
|
-
let attrs = $derived(mergeProps(props,
|
15
|
+
let attrs = $derived(mergeProps(props, radioGroup.getIndicatorProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<span {...attrs}>
|
@@ -10,11 +10,10 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: RadioGroupItemControlProps = $props();
|
12
12
|
|
13
|
-
let
|
14
|
-
|
13
|
+
let radioGroup = radioGroupContext.get();
|
15
14
|
let itemProps = radioGroupItemPropsContext.get();
|
16
15
|
|
17
|
-
let attrs = $derived(mergeProps(props,
|
16
|
+
let attrs = $derived(mergeProps(props, radioGroup.getItemControlProps(itemProps)));
|
18
17
|
</script>
|
19
18
|
|
20
19
|
<div {...attrs}>
|
@@ -10,11 +10,10 @@
|
|
10
10
|
|
11
11
|
let {...props}: RadioGroupItemHiddenInputProps = $props();
|
12
12
|
|
13
|
-
let
|
14
|
-
|
13
|
+
let radioGroup = radioGroupContext.get();
|
15
14
|
let itemProps = radioGroupItemPropsContext.get();
|
16
15
|
|
17
|
-
let attrs = $derived(mergeProps(props,
|
16
|
+
let attrs = $derived(mergeProps(props, radioGroup.getItemHiddenInputProps(itemProps)));
|
18
17
|
</script>
|
19
18
|
|
20
19
|
<input {...attrs} />
|
@@ -10,11 +10,10 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: RadioGroupItemTextProps = $props();
|
12
12
|
|
13
|
-
let
|
14
|
-
|
13
|
+
let radioGroup = radioGroupContext.get();
|
15
14
|
let itemProps = radioGroupItemPropsContext.get();
|
16
15
|
|
17
|
-
let attrs = $derived(mergeProps(props,
|
16
|
+
let attrs = $derived(mergeProps(props, radioGroup.getItemTextProps(itemProps)));
|
18
17
|
</script>
|
19
18
|
|
20
19
|
<span {...attrs}>
|
@@ -22,16 +22,15 @@
|
|
22
22
|
...props
|
23
23
|
}: RadioGroupItemProps = $props();
|
24
24
|
|
25
|
-
let
|
26
|
-
|
25
|
+
let radioGroup = radioGroupContext.get();
|
27
26
|
let itemProps = $derived({
|
28
27
|
value,
|
29
28
|
invalid,
|
30
29
|
disabled,
|
31
30
|
});
|
32
31
|
|
33
|
-
let state = $derived(
|
34
|
-
let attrs = $derived(mergeProps(props,
|
32
|
+
let state = $derived(radioGroup.getItemState(itemProps));
|
33
|
+
let attrs = $derived(mergeProps(props, radioGroup.getItemProps(itemProps)));
|
35
34
|
|
36
35
|
radioGroupItemPropsContext.set(() => itemProps);
|
37
36
|
</script>
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: RadioGroupLabelProps = $props();
|
12
12
|
|
13
|
-
let
|
13
|
+
let radioGroup = radioGroupContext.get();
|
14
14
|
|
15
|
-
let attrs = $derived(mergeProps(props,
|
15
|
+
let attrs = $derived(mergeProps(props, radioGroup.getLabelProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<span {...attrs}>
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
export interface RadioGroupProps
|
7
7
|
extends Assign<Omit<HtmlProps<'div'>, 'children'>, CreateRadioGroupProps> {
|
8
|
-
children?: Snippet<[
|
8
|
+
children?: Snippet<[radioGroup: CreateRadioGroupReturn]>;
|
9
9
|
}
|
10
10
|
</script>
|
11
11
|
|
@@ -28,7 +28,7 @@
|
|
28
28
|
...props
|
29
29
|
}: RadioGroupProps = $props();
|
30
30
|
|
31
|
-
let
|
31
|
+
let radioGroup = createRadioGroup({
|
32
32
|
id,
|
33
33
|
ids,
|
34
34
|
form,
|
@@ -40,11 +40,11 @@
|
|
40
40
|
onValueChange,
|
41
41
|
});
|
42
42
|
|
43
|
-
let attrs = $derived(mergeProps(props,
|
43
|
+
let attrs = $derived(mergeProps(props, radioGroup.getRootProps()));
|
44
44
|
|
45
|
-
radioGroupContext.set(
|
45
|
+
radioGroupContext.set(radioGroup);
|
46
46
|
</script>
|
47
47
|
|
48
48
|
<div {...attrs}>
|
49
|
-
{@render children?.(
|
49
|
+
{@render children?.(radioGroup)}
|
50
50
|
</div>
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: RatingGroupControlProps = $props();
|
12
12
|
|
13
|
-
let
|
13
|
+
let radioGroup = ratingGroupContext.get();
|
14
14
|
|
15
|
-
let attrs = $derived(mergeProps(props,
|
15
|
+
let attrs = $derived(mergeProps(props, radioGroup.getControlProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<div {...attrs}>
|
@@ -4,13 +4,13 @@ import { createUniqueId } from '../utils.svelte.js';
|
|
4
4
|
import * as ratingGroup from '@zag-js/rating-group';
|
5
5
|
import { normalizeProps, reflect, useMachine } from '@zag-js/svelte';
|
6
6
|
export function createRatingGroup(props) {
|
7
|
-
const
|
8
|
-
const
|
7
|
+
const locale = getLocaleContext();
|
8
|
+
const environment = getEnvironmentContext();
|
9
9
|
const [state, send] = useMachine(ratingGroup.machine({
|
10
10
|
...props,
|
11
11
|
id: props.id ?? createUniqueId(),
|
12
|
-
dir:
|
13
|
-
getRootNode:
|
12
|
+
dir: locale?.dir,
|
13
|
+
getRootNode: environment?.getRootNode,
|
14
14
|
}));
|
15
15
|
const api = $derived(reflect(() => ratingGroup.connect(state, send, normalizeProps)));
|
16
16
|
return api;
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {...props}: RatingGroupHiddenInputProps = $props();
|
12
12
|
|
13
|
-
let
|
13
|
+
let radioGroup = ratingGroupContext.get();
|
14
14
|
|
15
|
-
let attrs = $derived(mergeProps(props,
|
15
|
+
let attrs = $derived(mergeProps(props, radioGroup.getHiddenInputProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<input {...attrs} />
|
@@ -15,11 +15,10 @@
|
|
15
15
|
|
16
16
|
let {index, children, ...props}: RatingGroupItemProps = $props();
|
17
17
|
|
18
|
-
let
|
18
|
+
let radioGroup = ratingGroupContext.get();
|
19
19
|
|
20
|
-
let state = $derived(
|
21
|
-
|
22
|
-
let attrs = $derived(mergeProps(props, context.getItemProps({index})));
|
20
|
+
let state = $derived(radioGroup.getItemState({index}));
|
21
|
+
let attrs = $derived(mergeProps(props, radioGroup.getItemProps({index})));
|
23
22
|
</script>
|
24
23
|
|
25
24
|
<div {...attrs}>
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: RatingGroupLabelProps = $props();
|
12
12
|
|
13
|
-
let
|
13
|
+
let radioGroup = ratingGroupContext.get();
|
14
14
|
|
15
|
-
let attrs = $derived(mergeProps(props,
|
15
|
+
let attrs = $derived(mergeProps(props, radioGroup.getLabelProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<label {...attrs}>
|
@@ -8,7 +8,7 @@
|
|
8
8
|
|
9
9
|
export interface RatingGroupProps
|
10
10
|
extends Assign<Omit<HtmlProps<'div'>, 'children'>, CreateRatingGroupProps> {
|
11
|
-
children?: Snippet<[
|
11
|
+
children?: Snippet<[radioGroup: CreateRatingGroupReturn]>;
|
12
12
|
}
|
13
13
|
</script>
|
14
14
|
|
@@ -36,7 +36,7 @@
|
|
36
36
|
...props
|
37
37
|
}: RatingGroupProps = $props();
|
38
38
|
|
39
|
-
let
|
39
|
+
let radioGroup = createRatingGroup({
|
40
40
|
id,
|
41
41
|
ids,
|
42
42
|
form,
|
@@ -53,11 +53,11 @@
|
|
53
53
|
onValueChange,
|
54
54
|
});
|
55
55
|
|
56
|
-
let attrs = $derived(mergeProps(props,
|
56
|
+
let attrs = $derived(mergeProps(props, radioGroup.getRootProps()));
|
57
57
|
|
58
|
-
ratingGroupContext.set(
|
58
|
+
ratingGroupContext.set(radioGroup);
|
59
59
|
</script>
|
60
60
|
|
61
61
|
<div {...attrs}>
|
62
|
-
{@render children?.(
|
62
|
+
{@render children?.(radioGroup)}
|
63
63
|
</div>
|
@@ -4,13 +4,13 @@ import { createUniqueId } from '../utils.svelte.js';
|
|
4
4
|
import * as segmentGroup from '@zag-js/radio-group';
|
5
5
|
import { normalizeProps, reflect, useMachine } from '@zag-js/svelte';
|
6
6
|
export function createSegmentGroup(props) {
|
7
|
-
const
|
8
|
-
const
|
7
|
+
const locale = getLocaleContext();
|
8
|
+
const environment = getEnvironmentContext();
|
9
9
|
const [state, send] = useMachine(segmentGroup.machine({
|
10
10
|
...props,
|
11
11
|
id: props.id ?? createUniqueId(),
|
12
|
-
dir:
|
13
|
-
getRootNode:
|
12
|
+
dir: locale?.dir,
|
13
|
+
getRootNode: environment?.getRootNode,
|
14
14
|
}));
|
15
15
|
const api = $derived(reflect(() => segmentGroup.connect(state, send, normalizeProps)));
|
16
16
|
return api;
|
@@ -12,9 +12,9 @@
|
|
12
12
|
|
13
13
|
let {children, ...props}: SegmentGroupIndicatorProps = $props();
|
14
14
|
|
15
|
-
let
|
15
|
+
let segmentGroup = segmentGroupContext.get();
|
16
16
|
|
17
|
-
let attrs = $derived(mergeProps(props,
|
17
|
+
let attrs = $derived(mergeProps(props, segmentGroup.getIndicatorProps(), parts.indicator.attrs));
|
18
18
|
</script>
|
19
19
|
|
20
20
|
<span {...ensureStyleIsString(attrs)}>
|
@@ -12,12 +12,11 @@
|
|
12
12
|
|
13
13
|
let {children, ...props}: SegmentGroupItemControlProps = $props();
|
14
14
|
|
15
|
-
let
|
16
|
-
|
15
|
+
let segmentGroup = segmentGroupContext.get();
|
17
16
|
let itemProps = segmentGroupItemPropsContext.get();
|
18
17
|
|
19
18
|
let attrs = $derived(
|
20
|
-
mergeProps(props,
|
19
|
+
mergeProps(props, segmentGroup.getItemControlProps(itemProps), parts.itemControl.attrs),
|
21
20
|
);
|
22
21
|
</script>
|
23
22
|
|