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,11 +10,10 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: DatePickerViewControlProps = $props();
|
12
12
|
|
13
|
-
let
|
14
|
-
|
13
|
+
let datePicker = datePickerContext.get();
|
15
14
|
let viewProps = datePickerViewPropsContext.get();
|
16
15
|
|
17
|
-
let attrs = $derived(mergeProps(props,
|
16
|
+
let attrs = $derived(mergeProps(props, datePicker.getViewControlProps(viewProps)));
|
18
17
|
</script>
|
19
18
|
|
20
19
|
<div {...attrs}>
|
@@ -12,13 +12,13 @@
|
|
12
12
|
|
13
13
|
let {view = 'day', children, ...props}: DatePickerViewProps = $props();
|
14
14
|
|
15
|
-
let
|
15
|
+
let datePicker = datePickerContext.get();
|
16
16
|
|
17
17
|
let attrs = $derived(mergeProps(props, parts.view.attrs));
|
18
18
|
|
19
19
|
datePickerViewPropsContext.set(() => ({view}));
|
20
20
|
</script>
|
21
21
|
|
22
|
-
<div hidden={
|
22
|
+
<div hidden={datePicker.view !== view} {...attrs}>
|
23
23
|
{@render children?.()}
|
24
24
|
</div>
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: DatePickerYearSelectProps = $props();
|
12
12
|
|
13
|
-
let
|
13
|
+
let datePicker = datePickerContext.get();
|
14
14
|
|
15
|
-
let attrs = $derived(mergeProps(props,
|
15
|
+
let attrs = $derived(mergeProps(props, datePicker.getYearSelectProps()));
|
16
16
|
|
17
17
|
function getYears() {
|
18
18
|
const currentYear = new Date().getFullYear();
|
@@ -10,11 +10,10 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: DatePickerYearTableCellTriggerProps = $props();
|
12
12
|
|
13
|
-
let
|
14
|
-
|
13
|
+
let datePicker = datePickerContext.get();
|
15
14
|
let tableCellProps = datePickerTableCellPropsContext.get();
|
16
15
|
|
17
|
-
let attrs = $derived(mergeProps(props,
|
16
|
+
let attrs = $derived(mergeProps(props, datePicker.getYearTableCellTriggerProps(tableCellProps)));
|
18
17
|
</script>
|
19
18
|
|
20
19
|
<button type="button" {...attrs}>
|
@@ -22,16 +22,15 @@
|
|
22
22
|
...props
|
23
23
|
}: DatePickerYearTableCellProps = $props();
|
24
24
|
|
25
|
-
let
|
26
|
-
|
25
|
+
let datePicker = datePickerContext.get();
|
27
26
|
let tableCellProps: TableCellProps = $derived({
|
28
27
|
value,
|
29
28
|
disabled,
|
30
29
|
columns,
|
31
30
|
});
|
32
31
|
|
33
|
-
let state = $derived(
|
34
|
-
let attrs = $derived(mergeProps(props,
|
32
|
+
let state = $derived(datePicker.getYearTableCellState(tableCellProps));
|
33
|
+
let attrs = $derived(mergeProps(props, datePicker.getYearTableCellProps(tableCellProps)));
|
35
34
|
|
36
35
|
datePickerTableCellPropsContext.set(() => tableCellProps);
|
37
36
|
</script>
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: DialogBackdropProps = $props();
|
12
12
|
|
13
|
-
let
|
13
|
+
let dialog = dialogContext.get();
|
14
14
|
|
15
|
-
let attrs = $derived(mergeProps(props,
|
15
|
+
let attrs = $derived(mergeProps(props, dialog.getBackdropProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<div {...attrs}>
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: DialogCloseTriggerProps = $props();
|
12
12
|
|
13
|
-
let
|
13
|
+
let dialog = dialogContext.get();
|
14
14
|
|
15
|
-
let attrs = $derived(mergeProps(props,
|
15
|
+
let attrs = $derived(mergeProps(props, dialog.getCloseTriggerProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<button type="button" {...attrs}>
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: DialogContentProps = $props();
|
12
12
|
|
13
|
-
let
|
13
|
+
let dialog = dialogContext.get();
|
14
14
|
|
15
|
-
let attrs = $derived(mergeProps(props,
|
15
|
+
let attrs = $derived(mergeProps(props, dialog.getContentProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<div {...attrs}>
|
@@ -4,14 +4,14 @@ import { createUniqueId } from '../utils.svelte.js';
|
|
4
4
|
import * as dialog from '@zag-js/dialog';
|
5
5
|
import { normalizeProps, reflect, useMachine } from '@zag-js/svelte';
|
6
6
|
export function createDialog(props) {
|
7
|
-
const
|
8
|
-
const
|
7
|
+
const locale = getLocaleContext();
|
8
|
+
const environment = getEnvironmentContext();
|
9
9
|
const [state, send] = useMachine(dialog.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(() => dialog.connect(state, send, normalizeProps)));
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: DialogDescriptionProps = $props();
|
12
12
|
|
13
|
-
let
|
13
|
+
let dialog = dialogContext.get();
|
14
14
|
|
15
|
-
let attrs = $derived(mergeProps(props,
|
15
|
+
let attrs = $derived(mergeProps(props, dialog.getDescriptionProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<div {...attrs}>
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: DialogPositionerProps = $props();
|
12
12
|
|
13
|
-
let
|
13
|
+
let dialog = dialogContext.get();
|
14
14
|
|
15
|
-
let attrs = $derived(mergeProps(props,
|
15
|
+
let attrs = $derived(mergeProps(props, dialog.getPositionerProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<div {...attrs}>
|
package/dist/dialog/root.svelte
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
import type {CreateDialogProps, CreateDialogReturn} from './create-dialog.svelte.js';
|
4
4
|
|
5
5
|
export interface DialogProps extends CreateDialogProps {
|
6
|
-
children?: Snippet<[
|
6
|
+
children?: Snippet<[dialog: CreateDialogReturn]>;
|
7
7
|
}
|
8
8
|
</script>
|
9
9
|
|
@@ -13,9 +13,9 @@
|
|
13
13
|
|
14
14
|
let {children, ...props}: DialogProps = $props();
|
15
15
|
|
16
|
-
let
|
16
|
+
let dialog = createDialog(props);
|
17
17
|
|
18
|
-
dialogContext.set(
|
18
|
+
dialogContext.set(dialog);
|
19
19
|
</script>
|
20
20
|
|
21
|
-
{@render children?.(
|
21
|
+
{@render children?.(dialog)}
|
package/dist/dialog/title.svelte
CHANGED
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: DialogTitleProps = $props();
|
12
12
|
|
13
|
-
let
|
13
|
+
let dialog = dialogContext.get();
|
14
14
|
|
15
|
-
let attrs = $derived(mergeProps(props,
|
15
|
+
let attrs = $derived(mergeProps(props, dialog.getTitleProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<div {...attrs}>
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: DialogTriggerProps = $props();
|
12
12
|
|
13
|
-
let
|
13
|
+
let dialog = dialogContext.get();
|
14
14
|
|
15
|
-
let attrs = $derived(mergeProps(props,
|
15
|
+
let attrs = $derived(mergeProps(props, dialog.getTriggerProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<button type="button" {...attrs}>
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: EditableAreaProps = $props();
|
12
12
|
|
13
|
-
let
|
13
|
+
let editable = editableContext.get();
|
14
14
|
|
15
|
-
let attrs = $derived(mergeProps(props,
|
15
|
+
let attrs = $derived(mergeProps(props, editable.getAreaProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<div {...attrs}>
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: EditableCancelTriggerProps = $props();
|
12
12
|
|
13
|
-
let
|
13
|
+
let editable = editableContext.get();
|
14
14
|
|
15
|
-
let attrs = $derived(mergeProps(props,
|
15
|
+
let attrs = $derived(mergeProps(props, editable.getCancelTriggerProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<button type="button" {...attrs}>
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: EditableControlProps = $props();
|
12
12
|
|
13
|
-
let
|
13
|
+
let editable = editableContext.get();
|
14
14
|
|
15
|
-
let attrs = $derived(mergeProps(props,
|
15
|
+
let attrs = $derived(mergeProps(props, editable.getControlProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<div {...attrs}>
|
@@ -4,14 +4,14 @@ import { createUniqueId } from '../utils.svelte.js';
|
|
4
4
|
import * as editable from '@zag-js/editable';
|
5
5
|
import { normalizeProps, reflect, useMachine } from '@zag-js/svelte';
|
6
6
|
export function createEditable(props) {
|
7
|
-
const
|
8
|
-
const
|
7
|
+
const locale = getLocaleContext();
|
8
|
+
const environment = getEnvironmentContext();
|
9
9
|
const [state, send] = useMachine(editable.machine({
|
10
10
|
...props,
|
11
11
|
id: props.id ?? createUniqueId(),
|
12
|
-
dir:
|
12
|
+
dir: locale?.dir,
|
13
13
|
edit: props.defaultEdit,
|
14
|
-
getRootNode:
|
14
|
+
getRootNode: environment?.getRootNode,
|
15
15
|
'edit.controlled': props.edit != null,
|
16
16
|
}));
|
17
17
|
const api = $derived(reflect(() => editable.connect(state, send, normalizeProps)));
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: EditableEditTriggerProps = $props();
|
12
12
|
|
13
|
-
let
|
13
|
+
let editable = editableContext.get();
|
14
14
|
|
15
|
-
let attrs = $derived(mergeProps(props,
|
15
|
+
let attrs = $derived(mergeProps(props, editable.getEditTriggerProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<button type="button" {...attrs}>
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {...props}: EditableInputProps = $props();
|
12
12
|
|
13
|
-
let
|
13
|
+
let editable = editableContext.get();
|
14
14
|
|
15
|
-
let attrs = $derived(mergeProps(props,
|
15
|
+
let attrs = $derived(mergeProps(props, editable.getInputProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<input {...attrs} />
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: EditableLabelProps = $props();
|
12
12
|
|
13
|
-
let
|
13
|
+
let editable = editableContext.get();
|
14
14
|
|
15
|
-
let attrs = $derived(mergeProps(props,
|
15
|
+
let attrs = $derived(mergeProps(props, editable.getLabelProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<label {...attrs}>
|
@@ -10,15 +10,15 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: EditablePreviewProps = $props();
|
12
12
|
|
13
|
-
let
|
13
|
+
let editable = editableContext.get();
|
14
14
|
|
15
|
-
let attrs = $derived(mergeProps(props,
|
15
|
+
let attrs = $derived(mergeProps(props, editable.getPreviewProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<div {...attrs}>
|
19
19
|
{#if children}
|
20
20
|
{@render children?.()}
|
21
21
|
{:else}
|
22
|
-
{
|
22
|
+
{editable.value}
|
23
23
|
{/if}
|
24
24
|
</div>
|
@@ -3,7 +3,7 @@
|
|
3
3
|
import type {CreateEditableProps, CreateEditableReturn} from './create-editable.svelte.js';
|
4
4
|
|
5
5
|
export interface EditableProps extends CreateEditableProps {
|
6
|
-
children?: Snippet<[
|
6
|
+
children?: Snippet<[editable: CreateEditableReturn]>;
|
7
7
|
}
|
8
8
|
</script>
|
9
9
|
|
@@ -13,9 +13,9 @@
|
|
13
13
|
|
14
14
|
let {children, ...props}: EditableProps = $props();
|
15
15
|
|
16
|
-
let
|
16
|
+
let editable = createEditable(props);
|
17
17
|
|
18
|
-
editableContext.set(
|
18
|
+
editableContext.set(editable);
|
19
19
|
</script>
|
20
20
|
|
21
|
-
{@render children?.(
|
21
|
+
{@render children?.(editable)}
|
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
let {children, ...props}: EditableSubmitTriggerProps = $props();
|
12
12
|
|
13
|
-
let
|
13
|
+
let editable = editableContext.get();
|
14
14
|
|
15
|
-
let attrs = $derived(mergeProps(props,
|
15
|
+
let attrs = $derived(mergeProps(props, editable.getSubmitTriggerProps()));
|
16
16
|
</script>
|
17
17
|
|
18
18
|
<button type="button" {...attrs}>
|
@@ -24,13 +24,13 @@
|
|
24
24
|
}
|
25
25
|
});
|
26
26
|
|
27
|
-
let
|
27
|
+
let environment: Environment = $derived({
|
28
28
|
getRootNode,
|
29
29
|
getDocument: () => getDocument(getRootNode()),
|
30
30
|
getWindow: () => getWindow(getRootNode()),
|
31
31
|
});
|
32
32
|
|
33
|
-
environmentContext.set(() =>
|
33
|
+
environmentContext.set(() => environment);
|
34
34
|
</script>
|
35
35
|
|
36
36
|
{@render children()}
|
@@ -1,8 +1,5 @@
|
|
1
|
-
import
|
2
|
-
|
3
|
-
}
|
4
|
-
export
|
5
|
-
|
6
|
-
export declare function createFileUploadContext(props: CreateFileUploadContextProps): fileUpload.Api<any>;
|
7
|
-
export declare function setFileUploadContext(value: CreateFileUploadContextReturn): CreateFileUploadContextReturn;
|
8
|
-
export declare function useFileUploadContext(): CreateFileUploadContextReturn;
|
1
|
+
import { Context } from '../utils.svelte.js';
|
2
|
+
import type { ItemProps } from '@zag-js/file-upload';
|
3
|
+
import type { CreateFileUploadReturn } from './create-file-upload.svelte.js';
|
4
|
+
export declare const fileUploadContext: Context<CreateFileUploadReturn>;
|
5
|
+
export declare const fileUploadItemPropsContext: Context<ItemProps>;
|
@@ -1,14 +1,3 @@
|
|
1
|
-
import
|
2
|
-
|
3
|
-
|
4
|
-
export function createFileUploadContext(props) {
|
5
|
-
const [state, send] = useMachine(fileUpload.machine(props));
|
6
|
-
const api = $derived(reflect(() => fileUpload.connect(state, send, normalizeProps)));
|
7
|
-
return api;
|
8
|
-
}
|
9
|
-
export function setFileUploadContext(value) {
|
10
|
-
return setContext('FileUpload', value);
|
11
|
-
}
|
12
|
-
export function useFileUploadContext() {
|
13
|
-
return getContext('FileUpload');
|
14
|
-
}
|
1
|
+
import { Context } from '../utils.svelte.js';
|
2
|
+
export const fileUploadContext = new Context('FileUpload');
|
3
|
+
export const fileUploadItemPropsContext = new Context('FileUploadItem');
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import * as fileUpload from '@zag-js/file-upload';
|
2
|
+
export interface CreateFileUploadProps extends Omit<fileUpload.Context, 'id' | 'dir' | 'getRootNode'> {
|
3
|
+
id?: string | null;
|
4
|
+
}
|
5
|
+
export interface CreateFileUploadReturn extends fileUpload.Api<any> {
|
6
|
+
}
|
7
|
+
export declare function createFileUpload(props: CreateFileUploadProps): CreateFileUploadReturn;
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { getEnvironmentContext } from '../environment-provider/context.svelte.js';
|
2
|
+
import { getLocaleContext } from '../locale-provider/context.svelte.js';
|
3
|
+
import { createUniqueId } from '../utils.svelte.js';
|
4
|
+
import * as fileUpload from '@zag-js/file-upload';
|
5
|
+
import { normalizeProps, reflect, useMachine } from '@zag-js/svelte';
|
6
|
+
export function createFileUpload(props) {
|
7
|
+
const locale = getLocaleContext();
|
8
|
+
const environment = getEnvironmentContext();
|
9
|
+
const [state, send] = useMachine(fileUpload.machine({
|
10
|
+
...props,
|
11
|
+
id: props.id ?? createUniqueId(),
|
12
|
+
dir: locale?.dir,
|
13
|
+
locale: props.locale ?? locale?.locale,
|
14
|
+
getRootNode: environment?.getRootNode,
|
15
|
+
}));
|
16
|
+
const api = $derived(reflect(() => fileUpload.connect(state, send, normalizeProps)));
|
17
|
+
return api;
|
18
|
+
}
|
@@ -1,3 +1,20 @@
|
|
1
|
-
<script lang="ts" module
|
1
|
+
<script lang="ts" module>
|
2
|
+
import type {HtmlProps} from '../types.js';
|
2
3
|
|
3
|
-
<
|
4
|
+
export interface FileUploadDropzoneProps extends HtmlProps<'div'> {}
|
5
|
+
</script>
|
6
|
+
|
7
|
+
<script lang="ts">
|
8
|
+
import {mergeProps} from '@zag-js/svelte';
|
9
|
+
import {fileUploadContext} from './context.svelte.js';
|
10
|
+
|
11
|
+
let {children, ...props}: FileUploadDropzoneProps = $props();
|
12
|
+
|
13
|
+
let fileUpload = fileUploadContext.get();
|
14
|
+
|
15
|
+
let attrs = $derived(mergeProps(props, fileUpload.getDropzoneProps()));
|
16
|
+
</script>
|
17
|
+
|
18
|
+
<div {...attrs}>
|
19
|
+
{@render children?.()}
|
20
|
+
</div>
|
@@ -2,7 +2,7 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
|
|
2
2
|
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
3
3
|
$$bindings?: Bindings;
|
4
4
|
} & Exports;
|
5
|
-
(internal: unknown, props: {
|
5
|
+
(internal: unknown, props: Props & {
|
6
6
|
$$events?: Events;
|
7
7
|
$$slots?: Slots;
|
8
8
|
}): Exports & {
|
@@ -11,8 +11,8 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
|
|
11
11
|
};
|
12
12
|
z_$$bindings?: Bindings;
|
13
13
|
}
|
14
|
-
declare const Dropzone: $$__sveltets_2_IsomorphicComponent<
|
14
|
+
declare const Dropzone: $$__sveltets_2_IsomorphicComponent<FileUploadDropzoneProps, {
|
15
15
|
[evt: string]: CustomEvent<any>;
|
16
|
-
}, {}, {},
|
16
|
+
}, {}, {}, "">;
|
17
17
|
type Dropzone = InstanceType<typeof Dropzone>;
|
18
18
|
export default Dropzone;
|
@@ -1,3 +1,18 @@
|
|
1
|
-
<script lang="ts" module
|
1
|
+
<script lang="ts" module>
|
2
|
+
import type {HtmlProps} from '../types.js';
|
2
3
|
|
3
|
-
<
|
4
|
+
export interface FileUploadHiddenInputProps extends HtmlProps<'input'> {}
|
5
|
+
</script>
|
6
|
+
|
7
|
+
<script lang="ts">
|
8
|
+
import {mergeProps} from '@zag-js/svelte';
|
9
|
+
import {fileUploadContext} from './context.svelte.js';
|
10
|
+
|
11
|
+
let {...props}: FileUploadHiddenInputProps = $props();
|
12
|
+
|
13
|
+
let fileUpload = fileUploadContext.get();
|
14
|
+
|
15
|
+
let attrs = $derived(mergeProps(props, fileUpload.getHiddenInputProps()));
|
16
|
+
</script>
|
17
|
+
|
18
|
+
<input {...attrs} />
|
@@ -2,7 +2,7 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
|
|
2
2
|
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
3
3
|
$$bindings?: Bindings;
|
4
4
|
} & Exports;
|
5
|
-
(internal: unknown, props: {
|
5
|
+
(internal: unknown, props: Props & {
|
6
6
|
$$events?: Events;
|
7
7
|
$$slots?: Slots;
|
8
8
|
}): Exports & {
|
@@ -11,8 +11,8 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
|
|
11
11
|
};
|
12
12
|
z_$$bindings?: Bindings;
|
13
13
|
}
|
14
|
-
declare const HiddenInput: $$__sveltets_2_IsomorphicComponent<
|
14
|
+
declare const HiddenInput: $$__sveltets_2_IsomorphicComponent<FileUploadHiddenInputProps, {
|
15
15
|
[evt: string]: CustomEvent<any>;
|
16
|
-
}, {}, {},
|
16
|
+
}, {}, {}, "">;
|
17
17
|
type HiddenInput = InstanceType<typeof HiddenInput>;
|
18
18
|
export default HiddenInput;
|
@@ -1 +1,14 @@
|
|
1
|
+
export { anatomy as fileUploadAnatomy } from '@zag-js/file-upload';
|
2
|
+
export type { FileUploadDropzoneProps } from './dropzone.svelte';
|
1
3
|
export * as FileUpload from './file-upload.js';
|
4
|
+
export type { FileUploadHiddenInputProps } from './hidden-input.svelte';
|
5
|
+
export type { FileUploadItemDeleteTriggerProps } from './item-delete-trigger.svelte';
|
6
|
+
export type { FileUploadItemGroupProps } from './item-group.svelte';
|
7
|
+
export type { FileUploadItemNameProps } from './item-name.svelte';
|
8
|
+
export type { FileUploadItemPreviewImageProps } from './item-preview-image.svelte';
|
9
|
+
export type { FileUploadItemPreviewProps } from './item-preview.svelte';
|
10
|
+
export type { FileUploadItemSizeTextProps } from './item-size-text.svelte';
|
11
|
+
export type { FileUploadItemProps } from './item.svelte';
|
12
|
+
export type { FileUploadLabelProps } from './label.svelte';
|
13
|
+
export type { FileUploadProps } from './root.svelte';
|
14
|
+
export type { FileUploadTriggerProps } from './trigger.svelte';
|
@@ -1,3 +1,21 @@
|
|
1
|
-
<script lang="ts" module
|
1
|
+
<script lang="ts" module>
|
2
|
+
import type {HtmlProps} from '../types.js';
|
2
3
|
|
3
|
-
<
|
4
|
+
export interface FileUploadItemDeleteTriggerProps extends HtmlProps<'button'> {}
|
5
|
+
</script>
|
6
|
+
|
7
|
+
<script lang="ts">
|
8
|
+
import {mergeProps} from '@zag-js/svelte';
|
9
|
+
import {fileUploadContext, fileUploadItemPropsContext} from './context.svelte.js';
|
10
|
+
|
11
|
+
let {children, ...props}: FileUploadItemDeleteTriggerProps = $props();
|
12
|
+
|
13
|
+
let fileUpload = fileUploadContext.get();
|
14
|
+
let itemProps = fileUploadItemPropsContext.get();
|
15
|
+
|
16
|
+
let attrs = $derived(mergeProps(props, fileUpload.getItemDeleteTriggerProps(itemProps)));
|
17
|
+
</script>
|
18
|
+
|
19
|
+
<button type="button" {...attrs}>
|
20
|
+
{@render children?.()}
|
21
|
+
</button>
|
@@ -2,7 +2,7 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
|
|
2
2
|
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
3
3
|
$$bindings?: Bindings;
|
4
4
|
} & Exports;
|
5
|
-
(internal: unknown, props: {
|
5
|
+
(internal: unknown, props: Props & {
|
6
6
|
$$events?: Events;
|
7
7
|
$$slots?: Slots;
|
8
8
|
}): Exports & {
|
@@ -11,8 +11,8 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
|
|
11
11
|
};
|
12
12
|
z_$$bindings?: Bindings;
|
13
13
|
}
|
14
|
-
declare const ItemDeleteTrigger: $$__sveltets_2_IsomorphicComponent<
|
14
|
+
declare const ItemDeleteTrigger: $$__sveltets_2_IsomorphicComponent<FileUploadItemDeleteTriggerProps, {
|
15
15
|
[evt: string]: CustomEvent<any>;
|
16
|
-
}, {}, {},
|
16
|
+
}, {}, {}, "">;
|
17
17
|
type ItemDeleteTrigger = InstanceType<typeof ItemDeleteTrigger>;
|
18
18
|
export default ItemDeleteTrigger;
|
@@ -1,3 +1,20 @@
|
|
1
|
-
<script lang="ts" module
|
1
|
+
<script lang="ts" module>
|
2
|
+
import type {HtmlProps} from '../types.js';
|
2
3
|
|
3
|
-
<
|
4
|
+
export interface FileUploadItemGroupProps extends HtmlProps<'div'> {}
|
5
|
+
</script>
|
6
|
+
|
7
|
+
<script lang="ts">
|
8
|
+
import {mergeProps} from '@zag-js/svelte';
|
9
|
+
import {fileUploadContext} from './context.svelte.js';
|
10
|
+
|
11
|
+
let {children, ...props}: FileUploadItemGroupProps = $props();
|
12
|
+
|
13
|
+
let fileUpload = fileUploadContext.get();
|
14
|
+
|
15
|
+
let attrs = $derived(mergeProps(props, fileUpload.getItemGroupProps()));
|
16
|
+
</script>
|
17
|
+
|
18
|
+
<div {...attrs}>
|
19
|
+
{@render children?.()}
|
20
|
+
</div>
|
@@ -2,7 +2,7 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
|
|
2
2
|
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
3
3
|
$$bindings?: Bindings;
|
4
4
|
} & Exports;
|
5
|
-
(internal: unknown, props: {
|
5
|
+
(internal: unknown, props: Props & {
|
6
6
|
$$events?: Events;
|
7
7
|
$$slots?: Slots;
|
8
8
|
}): Exports & {
|
@@ -11,8 +11,8 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
|
|
11
11
|
};
|
12
12
|
z_$$bindings?: Bindings;
|
13
13
|
}
|
14
|
-
declare const ItemGroup: $$__sveltets_2_IsomorphicComponent<
|
14
|
+
declare const ItemGroup: $$__sveltets_2_IsomorphicComponent<FileUploadItemGroupProps, {
|
15
15
|
[evt: string]: CustomEvent<any>;
|
16
|
-
}, {}, {},
|
16
|
+
}, {}, {}, "">;
|
17
17
|
type ItemGroup = InstanceType<typeof ItemGroup>;
|
18
18
|
export default ItemGroup;
|