@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/esm/index.js
CHANGED
|
@@ -24,7 +24,7 @@ import * as dialog$1 from '@zag-js/dialog';
|
|
|
24
24
|
export { anatomy as dialogAnatomy } from '@zag-js/dialog';
|
|
25
25
|
import * as editable$1 from '@zag-js/editable';
|
|
26
26
|
export { anatomy as editableAnatomy } from '@zag-js/editable';
|
|
27
|
-
import { getDocument, getWindow } from '@zag-js/dom-query';
|
|
27
|
+
import { getDocument, getWindow, dataAttr as dataAttr$1, ariaAttr } from '@zag-js/dom-query';
|
|
28
28
|
import { createAnatomy } from '@zag-js/anatomy';
|
|
29
29
|
import * as fileUpload$1 from '@zag-js/file-upload';
|
|
30
30
|
export { anatomy as fileUploadAnatomy } from '@zag-js/file-upload';
|
|
@@ -817,14 +817,14 @@ const useFieldset = props => {
|
|
|
817
817
|
const getRootProps = () => ({
|
|
818
818
|
...parts$2.root.attrs,
|
|
819
819
|
disabled,
|
|
820
|
-
'data-disabled': dataAttr
|
|
821
|
-
'data-invalid': dataAttr
|
|
820
|
+
'data-disabled': dataAttr(disabled),
|
|
821
|
+
'data-invalid': dataAttr(invalid),
|
|
822
822
|
'aria-describedby': labelIds.join(' ') || undefined
|
|
823
823
|
});
|
|
824
824
|
const getLegendProps = () => ({
|
|
825
825
|
...parts$2.legend.attrs,
|
|
826
|
-
'data-disabled': dataAttr
|
|
827
|
-
'data-invalid': dataAttr
|
|
826
|
+
'data-disabled': dataAttr(disabled),
|
|
827
|
+
'data-invalid': dataAttr(invalid)
|
|
828
828
|
});
|
|
829
829
|
const getHelperTextProps = () => ({
|
|
830
830
|
id: helperTextId,
|
|
@@ -847,7 +847,7 @@ const useFieldset = props => {
|
|
|
847
847
|
getErrorTextProps
|
|
848
848
|
}));
|
|
849
849
|
};
|
|
850
|
-
const dataAttr
|
|
850
|
+
const dataAttr = condition => condition ? '' : undefined;
|
|
851
851
|
|
|
852
852
|
const FieldsetRoot = props => {
|
|
853
853
|
const [useFieldsetProps, localProps] = createSplitProps()(props, ['id', 'disabled', 'invalid']);
|
|
@@ -897,6 +897,7 @@ const parts$1 = fieldAnatomy.build();
|
|
|
897
897
|
const useField = props => {
|
|
898
898
|
const fieldset = useFieldsetContext();
|
|
899
899
|
const {
|
|
900
|
+
ids,
|
|
900
901
|
disabled = Boolean(fieldset?.().disabled),
|
|
901
902
|
invalid = false,
|
|
902
903
|
readOnly = false,
|
|
@@ -906,25 +907,27 @@ const useField = props => {
|
|
|
906
907
|
const [hasHelperText, setHasHelperText] = createSignal(false);
|
|
907
908
|
const id = props.id ?? createUniqueId();
|
|
908
909
|
let rootRef;
|
|
909
|
-
const
|
|
910
|
-
const
|
|
911
|
-
const
|
|
910
|
+
const rootId = ids?.control ?? `field::${id}`;
|
|
911
|
+
const errorTextId = ids?.errorText ?? `field::${id}::error-text`;
|
|
912
|
+
const helperTextId = ids?.helperText ?? `field::${id}::helper-text`;
|
|
913
|
+
const labelId = ids?.label ?? `field::${id}::label`;
|
|
912
914
|
createEffect(() => {
|
|
913
915
|
return;
|
|
914
916
|
});
|
|
915
917
|
const getRootProps = () => ({
|
|
916
918
|
...parts$1.root.attrs,
|
|
919
|
+
id: rootId,
|
|
917
920
|
role: 'group',
|
|
918
|
-
'data-disabled': dataAttr(disabled),
|
|
919
|
-
'data-invalid': dataAttr(invalid),
|
|
920
|
-
'data-readonly': dataAttr(readOnly)
|
|
921
|
+
'data-disabled': dataAttr$1(disabled),
|
|
922
|
+
'data-invalid': dataAttr$1(invalid),
|
|
923
|
+
'data-readonly': dataAttr$1(readOnly)
|
|
921
924
|
});
|
|
922
925
|
const getLabelProps = () => ({
|
|
923
926
|
...parts$1.label.attrs,
|
|
924
927
|
id: labelId,
|
|
925
|
-
'data-disabled': dataAttr(disabled),
|
|
926
|
-
'data-invalid': dataAttr(invalid),
|
|
927
|
-
'data-readonly': dataAttr(readOnly),
|
|
928
|
+
'data-disabled': dataAttr$1(disabled),
|
|
929
|
+
'data-invalid': dataAttr$1(invalid),
|
|
930
|
+
'data-readonly': dataAttr$1(readOnly),
|
|
928
931
|
htmlFor: id
|
|
929
932
|
});
|
|
930
933
|
const labelIds = [];
|
|
@@ -933,8 +936,9 @@ const useField = props => {
|
|
|
933
936
|
const getControlProps = () => ({
|
|
934
937
|
'aria-describedby': labelIds.join(' ') || undefined,
|
|
935
938
|
'aria-invalid': ariaAttr(invalid),
|
|
936
|
-
'
|
|
937
|
-
'
|
|
939
|
+
'data-invalid': dataAttr$1(invalid),
|
|
940
|
+
'data-required': dataAttr$1(required),
|
|
941
|
+
'data-readonly': dataAttr$1(readOnly),
|
|
938
942
|
id,
|
|
939
943
|
required,
|
|
940
944
|
disabled,
|
|
@@ -985,11 +989,9 @@ const useField = props => {
|
|
|
985
989
|
getErrorTextProps
|
|
986
990
|
}));
|
|
987
991
|
};
|
|
988
|
-
const dataAttr = condition => condition ? '' : undefined;
|
|
989
|
-
const ariaAttr = condition => condition ? true : undefined;
|
|
990
992
|
|
|
991
993
|
const FieldRoot = props => {
|
|
992
|
-
const [useFieldProps, localProps] = createSplitProps()(props, ['id', 'disabled', 'invalid', 'readOnly', 'required']);
|
|
994
|
+
const [useFieldProps, localProps] = createSplitProps()(props, ['id', 'ids', 'disabled', 'invalid', 'readOnly', 'required']);
|
|
993
995
|
const field = useField(useFieldProps);
|
|
994
996
|
const mergedProps = mergeProps$1(() => field().getRootProps(), localProps);
|
|
995
997
|
return createComponent(FieldProvider, {
|
|
@@ -3897,7 +3899,7 @@ const ProgressValueText = props => {
|
|
|
3897
3899
|
const mergedProps = mergeProps$1(() => api().getValueTextProps(), props);
|
|
3898
3900
|
return createComponent(ark.span, mergeProps(mergedProps, {
|
|
3899
3901
|
get children() {
|
|
3900
|
-
return props.children || api().
|
|
3902
|
+
return props.children || api().percentAsString;
|
|
3901
3903
|
}
|
|
3902
3904
|
}));
|
|
3903
3905
|
};
|
|
@@ -4543,14 +4545,14 @@ const SelectPositioner = props => {
|
|
|
4543
4545
|
|
|
4544
4546
|
const useSelect = props => {
|
|
4545
4547
|
const [collectionOptions, selectProps] = createSplitProps()(props, ['isItemDisabled', 'itemToValue', 'itemToString', 'items']);
|
|
4546
|
-
const collection = () => select$1.collection({
|
|
4548
|
+
const collection = createMemo(() => select$1.collection({
|
|
4547
4549
|
...collectionOptions
|
|
4548
|
-
});
|
|
4550
|
+
}));
|
|
4549
4551
|
const locale = useLocaleContext();
|
|
4550
4552
|
const environment = useEnvironmentContext();
|
|
4551
4553
|
const id = createUniqueId();
|
|
4552
4554
|
const field = useFieldContext();
|
|
4553
|
-
const
|
|
4555
|
+
const initialContext = createMemo(() => ({
|
|
4554
4556
|
id,
|
|
4555
4557
|
ids: {
|
|
4556
4558
|
label: field?.().ids.label,
|
|
@@ -4568,10 +4570,18 @@ const useSelect = props => {
|
|
|
4568
4570
|
'open.controlled': props.open !== undefined,
|
|
4569
4571
|
...selectProps
|
|
4570
4572
|
}));
|
|
4571
|
-
const
|
|
4573
|
+
const context = createMemo(() => {
|
|
4574
|
+
const [, restProps] = splitProps(initialContext(), ['collection']);
|
|
4575
|
+
return restProps;
|
|
4576
|
+
});
|
|
4577
|
+
const [state, send] = useMachine(select$1.machine(initialContext()), {
|
|
4572
4578
|
context
|
|
4573
4579
|
});
|
|
4574
|
-
|
|
4580
|
+
const api = createMemo(() => select$1.connect(state, send, normalizeProps));
|
|
4581
|
+
createEffect(() => {
|
|
4582
|
+
api().setCollection(collection());
|
|
4583
|
+
});
|
|
4584
|
+
return api;
|
|
4575
4585
|
};
|
|
4576
4586
|
|
|
4577
4587
|
const SelectRoot = props => {
|