ui-ingredients 0.0.53 → 0.0.54
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/accordion/accordion-root.svelte +2 -2
- package/dist/avatar/avatar-root.svelte +2 -2
- package/dist/carousel/carousel-root.svelte +2 -2
- package/dist/checkbox/checkbox-root.svelte +2 -2
- package/dist/clipboard/clipboard-root.svelte +2 -2
- package/dist/collapsible/collapsible-root.svelte +2 -2
- package/dist/color-picker/color-picker-anatomy.d.ts +2 -0
- package/dist/color-picker/color-picker-anatomy.js +3 -0
- package/dist/color-picker/color-picker-channel-slider-label.svelte +3 -6
- package/dist/color-picker/color-picker-channel-slider-thumb.svelte +8 -2
- package/dist/color-picker/color-picker-channel-slider-track.svelte +8 -2
- package/dist/color-picker/color-picker-channel-slider-value-text.svelte +4 -10
- package/dist/color-picker/color-picker-channel-slider.svelte +12 -10
- package/dist/color-picker/color-picker-channel-slider.svelte.d.ts +2 -2
- package/dist/color-picker/color-picker-content.svelte +8 -6
- package/dist/color-picker/color-picker-context.svelte.d.ts +10 -2
- package/dist/color-picker/color-picker-context.svelte.js +1 -1
- package/dist/color-picker/color-picker-format-select.svelte +4 -4
- package/dist/color-picker/color-picker-root.svelte +21 -11
- package/dist/color-picker/color-picker-root.svelte.d.ts +2 -1
- package/dist/color-picker/color-picker-swatch-trigger.svelte +4 -7
- package/dist/color-picker/color-picker-swatch-trigger.svelte.d.ts +1 -1
- package/dist/color-picker/color-picker-transparency-grid.svelte +1 -6
- package/dist/color-picker/color-picker-value-swatch.svelte +41 -0
- package/dist/color-picker/color-picker-value-swatch.svelte.d.ts +22 -0
- package/dist/color-picker/color-picker-view.svelte +41 -0
- package/dist/color-picker/color-picker-view.svelte.d.ts +23 -0
- package/dist/color-picker/color-picker.d.ts +2 -0
- package/dist/color-picker/color-picker.js +2 -0
- package/dist/color-picker/create-color-picker.svelte.d.ts +11 -1
- package/dist/color-picker/create-color-picker.svelte.js +31 -2
- package/dist/color-picker/index.d.ts +3 -1
- package/dist/color-picker/index.js +1 -1
- package/dist/combobox/combobox-input.svelte +3 -1
- package/dist/combobox/combobox-root.svelte +2 -2
- package/dist/date-picker/date-picker-anatomy.d.ts +2 -2
- package/dist/date-picker/date-picker-month-select.svelte +6 -18
- package/dist/date-picker/date-picker-month-select.svelte.d.ts +1 -0
- package/dist/date-picker/date-picker-root.svelte +2 -2
- package/dist/date-picker/date-picker-year-select.svelte +2 -17
- package/dist/dialog/dialog-root.svelte +2 -2
- package/dist/editable/editable-root.svelte +2 -2
- package/dist/field/field-root.svelte +2 -2
- package/dist/file-upload/file-upload-root.svelte +2 -2
- package/dist/floating-panel/floating-panel-root.svelte +4 -2
- package/dist/highlight/highlight.svelte +2 -2
- package/dist/hover-card/hover-card-root.svelte +2 -2
- package/dist/number-input/number-input-root.svelte +2 -2
- package/dist/pagination/pagination-root.svelte +2 -2
- package/dist/pin-input/pin-input-root.svelte +2 -2
- package/dist/popover/popover-root.svelte +2 -2
- package/dist/presence/presence.svelte +2 -2
- package/dist/progress/progress-root.svelte +2 -2
- package/dist/qr-code/qr-code-root.svelte +2 -2
- package/dist/radio-group/radio-group-root.svelte +2 -2
- package/dist/rating-group/rating-group-root.svelte +2 -2
- package/dist/segment-group/segment-group-root.svelte +2 -2
- package/dist/select/select-root.svelte +2 -2
- package/dist/signature-pad/signature-pad-root.svelte +2 -2
- package/dist/slider/slider-root.svelte +2 -2
- package/dist/splitter/splitter-root.svelte +2 -2
- package/dist/steps/steps-root.svelte +2 -2
- package/dist/switch/switch-root.svelte +2 -2
- package/dist/tabs/tabs-root.svelte +2 -2
- package/dist/tags-input/tags-input-root.svelte +2 -2
- package/dist/time-picker/time-picker-root.svelte +2 -2
- package/dist/timer/timer-root.svelte +2 -2
- package/dist/toggle-group/toggle-group-root.svelte +2 -2
- package/dist/tooltip/tooltip-root.svelte +2 -2
- package/dist/tour/tour-root.svelte +2 -2
- package/dist/tree-view/tree-view-root.svelte +2 -2
- package/package.json +53 -53
@@ -30,7 +30,7 @@
|
|
30
30
|
),
|
31
31
|
);
|
32
32
|
|
33
|
-
let [
|
33
|
+
let [createAccordionProps, localProps] = $derived(
|
34
34
|
createSplitProps<CreateAccordionProps>([
|
35
35
|
'id',
|
36
36
|
'ids',
|
@@ -44,7 +44,7 @@
|
|
44
44
|
])(rest),
|
45
45
|
);
|
46
46
|
|
47
|
-
let accordion = createAccordion(reflect(() =>
|
47
|
+
let accordion = createAccordion(reflect(() => createAccordionProps));
|
48
48
|
|
49
49
|
let mergedProps = $derived(mergeProps(localProps, accordion.getRootProps()));
|
50
50
|
|
@@ -21,11 +21,11 @@
|
|
21
21
|
|
22
22
|
let {this: e, asChild, children, ...props}: AvatarProps = $props();
|
23
23
|
|
24
|
-
let [
|
24
|
+
let [createAvatarProps, localProps] = $derived(
|
25
25
|
createSplitProps<CreateAvatarProps>(['id', 'ids', 'onStatusChange'])(props),
|
26
26
|
);
|
27
27
|
|
28
|
-
let avatar = createAvatar(reflect(() =>
|
28
|
+
let avatar = createAvatar(reflect(() => createAvatarProps));
|
29
29
|
|
30
30
|
let mergedProps = $derived(mergeProps(localProps, avatar.getRootProps()));
|
31
31
|
|
@@ -21,7 +21,7 @@
|
|
21
21
|
|
22
22
|
let {this: e, asChild, children, ...props}: CarouselProps = $props();
|
23
23
|
|
24
|
-
let [
|
24
|
+
let [createCarouselProps, localProps] = $derived(
|
25
25
|
createSplitProps<CreateCarouselProps>([
|
26
26
|
'id',
|
27
27
|
'ids',
|
@@ -35,7 +35,7 @@
|
|
35
35
|
])(props),
|
36
36
|
);
|
37
37
|
|
38
|
-
let carousel = createCarousel(reflect(() =>
|
38
|
+
let carousel = createCarousel(reflect(() => createCarouselProps));
|
39
39
|
|
40
40
|
let mergedProps = $derived(mergeProps(localProps, carousel.getRootProps()));
|
41
41
|
|
@@ -22,7 +22,7 @@
|
|
22
22
|
|
23
23
|
let {this: e, asChild, children, ...props}: CheckboxProps = $props();
|
24
24
|
|
25
|
-
let [
|
25
|
+
let [createCheckboxProps, localProps] = $derived(
|
26
26
|
createSplitProps<CreateCheckboxProps>([
|
27
27
|
'id',
|
28
28
|
'ids',
|
@@ -38,7 +38,7 @@
|
|
38
38
|
])(props),
|
39
39
|
);
|
40
40
|
|
41
|
-
let checkbox = createCheckbox(reflect(() =>
|
41
|
+
let checkbox = createCheckbox(reflect(() => createCheckboxProps));
|
42
42
|
|
43
43
|
let mergedProps = $derived(mergeProps(localProps, checkbox.getRootProps()));
|
44
44
|
|
@@ -21,7 +21,7 @@
|
|
21
21
|
|
22
22
|
let {this: e, asChild, children, ...props}: ClipboardProps = $props();
|
23
23
|
|
24
|
-
let [
|
24
|
+
let [createClipboardProps, localProps] = $derived(
|
25
25
|
createSplitProps<CreateClipboardProps>([
|
26
26
|
'id',
|
27
27
|
'ids',
|
@@ -31,7 +31,7 @@
|
|
31
31
|
])(props),
|
32
32
|
);
|
33
33
|
|
34
|
-
let clipboard = createClipboard(reflect(() =>
|
34
|
+
let clipboard = createClipboard(reflect(() => createClipboardProps));
|
35
35
|
|
36
36
|
let mergedProps = $derived(mergeProps(localProps, clipboard.getRootProps()));
|
37
37
|
|
@@ -21,7 +21,7 @@
|
|
21
21
|
|
22
22
|
let {this: e, asChild, children, ...props}: CollapsibleProps = $props();
|
23
23
|
|
24
|
-
let [
|
24
|
+
let [createCollapsibleProps, localProps] = $derived(
|
25
25
|
createSplitProps<CreateCollapsibleProps>([
|
26
26
|
'id',
|
27
27
|
'ids',
|
@@ -33,7 +33,7 @@
|
|
33
33
|
])(props),
|
34
34
|
);
|
35
35
|
|
36
|
-
let collapsible = createCollapsible(reflect(() =>
|
36
|
+
let collapsible = createCollapsible(reflect(() => createCollapsibleProps));
|
37
37
|
|
38
38
|
let mergedProps = $derived(
|
39
39
|
mergeProps(localProps, collapsible.getRootProps()),
|
@@ -0,0 +1,2 @@
|
|
1
|
+
export declare const anatomy: import("@zag-js/anatomy").AnatomyInstance<"area" | "label" | "view" | "root" | "control" | "content" | "trigger" | "positioner" | "areaThumb" | "valueText" | "areaBackground" | "channelSlider" | "channelSliderLabel" | "channelSliderTrack" | "channelSliderThumb" | "channelSliderValueText" | "channelInput" | "transparencyGrid" | "swatchGroup" | "swatchTrigger" | "swatchIndicator" | "swatch" | "eyeDropperTrigger" | "formatTrigger" | "formatSelect">;
|
2
|
+
export declare const parts: Record<"area" | "label" | "view" | "root" | "control" | "content" | "trigger" | "positioner" | "areaThumb" | "valueText" | "areaBackground" | "channelSlider" | "channelSliderLabel" | "channelSliderTrack" | "channelSliderThumb" | "channelSliderValueText" | "channelInput" | "transparencyGrid" | "swatchGroup" | "swatchTrigger" | "swatchIndicator" | "swatch" | "eyeDropperTrigger" | "formatTrigger" | "formatSelect", import("@zag-js/anatomy").AnatomyPart>;
|
@@ -9,7 +9,7 @@
|
|
9
9
|
<script lang="ts">
|
10
10
|
import {mergeProps} from '../merge-props.js';
|
11
11
|
import {
|
12
|
-
|
12
|
+
getColorPickerChannelPropsContext,
|
13
13
|
getColorPickerContext,
|
14
14
|
} from './color-picker-context.svelte.js';
|
15
15
|
|
@@ -23,13 +23,10 @@
|
|
23
23
|
}: ColorPickerChannelSliderLabelProps = $props();
|
24
24
|
|
25
25
|
let colorPicker = getColorPickerContext();
|
26
|
-
let
|
26
|
+
let channelProps = getColorPickerChannelPropsContext();
|
27
27
|
|
28
28
|
let mergedProps = $derived(
|
29
|
-
mergeProps(
|
30
|
-
props,
|
31
|
-
colorPicker.getChannelSliderLabelProps(channelSliderProps),
|
32
|
-
),
|
29
|
+
mergeProps(props, colorPicker.getChannelSliderLabelProps(channelProps)),
|
33
30
|
);
|
34
31
|
</script>
|
35
32
|
|
@@ -8,8 +8,9 @@
|
|
8
8
|
<script lang="ts">
|
9
9
|
import {mergeProps} from '../merge-props.js';
|
10
10
|
import {
|
11
|
-
|
11
|
+
getColorPickerChannelPropsContext,
|
12
12
|
getColorPickerContext,
|
13
|
+
getColorPickerFormatPropsContext,
|
13
14
|
} from './color-picker-context.svelte.js';
|
14
15
|
|
15
16
|
let {
|
@@ -20,7 +21,12 @@
|
|
20
21
|
}: ColorPickerChannelSliderThumbProps = $props();
|
21
22
|
|
22
23
|
let colorPicker = getColorPickerContext();
|
23
|
-
let
|
24
|
+
let formatProps = getColorPickerFormatPropsContext();
|
25
|
+
let channelProps = getColorPickerChannelPropsContext();
|
26
|
+
let channelSliderProps = $derived({
|
27
|
+
...formatProps,
|
28
|
+
...channelProps,
|
29
|
+
});
|
24
30
|
|
25
31
|
let mergedProps = $derived(
|
26
32
|
mergeProps(
|
@@ -8,8 +8,9 @@
|
|
8
8
|
<script lang="ts">
|
9
9
|
import {mergeProps} from '../merge-props.js';
|
10
10
|
import {
|
11
|
-
|
11
|
+
getColorPickerChannelPropsContext,
|
12
12
|
getColorPickerContext,
|
13
|
+
getColorPickerFormatPropsContext,
|
13
14
|
} from './color-picker-context.svelte.js';
|
14
15
|
|
15
16
|
let {
|
@@ -20,7 +21,12 @@
|
|
20
21
|
}: ColorPickerChannelSliderTrackProps = $props();
|
21
22
|
|
22
23
|
let colorPicker = getColorPickerContext();
|
23
|
-
let
|
24
|
+
let formatProps = getColorPickerFormatPropsContext();
|
25
|
+
let channelProps = getColorPickerChannelPropsContext();
|
26
|
+
let channelSliderProps = $derived({
|
27
|
+
...formatProps,
|
28
|
+
...channelProps,
|
29
|
+
});
|
24
30
|
|
25
31
|
let mergedProps = $derived(
|
26
32
|
mergeProps(
|
@@ -9,7 +9,7 @@
|
|
9
9
|
import {getLocaleContext} from '../locale-provider/local-provider-context.svelte.js';
|
10
10
|
import {mergeProps} from '../merge-props.js';
|
11
11
|
import {
|
12
|
-
|
12
|
+
getColorPickerChannelPropsContext,
|
13
13
|
getColorPickerContext,
|
14
14
|
} from './color-picker-context.svelte.js';
|
15
15
|
|
@@ -22,13 +22,10 @@
|
|
22
22
|
|
23
23
|
let locale = getLocaleContext();
|
24
24
|
let colorPicker = getColorPickerContext();
|
25
|
-
let
|
25
|
+
let channelProps = getColorPickerChannelPropsContext();
|
26
26
|
|
27
27
|
let mergedProps = $derived(
|
28
|
-
mergeProps(
|
29
|
-
props,
|
30
|
-
colorPicker.getChannelSliderValueTextProps(channelSliderProps),
|
31
|
-
),
|
28
|
+
mergeProps(props, colorPicker.getChannelSliderValueTextProps(channelProps)),
|
32
29
|
);
|
33
30
|
</script>
|
34
31
|
|
@@ -39,10 +36,7 @@
|
|
39
36
|
{#if children}
|
40
37
|
{@render children()}
|
41
38
|
{:else}
|
42
|
-
{colorPicker.getChannelValueText(
|
43
|
-
channelSliderProps.channel,
|
44
|
-
locale.locale,
|
45
|
-
)}
|
39
|
+
{colorPicker.getChannelValueText(channelProps.channel, locale.locale)}
|
46
40
|
{/if}
|
47
41
|
</div>
|
48
42
|
{/if}
|
@@ -1,24 +1,21 @@
|
|
1
1
|
<script lang="ts" module>
|
2
2
|
import type {Assign, HtmlIngredientProps} from '../types.js';
|
3
|
-
import type {
|
3
|
+
import type {ChannelProps} from '@zag-js/color-picker';
|
4
4
|
|
5
5
|
export interface ColorPickerChannelSliderProps
|
6
|
-
extends Assign<
|
7
|
-
HtmlIngredientProps<'div', HTMLDivElement>,
|
8
|
-
ChannelSliderProps
|
9
|
-
> {}
|
6
|
+
extends Assign<HtmlIngredientProps<'div', HTMLDivElement>, ChannelProps> {}
|
10
7
|
</script>
|
11
8
|
|
12
9
|
<script lang="ts">
|
13
10
|
import {mergeProps} from '../merge-props.js';
|
14
11
|
import {
|
15
12
|
getColorPickerContext,
|
16
|
-
|
13
|
+
getColorPickerFormatPropsContext,
|
14
|
+
setColorPickerChannelPropsContext,
|
17
15
|
} from './color-picker-context.svelte.js';
|
18
16
|
|
19
17
|
let {
|
20
18
|
this: e,
|
21
|
-
format,
|
22
19
|
channel,
|
23
20
|
orientation,
|
24
21
|
asChild,
|
@@ -27,17 +24,22 @@
|
|
27
24
|
}: ColorPickerChannelSliderProps = $props();
|
28
25
|
|
29
26
|
let colorPicker = getColorPickerContext();
|
30
|
-
let
|
31
|
-
|
27
|
+
let formatProps = getColorPickerFormatPropsContext();
|
28
|
+
let channelProps = $derived({
|
32
29
|
channel,
|
33
30
|
orientation,
|
34
31
|
});
|
35
32
|
|
33
|
+
let channelSliderProps = $derived({
|
34
|
+
...formatProps,
|
35
|
+
...channelProps,
|
36
|
+
});
|
37
|
+
|
36
38
|
let mergedProps = $derived(
|
37
39
|
mergeProps(props, colorPicker.getChannelSliderProps(channelSliderProps)),
|
38
40
|
);
|
39
41
|
|
40
|
-
|
42
|
+
setColorPickerChannelPropsContext(() => channelProps);
|
41
43
|
</script>
|
42
44
|
|
43
45
|
{#if asChild}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { Assign, HtmlIngredientProps } from '../types.js';
|
2
|
-
import type {
|
3
|
-
export interface ColorPickerChannelSliderProps extends Assign<HtmlIngredientProps<'div', HTMLDivElement>,
|
2
|
+
import type { ChannelProps } from '@zag-js/color-picker';
|
3
|
+
export interface ColorPickerChannelSliderProps extends Assign<HtmlIngredientProps<'div', HTMLDivElement>, ChannelProps> {
|
4
4
|
}
|
5
5
|
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
6
6
|
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
@@ -30,10 +30,12 @@
|
|
30
30
|
);
|
31
31
|
</script>
|
32
32
|
|
33
|
-
{#if
|
34
|
-
{
|
35
|
-
{
|
36
|
-
|
37
|
-
{
|
38
|
-
|
33
|
+
{#if presence.mounted}
|
34
|
+
{#if asChild}
|
35
|
+
{@render asChild(presence.ref, mergedProps)}
|
36
|
+
{:else}
|
37
|
+
<div bind:this={e} use:presence.ref {...mergedProps}>
|
38
|
+
{@render children?.()}
|
39
|
+
</div>
|
40
|
+
{/if}
|
39
41
|
{/if}
|
@@ -1,7 +1,15 @@
|
|
1
|
-
import type { AreaProps, ChannelProps,
|
1
|
+
import type { AreaProps, ChannelProps, ColorFormat, SwatchProps } from '@zag-js/color-picker';
|
2
2
|
import type { CreateColorPickerReturn } from './create-color-picker.svelte.js';
|
3
3
|
export declare const getColorPickerContext: () => CreateColorPickerReturn, setColorPickerContext: (context: CreateColorPickerReturn | (() => CreateColorPickerReturn)) => CreateColorPickerReturn;
|
4
4
|
export declare const getColorPickerAreaPropsContext: () => AreaProps, setColorPickerAreaPropsContext: (context: AreaProps | (() => AreaProps)) => AreaProps;
|
5
5
|
export declare const getColorPickerSwatchPropsContext: () => SwatchProps, setColorPickerSwatchPropsContext: (context: SwatchProps | (() => SwatchProps)) => SwatchProps;
|
6
|
+
export declare const getColorPickerFormatPropsContext: () => {
|
7
|
+
format: ColorFormat;
|
8
|
+
}, setColorPickerFormatPropsContext: (context: {
|
9
|
+
format: ColorFormat;
|
10
|
+
} | (() => {
|
11
|
+
format: ColorFormat;
|
12
|
+
})) => {
|
13
|
+
format: ColorFormat;
|
14
|
+
};
|
6
15
|
export declare const getColorPickerChannelPropsContext: () => ChannelProps, setColorPickerChannelPropsContext: (context: ChannelProps | (() => ChannelProps)) => ChannelProps;
|
7
|
-
export declare const getColorPickerChannelSliderPropsContext: () => ChannelSliderProps, setColorPickerChannelSliderPropsContext: (context: ChannelSliderProps | (() => ChannelSliderProps)) => ChannelSliderProps;
|
@@ -2,5 +2,5 @@ import { createContext } from '../create-context.svelte.js';
|
|
2
2
|
export const [getColorPickerContext, setColorPickerContext] = createContext('ColorPicker');
|
3
3
|
export const [getColorPickerAreaPropsContext, setColorPickerAreaPropsContext] = createContext('ColorPickerArea');
|
4
4
|
export const [getColorPickerSwatchPropsContext, setColorPickerSwatchPropsContext,] = createContext('ColorPickerSwatch');
|
5
|
+
export const [getColorPickerFormatPropsContext, setColorPickerFormatPropsContext,] = createContext('ColorPicker__format', false);
|
5
6
|
export const [getColorPickerChannelPropsContext, setColorPickerChannelPropsContext,] = createContext('ColorPickerChannel');
|
6
|
-
export const [getColorPickerChannelSliderPropsContext, setColorPickerChannelSliderPropsContext,] = createContext('ColorPickerChannelSlider');
|
@@ -21,8 +21,6 @@
|
|
21
21
|
let mergedProps = $derived(
|
22
22
|
mergeProps(props, colorPicker.getFormatSelectProps()),
|
23
23
|
);
|
24
|
-
|
25
|
-
let formats = ['rgba', 'hsla', 'hsba'];
|
26
24
|
</script>
|
27
25
|
|
28
26
|
{#if asChild}
|
@@ -32,8 +30,10 @@
|
|
32
30
|
{#if children}
|
33
31
|
{@render children()}
|
34
32
|
{:else}
|
35
|
-
{#each
|
36
|
-
<option value={format}>
|
33
|
+
{#each colorPicker.getFormats() as format}
|
34
|
+
<option value={format.value}>
|
35
|
+
{format.label}
|
36
|
+
</option>
|
37
37
|
{/each}
|
38
38
|
{/if}
|
39
39
|
</select>
|
@@ -1,4 +1,5 @@
|
|
1
1
|
<script lang="ts" module>
|
2
|
+
import type {PresenceStrategyProps} from '../presence/create-presence.svelte.js';
|
2
3
|
import type {Assign, HtmlIngredientProps} from '../types.js';
|
3
4
|
import type {
|
4
5
|
CreateColorPickerProps,
|
@@ -7,9 +8,10 @@
|
|
7
8
|
|
8
9
|
export interface ColorPickerProps
|
9
10
|
extends Assign<
|
10
|
-
|
11
|
-
|
12
|
-
|
11
|
+
HtmlIngredientProps<'div', HTMLDivElement, CreateColorPickerReturn>,
|
12
|
+
CreateColorPickerProps
|
13
|
+
>,
|
14
|
+
PresenceStrategyProps {}
|
13
15
|
</script>
|
14
16
|
|
15
17
|
<script lang="ts">
|
@@ -23,7 +25,13 @@
|
|
23
25
|
|
24
26
|
let {this: e, asChild, children, ...props}: ColorPickerProps = $props();
|
25
27
|
|
26
|
-
let [
|
28
|
+
let [presenceProps, etc] = $derived(
|
29
|
+
createSplitProps<PresenceStrategyProps>(['lazyMount', 'keepMounted'])(
|
30
|
+
props,
|
31
|
+
),
|
32
|
+
);
|
33
|
+
|
34
|
+
let [createColorPickerProps, localProps] = $derived(
|
27
35
|
createSplitProps<CreateColorPickerProps>([
|
28
36
|
'id',
|
29
37
|
'ids',
|
@@ -45,15 +53,17 @@
|
|
45
53
|
'onFormatChange',
|
46
54
|
'onInteractOutside',
|
47
55
|
'onPointerDownOutside',
|
48
|
-
])(
|
56
|
+
])(etc),
|
49
57
|
);
|
50
58
|
|
51
|
-
let colorPicker = createColorPicker(reflect(() =>
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
59
|
+
let colorPicker = createColorPicker(reflect(() => createColorPickerProps));
|
60
|
+
|
61
|
+
let presence = createPresence(
|
62
|
+
reflect(() => ({
|
63
|
+
present: colorPicker.open,
|
64
|
+
...presenceProps,
|
65
|
+
})),
|
66
|
+
);
|
57
67
|
|
58
68
|
let mergedProps = $derived(
|
59
69
|
mergeProps(localProps, colorPicker.getRootProps()),
|
@@ -1,6 +1,7 @@
|
|
1
|
+
import type { PresenceStrategyProps } from '../presence/create-presence.svelte.js';
|
1
2
|
import type { Assign, HtmlIngredientProps } from '../types.js';
|
2
3
|
import type { CreateColorPickerProps, CreateColorPickerReturn } from './create-color-picker.svelte.js';
|
3
|
-
export interface ColorPickerProps extends Assign<HtmlIngredientProps<'div', HTMLDivElement, CreateColorPickerReturn>, CreateColorPickerProps
|
4
|
+
export interface ColorPickerProps extends Assign<HtmlIngredientProps<'div', HTMLDivElement, CreateColorPickerReturn>, CreateColorPickerProps>, PresenceStrategyProps {
|
4
5
|
}
|
5
6
|
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
6
7
|
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
@@ -5,19 +5,17 @@
|
|
5
5
|
export interface ColorPickerSwatchTriggerProps
|
6
6
|
extends Assign<
|
7
7
|
HtmlIngredientProps<'button', HTMLButtonElement>,
|
8
|
-
|
8
|
+
SwatchTriggerProps
|
9
9
|
> {}
|
10
10
|
</script>
|
11
11
|
|
12
12
|
<script lang="ts">
|
13
13
|
import {mergeProps} from '../merge-props.js';
|
14
|
-
import {
|
15
|
-
getColorPickerContext,
|
16
|
-
getColorPickerSwatchPropsContext,
|
17
|
-
} from './color-picker-context.svelte.js';
|
14
|
+
import {getColorPickerContext} from './color-picker-context.svelte.js';
|
18
15
|
|
19
16
|
let {
|
20
17
|
this: e,
|
18
|
+
value,
|
21
19
|
disabled,
|
22
20
|
asChild,
|
23
21
|
children,
|
@@ -25,13 +23,12 @@
|
|
25
23
|
}: ColorPickerSwatchTriggerProps = $props();
|
26
24
|
|
27
25
|
let colorPicker = getColorPickerContext();
|
28
|
-
let swatchProps = getColorPickerSwatchPropsContext();
|
29
26
|
|
30
27
|
let mergedProps = $derived(
|
31
28
|
mergeProps(
|
32
29
|
props,
|
33
30
|
colorPicker.getSwatchTriggerProps({
|
34
|
-
value
|
31
|
+
value,
|
35
32
|
disabled,
|
36
33
|
}),
|
37
34
|
),
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { Assign, HtmlIngredientProps } from '../types.js';
|
2
2
|
import type { SwatchTriggerProps } from '@zag-js/color-picker';
|
3
|
-
export interface ColorPickerSwatchTriggerProps extends Assign<HtmlIngredientProps<'button', HTMLButtonElement>,
|
3
|
+
export interface ColorPickerSwatchTriggerProps extends Assign<HtmlIngredientProps<'button', HTMLButtonElement>, SwatchTriggerProps> {
|
4
4
|
}
|
5
5
|
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
6
6
|
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
@@ -24,12 +24,7 @@
|
|
24
24
|
let colorPicker = getColorPickerContext();
|
25
25
|
|
26
26
|
let mergedProps = $derived(
|
27
|
-
mergeProps(
|
28
|
-
props,
|
29
|
-
colorPicker.getTransparencyGridProps({
|
30
|
-
size,
|
31
|
-
}),
|
32
|
-
),
|
27
|
+
mergeProps(props, colorPicker.getTransparencyGridProps({size})),
|
33
28
|
);
|
34
29
|
</script>
|
35
30
|
|
@@ -0,0 +1,41 @@
|
|
1
|
+
<script lang="ts" module>
|
2
|
+
import type {HtmlIngredientProps} from '../types.js';
|
3
|
+
|
4
|
+
export interface ColorPickerValueSwatchProps
|
5
|
+
extends HtmlIngredientProps<'div', HTMLDivElement> {
|
6
|
+
respectAlpha?: boolean;
|
7
|
+
}
|
8
|
+
</script>
|
9
|
+
|
10
|
+
<script lang="ts">
|
11
|
+
import {mergeProps} from '../merge-props.js';
|
12
|
+
import type {SwatchProps} from '@zag-js/color-picker';
|
13
|
+
import {getColorPickerContext} from './color-picker-context.svelte.js';
|
14
|
+
|
15
|
+
let {
|
16
|
+
this: e,
|
17
|
+
respectAlpha,
|
18
|
+
asChild,
|
19
|
+
children,
|
20
|
+
...props
|
21
|
+
}: ColorPickerValueSwatchProps = $props();
|
22
|
+
|
23
|
+
let colorPicker = getColorPickerContext();
|
24
|
+
|
25
|
+
let swatchProps: SwatchProps = $derived({
|
26
|
+
respectAlpha,
|
27
|
+
value: colorPicker.valueAsString,
|
28
|
+
});
|
29
|
+
|
30
|
+
let mergedProps = $derived(
|
31
|
+
mergeProps(props, colorPicker.getSwatchProps(swatchProps)),
|
32
|
+
);
|
33
|
+
</script>
|
34
|
+
|
35
|
+
{#if asChild}
|
36
|
+
{@render asChild(mergedProps)}
|
37
|
+
{:else}
|
38
|
+
<div {...mergedProps}>
|
39
|
+
{@render children?.()}
|
40
|
+
</div>
|
41
|
+
{/if}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import type { HtmlIngredientProps } from '../types.js';
|
2
|
+
export interface ColorPickerValueSwatchProps extends HtmlIngredientProps<'div', HTMLDivElement> {
|
3
|
+
respectAlpha?: boolean;
|
4
|
+
}
|
5
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
6
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
7
|
+
$$bindings?: Bindings;
|
8
|
+
} & Exports;
|
9
|
+
(internal: unknown, props: Props & {
|
10
|
+
$$events?: Events;
|
11
|
+
$$slots?: Slots;
|
12
|
+
}): Exports & {
|
13
|
+
$set?: any;
|
14
|
+
$on?: any;
|
15
|
+
};
|
16
|
+
z_$$bindings?: Bindings;
|
17
|
+
}
|
18
|
+
declare const ColorPickerValueSwatch: $$__sveltets_2_IsomorphicComponent<ColorPickerValueSwatchProps, {
|
19
|
+
[evt: string]: CustomEvent<any>;
|
20
|
+
}, {}, {}, "">;
|
21
|
+
type ColorPickerValueSwatch = InstanceType<typeof ColorPickerValueSwatch>;
|
22
|
+
export default ColorPickerValueSwatch;
|
@@ -0,0 +1,41 @@
|
|
1
|
+
<script lang="ts" module>
|
2
|
+
import type {HtmlIngredientProps} from '../types.js';
|
3
|
+
import type {ColorFormat} from '@zag-js/color-picker';
|
4
|
+
|
5
|
+
export interface ColorPickerViewTextProps
|
6
|
+
extends HtmlIngredientProps<'div', HTMLDivElement> {
|
7
|
+
format: ColorFormat;
|
8
|
+
}
|
9
|
+
</script>
|
10
|
+
|
11
|
+
<script lang="ts">
|
12
|
+
import {mergeProps} from '../merge-props.js';
|
13
|
+
import {
|
14
|
+
getColorPickerContext,
|
15
|
+
setColorPickerFormatPropsContext,
|
16
|
+
} from './color-picker-context.svelte.js';
|
17
|
+
|
18
|
+
let {
|
19
|
+
this: e,
|
20
|
+
format,
|
21
|
+
asChild,
|
22
|
+
children,
|
23
|
+
...props
|
24
|
+
}: ColorPickerViewTextProps = $props();
|
25
|
+
|
26
|
+
let colorPicker = getColorPickerContext();
|
27
|
+
let formatProps = $derived({format});
|
28
|
+
let mergedProps = $derived(
|
29
|
+
mergeProps(props, colorPicker.getViewProps(formatProps)),
|
30
|
+
);
|
31
|
+
|
32
|
+
setColorPickerFormatPropsContext(() => formatProps);
|
33
|
+
</script>
|
34
|
+
|
35
|
+
{#if asChild}
|
36
|
+
{@render asChild(mergedProps)}
|
37
|
+
{:else}
|
38
|
+
<div {...mergedProps}>
|
39
|
+
{@render children?.()}
|
40
|
+
</div>
|
41
|
+
{/if}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import type { HtmlIngredientProps } from '../types.js';
|
2
|
+
import type { ColorFormat } from '@zag-js/color-picker';
|
3
|
+
export interface ColorPickerViewTextProps extends HtmlIngredientProps<'div', HTMLDivElement> {
|
4
|
+
format: ColorFormat;
|
5
|
+
}
|
6
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
7
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
8
|
+
$$bindings?: Bindings;
|
9
|
+
} & Exports;
|
10
|
+
(internal: unknown, props: Props & {
|
11
|
+
$$events?: Events;
|
12
|
+
$$slots?: Slots;
|
13
|
+
}): Exports & {
|
14
|
+
$set?: any;
|
15
|
+
$on?: any;
|
16
|
+
};
|
17
|
+
z_$$bindings?: Bindings;
|
18
|
+
}
|
19
|
+
declare const ColorPickerView: $$__sveltets_2_IsomorphicComponent<ColorPickerViewTextProps, {
|
20
|
+
[evt: string]: CustomEvent<any>;
|
21
|
+
}, {}, {}, "">;
|
22
|
+
type ColorPickerView = InstanceType<typeof ColorPickerView>;
|
23
|
+
export default ColorPickerView;
|
@@ -23,4 +23,6 @@ export { default as SwatchTrigger } from './color-picker-swatch-trigger.svelte';
|
|
23
23
|
export { default as Swatch } from './color-picker-swatch.svelte';
|
24
24
|
export { default as TransparencyGrid } from './color-picker-transparency-grid.svelte';
|
25
25
|
export { default as Trigger } from './color-picker-trigger.svelte';
|
26
|
+
export { default as ValueSwatchProps } from './color-picker-value-swatch.svelte';
|
26
27
|
export { default as ValueText } from './color-picker-value-text.svelte';
|
28
|
+
export { default as ViewTextProps } from './color-picker-view.svelte';
|
@@ -23,4 +23,6 @@ export { default as SwatchTrigger } from './color-picker-swatch-trigger.svelte';
|
|
23
23
|
export { default as Swatch } from './color-picker-swatch.svelte';
|
24
24
|
export { default as TransparencyGrid } from './color-picker-transparency-grid.svelte';
|
25
25
|
export { default as Trigger } from './color-picker-trigger.svelte';
|
26
|
+
export { default as ValueSwatchProps } from './color-picker-value-swatch.svelte';
|
26
27
|
export { default as ValueText } from './color-picker-value-text.svelte';
|
28
|
+
export { default as ViewTextProps } from './color-picker-view.svelte';
|