ui-ingredients 0.20.0 → 0.21.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/accordion/accordion-item-content.svelte +55 -55
- package/dist/accordion/accordion-root.svelte +66 -66
- package/dist/alert-dialog/alert-dialog-backdrop.svelte +49 -49
- package/dist/alert-dialog/alert-dialog-root.svelte +48 -48
- package/dist/avatar/avatar-root.svelte +46 -46
- package/dist/carousel/carousel-root.svelte +56 -56
- package/dist/checkbox/checkbox-root.svelte +59 -59
- package/dist/clipboard/clipboard-root.svelte +52 -52
- package/dist/collapsible/collapsible-root.svelte +75 -75
- package/dist/color-picker/color-picker-root.svelte +87 -87
- package/dist/combobox/combobox-root.svelte +101 -101
- package/dist/combobox/combobox-trigger.svelte +41 -41
- package/dist/date-picker/date-picker-root.svelte +89 -89
- package/dist/dialog/dialog-backdrop.svelte +45 -45
- package/dist/dialog/dialog-root.svelte +48 -48
- package/dist/drawer/drawer-backdrop.svelte +45 -45
- package/dist/drawer/drawer-root.svelte +48 -48
- package/dist/editable/editable-root.svelte +74 -74
- package/dist/field/field-error-text.svelte +50 -50
- package/dist/field/field-root.svelte +63 -63
- package/dist/file-upload/file-upload-root.svelte +66 -66
- package/dist/floating-panel/floating-panel-root.svelte +47 -47
- package/dist/hover-card/hover-card-root.svelte +52 -52
- package/dist/menu/menu-root.svelte +74 -74
- package/dist/number-input/number-input-root.svelte +74 -74
- package/dist/pagination/pagination-root.svelte +57 -57
- package/dist/pin-input/pin-input-root.svelte +68 -68
- package/dist/popover/popover-root.svelte +60 -60
- package/dist/presence/presence.svelte +48 -48
- package/dist/progress/progress-root.svelte +54 -54
- package/dist/qr-code/qr-code-root.svelte +48 -48
- package/dist/radio-group/radio-group-root.svelte +56 -56
- package/dist/rating-group/rating-group-root.svelte +63 -63
- package/dist/segment-group/segment-group-root.svelte +58 -58
- package/dist/select/select-root.svelte +88 -88
- package/dist/signature-pad/signature-pad-root.svelte +59 -59
- package/dist/slider/slider-root.svelte +69 -69
- package/dist/splitter/splitter-root.svelte +53 -53
- package/dist/steps/steps-completed-content.svelte +51 -37
- package/dist/steps/steps-completed-content.svelte.d.ts +2 -1
- package/dist/steps/steps-content.svelte +55 -32
- package/dist/steps/steps-content.svelte.d.ts +2 -1
- package/dist/steps/steps-root.svelte +65 -55
- package/dist/steps/steps-root.svelte.d.ts +2 -1
- package/dist/switch/switch-root.svelte +59 -59
- package/dist/tabs/tabs-root.svelte +57 -57
- package/dist/tags-input/tags-input-root.svelte +74 -74
- package/dist/time-picker/time-picker-root.svelte +81 -81
- package/dist/timer/timer-root.svelte +55 -55
- package/dist/toast/create-toaster.svelte.d.ts +1 -1
- package/dist/toast/toast-actor.svelte +19 -19
- package/dist/toast/toast-actor.svelte.d.ts +3 -3
- package/dist/toast/toaster.svelte +19 -21
- package/dist/toast/toaster.svelte.d.ts +1 -1
- package/dist/toggle/toggle-root.svelte +50 -50
- package/dist/toggle-group/toggle-group-root.svelte +58 -58
- package/dist/tooltip/tooltip-root.svelte +44 -44
- package/dist/tour/tour-backdrop.svelte +44 -44
- package/dist/tour/tour-root.svelte +47 -47
- package/dist/tree-view/tree-view-branch-content.svelte +55 -55
- package/dist/tree-view/tree-view-root.svelte +68 -68
- package/package.json +5 -5
@@ -1,101 +1,101 @@
|
|
1
|
-
<script lang="ts" module>
|
2
|
-
import type {PresenceStrategyProps} from '../presence/create-presence.svelte.js';
|
3
|
-
import type {Assign, HtmlIngredientProps} from '../types.js';
|
4
|
-
import type {
|
5
|
-
CreateComboboxProps,
|
6
|
-
CreateComboboxReturn,
|
7
|
-
} from './create-combobox.svelte.js';
|
8
|
-
|
9
|
-
export interface ComboboxProps
|
10
|
-
extends Assign<
|
11
|
-
HtmlIngredientProps<'div', HTMLDivElement, CreateComboboxReturn>,
|
12
|
-
CreateComboboxProps
|
13
|
-
>,
|
14
|
-
PresenceStrategyProps {}
|
15
|
-
</script>
|
16
|
-
|
17
|
-
<script lang="ts">
|
18
|
-
import {mergeProps} from '../merge-props.js';
|
19
|
-
import {createPresence} from '../presence/create-presence.svelte.js';
|
20
|
-
import {setPresenceContext} from '../presence/presence-context.svelte.js';
|
21
|
-
import {reflect} from '@zag-js/svelte';
|
22
|
-
import {createSplitProps} from '@zag-js/utils';
|
23
|
-
import {setComboboxContext} from './combobox-context.svelte.js';
|
24
|
-
import {createCombobox} from './create-combobox.svelte.js';
|
25
|
-
|
26
|
-
let {
|
27
|
-
ref = $bindable(null),
|
28
|
-
asChild,
|
29
|
-
children,
|
30
|
-
...props
|
31
|
-
}: ComboboxProps = $props();
|
32
|
-
|
33
|
-
let [presenceStrategyProps, rest] = $derived(
|
34
|
-
createSplitProps<PresenceStrategyProps>(['lazyMount', 'keepMounted'])(
|
35
|
-
props,
|
36
|
-
),
|
37
|
-
);
|
38
|
-
|
39
|
-
let [createComboboxProps, localProps] = $derived(
|
40
|
-
createSplitProps<CreateComboboxProps>([
|
41
|
-
'id',
|
42
|
-
'ids',
|
43
|
-
'name',
|
44
|
-
'form',
|
45
|
-
'open',
|
46
|
-
'openControlled',
|
47
|
-
'collection',
|
48
|
-
'value',
|
49
|
-
'invalid',
|
50
|
-
'disabled',
|
51
|
-
'multiple',
|
52
|
-
'readOnly',
|
53
|
-
'required',
|
54
|
-
'autoFocus',
|
55
|
-
'composite',
|
56
|
-
'loopFocus',
|
57
|
-
'inputValue',
|
58
|
-
'placeholder',
|
59
|
-
'positioning',
|
60
|
-
'translations',
|
61
|
-
'disableLayer',
|
62
|
-
'closeOnSelect',
|
63
|
-
'inputBehavior',
|
64
|
-
'openOnChange',
|
65
|
-
'openOnClick',
|
66
|
-
'openOnKeyPress',
|
67
|
-
'allowCustomValue',
|
68
|
-
'highlightedValue',
|
69
|
-
'selectionBehavior',
|
70
|
-
'onOpenChange',
|
71
|
-
'onValueChange',
|
72
|
-
'onFocusOutside',
|
73
|
-
'onHighlightChange',
|
74
|
-
'onInteractOutside',
|
75
|
-
'onInputValueChange',
|
76
|
-
'onPointerDownOutside',
|
77
|
-
'scrollToIndexFn',
|
78
|
-
])(rest),
|
79
|
-
);
|
80
|
-
|
81
|
-
let combobox = createCombobox(reflect(() => createComboboxProps));
|
82
|
-
let presence = createPresence(
|
83
|
-
reflect(() => ({
|
84
|
-
...presenceStrategyProps,
|
85
|
-
present: combobox.open,
|
86
|
-
})),
|
87
|
-
);
|
88
|
-
|
89
|
-
let mergedProps = $derived(mergeProps(combobox.getRootProps(), localProps));
|
90
|
-
|
91
|
-
setComboboxContext(combobox);
|
92
|
-
setPresenceContext(presence);
|
93
|
-
</script>
|
94
|
-
|
95
|
-
{#if asChild}
|
96
|
-
{@render asChild(mergedProps, combobox)}
|
97
|
-
{:else}
|
98
|
-
<div bind:this={ref} {...mergedProps}>
|
99
|
-
{@render children?.(combobox)}
|
100
|
-
</div>
|
101
|
-
{/if}
|
1
|
+
<script lang="ts" module>
|
2
|
+
import type {PresenceStrategyProps} from '../presence/create-presence.svelte.js';
|
3
|
+
import type {Assign, HtmlIngredientProps} from '../types.js';
|
4
|
+
import type {
|
5
|
+
CreateComboboxProps,
|
6
|
+
CreateComboboxReturn,
|
7
|
+
} from './create-combobox.svelte.js';
|
8
|
+
|
9
|
+
export interface ComboboxProps
|
10
|
+
extends Assign<
|
11
|
+
HtmlIngredientProps<'div', HTMLDivElement, CreateComboboxReturn>,
|
12
|
+
CreateComboboxProps
|
13
|
+
>,
|
14
|
+
PresenceStrategyProps {}
|
15
|
+
</script>
|
16
|
+
|
17
|
+
<script lang="ts">
|
18
|
+
import {mergeProps} from '../merge-props.js';
|
19
|
+
import {createPresence} from '../presence/create-presence.svelte.js';
|
20
|
+
import {setPresenceContext} from '../presence/presence-context.svelte.js';
|
21
|
+
import {reflect} from '@zag-js/svelte';
|
22
|
+
import {createSplitProps} from '@zag-js/utils';
|
23
|
+
import {setComboboxContext} from './combobox-context.svelte.js';
|
24
|
+
import {createCombobox} from './create-combobox.svelte.js';
|
25
|
+
|
26
|
+
let {
|
27
|
+
ref = $bindable(null),
|
28
|
+
asChild,
|
29
|
+
children,
|
30
|
+
...props
|
31
|
+
}: ComboboxProps = $props();
|
32
|
+
|
33
|
+
let [presenceStrategyProps, rest] = $derived(
|
34
|
+
createSplitProps<PresenceStrategyProps>(['lazyMount', 'keepMounted'])(
|
35
|
+
props,
|
36
|
+
),
|
37
|
+
);
|
38
|
+
|
39
|
+
let [createComboboxProps, localProps] = $derived(
|
40
|
+
createSplitProps<CreateComboboxProps>([
|
41
|
+
'id',
|
42
|
+
'ids',
|
43
|
+
'name',
|
44
|
+
'form',
|
45
|
+
'open',
|
46
|
+
'openControlled',
|
47
|
+
'collection',
|
48
|
+
'value',
|
49
|
+
'invalid',
|
50
|
+
'disabled',
|
51
|
+
'multiple',
|
52
|
+
'readOnly',
|
53
|
+
'required',
|
54
|
+
'autoFocus',
|
55
|
+
'composite',
|
56
|
+
'loopFocus',
|
57
|
+
'inputValue',
|
58
|
+
'placeholder',
|
59
|
+
'positioning',
|
60
|
+
'translations',
|
61
|
+
'disableLayer',
|
62
|
+
'closeOnSelect',
|
63
|
+
'inputBehavior',
|
64
|
+
'openOnChange',
|
65
|
+
'openOnClick',
|
66
|
+
'openOnKeyPress',
|
67
|
+
'allowCustomValue',
|
68
|
+
'highlightedValue',
|
69
|
+
'selectionBehavior',
|
70
|
+
'onOpenChange',
|
71
|
+
'onValueChange',
|
72
|
+
'onFocusOutside',
|
73
|
+
'onHighlightChange',
|
74
|
+
'onInteractOutside',
|
75
|
+
'onInputValueChange',
|
76
|
+
'onPointerDownOutside',
|
77
|
+
'scrollToIndexFn',
|
78
|
+
])(rest),
|
79
|
+
);
|
80
|
+
|
81
|
+
let combobox = createCombobox(reflect(() => createComboboxProps));
|
82
|
+
let presence = createPresence(
|
83
|
+
reflect(() => ({
|
84
|
+
...presenceStrategyProps,
|
85
|
+
present: combobox.open,
|
86
|
+
})),
|
87
|
+
);
|
88
|
+
|
89
|
+
let mergedProps = $derived(mergeProps(combobox.getRootProps(), localProps));
|
90
|
+
|
91
|
+
setComboboxContext(combobox);
|
92
|
+
setPresenceContext(presence);
|
93
|
+
</script>
|
94
|
+
|
95
|
+
{#if asChild}
|
96
|
+
{@render asChild(mergedProps, combobox)}
|
97
|
+
{:else}
|
98
|
+
<div bind:this={ref} {...mergedProps}>
|
99
|
+
{@render children?.(combobox)}
|
100
|
+
</div>
|
101
|
+
{/if}
|
@@ -1,41 +1,41 @@
|
|
1
|
-
<script lang="ts" module>
|
2
|
-
import {mergeProps} from '../merge-props.js';
|
3
|
-
import type {Assign, HtmlIngredientProps} from '../types.js';
|
4
|
-
|
5
|
-
export interface ComboboxTriggerProps
|
6
|
-
extends Assign<
|
7
|
-
HtmlIngredientProps<'button', HTMLButtonElement>,
|
8
|
-
TriggerProps
|
9
|
-
> {}
|
10
|
-
</script>
|
11
|
-
|
12
|
-
<script lang="ts">
|
13
|
-
import type {TriggerProps} from '@zag-js/combobox';
|
14
|
-
import {createSplitProps} from '@zag-js/utils';
|
15
|
-
import {getComboboxContext} from './combobox-context.svelte.js';
|
16
|
-
|
17
|
-
let {
|
18
|
-
ref = $bindable(null),
|
19
|
-
asChild,
|
20
|
-
children,
|
21
|
-
...props
|
22
|
-
}: ComboboxTriggerProps = $props();
|
23
|
-
|
24
|
-
let [triggerProps, localProps] = $derived(
|
25
|
-
createSplitProps<TriggerProps>(['focusable'])(props),
|
26
|
-
);
|
27
|
-
|
28
|
-
let combobox = getComboboxContext();
|
29
|
-
|
30
|
-
let mergedProps = $derived(
|
31
|
-
mergeProps(combobox.getTriggerProps(triggerProps), localProps),
|
32
|
-
);
|
33
|
-
</script>
|
34
|
-
|
35
|
-
{#if asChild}
|
36
|
-
{@render asChild(mergedProps)}
|
37
|
-
{:else}
|
38
|
-
<button bind:this={ref} {...mergedProps}>
|
39
|
-
{@render children?.()}
|
40
|
-
</button>
|
41
|
-
{/if}
|
1
|
+
<script lang="ts" module>
|
2
|
+
import {mergeProps} from '../merge-props.js';
|
3
|
+
import type {Assign, HtmlIngredientProps} from '../types.js';
|
4
|
+
|
5
|
+
export interface ComboboxTriggerProps
|
6
|
+
extends Assign<
|
7
|
+
HtmlIngredientProps<'button', HTMLButtonElement>,
|
8
|
+
TriggerProps
|
9
|
+
> {}
|
10
|
+
</script>
|
11
|
+
|
12
|
+
<script lang="ts">
|
13
|
+
import type {TriggerProps} from '@zag-js/combobox';
|
14
|
+
import {createSplitProps} from '@zag-js/utils';
|
15
|
+
import {getComboboxContext} from './combobox-context.svelte.js';
|
16
|
+
|
17
|
+
let {
|
18
|
+
ref = $bindable(null),
|
19
|
+
asChild,
|
20
|
+
children,
|
21
|
+
...props
|
22
|
+
}: ComboboxTriggerProps = $props();
|
23
|
+
|
24
|
+
let [triggerProps, localProps] = $derived(
|
25
|
+
createSplitProps<TriggerProps>(['focusable'])(props),
|
26
|
+
);
|
27
|
+
|
28
|
+
let combobox = getComboboxContext();
|
29
|
+
|
30
|
+
let mergedProps = $derived(
|
31
|
+
mergeProps(combobox.getTriggerProps(triggerProps), localProps),
|
32
|
+
);
|
33
|
+
</script>
|
34
|
+
|
35
|
+
{#if asChild}
|
36
|
+
{@render asChild(mergedProps)}
|
37
|
+
{:else}
|
38
|
+
<button bind:this={ref} {...mergedProps}>
|
39
|
+
{@render children?.()}
|
40
|
+
</button>
|
41
|
+
{/if}
|
@@ -1,89 +1,89 @@
|
|
1
|
-
<script lang="ts" module>
|
2
|
-
import type {PresenceStrategyProps} from '../presence/create-presence.svelte.js';
|
3
|
-
import type {Assign, HtmlIngredientProps} from '../types.js';
|
4
|
-
import type {
|
5
|
-
CreateDatePickerProps,
|
6
|
-
CreateDatePickerReturn,
|
7
|
-
} from './create-date-picker.svelte.js';
|
8
|
-
|
9
|
-
export interface DatePickerProps
|
10
|
-
extends Assign<
|
11
|
-
HtmlIngredientProps<'div', HTMLDivElement, CreateDatePickerReturn>,
|
12
|
-
CreateDatePickerProps
|
13
|
-
>,
|
14
|
-
PresenceStrategyProps {}
|
15
|
-
</script>
|
16
|
-
|
17
|
-
<script lang="ts">
|
18
|
-
import {mergeProps} from '../merge-props.js';
|
19
|
-
import {createPresence} from '../presence/create-presence.svelte.js';
|
20
|
-
import {setPresenceContext} from '../presence/presence-context.svelte.js';
|
21
|
-
import {reflect} from '@zag-js/svelte';
|
22
|
-
import {createSplitProps} from '@zag-js/utils';
|
23
|
-
import {createDatePicker} from './create-date-picker.svelte.js';
|
24
|
-
import {setDatePickerContext} from './date-picker-context.svelte.js';
|
25
|
-
|
26
|
-
let {
|
27
|
-
ref = $bindable(null),
|
28
|
-
asChild,
|
29
|
-
children,
|
30
|
-
...props
|
31
|
-
}: DatePickerProps = $props();
|
32
|
-
|
33
|
-
let [presenceStrategyProps, rest] = $derived(
|
34
|
-
createSplitProps<PresenceStrategyProps>([])(props),
|
35
|
-
);
|
36
|
-
|
37
|
-
let [createDatePickerProps, localProps] = $derived(
|
38
|
-
createSplitProps<CreateDatePickerProps>([
|
39
|
-
'id',
|
40
|
-
'ids',
|
41
|
-
'min',
|
42
|
-
'max',
|
43
|
-
'name',
|
44
|
-
'open',
|
45
|
-
'openControlled',
|
46
|
-
'view',
|
47
|
-
'value',
|
48
|
-
'format',
|
49
|
-
'locale',
|
50
|
-
'disabled',
|
51
|
-
'readOnly',
|
52
|
-
'timeZone',
|
53
|
-
'fixedWeeks',
|
54
|
-
'startOfWeek',
|
55
|
-
'positioning',
|
56
|
-
'numOfMonths',
|
57
|
-
'translations',
|
58
|
-
'focusedValue',
|
59
|
-
'closeOnSelect',
|
60
|
-
'selectionMode',
|
61
|
-
'onViewChange',
|
62
|
-
'onOpenChange',
|
63
|
-
'onValueChange',
|
64
|
-
'onFocusChange',
|
65
|
-
'isDateUnavailable',
|
66
|
-
])(rest),
|
67
|
-
);
|
68
|
-
|
69
|
-
let datePicker = createDatePicker(reflect(() => createDatePickerProps));
|
70
|
-
let presence = createPresence(
|
71
|
-
reflect(() => ({
|
72
|
-
...presenceStrategyProps,
|
73
|
-
present: datePicker.open,
|
74
|
-
})),
|
75
|
-
);
|
76
|
-
|
77
|
-
let mergedProps = $derived(mergeProps(datePicker.getRootProps(), localProps));
|
78
|
-
|
79
|
-
setDatePickerContext(datePicker);
|
80
|
-
setPresenceContext(presence);
|
81
|
-
</script>
|
82
|
-
|
83
|
-
{#if asChild}
|
84
|
-
{@render asChild(mergedProps, datePicker)}
|
85
|
-
{:else}
|
86
|
-
<div bind:this={ref} {...mergedProps}>
|
87
|
-
{@render children?.(datePicker)}
|
88
|
-
</div>
|
89
|
-
{/if}
|
1
|
+
<script lang="ts" module>
|
2
|
+
import type {PresenceStrategyProps} from '../presence/create-presence.svelte.js';
|
3
|
+
import type {Assign, HtmlIngredientProps} from '../types.js';
|
4
|
+
import type {
|
5
|
+
CreateDatePickerProps,
|
6
|
+
CreateDatePickerReturn,
|
7
|
+
} from './create-date-picker.svelte.js';
|
8
|
+
|
9
|
+
export interface DatePickerProps
|
10
|
+
extends Assign<
|
11
|
+
HtmlIngredientProps<'div', HTMLDivElement, CreateDatePickerReturn>,
|
12
|
+
CreateDatePickerProps
|
13
|
+
>,
|
14
|
+
PresenceStrategyProps {}
|
15
|
+
</script>
|
16
|
+
|
17
|
+
<script lang="ts">
|
18
|
+
import {mergeProps} from '../merge-props.js';
|
19
|
+
import {createPresence} from '../presence/create-presence.svelte.js';
|
20
|
+
import {setPresenceContext} from '../presence/presence-context.svelte.js';
|
21
|
+
import {reflect} from '@zag-js/svelte';
|
22
|
+
import {createSplitProps} from '@zag-js/utils';
|
23
|
+
import {createDatePicker} from './create-date-picker.svelte.js';
|
24
|
+
import {setDatePickerContext} from './date-picker-context.svelte.js';
|
25
|
+
|
26
|
+
let {
|
27
|
+
ref = $bindable(null),
|
28
|
+
asChild,
|
29
|
+
children,
|
30
|
+
...props
|
31
|
+
}: DatePickerProps = $props();
|
32
|
+
|
33
|
+
let [presenceStrategyProps, rest] = $derived(
|
34
|
+
createSplitProps<PresenceStrategyProps>([])(props),
|
35
|
+
);
|
36
|
+
|
37
|
+
let [createDatePickerProps, localProps] = $derived(
|
38
|
+
createSplitProps<CreateDatePickerProps>([
|
39
|
+
'id',
|
40
|
+
'ids',
|
41
|
+
'min',
|
42
|
+
'max',
|
43
|
+
'name',
|
44
|
+
'open',
|
45
|
+
'openControlled',
|
46
|
+
'view',
|
47
|
+
'value',
|
48
|
+
'format',
|
49
|
+
'locale',
|
50
|
+
'disabled',
|
51
|
+
'readOnly',
|
52
|
+
'timeZone',
|
53
|
+
'fixedWeeks',
|
54
|
+
'startOfWeek',
|
55
|
+
'positioning',
|
56
|
+
'numOfMonths',
|
57
|
+
'translations',
|
58
|
+
'focusedValue',
|
59
|
+
'closeOnSelect',
|
60
|
+
'selectionMode',
|
61
|
+
'onViewChange',
|
62
|
+
'onOpenChange',
|
63
|
+
'onValueChange',
|
64
|
+
'onFocusChange',
|
65
|
+
'isDateUnavailable',
|
66
|
+
])(rest),
|
67
|
+
);
|
68
|
+
|
69
|
+
let datePicker = createDatePicker(reflect(() => createDatePickerProps));
|
70
|
+
let presence = createPresence(
|
71
|
+
reflect(() => ({
|
72
|
+
...presenceStrategyProps,
|
73
|
+
present: datePicker.open,
|
74
|
+
})),
|
75
|
+
);
|
76
|
+
|
77
|
+
let mergedProps = $derived(mergeProps(datePicker.getRootProps(), localProps));
|
78
|
+
|
79
|
+
setDatePickerContext(datePicker);
|
80
|
+
setPresenceContext(presence);
|
81
|
+
</script>
|
82
|
+
|
83
|
+
{#if asChild}
|
84
|
+
{@render asChild(mergedProps, datePicker)}
|
85
|
+
{:else}
|
86
|
+
<div bind:this={ref} {...mergedProps}>
|
87
|
+
{@render children?.(datePicker)}
|
88
|
+
</div>
|
89
|
+
{/if}
|
@@ -1,45 +1,45 @@
|
|
1
|
-
<script lang="ts" module>
|
2
|
-
import type {HtmlIngredientProps} from '../types.js';
|
3
|
-
import type {Action} from 'svelte/action';
|
4
|
-
|
5
|
-
export interface DialogBackdropProps
|
6
|
-
extends HtmlIngredientProps<'div', HTMLDivElement, never, Action> {}
|
7
|
-
</script>
|
8
|
-
|
9
|
-
<script lang="ts">
|
10
|
-
import {mergeProps} from '../merge-props.js';
|
11
|
-
import {createPresence} from '../presence/create-presence.svelte.js';
|
12
|
-
import {getPresenceStrategyPropsContext} from '../presence/presence-context.svelte.js';
|
13
|
-
import {reflect} from '@zag-js/svelte';
|
14
|
-
import {getDialogContext} from './dialog-context.svelte.js';
|
15
|
-
|
16
|
-
let {
|
17
|
-
ref = $bindable(null),
|
18
|
-
asChild,
|
19
|
-
children,
|
20
|
-
...props
|
21
|
-
}: DialogBackdropProps = $props();
|
22
|
-
|
23
|
-
let dialog = getDialogContext();
|
24
|
-
let presenceStrategyProps = getPresenceStrategyPropsContext();
|
25
|
-
let presence = createPresence(
|
26
|
-
reflect(() => ({
|
27
|
-
...presenceStrategyProps,
|
28
|
-
present: dialog.open,
|
29
|
-
})),
|
30
|
-
);
|
31
|
-
|
32
|
-
let mergedProps = $derived(
|
33
|
-
mergeProps(dialog.getBackdropProps(), presence.getPresenceProps(), props),
|
34
|
-
);
|
35
|
-
</script>
|
36
|
-
|
37
|
-
{#if presence.mounted}
|
38
|
-
{#if asChild}
|
39
|
-
{@render asChild(presence.setReference, mergedProps)}
|
40
|
-
{:else}
|
41
|
-
<div bind:this={ref} use:presence.setReference {...mergedProps}>
|
42
|
-
{@render children?.()}
|
43
|
-
</div>
|
44
|
-
{/if}
|
45
|
-
{/if}
|
1
|
+
<script lang="ts" module>
|
2
|
+
import type {HtmlIngredientProps} from '../types.js';
|
3
|
+
import type {Action} from 'svelte/action';
|
4
|
+
|
5
|
+
export interface DialogBackdropProps
|
6
|
+
extends HtmlIngredientProps<'div', HTMLDivElement, never, Action> {}
|
7
|
+
</script>
|
8
|
+
|
9
|
+
<script lang="ts">
|
10
|
+
import {mergeProps} from '../merge-props.js';
|
11
|
+
import {createPresence} from '../presence/create-presence.svelte.js';
|
12
|
+
import {getPresenceStrategyPropsContext} from '../presence/presence-context.svelte.js';
|
13
|
+
import {reflect} from '@zag-js/svelte';
|
14
|
+
import {getDialogContext} from './dialog-context.svelte.js';
|
15
|
+
|
16
|
+
let {
|
17
|
+
ref = $bindable(null),
|
18
|
+
asChild,
|
19
|
+
children,
|
20
|
+
...props
|
21
|
+
}: DialogBackdropProps = $props();
|
22
|
+
|
23
|
+
let dialog = getDialogContext();
|
24
|
+
let presenceStrategyProps = getPresenceStrategyPropsContext();
|
25
|
+
let presence = createPresence(
|
26
|
+
reflect(() => ({
|
27
|
+
...presenceStrategyProps,
|
28
|
+
present: dialog.open,
|
29
|
+
})),
|
30
|
+
);
|
31
|
+
|
32
|
+
let mergedProps = $derived(
|
33
|
+
mergeProps(dialog.getBackdropProps(), presence.getPresenceProps(), props),
|
34
|
+
);
|
35
|
+
</script>
|
36
|
+
|
37
|
+
{#if presence.mounted}
|
38
|
+
{#if asChild}
|
39
|
+
{@render asChild(presence.setReference, mergedProps)}
|
40
|
+
{:else}
|
41
|
+
<div bind:this={ref} use:presence.setReference {...mergedProps}>
|
42
|
+
{@render children?.()}
|
43
|
+
</div>
|
44
|
+
{/if}
|
45
|
+
{/if}
|
@@ -1,48 +1,48 @@
|
|
1
|
-
<script lang="ts" module>
|
2
|
-
import type {PresenceStrategyProps} from '../presence/create-presence.svelte.js';
|
3
|
-
import type {Snippet} from 'svelte';
|
4
|
-
import type {
|
5
|
-
CreateDialogProps,
|
6
|
-
CreateDialogReturn,
|
7
|
-
} from './create-dialog.svelte.js';
|
8
|
-
|
9
|
-
export interface DialogProps
|
10
|
-
extends CreateDialogProps,
|
11
|
-
PresenceStrategyProps {
|
12
|
-
children?: Snippet<[CreateDialogReturn]>;
|
13
|
-
}
|
14
|
-
</script>
|
15
|
-
|
16
|
-
<script lang="ts">
|
17
|
-
import {createPresence} from '../presence/create-presence.svelte.js';
|
18
|
-
import {
|
19
|
-
setPresenceContext,
|
20
|
-
setPresenceStrategyPropsContext,
|
21
|
-
} from '../presence/presence-context.svelte.js';
|
22
|
-
import {reflect} from '@zag-js/svelte';
|
23
|
-
import {createSplitProps} from '@zag-js/utils';
|
24
|
-
import {createDialog} from './create-dialog.svelte.js';
|
25
|
-
import {setDialogContext} from './dialog-context.svelte.js';
|
26
|
-
|
27
|
-
let {children, ...props}: DialogProps = $props();
|
28
|
-
|
29
|
-
let [presenceStrategyProps, createDialogProps] = $derived(
|
30
|
-
createSplitProps<PresenceStrategyProps>(['lazyMount', 'keepMounted'])(
|
31
|
-
props,
|
32
|
-
),
|
33
|
-
);
|
34
|
-
|
35
|
-
let dialog = createDialog(reflect(() => createDialogProps));
|
36
|
-
let presence = createPresence(
|
37
|
-
reflect(() => ({
|
38
|
-
...presenceStrategyProps,
|
39
|
-
present: dialog.open,
|
40
|
-
})),
|
41
|
-
);
|
42
|
-
|
43
|
-
setDialogContext(dialog);
|
44
|
-
setPresenceContext(presence);
|
45
|
-
setPresenceStrategyPropsContext(() => presenceStrategyProps);
|
46
|
-
</script>
|
47
|
-
|
48
|
-
{@render children?.(dialog)}
|
1
|
+
<script lang="ts" module>
|
2
|
+
import type {PresenceStrategyProps} from '../presence/create-presence.svelte.js';
|
3
|
+
import type {Snippet} from 'svelte';
|
4
|
+
import type {
|
5
|
+
CreateDialogProps,
|
6
|
+
CreateDialogReturn,
|
7
|
+
} from './create-dialog.svelte.js';
|
8
|
+
|
9
|
+
export interface DialogProps
|
10
|
+
extends CreateDialogProps,
|
11
|
+
PresenceStrategyProps {
|
12
|
+
children?: Snippet<[CreateDialogReturn]>;
|
13
|
+
}
|
14
|
+
</script>
|
15
|
+
|
16
|
+
<script lang="ts">
|
17
|
+
import {createPresence} from '../presence/create-presence.svelte.js';
|
18
|
+
import {
|
19
|
+
setPresenceContext,
|
20
|
+
setPresenceStrategyPropsContext,
|
21
|
+
} from '../presence/presence-context.svelte.js';
|
22
|
+
import {reflect} from '@zag-js/svelte';
|
23
|
+
import {createSplitProps} from '@zag-js/utils';
|
24
|
+
import {createDialog} from './create-dialog.svelte.js';
|
25
|
+
import {setDialogContext} from './dialog-context.svelte.js';
|
26
|
+
|
27
|
+
let {children, ...props}: DialogProps = $props();
|
28
|
+
|
29
|
+
let [presenceStrategyProps, createDialogProps] = $derived(
|
30
|
+
createSplitProps<PresenceStrategyProps>(['lazyMount', 'keepMounted'])(
|
31
|
+
props,
|
32
|
+
),
|
33
|
+
);
|
34
|
+
|
35
|
+
let dialog = createDialog(reflect(() => createDialogProps));
|
36
|
+
let presence = createPresence(
|
37
|
+
reflect(() => ({
|
38
|
+
...presenceStrategyProps,
|
39
|
+
present: dialog.open,
|
40
|
+
})),
|
41
|
+
);
|
42
|
+
|
43
|
+
setDialogContext(dialog);
|
44
|
+
setPresenceContext(presence);
|
45
|
+
setPresenceStrategyPropsContext(() => presenceStrategyProps);
|
46
|
+
</script>
|
47
|
+
|
48
|
+
{@render children?.(dialog)}
|