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
package/dist/menu/item.svelte
CHANGED
@@ -14,8 +14,7 @@
|
|
14
14
|
|
15
15
|
let {value, valueText, disabled, closeOnSelect, children, ...props}: MenuItemProps = $props();
|
16
16
|
|
17
|
-
let
|
18
|
-
|
17
|
+
let menu = menuContext.get();
|
19
18
|
let itemProps = $derived({
|
20
19
|
value,
|
21
20
|
valueText,
|
@@ -23,8 +22,8 @@
|
|
23
22
|
closeOnSelect,
|
24
23
|
});
|
25
24
|
|
26
|
-
let state = $derived(
|
27
|
-
let attrs = $derived(mergeProps(props,
|
25
|
+
let state = $derived(menu.getItemState(itemProps));
|
26
|
+
let attrs = $derived(mergeProps(props, menu.getItemProps(itemProps)));
|
28
27
|
</script>
|
29
28
|
|
30
29
|
<div {...attrs}>
|
@@ -10,11 +10,10 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: MenuOptionItemIndicatorProps = $props();
|
12
12
|
|
13
|
-
let
|
14
|
-
|
13
|
+
let menu = menuContext.get();
|
15
14
|
let optionItemProps = menuOptionItemPropsContext.get();
|
16
15
|
|
17
|
-
let attrs = $derived(mergeProps(props,
|
16
|
+
let attrs = $derived(mergeProps(props, menu.getItemIndicatorProps(optionItemProps)));
|
18
17
|
</script>
|
19
18
|
|
20
19
|
<span {...attrs}>
|
@@ -10,11 +10,10 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: MenuOptionItemTextProps = $props();
|
12
12
|
|
13
|
-
let
|
14
|
-
|
13
|
+
let menu = menuContext.get();
|
15
14
|
let optionItemProps = menuOptionItemPropsContext.get();
|
16
15
|
|
17
|
-
let attrs = $derived(mergeProps(props,
|
16
|
+
let attrs = $derived(mergeProps(props, menu.getItemTextProps(optionItemProps)));
|
18
17
|
</script>
|
19
18
|
|
20
19
|
<span {...attrs}>
|
@@ -25,8 +25,7 @@
|
|
25
25
|
...props
|
26
26
|
}: MenuOptionItemProps = $props();
|
27
27
|
|
28
|
-
let
|
29
|
-
|
28
|
+
let menu = menuContext.get();
|
30
29
|
let itemProps: OptionItemProps = $derived({
|
31
30
|
type,
|
32
31
|
value,
|
@@ -37,8 +36,8 @@
|
|
37
36
|
onCheckedChange,
|
38
37
|
});
|
39
38
|
|
40
|
-
let state = $derived(
|
41
|
-
let attrs = $derived(mergeProps(props,
|
39
|
+
let state = $derived(menu.getOptionItemState(itemProps));
|
40
|
+
let attrs = $derived(mergeProps(props, menu.getOptionItemProps(itemProps)));
|
42
41
|
|
43
42
|
menuOptionItemPropsContext.set(() => itemProps);
|
44
43
|
</script>
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: MenuPositionerProps = $props();
|
12
12
|
|
13
|
-
let
|
13
|
+
let menu = menuContext.get();
|
14
14
|
|
15
|
-
let attrs = $derived(mergeProps(props,
|
15
|
+
let attrs = $derived(mergeProps(props, menu.getPositionerProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<div {...attrs}>
|
package/dist/menu/root.svelte
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
import {type CreateMenuProps, type CreateMenuReturn} from './create-menu.svelte.js';
|
4
4
|
|
5
5
|
export interface MenuRootProps extends CreateMenuProps {
|
6
|
-
children?: Snippet<[
|
6
|
+
children?: Snippet<[menu: CreateMenuReturn]>;
|
7
7
|
}
|
8
8
|
</script>
|
9
9
|
|
@@ -13,9 +13,9 @@
|
|
13
13
|
|
14
14
|
let {children, ...props}: MenuRootProps = $props();
|
15
15
|
|
16
|
-
let
|
16
|
+
let menu = createMenu(props);
|
17
17
|
|
18
|
-
menuContext.set(
|
18
|
+
menuContext.set(menu);
|
19
19
|
</script>
|
20
20
|
|
21
|
-
{@render children?.(
|
21
|
+
{@render children?.(menu)}
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: MenuSeparatorProps = $props();
|
12
12
|
|
13
|
-
let
|
13
|
+
let menu = menuContext.get();
|
14
14
|
|
15
|
-
let attrs = $derived(mergeProps(props,
|
15
|
+
let attrs = $derived(mergeProps(props, menu.getSeparatorProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<div {...attrs}>
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: MenuTriggerItemIndicatorProps = $props();
|
12
12
|
|
13
|
-
let
|
13
|
+
let menu = menuContext.get();
|
14
14
|
|
15
|
-
let attrs = $derived(mergeProps(props,
|
15
|
+
let attrs = $derived(mergeProps(props, menu.getTriggerItemProps(menu)));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<button type="button" {...attrs}>
|
package/dist/menu/trigger.svelte
CHANGED
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: MenuTriggerProps = $props();
|
12
12
|
|
13
|
-
let
|
13
|
+
let menu = menuContext.get();
|
14
14
|
|
15
|
-
let attrs = $derived(mergeProps(props,
|
15
|
+
let attrs = $derived(mergeProps(props, menu.getTriggerProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<button type="button" {...attrs}>
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: NumberInputControlTriggerProps = $props();
|
12
12
|
|
13
|
-
let
|
13
|
+
let numberInput = numberInputContext.get();
|
14
14
|
|
15
|
-
let attrs = $derived(mergeProps(props,
|
15
|
+
let attrs = $derived(mergeProps(props, numberInput.getControlProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<div {...attrs}>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import * as numberInput from '@zag-js/number-input';
|
2
|
-
export interface CreateNumberInputProps extends Omit<numberInput.Context, 'id' | 'dir' | '
|
2
|
+
export interface CreateNumberInputProps extends Omit<numberInput.Context, 'id' | 'dir' | 'getRootNode'> {
|
3
3
|
id?: string | null;
|
4
4
|
}
|
5
5
|
export interface CreateNumberInputReturn extends numberInput.Api {
|
@@ -4,14 +4,14 @@ import { createUniqueId } from '../utils.svelte.js';
|
|
4
4
|
import * as numberInput from '@zag-js/number-input';
|
5
5
|
import { normalizeProps, reflect, useMachine } from '@zag-js/svelte';
|
6
6
|
export function createNumberInput(props) {
|
7
|
-
const
|
8
|
-
const
|
7
|
+
const locale = getLocaleContext();
|
8
|
+
const environment = getEnvironmentContext();
|
9
9
|
const [state, send] = useMachine(numberInput.machine({
|
10
10
|
...props,
|
11
11
|
id: props.id ?? createUniqueId(),
|
12
|
-
dir:
|
13
|
-
locale:
|
14
|
-
getRootNode:
|
12
|
+
dir: locale?.dir,
|
13
|
+
locale: props.locale ?? locale?.locale,
|
14
|
+
getRootNode: environment?.getRootNode,
|
15
15
|
}));
|
16
16
|
const api = $derived(reflect(() => numberInput.connect(state, send, normalizeProps)));
|
17
17
|
return api;
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: NumberInputDecrementTriggerProps = $props();
|
12
12
|
|
13
|
-
let
|
13
|
+
let numberInput = numberInputContext.get();
|
14
14
|
|
15
|
-
let attrs = $derived(mergeProps(props,
|
15
|
+
let attrs = $derived(mergeProps(props, numberInput.getDecrementTriggerProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<button type="button" {...attrs}>
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: NumberInputIncrementTriggerProps = $props();
|
12
12
|
|
13
|
-
let
|
13
|
+
let numberInput = numberInputContext.get();
|
14
14
|
|
15
|
-
let attrs = $derived(mergeProps(props,
|
15
|
+
let attrs = $derived(mergeProps(props, numberInput.getIncrementTriggerProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<button type="button" {...attrs}>
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {...props}: NumberInputInputProps = $props();
|
12
12
|
|
13
|
-
let
|
13
|
+
let numberInput = numberInputContext.get();
|
14
14
|
|
15
|
-
let attrs = $derived(mergeProps(props,
|
15
|
+
let attrs = $derived(mergeProps(props, numberInput.getInputProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<input {...attrs} />
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: NumberInputLabelProps = $props();
|
12
12
|
|
13
|
-
let
|
13
|
+
let numberInput = numberInputContext.get();
|
14
14
|
|
15
|
-
let attrs = $derived(mergeProps(props,
|
15
|
+
let attrs = $derived(mergeProps(props, numberInput.getLabelProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<label {...attrs}>
|
@@ -8,7 +8,7 @@
|
|
8
8
|
|
9
9
|
export interface NumberInputProps
|
10
10
|
extends Assign<Omit<HtmlProps<'div'>, 'children'>, CreateNumberInputProps> {
|
11
|
-
children?: Snippet<[
|
11
|
+
children?: Snippet<[numberInput: CreateNumberInputReturn]>;
|
12
12
|
}
|
13
13
|
</script>
|
14
14
|
|
@@ -26,6 +26,7 @@
|
|
26
26
|
name,
|
27
27
|
form,
|
28
28
|
value,
|
29
|
+
locale,
|
29
30
|
pattern,
|
30
31
|
invalid,
|
31
32
|
disabled,
|
@@ -46,7 +47,7 @@
|
|
46
47
|
...props
|
47
48
|
}: NumberInputProps = $props();
|
48
49
|
|
49
|
-
let
|
50
|
+
let numberInput = createNumberInput({
|
50
51
|
id,
|
51
52
|
ids,
|
52
53
|
max,
|
@@ -55,6 +56,7 @@
|
|
55
56
|
name,
|
56
57
|
form,
|
57
58
|
value: $state.snapshot(value),
|
59
|
+
locale,
|
58
60
|
pattern,
|
59
61
|
invalid,
|
60
62
|
disabled,
|
@@ -73,11 +75,11 @@
|
|
73
75
|
onValueInvalid,
|
74
76
|
});
|
75
77
|
|
76
|
-
let attrs = $derived(mergeProps(props,
|
78
|
+
let attrs = $derived(mergeProps(props, numberInput.getRootProps()));
|
77
79
|
|
78
|
-
numberInputContext.set(
|
80
|
+
numberInputContext.set(numberInput);
|
79
81
|
</script>
|
80
82
|
|
81
83
|
<div {...attrs}>
|
82
|
-
{@render children?.(
|
84
|
+
{@render children?.(numberInput)}
|
83
85
|
</div>
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: NumberInputScrubberProps = $props();
|
12
12
|
|
13
|
-
let
|
13
|
+
let numberInput = numberInputContext.get();
|
14
14
|
|
15
|
-
let attrs = $derived(mergeProps(props,
|
15
|
+
let attrs = $derived(mergeProps(props, numberInput.getScrubberProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<div {...attrs}>
|
@@ -4,13 +4,13 @@ import { createUniqueId } from '../utils.svelte.js';
|
|
4
4
|
import * as pagination from '@zag-js/pagination';
|
5
5
|
import { normalizeProps, reflect, useMachine } from '@zag-js/svelte';
|
6
6
|
export function createPagination(props) {
|
7
|
-
const
|
8
|
-
const
|
7
|
+
const locale = getLocaleContext();
|
8
|
+
const environment = getEnvironmentContext();
|
9
9
|
const [state, send] = useMachine(pagination.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(() => pagination.connect(state, send, normalizeProps)));
|
16
16
|
return api;
|
@@ -11,9 +11,9 @@
|
|
11
11
|
|
12
12
|
let {index, children, ...props}: PaginationEllipsisProps = $props();
|
13
13
|
|
14
|
-
let
|
14
|
+
let pagination = paginationContext.get();
|
15
15
|
|
16
|
-
let attrs = $derived(mergeProps(props,
|
16
|
+
let attrs = $derived(mergeProps(props, pagination.getEllipsisProps({index})));
|
17
17
|
</script>
|
18
18
|
|
19
19
|
<span {...attrs}>
|
@@ -12,12 +12,12 @@
|
|
12
12
|
|
13
13
|
let {value, children, ...props}: PaginationItemProps = $props();
|
14
14
|
|
15
|
-
let
|
15
|
+
let pagination = paginationContext.get();
|
16
16
|
|
17
17
|
let attrs = $derived(
|
18
18
|
mergeProps(
|
19
19
|
props,
|
20
|
-
|
20
|
+
pagination.getItemProps({
|
21
21
|
type: 'page',
|
22
22
|
value,
|
23
23
|
}),
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: PaginationNextTriggerProps = $props();
|
12
12
|
|
13
|
-
let
|
13
|
+
let pagination = paginationContext.get();
|
14
14
|
|
15
|
-
let attrs = $derived(mergeProps(props,
|
15
|
+
let attrs = $derived(mergeProps(props, pagination.getNextTriggerProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<button type="button" {...attrs}>
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: PaginationPrevTriggerProps = $props();
|
12
12
|
|
13
|
-
let
|
13
|
+
let pagination = paginationContext.get();
|
14
14
|
|
15
|
-
let attrs = $derived(mergeProps(props,
|
15
|
+
let attrs = $derived(mergeProps(props, pagination.getPrevTriggerProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<button type="button" {...attrs}>
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
export interface PaginationProps
|
7
7
|
extends Assign<Omit<HtmlProps<'div'>, 'children'>, CreatePaginationProps> {
|
8
|
-
children?: Snippet<[
|
8
|
+
children?: Snippet<[pagination: CreatePaginationReturn]>;
|
9
9
|
}
|
10
10
|
</script>
|
11
11
|
|
@@ -29,7 +29,7 @@
|
|
29
29
|
...props
|
30
30
|
}: PaginationProps = $props();
|
31
31
|
|
32
|
-
let
|
32
|
+
let pagination = createPagination({
|
33
33
|
id,
|
34
34
|
ids,
|
35
35
|
type,
|
@@ -42,11 +42,11 @@
|
|
42
42
|
onPageSizeChange,
|
43
43
|
});
|
44
44
|
|
45
|
-
let attrs = $derived(mergeProps(props,
|
45
|
+
let attrs = $derived(mergeProps(props, pagination.getRootProps()));
|
46
46
|
|
47
|
-
paginationContext.set(
|
47
|
+
paginationContext.set(pagination);
|
48
48
|
</script>
|
49
49
|
|
50
50
|
<div {...attrs}>
|
51
|
-
{@render children?.(
|
51
|
+
{@render children?.(pagination)}
|
52
52
|
</div>
|
@@ -9,14 +9,14 @@
|
|
9
9
|
|
10
10
|
let {children, onclick, ...props}: PinInputClearTriggerProps = $props();
|
11
11
|
|
12
|
-
let
|
12
|
+
let pinInput = pinInputContext.get();
|
13
13
|
</script>
|
14
14
|
|
15
15
|
<button
|
16
16
|
type="button"
|
17
17
|
onclick={(e) => {
|
18
18
|
onclick?.(e);
|
19
|
-
|
19
|
+
pinInput.clearValue();
|
20
20
|
}}
|
21
21
|
{...props}
|
22
22
|
>
|
@@ -4,13 +4,13 @@ import { createUniqueId } from '../utils.svelte.js';
|
|
4
4
|
import * as pinInput from '@zag-js/pin-input';
|
5
5
|
import { normalizeProps, reflect, useMachine } from '@zag-js/svelte';
|
6
6
|
export function createPinInputContext(props) {
|
7
|
-
const
|
8
|
-
const
|
7
|
+
const locale = getLocaleContext();
|
8
|
+
const environment = getEnvironmentContext();
|
9
9
|
const [state, send] = useMachine(pinInput.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(() => pinInput.connect(state, send, normalizeProps)));
|
16
16
|
return api;
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {...props}: PinInputHiddenInputProps = $props();
|
12
12
|
|
13
|
-
let
|
13
|
+
let pinInput = pinInputContext.get();
|
14
14
|
|
15
|
-
let attrs = $derived(mergeProps(props,
|
15
|
+
let attrs = $derived(mergeProps(props, pinInput.getHiddenInputProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<input {...attrs} />
|
@@ -11,9 +11,9 @@
|
|
11
11
|
|
12
12
|
let {index, ...props}: PinInputInputProps = $props();
|
13
13
|
|
14
|
-
let
|
14
|
+
let pinInput = pinInputContext.get();
|
15
15
|
|
16
|
-
let attrs = $derived(mergeProps(props,
|
16
|
+
let attrs = $derived(mergeProps(props, pinInput.getInputProps({index})));
|
17
17
|
</script>
|
18
18
|
|
19
19
|
<input {...attrs} />
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: PinInputLabelProps = $props();
|
12
12
|
|
13
|
-
let
|
13
|
+
let pinInput = pinInputContext.get();
|
14
14
|
|
15
|
-
let attrs = $derived(mergeProps(props,
|
15
|
+
let attrs = $derived(mergeProps(props, pinInput.getLabelProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<label {...attrs}>
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
export interface PinInputProps
|
7
7
|
extends Assign<Omit<HtmlProps<'div'>, 'children'>, CreatePinInputProps> {
|
8
|
-
children?: Snippet<[
|
8
|
+
children?: Snippet<[pinInput: CreatePinInputReturn]>;
|
9
9
|
}
|
10
10
|
</script>
|
11
11
|
|
@@ -40,7 +40,7 @@
|
|
40
40
|
...props
|
41
41
|
}: PinInputProps = $props();
|
42
42
|
|
43
|
-
let
|
43
|
+
let pinInput = createPinInputContext({
|
44
44
|
id,
|
45
45
|
ids,
|
46
46
|
otp,
|
@@ -64,11 +64,11 @@
|
|
64
64
|
onValueComplete,
|
65
65
|
});
|
66
66
|
|
67
|
-
let attrs = $derived(mergeProps(props,
|
67
|
+
let attrs = $derived(mergeProps(props, pinInput.getRootProps()));
|
68
68
|
|
69
|
-
pinInputContext.set(
|
69
|
+
pinInputContext.set(pinInput);
|
70
70
|
</script>
|
71
71
|
|
72
72
|
<div {...attrs}>
|
73
|
-
{@render children?.(
|
73
|
+
{@render children?.(pinInput)}
|
74
74
|
</div>
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: PopoverArrowTipProps = $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.getArrowTipProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<div {...attrs}>
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: PopoverArrowProps = $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.getArrowProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<div {...attrs}>
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: PopoverCloseTriggerProps = $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.getCloseTriggerProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<button type="button" {...attrs}>
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: PopoverContentProps = $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.getContentProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<div {...attrs}>
|
@@ -4,14 +4,14 @@ import { createUniqueId } from '../utils.svelte.js';
|
|
4
4
|
import * as popover from '@zag-js/popover';
|
5
5
|
import { normalizeProps, reflect, useMachine } from '@zag-js/svelte';
|
6
6
|
export function createPopover(props) {
|
7
|
-
const
|
8
|
-
const
|
7
|
+
const locale = getLocaleContext();
|
8
|
+
const environment = getEnvironmentContext();
|
9
9
|
const [state, send] = useMachine(popover.machine({
|
10
10
|
...props,
|
11
11
|
id: props.id ?? createUniqueId(),
|
12
|
-
dir:
|
12
|
+
dir: locale?.dir,
|
13
13
|
open: props.defaultOpen,
|
14
|
-
getRootNode:
|
14
|
+
getRootNode: environment?.getRootNode,
|
15
15
|
'open.controlled': props.open != null,
|
16
16
|
}));
|
17
17
|
const api = $derived(reflect(() => popover.connect(state, send, normalizeProps)));
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: PopoverDescriptionProps = $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.getDescriptionProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<div {...attrs}>
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: PopoverPositionerProps = $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.getPositionerProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<div {...attrs}>
|
package/dist/popover/root.svelte
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
import type {CreatePopoverProps, CreatePopoverReturn} from './create-popover.svelte.js';
|
4
4
|
|
5
5
|
export interface PopoverProps extends CreatePopoverProps {
|
6
|
-
children?: Snippet<[
|
6
|
+
children?: Snippet<[popover: CreatePopoverReturn]>;
|
7
7
|
}
|
8
8
|
</script>
|
9
9
|
|
@@ -13,9 +13,9 @@
|
|
13
13
|
|
14
14
|
let {children, ...props}: PopoverProps = $props();
|
15
15
|
|
16
|
-
let
|
16
|
+
let popover = createPopover(props);
|
17
17
|
|
18
|
-
popoverContext.set(
|
18
|
+
popoverContext.set(popover);
|
19
19
|
</script>
|
20
20
|
|
21
|
-
{@render children?.(
|
21
|
+
{@render children?.(popover)}
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: PopoverTitleProps = $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.getTitleProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<div {...attrs}>
|