@ark-ui/solid 2.0.1 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +41 -0
- package/cjs/index.js +288 -67
- package/cjs/index.js.map +1 -1
- package/esm/index.js +277 -69
- package/esm/index.js.map +1 -1
- package/package.json +52 -47
- package/source/clipboard/clipboard-context.js +5 -0
- package/source/clipboard/clipboard-control.jsx +8 -0
- package/source/clipboard/clipboard-indicator.jsx +16 -0
- package/source/clipboard/clipboard-input.jsx +8 -0
- package/source/clipboard/clipboard-label.jsx +8 -0
- package/source/clipboard/clipboard-root.jsx +22 -0
- package/source/clipboard/clipboard-trigger.jsx +8 -0
- package/source/clipboard/clipboard.jsx +7 -0
- package/source/clipboard/index.js +9 -0
- package/source/clipboard/use-clipboard.jsx +10 -0
- package/source/color-picker/use-color-picker.js +1 -0
- package/source/date-picker/date-picker-input.jsx +3 -1
- package/source/date-picker/date-picker-preset-trigger.jsx +10 -0
- package/source/date-picker/date-picker.jsx +2 -1
- package/source/date-picker/index.js +2 -1
- package/source/date-picker/use-date-picker.js +1 -0
- package/source/dialog/dialog-description.jsx +1 -1
- package/source/dialog/use-dialog.js +1 -1
- package/source/hover-card/use-hover-card.js +1 -1
- package/source/index.jsx +2 -0
- package/source/locale/index.js +2 -0
- package/source/locale/locale-context.jsx +7 -0
- package/source/locale/locale.jsx +24 -0
- package/source/menu/use-menu.js +1 -1
- package/source/popover/popover-description.jsx +1 -1
- package/source/popover/use-popover.js +1 -1
- package/source/select/select-control.jsx +5 -1
- package/source/select/use-select.js +6 -1
- package/source/tooltip/use-tooltip.js +1 -1
- package/source/tree-view/index.js +2 -1
- package/source/tree-view/tree-view-branch-content.jsx +3 -8
- package/source/tree-view/tree-view-branch-context.js +5 -0
- package/source/tree-view/tree-view-branch-control.jsx +3 -8
- package/source/tree-view/tree-view-branch-indicator.jsx +5 -8
- package/source/tree-view/tree-view-branch-text.jsx +3 -8
- package/source/tree-view/tree-view-branch-trigger.jsx +4 -9
- package/source/tree-view/tree-view-branch.jsx +10 -7
- package/source/tree-view/tree-view-depth-context.js +5 -0
- package/source/tree-view/tree-view-item-context.js +5 -0
- package/source/tree-view/tree-view-item-indicator.jsx +10 -0
- package/source/tree-view/tree-view-item-text.jsx +3 -5
- package/source/tree-view/tree-view-item.jsx +8 -3
- package/source/tree-view/tree-view-tree.jsx +4 -1
- package/source/tree-view/tree-view.jsx +2 -1
- package/types/clipboard/clipboard-context.d.ts +4 -0
- package/types/clipboard/clipboard-control.d.ts +4 -0
- package/types/clipboard/clipboard-indicator.d.ts +10 -0
- package/types/clipboard/clipboard-input.d.ts +4 -0
- package/types/clipboard/clipboard-label.d.ts +4 -0
- package/types/clipboard/clipboard-root.d.ts +11 -0
- package/types/clipboard/clipboard-trigger.d.ts +4 -0
- package/types/clipboard/clipboard.d.ts +7 -0
- package/types/clipboard/index.d.ts +11 -0
- package/types/clipboard/use-clipboard.d.ts +9 -0
- package/types/color-picker/use-color-picker.d.ts +1 -1
- package/types/date-picker/date-picker-input.d.ts +4 -2
- package/types/date-picker/date-picker-preset-trigger.d.ts +6 -0
- package/types/date-picker/date-picker.d.ts +2 -1
- package/types/date-picker/index.d.ts +3 -2
- package/types/date-picker/use-date-picker.d.ts +1 -1
- package/types/dialog/dialog-description.d.ts +2 -2
- package/types/dialog/use-dialog.d.ts +1 -1
- package/types/hover-card/use-hover-card.d.ts +1 -1
- package/types/index.d.ts +2 -0
- package/types/locale/index.d.ts +2 -0
- package/types/locale/locale-context.d.ts +5 -0
- package/types/locale/locale.d.ts +9 -0
- package/types/menu/index.d.ts +2 -2
- package/types/menu/use-menu.d.ts +1 -1
- package/types/popover/popover-description.d.ts +2 -2
- package/types/popover/use-popover.d.ts +1 -1
- package/types/select/use-select.d.ts +1 -1
- package/types/tooltip/use-tooltip.d.ts +1 -1
- package/types/tree-view/index.d.ts +3 -2
- package/types/tree-view/tree-view-branch-content.d.ts +2 -4
- package/types/tree-view/tree-view-branch-context.d.ts +6 -0
- package/types/tree-view/tree-view-branch-control.d.ts +2 -4
- package/types/tree-view/tree-view-branch-indicator.d.ts +2 -4
- package/types/tree-view/tree-view-branch-text.d.ts +2 -4
- package/types/tree-view/tree-view-branch-trigger.d.ts +2 -4
- package/types/tree-view/tree-view-branch.d.ts +4 -3
- package/types/tree-view/tree-view-context.d.ts +0 -16
- package/types/tree-view/tree-view-depth-context.d.ts +2 -0
- package/types/tree-view/tree-view-item-context.d.ts +6 -0
- package/types/tree-view/tree-view-item-indicator.d.ts +4 -0
- package/types/tree-view/tree-view-item-text.d.ts +2 -4
- package/types/tree-view/tree-view-item.d.ts +2 -1
- package/types/tree-view/tree-view.d.ts +2 -1
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ark-ui/solid",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "A collection of unstyled, accessible UI components for Solid, utilizing state machines for seamless interaction.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"accordion",
|
|
7
7
|
"avatar",
|
|
8
8
|
"carousel",
|
|
9
9
|
"checkbox",
|
|
10
|
+
"clipboard",
|
|
10
11
|
"color picker",
|
|
11
12
|
"combobox",
|
|
12
13
|
"date picker",
|
|
@@ -15,6 +16,7 @@
|
|
|
15
16
|
"environment",
|
|
16
17
|
"file upload",
|
|
17
18
|
"hover card",
|
|
19
|
+
"locale",
|
|
18
20
|
"menu",
|
|
19
21
|
"number input",
|
|
20
22
|
"pagination",
|
|
@@ -82,73 +84,76 @@
|
|
|
82
84
|
"release-it": "release-it --config ../../../release-it.json"
|
|
83
85
|
},
|
|
84
86
|
"dependencies": {
|
|
85
|
-
"@ark-ui/anatomy": "2.
|
|
86
|
-
"@zag-js/accordion": "0.
|
|
87
|
-
"@zag-js/avatar": "0.
|
|
88
|
-
"@zag-js/carousel": "0.
|
|
89
|
-
"@zag-js/checkbox": "0.
|
|
90
|
-
"@zag-js/
|
|
91
|
-
"@zag-js/
|
|
92
|
-
"@zag-js/
|
|
93
|
-
"@zag-js/
|
|
94
|
-
"@zag-js/
|
|
95
|
-
"@zag-js/
|
|
96
|
-
"@zag-js/
|
|
97
|
-
"@zag-js/
|
|
98
|
-
"@zag-js/
|
|
99
|
-
"@zag-js/
|
|
100
|
-
"@zag-js/
|
|
101
|
-
"@zag-js/
|
|
102
|
-
"@zag-js/
|
|
103
|
-
"@zag-js/
|
|
104
|
-
"@zag-js/
|
|
105
|
-
"@zag-js/
|
|
106
|
-
"@zag-js/
|
|
107
|
-
"@zag-js/
|
|
108
|
-
"@zag-js/
|
|
109
|
-
"@zag-js/
|
|
110
|
-
"@zag-js/
|
|
111
|
-
"@zag-js/
|
|
112
|
-
"@zag-js/
|
|
113
|
-
"@zag-js/
|
|
114
|
-
"@zag-js/
|
|
115
|
-
"@zag-js/
|
|
116
|
-
"@zag-js/
|
|
117
|
-
"@zag-js/
|
|
87
|
+
"@ark-ui/anatomy": "2.2.0",
|
|
88
|
+
"@zag-js/accordion": "0.36.2",
|
|
89
|
+
"@zag-js/avatar": "0.36.2",
|
|
90
|
+
"@zag-js/carousel": "0.36.2",
|
|
91
|
+
"@zag-js/checkbox": "0.36.2",
|
|
92
|
+
"@zag-js/clipboard": "0.36.2",
|
|
93
|
+
"@zag-js/collapsible": "0.36.2",
|
|
94
|
+
"@zag-js/color-picker": "0.36.2",
|
|
95
|
+
"@zag-js/combobox": "0.36.2",
|
|
96
|
+
"@zag-js/date-picker": "0.36.2",
|
|
97
|
+
"@zag-js/dialog": "0.36.2",
|
|
98
|
+
"@zag-js/editable": "0.36.2",
|
|
99
|
+
"@zag-js/file-upload": "0.36.2",
|
|
100
|
+
"@zag-js/hover-card": "0.36.2",
|
|
101
|
+
"@zag-js/i18n-utils": "0.36.2",
|
|
102
|
+
"@zag-js/menu": "0.36.2",
|
|
103
|
+
"@zag-js/number-input": "0.36.2",
|
|
104
|
+
"@zag-js/pagination": "0.36.2",
|
|
105
|
+
"@zag-js/pin-input": "0.36.2",
|
|
106
|
+
"@zag-js/popover": "0.36.2",
|
|
107
|
+
"@zag-js/presence": "0.36.2",
|
|
108
|
+
"@zag-js/progress": "0.36.2",
|
|
109
|
+
"@zag-js/radio-group": "0.36.2",
|
|
110
|
+
"@zag-js/rating-group": "0.36.2",
|
|
111
|
+
"@zag-js/select": "0.36.2",
|
|
112
|
+
"@zag-js/slider": "0.36.2",
|
|
113
|
+
"@zag-js/solid": "0.36.2",
|
|
114
|
+
"@zag-js/splitter": "0.36.2",
|
|
115
|
+
"@zag-js/switch": "0.36.2",
|
|
116
|
+
"@zag-js/tabs": "0.36.2",
|
|
117
|
+
"@zag-js/tags-input": "0.36.2",
|
|
118
|
+
"@zag-js/toast": "0.36.2",
|
|
119
|
+
"@zag-js/toggle-group": "0.36.2",
|
|
120
|
+
"@zag-js/tooltip": "0.36.2",
|
|
121
|
+
"@zag-js/tree-view": "0.36.2",
|
|
122
|
+
"@zag-js/types": "0.36.2"
|
|
118
123
|
},
|
|
119
124
|
"devDependencies": {
|
|
120
125
|
"@release-it/keep-a-changelog": "5.0.0",
|
|
121
|
-
"@solidjs/testing-library": "0.8.
|
|
122
|
-
"@storybook/addon-essentials": "7.6.
|
|
123
|
-
"@storybook/addon-interactions": "7.6.
|
|
124
|
-
"@storybook/addon-links": "7.6.
|
|
125
|
-
"@storybook/blocks": "7.6.
|
|
126
|
+
"@solidjs/testing-library": "0.8.6",
|
|
127
|
+
"@storybook/addon-essentials": "7.6.14",
|
|
128
|
+
"@storybook/addon-interactions": "7.6.14",
|
|
129
|
+
"@storybook/addon-links": "7.6.14",
|
|
130
|
+
"@storybook/blocks": "7.6.14",
|
|
126
131
|
"@storybook/testing-library": "0.2.2",
|
|
127
132
|
"@testing-library/dom": "9.3.4",
|
|
128
|
-
"@testing-library/jest-dom": "6.
|
|
133
|
+
"@testing-library/jest-dom": "6.4.2",
|
|
129
134
|
"@testing-library/user-event": "14.5.2",
|
|
130
135
|
"@types/jsdom": "21.1.6",
|
|
131
136
|
"@types/testing-library__jest-dom": "5.14.9",
|
|
132
|
-
"@typescript-eslint/eslint-plugin": "6.
|
|
133
|
-
"@typescript-eslint/parser": "6.
|
|
137
|
+
"@typescript-eslint/eslint-plugin": "6.21.0",
|
|
138
|
+
"@typescript-eslint/parser": "6.21.0",
|
|
134
139
|
"@vitest/coverage-v8": "1.2.2",
|
|
135
140
|
"eslint": "8.56.0",
|
|
136
141
|
"eslint-plugin-jest-dom": "5.1.0",
|
|
137
142
|
"eslint-plugin-testing-library": "6.2.0",
|
|
138
|
-
"globby": "14.0.
|
|
143
|
+
"globby": "14.0.1",
|
|
139
144
|
"jsdom": "24.0.0",
|
|
140
145
|
"react": "18.2.0",
|
|
141
146
|
"react-dom": "18.2.0",
|
|
142
147
|
"release-it": "17.0.3",
|
|
143
148
|
"resize-observer-polyfill": "1.5.1",
|
|
144
|
-
"rollup": "4.
|
|
149
|
+
"rollup": "4.10.0",
|
|
145
150
|
"rollup-preset-solid": "2.0.1",
|
|
146
|
-
"solid-js": "1.8.
|
|
147
|
-
"storybook": "7.6.
|
|
151
|
+
"solid-js": "1.8.14",
|
|
152
|
+
"storybook": "7.6.14",
|
|
148
153
|
"storybook-solidjs": "1.0.0-beta.2",
|
|
149
154
|
"storybook-solidjs-vite": "1.0.0-beta.2",
|
|
150
155
|
"typescript": "5.3.3",
|
|
151
|
-
"vite": "5.
|
|
156
|
+
"vite": "5.1.1",
|
|
152
157
|
"vite-plugin-solid": "2.9.1",
|
|
153
158
|
"vitest": "1.2.2"
|
|
154
159
|
},
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { mergeProps } from '@zag-js/solid';
|
|
2
|
+
import { ark } from '../factory';
|
|
3
|
+
import { useClipboardContext } from './clipboard-context';
|
|
4
|
+
export const ClipboardControl = (props) => {
|
|
5
|
+
const api = useClipboardContext();
|
|
6
|
+
const mergedProps = mergeProps(() => api().controlProps, props);
|
|
7
|
+
return <ark.div {...mergedProps}/>;
|
|
8
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { mergeProps } from '@zag-js/solid';
|
|
2
|
+
import { Show, children } from 'solid-js';
|
|
3
|
+
import { createSplitProps } from '../create-split-props';
|
|
4
|
+
import { ark } from '../factory';
|
|
5
|
+
import { useClipboardContext } from './clipboard-context';
|
|
6
|
+
export const ClipboardIndicator = (props) => {
|
|
7
|
+
const [indicatorProps, localProps] = createSplitProps()(props, ['copied']);
|
|
8
|
+
const api = useClipboardContext();
|
|
9
|
+
const mergedProps = mergeProps(api().getIndicatorProps({ copied: api().isCopied }), localProps);
|
|
10
|
+
const getChildren = children(() => localProps.children);
|
|
11
|
+
return (<ark.div {...mergedProps}>
|
|
12
|
+
<Show when={api().isCopied} fallback={getChildren()}>
|
|
13
|
+
{indicatorProps.copied}
|
|
14
|
+
</Show>
|
|
15
|
+
</ark.div>);
|
|
16
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { mergeProps } from '@zag-js/solid';
|
|
2
|
+
import { ark } from '../factory';
|
|
3
|
+
import { useClipboardContext } from './clipboard-context';
|
|
4
|
+
export const ClipboardInput = (props) => {
|
|
5
|
+
const api = useClipboardContext();
|
|
6
|
+
const mergedProps = mergeProps(() => api().inputProps, props);
|
|
7
|
+
return <ark.input {...mergedProps}/>;
|
|
8
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { mergeProps } from '@zag-js/solid';
|
|
2
|
+
import { ark } from '../factory';
|
|
3
|
+
import { useClipboardContext } from './clipboard-context';
|
|
4
|
+
export const ClipboardLabel = (props) => {
|
|
5
|
+
const api = useClipboardContext();
|
|
6
|
+
const mergedProps = mergeProps(() => api().labelProps, props);
|
|
7
|
+
return <ark.label {...mergedProps}/>;
|
|
8
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { mergeProps } from '@zag-js/solid';
|
|
2
|
+
import { createSplitProps } from '../create-split-props';
|
|
3
|
+
import { ark } from '../factory';
|
|
4
|
+
import { runIfFn } from '../run-if-fn';
|
|
5
|
+
import { ClipboardProvider } from './clipboard-context';
|
|
6
|
+
import { useClipboard } from './use-clipboard';
|
|
7
|
+
export const ClipboardRoot = (props) => {
|
|
8
|
+
const [useClipboardProps, localProps] = createSplitProps()(props, [
|
|
9
|
+
'getRootNode',
|
|
10
|
+
'id',
|
|
11
|
+
'ids',
|
|
12
|
+
'value',
|
|
13
|
+
'timeout',
|
|
14
|
+
'onCopyStatusChange',
|
|
15
|
+
]);
|
|
16
|
+
const api = useClipboard(useClipboardProps);
|
|
17
|
+
const mergedProps = mergeProps(() => api().rootProps, localProps);
|
|
18
|
+
const getChildren = () => runIfFn(localProps.children, api);
|
|
19
|
+
return (<ClipboardProvider value={api}>
|
|
20
|
+
<ark.div {...mergedProps}>{getChildren()}</ark.div>
|
|
21
|
+
</ClipboardProvider>);
|
|
22
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { mergeProps } from '@zag-js/solid';
|
|
2
|
+
import { ark } from '../factory';
|
|
3
|
+
import { useClipboardContext } from './clipboard-context';
|
|
4
|
+
export const ClipboardTrigger = (props) => {
|
|
5
|
+
const api = useClipboardContext();
|
|
6
|
+
const mergedProps = mergeProps(() => api().triggerProps, props);
|
|
7
|
+
return <ark.button {...mergedProps}/>;
|
|
8
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ClipboardControl as Control } from './clipboard-control';
|
|
2
|
+
import { ClipboardIndicator as Indicator } from './clipboard-indicator';
|
|
3
|
+
import { ClipboardInput as Input } from './clipboard-input';
|
|
4
|
+
import { ClipboardLabel as Label } from './clipboard-label';
|
|
5
|
+
import { ClipboardRoot as Root } from './clipboard-root';
|
|
6
|
+
import { ClipboardTrigger as Trigger } from './clipboard-trigger';
|
|
7
|
+
export { Control, Indicator, Input, Label, Root, Trigger };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useClipboardContext } from './clipboard-context';
|
|
2
|
+
import { ClipboardControl } from './clipboard-control';
|
|
3
|
+
import { ClipboardIndicator } from './clipboard-indicator';
|
|
4
|
+
import { ClipboardInput } from './clipboard-input';
|
|
5
|
+
import { ClipboardLabel } from './clipboard-label';
|
|
6
|
+
import { ClipboardRoot } from './clipboard-root';
|
|
7
|
+
import { ClipboardTrigger } from './clipboard-trigger';
|
|
8
|
+
export * as Clipboard from './clipboard';
|
|
9
|
+
export { ClipboardControl, ClipboardIndicator, ClipboardInput, ClipboardLabel, ClipboardRoot, ClipboardTrigger, useClipboardContext, };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as clipboard from '@zag-js/clipboard';
|
|
2
|
+
import { mergeProps, normalizeProps, useMachine } from '@zag-js/solid';
|
|
3
|
+
import { createMemo, createUniqueId } from 'solid-js';
|
|
4
|
+
import { useEnvironmentContext } from '../environment';
|
|
5
|
+
export const useClipboard = (props) => {
|
|
6
|
+
const getRootNode = useEnvironmentContext();
|
|
7
|
+
const context = mergeProps({ id: createUniqueId(), getRootNode }, props);
|
|
8
|
+
const [state, send] = useMachine(clipboard.machine(context), { context });
|
|
9
|
+
return createMemo(() => clipboard.connect(state, send, normalizeProps));
|
|
10
|
+
};
|
|
@@ -9,6 +9,7 @@ export const useColorPicker = (props) => {
|
|
|
9
9
|
id: createUniqueId(),
|
|
10
10
|
getRootNode,
|
|
11
11
|
value: local.value ? colorPicker.parse(local.value) : undefined,
|
|
12
|
+
'open.controlled': props.open !== undefined,
|
|
12
13
|
}), rest);
|
|
13
14
|
const [state, send] = useMachine(colorPicker.machine(context), { context });
|
|
14
15
|
return createMemo(() => colorPicker.connect(state, send, normalizeProps));
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { mergeProps } from '@zag-js/solid';
|
|
2
|
+
import { createSplitProps } from '../create-split-props';
|
|
2
3
|
import { ark } from '../factory';
|
|
3
4
|
import { useDatePickerContext } from './date-picker-context';
|
|
4
5
|
export const DatePickerInput = (props) => {
|
|
6
|
+
const [inputProps, localProps] = createSplitProps()(props, ['index']);
|
|
5
7
|
const api = useDatePickerContext();
|
|
6
|
-
const mergedProps = mergeProps(() => api().inputProps,
|
|
8
|
+
const mergedProps = mergeProps(() => api().getInputProps(inputProps), localProps);
|
|
7
9
|
return <ark.input {...mergedProps}/>;
|
|
8
10
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { mergeProps } from '@zag-js/solid';
|
|
2
|
+
import { createSplitProps } from '../create-split-props';
|
|
3
|
+
import { ark } from '../factory';
|
|
4
|
+
import { useDatePickerContext } from './date-picker-context';
|
|
5
|
+
export const DatePickerPresetTrigger = (props) => {
|
|
6
|
+
const [presetTriggerProps, localProps] = createSplitProps()(props, ['value']);
|
|
7
|
+
const api = useDatePickerContext();
|
|
8
|
+
const mergedProps = mergeProps(() => api().getPresetTriggerProps(presetTriggerProps), localProps);
|
|
9
|
+
return <ark.button {...mergedProps}/>;
|
|
10
|
+
};
|
|
@@ -6,6 +6,7 @@ import { DatePickerLabel as Label } from './date-picker-label';
|
|
|
6
6
|
import { DatePickerMonthSelect as MonthSelect } from './date-picker-month-select';
|
|
7
7
|
import { DatePickerNextTrigger as NextTrigger } from './date-picker-next-trigger';
|
|
8
8
|
import { DatePickerPositioner as Positioner } from './date-picker-positioner';
|
|
9
|
+
import { DatePickerPresetTrigger as PresetTrigger } from './date-picker-preset-trigger';
|
|
9
10
|
import { DatePickerPrevTrigger as PrevTrigger } from './date-picker-prev-trigger';
|
|
10
11
|
import { DatePickerRangeText as RangeText } from './date-picker-range-text';
|
|
11
12
|
import { DatePickerRoot as Root } from './date-picker-root';
|
|
@@ -21,4 +22,4 @@ import { DatePickerView as View } from './date-picker-view';
|
|
|
21
22
|
import { DatePickerViewControl as ViewControl } from './date-picker-view-control';
|
|
22
23
|
import { DatePickerViewTrigger as ViewTrigger } from './date-picker-view-trigger';
|
|
23
24
|
import { DatePickerYearSelect as YearSelect } from './date-picker-year-select';
|
|
24
|
-
export { ClearTrigger, Content, Control, Input, Label, MonthSelect, NextTrigger, Positioner, PrevTrigger, RangeText, Root, Table, TableBody, TableCell, TableCellTrigger, TableHead, TableHeader, TableRow, Trigger, View, ViewControl, ViewTrigger, YearSelect, };
|
|
25
|
+
export { ClearTrigger, Content, Control, Input, Label, MonthSelect, NextTrigger, Positioner, PresetTrigger, PrevTrigger, RangeText, Root, Table, TableBody, TableCell, TableCellTrigger, TableHead, TableHeader, TableRow, Trigger, View, ViewControl, ViewTrigger, YearSelect, };
|
|
@@ -7,6 +7,7 @@ import { DatePickerLabel } from './date-picker-label';
|
|
|
7
7
|
import { DatePickerMonthSelect } from './date-picker-month-select';
|
|
8
8
|
import { DatePickerNextTrigger } from './date-picker-next-trigger';
|
|
9
9
|
import { DatePickerPositioner } from './date-picker-positioner';
|
|
10
|
+
import { DatePickerPresetTrigger, } from './date-picker-preset-trigger';
|
|
10
11
|
import { DatePickerPrevTrigger } from './date-picker-prev-trigger';
|
|
11
12
|
import { DatePickerRangeText } from './date-picker-range-text';
|
|
12
13
|
import { DatePickerRoot } from './date-picker-root';
|
|
@@ -26,4 +27,4 @@ import { DatePickerViewControl } from './date-picker-view-control';
|
|
|
26
27
|
import { DatePickerViewTrigger } from './date-picker-view-trigger';
|
|
27
28
|
import { DatePickerYearSelect } from './date-picker-year-select';
|
|
28
29
|
export * as DatePicker from './date-picker';
|
|
29
|
-
export { DatePickerClearTrigger, DatePickerContent, DatePickerControl, DatePickerInput, DatePickerLabel, DatePickerMonthSelect, DatePickerNextTrigger, DatePickerPositioner, DatePickerPrevTrigger, DatePickerRangeText, DatePickerRoot, DatePickerTable, DatePickerTableBody, DatePickerTableCell, DatePickerTableCellTrigger, DatePickerTableHead, DatePickerTableHeader, DatePickerTableRow, DatePickerTrigger, DatePickerView, DatePickerViewControl, DatePickerViewTrigger, DatePickerYearSelect, useDatePickerContext, useDatePickerTableCellContext, useDatePickerTableContext, useDatePickerViewContext, };
|
|
30
|
+
export { DatePickerClearTrigger, DatePickerContent, DatePickerControl, DatePickerInput, DatePickerLabel, DatePickerMonthSelect, DatePickerNextTrigger, DatePickerPositioner, DatePickerPresetTrigger, DatePickerPrevTrigger, DatePickerRangeText, DatePickerRoot, DatePickerTable, DatePickerTableBody, DatePickerTableCell, DatePickerTableCellTrigger, DatePickerTableHead, DatePickerTableHeader, DatePickerTableRow, DatePickerTrigger, DatePickerView, DatePickerViewControl, DatePickerViewTrigger, DatePickerYearSelect, useDatePickerContext, useDatePickerTableCellContext, useDatePickerTableContext, useDatePickerViewContext, };
|
|
@@ -10,6 +10,7 @@ export const useDatePicker = (props) => {
|
|
|
10
10
|
getRootNode,
|
|
11
11
|
focusedValue: local.focusedValue ? datePicker.parse(local.focusedValue) : undefined,
|
|
12
12
|
value: local.value ? datePicker.parse(local.value) : undefined,
|
|
13
|
+
'open.controlled': props.open !== undefined,
|
|
13
14
|
}), rest);
|
|
14
15
|
const [state, send] = useMachine(datePicker.machine(context), { context });
|
|
15
16
|
return createMemo(() => datePicker.connect(state, send, normalizeProps));
|
|
@@ -4,5 +4,5 @@ import { useDialogContext } from './dialog-context';
|
|
|
4
4
|
export const DialogDescription = (props) => {
|
|
5
5
|
const dialog = useDialogContext();
|
|
6
6
|
const mergedProps = mergeProps(() => dialog().descriptionProps, props);
|
|
7
|
-
return <ark.
|
|
7
|
+
return <ark.div {...mergedProps}/>;
|
|
8
8
|
};
|
|
@@ -4,7 +4,7 @@ import { createMemo, createUniqueId } from 'solid-js';
|
|
|
4
4
|
import { useEnvironmentContext } from '../environment';
|
|
5
5
|
export const useDialog = (props) => {
|
|
6
6
|
const getRootNode = useEnvironmentContext();
|
|
7
|
-
const context = mergeProps({ id: createUniqueId(), getRootNode }, props);
|
|
7
|
+
const context = mergeProps({ id: createUniqueId(), getRootNode, 'open.controlled': props.open !== undefined }, props);
|
|
8
8
|
const [state, send] = useMachine(dialog.machine(context), { context });
|
|
9
9
|
return createMemo(() => dialog.connect(state, send, normalizeProps));
|
|
10
10
|
};
|
|
@@ -4,7 +4,7 @@ import { createMemo, createUniqueId } from 'solid-js';
|
|
|
4
4
|
import { useEnvironmentContext } from '../environment';
|
|
5
5
|
export const useHoverCard = (props) => {
|
|
6
6
|
const getRootNode = useEnvironmentContext();
|
|
7
|
-
const context = mergeProps({ id: createUniqueId(), getRootNode }, props);
|
|
7
|
+
const context = mergeProps({ id: createUniqueId(), getRootNode, 'open.controlled': props.open !== undefined }, props);
|
|
8
8
|
const [state, send] = useMachine(hoverCard.machine(context), { context });
|
|
9
9
|
return createMemo(() => hoverCard.connect(state, send, normalizeProps));
|
|
10
10
|
};
|
package/source/index.jsx
CHANGED
|
@@ -2,6 +2,7 @@ export * from './accordion';
|
|
|
2
2
|
export * from './avatar';
|
|
3
3
|
export * from './carousel';
|
|
4
4
|
export * from './checkbox';
|
|
5
|
+
export * from './clipboard';
|
|
5
6
|
export * from './color-picker';
|
|
6
7
|
export * from './combobox';
|
|
7
8
|
export * from './date-picker';
|
|
@@ -11,6 +12,7 @@ export * from './environment';
|
|
|
11
12
|
export * from './factory';
|
|
12
13
|
export * from './file-upload';
|
|
13
14
|
export * from './hover-card';
|
|
15
|
+
export * from './locale';
|
|
14
16
|
export * from './menu';
|
|
15
17
|
export * from './number-input';
|
|
16
18
|
export * from './pagination';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createContext } from '../create-context';
|
|
2
|
+
export const [LocaleContextProvider, useLocaleContext] = createContext({
|
|
3
|
+
hookName: 'useEnvironmentContext',
|
|
4
|
+
providerName: '<EnvironmentProvider />',
|
|
5
|
+
strict: false,
|
|
6
|
+
defaultValue: () => ({ dir: 'ltr', locale: 'en-US' }),
|
|
7
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { isRTL, trackLocale } from '@zag-js/i18n-utils';
|
|
2
|
+
import { createEffect, createMemo, createSignal, onCleanup, splitProps, } from 'solid-js';
|
|
3
|
+
import { useEnvironmentContext } from '../environment';
|
|
4
|
+
import { LocaleContextProvider } from './locale-context';
|
|
5
|
+
export const LocaleProvider = (props) => {
|
|
6
|
+
const [localeProps, restProps] = splitProps(props, ['locale', 'defaultLocale']);
|
|
7
|
+
const [locale, setLocale] = createSignal(localeProps.defaultLocale || localeProps.locale || 'en-US');
|
|
8
|
+
const getRootNode = useEnvironmentContext();
|
|
9
|
+
createEffect(() => {
|
|
10
|
+
const cleanup = trackLocale({
|
|
11
|
+
locale: localeProps.locale,
|
|
12
|
+
getRootNode,
|
|
13
|
+
onLocaleChange(locale) {
|
|
14
|
+
setLocale(locale.locale);
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
onCleanup(cleanup);
|
|
18
|
+
});
|
|
19
|
+
const context = createMemo(() => ({
|
|
20
|
+
locale: locale(),
|
|
21
|
+
dir: isRTL(locale()) ? 'rtl' : 'ltr',
|
|
22
|
+
}));
|
|
23
|
+
return <LocaleContextProvider value={context}>{restProps.children}</LocaleContextProvider>;
|
|
24
|
+
};
|
package/source/menu/use-menu.js
CHANGED
|
@@ -4,7 +4,7 @@ import { createMemo, createUniqueId } from 'solid-js';
|
|
|
4
4
|
import { useEnvironmentContext } from '../environment';
|
|
5
5
|
export const useMenu = (props) => {
|
|
6
6
|
const getRootNode = useEnvironmentContext();
|
|
7
|
-
const context = mergeProps({ id: createUniqueId(), getRootNode }, props);
|
|
7
|
+
const context = mergeProps({ id: createUniqueId(), getRootNode, 'open.controlled': props.open !== undefined }, props);
|
|
8
8
|
const [state, send, machine] = useMachine(menu.machine(context), { context });
|
|
9
9
|
return createMemo(() => ({
|
|
10
10
|
api: () => menu.connect(state, send, normalizeProps),
|
|
@@ -4,5 +4,5 @@ import { usePopoverContext } from './popover-context';
|
|
|
4
4
|
export const PopoverDescription = (props) => {
|
|
5
5
|
const api = usePopoverContext();
|
|
6
6
|
const mergedProps = mergeProps(() => api().descriptionProps, props);
|
|
7
|
-
return <ark.
|
|
7
|
+
return <ark.div {...mergedProps}/>;
|
|
8
8
|
};
|
|
@@ -4,7 +4,7 @@ import { createMemo, createUniqueId } from 'solid-js';
|
|
|
4
4
|
import { useEnvironmentContext } from '../environment';
|
|
5
5
|
export const usePopover = (props) => {
|
|
6
6
|
const getRootNode = useEnvironmentContext();
|
|
7
|
-
const context = mergeProps({ id: createUniqueId(), getRootNode }, props);
|
|
7
|
+
const context = mergeProps({ id: createUniqueId(), getRootNode, 'open.controlled': props.open !== undefined }, props);
|
|
8
8
|
const [state, send] = useMachine(popover.machine(context), { context });
|
|
9
9
|
return createMemo(() => popover.connect(state, send, normalizeProps));
|
|
10
10
|
};
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { mergeProps } from '@zag-js/solid';
|
|
2
|
-
import { Index } from 'solid-js';
|
|
2
|
+
import { createMemo, Index, Show } from 'solid-js';
|
|
3
3
|
import { ark } from '../factory';
|
|
4
4
|
import { useSelectContext } from './select-context';
|
|
5
5
|
export const SelectControl = (props) => {
|
|
6
6
|
const api = useSelectContext();
|
|
7
7
|
const mergedProps = mergeProps(() => api().controlProps, props);
|
|
8
|
+
const isValueEmpty = createMemo(() => api().value.length === 0);
|
|
8
9
|
return (<>
|
|
9
10
|
<ark.div {...mergedProps}/>
|
|
10
11
|
<select {...api().hiddenSelectProps}>
|
|
12
|
+
<Show when={isValueEmpty()}>
|
|
13
|
+
<option value=""/>
|
|
14
|
+
</Show>
|
|
11
15
|
<Index each={api().collection.toArray()}>
|
|
12
16
|
{(option) => <option value={option().value}>{option().label}</option>}
|
|
13
17
|
</Index>
|
|
@@ -12,7 +12,12 @@ export const useSelect = (props) => {
|
|
|
12
12
|
]);
|
|
13
13
|
const collection = () => select.collection(collectionOptions);
|
|
14
14
|
const getRootNode = useEnvironmentContext();
|
|
15
|
-
const context = () => mergeProps({
|
|
15
|
+
const context = () => mergeProps({
|
|
16
|
+
id: createUniqueId(),
|
|
17
|
+
getRootNode,
|
|
18
|
+
collection: collection(),
|
|
19
|
+
'open.controlled': props.open !== undefined,
|
|
20
|
+
}, rest);
|
|
16
21
|
const [state, send] = useMachine(select.machine(context()), {
|
|
17
22
|
context,
|
|
18
23
|
});
|
|
@@ -4,7 +4,7 @@ import { createMemo, createUniqueId } from 'solid-js';
|
|
|
4
4
|
import { useEnvironmentContext } from '../environment';
|
|
5
5
|
export const useTooltip = (props) => {
|
|
6
6
|
const getRootNode = useEnvironmentContext();
|
|
7
|
-
const context = mergeProps({ id: createUniqueId(), getRootNode }, props);
|
|
7
|
+
const context = mergeProps({ id: createUniqueId(), getRootNode, 'open.controlled': props.open !== undefined }, props);
|
|
8
8
|
const [state, send] = useMachine(tooltip.machine(context), { context });
|
|
9
9
|
return createMemo(() => tooltip.connect(state, send, normalizeProps));
|
|
10
10
|
};
|
|
@@ -6,9 +6,10 @@ import { TreeViewBranchText } from './tree-view-branch-text';
|
|
|
6
6
|
import { TreeViewBranchTrigger } from './tree-view-branch-trigger';
|
|
7
7
|
import { useTreeViewContext } from './tree-view-context';
|
|
8
8
|
import { TreeViewItem } from './tree-view-item';
|
|
9
|
+
import { TreeViewItemIndicator } from './tree-view-item-indicator';
|
|
9
10
|
import { TreeViewItemText } from './tree-view-item-text';
|
|
10
11
|
import { TreeViewLabel } from './tree-view-label';
|
|
11
12
|
import { TreeViewRoot } from './tree-view-root';
|
|
12
13
|
import { TreeViewTree } from './tree-view-tree';
|
|
13
14
|
export * as TreeView from './tree-view';
|
|
14
|
-
export { TreeViewBranch, TreeViewBranchContent, TreeViewBranchControl, TreeViewBranchIndicator, TreeViewBranchText, TreeViewBranchTrigger, TreeViewItem, TreeViewItemText, TreeViewLabel, TreeViewRoot, TreeViewTree, useTreeViewContext, };
|
|
15
|
+
export { TreeViewBranch, TreeViewBranchContent, TreeViewBranchControl, TreeViewBranchIndicator, TreeViewBranchText, TreeViewBranchTrigger, TreeViewItem, TreeViewItemIndicator, TreeViewItemText, TreeViewLabel, TreeViewRoot, TreeViewTree, useTreeViewContext, };
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
// import type { BranchProps } from '@zag-js/tree-view'
|
|
2
1
|
import { mergeProps } from '@zag-js/solid';
|
|
3
|
-
import { createSplitProps } from '../create-split-props';
|
|
4
2
|
import { ark } from '../factory';
|
|
3
|
+
import { useTreeViewBranchContext } from './tree-view-branch-context';
|
|
5
4
|
import { useTreeViewContext } from './tree-view-context';
|
|
6
5
|
export const TreeViewBranchContent = (props) => {
|
|
7
|
-
const [branchProps, localProps] = createSplitProps()(props, [
|
|
8
|
-
'depth',
|
|
9
|
-
'id',
|
|
10
|
-
'disabled',
|
|
11
|
-
]);
|
|
12
6
|
const api = useTreeViewContext();
|
|
13
|
-
const
|
|
7
|
+
const branchProps = useTreeViewBranchContext();
|
|
8
|
+
const mergedProps = mergeProps(() => api().getBranchContentProps(branchProps), props);
|
|
14
9
|
return <ark.ul {...mergedProps}/>;
|
|
15
10
|
};
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
// import type { BranchProps } from '@zag-js/tree-view'
|
|
2
1
|
import { mergeProps } from '@zag-js/solid';
|
|
3
|
-
import { createSplitProps } from '../create-split-props';
|
|
4
2
|
import { ark } from '../factory';
|
|
3
|
+
import { useTreeViewBranchContext } from './tree-view-branch-context';
|
|
5
4
|
import { useTreeViewContext } from './tree-view-context';
|
|
6
5
|
export const TreeViewBranchControl = (props) => {
|
|
7
|
-
const [branchProps, localProps] = createSplitProps()(props, [
|
|
8
|
-
'depth',
|
|
9
|
-
'id',
|
|
10
|
-
'disabled',
|
|
11
|
-
]);
|
|
12
6
|
const api = useTreeViewContext();
|
|
13
|
-
const
|
|
7
|
+
const branchProps = useTreeViewBranchContext();
|
|
8
|
+
const mergedProps = mergeProps(() => api().getBranchControlProps(branchProps), props);
|
|
14
9
|
return <ark.div {...mergedProps}/>;
|
|
15
10
|
};
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
// import type { BranchProps } from '@zag-js/tree-view'
|
|
2
1
|
import { treeViewAnatomy } from '@ark-ui/anatomy';
|
|
3
2
|
import { mergeProps } from '@zag-js/solid';
|
|
4
|
-
import { createSplitProps } from '../create-split-props';
|
|
5
3
|
import { ark } from '../factory';
|
|
4
|
+
import { useTreeViewBranchContext } from './tree-view-branch-context';
|
|
6
5
|
import { useTreeViewContext } from './tree-view-context';
|
|
7
6
|
export const TreeViewBranchIndicator = (props) => {
|
|
8
|
-
const [branchProps, localProps] = createSplitProps()(props, [
|
|
9
|
-
'depth',
|
|
10
|
-
'id',
|
|
11
|
-
'disabled',
|
|
12
|
-
]);
|
|
13
7
|
const api = useTreeViewContext();
|
|
14
|
-
const
|
|
8
|
+
const branchProps = useTreeViewBranchContext();
|
|
9
|
+
const mergedProps = mergeProps(() => api().getBranchProps(branchProps),
|
|
10
|
+
// TODO use api.getBranchIndicatorProps() when available
|
|
11
|
+
treeViewAnatomy.build().branchIndicator.attrs, props);
|
|
15
12
|
return <ark.div {...mergedProps}/>;
|
|
16
13
|
};
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
// import type { BranchProps } from '@zag-js/tree-view'
|
|
2
1
|
import { mergeProps } from '@zag-js/solid';
|
|
3
|
-
import { createSplitProps } from '../create-split-props';
|
|
4
2
|
import { ark } from '../factory';
|
|
3
|
+
import { useTreeViewBranchContext } from './tree-view-branch-context';
|
|
5
4
|
import { useTreeViewContext } from './tree-view-context';
|
|
6
5
|
export const TreeViewBranchText = (props) => {
|
|
7
|
-
const [branchProps, localProps] = createSplitProps()(props, [
|
|
8
|
-
'depth',
|
|
9
|
-
'id',
|
|
10
|
-
'disabled',
|
|
11
|
-
]);
|
|
12
6
|
const api = useTreeViewContext();
|
|
13
|
-
const
|
|
7
|
+
const branchProps = useTreeViewBranchContext();
|
|
8
|
+
const mergedProps = mergeProps(() => api().getBranchTextProps(branchProps), props);
|
|
14
9
|
return <ark.span {...mergedProps}/>;
|
|
15
10
|
};
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
// import type { BranchProps } from '@zag-js/tree-view'
|
|
2
1
|
import { mergeProps } from '@zag-js/solid';
|
|
3
|
-
import { createSplitProps } from '../create-split-props';
|
|
4
2
|
import { ark } from '../factory';
|
|
3
|
+
import { useTreeViewBranchContext } from './tree-view-branch-context';
|
|
5
4
|
import { useTreeViewContext } from './tree-view-context';
|
|
6
5
|
export const TreeViewBranchTrigger = (props) => {
|
|
7
|
-
const [branchProps, localProps] = createSplitProps()(props, [
|
|
8
|
-
'depth',
|
|
9
|
-
'id',
|
|
10
|
-
'disabled',
|
|
11
|
-
]);
|
|
12
6
|
const api = useTreeViewContext();
|
|
13
|
-
const
|
|
14
|
-
|
|
7
|
+
const branchProps = useTreeViewBranchContext();
|
|
8
|
+
const mergedProps = mergeProps(() => api().getBranchTriggerProps(branchProps), props);
|
|
9
|
+
return <ark.div {...mergedProps}/>;
|
|
15
10
|
};
|