@ark-ui/solid 1.0.1 → 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 +65 -0
- package/README.md +67 -61
- package/cjs/index.js +331 -99
- package/cjs/index.js.map +1 -1
- package/esm/index.js +315 -100
- package/esm/index.js.map +1 -1
- package/package.json +55 -50
- package/source/color-picker/color-picker-format-select.jsx +13 -0
- package/source/color-picker/color-picker-format-trigger.jsx +8 -0
- package/source/color-picker/color-picker-swatch-context.js +5 -0
- package/source/color-picker/color-picker-swatch-indicator.jsx +10 -0
- package/source/color-picker/color-picker-swatch-trigger.jsx +4 -1
- package/source/color-picker/color-picker-swatch.jsx +6 -3
- package/source/color-picker/color-picker.jsx +3 -1
- package/source/color-picker/index.js +7 -1
- package/source/date-picker/date-picker.jsx +1 -1
- package/source/dialog/dialog-close-trigger.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-context.js +5 -0
- package/source/file-upload/file-upload-dropzone.jsx +11 -0
- package/source/file-upload/file-upload-item-context.js +5 -0
- package/source/file-upload/file-upload-item-delete-trigger.jsx +10 -0
- package/source/file-upload/file-upload-item-group.jsx +10 -0
- package/source/file-upload/file-upload-item-name.jsx +12 -0
- package/source/file-upload/file-upload-item-preview-image.jsx +13 -0
- package/source/file-upload/file-upload-item-preview.jsx +12 -0
- package/source/file-upload/file-upload-item-size-text.jsx +12 -0
- package/source/file-upload/file-upload-item.jsx +15 -0
- package/source/file-upload/file-upload-label.jsx +8 -0
- package/source/file-upload/file-upload-trigger.jsx +8 -0
- package/source/file-upload/file-upload.jsx +34 -0
- package/source/file-upload/index.js +26 -0
- package/source/file-upload/use-file-upload.js +10 -0
- package/source/index.jsx +1 -0
- package/source/number-input/index.js +1 -1
- package/source/number-input/number-input.jsx +4 -2
- 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 +9 -10
- package/source/toast/index.js +5 -3
- package/source/toast/toast-group.jsx +4 -0
- package/types/color-picker/color-picker-format-select.d.ts +4 -0
- package/types/color-picker/color-picker-format-trigger.d.ts +4 -0
- package/types/color-picker/color-picker-swatch-context.d.ts +4 -0
- package/types/color-picker/color-picker-swatch-indicator.d.ts +4 -0
- package/types/color-picker/color-picker-swatch-trigger.d.ts +1 -5
- package/types/color-picker/color-picker-transparency-grid.d.ts +2 -5
- package/types/color-picker/index.d.ts +10 -3
- package/types/color-picker/use-color-picker.d.ts +3 -0
- package/types/file-upload/file-upload-context.d.ts +4 -0
- package/types/file-upload/file-upload-dropzone.d.ts +4 -0
- package/types/file-upload/file-upload-item-context.d.ts +4 -0
- package/types/file-upload/file-upload-item-delete-trigger.d.ts +4 -0
- package/types/file-upload/file-upload-item-group.d.ts +8 -0
- package/types/file-upload/file-upload-item-name.d.ts +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 +9 -0
- package/types/file-upload/file-upload-item-size-text.d.ts +4 -0
- package/types/file-upload/file-upload-item.d.ts +6 -0
- package/types/file-upload/file-upload-label.d.ts +4 -0
- package/types/file-upload/file-upload-trigger.d.ts +4 -0
- package/types/file-upload/file-upload.d.ts +9 -0
- package/types/file-upload/index.d.ts +27 -0
- package/types/file-upload/use-file-upload.d.ts +9 -0
- package/types/index.d.ts +1 -0
- package/types/number-input/index.d.ts +1 -1
- package/types/number-input/number-input.d.ts +6 -3
- 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/create-toaster.d.ts +3 -2
- package/types/toast/index.d.ts +6 -4
- package/types/toast/toast-context.d.ts +7 -2
- 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.0
|
|
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",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"dialog",
|
|
14
14
|
"editable",
|
|
15
15
|
"environment",
|
|
16
|
+
"file upload",
|
|
16
17
|
"hover card",
|
|
17
18
|
"menu",
|
|
18
19
|
"number input",
|
|
@@ -79,69 +80,73 @@
|
|
|
79
80
|
"release-it": "release-it --config ../../../release-it.json"
|
|
80
81
|
},
|
|
81
82
|
"dependencies": {
|
|
82
|
-
"@ark-ui/anatomy": "1.
|
|
83
|
-
"@zag-js/accordion": "0.
|
|
84
|
-
"@zag-js/avatar": "0.
|
|
85
|
-
"@zag-js/carousel": "0.
|
|
86
|
-
"@zag-js/checkbox": "0.
|
|
87
|
-
"@zag-js/color-picker": "0.
|
|
88
|
-
"@zag-js/combobox": "0.
|
|
89
|
-
"@zag-js/date-picker": "0.
|
|
90
|
-
"@zag-js/dialog": "0.
|
|
91
|
-
"@zag-js/editable": "0.
|
|
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/
|
|
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"
|
|
112
114
|
},
|
|
113
115
|
"devDependencies": {
|
|
114
|
-
"@release-it/keep-a-changelog": "
|
|
116
|
+
"@release-it/keep-a-changelog": "5.0.0",
|
|
115
117
|
"@solidjs/testing-library": "0.8.4",
|
|
116
|
-
"@storybook/addon-essentials": "7.
|
|
117
|
-
"@storybook/addon-interactions": "7.
|
|
118
|
-
"@storybook/addon-links": "7.
|
|
119
|
-
"@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",
|
|
120
122
|
"@storybook/testing-library": "0.2.2",
|
|
121
123
|
"@testing-library/dom": "9.3.3",
|
|
122
|
-
"@testing-library/jest-dom": "6.1.
|
|
124
|
+
"@testing-library/jest-dom": "6.1.5",
|
|
123
125
|
"@testing-library/user-event": "14.5.1",
|
|
124
|
-
"@types/jsdom": "21.1.
|
|
126
|
+
"@types/jsdom": "21.1.6",
|
|
125
127
|
"@types/testing-library__jest-dom": "5.14.9",
|
|
126
|
-
"@typescript-eslint/eslint-plugin": "6.
|
|
127
|
-
"@typescript-eslint/parser": "6.
|
|
128
|
+
"@typescript-eslint/eslint-plugin": "6.14.0",
|
|
129
|
+
"@typescript-eslint/parser": "6.14.0",
|
|
128
130
|
"@vitest/coverage-v8": "0.34.6",
|
|
129
|
-
"eslint": "8.
|
|
130
|
-
"
|
|
131
|
-
"
|
|
131
|
+
"eslint": "8.55.0",
|
|
132
|
+
"eslint-plugin-jest-dom": "5.1.0",
|
|
133
|
+
"eslint-plugin-testing-library": "6.2.0",
|
|
134
|
+
"globby": "14.0.0",
|
|
135
|
+
"jsdom": "23.0.1",
|
|
136
|
+
"lucide-solid": "0.294.0",
|
|
132
137
|
"react": "18.2.0",
|
|
133
138
|
"react-dom": "18.2.0",
|
|
134
|
-
"release-it": "
|
|
139
|
+
"release-it": "17.0.1",
|
|
135
140
|
"resize-observer-polyfill": "1.5.1",
|
|
136
|
-
"rollup": "4.
|
|
141
|
+
"rollup": "4.9.0",
|
|
137
142
|
"rollup-preset-solid": "2.0.1",
|
|
138
|
-
"solid-js": "1.8.
|
|
139
|
-
"storybook": "7.
|
|
143
|
+
"solid-js": "1.8.7",
|
|
144
|
+
"storybook": "7.6.4",
|
|
140
145
|
"storybook-solidjs": "1.0.0-beta.2",
|
|
141
146
|
"storybook-solidjs-vite": "1.0.0-beta.2",
|
|
142
|
-
"typescript": "5.
|
|
143
|
-
"vite": "
|
|
144
|
-
"vite-plugin-solid": "2.
|
|
147
|
+
"typescript": "5.3.3",
|
|
148
|
+
"vite": "5.0.8",
|
|
149
|
+
"vite-plugin-solid": "2.8.0",
|
|
145
150
|
"vitest": "0.34.2"
|
|
146
151
|
},
|
|
147
152
|
"peerDependencies": {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { mergeProps } from '@zag-js/solid';
|
|
2
|
+
import { Index } from 'solid-js';
|
|
3
|
+
import { ark } from '../factory';
|
|
4
|
+
import { useColorPickerContext } from './color-picker-context';
|
|
5
|
+
export const ColorPickerFormatSelect = (props) => {
|
|
6
|
+
const api = useColorPickerContext();
|
|
7
|
+
const mergedProps = mergeProps(() => api().formatSelectProps, props);
|
|
8
|
+
return (<ark.select {...mergedProps}>
|
|
9
|
+
<Index each={['rgba', 'hsla', 'hsba']}>
|
|
10
|
+
{(format) => <ark.option value={format()}>{format()}</ark.option>}
|
|
11
|
+
</Index>
|
|
12
|
+
</ark.select>);
|
|
13
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { mergeProps } from '@zag-js/solid';
|
|
2
|
+
import { ark } from '../factory';
|
|
3
|
+
import { useColorPickerContext } from './color-picker-context';
|
|
4
|
+
export const ColorPickerFormatTrigger = (props) => {
|
|
5
|
+
const api = useColorPickerContext();
|
|
6
|
+
const mergedProps = mergeProps(() => api().formatTriggerProps, props);
|
|
7
|
+
return <ark.button {...mergedProps}/>;
|
|
8
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { mergeProps } from '@zag-js/solid';
|
|
2
|
+
import { ark } from '../factory';
|
|
3
|
+
import { useColorPickerContext } from './color-picker-context';
|
|
4
|
+
import { useColorPickerSwatchContext } from './color-picker-swatch-context';
|
|
5
|
+
export const ColorPickerSwatchIndicator = (props) => {
|
|
6
|
+
const api = useColorPickerContext();
|
|
7
|
+
const swatchProps = useColorPickerSwatchContext();
|
|
8
|
+
const mergedProps = mergeProps(() => api().getSwatchIndicatorProps(swatchProps), props);
|
|
9
|
+
return <ark.div {...mergedProps}/>;
|
|
10
|
+
};
|
|
@@ -3,7 +3,10 @@ import { createSplitProps } from '../create-split-props';
|
|
|
3
3
|
import { ark } from '../factory';
|
|
4
4
|
import { useColorPickerContext } from './color-picker-context';
|
|
5
5
|
export const ColorPickerSwatchTrigger = (props) => {
|
|
6
|
-
const [triggerProps, localProps] = createSplitProps()(props, [
|
|
6
|
+
const [triggerProps, localProps] = createSplitProps()(props, [
|
|
7
|
+
'value',
|
|
8
|
+
'disabled',
|
|
9
|
+
]);
|
|
7
10
|
const api = useColorPickerContext();
|
|
8
11
|
const mergedProps = mergeProps(() => api().getSwatchTriggerProps(triggerProps), localProps);
|
|
9
12
|
return <ark.button {...mergedProps}/>;
|
|
@@ -2,12 +2,15 @@ import { mergeProps } from '@zag-js/solid';
|
|
|
2
2
|
import { createSplitProps } from '../create-split-props';
|
|
3
3
|
import { ark } from '../factory';
|
|
4
4
|
import { useColorPickerContext } from './color-picker-context';
|
|
5
|
+
import { ColorPickerSwatchProvider } from './color-picker-swatch-context';
|
|
5
6
|
export const ColorPickerSwatch = (props) => {
|
|
6
|
-
const [
|
|
7
|
+
const [swatchProps, localProps] = createSplitProps()(props, [
|
|
7
8
|
'respectAlpha',
|
|
8
9
|
'value',
|
|
9
10
|
]);
|
|
10
11
|
const api = useColorPickerContext();
|
|
11
|
-
const mergedProps = mergeProps(() => api().getSwatchProps(
|
|
12
|
-
return <
|
|
12
|
+
const mergedProps = mergeProps(() => api().getSwatchProps(swatchProps), localProps);
|
|
13
|
+
return (<ColorPickerSwatchProvider value={swatchProps}>
|
|
14
|
+
<ark.div {...mergedProps}/>
|
|
15
|
+
</ColorPickerSwatchProvider>);
|
|
13
16
|
};
|
|
@@ -8,9 +8,10 @@ import { useColorPicker, } from './use-color-picker';
|
|
|
8
8
|
export const ColorPicker = (props) => {
|
|
9
9
|
const [presenceProps, colorPickerProps] = splitPresenceProps(props);
|
|
10
10
|
const [useColorPickerProps, localProps] = createSplitProps()(colorPickerProps, [
|
|
11
|
-
'
|
|
11
|
+
'closeOnSelect',
|
|
12
12
|
'dir',
|
|
13
13
|
'disabled',
|
|
14
|
+
'format',
|
|
14
15
|
'getRootNode',
|
|
15
16
|
'id',
|
|
16
17
|
'ids',
|
|
@@ -18,6 +19,7 @@ export const ColorPicker = (props) => {
|
|
|
18
19
|
'name',
|
|
19
20
|
'name',
|
|
20
21
|
'onFocusOutside',
|
|
22
|
+
'onFormatChange',
|
|
21
23
|
'onInteractOutside',
|
|
22
24
|
'onOpenChange',
|
|
23
25
|
'onPointerDownOutside',
|
|
@@ -12,10 +12,13 @@ import { ColorPickerContent } from './color-picker-content';
|
|
|
12
12
|
import { useColorPickerContext } from './color-picker-context';
|
|
13
13
|
import { ColorPickerControl } from './color-picker-control';
|
|
14
14
|
import { ColorPickerEyeDropperTrigger, } from './color-picker-eye-dropper-trigger';
|
|
15
|
+
import { ColorPickerFormatSelect, } from './color-picker-format-select';
|
|
16
|
+
import { ColorPickerFormatTrigger, } from './color-picker-format-trigger';
|
|
15
17
|
import { ColorPickerLabel } from './color-picker-label';
|
|
16
18
|
import { ColorPickerPositioner } from './color-picker-positioner';
|
|
17
19
|
import { ColorPickerSwatch } from './color-picker-swatch';
|
|
18
20
|
import { ColorPickerSwatchGroup, } from './color-picker-swatch-group';
|
|
21
|
+
import { ColorPickerSwatchIndicator, } from './color-picker-swatch-indicator';
|
|
19
22
|
import { ColorPickerSwatchTrigger, } from './color-picker-swatch-trigger';
|
|
20
23
|
import { ColorPickerTransparencyGrid, } from './color-picker-transparency-grid';
|
|
21
24
|
import { ColorPickerTrigger } from './color-picker-trigger';
|
|
@@ -33,14 +36,17 @@ const ColorPicker = Object.assign(ColorPickerRoot, {
|
|
|
33
36
|
Content: ColorPickerContent,
|
|
34
37
|
Control: ColorPickerControl,
|
|
35
38
|
EyeDropperTrigger: ColorPickerEyeDropperTrigger,
|
|
39
|
+
FormatTrigger: ColorPickerFormatTrigger,
|
|
40
|
+
FormatSelect: ColorPickerFormatSelect,
|
|
36
41
|
Label: ColorPickerLabel,
|
|
37
42
|
Positioner: ColorPickerPositioner,
|
|
38
43
|
Swatch: ColorPickerSwatch,
|
|
39
44
|
SwatchGroup: ColorPickerSwatchGroup,
|
|
45
|
+
SwatchIndicator: ColorPickerSwatchIndicator,
|
|
40
46
|
SwatchTrigger: ColorPickerSwatchTrigger,
|
|
41
47
|
TransparencyGrid: ColorPickerTransparencyGrid,
|
|
42
48
|
Trigger: ColorPickerTrigger,
|
|
43
49
|
ValueText: ColorPickerValueText,
|
|
44
50
|
View: ColorPickerView,
|
|
45
51
|
});
|
|
46
|
-
export { ColorPicker, ColorPickerArea, ColorPickerAreaBackground, ColorPickerAreaThumb, ColorPickerChannelInput, ColorPickerChannelSlider, ColorPickerChannelSliderThumb, ColorPickerChannelSliderTrack, ColorPickerContent, ColorPickerControl, ColorPickerEyeDropperTrigger, ColorPickerLabel, ColorPickerPositioner, ColorPickerSwatch, ColorPickerSwatchGroup, ColorPickerSwatchTrigger, ColorPickerTransparencyGrid, ColorPickerTrigger, ColorPickerValueText, useColorPickerAreaContext, useColorPickerChannelSliderContext, useColorPickerContext, };
|
|
52
|
+
export { ColorPicker, ColorPickerArea, ColorPickerAreaBackground, ColorPickerAreaThumb, ColorPickerChannelInput, ColorPickerChannelSlider, ColorPickerChannelSliderThumb, ColorPickerChannelSliderTrack, ColorPickerContent, ColorPickerControl, ColorPickerEyeDropperTrigger, ColorPickerFormatSelect, ColorPickerFormatTrigger, ColorPickerLabel, ColorPickerPositioner, ColorPickerSwatch, ColorPickerSwatchGroup, ColorPickerSwatchIndicator, ColorPickerSwatchTrigger, ColorPickerTransparencyGrid, ColorPickerTrigger, ColorPickerValueText, ColorPickerView, useColorPickerAreaContext, useColorPickerChannelSliderContext, useColorPickerContext, };
|
|
@@ -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
|
]);
|
|
@@ -3,6 +3,6 @@ import { ark } from '../factory';
|
|
|
3
3
|
import { useDialogContext } from './dialog-context';
|
|
4
4
|
export const DialogCloseTrigger = (props) => {
|
|
5
5
|
const dialog = useDialogContext();
|
|
6
|
-
const mergedProps = mergeProps(() => dialog().
|
|
6
|
+
const mergedProps = mergeProps(() => dialog().closeTriggerProps, 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 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,11 @@
|
|
|
1
|
+
import { mergeProps } from '@zag-js/solid';
|
|
2
|
+
import { ark } from '../factory';
|
|
3
|
+
import { useFileUploadContext } from './file-upload-context';
|
|
4
|
+
export const FileUploadDropzone = (props) => {
|
|
5
|
+
const api = useFileUploadContext();
|
|
6
|
+
const mergedProps = mergeProps(() => api().dropzoneProps, props);
|
|
7
|
+
return (<>
|
|
8
|
+
<ark.div {...mergedProps}/>
|
|
9
|
+
<input {...api().hiddenInputProps}/>
|
|
10
|
+
</>);
|
|
11
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { mergeProps } from '@zag-js/solid';
|
|
2
|
+
import { ark } from '../factory';
|
|
3
|
+
import { useFileUploadContext } from './file-upload-context';
|
|
4
|
+
import { useFileUploadItemContext } from './file-upload-item-context';
|
|
5
|
+
export const FileUploadItemDeleteTrigger = (props) => {
|
|
6
|
+
const api = useFileUploadContext();
|
|
7
|
+
const item = useFileUploadItemContext();
|
|
8
|
+
const mergedProps = mergeProps(() => api().getItemDeleteTriggerProps(item), props);
|
|
9
|
+
return <ark.button {...mergedProps}/>;
|
|
10
|
+
};
|
|
@@ -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 { useFileUploadContext } from './file-upload-context';
|
|
5
|
+
export const FileUploadItemGroup = (props) => {
|
|
6
|
+
const api = useFileUploadContext();
|
|
7
|
+
const mergedProps = mergeProps(() => api().itemGroupProps, props);
|
|
8
|
+
const getChildren = () => runIfFn(props.children, () => api().files);
|
|
9
|
+
return <ark.ul {...mergedProps}>{getChildren()}</ark.ul>;
|
|
10
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { mergeProps } from '@zag-js/solid';
|
|
2
|
+
import { children } 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 FileUploadItemName = (props) => {
|
|
7
|
+
const api = useFileUploadContext();
|
|
8
|
+
const item = useFileUploadItemContext();
|
|
9
|
+
const mergedProps = mergeProps(() => api().getItemNameProps(item), props);
|
|
10
|
+
const getChildren = children(() => props.children);
|
|
11
|
+
return <ark.div {...mergedProps}>{getChildren() || item.file.name}</ark.div>;
|
|
12
|
+
};
|
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { mergeProps } from '@zag-js/solid';
|
|
2
|
+
import { ark } from '../factory';
|
|
3
|
+
import { useFileUploadContext } from './file-upload-context';
|
|
4
|
+
import { useFileUploadItemContext } from './file-upload-item-context';
|
|
5
|
+
export const FileUploadItemPreview = (props) => {
|
|
6
|
+
const api = useFileUploadContext();
|
|
7
|
+
const item = useFileUploadItemContext();
|
|
8
|
+
const mergedProps = mergeProps(() => api().getItemPreviewProps(item), props);
|
|
9
|
+
if (!item.file.type.match(props.type ?? '.*'))
|
|
10
|
+
return null;
|
|
11
|
+
return <ark.div {...mergedProps}/>;
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { mergeProps } from '@zag-js/solid';
|
|
2
|
+
import { children } 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 FileUploadItemSizeText = (props) => {
|
|
7
|
+
const api = useFileUploadContext();
|
|
8
|
+
const item = useFileUploadItemContext();
|
|
9
|
+
const mergedProps = mergeProps(() => api().getItemSizeTextProps(item), props);
|
|
10
|
+
const getChildren = children(() => props.children);
|
|
11
|
+
return <ark.div {...mergedProps}>{getChildren() || api().getFileSize(item.file)}</ark.div>;
|
|
12
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
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 { useFileUploadContext } from './file-upload-context';
|
|
6
|
+
import { FileUploadItemProvider } from './file-upload-item-context';
|
|
7
|
+
export const FileUploadItem = (props) => {
|
|
8
|
+
const [itemProps, localProps] = createSplitProps()(props, ['file']);
|
|
9
|
+
const api = useFileUploadContext();
|
|
10
|
+
const mergedProps = mergeProps(() => api().getItemProps(itemProps), localProps);
|
|
11
|
+
const getChildren = () => runIfFn(localProps.children);
|
|
12
|
+
return (<FileUploadItemProvider value={itemProps}>
|
|
13
|
+
<ark.li {...mergedProps}>{getChildren()}</ark.li>
|
|
14
|
+
</FileUploadItemProvider>);
|
|
15
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { mergeProps } from '@zag-js/solid';
|
|
2
|
+
import { ark } from '../factory';
|
|
3
|
+
import { useFileUploadContext } from './file-upload-context';
|
|
4
|
+
export const FileUploadLabel = (props) => {
|
|
5
|
+
const api = useFileUploadContext();
|
|
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 { useFileUploadContext } from './file-upload-context';
|
|
4
|
+
export const FileUploadTrigger = (props) => {
|
|
5
|
+
const api = useFileUploadContext();
|
|
6
|
+
const mergedProps = mergeProps(() => api().triggerProps, props);
|
|
7
|
+
return <ark.button {...mergedProps}/>;
|
|
8
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
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 { FileUploadProvider } from './file-upload-context';
|
|
6
|
+
import { useFileUpload } from './use-file-upload';
|
|
7
|
+
export const FileUpload = (props) => {
|
|
8
|
+
const [fileUploadProps, localProps] = createSplitProps()(props, [
|
|
9
|
+
'accept',
|
|
10
|
+
'allowDrop',
|
|
11
|
+
'dir',
|
|
12
|
+
'disabled',
|
|
13
|
+
'files',
|
|
14
|
+
'getRootNode',
|
|
15
|
+
'id',
|
|
16
|
+
'ids',
|
|
17
|
+
'locale',
|
|
18
|
+
'maxFiles',
|
|
19
|
+
'maxFileSize',
|
|
20
|
+
'minFileSize',
|
|
21
|
+
'name',
|
|
22
|
+
'onFileAccept',
|
|
23
|
+
'onFileReject',
|
|
24
|
+
'onFilesChange',
|
|
25
|
+
'translations',
|
|
26
|
+
'validate',
|
|
27
|
+
]);
|
|
28
|
+
const api = useFileUpload(fileUploadProps);
|
|
29
|
+
const mergedProps = mergeProps(() => api().rootProps, localProps);
|
|
30
|
+
const getChildren = () => runIfFn(localProps.children, api);
|
|
31
|
+
return (<FileUploadProvider value={api}>
|
|
32
|
+
<ark.div {...mergedProps}>{getChildren()}</ark.div>
|
|
33
|
+
</FileUploadProvider>);
|
|
34
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { FileUpload as FileUploadRoot } from './file-upload';
|
|
2
|
+
import { useFileUploadContext } from './file-upload-context';
|
|
3
|
+
import { FileUploadDropzone } from './file-upload-dropzone';
|
|
4
|
+
import { FileUploadItem } from './file-upload-item';
|
|
5
|
+
import { FileUploadItemDeleteTrigger, } from './file-upload-item-delete-trigger';
|
|
6
|
+
import { FileUploadItemGroup } from './file-upload-item-group';
|
|
7
|
+
import { FileUploadItemName } from './file-upload-item-name';
|
|
8
|
+
import { FileUploadItemPreview } from './file-upload-item-preview';
|
|
9
|
+
import { FileUploadItemPreviewImage, } from './file-upload-item-preview-image';
|
|
10
|
+
import { FileUploadItemSizeText, } from './file-upload-item-size-text';
|
|
11
|
+
import { FileUploadLabel } from './file-upload-label';
|
|
12
|
+
import { FileUploadTrigger } from './file-upload-trigger';
|
|
13
|
+
const FileUpload = Object.assign(FileUploadRoot, {
|
|
14
|
+
Root: FileUploadRoot,
|
|
15
|
+
Dropzone: FileUploadDropzone,
|
|
16
|
+
Item: FileUploadItem,
|
|
17
|
+
ItemDeleteTrigger: FileUploadItemDeleteTrigger,
|
|
18
|
+
ItemGroup: FileUploadItemGroup,
|
|
19
|
+
ItemName: FileUploadItemName,
|
|
20
|
+
ItemPreview: FileUploadItemPreview,
|
|
21
|
+
ItemPreviewImage: FileUploadItemPreviewImage,
|
|
22
|
+
ItemSizeText: FileUploadItemSizeText,
|
|
23
|
+
Label: FileUploadLabel,
|
|
24
|
+
Trigger: FileUploadTrigger,
|
|
25
|
+
});
|
|
26
|
+
export { FileUpload, FileUploadDropzone, FileUploadItem, FileUploadItemDeleteTrigger, FileUploadItemGroup, FileUploadItemName, FileUploadItemPreviewImage, FileUploadItemSizeText, FileUploadLabel, FileUploadTrigger, useFileUploadContext, };
|