@ark-ui/solid 1.1.0 → 1.2.0
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 +16 -1
- package/README.md +24 -21
- package/cjs/index.js +104 -84
- package/cjs/index.js.map +1 -1
- package/esm/index.js +103 -84
- package/esm/index.js.map +1 -1
- package/package.json +51 -49
- package/source/date-picker/date-picker.jsx +1 -1
- package/source/editable/editable-area.jsx +2 -2
- package/source/editable/editable-cancel-trigger.jsx +2 -2
- package/source/editable/editable-control.jsx +2 -2
- package/source/editable/editable-edit-trigger.jsx +2 -2
- package/source/editable/editable-input.jsx +2 -2
- package/source/editable/editable-label.jsx +2 -2
- package/source/editable/editable-preview.jsx +2 -2
- package/source/editable/editable-submit-trigger.jsx +2 -2
- package/source/editable/editable.jsx +5 -7
- package/source/file-upload/file-upload-item-preview-image.jsx +13 -0
- package/source/file-upload/file-upload-item-preview.jsx +3 -10
- package/source/file-upload/file-upload.jsx +5 -1
- package/source/file-upload/index.js +7 -5
- package/source/number-input/index.js +1 -1
- package/source/pagination/pagination-ellipsis.jsx +2 -2
- package/source/pagination/pagination.jsx +2 -4
- package/source/pin-input/index.js +1 -1
- package/source/pin-input/pin-input.jsx +2 -2
- package/source/radio-group/radio-group-item-context.js +2 -2
- package/source/radio-group/radio-group-item.jsx +9 -6
- package/source/rating-group/rating-group-control.jsx +1 -1
- package/source/rating-group/rating-group-item.jsx +2 -2
- package/source/rating-group/rating-group.jsx +2 -2
- package/source/segment-group/segment-group-item-context.js +2 -2
- package/source/segment-group/segment-group-item.jsx +9 -6
- package/source/select/select-indicator.jsx +1 -1
- package/source/select/select-item-group.jsx +2 -2
- package/source/select/select.jsx +2 -2
- package/source/switch/switch-label.jsx +2 -2
- package/source/switch/switch-thumb.jsx +2 -2
- package/source/switch/switch.jsx +2 -2
- package/source/toast/create-toaster.jsx +3 -3
- package/source/toast/index.js +5 -3
- package/source/toast/toast-group.jsx +4 -0
- package/types/file-upload/file-upload-item-preview-image.d.ts +4 -0
- package/types/file-upload/file-upload-item-preview.d.ts +6 -1
- package/types/file-upload/index.d.ts +9 -7
- package/types/number-input/index.d.ts +1 -1
- package/types/pin-input/index.d.ts +1 -1
- package/types/radio-group/radio-group-item-context.d.ts +1 -1
- package/types/radio-group/radio-group-item.d.ts +6 -3
- package/types/rating-group/rating-group-item-context.d.ts +2 -3
- package/types/segment-group/segment-group-item-context.d.ts +3 -14
- package/types/segment-group/segment-group-item.d.ts +6 -2
- package/types/toast/index.d.ts +6 -4
- package/types/toast/toast-group.d.ts +4 -0
- /package/source/number-input/{number-input-field.jsx → number-input-input.jsx} +0 -0
- /package/source/pin-input/{pin-input-field.jsx → pin-input-input.jsx} +0 -0
- /package/types/number-input/{number-input-field.d.ts → number-input-input.d.ts} +0 -0
- /package/types/pin-input/{pin-input-field.d.ts → pin-input-input.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ark-ui/solid",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "A collection of unstyled, accessible UI components for Solid, utilizing state machines for seamless interaction.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"accordion",
|
|
@@ -80,71 +80,73 @@
|
|
|
80
80
|
"release-it": "release-it --config ../../../release-it.json"
|
|
81
81
|
},
|
|
82
82
|
"dependencies": {
|
|
83
|
-
"@ark-ui/anatomy": "1.
|
|
84
|
-
"@zag-js/accordion": "0.
|
|
85
|
-
"@zag-js/avatar": "0.
|
|
86
|
-
"@zag-js/carousel": "0.
|
|
87
|
-
"@zag-js/checkbox": "0.
|
|
88
|
-
"@zag-js/color-picker": "0.
|
|
89
|
-
"@zag-js/combobox": "0.
|
|
90
|
-
"@zag-js/date-picker": "0.
|
|
91
|
-
"@zag-js/dialog": "0.
|
|
92
|
-
"@zag-js/editable": "0.
|
|
93
|
-
"@zag-js/file-upload": "0.
|
|
94
|
-
"@zag-js/hover-card": "0.
|
|
95
|
-
"@zag-js/menu": "0.
|
|
96
|
-
"@zag-js/number-input": "0.
|
|
97
|
-
"@zag-js/pagination": "0.
|
|
98
|
-
"@zag-js/pin-input": "0.
|
|
99
|
-
"@zag-js/popover": "0.
|
|
100
|
-
"@zag-js/presence": "0.
|
|
101
|
-
"@zag-js/radio-group": "0.
|
|
102
|
-
"@zag-js/rating-group": "0.
|
|
103
|
-
"@zag-js/select": "0.
|
|
104
|
-
"@zag-js/slider": "0.
|
|
105
|
-
"@zag-js/solid": "0.
|
|
106
|
-
"@zag-js/splitter": "0.
|
|
107
|
-
"@zag-js/switch": "0.
|
|
108
|
-
"@zag-js/tabs": "0.
|
|
109
|
-
"@zag-js/tags-input": "0.
|
|
110
|
-
"@zag-js/toast": "0.
|
|
111
|
-
"@zag-js/toggle-group": "0.
|
|
112
|
-
"@zag-js/tooltip": "0.
|
|
113
|
-
"@zag-js/types": "0.
|
|
83
|
+
"@ark-ui/anatomy": "1.2.0",
|
|
84
|
+
"@zag-js/accordion": "0.31.1",
|
|
85
|
+
"@zag-js/avatar": "0.31.1",
|
|
86
|
+
"@zag-js/carousel": "0.31.1",
|
|
87
|
+
"@zag-js/checkbox": "0.31.1",
|
|
88
|
+
"@zag-js/color-picker": "0.31.1",
|
|
89
|
+
"@zag-js/combobox": "0.31.1",
|
|
90
|
+
"@zag-js/date-picker": "0.31.1",
|
|
91
|
+
"@zag-js/dialog": "0.31.1",
|
|
92
|
+
"@zag-js/editable": "0.31.1",
|
|
93
|
+
"@zag-js/file-upload": "0.31.1",
|
|
94
|
+
"@zag-js/hover-card": "0.31.1",
|
|
95
|
+
"@zag-js/menu": "0.31.1",
|
|
96
|
+
"@zag-js/number-input": "0.31.1",
|
|
97
|
+
"@zag-js/pagination": "0.31.1",
|
|
98
|
+
"@zag-js/pin-input": "0.31.1",
|
|
99
|
+
"@zag-js/popover": "0.31.1",
|
|
100
|
+
"@zag-js/presence": "0.31.1",
|
|
101
|
+
"@zag-js/radio-group": "0.31.1",
|
|
102
|
+
"@zag-js/rating-group": "0.31.1",
|
|
103
|
+
"@zag-js/select": "0.31.1",
|
|
104
|
+
"@zag-js/slider": "0.31.1",
|
|
105
|
+
"@zag-js/solid": "0.31.1",
|
|
106
|
+
"@zag-js/splitter": "0.31.1",
|
|
107
|
+
"@zag-js/switch": "0.31.1",
|
|
108
|
+
"@zag-js/tabs": "0.31.1",
|
|
109
|
+
"@zag-js/tags-input": "0.31.1",
|
|
110
|
+
"@zag-js/toast": "0.31.1",
|
|
111
|
+
"@zag-js/toggle-group": "0.31.1",
|
|
112
|
+
"@zag-js/tooltip": "0.31.1",
|
|
113
|
+
"@zag-js/types": "0.31.1"
|
|
114
114
|
},
|
|
115
115
|
"devDependencies": {
|
|
116
116
|
"@release-it/keep-a-changelog": "5.0.0",
|
|
117
117
|
"@solidjs/testing-library": "0.8.4",
|
|
118
|
-
"@storybook/addon-essentials": "7.
|
|
119
|
-
"@storybook/addon-interactions": "7.
|
|
120
|
-
"@storybook/addon-links": "7.
|
|
121
|
-
"@storybook/blocks": "7.
|
|
118
|
+
"@storybook/addon-essentials": "7.6.4",
|
|
119
|
+
"@storybook/addon-interactions": "7.6.4",
|
|
120
|
+
"@storybook/addon-links": "7.6.4",
|
|
121
|
+
"@storybook/blocks": "7.6.4",
|
|
122
122
|
"@storybook/testing-library": "0.2.2",
|
|
123
123
|
"@testing-library/dom": "9.3.3",
|
|
124
|
-
"@testing-library/jest-dom": "6.1.
|
|
124
|
+
"@testing-library/jest-dom": "6.1.5",
|
|
125
125
|
"@testing-library/user-event": "14.5.1",
|
|
126
126
|
"@types/jsdom": "21.1.6",
|
|
127
127
|
"@types/testing-library__jest-dom": "5.14.9",
|
|
128
|
-
"@typescript-eslint/eslint-plugin": "6.
|
|
129
|
-
"@typescript-eslint/parser": "6.
|
|
128
|
+
"@typescript-eslint/eslint-plugin": "6.14.0",
|
|
129
|
+
"@typescript-eslint/parser": "6.14.0",
|
|
130
130
|
"@vitest/coverage-v8": "0.34.6",
|
|
131
|
-
"eslint": "8.
|
|
131
|
+
"eslint": "8.55.0",
|
|
132
|
+
"eslint-plugin-jest-dom": "5.1.0",
|
|
133
|
+
"eslint-plugin-testing-library": "6.2.0",
|
|
132
134
|
"globby": "14.0.0",
|
|
133
|
-
"jsdom": "
|
|
134
|
-
"lucide-solid": "0.
|
|
135
|
+
"jsdom": "23.0.1",
|
|
136
|
+
"lucide-solid": "0.294.0",
|
|
135
137
|
"react": "18.2.0",
|
|
136
138
|
"react-dom": "18.2.0",
|
|
137
|
-
"release-it": "17.0.
|
|
139
|
+
"release-it": "17.0.1",
|
|
138
140
|
"resize-observer-polyfill": "1.5.1",
|
|
139
|
-
"rollup": "4.
|
|
141
|
+
"rollup": "4.9.0",
|
|
140
142
|
"rollup-preset-solid": "2.0.1",
|
|
141
|
-
"solid-js": "1.8.
|
|
142
|
-
"storybook": "7.
|
|
143
|
+
"solid-js": "1.8.7",
|
|
144
|
+
"storybook": "7.6.4",
|
|
143
145
|
"storybook-solidjs": "1.0.0-beta.2",
|
|
144
146
|
"storybook-solidjs-vite": "1.0.0-beta.2",
|
|
145
|
-
"typescript": "5.3.
|
|
146
|
-
"vite": "
|
|
147
|
-
"vite-plugin-solid": "2.
|
|
147
|
+
"typescript": "5.3.3",
|
|
148
|
+
"vite": "5.0.8",
|
|
149
|
+
"vite-plugin-solid": "2.8.0",
|
|
148
150
|
"vitest": "0.34.2"
|
|
149
151
|
},
|
|
150
152
|
"peerDependencies": {
|
|
@@ -21,7 +21,6 @@ export const DatePicker = (props) => {
|
|
|
21
21
|
'isDateUnavailable',
|
|
22
22
|
'locale',
|
|
23
23
|
'max',
|
|
24
|
-
'messages',
|
|
25
24
|
'min',
|
|
26
25
|
'modal',
|
|
27
26
|
'name',
|
|
@@ -37,6 +36,7 @@ export const DatePicker = (props) => {
|
|
|
37
36
|
'selectionMode',
|
|
38
37
|
'startOfWeek',
|
|
39
38
|
'timeZone',
|
|
39
|
+
'translations',
|
|
40
40
|
'value',
|
|
41
41
|
'view',
|
|
42
42
|
]);
|
|
@@ -2,7 +2,7 @@ import { mergeProps } from '@zag-js/solid';
|
|
|
2
2
|
import { ark } from '../factory';
|
|
3
3
|
import { useEditableContext } from './editable-context';
|
|
4
4
|
export const EditableArea = (props) => {
|
|
5
|
-
const
|
|
6
|
-
const mergedProps = mergeProps(() =>
|
|
5
|
+
const api = useEditableContext();
|
|
6
|
+
const mergedProps = mergeProps(() => api().areaProps, props);
|
|
7
7
|
return <ark.div {...mergedProps}/>;
|
|
8
8
|
};
|
|
@@ -2,7 +2,7 @@ import { mergeProps } from '@zag-js/solid';
|
|
|
2
2
|
import { ark } from '../factory';
|
|
3
3
|
import { useEditableContext } from './editable-context';
|
|
4
4
|
export const EditableCancelTrigger = (props) => {
|
|
5
|
-
const
|
|
6
|
-
const mergedProps = mergeProps(() =>
|
|
5
|
+
const api = useEditableContext();
|
|
6
|
+
const mergedProps = mergeProps(() => api().cancelTriggerProps, props);
|
|
7
7
|
return <ark.button {...mergedProps}/>;
|
|
8
8
|
};
|
|
@@ -2,7 +2,7 @@ import { mergeProps } from '@zag-js/solid';
|
|
|
2
2
|
import { ark } from '../factory';
|
|
3
3
|
import { useEditableContext } from './editable-context';
|
|
4
4
|
export const EditableControl = (props) => {
|
|
5
|
-
const
|
|
6
|
-
const mergedProps = mergeProps(() =>
|
|
5
|
+
const api = useEditableContext();
|
|
6
|
+
const mergedProps = mergeProps(() => api().controlProps, props);
|
|
7
7
|
return <ark.div {...mergedProps}/>;
|
|
8
8
|
};
|
|
@@ -2,7 +2,7 @@ import { mergeProps } from '@zag-js/solid';
|
|
|
2
2
|
import { ark } from '../factory';
|
|
3
3
|
import { useEditableContext } from './editable-context';
|
|
4
4
|
export const EditableEditTrigger = (props) => {
|
|
5
|
-
const
|
|
6
|
-
const mergedProps = mergeProps(() =>
|
|
5
|
+
const api = useEditableContext();
|
|
6
|
+
const mergedProps = mergeProps(() => api().editTriggerProps, props);
|
|
7
7
|
return <ark.button {...mergedProps}/>;
|
|
8
8
|
};
|
|
@@ -2,7 +2,7 @@ import { mergeProps } from '@zag-js/solid';
|
|
|
2
2
|
import { ark } from '../factory';
|
|
3
3
|
import { useEditableContext } from './editable-context';
|
|
4
4
|
export const EditableInput = (props) => {
|
|
5
|
-
const
|
|
6
|
-
const mergedProps = mergeProps(() =>
|
|
5
|
+
const api = useEditableContext();
|
|
6
|
+
const mergedProps = mergeProps(() => api().inputProps, props);
|
|
7
7
|
return <ark.input {...mergedProps}/>;
|
|
8
8
|
};
|
|
@@ -2,7 +2,7 @@ import { mergeProps } from '@zag-js/solid';
|
|
|
2
2
|
import { ark } from '../factory';
|
|
3
3
|
import { useEditableContext } from './editable-context';
|
|
4
4
|
export const EditableLabel = (props) => {
|
|
5
|
-
const
|
|
6
|
-
const mergedProps = mergeProps(() =>
|
|
5
|
+
const api = useEditableContext();
|
|
6
|
+
const mergedProps = mergeProps(() => api().labelProps, props);
|
|
7
7
|
return <ark.label {...mergedProps}/>;
|
|
8
8
|
};
|
|
@@ -2,7 +2,7 @@ import { mergeProps } from '@zag-js/solid';
|
|
|
2
2
|
import { ark } from '../factory';
|
|
3
3
|
import { useEditableContext } from './editable-context';
|
|
4
4
|
export const EditablePreview = (props) => {
|
|
5
|
-
const
|
|
6
|
-
const mergedProps = mergeProps(() =>
|
|
5
|
+
const api = useEditableContext();
|
|
6
|
+
const mergedProps = mergeProps(() => api().previewProps, props);
|
|
7
7
|
return <ark.span {...mergedProps}/>;
|
|
8
8
|
};
|
|
@@ -2,7 +2,7 @@ import { mergeProps } from '@zag-js/solid';
|
|
|
2
2
|
import { ark } from '../factory';
|
|
3
3
|
import { useEditableContext } from './editable-context';
|
|
4
4
|
export const EditableSubmitTrigger = (props) => {
|
|
5
|
-
const
|
|
6
|
-
const mergedProps = mergeProps(() =>
|
|
5
|
+
const api = useEditableContext();
|
|
6
|
+
const mergedProps = mergeProps(() => api().submitTriggerProps, props);
|
|
7
7
|
return <ark.button {...mergedProps}/>;
|
|
8
8
|
};
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { mergeProps } from '@zag-js/solid';
|
|
2
|
-
import { splitProps } from 'solid-js';
|
|
3
2
|
import { createSplitProps } from '../create-split-props';
|
|
4
3
|
import { ark } from '../factory';
|
|
5
4
|
import { runIfFn } from '../run-if-fn';
|
|
6
5
|
import { EditableProvider } from './editable-context';
|
|
7
6
|
import { useEditable } from './use-editable';
|
|
8
7
|
export const Editable = (props) => {
|
|
9
|
-
const [useEditableProps,
|
|
8
|
+
const [useEditableProps, localProps] = createSplitProps()(props, [
|
|
10
9
|
'activationMode',
|
|
11
10
|
'autoResize',
|
|
12
11
|
'dir',
|
|
@@ -34,11 +33,10 @@ export const Editable = (props) => {
|
|
|
34
33
|
'translations',
|
|
35
34
|
'value',
|
|
36
35
|
]);
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
return (<EditableProvider value={editable}>
|
|
36
|
+
const api = useEditable(useEditableProps);
|
|
37
|
+
const mergedProps = mergeProps(() => api().rootProps, localProps);
|
|
38
|
+
const getChildren = () => runIfFn(localProps.children, api);
|
|
39
|
+
return (<EditableProvider value={api}>
|
|
42
40
|
<ark.div {...mergedProps}>{getChildren()}</ark.div>
|
|
43
41
|
</EditableProvider>);
|
|
44
42
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { mergeProps } from '@zag-js/solid';
|
|
2
|
+
import { createSignal } from 'solid-js';
|
|
3
|
+
import { ark } from '../factory';
|
|
4
|
+
import { useFileUploadContext } from './file-upload-context';
|
|
5
|
+
import { useFileUploadItemContext } from './file-upload-item-context';
|
|
6
|
+
export const FileUploadItemPreviewImage = (props) => {
|
|
7
|
+
const api = useFileUploadContext();
|
|
8
|
+
const item = useFileUploadItemContext();
|
|
9
|
+
const [url, setUrl] = createSignal('');
|
|
10
|
+
api().createFileUrl(item.file, (url) => setUrl(url));
|
|
11
|
+
const mergedProps = mergeProps(api().getItemPreviewImageProps({ ...item, url: url() }), props);
|
|
12
|
+
return <ark.img {...mergedProps}/>;
|
|
13
|
+
};
|
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
import { mergeProps } from '@zag-js/solid';
|
|
2
|
-
import { createSignal } from 'solid-js';
|
|
3
2
|
import { ark } from '../factory';
|
|
4
3
|
import { useFileUploadContext } from './file-upload-context';
|
|
5
4
|
import { useFileUploadItemContext } from './file-upload-item-context';
|
|
6
5
|
export const FileUploadItemPreview = (props) => {
|
|
7
6
|
const api = useFileUploadContext();
|
|
8
7
|
const item = useFileUploadItemContext();
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
try {
|
|
12
|
-
const mergedProps = mergeProps(api().getItemPreviewProps({ ...item, url: url() }), props);
|
|
13
|
-
return <ark.img {...mergedProps}/>;
|
|
14
|
-
}
|
|
15
|
-
catch (e) {
|
|
16
|
-
// TODO We could render a fallback component
|
|
8
|
+
const mergedProps = mergeProps(() => api().getItemPreviewProps(item), props);
|
|
9
|
+
if (!item.file.type.match(props.type ?? '.*'))
|
|
17
10
|
return null;
|
|
18
|
-
}
|
|
11
|
+
return <ark.div {...mergedProps}/>;
|
|
19
12
|
};
|
|
@@ -13,13 +13,17 @@ export const FileUpload = (props) => {
|
|
|
13
13
|
'files',
|
|
14
14
|
'getRootNode',
|
|
15
15
|
'id',
|
|
16
|
-
'
|
|
16
|
+
'ids',
|
|
17
17
|
'locale',
|
|
18
18
|
'maxFiles',
|
|
19
19
|
'maxFileSize',
|
|
20
20
|
'minFileSize',
|
|
21
21
|
'name',
|
|
22
|
+
'onFileAccept',
|
|
23
|
+
'onFileReject',
|
|
22
24
|
'onFilesChange',
|
|
25
|
+
'translations',
|
|
26
|
+
'validate',
|
|
23
27
|
]);
|
|
24
28
|
const api = useFileUpload(fileUploadProps);
|
|
25
29
|
const mergedProps = mergeProps(() => api().rootProps, localProps);
|
|
@@ -6,19 +6,21 @@ import { FileUploadItemDeleteTrigger, } from './file-upload-item-delete-trigger'
|
|
|
6
6
|
import { FileUploadItemGroup } from './file-upload-item-group';
|
|
7
7
|
import { FileUploadItemName } from './file-upload-item-name';
|
|
8
8
|
import { FileUploadItemPreview } from './file-upload-item-preview';
|
|
9
|
+
import { FileUploadItemPreviewImage, } from './file-upload-item-preview-image';
|
|
9
10
|
import { FileUploadItemSizeText, } from './file-upload-item-size-text';
|
|
10
11
|
import { FileUploadLabel } from './file-upload-label';
|
|
11
12
|
import { FileUploadTrigger } from './file-upload-trigger';
|
|
12
13
|
const FileUpload = Object.assign(FileUploadRoot, {
|
|
13
14
|
Root: FileUploadRoot,
|
|
14
15
|
Dropzone: FileUploadDropzone,
|
|
15
|
-
Label: FileUploadLabel,
|
|
16
|
-
Trigger: FileUploadTrigger,
|
|
17
|
-
ItemGroup: FileUploadItemGroup,
|
|
18
16
|
Item: FileUploadItem,
|
|
17
|
+
ItemDeleteTrigger: FileUploadItemDeleteTrigger,
|
|
18
|
+
ItemGroup: FileUploadItemGroup,
|
|
19
19
|
ItemName: FileUploadItemName,
|
|
20
20
|
ItemPreview: FileUploadItemPreview,
|
|
21
|
+
ItemPreviewImage: FileUploadItemPreviewImage,
|
|
21
22
|
ItemSizeText: FileUploadItemSizeText,
|
|
22
|
-
|
|
23
|
+
Label: FileUploadLabel,
|
|
24
|
+
Trigger: FileUploadTrigger,
|
|
23
25
|
});
|
|
24
|
-
export { FileUpload, FileUploadDropzone, FileUploadItem, FileUploadItemDeleteTrigger, FileUploadItemGroup, FileUploadItemName,
|
|
26
|
+
export { FileUpload, FileUploadDropzone, FileUploadItem, FileUploadItemDeleteTrigger, FileUploadItemGroup, FileUploadItemName, FileUploadItemPreviewImage, FileUploadItemSizeText, FileUploadLabel, FileUploadTrigger, useFileUploadContext, };
|
|
@@ -2,8 +2,8 @@ import { NumberInput as NumberInputRoot } from './number-input';
|
|
|
2
2
|
import { useNumberInputContext } from './number-input-context';
|
|
3
3
|
import { NumberInputControl } from './number-input-control';
|
|
4
4
|
import { NumberInputDecrementTrigger, } from './number-input-decrement-trigger';
|
|
5
|
-
import { NumberInputInput } from './number-input-field';
|
|
6
5
|
import { NumberInputIncrementTrigger, } from './number-input-increment-trigger';
|
|
6
|
+
import { NumberInputInput } from './number-input-input';
|
|
7
7
|
import { NumberInputLabel } from './number-input-label';
|
|
8
8
|
import { NumberInputScrubber } from './number-input-scrubber';
|
|
9
9
|
const NumberInput = Object.assign(NumberInputRoot, {
|
|
@@ -3,8 +3,8 @@ import { createSplitProps } from '../create-split-props';
|
|
|
3
3
|
import { ark } from '../factory';
|
|
4
4
|
import { usePaginationContext } from './pagination-context';
|
|
5
5
|
export const PaginationEllipsis = (props) => {
|
|
6
|
-
const [ellipsisProps,
|
|
6
|
+
const [ellipsisProps, localProps] = createSplitProps()(props, ['index']);
|
|
7
7
|
const api = usePaginationContext();
|
|
8
|
-
const mergedProps = mergeProps(() => api().getEllipsisProps(ellipsisProps),
|
|
8
|
+
const mergedProps = mergeProps(() => api().getEllipsisProps(ellipsisProps), localProps);
|
|
9
9
|
return <ark.div {...mergedProps}/>;
|
|
10
10
|
};
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { mergeProps } from '@zag-js/solid';
|
|
2
|
-
import { splitProps } from 'solid-js';
|
|
3
2
|
import { createSplitProps } from '../create-split-props';
|
|
4
3
|
import { ark } from '../factory';
|
|
5
4
|
import { runIfFn } from '../run-if-fn';
|
|
6
5
|
import { PaginationProvider } from './pagination-context';
|
|
7
6
|
import { usePagination } from './use-pagination';
|
|
8
7
|
export const Pagination = (props) => {
|
|
9
|
-
const [paginationParams,
|
|
8
|
+
const [paginationParams, localProps] = createSplitProps()(props, [
|
|
10
9
|
'count',
|
|
11
10
|
'dir',
|
|
12
11
|
'getRootNode',
|
|
@@ -19,10 +18,9 @@ export const Pagination = (props) => {
|
|
|
19
18
|
'translations',
|
|
20
19
|
'type',
|
|
21
20
|
]);
|
|
22
|
-
const [childrenProps, localProps] = splitProps(restProps, ['children']);
|
|
23
21
|
const api = usePagination(paginationParams);
|
|
24
|
-
const getChildren = () => runIfFn(childrenProps.children, api);
|
|
25
22
|
const mergedProps = mergeProps(() => api().rootProps, localProps);
|
|
23
|
+
const getChildren = () => runIfFn(localProps.children, api);
|
|
26
24
|
return (<PaginationProvider value={api}>
|
|
27
25
|
<ark.nav {...mergedProps}>{getChildren()}</ark.nav>
|
|
28
26
|
</PaginationProvider>);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PinInput as PinInputRoot } from './pin-input';
|
|
2
2
|
import { usePinInputContext } from './pin-input-context';
|
|
3
3
|
import { PinInputControl } from './pin-input-control';
|
|
4
|
-
import { PinInputInput } from './pin-input-
|
|
4
|
+
import { PinInputInput } from './pin-input-input';
|
|
5
5
|
import { PinInputLabel } from './pin-input-label';
|
|
6
6
|
const PinInput = Object.assign(PinInputRoot, {
|
|
7
7
|
Root: PinInputRoot,
|
|
@@ -4,7 +4,7 @@ import { ark } from '../factory';
|
|
|
4
4
|
import { PinInputProvider } from './pin-input-context';
|
|
5
5
|
import { usePinInput } from './use-pin-input';
|
|
6
6
|
export const PinInput = (props) => {
|
|
7
|
-
const [
|
|
7
|
+
const [usePinInputProps, localProps] = createSplitProps()(props, [
|
|
8
8
|
'autoFocus',
|
|
9
9
|
'blurOnComplete',
|
|
10
10
|
'dir',
|
|
@@ -27,7 +27,7 @@ export const PinInput = (props) => {
|
|
|
27
27
|
'type',
|
|
28
28
|
'value',
|
|
29
29
|
]);
|
|
30
|
-
const api = usePinInput(
|
|
30
|
+
const api = usePinInput(usePinInputProps);
|
|
31
31
|
const mergedProps = mergeProps(() => api().rootProps, localProps);
|
|
32
32
|
return (<PinInputProvider value={api}>
|
|
33
33
|
<ark.div {...mergedProps}/>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createContext } from '../create-context';
|
|
2
|
-
export const [
|
|
2
|
+
export const [RadioGroupItemProvider, useRadioGroupItemContext] = createContext({
|
|
3
3
|
hookName: 'useRadioGroupItemContext',
|
|
4
|
-
providerName: '<
|
|
4
|
+
providerName: '<RadioGroupItemProvider />',
|
|
5
5
|
});
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import { mergeProps } from '@zag-js/solid';
|
|
2
2
|
import { createSplitProps } from '../create-split-props';
|
|
3
3
|
import { ark } from '../factory';
|
|
4
|
+
import { runIfFn } from '../run-if-fn';
|
|
4
5
|
import { useRadioGroupContext } from './radio-group-context';
|
|
5
|
-
import {
|
|
6
|
+
import { RadioGroupItemProvider } from './radio-group-item-context';
|
|
6
7
|
export const RadioGroupItem = (props) => {
|
|
7
|
-
const [itemProps,
|
|
8
|
+
const [itemProps, localProps] = createSplitProps()(props, [
|
|
8
9
|
'value',
|
|
9
10
|
'disabled',
|
|
10
11
|
'invalid',
|
|
11
12
|
]);
|
|
12
13
|
const api = useRadioGroupContext();
|
|
13
|
-
const mergedProps = mergeProps(() => api().getItemProps(itemProps),
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
const mergedProps = mergeProps(() => api().getItemProps(itemProps), localProps);
|
|
15
|
+
const itemState = api().getItemState(itemProps);
|
|
16
|
+
const getChildren = () => runIfFn(localProps.children, itemState);
|
|
17
|
+
return (<RadioGroupItemProvider value={itemProps}>
|
|
18
|
+
<ark.label {...mergedProps}>{getChildren()}</ark.label>
|
|
19
|
+
</RadioGroupItemProvider>);
|
|
17
20
|
};
|
|
@@ -4,8 +4,8 @@ import { runIfFn } from '../run-if-fn';
|
|
|
4
4
|
import { useRatingGroupContext } from './rating-group-context';
|
|
5
5
|
export const RatingGroupControl = (props) => {
|
|
6
6
|
const api = useRatingGroupContext();
|
|
7
|
-
const getChildren = () => runIfFn(props.children, api);
|
|
8
7
|
const mergedProps = mergeProps(() => api().controlProps, props);
|
|
8
|
+
const getChildren = () => runIfFn(props.children, api);
|
|
9
9
|
return (<>
|
|
10
10
|
<ark.div {...mergedProps}>{getChildren()}</ark.div>
|
|
11
11
|
<input {...api().hiddenInputProps}/>
|
|
@@ -8,10 +8,10 @@ import { RatingGroupItemProvider } from './rating-group-item-context';
|
|
|
8
8
|
export const RatingGroupItem = (props) => {
|
|
9
9
|
const [itemProps, localProps] = createSplitProps()(props, ['index']);
|
|
10
10
|
const api = useRatingGroupContext();
|
|
11
|
+
const mergedProps = mergeProps(() => api().getItemProps(itemProps), localProps);
|
|
11
12
|
const itemState = createMemo(() => api().getItemState(itemProps));
|
|
12
13
|
const getChildren = () => runIfFn(localProps.children, itemState);
|
|
13
|
-
|
|
14
|
-
return (<RatingGroupItemProvider value={itemState}>
|
|
14
|
+
return (<RatingGroupItemProvider value={itemProps}>
|
|
15
15
|
<ark.span {...mergedProps}>{getChildren()}</ark.span>
|
|
16
16
|
</RatingGroupItemProvider>);
|
|
17
17
|
};
|
|
@@ -4,7 +4,7 @@ import { ark } from '../factory';
|
|
|
4
4
|
import { RatingGroupProvider } from './rating-group-context';
|
|
5
5
|
import { useRatingGroup } from './use-rating-group';
|
|
6
6
|
export const RatingGroup = (props) => {
|
|
7
|
-
const [
|
|
7
|
+
const [useRatingProps, localProps] = createSplitProps()(props, [
|
|
8
8
|
'allowHalf',
|
|
9
9
|
'autoFocus',
|
|
10
10
|
'count',
|
|
@@ -21,7 +21,7 @@ export const RatingGroup = (props) => {
|
|
|
21
21
|
'translations',
|
|
22
22
|
'value',
|
|
23
23
|
]);
|
|
24
|
-
const api = useRatingGroup(
|
|
24
|
+
const api = useRatingGroup(useRatingProps);
|
|
25
25
|
const mergedProps = mergeProps(() => api().rootProps, localProps);
|
|
26
26
|
return (<RatingGroupProvider value={api}>
|
|
27
27
|
<ark.div {...mergedProps}/>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createContext } from '../create-context';
|
|
2
|
-
export const [
|
|
2
|
+
export const [SegmentGroupItemProvider, useSegmentGroupItemContext] = createContext({
|
|
3
3
|
hookName: 'useSegmentGroupItemContext',
|
|
4
|
-
providerName: '<
|
|
4
|
+
providerName: '<SegmentGroupItemProvider />',
|
|
5
5
|
});
|
|
@@ -2,17 +2,20 @@ import { segmentGroupAnatomy } from '@ark-ui/anatomy';
|
|
|
2
2
|
import { mergeProps } from '@zag-js/solid';
|
|
3
3
|
import { createSplitProps } from '../create-split-props';
|
|
4
4
|
import { ark } from '../factory';
|
|
5
|
+
import { runIfFn } from '../run-if-fn';
|
|
5
6
|
import { useSegmentGroupContext } from './segment-group-context';
|
|
6
|
-
import {
|
|
7
|
+
import { SegmentGroupItemProvider, } from './segment-group-item-context';
|
|
7
8
|
export const SegmentGroupItem = (props) => {
|
|
8
|
-
const [itemProps,
|
|
9
|
+
const [itemProps, localProps] = createSplitProps()(props, [
|
|
9
10
|
'value',
|
|
10
11
|
'disabled',
|
|
11
12
|
'invalid',
|
|
12
13
|
]);
|
|
13
14
|
const api = useSegmentGroupContext();
|
|
14
|
-
const mergedProps = mergeProps(() => api().getItemProps(itemProps), segmentGroupAnatomy.build().item.attrs,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
const mergedProps = mergeProps(() => api().getItemProps(itemProps), segmentGroupAnatomy.build().item.attrs, localProps);
|
|
16
|
+
const itemState = api().getItemState(itemProps);
|
|
17
|
+
const getChildren = () => runIfFn(localProps.children, itemState);
|
|
18
|
+
return (<SegmentGroupItemProvider value={itemProps}>
|
|
19
|
+
<ark.label {...mergedProps}>{getChildren()}</ark.label>
|
|
20
|
+
</SegmentGroupItemProvider>);
|
|
18
21
|
};
|
|
@@ -3,6 +3,6 @@ import { ark } from '../factory';
|
|
|
3
3
|
import { useSelectContext } from './select-context';
|
|
4
4
|
export const SelectIndicator = (props) => {
|
|
5
5
|
const api = useSelectContext();
|
|
6
|
-
const mergedProps = mergeProps(() => api().
|
|
6
|
+
const mergedProps = mergeProps(() => api().indicatorProps, props);
|
|
7
7
|
return <ark.div {...mergedProps}/>;
|
|
8
8
|
};
|
|
@@ -3,8 +3,8 @@ import { createSplitProps } from '../create-split-props';
|
|
|
3
3
|
import { ark } from '../factory';
|
|
4
4
|
import { useSelectContext } from './select-context';
|
|
5
5
|
export const SelectItemGroup = (props) => {
|
|
6
|
-
const [
|
|
6
|
+
const [itemGroupProps, localProps] = createSplitProps()(props, ['id']);
|
|
7
7
|
const api = useSelectContext();
|
|
8
|
-
const mergedProps = mergeProps(() => api().getItemGroupProps(
|
|
8
|
+
const mergedProps = mergeProps(() => api().getItemGroupProps(itemGroupProps), localProps);
|
|
9
9
|
return <ark.div {...mergedProps}/>;
|
|
10
10
|
};
|
package/source/select/select.jsx
CHANGED
|
@@ -37,11 +37,11 @@ export const Select = (props) => {
|
|
|
37
37
|
'value',
|
|
38
38
|
]);
|
|
39
39
|
const api = useSelect(useSelectProps);
|
|
40
|
-
const
|
|
40
|
+
const presenceApi = usePresence(mergeProps(() => ({ present: api().isOpen }), presenceProps));
|
|
41
41
|
const mergedProps = mergeProps(() => api().rootProps, localProps);
|
|
42
42
|
const getChildren = () => runIfFn(localProps.children, api);
|
|
43
43
|
return (<SelectProvider value={api}>
|
|
44
|
-
<PresenceProvider value={
|
|
44
|
+
<PresenceProvider value={presenceApi}>
|
|
45
45
|
<ark.div {...mergedProps}>{getChildren()}</ark.div>
|
|
46
46
|
</PresenceProvider>
|
|
47
47
|
</SelectProvider>);
|
|
@@ -2,7 +2,7 @@ import { mergeProps } from '@zag-js/solid';
|
|
|
2
2
|
import { ark } from '../factory';
|
|
3
3
|
import { useSwitchContext } from './switch-context';
|
|
4
4
|
export const SwitchLabel = (props) => {
|
|
5
|
-
const
|
|
6
|
-
const mergedProps = mergeProps(() =>
|
|
5
|
+
const api = useSwitchContext();
|
|
6
|
+
const mergedProps = mergeProps(() => api().labelProps, props);
|
|
7
7
|
return <ark.span {...mergedProps}/>;
|
|
8
8
|
};
|
|
@@ -2,7 +2,7 @@ import { mergeProps } from '@zag-js/solid';
|
|
|
2
2
|
import { ark } from '../factory';
|
|
3
3
|
import { useSwitchContext } from './switch-context';
|
|
4
4
|
export const SwitchThumb = (props) => {
|
|
5
|
-
const
|
|
6
|
-
const mergedProps = mergeProps(() =>
|
|
5
|
+
const api = useSwitchContext();
|
|
6
|
+
const mergedProps = mergeProps(() => api().thumbProps, props);
|
|
7
7
|
return <ark.span {...mergedProps}/>;
|
|
8
8
|
};
|