@ark-ui/solid 1.1.0 → 1.3.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 +40 -1
- package/README.md +25 -21
- package/cjs/index.js +229 -96
- package/cjs/index.js.map +1 -1
- package/esm/index.js +217 -96
- package/esm/index.js.map +1 -1
- package/package.json +56 -52
- package/source/combobox/use-combobox.js +3 -3
- 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/factory.jsx +1 -1
- 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/index.jsx +1 -0
- 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/popover/popover-description.jsx +1 -1
- package/source/progress/index.js +22 -0
- package/source/progress/progress-circle-range.jsx +8 -0
- package/source/progress/progress-circle-track.jsx +8 -0
- package/source/progress/progress-circle.jsx +8 -0
- package/source/progress/progress-context.js +5 -0
- package/source/progress/progress-indicator.jsx +10 -0
- package/source/progress/progress-label.jsx +8 -0
- package/source/progress/progress-range.jsx +8 -0
- package/source/progress/progress-track.jsx +8 -0
- package/source/progress/progress-value-text.jsx +10 -0
- package/source/progress/progress.jsx +24 -0
- package/source/progress/use-progress.js +10 -0
- 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/select/use-select.js +3 -3
- package/source/spread.js +3 -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/accordion/index.d.ts +2 -1
- package/types/avatar/index.d.ts +2 -1
- package/types/carousel/index.d.ts +2 -1
- package/types/checkbox/index.d.ts +2 -2
- package/types/color-picker/index.d.ts +2 -2
- package/types/combobox/index.d.ts +2 -1
- package/types/create-split-props.d.ts +1 -1
- package/types/date-picker/index.d.ts +2 -1
- package/types/dialog/index.d.ts +2 -1
- package/types/editable/index.d.ts +2 -1
- 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 +10 -7
- package/types/hover-card/index.d.ts +2 -1
- package/types/index.d.ts +1 -0
- package/types/menu/index.d.ts +2 -1
- package/types/number-input/index.d.ts +3 -2
- package/types/pagination/index.d.ts +2 -1
- package/types/pin-input/index.d.ts +3 -2
- package/types/popover/index.d.ts +2 -1
- package/types/popover/popover-description.d.ts +1 -1
- package/types/presence/split-presence-props.d.ts +1 -1
- package/types/progress/index.d.ts +23 -0
- package/types/progress/progress-circle-range.d.ts +4 -0
- package/types/progress/progress-circle-track.d.ts +4 -0
- package/types/progress/progress-circle.d.ts +4 -0
- package/types/progress/progress-context.d.ts +4 -0
- package/types/progress/progress-indicator.d.ts +6 -0
- package/types/progress/progress-label.d.ts +4 -0
- package/types/progress/progress-range.d.ts +4 -0
- package/types/progress/progress-track.d.ts +4 -0
- package/types/progress/progress-value-text.d.ts +4 -0
- package/types/progress/progress.d.ts +9 -0
- package/types/progress/use-progress.d.ts +9 -0
- package/types/radio-group/index.d.ts +2 -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/index.d.ts +2 -1
- package/types/rating-group/rating-group-item-context.d.ts +2 -3
- package/types/segment-group/index.d.ts +2 -1
- 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/select/index.d.ts +2 -1
- package/types/slider/index.d.ts +2 -1
- package/types/splitter/index.d.ts +2 -1
- package/types/spread.d.ts +1 -1
- package/types/switch/index.d.ts +2 -1
- package/types/tabs/index.d.ts +2 -1
- package/types/tags-input/index.d.ts +2 -1
- package/types/toast/index.d.ts +6 -4
- package/types/toast/toast-group.d.ts +4 -0
- package/types/toggle-group/index.d.ts +2 -1
- package/types/tooltip/index.d.ts +2 -1
- /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.3.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",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"pin input",
|
|
22
22
|
"popover",
|
|
23
23
|
"presence",
|
|
24
|
+
"progress",
|
|
24
25
|
"radio group",
|
|
25
26
|
"rating group",
|
|
26
27
|
"segment group",
|
|
@@ -80,71 +81,74 @@
|
|
|
80
81
|
"release-it": "release-it --config ../../../release-it.json"
|
|
81
82
|
},
|
|
82
83
|
"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/
|
|
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/
|
|
84
|
+
"@ark-ui/anatomy": "1.3.0",
|
|
85
|
+
"@zag-js/accordion": "0.32.1",
|
|
86
|
+
"@zag-js/avatar": "0.32.1",
|
|
87
|
+
"@zag-js/carousel": "0.32.1",
|
|
88
|
+
"@zag-js/checkbox": "0.32.1",
|
|
89
|
+
"@zag-js/color-picker": "0.32.1",
|
|
90
|
+
"@zag-js/combobox": "0.32.1",
|
|
91
|
+
"@zag-js/date-picker": "0.32.1",
|
|
92
|
+
"@zag-js/dialog": "0.32.1",
|
|
93
|
+
"@zag-js/editable": "0.32.1",
|
|
94
|
+
"@zag-js/file-upload": "0.32.1",
|
|
95
|
+
"@zag-js/hover-card": "0.32.1",
|
|
96
|
+
"@zag-js/menu": "0.32.1",
|
|
97
|
+
"@zag-js/number-input": "0.32.1",
|
|
98
|
+
"@zag-js/pagination": "0.32.1",
|
|
99
|
+
"@zag-js/pin-input": "0.32.1",
|
|
100
|
+
"@zag-js/popover": "0.32.1",
|
|
101
|
+
"@zag-js/presence": "0.32.1",
|
|
102
|
+
"@zag-js/progress": "0.32.1",
|
|
103
|
+
"@zag-js/radio-group": "0.32.1",
|
|
104
|
+
"@zag-js/rating-group": "0.32.1",
|
|
105
|
+
"@zag-js/select": "0.32.1",
|
|
106
|
+
"@zag-js/slider": "0.32.1",
|
|
107
|
+
"@zag-js/solid": "0.32.1",
|
|
108
|
+
"@zag-js/splitter": "0.32.1",
|
|
109
|
+
"@zag-js/switch": "0.32.1",
|
|
110
|
+
"@zag-js/tabs": "0.32.1",
|
|
111
|
+
"@zag-js/tags-input": "0.32.1",
|
|
112
|
+
"@zag-js/toast": "0.32.1",
|
|
113
|
+
"@zag-js/toggle-group": "0.32.1",
|
|
114
|
+
"@zag-js/tooltip": "0.32.1",
|
|
115
|
+
"@zag-js/types": "0.32.1"
|
|
114
116
|
},
|
|
115
117
|
"devDependencies": {
|
|
116
118
|
"@release-it/keep-a-changelog": "5.0.0",
|
|
117
|
-
"@solidjs/testing-library": "0.8.
|
|
118
|
-
"@storybook/addon-essentials": "7.
|
|
119
|
-
"@storybook/addon-interactions": "7.
|
|
120
|
-
"@storybook/addon-links": "7.
|
|
121
|
-
"@storybook/blocks": "7.
|
|
119
|
+
"@solidjs/testing-library": "0.8.5",
|
|
120
|
+
"@storybook/addon-essentials": "7.6.8",
|
|
121
|
+
"@storybook/addon-interactions": "7.6.8",
|
|
122
|
+
"@storybook/addon-links": "7.6.8",
|
|
123
|
+
"@storybook/blocks": "7.6.8",
|
|
122
124
|
"@storybook/testing-library": "0.2.2",
|
|
123
|
-
"@testing-library/dom": "9.3.
|
|
124
|
-
"@testing-library/jest-dom": "6.
|
|
125
|
-
"@testing-library/user-event": "14.5.
|
|
125
|
+
"@testing-library/dom": "9.3.4",
|
|
126
|
+
"@testing-library/jest-dom": "6.2.0",
|
|
127
|
+
"@testing-library/user-event": "14.5.2",
|
|
126
128
|
"@types/jsdom": "21.1.6",
|
|
127
129
|
"@types/testing-library__jest-dom": "5.14.9",
|
|
128
|
-
"@typescript-eslint/eslint-plugin": "6.
|
|
129
|
-
"@typescript-eslint/parser": "6.
|
|
130
|
+
"@typescript-eslint/eslint-plugin": "6.18.1",
|
|
131
|
+
"@typescript-eslint/parser": "6.18.1",
|
|
130
132
|
"@vitest/coverage-v8": "0.34.6",
|
|
131
|
-
"eslint": "8.
|
|
133
|
+
"eslint": "8.56.0",
|
|
134
|
+
"eslint-plugin-jest-dom": "5.1.0",
|
|
135
|
+
"eslint-plugin-testing-library": "6.2.0",
|
|
132
136
|
"globby": "14.0.0",
|
|
133
|
-
"jsdom": "
|
|
134
|
-
"lucide-solid": "0.
|
|
137
|
+
"jsdom": "23.0.1",
|
|
138
|
+
"lucide-solid": "0.309.0",
|
|
135
139
|
"react": "18.2.0",
|
|
136
140
|
"react-dom": "18.2.0",
|
|
137
|
-
"release-it": "17.0.
|
|
141
|
+
"release-it": "17.0.1",
|
|
138
142
|
"resize-observer-polyfill": "1.5.1",
|
|
139
|
-
"rollup": "4.5
|
|
143
|
+
"rollup": "4.9.5",
|
|
140
144
|
"rollup-preset-solid": "2.0.1",
|
|
141
|
-
"solid-js": "1.8.
|
|
142
|
-
"storybook": "7.
|
|
145
|
+
"solid-js": "1.8.11",
|
|
146
|
+
"storybook": "7.6.8",
|
|
143
147
|
"storybook-solidjs": "1.0.0-beta.2",
|
|
144
148
|
"storybook-solidjs-vite": "1.0.0-beta.2",
|
|
145
|
-
"typescript": "5.3.
|
|
146
|
-
"vite": "
|
|
147
|
-
"vite-plugin-solid": "2.
|
|
149
|
+
"typescript": "5.3.3",
|
|
150
|
+
"vite": "5.0.11",
|
|
151
|
+
"vite-plugin-solid": "2.8.0",
|
|
148
152
|
"vitest": "0.34.2"
|
|
149
153
|
},
|
|
150
154
|
"peerDependencies": {
|
|
@@ -10,10 +10,10 @@ export const useCombobox = (props) => {
|
|
|
10
10
|
'itemToString',
|
|
11
11
|
'items',
|
|
12
12
|
]);
|
|
13
|
-
const collection = combobox.collection(collectionOptions);
|
|
13
|
+
const collection = () => combobox.collection(collectionOptions);
|
|
14
14
|
const getRootNode = useEnvironmentContext();
|
|
15
|
-
const context = mergeProps({ id: createUniqueId(), getRootNode, collection }, rest);
|
|
16
|
-
const [state, send] = useMachine(combobox.machine(context), {
|
|
15
|
+
const context = () => mergeProps({ id: createUniqueId(), getRootNode, collection: collection() }, rest);
|
|
16
|
+
const [state, send] = useMachine(combobox.machine(context()), {
|
|
17
17
|
context,
|
|
18
18
|
});
|
|
19
19
|
return createMemo(() => combobox.connect(state, send, normalizeProps));
|
|
@@ -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
|
};
|
package/source/factory.jsx
CHANGED
|
@@ -13,7 +13,7 @@ function withAsChild(Component) {
|
|
|
13
13
|
const getChildren = children(() => ssrSpread(localProps.children, restProps));
|
|
14
14
|
createEffect(() => {
|
|
15
15
|
const children = getChildren();
|
|
16
|
-
if (children instanceof HTMLElement) {
|
|
16
|
+
if (children instanceof HTMLElement || children instanceof SVGElement) {
|
|
17
17
|
spread(children, restProps);
|
|
18
18
|
}
|
|
19
19
|
});
|
|
@@ -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, };
|
package/source/index.jsx
CHANGED
|
@@ -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}/>
|
|
@@ -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.p {...mergedProps}/>;
|
|
8
8
|
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Progress as ProgressRoot } from './progress';
|
|
2
|
+
import { ProgressCircle } from './progress-circle';
|
|
3
|
+
import { ProgressCircleRange } from './progress-circle-range';
|
|
4
|
+
import { ProgressCircleTrack } from './progress-circle-track';
|
|
5
|
+
import { useProgressContext } from './progress-context';
|
|
6
|
+
import { ProgressIndicator } from './progress-indicator';
|
|
7
|
+
import { ProgressLabel } from './progress-label';
|
|
8
|
+
import { ProgressRange } from './progress-range';
|
|
9
|
+
import { ProgressTrack } from './progress-track';
|
|
10
|
+
import { ProgressValueText } from './progress-value-text';
|
|
11
|
+
const Progress = Object.assign(ProgressRoot, {
|
|
12
|
+
Root: ProgressRoot,
|
|
13
|
+
Label: ProgressLabel,
|
|
14
|
+
Track: ProgressTrack,
|
|
15
|
+
Range: ProgressRange,
|
|
16
|
+
ValueText: ProgressValueText,
|
|
17
|
+
Indicator: ProgressIndicator,
|
|
18
|
+
Circle: ProgressCircle,
|
|
19
|
+
CircleTrack: ProgressCircleTrack,
|
|
20
|
+
CircleRange: ProgressCircleRange,
|
|
21
|
+
});
|
|
22
|
+
export { Progress, ProgressCircle, ProgressCircleRange, ProgressCircleTrack, ProgressIndicator, ProgressLabel, ProgressRange, ProgressTrack, ProgressValueText, useProgressContext, };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { mergeProps } from '@zag-js/solid';
|
|
2
|
+
import { ark } from '../factory';
|
|
3
|
+
import { useProgressContext } from './progress-context';
|
|
4
|
+
export const ProgressCircleRange = (props) => {
|
|
5
|
+
const api = useProgressContext();
|
|
6
|
+
const mergedProps = mergeProps(() => api().circleRangeProps, props);
|
|
7
|
+
return <ark.circle {...mergedProps}/>;
|
|
8
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { mergeProps } from '@zag-js/solid';
|
|
2
|
+
import { ark } from '../factory';
|
|
3
|
+
import { useProgressContext } from './progress-context';
|
|
4
|
+
export const ProgressCircleTrack = (props) => {
|
|
5
|
+
const api = useProgressContext();
|
|
6
|
+
const mergedProps = mergeProps(() => api().circleTrackProps, props);
|
|
7
|
+
return <ark.circle {...mergedProps}/>;
|
|
8
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { mergeProps } from '@zag-js/solid';
|
|
2
|
+
import { ark } from '../factory';
|
|
3
|
+
import { useProgressContext } from './progress-context';
|
|
4
|
+
export const ProgressCircle = (props) => {
|
|
5
|
+
const api = useProgressContext();
|
|
6
|
+
const mergedProps = mergeProps(() => api().circleProps, props);
|
|
7
|
+
return <ark.svg {...mergedProps}/>;
|
|
8
|
+
};
|
|
@@ -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 { useProgressContext } from './progress-context';
|
|
5
|
+
export const ProgressIndicator = (props) => {
|
|
6
|
+
const [state, localProps] = createSplitProps()(props, ['state']);
|
|
7
|
+
const api = useProgressContext();
|
|
8
|
+
const mergedProps = mergeProps(() => api().getIndicatorProps(state), localProps);
|
|
9
|
+
return <ark.span {...mergedProps}/>;
|
|
10
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { mergeProps } from '@zag-js/solid';
|
|
2
|
+
import { ark } from '../factory';
|
|
3
|
+
import { useProgressContext } from './progress-context';
|
|
4
|
+
export const ProgressLabel = (props) => {
|
|
5
|
+
const api = useProgressContext();
|
|
6
|
+
const mergedProps = mergeProps(() => api().labelProps, props);
|
|
7
|
+
return <ark.label {...mergedProps}/>;
|
|
8
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { mergeProps } from '@zag-js/solid';
|
|
2
|
+
import { ark } from '../factory';
|
|
3
|
+
import { useProgressContext } from './progress-context';
|
|
4
|
+
export const ProgressRange = (props) => {
|
|
5
|
+
const api = useProgressContext();
|
|
6
|
+
const mergedProps = mergeProps(() => api().rangeProps, props);
|
|
7
|
+
return <ark.div {...mergedProps}/>;
|
|
8
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { mergeProps } from '@zag-js/solid';
|
|
2
|
+
import { ark } from '../factory';
|
|
3
|
+
import { useProgressContext } from './progress-context';
|
|
4
|
+
export const ProgressTrack = (props) => {
|
|
5
|
+
const api = useProgressContext();
|
|
6
|
+
const mergedProps = mergeProps(() => api().trackProps, props);
|
|
7
|
+
return <ark.div {...mergedProps}/>;
|
|
8
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { mergeProps } from '@zag-js/solid';
|
|
2
|
+
import { ark } from '../factory';
|
|
3
|
+
import { runIfFn } from '../run-if-fn';
|
|
4
|
+
import { useProgressContext } from './progress-context';
|
|
5
|
+
export const ProgressValueText = (props) => {
|
|
6
|
+
const api = useProgressContext();
|
|
7
|
+
const mergedProps = mergeProps(() => api().valueTextProps, props);
|
|
8
|
+
const getChildren = () => runIfFn(props.children, () => api().valueAsString);
|
|
9
|
+
return <ark.span {...mergedProps}>{getChildren() || api().valueAsString}</ark.span>;
|
|
10
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
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 { ProgressProvider } from './progress-context';
|
|
6
|
+
import { useProgress } from './use-progress';
|
|
7
|
+
export const Progress = (props) => {
|
|
8
|
+
const [progressProps, localProps] = createSplitProps()(props, [
|
|
9
|
+
'dir',
|
|
10
|
+
'getRootNode',
|
|
11
|
+
'id',
|
|
12
|
+
'max',
|
|
13
|
+
'min',
|
|
14
|
+
'orientation',
|
|
15
|
+
'translations',
|
|
16
|
+
'value',
|
|
17
|
+
]);
|
|
18
|
+
const api = useProgress(progressProps);
|
|
19
|
+
const mergedProps = mergeProps(() => api().rootProps, localProps);
|
|
20
|
+
const getChildren = () => runIfFn(localProps.children, api);
|
|
21
|
+
return (<ProgressProvider value={api}>
|
|
22
|
+
<ark.div {...mergedProps}>{getChildren()}</ark.div>
|
|
23
|
+
</ProgressProvider>);
|
|
24
|
+
};
|