@ark-ui/solid 3.6.2 → 3.7.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/dist/cjs/index.js +36 -26
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +36 -26
- package/dist/esm/index.js.map +1 -1
- package/dist/source/components/field/field-root.jsx +1 -0
- package/dist/source/components/field/use-field.js +10 -9
- package/dist/source/components/progress/progress-value-text.jsx +1 -1
- package/dist/source/components/select/use-select.js +13 -5
- package/dist/types/components/field/use-field.d.ts +33 -17
- package/package.json +51 -49
package/dist/cjs/index.js
CHANGED
|
@@ -838,14 +838,14 @@ const useFieldset = props => {
|
|
|
838
838
|
const getRootProps = () => ({
|
|
839
839
|
...parts$2.root.attrs,
|
|
840
840
|
disabled,
|
|
841
|
-
'data-disabled': dataAttr
|
|
842
|
-
'data-invalid': dataAttr
|
|
841
|
+
'data-disabled': dataAttr(disabled),
|
|
842
|
+
'data-invalid': dataAttr(invalid),
|
|
843
843
|
'aria-describedby': labelIds.join(' ') || undefined
|
|
844
844
|
});
|
|
845
845
|
const getLegendProps = () => ({
|
|
846
846
|
...parts$2.legend.attrs,
|
|
847
|
-
'data-disabled': dataAttr
|
|
848
|
-
'data-invalid': dataAttr
|
|
847
|
+
'data-disabled': dataAttr(disabled),
|
|
848
|
+
'data-invalid': dataAttr(invalid)
|
|
849
849
|
});
|
|
850
850
|
const getHelperTextProps = () => ({
|
|
851
851
|
id: helperTextId,
|
|
@@ -868,7 +868,7 @@ const useFieldset = props => {
|
|
|
868
868
|
getErrorTextProps
|
|
869
869
|
}));
|
|
870
870
|
};
|
|
871
|
-
const dataAttr
|
|
871
|
+
const dataAttr = condition => condition ? '' : undefined;
|
|
872
872
|
|
|
873
873
|
const FieldsetRoot = props => {
|
|
874
874
|
const [useFieldsetProps, localProps] = createSplitProps()(props, ['id', 'disabled', 'invalid']);
|
|
@@ -918,6 +918,7 @@ const parts$1 = fieldAnatomy.build();
|
|
|
918
918
|
const useField = props => {
|
|
919
919
|
const fieldset = useFieldsetContext();
|
|
920
920
|
const {
|
|
921
|
+
ids,
|
|
921
922
|
disabled = Boolean(fieldset?.().disabled),
|
|
922
923
|
invalid = false,
|
|
923
924
|
readOnly = false,
|
|
@@ -927,25 +928,27 @@ const useField = props => {
|
|
|
927
928
|
const [hasHelperText, setHasHelperText] = solidJs.createSignal(false);
|
|
928
929
|
const id = props.id ?? solidJs.createUniqueId();
|
|
929
930
|
let rootRef;
|
|
930
|
-
const
|
|
931
|
-
const
|
|
932
|
-
const
|
|
931
|
+
const rootId = ids?.control ?? `field::${id}`;
|
|
932
|
+
const errorTextId = ids?.errorText ?? `field::${id}::error-text`;
|
|
933
|
+
const helperTextId = ids?.helperText ?? `field::${id}::helper-text`;
|
|
934
|
+
const labelId = ids?.label ?? `field::${id}::label`;
|
|
933
935
|
solidJs.createEffect(() => {
|
|
934
936
|
return;
|
|
935
937
|
});
|
|
936
938
|
const getRootProps = () => ({
|
|
937
939
|
...parts$1.root.attrs,
|
|
940
|
+
id: rootId,
|
|
938
941
|
role: 'group',
|
|
939
|
-
'data-disabled': dataAttr(disabled),
|
|
940
|
-
'data-invalid': dataAttr(invalid),
|
|
941
|
-
'data-readonly': dataAttr(readOnly)
|
|
942
|
+
'data-disabled': domQuery.dataAttr(disabled),
|
|
943
|
+
'data-invalid': domQuery.dataAttr(invalid),
|
|
944
|
+
'data-readonly': domQuery.dataAttr(readOnly)
|
|
942
945
|
});
|
|
943
946
|
const getLabelProps = () => ({
|
|
944
947
|
...parts$1.label.attrs,
|
|
945
948
|
id: labelId,
|
|
946
|
-
'data-disabled': dataAttr(disabled),
|
|
947
|
-
'data-invalid': dataAttr(invalid),
|
|
948
|
-
'data-readonly': dataAttr(readOnly),
|
|
949
|
+
'data-disabled': domQuery.dataAttr(disabled),
|
|
950
|
+
'data-invalid': domQuery.dataAttr(invalid),
|
|
951
|
+
'data-readonly': domQuery.dataAttr(readOnly),
|
|
949
952
|
htmlFor: id
|
|
950
953
|
});
|
|
951
954
|
const labelIds = [];
|
|
@@ -953,9 +956,10 @@ const useField = props => {
|
|
|
953
956
|
if (hasHelperText()) labelIds.push(helperTextId);
|
|
954
957
|
const getControlProps = () => ({
|
|
955
958
|
'aria-describedby': labelIds.join(' ') || undefined,
|
|
956
|
-
'aria-invalid': ariaAttr(invalid),
|
|
957
|
-
'
|
|
958
|
-
'
|
|
959
|
+
'aria-invalid': domQuery.ariaAttr(invalid),
|
|
960
|
+
'data-invalid': domQuery.dataAttr(invalid),
|
|
961
|
+
'data-required': domQuery.dataAttr(required),
|
|
962
|
+
'data-readonly': domQuery.dataAttr(readOnly),
|
|
959
963
|
id,
|
|
960
964
|
required,
|
|
961
965
|
disabled,
|
|
@@ -1006,11 +1010,9 @@ const useField = props => {
|
|
|
1006
1010
|
getErrorTextProps
|
|
1007
1011
|
}));
|
|
1008
1012
|
};
|
|
1009
|
-
const dataAttr = condition => condition ? '' : undefined;
|
|
1010
|
-
const ariaAttr = condition => condition ? true : undefined;
|
|
1011
1013
|
|
|
1012
1014
|
const FieldRoot = props => {
|
|
1013
|
-
const [useFieldProps, localProps] = createSplitProps()(props, ['id', 'disabled', 'invalid', 'readOnly', 'required']);
|
|
1015
|
+
const [useFieldProps, localProps] = createSplitProps()(props, ['id', 'ids', 'disabled', 'invalid', 'readOnly', 'required']);
|
|
1014
1016
|
const field = useField(useFieldProps);
|
|
1015
1017
|
const mergedProps = solid.mergeProps(() => field().getRootProps(), localProps);
|
|
1016
1018
|
return web.createComponent(FieldProvider, {
|
|
@@ -3918,7 +3920,7 @@ const ProgressValueText = props => {
|
|
|
3918
3920
|
const mergedProps = solid.mergeProps(() => api().getValueTextProps(), props);
|
|
3919
3921
|
return web.createComponent(ark.span, web.mergeProps(mergedProps, {
|
|
3920
3922
|
get children() {
|
|
3921
|
-
return props.children || api().
|
|
3923
|
+
return props.children || api().percentAsString;
|
|
3922
3924
|
}
|
|
3923
3925
|
}));
|
|
3924
3926
|
};
|
|
@@ -4564,14 +4566,14 @@ const SelectPositioner = props => {
|
|
|
4564
4566
|
|
|
4565
4567
|
const useSelect = props => {
|
|
4566
4568
|
const [collectionOptions, selectProps] = createSplitProps()(props, ['isItemDisabled', 'itemToValue', 'itemToString', 'items']);
|
|
4567
|
-
const collection = () => select__namespace.collection({
|
|
4569
|
+
const collection = solidJs.createMemo(() => select__namespace.collection({
|
|
4568
4570
|
...collectionOptions
|
|
4569
|
-
});
|
|
4571
|
+
}));
|
|
4570
4572
|
const locale = useLocaleContext();
|
|
4571
4573
|
const environment = useEnvironmentContext();
|
|
4572
4574
|
const id = solidJs.createUniqueId();
|
|
4573
4575
|
const field = useFieldContext();
|
|
4574
|
-
const
|
|
4576
|
+
const initialContext = solidJs.createMemo(() => ({
|
|
4575
4577
|
id,
|
|
4576
4578
|
ids: {
|
|
4577
4579
|
label: field?.().ids.label,
|
|
@@ -4589,10 +4591,18 @@ const useSelect = props => {
|
|
|
4589
4591
|
'open.controlled': props.open !== undefined,
|
|
4590
4592
|
...selectProps
|
|
4591
4593
|
}));
|
|
4592
|
-
const
|
|
4594
|
+
const context = solidJs.createMemo(() => {
|
|
4595
|
+
const [, restProps] = solidJs.splitProps(initialContext(), ['collection']);
|
|
4596
|
+
return restProps;
|
|
4597
|
+
});
|
|
4598
|
+
const [state, send] = solid.useMachine(select__namespace.machine(initialContext()), {
|
|
4593
4599
|
context
|
|
4594
4600
|
});
|
|
4595
|
-
|
|
4601
|
+
const api = solidJs.createMemo(() => select__namespace.connect(state, send, solid.normalizeProps));
|
|
4602
|
+
solidJs.createEffect(() => {
|
|
4603
|
+
api().setCollection(collection());
|
|
4604
|
+
});
|
|
4605
|
+
return api;
|
|
4596
4606
|
};
|
|
4597
4607
|
|
|
4598
4608
|
const SelectRoot = props => {
|