@ark-ui/solid 1.2.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 +24 -0
- package/README.md +1 -0
- package/cjs/index.js +125 -12
- package/cjs/index.js.map +1 -1
- package/esm/index.js +115 -13
- package/esm/index.js.map +1 -1
- package/package.json +50 -48
- package/source/combobox/use-combobox.js +3 -3
- package/source/factory.jsx +1 -1
- package/source/index.jsx +1 -0
- 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/select/use-select.js +3 -3
- package/source/spread.js +3 -2
- 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/index.d.ts +2 -1
- 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 +2 -1
- package/types/pagination/index.d.ts +2 -1
- package/types/pin-input/index.d.ts +2 -1
- 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/rating-group/index.d.ts +2 -1
- package/types/segment-group/index.d.ts +2 -1
- 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/toggle-group/index.d.ts +2 -1
- package/types/tooltip/index.d.ts +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,30 @@ description: All notable changes to this project will be documented in this file
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [1.3.0] - 2024-01-17
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- Added the `Progress` component.
|
|
14
|
+
- Added `valueAsString` to `onValueChange` in `DatePicker` callback details
|
|
15
|
+
- Exported change details typings, for example `AccordionValueChangeDetails` or `DialogOpenChangeDetails`
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- Changed `Popover.Description` tag from `div` to `p`
|
|
20
|
+
- Changed `PopoverDescriptionProps` type from `div` to `p`
|
|
21
|
+
- Replaced the styling props for indicator with CSS variables in `RadioGroup`, `SegmentGroup`, and `Tabs`.
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
|
|
25
|
+
- Fixed multiple rerenders on `Select` component using search params
|
|
26
|
+
- Fixed reactivity with collection in `Select` and `Combobox` components
|
|
27
|
+
- Fixed the issue where setting `disabled` on `Combobox` does not reflect in combobox item
|
|
28
|
+
- Fix an issue that breaks the `Combobox` when clicking on the input while the menu is open
|
|
29
|
+
- Fixed the issue where `DatePicker` initial value isn't set when using controlled context
|
|
30
|
+
- Resolved an issue that `asChild` did not work properly with `svg` elements.
|
|
31
|
+
- Resolved an issue that `Menu` option item could not be activated by keyboard
|
|
32
|
+
|
|
9
33
|
## [1.2.0] - 2023-12-13
|
|
10
34
|
|
|
11
35
|
### Added
|
package/README.md
CHANGED
|
@@ -28,6 +28,7 @@ Ark UI is available for the following JavaScript frameworks:
|
|
|
28
28
|
- [Pagination](https://ark-ui.com/docs/components/pagination)
|
|
29
29
|
- [Pin Input](https://ark-ui.com/docs/components/pin-input)
|
|
30
30
|
- [Popover](https://ark-ui.com/docs/components/popover)
|
|
31
|
+
- [Progress](https://ark-ui.com/docs/components/progress)
|
|
31
32
|
- [Radio Group](https://ark-ui.com/docs/components/radio-group)
|
|
32
33
|
- [Range Slider](https://ark-ui.com/docs/components/slider)
|
|
33
34
|
- [Rating Group](https://ark-ui.com/docs/components/rating-group)
|
package/cjs/index.js
CHANGED
|
@@ -21,6 +21,7 @@ var numberInput = require('@zag-js/number-input');
|
|
|
21
21
|
var pagination = require('@zag-js/pagination');
|
|
22
22
|
var pinInput = require('@zag-js/pin-input');
|
|
23
23
|
var popover = require('@zag-js/popover');
|
|
24
|
+
var progress = require('@zag-js/progress');
|
|
24
25
|
var radio = require('@zag-js/radio-group');
|
|
25
26
|
var rating = require('@zag-js/rating-group');
|
|
26
27
|
var select = require('@zag-js/select');
|
|
@@ -67,6 +68,7 @@ var numberInput__namespace = /*#__PURE__*/_interopNamespaceDefault(numberInput);
|
|
|
67
68
|
var pagination__namespace = /*#__PURE__*/_interopNamespaceDefault(pagination);
|
|
68
69
|
var pinInput__namespace = /*#__PURE__*/_interopNamespaceDefault(pinInput);
|
|
69
70
|
var popover__namespace = /*#__PURE__*/_interopNamespaceDefault(popover);
|
|
71
|
+
var progress__namespace = /*#__PURE__*/_interopNamespaceDefault(progress);
|
|
70
72
|
var radio__namespace = /*#__PURE__*/_interopNamespaceDefault(radio);
|
|
71
73
|
var rating__namespace = /*#__PURE__*/_interopNamespaceDefault(rating);
|
|
72
74
|
var select__namespace = /*#__PURE__*/_interopNamespaceDefault(select);
|
|
@@ -122,6 +124,7 @@ const spread = (node, props) => {
|
|
|
122
124
|
const nodeEvents = Object.fromEntries(Object.keys(node).filter(prop => prop.startsWith('$$'))
|
|
123
125
|
// @ts-expect-error - fix later
|
|
124
126
|
.map(prop => [prop, node[prop]]));
|
|
127
|
+
const isSVG = node instanceof SVGElement;
|
|
125
128
|
const childProps = solidJs.createMemo(() => mapProps(props, (key, value) => {
|
|
126
129
|
const eventKey = getEventKey(key);
|
|
127
130
|
|
|
@@ -140,14 +143,14 @@ const spread = (node, props) => {
|
|
|
140
143
|
|
|
141
144
|
// class composition
|
|
142
145
|
if (key === 'class') {
|
|
143
|
-
return [node.
|
|
146
|
+
return [node.classList.toString(), value].filter(Boolean).join(' ');
|
|
144
147
|
}
|
|
145
148
|
|
|
146
149
|
// don't override existing child attributes
|
|
147
150
|
if (node.hasAttribute(key)) return;
|
|
148
151
|
return value;
|
|
149
152
|
}));
|
|
150
|
-
web.spread(node, solidJs.mergeProps(childProps));
|
|
153
|
+
web.spread(node, solidJs.mergeProps(childProps), isSVG);
|
|
151
154
|
};
|
|
152
155
|
|
|
153
156
|
const booleans = ['allowfullscreen', 'async', 'autofocus', 'autoplay', 'checked', 'controls', 'default', 'disabled', 'formnovalidate', 'hidden', 'indeterminate', 'ismap', 'loop', 'multiple', 'muted', 'nomodule', 'novalidate', 'open', 'playsinline', 'readonly', 'required', 'reversed', 'seamless', 'selected'];
|
|
@@ -419,7 +422,7 @@ function withAsChild(Component) {
|
|
|
419
422
|
const getChildren = solidJs.children(() => ssrSpread(localProps.children, restProps));
|
|
420
423
|
solidJs.createEffect(() => {
|
|
421
424
|
const children = getChildren();
|
|
422
|
-
if (children instanceof HTMLElement) {
|
|
425
|
+
if (children instanceof HTMLElement || children instanceof SVGElement) {
|
|
423
426
|
spread(children, restProps);
|
|
424
427
|
}
|
|
425
428
|
});
|
|
@@ -1175,14 +1178,14 @@ const [ComboboxProvider, useComboboxContext] = createContext({
|
|
|
1175
1178
|
|
|
1176
1179
|
const useCombobox = props => {
|
|
1177
1180
|
const [collectionOptions, rest] = createSplitProps()(props, ['isItemDisabled', 'itemToValue', 'itemToString', 'items']);
|
|
1178
|
-
const collection = combobox__namespace.collection(collectionOptions);
|
|
1181
|
+
const collection = () => combobox__namespace.collection(collectionOptions);
|
|
1179
1182
|
const getRootNode = useEnvironmentContext();
|
|
1180
|
-
const context = solid.mergeProps({
|
|
1183
|
+
const context = () => solid.mergeProps({
|
|
1181
1184
|
id: solidJs.createUniqueId(),
|
|
1182
1185
|
getRootNode,
|
|
1183
|
-
collection
|
|
1186
|
+
collection: collection()
|
|
1184
1187
|
}, rest);
|
|
1185
|
-
const [state, send] = solid.useMachine(combobox__namespace.machine(context), {
|
|
1188
|
+
const [state, send] = solid.useMachine(combobox__namespace.machine(context()), {
|
|
1186
1189
|
context
|
|
1187
1190
|
});
|
|
1188
1191
|
return solidJs.createMemo(() => combobox__namespace.connect(state, send, solid.normalizeProps));
|
|
@@ -2617,7 +2620,7 @@ const PopoverContent = props => {
|
|
|
2617
2620
|
const PopoverDescription = props => {
|
|
2618
2621
|
const api = usePopoverContext();
|
|
2619
2622
|
const mergedProps = solid.mergeProps(() => api().descriptionProps, props);
|
|
2620
|
-
return web.createComponent(ark.
|
|
2623
|
+
return web.createComponent(ark.p, mergedProps);
|
|
2621
2624
|
};
|
|
2622
2625
|
|
|
2623
2626
|
const PopoverIndicator = props => {
|
|
@@ -2671,6 +2674,106 @@ const Popover = Object.assign(Popover$1, {
|
|
|
2671
2674
|
Trigger: PopoverTrigger
|
|
2672
2675
|
});
|
|
2673
2676
|
|
|
2677
|
+
const [ProgressProvider, useProgressContext] = createContext({
|
|
2678
|
+
hookName: 'useProgressContext',
|
|
2679
|
+
providerName: '<ProgressProvider />'
|
|
2680
|
+
});
|
|
2681
|
+
|
|
2682
|
+
const useProgress = props => {
|
|
2683
|
+
const getRootNode = useEnvironmentContext();
|
|
2684
|
+
const context = solid.mergeProps({
|
|
2685
|
+
id: solidJs.createUniqueId(),
|
|
2686
|
+
getRootNode
|
|
2687
|
+
}, props);
|
|
2688
|
+
const [state, send] = solid.useMachine(progress__namespace.machine(context), {
|
|
2689
|
+
context
|
|
2690
|
+
});
|
|
2691
|
+
return solidJs.createMemo(() => progress__namespace.connect(state, send, solid.normalizeProps));
|
|
2692
|
+
};
|
|
2693
|
+
|
|
2694
|
+
const Progress$1 = props => {
|
|
2695
|
+
const [progressProps, localProps] = createSplitProps()(props, ['dir', 'getRootNode', 'id', 'max', 'min', 'orientation', 'translations', 'value']);
|
|
2696
|
+
const api = useProgress(progressProps);
|
|
2697
|
+
const mergedProps = solid.mergeProps(() => api().rootProps, localProps);
|
|
2698
|
+
const getChildren = () => runIfFn(localProps.children, api);
|
|
2699
|
+
return web.createComponent(ProgressProvider, {
|
|
2700
|
+
value: api,
|
|
2701
|
+
get children() {
|
|
2702
|
+
return web.createComponent(ark.div, web.mergeProps(mergedProps, {
|
|
2703
|
+
get children() {
|
|
2704
|
+
return getChildren();
|
|
2705
|
+
}
|
|
2706
|
+
}));
|
|
2707
|
+
}
|
|
2708
|
+
});
|
|
2709
|
+
};
|
|
2710
|
+
|
|
2711
|
+
const ProgressCircle = props => {
|
|
2712
|
+
const api = useProgressContext();
|
|
2713
|
+
const mergedProps = solid.mergeProps(() => api().circleProps, props);
|
|
2714
|
+
return web.createComponent(ark.svg, mergedProps);
|
|
2715
|
+
};
|
|
2716
|
+
|
|
2717
|
+
const ProgressCircleRange = props => {
|
|
2718
|
+
const api = useProgressContext();
|
|
2719
|
+
const mergedProps = solid.mergeProps(() => api().circleRangeProps, props);
|
|
2720
|
+
return web.createComponent(ark.circle, mergedProps);
|
|
2721
|
+
};
|
|
2722
|
+
|
|
2723
|
+
const ProgressCircleTrack = props => {
|
|
2724
|
+
const api = useProgressContext();
|
|
2725
|
+
const mergedProps = solid.mergeProps(() => api().circleTrackProps, props);
|
|
2726
|
+
return web.createComponent(ark.circle, mergedProps);
|
|
2727
|
+
};
|
|
2728
|
+
|
|
2729
|
+
const ProgressIndicator = props => {
|
|
2730
|
+
const [state, localProps] = createSplitProps()(props, ['state']);
|
|
2731
|
+
const api = useProgressContext();
|
|
2732
|
+
const mergedProps = solid.mergeProps(() => api().getIndicatorProps(state), localProps);
|
|
2733
|
+
return web.createComponent(ark.span, mergedProps);
|
|
2734
|
+
};
|
|
2735
|
+
|
|
2736
|
+
const ProgressLabel = props => {
|
|
2737
|
+
const api = useProgressContext();
|
|
2738
|
+
const mergedProps = solid.mergeProps(() => api().labelProps, props);
|
|
2739
|
+
return web.createComponent(ark.label, mergedProps);
|
|
2740
|
+
};
|
|
2741
|
+
|
|
2742
|
+
const ProgressRange = props => {
|
|
2743
|
+
const api = useProgressContext();
|
|
2744
|
+
const mergedProps = solid.mergeProps(() => api().rangeProps, props);
|
|
2745
|
+
return web.createComponent(ark.div, mergedProps);
|
|
2746
|
+
};
|
|
2747
|
+
|
|
2748
|
+
const ProgressTrack = props => {
|
|
2749
|
+
const api = useProgressContext();
|
|
2750
|
+
const mergedProps = solid.mergeProps(() => api().trackProps, props);
|
|
2751
|
+
return web.createComponent(ark.div, mergedProps);
|
|
2752
|
+
};
|
|
2753
|
+
|
|
2754
|
+
const ProgressValueText = props => {
|
|
2755
|
+
const api = useProgressContext();
|
|
2756
|
+
const mergedProps = solid.mergeProps(() => api().valueTextProps, props);
|
|
2757
|
+
const getChildren = () => runIfFn(props.children, () => api().valueAsString);
|
|
2758
|
+
return web.createComponent(ark.span, web.mergeProps(mergedProps, {
|
|
2759
|
+
get children() {
|
|
2760
|
+
return getChildren() || api().valueAsString;
|
|
2761
|
+
}
|
|
2762
|
+
}));
|
|
2763
|
+
};
|
|
2764
|
+
|
|
2765
|
+
const Progress = Object.assign(Progress$1, {
|
|
2766
|
+
Root: Progress$1,
|
|
2767
|
+
Label: ProgressLabel,
|
|
2768
|
+
Track: ProgressTrack,
|
|
2769
|
+
Range: ProgressRange,
|
|
2770
|
+
ValueText: ProgressValueText,
|
|
2771
|
+
Indicator: ProgressIndicator,
|
|
2772
|
+
Circle: ProgressCircle,
|
|
2773
|
+
CircleTrack: ProgressCircleTrack,
|
|
2774
|
+
CircleRange: ProgressCircleRange
|
|
2775
|
+
});
|
|
2776
|
+
|
|
2674
2777
|
const [RadioGroupProvider, useRadioGroupContext] = createContext({
|
|
2675
2778
|
hookName: 'useRadioGroupContext',
|
|
2676
2779
|
providerName: '<RadioGroupProvider />'
|
|
@@ -2944,14 +3047,14 @@ const [SelectProvider, useSelectContext] = createContext({
|
|
|
2944
3047
|
|
|
2945
3048
|
const useSelect = props => {
|
|
2946
3049
|
const [collectionOptions, rest] = createSplitProps()(props, ['isItemDisabled', 'itemToValue', 'itemToString', 'items']);
|
|
2947
|
-
const collection = select__namespace.collection(collectionOptions);
|
|
3050
|
+
const collection = () => select__namespace.collection(collectionOptions);
|
|
2948
3051
|
const getRootNode = useEnvironmentContext();
|
|
2949
|
-
const context = solid.mergeProps({
|
|
3052
|
+
const context = () => solid.mergeProps({
|
|
2950
3053
|
id: solidJs.createUniqueId(),
|
|
2951
3054
|
getRootNode,
|
|
2952
|
-
collection
|
|
3055
|
+
collection: collection()
|
|
2953
3056
|
}, rest);
|
|
2954
|
-
const [state, send] = solid.useMachine(select__namespace.machine(context), {
|
|
3057
|
+
const [state, send] = solid.useMachine(select__namespace.machine(context()), {
|
|
2955
3058
|
context
|
|
2956
3059
|
});
|
|
2957
3060
|
return solidJs.createMemo(() => select__namespace.connect(state, send, solid.normalizeProps));
|
|
@@ -3937,6 +4040,15 @@ exports.PopoverTrigger = PopoverTrigger;
|
|
|
3937
4040
|
exports.Presence = Presence;
|
|
3938
4041
|
exports.PresencePropsProvider = PresencePropsProvider;
|
|
3939
4042
|
exports.PresenceProvider = PresenceProvider;
|
|
4043
|
+
exports.Progress = Progress;
|
|
4044
|
+
exports.ProgressCircle = ProgressCircle;
|
|
4045
|
+
exports.ProgressCircleRange = ProgressCircleRange;
|
|
4046
|
+
exports.ProgressCircleTrack = ProgressCircleTrack;
|
|
4047
|
+
exports.ProgressIndicator = ProgressIndicator;
|
|
4048
|
+
exports.ProgressLabel = ProgressLabel;
|
|
4049
|
+
exports.ProgressRange = ProgressRange;
|
|
4050
|
+
exports.ProgressTrack = ProgressTrack;
|
|
4051
|
+
exports.ProgressValueText = ProgressValueText;
|
|
3940
4052
|
exports.RadioGroup = RadioGroup;
|
|
3941
4053
|
exports.RadioGroupItem = RadioGroupItem;
|
|
3942
4054
|
exports.RadioGroupItemControl = RadioGroupItemControl;
|
|
@@ -4038,6 +4150,7 @@ exports.usePopoverContext = usePopoverContext;
|
|
|
4038
4150
|
exports.usePresence = usePresence;
|
|
4039
4151
|
exports.usePresenceContext = usePresenceContext;
|
|
4040
4152
|
exports.usePresencePropsContext = usePresencePropsContext;
|
|
4153
|
+
exports.useProgressContext = useProgressContext;
|
|
4041
4154
|
exports.useRadioGroupContext = useRadioGroupContext;
|
|
4042
4155
|
exports.useRadioGroupItemContext = useRadioGroupItemContext;
|
|
4043
4156
|
exports.useRatingGroupContext = useRatingGroupContext;
|