ui-ingredients 0.21.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 -51
- package/dist/steps/steps-content.svelte +55 -55
- package/dist/steps/steps-root.svelte +65 -65
- 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,59 +1,59 @@
|
|
1
|
-
<script lang="ts" module>
|
2
|
-
import type {Assign, HtmlIngredientProps} from '../types.js';
|
3
|
-
import type {
|
4
|
-
CreateCheckboxProps,
|
5
|
-
CreateCheckboxReturn,
|
6
|
-
} from './create-checkbox.svelte.js';
|
7
|
-
|
8
|
-
export interface CheckboxProps
|
9
|
-
extends Assign<
|
10
|
-
HtmlIngredientProps<'label', HTMLLabelElement, CreateCheckboxReturn>,
|
11
|
-
CreateCheckboxProps
|
12
|
-
> {}
|
13
|
-
</script>
|
14
|
-
|
15
|
-
<script lang="ts">
|
16
|
-
import {mergeProps} from '../merge-props.js';
|
17
|
-
import {createSplitProps} from '@zag-js/utils';
|
18
|
-
import {setCheckboxContext} from './checkbox-context.svelte.js';
|
19
|
-
import {createCheckbox} from './create-checkbox.svelte.js';
|
20
|
-
|
21
|
-
import {reflect} from '@zag-js/svelte';
|
22
|
-
|
23
|
-
let {
|
24
|
-
ref = $bindable(null),
|
25
|
-
asChild,
|
26
|
-
children,
|
27
|
-
...props
|
28
|
-
}: CheckboxProps = $props();
|
29
|
-
|
30
|
-
let [createCheckboxProps, localProps] = $derived(
|
31
|
-
createSplitProps<CreateCheckboxProps>([
|
32
|
-
'id',
|
33
|
-
'ids',
|
34
|
-
'form',
|
35
|
-
'name',
|
36
|
-
'value',
|
37
|
-
'checked',
|
38
|
-
'invalid',
|
39
|
-
'disabled',
|
40
|
-
'readOnly',
|
41
|
-
'required',
|
42
|
-
'onCheckedChange',
|
43
|
-
])(props),
|
44
|
-
);
|
45
|
-
|
46
|
-
let checkbox = createCheckbox(reflect(() => createCheckboxProps));
|
47
|
-
|
48
|
-
let mergedProps = $derived(mergeProps(checkbox.getRootProps(), localProps));
|
49
|
-
|
50
|
-
setCheckboxContext(checkbox);
|
51
|
-
</script>
|
52
|
-
|
53
|
-
{#if asChild}
|
54
|
-
{@render asChild(mergedProps, checkbox)}
|
55
|
-
{:else}
|
56
|
-
<label bind:this={ref} {...mergedProps}>
|
57
|
-
{@render children?.(checkbox)}
|
58
|
-
</label>
|
59
|
-
{/if}
|
1
|
+
<script lang="ts" module>
|
2
|
+
import type {Assign, HtmlIngredientProps} from '../types.js';
|
3
|
+
import type {
|
4
|
+
CreateCheckboxProps,
|
5
|
+
CreateCheckboxReturn,
|
6
|
+
} from './create-checkbox.svelte.js';
|
7
|
+
|
8
|
+
export interface CheckboxProps
|
9
|
+
extends Assign<
|
10
|
+
HtmlIngredientProps<'label', HTMLLabelElement, CreateCheckboxReturn>,
|
11
|
+
CreateCheckboxProps
|
12
|
+
> {}
|
13
|
+
</script>
|
14
|
+
|
15
|
+
<script lang="ts">
|
16
|
+
import {mergeProps} from '../merge-props.js';
|
17
|
+
import {createSplitProps} from '@zag-js/utils';
|
18
|
+
import {setCheckboxContext} from './checkbox-context.svelte.js';
|
19
|
+
import {createCheckbox} from './create-checkbox.svelte.js';
|
20
|
+
|
21
|
+
import {reflect} from '@zag-js/svelte';
|
22
|
+
|
23
|
+
let {
|
24
|
+
ref = $bindable(null),
|
25
|
+
asChild,
|
26
|
+
children,
|
27
|
+
...props
|
28
|
+
}: CheckboxProps = $props();
|
29
|
+
|
30
|
+
let [createCheckboxProps, localProps] = $derived(
|
31
|
+
createSplitProps<CreateCheckboxProps>([
|
32
|
+
'id',
|
33
|
+
'ids',
|
34
|
+
'form',
|
35
|
+
'name',
|
36
|
+
'value',
|
37
|
+
'checked',
|
38
|
+
'invalid',
|
39
|
+
'disabled',
|
40
|
+
'readOnly',
|
41
|
+
'required',
|
42
|
+
'onCheckedChange',
|
43
|
+
])(props),
|
44
|
+
);
|
45
|
+
|
46
|
+
let checkbox = createCheckbox(reflect(() => createCheckboxProps));
|
47
|
+
|
48
|
+
let mergedProps = $derived(mergeProps(checkbox.getRootProps(), localProps));
|
49
|
+
|
50
|
+
setCheckboxContext(checkbox);
|
51
|
+
</script>
|
52
|
+
|
53
|
+
{#if asChild}
|
54
|
+
{@render asChild(mergedProps, checkbox)}
|
55
|
+
{:else}
|
56
|
+
<label bind:this={ref} {...mergedProps}>
|
57
|
+
{@render children?.(checkbox)}
|
58
|
+
</label>
|
59
|
+
{/if}
|
@@ -1,52 +1,52 @@
|
|
1
|
-
<script lang="ts" module>
|
2
|
-
import type {Assign, HtmlIngredientProps} from '../types.js';
|
3
|
-
import type {
|
4
|
-
CreateClipboardProps,
|
5
|
-
CreateClipboardReturn,
|
6
|
-
} from './create-clipboard.svelte.js';
|
7
|
-
|
8
|
-
export interface ClipboardProps
|
9
|
-
extends Assign<
|
10
|
-
HtmlIngredientProps<'div', HTMLDivElement, CreateClipboardReturn>,
|
11
|
-
CreateClipboardProps
|
12
|
-
> {}
|
13
|
-
</script>
|
14
|
-
|
15
|
-
<script lang="ts">
|
16
|
-
import {mergeProps} from '../merge-props.js';
|
17
|
-
import {reflect} from '@zag-js/svelte';
|
18
|
-
import {createSplitProps} from '@zag-js/utils';
|
19
|
-
import {setClipboardContext} from './clipboard-context.svelte.js';
|
20
|
-
import {createClipboard} from './create-clipboard.svelte.js';
|
21
|
-
|
22
|
-
let {
|
23
|
-
ref = $bindable(null),
|
24
|
-
asChild,
|
25
|
-
children,
|
26
|
-
...props
|
27
|
-
}: ClipboardProps = $props();
|
28
|
-
|
29
|
-
let [createClipboardProps, localProps] = $derived(
|
30
|
-
createSplitProps<CreateClipboardProps>([
|
31
|
-
'id',
|
32
|
-
'ids',
|
33
|
-
'value',
|
34
|
-
'timeout',
|
35
|
-
'onStatusChange',
|
36
|
-
])(props),
|
37
|
-
);
|
38
|
-
|
39
|
-
let clipboard = createClipboard(reflect(() => createClipboardProps));
|
40
|
-
|
41
|
-
let mergedProps = $derived(mergeProps(clipboard.getRootProps(), localProps));
|
42
|
-
|
43
|
-
setClipboardContext(clipboard);
|
44
|
-
</script>
|
45
|
-
|
46
|
-
{#if asChild}
|
47
|
-
{@render asChild(mergedProps, clipboard)}
|
48
|
-
{:else}
|
49
|
-
<div bind:this={ref} {...mergedProps}>
|
50
|
-
{@render children?.(clipboard)}
|
51
|
-
</div>
|
52
|
-
{/if}
|
1
|
+
<script lang="ts" module>
|
2
|
+
import type {Assign, HtmlIngredientProps} from '../types.js';
|
3
|
+
import type {
|
4
|
+
CreateClipboardProps,
|
5
|
+
CreateClipboardReturn,
|
6
|
+
} from './create-clipboard.svelte.js';
|
7
|
+
|
8
|
+
export interface ClipboardProps
|
9
|
+
extends Assign<
|
10
|
+
HtmlIngredientProps<'div', HTMLDivElement, CreateClipboardReturn>,
|
11
|
+
CreateClipboardProps
|
12
|
+
> {}
|
13
|
+
</script>
|
14
|
+
|
15
|
+
<script lang="ts">
|
16
|
+
import {mergeProps} from '../merge-props.js';
|
17
|
+
import {reflect} from '@zag-js/svelte';
|
18
|
+
import {createSplitProps} from '@zag-js/utils';
|
19
|
+
import {setClipboardContext} from './clipboard-context.svelte.js';
|
20
|
+
import {createClipboard} from './create-clipboard.svelte.js';
|
21
|
+
|
22
|
+
let {
|
23
|
+
ref = $bindable(null),
|
24
|
+
asChild,
|
25
|
+
children,
|
26
|
+
...props
|
27
|
+
}: ClipboardProps = $props();
|
28
|
+
|
29
|
+
let [createClipboardProps, localProps] = $derived(
|
30
|
+
createSplitProps<CreateClipboardProps>([
|
31
|
+
'id',
|
32
|
+
'ids',
|
33
|
+
'value',
|
34
|
+
'timeout',
|
35
|
+
'onStatusChange',
|
36
|
+
])(props),
|
37
|
+
);
|
38
|
+
|
39
|
+
let clipboard = createClipboard(reflect(() => createClipboardProps));
|
40
|
+
|
41
|
+
let mergedProps = $derived(mergeProps(clipboard.getRootProps(), localProps));
|
42
|
+
|
43
|
+
setClipboardContext(clipboard);
|
44
|
+
</script>
|
45
|
+
|
46
|
+
{#if asChild}
|
47
|
+
{@render asChild(mergedProps, clipboard)}
|
48
|
+
{:else}
|
49
|
+
<div bind:this={ref} {...mergedProps}>
|
50
|
+
{@render children?.(clipboard)}
|
51
|
+
</div>
|
52
|
+
{/if}
|
@@ -1,75 +1,75 @@
|
|
1
|
-
<script lang="ts" module>
|
2
|
-
import {
|
3
|
-
createPresence,
|
4
|
-
type PresenceStrategyProps,
|
5
|
-
} from '../presence/create-presence.svelte.js';
|
6
|
-
import type {Assign, HtmlIngredientProps} from '../types.js';
|
7
|
-
import type {
|
8
|
-
CreateCollapsibleProps,
|
9
|
-
CreateCollapsibleReturn,
|
10
|
-
} from './create-collapsible.svelte.js';
|
11
|
-
|
12
|
-
export interface CollapsibleProps
|
13
|
-
extends Assign<
|
14
|
-
HtmlIngredientProps<'div', HTMLDivElement, CreateCollapsibleReturn>,
|
15
|
-
CreateCollapsibleProps
|
16
|
-
>,
|
17
|
-
PresenceStrategyProps {}
|
18
|
-
</script>
|
19
|
-
|
20
|
-
<script lang="ts">
|
21
|
-
import {mergeProps} from '../merge-props.js';
|
22
|
-
import {setPresenceContext} from '../presence/presence-context.svelte.js';
|
23
|
-
import {reflect} from '@zag-js/svelte';
|
24
|
-
import {createSplitProps} from '@zag-js/utils';
|
25
|
-
import {setCollapsibleContext} from './collapsible-context.svelte.js';
|
26
|
-
import {createCollapsible} from './create-collapsible.svelte.js';
|
27
|
-
|
28
|
-
let {
|
29
|
-
ref = $bindable(null),
|
30
|
-
asChild,
|
31
|
-
children,
|
32
|
-
...props
|
33
|
-
}: CollapsibleProps = $props();
|
34
|
-
|
35
|
-
let [presenceStrategyProps, rest] = $derived(
|
36
|
-
createSplitProps<PresenceStrategyProps>(['lazyMount', 'keepMounted'])(
|
37
|
-
props,
|
38
|
-
),
|
39
|
-
);
|
40
|
-
|
41
|
-
let [createCollapsibleProps, localProps] = $derived(
|
42
|
-
createSplitProps<CreateCollapsibleProps>([
|
43
|
-
'id',
|
44
|
-
'ids',
|
45
|
-
'open',
|
46
|
-
'openControlled',
|
47
|
-
'disabled',
|
48
|
-
'onOpenChange',
|
49
|
-
'onExitComplete',
|
50
|
-
])(rest),
|
51
|
-
);
|
52
|
-
|
53
|
-
let collapsible = createCollapsible(reflect(() => createCollapsibleProps));
|
54
|
-
let presence = createPresence(
|
55
|
-
reflect(() => ({
|
56
|
-
present: collapsible.open,
|
57
|
-
...presenceStrategyProps,
|
58
|
-
})),
|
59
|
-
);
|
60
|
-
|
61
|
-
let mergedProps = $derived(
|
62
|
-
mergeProps(collapsible.getRootProps(), localProps),
|
63
|
-
);
|
64
|
-
|
65
|
-
setCollapsibleContext(collapsible);
|
66
|
-
setPresenceContext(presence);
|
67
|
-
</script>
|
68
|
-
|
69
|
-
{#if asChild}
|
70
|
-
{@render asChild(mergedProps, collapsible)}
|
71
|
-
{:else}
|
72
|
-
<div bind:this={ref} {...mergedProps}>
|
73
|
-
{@render children?.(collapsible)}
|
74
|
-
</div>
|
75
|
-
{/if}
|
1
|
+
<script lang="ts" module>
|
2
|
+
import {
|
3
|
+
createPresence,
|
4
|
+
type PresenceStrategyProps,
|
5
|
+
} from '../presence/create-presence.svelte.js';
|
6
|
+
import type {Assign, HtmlIngredientProps} from '../types.js';
|
7
|
+
import type {
|
8
|
+
CreateCollapsibleProps,
|
9
|
+
CreateCollapsibleReturn,
|
10
|
+
} from './create-collapsible.svelte.js';
|
11
|
+
|
12
|
+
export interface CollapsibleProps
|
13
|
+
extends Assign<
|
14
|
+
HtmlIngredientProps<'div', HTMLDivElement, CreateCollapsibleReturn>,
|
15
|
+
CreateCollapsibleProps
|
16
|
+
>,
|
17
|
+
PresenceStrategyProps {}
|
18
|
+
</script>
|
19
|
+
|
20
|
+
<script lang="ts">
|
21
|
+
import {mergeProps} from '../merge-props.js';
|
22
|
+
import {setPresenceContext} from '../presence/presence-context.svelte.js';
|
23
|
+
import {reflect} from '@zag-js/svelte';
|
24
|
+
import {createSplitProps} from '@zag-js/utils';
|
25
|
+
import {setCollapsibleContext} from './collapsible-context.svelte.js';
|
26
|
+
import {createCollapsible} from './create-collapsible.svelte.js';
|
27
|
+
|
28
|
+
let {
|
29
|
+
ref = $bindable(null),
|
30
|
+
asChild,
|
31
|
+
children,
|
32
|
+
...props
|
33
|
+
}: CollapsibleProps = $props();
|
34
|
+
|
35
|
+
let [presenceStrategyProps, rest] = $derived(
|
36
|
+
createSplitProps<PresenceStrategyProps>(['lazyMount', 'keepMounted'])(
|
37
|
+
props,
|
38
|
+
),
|
39
|
+
);
|
40
|
+
|
41
|
+
let [createCollapsibleProps, localProps] = $derived(
|
42
|
+
createSplitProps<CreateCollapsibleProps>([
|
43
|
+
'id',
|
44
|
+
'ids',
|
45
|
+
'open',
|
46
|
+
'openControlled',
|
47
|
+
'disabled',
|
48
|
+
'onOpenChange',
|
49
|
+
'onExitComplete',
|
50
|
+
])(rest),
|
51
|
+
);
|
52
|
+
|
53
|
+
let collapsible = createCollapsible(reflect(() => createCollapsibleProps));
|
54
|
+
let presence = createPresence(
|
55
|
+
reflect(() => ({
|
56
|
+
present: collapsible.open,
|
57
|
+
...presenceStrategyProps,
|
58
|
+
})),
|
59
|
+
);
|
60
|
+
|
61
|
+
let mergedProps = $derived(
|
62
|
+
mergeProps(collapsible.getRootProps(), localProps),
|
63
|
+
);
|
64
|
+
|
65
|
+
setCollapsibleContext(collapsible);
|
66
|
+
setPresenceContext(presence);
|
67
|
+
</script>
|
68
|
+
|
69
|
+
{#if asChild}
|
70
|
+
{@render asChild(mergedProps, collapsible)}
|
71
|
+
{:else}
|
72
|
+
<div bind:this={ref} {...mergedProps}>
|
73
|
+
{@render children?.(collapsible)}
|
74
|
+
</div>
|
75
|
+
{/if}
|
@@ -1,87 +1,87 @@
|
|
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
|
-
CreateColorPickerProps,
|
6
|
-
CreateColorPickerReturn,
|
7
|
-
} from './create-color-picker.svelte.js';
|
8
|
-
|
9
|
-
export interface ColorPickerProps
|
10
|
-
extends Assign<
|
11
|
-
HtmlIngredientProps<'div', HTMLDivElement, CreateColorPickerReturn>,
|
12
|
-
CreateColorPickerProps
|
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 {setColorPickerContext} from './color-picker-context.svelte.js';
|
24
|
-
import {createColorPicker} from './create-color-picker.svelte.js';
|
25
|
-
|
26
|
-
let {
|
27
|
-
ref = $bindable(null),
|
28
|
-
asChild,
|
29
|
-
children,
|
30
|
-
...props
|
31
|
-
}: ColorPickerProps = $props();
|
32
|
-
|
33
|
-
let [presenceProps, etc] = $derived(
|
34
|
-
createSplitProps<PresenceStrategyProps>(['lazyMount', 'keepMounted'])(
|
35
|
-
props,
|
36
|
-
),
|
37
|
-
);
|
38
|
-
|
39
|
-
let [createColorPickerProps, localProps] = $derived(
|
40
|
-
createSplitProps<CreateColorPickerProps>([
|
41
|
-
'id',
|
42
|
-
'ids',
|
43
|
-
'open',
|
44
|
-
'openControlled',
|
45
|
-
'name',
|
46
|
-
'value',
|
47
|
-
'format',
|
48
|
-
'disabled',
|
49
|
-
'required',
|
50
|
-
'readOnly',
|
51
|
-
'positioning',
|
52
|
-
'onOpenChange',
|
53
|
-
'closeOnSelect',
|
54
|
-
'initialFocusEl',
|
55
|
-
'onValueChange',
|
56
|
-
'onValueChangeEnd',
|
57
|
-
'onFocusOutside',
|
58
|
-
'onFormatChange',
|
59
|
-
'onInteractOutside',
|
60
|
-
'onPointerDownOutside',
|
61
|
-
])(etc),
|
62
|
-
);
|
63
|
-
|
64
|
-
let colorPicker = createColorPicker(reflect(() => createColorPickerProps));
|
65
|
-
|
66
|
-
let presence = createPresence(
|
67
|
-
reflect(() => ({
|
68
|
-
present: colorPicker.open,
|
69
|
-
...presenceProps,
|
70
|
-
})),
|
71
|
-
);
|
72
|
-
|
73
|
-
let mergedProps = $derived(
|
74
|
-
mergeProps(colorPicker.getRootProps(), localProps),
|
75
|
-
);
|
76
|
-
|
77
|
-
setColorPickerContext(colorPicker);
|
78
|
-
setPresenceContext(presence);
|
79
|
-
</script>
|
80
|
-
|
81
|
-
{#if asChild}
|
82
|
-
{@render asChild(mergedProps, colorPicker)}
|
83
|
-
{:else}
|
84
|
-
<div bind:this={ref} {...mergedProps}>
|
85
|
-
{@render children?.(colorPicker)}
|
86
|
-
</div>
|
87
|
-
{/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
|
+
CreateColorPickerProps,
|
6
|
+
CreateColorPickerReturn,
|
7
|
+
} from './create-color-picker.svelte.js';
|
8
|
+
|
9
|
+
export interface ColorPickerProps
|
10
|
+
extends Assign<
|
11
|
+
HtmlIngredientProps<'div', HTMLDivElement, CreateColorPickerReturn>,
|
12
|
+
CreateColorPickerProps
|
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 {setColorPickerContext} from './color-picker-context.svelte.js';
|
24
|
+
import {createColorPicker} from './create-color-picker.svelte.js';
|
25
|
+
|
26
|
+
let {
|
27
|
+
ref = $bindable(null),
|
28
|
+
asChild,
|
29
|
+
children,
|
30
|
+
...props
|
31
|
+
}: ColorPickerProps = $props();
|
32
|
+
|
33
|
+
let [presenceProps, etc] = $derived(
|
34
|
+
createSplitProps<PresenceStrategyProps>(['lazyMount', 'keepMounted'])(
|
35
|
+
props,
|
36
|
+
),
|
37
|
+
);
|
38
|
+
|
39
|
+
let [createColorPickerProps, localProps] = $derived(
|
40
|
+
createSplitProps<CreateColorPickerProps>([
|
41
|
+
'id',
|
42
|
+
'ids',
|
43
|
+
'open',
|
44
|
+
'openControlled',
|
45
|
+
'name',
|
46
|
+
'value',
|
47
|
+
'format',
|
48
|
+
'disabled',
|
49
|
+
'required',
|
50
|
+
'readOnly',
|
51
|
+
'positioning',
|
52
|
+
'onOpenChange',
|
53
|
+
'closeOnSelect',
|
54
|
+
'initialFocusEl',
|
55
|
+
'onValueChange',
|
56
|
+
'onValueChangeEnd',
|
57
|
+
'onFocusOutside',
|
58
|
+
'onFormatChange',
|
59
|
+
'onInteractOutside',
|
60
|
+
'onPointerDownOutside',
|
61
|
+
])(etc),
|
62
|
+
);
|
63
|
+
|
64
|
+
let colorPicker = createColorPicker(reflect(() => createColorPickerProps));
|
65
|
+
|
66
|
+
let presence = createPresence(
|
67
|
+
reflect(() => ({
|
68
|
+
present: colorPicker.open,
|
69
|
+
...presenceProps,
|
70
|
+
})),
|
71
|
+
);
|
72
|
+
|
73
|
+
let mergedProps = $derived(
|
74
|
+
mergeProps(colorPicker.getRootProps(), localProps),
|
75
|
+
);
|
76
|
+
|
77
|
+
setColorPickerContext(colorPicker);
|
78
|
+
setPresenceContext(presence);
|
79
|
+
</script>
|
80
|
+
|
81
|
+
{#if asChild}
|
82
|
+
{@render asChild(mergedProps, colorPicker)}
|
83
|
+
{:else}
|
84
|
+
<div bind:this={ref} {...mergedProps}>
|
85
|
+
{@render children?.(colorPicker)}
|
86
|
+
</div>
|
87
|
+
{/if}
|