@ultraviolet/form 3.9.0 → 3.9.2
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/components/CheckboxGroupField/index.cjs +4 -1
- package/dist/components/CheckboxGroupField/index.js +4 -1
- package/dist/components/TextAreaField/index.cjs +9 -4
- package/dist/components/TextAreaField/index.d.ts +1 -1
- package/dist/components/TextAreaField/index.js +9 -4
- package/package.json +4 -4
|
@@ -36,6 +36,9 @@ const CheckboxGroupField = ({
|
|
|
36
36
|
}
|
|
37
37
|
return null;
|
|
38
38
|
})?.filter(Boolean) ?? [];
|
|
39
|
+
if (requiredChildren.length === 0 && !required) {
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
39
42
|
if (!required && arraysContainSameValues(value, requiredChildren)) {
|
|
40
43
|
return true;
|
|
41
44
|
}
|
|
@@ -70,7 +73,7 @@ const CheckboxGroupField = ({
|
|
|
70
73
|
onChange?.(event.currentTarget.value);
|
|
71
74
|
}, error: getError({
|
|
72
75
|
label
|
|
73
|
-
}, error) ?? customError, name, children });
|
|
76
|
+
}, error) ?? customError, name, required, children });
|
|
74
77
|
};
|
|
75
78
|
CheckboxGroupField.Checkbox = ui.CheckboxGroup.Checkbox;
|
|
76
79
|
exports.CheckboxGroupField = CheckboxGroupField;
|
|
@@ -34,6 +34,9 @@ const CheckboxGroupField = ({
|
|
|
34
34
|
}
|
|
35
35
|
return null;
|
|
36
36
|
})?.filter(Boolean) ?? [];
|
|
37
|
+
if (requiredChildren.length === 0 && !required) {
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
37
40
|
if (!required && arraysContainSameValues(value, requiredChildren)) {
|
|
38
41
|
return true;
|
|
39
42
|
}
|
|
@@ -68,7 +71,7 @@ const CheckboxGroupField = ({
|
|
|
68
71
|
onChange?.(event.currentTarget.value);
|
|
69
72
|
}, error: getError({
|
|
70
73
|
label
|
|
71
|
-
}, error) ?? customError, name, children });
|
|
74
|
+
}, error) ?? customError, name, required, children });
|
|
72
75
|
};
|
|
73
76
|
CheckboxGroupField.Checkbox = CheckboxGroup.Checkbox;
|
|
74
77
|
export {
|
|
@@ -31,7 +31,8 @@ const TextAreaField = ({
|
|
|
31
31
|
tooltip,
|
|
32
32
|
regex: regexes,
|
|
33
33
|
submitOnEnter,
|
|
34
|
-
validate
|
|
34
|
+
validate,
|
|
35
|
+
"aria-label": ariaLabel
|
|
35
36
|
}) => {
|
|
36
37
|
const {
|
|
37
38
|
getError
|
|
@@ -78,14 +79,18 @@ const TextAreaField = ({
|
|
|
78
79
|
regex: regexes,
|
|
79
80
|
minLength,
|
|
80
81
|
maxLength,
|
|
81
|
-
label,
|
|
82
|
+
label: label ?? ariaLabel,
|
|
82
83
|
value: field.value
|
|
83
|
-
}, error), helper,
|
|
84
|
+
}, error), helper, labelDescription, minLength, maxLength, name, onBlur: (event) => {
|
|
84
85
|
onBlur?.(event);
|
|
85
86
|
field.onBlur();
|
|
86
87
|
}, onChange: (event) => {
|
|
87
88
|
field.onChange(event);
|
|
88
89
|
onChange?.(event);
|
|
89
|
-
}, onFocus, onKeyDown: onKeyDownHandler, placeholder, readOnly, required, rows, success, tabIndex, tooltip, value: field.value
|
|
90
|
+
}, onFocus, onKeyDown: onKeyDownHandler, placeholder, readOnly, required, rows, success, tabIndex, tooltip, value: field.value, ...label ? {
|
|
91
|
+
label
|
|
92
|
+
} : {
|
|
93
|
+
"aria-label": ariaLabel
|
|
94
|
+
} });
|
|
90
95
|
};
|
|
91
96
|
exports.TextAreaField = TextAreaField;
|
|
@@ -9,4 +9,4 @@ export type TextAreaFieldProps<TFieldValues extends FieldValues, TFieldName exte
|
|
|
9
9
|
/**
|
|
10
10
|
* This component offers a form field based on Ultraviolet UI TextArea component
|
|
11
11
|
*/
|
|
12
|
-
export declare const TextAreaField: <TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ autoFocus, clearable, className, tabIndex, control, "data-testid": dataTestId, disabled, helper, label, labelDescription, onChange, minLength, maxLength, name, onFocus, onBlur, onKeyDown, placeholder, readOnly, required, rows, success, tooltip, regex: regexes, submitOnEnter, validate, }: TextAreaFieldProps<TFieldValues, TFieldName>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare const TextAreaField: <TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ autoFocus, clearable, className, tabIndex, control, "data-testid": dataTestId, disabled, helper, label, labelDescription, onChange, minLength, maxLength, name, onFocus, onBlur, onKeyDown, placeholder, readOnly, required, rows, success, tooltip, regex: regexes, submitOnEnter, validate, "aria-label": ariaLabel, }: TextAreaFieldProps<TFieldValues, TFieldName>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -29,7 +29,8 @@ const TextAreaField = ({
|
|
|
29
29
|
tooltip,
|
|
30
30
|
regex: regexes,
|
|
31
31
|
submitOnEnter,
|
|
32
|
-
validate
|
|
32
|
+
validate,
|
|
33
|
+
"aria-label": ariaLabel
|
|
33
34
|
}) => {
|
|
34
35
|
const {
|
|
35
36
|
getError
|
|
@@ -76,15 +77,19 @@ const TextAreaField = ({
|
|
|
76
77
|
regex: regexes,
|
|
77
78
|
minLength,
|
|
78
79
|
maxLength,
|
|
79
|
-
label,
|
|
80
|
+
label: label ?? ariaLabel,
|
|
80
81
|
value: field.value
|
|
81
|
-
}, error), helper,
|
|
82
|
+
}, error), helper, labelDescription, minLength, maxLength, name, onBlur: (event) => {
|
|
82
83
|
onBlur?.(event);
|
|
83
84
|
field.onBlur();
|
|
84
85
|
}, onChange: (event) => {
|
|
85
86
|
field.onChange(event);
|
|
86
87
|
onChange?.(event);
|
|
87
|
-
}, onFocus, onKeyDown: onKeyDownHandler, placeholder, readOnly, required, rows, success, tabIndex, tooltip, value: field.value
|
|
88
|
+
}, onFocus, onKeyDown: onKeyDownHandler, placeholder, readOnly, required, rows, success, tabIndex, tooltip, value: field.value, ...label ? {
|
|
89
|
+
label
|
|
90
|
+
} : {
|
|
91
|
+
"aria-label": ariaLabel
|
|
92
|
+
} });
|
|
88
93
|
};
|
|
89
94
|
export {
|
|
90
95
|
TextAreaField
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultraviolet/form",
|
|
3
|
-
"version": "3.9.
|
|
3
|
+
"version": "3.9.2",
|
|
4
4
|
"description": "Ultraviolet Form",
|
|
5
5
|
"homepage": "https://github.com/scaleway/ultraviolet#readme",
|
|
6
6
|
"repository": {
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"@emotion/react": "11.13.3",
|
|
62
62
|
"@emotion/styled": "11.13.0",
|
|
63
63
|
"@types/final-form-focus": "1.1.7",
|
|
64
|
-
"@types/react": "18.3.
|
|
64
|
+
"@types/react": "18.3.10",
|
|
65
65
|
"@types/react-dom": "18.3.0",
|
|
66
66
|
"react": "18.3.1",
|
|
67
67
|
"react-dom": "18.3.1",
|
|
@@ -71,8 +71,8 @@
|
|
|
71
71
|
"@babel/runtime": "7.25.6",
|
|
72
72
|
"react-hook-form": "7.53.0",
|
|
73
73
|
"react-select": "5.8.1",
|
|
74
|
-
"@ultraviolet/themes": "1.14.
|
|
75
|
-
"@ultraviolet/ui": "1.
|
|
74
|
+
"@ultraviolet/themes": "1.14.2",
|
|
75
|
+
"@ultraviolet/ui": "1.72.0"
|
|
76
76
|
},
|
|
77
77
|
"scripts": {
|
|
78
78
|
"build:profile": "npx vite-bundle-visualizer -c vite.config.ts",
|