ui-ingredients 0.0.44 → 0.0.45
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -0
- package/dist/accordion/create-accordion.svelte.js +3 -4
- package/dist/accordion/item-content.svelte +7 -11
- package/dist/accordion/item.svelte +2 -2
- package/dist/accordion/root.svelte +4 -6
- package/dist/avatar/create-avatar.svelte.js +3 -4
- package/dist/avatar/root.svelte +2 -2
- package/dist/carousel/create-carousel.svelte.js +3 -4
- package/dist/carousel/indicator.svelte +2 -2
- package/dist/carousel/item.svelte +2 -2
- package/dist/carousel/root.svelte +2 -2
- package/dist/checkbox/create-checkbox.svelte.js +4 -5
- package/dist/checkbox/root.svelte +2 -2
- package/dist/clipboard/create-clipboard.svelte.js +3 -4
- package/dist/clipboard/root.svelte +2 -2
- package/dist/collapsible/create-collapsible.svelte.js +3 -4
- package/dist/collapsible/root.svelte +2 -2
- package/dist/color-picker/create-color-picker.svelte.js +3 -4
- package/dist/color-picker/root.svelte +2 -2
- package/dist/combobox/create-combobox.svelte.js +4 -5
- package/dist/combobox/item.svelte +2 -2
- package/dist/combobox/root.svelte +10 -16
- package/dist/create-context.svelte.js +1 -9
- package/dist/date-picker/create-date-picker.svelte.js +2 -3
- package/dist/date-picker/day-table-cell.svelte +2 -2
- package/dist/date-picker/month-table-cell.svelte +2 -2
- package/dist/date-picker/root.svelte +10 -18
- package/dist/date-picker/year-table-cell.svelte +2 -2
- package/dist/dialog/backdrop.svelte +7 -12
- package/dist/dialog/create-dialog.svelte.js +3 -4
- package/dist/dialog/root.svelte +6 -12
- package/dist/editable/create-editable.svelte.js +4 -5
- package/dist/editable/root.svelte +2 -2
- package/dist/environment-provider/root.svelte +5 -8
- package/dist/field/create-field.svelte.d.ts +1 -22
- package/dist/field/create-field.svelte.js +9 -20
- package/dist/field/root.svelte +2 -2
- package/dist/file-upload/create-file-upload.svelte.js +4 -5
- package/dist/file-upload/item.svelte +2 -2
- package/dist/file-upload/root.svelte +2 -2
- package/dist/floating-panel/create-floating-panel.svelte.js +3 -4
- package/dist/floating-panel/resize-trigger.svelte +2 -2
- package/dist/floating-panel/root.svelte +6 -11
- package/dist/highlight/highlight.svelte +42 -0
- package/dist/highlight/highlight.svelte.d.ts +18 -0
- package/dist/highlight/index.d.ts +1 -0
- package/dist/highlight/index.js +1 -0
- package/dist/hover-card/create-hover-card.svelte.js +3 -4
- package/dist/hover-card/root.svelte +6 -11
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/locale-provider/root.svelte +8 -6
- package/dist/menu/create-menu.svelte.js +3 -4
- package/dist/menu/item.svelte +2 -2
- package/dist/menu/option-item.svelte +2 -2
- package/dist/menu/root.svelte +6 -12
- package/dist/number-input/create-number-input.svelte.js +4 -5
- package/dist/number-input/root.svelte +2 -2
- package/dist/pagination/create-pagination.svelte.js +3 -4
- package/dist/pagination/root.svelte +2 -2
- package/dist/pin-input/create-pin-input.svelte.js +4 -5
- package/dist/pin-input/root.svelte +2 -2
- package/dist/popover/create-popover.svelte.js +3 -4
- package/dist/popover/root.svelte +6 -11
- package/dist/presence/root.svelte +2 -2
- package/dist/progress/create-progress.svelte.js +3 -4
- package/dist/progress/root.svelte +2 -2
- package/dist/qr-code/create-qr-code.svelte.js +3 -4
- package/dist/qr-code/root.svelte +2 -2
- package/dist/radio-group/create-radio-group.svelte.js +3 -4
- package/dist/radio-group/item.svelte +2 -2
- package/dist/radio-group/root.svelte +2 -2
- package/dist/rating-group/create-rating-group.svelte.js +4 -5
- package/dist/rating-group/root.svelte +2 -2
- package/dist/segment-group/create-segment-group.svelte.js +3 -4
- package/dist/segment-group/item.svelte +2 -2
- package/dist/segment-group/root.svelte +2 -2
- package/dist/select/create-select.svelte.js +2 -3
- package/dist/select/item.svelte +2 -2
- package/dist/select/root.svelte +11 -19
- package/dist/signature-pad/create-signature-pad.svelte.js +3 -4
- package/dist/signature-pad/root.svelte +2 -2
- package/dist/slider/create-slider.svelte.js +3 -4
- package/dist/slider/root.svelte +2 -2
- package/dist/slider/thumb.svelte +2 -2
- package/dist/splitter/create-splitter.svelte.js +3 -4
- package/dist/splitter/panel.svelte +2 -2
- package/dist/splitter/resize-trigger.svelte +2 -2
- package/dist/splitter/root.svelte +2 -2
- package/dist/steps/create-steps.svelte.js +3 -4
- package/dist/steps/item.svelte +2 -2
- package/dist/steps/root.svelte +2 -2
- package/dist/switch/create-switch.svelte.js +4 -5
- package/dist/switch/root.svelte +2 -2
- package/dist/tabs/content.svelte +2 -2
- package/dist/tabs/create-tabs.svelte.js +3 -4
- package/dist/tabs/root.svelte +2 -2
- package/dist/tabs/trigger.svelte +2 -2
- package/dist/tags-input/create-tags-input.svelte.js +4 -5
- package/dist/tags-input/item.svelte +2 -2
- package/dist/tags-input/root.svelte +2 -2
- package/dist/time-picker/create-time-picker.svelte.js +3 -4
- package/dist/time-picker/root.svelte +11 -21
- package/dist/timer/create-timer.svelte.js +3 -4
- package/dist/timer/item.svelte +2 -2
- package/dist/timer/root.svelte +2 -2
- package/dist/toast/create-toast.svelte.js +1 -2
- package/dist/toast/create-toaster.svelte.js +2 -3
- package/dist/toggle-group/create-toggle-group.svelte.js +3 -4
- package/dist/toggle-group/item.svelte +2 -2
- package/dist/toggle-group/root.svelte +2 -2
- package/dist/tooltip/create-tooltip.svelte.js +3 -4
- package/dist/tooltip/root.svelte +6 -12
- package/dist/tour/create-tour.svelte.js +3 -4
- package/dist/tour/overlay.svelte +7 -12
- package/dist/tour/root.svelte +6 -11
- package/dist/tree-view/branch.svelte +2 -2
- package/dist/tree-view/create-tree-view.svelte.js +3 -4
- package/dist/tree-view/item.svelte +2 -2
- package/dist/tree-view/root.svelte +2 -2
- package/package.json +2 -1
@@ -7,15 +7,14 @@ export function createDialog(props) {
|
|
7
7
|
const locale = getLocaleContext();
|
8
8
|
const environment = getEnvironmentContext();
|
9
9
|
const id = uid();
|
10
|
-
const context =
|
10
|
+
const context = reflect(() => ({
|
11
11
|
...props,
|
12
12
|
id: props.id ?? id,
|
13
13
|
dir: locale?.dir,
|
14
14
|
open: props.defaultOpen ?? props.open,
|
15
15
|
getRootNode: environment?.getRootNode,
|
16
16
|
'open.controlled': props.open != null,
|
17
|
-
}))
|
17
|
+
}));
|
18
18
|
const [state, send] = useMachine(dialog.machine(context), { context });
|
19
|
-
|
20
|
-
return api;
|
19
|
+
return reflect(() => dialog.connect(state, send, normalizeProps));
|
21
20
|
}
|
package/dist/dialog/root.svelte
CHANGED
@@ -33,18 +33,12 @@
|
|
33
33
|
);
|
34
34
|
|
35
35
|
let dialog = createDialog(reflect(() => dialogProps));
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
},
|
41
|
-
|
42
|
-
return presenceStrategyProps.lazyMount;
|
43
|
-
},
|
44
|
-
get keepMounted() {
|
45
|
-
return presenceStrategyProps.keepMounted;
|
46
|
-
},
|
47
|
-
});
|
36
|
+
let presence = createPresence(
|
37
|
+
reflect(() => ({
|
38
|
+
...presenceStrategyProps,
|
39
|
+
present: dialog.open,
|
40
|
+
})),
|
41
|
+
);
|
48
42
|
|
49
43
|
setDialogContext(dialog);
|
50
44
|
setPresenceContext(presence);
|
@@ -9,7 +9,7 @@ export function createEditable(props) {
|
|
9
9
|
const locale = getLocaleContext();
|
10
10
|
const environment = getEnvironmentContext();
|
11
11
|
const id = uid();
|
12
|
-
const context =
|
12
|
+
const context = reflect(() => ({
|
13
13
|
ids: {
|
14
14
|
label: field?.ids.label,
|
15
15
|
input: field?.ids.control,
|
@@ -24,9 +24,9 @@ export function createEditable(props) {
|
|
24
24
|
edit: props.defaultEdit ?? props.edit,
|
25
25
|
getRootNode: environment?.getRootNode,
|
26
26
|
'edit.controlled': props.edit != null,
|
27
|
-
}))
|
27
|
+
}));
|
28
28
|
const [state, send] = useMachine(editable.machine(context), { context });
|
29
|
-
|
29
|
+
return reflect(() => {
|
30
30
|
const o = editable.connect(state, send, normalizeProps);
|
31
31
|
return {
|
32
32
|
...o,
|
@@ -37,6 +37,5 @@ export function createEditable(props) {
|
|
37
37
|
};
|
38
38
|
},
|
39
39
|
};
|
40
|
-
})
|
41
|
-
return api;
|
40
|
+
});
|
42
41
|
}
|
@@ -21,7 +21,7 @@
|
|
21
21
|
|
22
22
|
let {asChild, children, ...props}: EditableProps = $props();
|
23
23
|
|
24
|
-
let [editableProps,
|
24
|
+
let [editableProps, localProps] = $derived(
|
25
25
|
createSplitProps<CreateEditableProps>([
|
26
26
|
'id',
|
27
27
|
'ids',
|
@@ -54,7 +54,7 @@
|
|
54
54
|
|
55
55
|
let editable = createEditable(reflect(() => editableProps));
|
56
56
|
|
57
|
-
let mergedProps = $derived(mergeProps(
|
57
|
+
let mergedProps = $derived(mergeProps(localProps, editable.getRootProps()));
|
58
58
|
|
59
59
|
setEditableContext(editable);
|
60
60
|
</script>
|
@@ -1,6 +1,5 @@
|
|
1
1
|
<script lang="ts" module>
|
2
2
|
import type {Snippet} from 'svelte';
|
3
|
-
import {type Environment} from './context.svelte.js';
|
4
3
|
|
5
4
|
export interface EnvironmentProviderProps {
|
6
5
|
rootNode?:
|
@@ -20,21 +19,19 @@
|
|
20
19
|
|
21
20
|
let elem: HTMLSpanElement | null = $state(null);
|
22
21
|
|
23
|
-
|
22
|
+
function getRootNode() {
|
24
23
|
if (rootNode) {
|
25
|
-
return typeof rootNode === 'function' ? rootNode
|
24
|
+
return typeof rootNode === 'function' ? rootNode() : rootNode;
|
26
25
|
} else {
|
27
|
-
return
|
26
|
+
return elem?.ownerDocument ?? document;
|
28
27
|
}
|
29
|
-
}
|
28
|
+
}
|
30
29
|
|
31
|
-
|
30
|
+
setEnvironmentContext({
|
32
31
|
getRootNode,
|
33
32
|
getDocument: () => getDocument(getRootNode()),
|
34
33
|
getWindow: () => getWindow(getRootNode()),
|
35
34
|
});
|
36
|
-
|
37
|
-
setEnvironmentContext(() => environment);
|
38
35
|
</script>
|
39
36
|
|
40
37
|
{@render children()}
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import type { HtmlProps } from '../types.js';
|
2
1
|
interface ElementIds {
|
3
2
|
root?: string;
|
4
3
|
label?: string;
|
@@ -16,25 +15,5 @@ export interface CreateFieldProps {
|
|
16
15
|
}
|
17
16
|
export interface CreateFieldReturn extends ReturnType<typeof createField> {
|
18
17
|
}
|
19
|
-
export declare function createField(props: CreateFieldProps):
|
20
|
-
readonly ids: {
|
21
|
-
root: string;
|
22
|
-
label: string;
|
23
|
-
control: string;
|
24
|
-
errorText: string;
|
25
|
-
helperText: string;
|
26
|
-
};
|
27
|
-
readonly disabled: boolean;
|
28
|
-
readonly required: boolean;
|
29
|
-
readonly readOnly: boolean;
|
30
|
-
readonly invalid: boolean;
|
31
|
-
readonly 'aria-describedby': string;
|
32
|
-
getRootProps: () => HtmlProps<"div">;
|
33
|
-
getLabelProps: () => HtmlProps<"label">;
|
34
|
-
getErrorTextProps: () => HtmlProps<"div">;
|
35
|
-
getHelperTextProps: () => HtmlProps<"div">;
|
36
|
-
getInputProps: () => HtmlProps<"input">;
|
37
|
-
getSelectProps: () => HtmlProps<"select">;
|
38
|
-
getTextareaProps: () => HtmlProps<"textarea">;
|
39
|
-
};
|
18
|
+
export declare function createField(props: CreateFieldProps): any;
|
40
19
|
export {};
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { getEnvironmentContext } from '../environment-provider/context.svelte.js';
|
2
2
|
import { ariaAttr, dataAttr, getDocument, getWindow } from '@zag-js/dom-query';
|
3
|
+
import { reflect } from '@zag-js/svelte';
|
3
4
|
import { uid } from 'uid';
|
4
5
|
import { parts } from './anatomy.js';
|
5
6
|
export function createField(props) {
|
@@ -136,25 +137,13 @@ export function createField(props) {
|
|
136
137
|
'data-readonly': dataAttr(readOnly),
|
137
138
|
};
|
138
139
|
}
|
139
|
-
return {
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
get required() {
|
147
|
-
return required;
|
148
|
-
},
|
149
|
-
get readOnly() {
|
150
|
-
return readOnly;
|
151
|
-
},
|
152
|
-
get invalid() {
|
153
|
-
return invalid;
|
154
|
-
},
|
155
|
-
get 'aria-describedby'() {
|
156
|
-
return ariaDescribedby;
|
157
|
-
},
|
140
|
+
return reflect(() => ({
|
141
|
+
ids,
|
142
|
+
disabled,
|
143
|
+
required,
|
144
|
+
readOnly,
|
145
|
+
invalid,
|
146
|
+
'aria-describedby': ariaDescribedby,
|
158
147
|
getRootProps,
|
159
148
|
getLabelProps,
|
160
149
|
getErrorTextProps,
|
@@ -162,5 +151,5 @@ export function createField(props) {
|
|
162
151
|
getInputProps,
|
163
152
|
getSelectProps,
|
164
153
|
getTextareaProps,
|
165
|
-
};
|
154
|
+
}));
|
166
155
|
}
|
package/dist/field/root.svelte
CHANGED
@@ -21,7 +21,7 @@
|
|
21
21
|
|
22
22
|
let {asChild, children, ...props}: FieldProps = $props();
|
23
23
|
|
24
|
-
let [fieldProps,
|
24
|
+
let [fieldProps, localProps] = $derived(
|
25
25
|
createSplitProps<CreateFieldProps>([
|
26
26
|
'id',
|
27
27
|
'ids',
|
@@ -34,7 +34,7 @@
|
|
34
34
|
|
35
35
|
let field = createField(reflect(() => fieldProps));
|
36
36
|
|
37
|
-
let mergedProps = $derived(mergeProps(
|
37
|
+
let mergedProps = $derived(mergeProps(localProps, field.getRootProps()));
|
38
38
|
|
39
39
|
setFieldContext(field);
|
40
40
|
</script>
|
@@ -9,7 +9,7 @@ export function createFileUpload(props) {
|
|
9
9
|
const locale = getLocaleContext();
|
10
10
|
const environment = getEnvironmentContext();
|
11
11
|
const id = uid();
|
12
|
-
const context =
|
12
|
+
const context = reflect(() => ({
|
13
13
|
ids: {
|
14
14
|
label: field?.ids.label,
|
15
15
|
hiddenInput: field?.ids.control,
|
@@ -22,9 +22,9 @@ export function createFileUpload(props) {
|
|
22
22
|
dir: locale?.dir,
|
23
23
|
locale: props.locale ?? locale?.locale,
|
24
24
|
getRootNode: environment?.getRootNode,
|
25
|
-
}))
|
25
|
+
}));
|
26
26
|
const [state, send] = useMachine(fileUpload.machine(context), { context });
|
27
|
-
|
27
|
+
return reflect(() => {
|
28
28
|
const o = fileUpload.connect(state, send, normalizeProps);
|
29
29
|
return {
|
30
30
|
...o,
|
@@ -35,6 +35,5 @@ export function createFileUpload(props) {
|
|
35
35
|
};
|
36
36
|
},
|
37
37
|
};
|
38
|
-
})
|
39
|
-
return api;
|
38
|
+
});
|
40
39
|
}
|
@@ -18,12 +18,12 @@
|
|
18
18
|
|
19
19
|
let fileUpload = getFileUploadContext();
|
20
20
|
|
21
|
-
let [itemProps,
|
21
|
+
let [itemProps, localProps] = $derived(
|
22
22
|
createSplitProps<ItemProps>(['file'])(props),
|
23
23
|
);
|
24
24
|
|
25
25
|
let mergedProps = $derived(
|
26
|
-
mergeProps(
|
26
|
+
mergeProps(localProps, fileUpload.getItemProps(itemProps)),
|
27
27
|
);
|
28
28
|
|
29
29
|
setFileUploadItemPropsContext(() => itemProps);
|
@@ -21,7 +21,7 @@
|
|
21
21
|
|
22
22
|
let {asChild, children, ...props}: FileUploadProps = $props();
|
23
23
|
|
24
|
-
let [fileUploadProps,
|
24
|
+
let [fileUploadProps, localProps] = $derived(
|
25
25
|
createSplitProps<CreateFileUploadProps>([
|
26
26
|
'id',
|
27
27
|
'ids',
|
@@ -47,7 +47,7 @@
|
|
47
47
|
|
48
48
|
let fileUpload = createFileUpload(reflect(() => fileUploadProps));
|
49
49
|
|
50
|
-
let mergedProps = $derived(mergeProps(
|
50
|
+
let mergedProps = $derived(mergeProps(localProps, fileUpload.getRootProps()));
|
51
51
|
|
52
52
|
setFileUploadContext(fileUpload);
|
53
53
|
</script>
|
@@ -7,13 +7,12 @@ export function createFloatingPanel(props) {
|
|
7
7
|
const locale = getLocaleContext();
|
8
8
|
const environment = getEnvironmentContext();
|
9
9
|
const id = uid();
|
10
|
-
const context =
|
10
|
+
const context = reflect(() => ({
|
11
11
|
...props,
|
12
12
|
id: props.id ?? id,
|
13
13
|
dir: locale?.dir,
|
14
14
|
getRootNode: environment?.getRootNode,
|
15
|
-
}))
|
15
|
+
}));
|
16
16
|
const [state, send] = useMachine(floatingPanel.machine(context), { context });
|
17
|
-
|
18
|
-
return api;
|
17
|
+
return reflect(() => floatingPanel.connect(state, send, normalizeProps));
|
19
18
|
}
|
@@ -15,13 +15,13 @@
|
|
15
15
|
|
16
16
|
let floatingPanel = getFloatingPanelContext();
|
17
17
|
|
18
|
-
let [resizeTriggerProps,
|
18
|
+
let [resizeTriggerProps, localProps] = $derived(
|
19
19
|
createSplitProps<ResizeTriggerProps>([])(props),
|
20
20
|
);
|
21
21
|
|
22
22
|
let mergedProps = $derived(
|
23
23
|
mergeProps(
|
24
|
-
|
24
|
+
localProps,
|
25
25
|
floatingPanel.getResizeTriggerProps(resizeTriggerProps),
|
26
26
|
),
|
27
27
|
);
|
@@ -31,17 +31,12 @@
|
|
31
31
|
|
32
32
|
let floatingPanel = createFloatingPanel(reflect(() => floatingPanelProps));
|
33
33
|
|
34
|
-
let presence = createPresence(
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
},
|
41
|
-
get keepMounted() {
|
42
|
-
return presenceStrategyProps.keepMounted;
|
43
|
-
},
|
44
|
-
});
|
34
|
+
let presence = createPresence(
|
35
|
+
reflect(() => ({
|
36
|
+
...presenceStrategyProps,
|
37
|
+
present: floatingPanel.open,
|
38
|
+
})),
|
39
|
+
);
|
45
40
|
|
46
41
|
setFloatingPanelContext(floatingPanel);
|
47
42
|
setPresenceContext(presence);
|
@@ -0,0 +1,42 @@
|
|
1
|
+
<script lang="ts" module>
|
2
|
+
import type {Assign, HtmlIngredientProps} from '../types.js';
|
3
|
+
import type {HighlightWordProps} from '@zag-js/highlight-word';
|
4
|
+
|
5
|
+
export interface HighlightProps
|
6
|
+
extends Assign<
|
7
|
+
Omit<HtmlIngredientProps<'div'>, 'children'>,
|
8
|
+
HighlightWordProps
|
9
|
+
> {}
|
10
|
+
</script>
|
11
|
+
|
12
|
+
<script lang="ts">
|
13
|
+
import {highlightWord} from '@zag-js/highlight-word';
|
14
|
+
import {createSplitProps} from '@zag-js/utils';
|
15
|
+
|
16
|
+
let {asChild, ...props}: HighlightProps = $props();
|
17
|
+
|
18
|
+
let [highlightProps, localProps] = $derived(
|
19
|
+
createSplitProps<HighlightWordProps>([
|
20
|
+
'text',
|
21
|
+
'query',
|
22
|
+
'matchAll',
|
23
|
+
'ignoreCase',
|
24
|
+
])(props),
|
25
|
+
);
|
26
|
+
|
27
|
+
let chunks = $derived(highlightWord(highlightProps));
|
28
|
+
</script>
|
29
|
+
|
30
|
+
{#if asChild}
|
31
|
+
{@render asChild(localProps)}
|
32
|
+
{:else}
|
33
|
+
<div {...localProps}>
|
34
|
+
{#each chunks as chunk}
|
35
|
+
{#if chunk.match}
|
36
|
+
<mark>{chunk.text}</mark>
|
37
|
+
{:else}
|
38
|
+
{chunk.text}
|
39
|
+
{/if}
|
40
|
+
{/each}
|
41
|
+
</div>
|
42
|
+
{/if}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
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> {
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
3
|
+
$$bindings?: Bindings;
|
4
|
+
} & Exports;
|
5
|
+
(internal: unknown, props: Props & {
|
6
|
+
$$events?: Events;
|
7
|
+
$$slots?: Slots;
|
8
|
+
}): Exports & {
|
9
|
+
$set?: any;
|
10
|
+
$on?: any;
|
11
|
+
};
|
12
|
+
z_$$bindings?: Bindings;
|
13
|
+
}
|
14
|
+
declare const Highlight: $$__sveltets_2_IsomorphicComponent<HighlightProps, {
|
15
|
+
[evt: string]: CustomEvent<any>;
|
16
|
+
}, {}, {}, "">;
|
17
|
+
type Highlight = InstanceType<typeof Highlight>;
|
18
|
+
export default Highlight;
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default as Highlight, type HighlightProps } from './highlight.svelte';
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default as Highlight } from './highlight.svelte';
|
@@ -7,15 +7,14 @@ export function createHoverCard(props) {
|
|
7
7
|
const locale = getLocaleContext();
|
8
8
|
const environment = getEnvironmentContext();
|
9
9
|
const id = uid();
|
10
|
-
const context =
|
10
|
+
const context = reflect(() => ({
|
11
11
|
...props,
|
12
12
|
id: props.id ?? id,
|
13
13
|
dir: locale?.dir,
|
14
14
|
open: props.defaultOpen ?? props.open,
|
15
15
|
getRootNode: environment?.getRootNode,
|
16
16
|
'open.controlled': props.open != null,
|
17
|
-
}))
|
17
|
+
}));
|
18
18
|
const [state, send] = useMachine(hoverCard.machine(context), { context });
|
19
|
-
|
20
|
-
return api;
|
19
|
+
return reflect(() => hoverCard.connect(state, send, normalizeProps));
|
21
20
|
}
|
@@ -38,17 +38,12 @@
|
|
38
38
|
|
39
39
|
let hoverCard = createHoverCard(reflect(() => hoverCardProps));
|
40
40
|
|
41
|
-
let presence = createPresence(
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
},
|
48
|
-
get keepMounted() {
|
49
|
-
return presenceStrategyProps.keepMounted;
|
50
|
-
},
|
51
|
-
});
|
41
|
+
let presence = createPresence(
|
42
|
+
reflect(() => ({
|
43
|
+
...presenceStrategyProps,
|
44
|
+
present: hoverCard.open,
|
45
|
+
})),
|
46
|
+
);
|
52
47
|
|
53
48
|
setHoverCardContext(hoverCard);
|
54
49
|
setPresenceContext(presence);
|
package/dist/index.d.ts
CHANGED
@@ -13,6 +13,7 @@ export * from './environment-provider/index.js';
|
|
13
13
|
export * from './field/index.js';
|
14
14
|
export * from './file-upload/index.js';
|
15
15
|
export * from './floating-panel/index.js';
|
16
|
+
export * from './highlight/index.js';
|
16
17
|
export * from './hover-card/index.js';
|
17
18
|
export * from './locale-provider/index.js';
|
18
19
|
export * from './menu/index.js';
|
package/dist/index.js
CHANGED
@@ -13,6 +13,7 @@ export * from './environment-provider/index.js';
|
|
13
13
|
export * from './field/index.js';
|
14
14
|
export * from './file-upload/index.js';
|
15
15
|
export * from './floating-panel/index.js';
|
16
|
+
export * from './highlight/index.js';
|
16
17
|
export * from './hover-card/index.js';
|
17
18
|
export * from './locale-provider/index.js';
|
18
19
|
export * from './menu/index.js';
|
@@ -8,17 +8,19 @@
|
|
8
8
|
</script>
|
9
9
|
|
10
10
|
<script lang="ts">
|
11
|
-
import {isRTL
|
11
|
+
import {isRTL} from '@zag-js/i18n-utils';
|
12
12
|
import {setLocaleContext} from './context.svelte.js';
|
13
13
|
|
14
14
|
let {children, ...props}: LocaleProviderProps = $props();
|
15
15
|
|
16
|
-
|
17
|
-
locale
|
18
|
-
|
16
|
+
setLocaleContext({
|
17
|
+
get locale() {
|
18
|
+
return props.locale;
|
19
|
+
},
|
20
|
+
get dir() {
|
21
|
+
return isRTL(props.locale) ? 'rtl' : 'ltr';
|
22
|
+
},
|
19
23
|
});
|
20
|
-
|
21
|
-
setLocaleContext(() => locale);
|
22
24
|
</script>
|
23
25
|
|
24
26
|
{@render children()}
|
@@ -7,15 +7,14 @@ export function createMenu(props) {
|
|
7
7
|
const locale = getLocaleContext();
|
8
8
|
const environment = getEnvironmentContext();
|
9
9
|
const id = uid();
|
10
|
-
const context =
|
10
|
+
const context = reflect(() => ({
|
11
11
|
...props,
|
12
12
|
id: props.id ?? id,
|
13
13
|
dir: locale?.dir,
|
14
14
|
open: props.defaultOpen ?? props.open,
|
15
15
|
getRootNode: environment?.getRootNode,
|
16
16
|
'open.controlled': props.open != null,
|
17
|
-
}))
|
17
|
+
}));
|
18
18
|
const [state, send] = useMachine(menu.machine(context), { context });
|
19
|
-
|
20
|
-
return api;
|
19
|
+
return reflect(() => menu.connect(state, send, normalizeProps));
|
21
20
|
}
|
package/dist/menu/item.svelte
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
|
16
16
|
let menu = getMenuContext();
|
17
17
|
|
18
|
-
let [itemProps,
|
18
|
+
let [itemProps, localProps] = $derived(
|
19
19
|
createSplitProps<ItemProps>([
|
20
20
|
'value',
|
21
21
|
'valueText',
|
@@ -26,7 +26,7 @@
|
|
26
26
|
|
27
27
|
let itemState = $derived(menu.getItemState(itemProps));
|
28
28
|
let mergedProps = $derived(
|
29
|
-
mergeProps(
|
29
|
+
mergeProps(localProps, menu.getItemProps(itemProps)),
|
30
30
|
);
|
31
31
|
</script>
|
32
32
|
|
@@ -21,7 +21,7 @@
|
|
21
21
|
|
22
22
|
let menu = getMenuContext();
|
23
23
|
|
24
|
-
let [itemProps,
|
24
|
+
let [itemProps, localProps] = $derived(
|
25
25
|
createSplitProps<OptionItemProps>([
|
26
26
|
'type',
|
27
27
|
'value',
|
@@ -36,7 +36,7 @@
|
|
36
36
|
let itemState = $derived(menu.getOptionItemState(itemProps));
|
37
37
|
|
38
38
|
let mergedProps = $derived(
|
39
|
-
mergeProps(
|
39
|
+
mergeProps(localProps, menu.getOptionItemProps(itemProps)),
|
40
40
|
);
|
41
41
|
|
42
42
|
setMenuOptionItemPropsContext(() => itemProps);
|
package/dist/menu/root.svelte
CHANGED
@@ -48,18 +48,12 @@
|
|
48
48
|
);
|
49
49
|
|
50
50
|
let menu = createMenu(reflect(() => menuProps));
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
},
|
56
|
-
|
57
|
-
return presenceStrategyProps.lazyMount;
|
58
|
-
},
|
59
|
-
get keepMounted() {
|
60
|
-
return presenceStrategyProps.keepMounted;
|
61
|
-
},
|
62
|
-
});
|
51
|
+
let presence = createPresence(
|
52
|
+
reflect(() => ({
|
53
|
+
...presenceStrategyProps,
|
54
|
+
present: menu.open,
|
55
|
+
})),
|
56
|
+
);
|
63
57
|
|
64
58
|
setMenuContext(menu);
|
65
59
|
setPresenceContext(presence);
|
@@ -9,7 +9,7 @@ export function createNumberInput(props) {
|
|
9
9
|
const locale = getLocaleContext();
|
10
10
|
const environment = getEnvironmentContext();
|
11
11
|
const id = uid();
|
12
|
-
const context =
|
12
|
+
const context = reflect(() => ({
|
13
13
|
ids: {
|
14
14
|
label: field?.ids.label,
|
15
15
|
input: field?.ids.control,
|
@@ -23,9 +23,9 @@ export function createNumberInput(props) {
|
|
23
23
|
dir: locale?.dir,
|
24
24
|
locale: props.locale ?? locale?.locale,
|
25
25
|
getRootNode: environment?.getRootNode,
|
26
|
-
}))
|
26
|
+
}));
|
27
27
|
const [state, send] = useMachine(numberInput.machine(context), { context });
|
28
|
-
|
28
|
+
return reflect(() => {
|
29
29
|
const o = numberInput.connect(state, send, normalizeProps);
|
30
30
|
return {
|
31
31
|
...o,
|
@@ -36,6 +36,5 @@ export function createNumberInput(props) {
|
|
36
36
|
};
|
37
37
|
},
|
38
38
|
};
|
39
|
-
})
|
40
|
-
return api;
|
39
|
+
});
|
41
40
|
}
|
@@ -21,7 +21,7 @@
|
|
21
21
|
|
22
22
|
let {asChild, children, ...props}: NumberInputProps = $props();
|
23
23
|
|
24
|
-
let [numberInputProps,
|
24
|
+
let [numberInputProps, localProps] = $derived(
|
25
25
|
createSplitProps<CreateNumberInputProps>([
|
26
26
|
'id',
|
27
27
|
'ids',
|
@@ -54,7 +54,7 @@
|
|
54
54
|
let numberInput = createNumberInput(reflect(() => numberInputProps));
|
55
55
|
|
56
56
|
let mergedProps = $derived(
|
57
|
-
mergeProps(
|
57
|
+
mergeProps(localProps, numberInput.getRootProps()),
|
58
58
|
);
|
59
59
|
|
60
60
|
setNumberInputContext(numberInput);
|
@@ -7,13 +7,12 @@ export function createPagination(props) {
|
|
7
7
|
const locale = getLocaleContext();
|
8
8
|
const environment = getEnvironmentContext();
|
9
9
|
const id = uid();
|
10
|
-
const context =
|
10
|
+
const context = reflect(() => ({
|
11
11
|
...props,
|
12
12
|
id: props.id ?? id,
|
13
13
|
dir: locale?.dir,
|
14
14
|
getRootNode: environment?.getRootNode,
|
15
|
-
}))
|
15
|
+
}));
|
16
16
|
const [state, send] = useMachine(pagination.machine(context), { context });
|
17
|
-
|
18
|
-
return api;
|
17
|
+
return reflect(() => pagination.connect(state, send, normalizeProps));
|
19
18
|
}
|