@ultraviolet/form 4.0.0 → 4.0.1
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/CheckboxField/index.cjs +13 -13
- package/dist/components/CheckboxField/index.js +13 -13
- package/dist/components/CheckboxGroupField/index.cjs +7 -7
- package/dist/components/CheckboxGroupField/index.js +7 -7
- package/dist/components/DateInputField/index.cjs +16 -16
- package/dist/components/DateInputField/index.js +16 -16
- package/dist/components/Form/defaultErrors.cjs +10 -10
- package/dist/components/Form/defaultErrors.js +10 -10
- package/dist/components/Form/index.cjs +5 -5
- package/dist/components/Form/index.js +5 -5
- package/dist/components/KeyValueField/index.cjs +10 -10
- package/dist/components/KeyValueField/index.js +10 -10
- package/dist/components/NumberInputField/index.cjs +10 -10
- package/dist/components/NumberInputField/index.js +10 -10
- package/dist/components/RadioField/index.cjs +8 -8
- package/dist/components/RadioField/index.js +8 -8
- package/dist/components/RadioGroupField/index.cjs +7 -7
- package/dist/components/RadioGroupField/index.js +7 -7
- package/dist/components/SelectInputField/index.cjs +7 -7
- package/dist/components/SelectInputField/index.js +7 -7
- package/dist/components/SelectableCardField/index.cjs +8 -8
- package/dist/components/SelectableCardField/index.js +8 -8
- package/dist/components/SelectableCardGroupField/index.cjs +7 -7
- package/dist/components/SelectableCardGroupField/index.js +7 -7
- package/dist/components/SelectableCardOptionGroupField/index.cjs +9 -9
- package/dist/components/SelectableCardOptionGroupField/index.js +9 -9
- package/dist/components/SliderField/index.cjs +9 -9
- package/dist/components/SliderField/index.js +9 -9
- package/dist/components/Submit/index.cjs +1 -1
- package/dist/components/Submit/index.js +1 -1
- package/dist/components/SwitchButtonField/index.cjs +7 -7
- package/dist/components/SwitchButtonField/index.js +7 -7
- package/dist/components/TagInputField/index.cjs +6 -6
- package/dist/components/TagInputField/index.js +6 -6
- package/dist/components/TextAreaField/index.cjs +8 -8
- package/dist/components/TextAreaField/index.js +8 -8
- package/dist/components/TextInputField/index.cjs +12 -12
- package/dist/components/TextInputField/index.js +12 -12
- package/dist/components/TimeInputField/index.cjs +3 -3
- package/dist/components/TimeInputField/index.js +3 -3
- package/dist/components/ToggleField/index.cjs +7 -7
- package/dist/components/ToggleField/index.js +7 -7
- package/dist/components/UnitInputField/index.cjs +10 -10
- package/dist/components/UnitInputField/index.js +10 -10
- package/dist/components/VerificationCodeField/index.cjs +4 -4
- package/dist/components/VerificationCodeField/index.js +4 -4
- package/dist/components/index.d.ts +9 -9
- package/dist/index.cjs +41 -41
- package/dist/index.d.ts +5 -5
- package/dist/index.js +11 -11
- package/dist/providers/index.d.ts +1 -1
- package/dist/validators/index.d.ts +1 -1
- package/package.json +5 -5
|
@@ -28,26 +28,26 @@ const CheckboxField = ({
|
|
|
28
28
|
error
|
|
29
29
|
}
|
|
30
30
|
} = reactHookForm.useController({
|
|
31
|
-
name,
|
|
32
|
-
disabled,
|
|
33
|
-
shouldUnregister,
|
|
34
31
|
control,
|
|
32
|
+
disabled,
|
|
33
|
+
name,
|
|
35
34
|
rules: {
|
|
36
35
|
required,
|
|
37
36
|
validate
|
|
38
|
-
}
|
|
37
|
+
},
|
|
38
|
+
shouldUnregister
|
|
39
39
|
});
|
|
40
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ui.Checkbox, { ...props,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}, onBlur: (event) => {
|
|
40
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.Checkbox, { ...props, checked: !!field.value, disabled: field.disabled, error: getError({
|
|
41
|
+
label: label ?? ariaLabel ?? name
|
|
42
|
+
}, error), name: field.name, onBlur: (event) => {
|
|
44
43
|
field.onBlur();
|
|
45
44
|
onBlur?.(event);
|
|
46
|
-
},
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
"aria-label": void 0
|
|
45
|
+
}, onChange: (event) => {
|
|
46
|
+
field.onChange(event.target.checked);
|
|
47
|
+
onChange?.(event.target.checked);
|
|
48
|
+
}, ref: field.ref, ...children ? {
|
|
49
|
+
"aria-label": void 0,
|
|
50
|
+
children
|
|
51
51
|
} : {
|
|
52
52
|
"aria-label": ariaLabel
|
|
53
53
|
} });
|
|
@@ -26,26 +26,26 @@ const CheckboxField = ({
|
|
|
26
26
|
error
|
|
27
27
|
}
|
|
28
28
|
} = useController({
|
|
29
|
-
name,
|
|
30
|
-
disabled,
|
|
31
|
-
shouldUnregister,
|
|
32
29
|
control,
|
|
30
|
+
disabled,
|
|
31
|
+
name,
|
|
33
32
|
rules: {
|
|
34
33
|
required,
|
|
35
34
|
validate
|
|
36
|
-
}
|
|
35
|
+
},
|
|
36
|
+
shouldUnregister
|
|
37
37
|
});
|
|
38
|
-
return /* @__PURE__ */ jsx(Checkbox, { ...props,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}, onBlur: (event) => {
|
|
38
|
+
return /* @__PURE__ */ jsx(Checkbox, { ...props, checked: !!field.value, disabled: field.disabled, error: getError({
|
|
39
|
+
label: label ?? ariaLabel ?? name
|
|
40
|
+
}, error), name: field.name, onBlur: (event) => {
|
|
42
41
|
field.onBlur();
|
|
43
42
|
onBlur?.(event);
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"aria-label": void 0
|
|
43
|
+
}, onChange: (event) => {
|
|
44
|
+
field.onChange(event.target.checked);
|
|
45
|
+
onChange?.(event.target.checked);
|
|
46
|
+
}, ref: field.ref, ...children ? {
|
|
47
|
+
"aria-label": void 0,
|
|
48
|
+
children
|
|
49
49
|
} : {
|
|
50
50
|
"aria-label": ariaLabel
|
|
51
51
|
} });
|
|
@@ -54,17 +54,19 @@ const CheckboxGroupField = ({
|
|
|
54
54
|
error
|
|
55
55
|
}
|
|
56
56
|
} = reactHookForm.useController({
|
|
57
|
-
name,
|
|
58
57
|
control,
|
|
59
|
-
|
|
58
|
+
name,
|
|
60
59
|
rules: {
|
|
61
60
|
validate: {
|
|
62
61
|
checkboxValid,
|
|
63
62
|
...validate
|
|
64
63
|
}
|
|
65
|
-
}
|
|
64
|
+
},
|
|
65
|
+
shouldUnregister
|
|
66
66
|
});
|
|
67
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ui.CheckboxGroup, { ...props,
|
|
67
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.CheckboxGroup, { ...props, error: getError({
|
|
68
|
+
label: legend
|
|
69
|
+
}, error) ?? customError, legend, name, onChange: (event) => {
|
|
68
70
|
const fieldValue = field.value;
|
|
69
71
|
if (fieldValue?.includes(event.currentTarget.value)) {
|
|
70
72
|
field.onChange(fieldValue?.filter((currentValue) => currentValue !== event.currentTarget.value));
|
|
@@ -72,9 +74,7 @@ const CheckboxGroupField = ({
|
|
|
72
74
|
field.onChange([...field.value, event.currentTarget.value]);
|
|
73
75
|
}
|
|
74
76
|
onChange?.(event.currentTarget.value);
|
|
75
|
-
},
|
|
76
|
-
label: legend
|
|
77
|
-
}, error) ?? customError, name, required, legend, children });
|
|
77
|
+
}, required, value: field.value, children });
|
|
78
78
|
};
|
|
79
79
|
CheckboxGroupField.Checkbox = ui.CheckboxGroup.Checkbox;
|
|
80
80
|
exports.CheckboxGroupField = CheckboxGroupField;
|
|
@@ -52,17 +52,19 @@ const CheckboxGroupField = ({
|
|
|
52
52
|
error
|
|
53
53
|
}
|
|
54
54
|
} = useController({
|
|
55
|
-
name,
|
|
56
55
|
control,
|
|
57
|
-
|
|
56
|
+
name,
|
|
58
57
|
rules: {
|
|
59
58
|
validate: {
|
|
60
59
|
checkboxValid,
|
|
61
60
|
...validate
|
|
62
61
|
}
|
|
63
|
-
}
|
|
62
|
+
},
|
|
63
|
+
shouldUnregister
|
|
64
64
|
});
|
|
65
|
-
return /* @__PURE__ */ jsx(CheckboxGroup, { ...props,
|
|
65
|
+
return /* @__PURE__ */ jsx(CheckboxGroup, { ...props, error: getError({
|
|
66
|
+
label: legend
|
|
67
|
+
}, error) ?? customError, legend, name, onChange: (event) => {
|
|
66
68
|
const fieldValue = field.value;
|
|
67
69
|
if (fieldValue?.includes(event.currentTarget.value)) {
|
|
68
70
|
field.onChange(fieldValue?.filter((currentValue) => currentValue !== event.currentTarget.value));
|
|
@@ -70,9 +72,7 @@ const CheckboxGroupField = ({
|
|
|
70
72
|
field.onChange([...field.value, event.currentTarget.value]);
|
|
71
73
|
}
|
|
72
74
|
onChange?.(event.currentTarget.value);
|
|
73
|
-
},
|
|
74
|
-
label: legend
|
|
75
|
-
}, error) ?? customError, name, required, legend, children });
|
|
75
|
+
}, required, value: field.value, children });
|
|
76
76
|
};
|
|
77
77
|
CheckboxGroupField.Checkbox = CheckboxGroup.Checkbox;
|
|
78
78
|
export {
|
|
@@ -34,26 +34,33 @@ const DateInputField = ({
|
|
|
34
34
|
error
|
|
35
35
|
}
|
|
36
36
|
} = reactHookForm.useController({
|
|
37
|
-
name,
|
|
38
37
|
control,
|
|
39
|
-
|
|
38
|
+
name,
|
|
40
39
|
rules: {
|
|
41
40
|
required,
|
|
42
41
|
validate: {
|
|
43
|
-
minDate: minDate.minDateValidator(minDate$1),
|
|
44
42
|
maxDate: maxDate.maxDateValidator(maxDate$1),
|
|
43
|
+
minDate: minDate.minDateValidator(minDate$1),
|
|
45
44
|
...validate
|
|
46
45
|
}
|
|
47
|
-
}
|
|
46
|
+
},
|
|
47
|
+
shouldUnregister
|
|
48
48
|
});
|
|
49
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ui.DateInput, { ...props,
|
|
49
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.DateInput, { ...props, endDate: selectsRange && Array.isArray(field.value) ? field.value[1] : void 0, error: getError({
|
|
50
|
+
label,
|
|
51
|
+
maxDate: maxDate$1,
|
|
52
|
+
minDate: minDate$1
|
|
53
|
+
}, error), format: format || ((value) => {
|
|
50
54
|
if (!value) return "";
|
|
51
55
|
const date = parseDate(value);
|
|
52
56
|
return showMonthYearPicker ? date.toLocaleDateString(void 0, {
|
|
53
|
-
|
|
54
|
-
|
|
57
|
+
month: "numeric",
|
|
58
|
+
year: "numeric"
|
|
55
59
|
}) : date.toLocaleDateString();
|
|
56
|
-
}),
|
|
60
|
+
}), label, maxDate: maxDate$1, minDate: minDate$1, name: field.name, onBlur: (e) => {
|
|
61
|
+
field.onBlur();
|
|
62
|
+
onBlur?.(e);
|
|
63
|
+
}, onChange: (val) => {
|
|
57
64
|
if (val && val instanceof Date) {
|
|
58
65
|
onChange?.(val);
|
|
59
66
|
const newDate = parseDate(val);
|
|
@@ -71,13 +78,6 @@ const DateInputField = ({
|
|
|
71
78
|
onChange?.(val);
|
|
72
79
|
field.onChange(val);
|
|
73
80
|
}
|
|
74
|
-
},
|
|
75
|
-
field.onBlur();
|
|
76
|
-
onBlur?.(e);
|
|
77
|
-
}, maxDate: maxDate$1, minDate: minDate$1, error: getError({
|
|
78
|
-
minDate: minDate$1,
|
|
79
|
-
maxDate: maxDate$1,
|
|
80
|
-
label
|
|
81
|
-
}, error), selectsRange, showMonthYearPicker, startDate: selectsRange && Array.isArray(field.value) ? field.value[0] : void 0, endDate: selectsRange && Array.isArray(field.value) ? field.value[1] : void 0 });
|
|
81
|
+
}, required, selectsRange, showMonthYearPicker, startDate: selectsRange && Array.isArray(field.value) ? field.value[0] : void 0, value: Array.isArray(field.value) ? void 0 : field.value });
|
|
82
82
|
};
|
|
83
83
|
exports.DateInputField = DateInputField;
|
|
@@ -32,26 +32,33 @@ const DateInputField = ({
|
|
|
32
32
|
error
|
|
33
33
|
}
|
|
34
34
|
} = useController({
|
|
35
|
-
name,
|
|
36
35
|
control,
|
|
37
|
-
|
|
36
|
+
name,
|
|
38
37
|
rules: {
|
|
39
38
|
required,
|
|
40
39
|
validate: {
|
|
41
|
-
minDate: minDateValidator(minDate),
|
|
42
40
|
maxDate: maxDateValidator(maxDate),
|
|
41
|
+
minDate: minDateValidator(minDate),
|
|
43
42
|
...validate
|
|
44
43
|
}
|
|
45
|
-
}
|
|
44
|
+
},
|
|
45
|
+
shouldUnregister
|
|
46
46
|
});
|
|
47
|
-
return /* @__PURE__ */ jsx(DateInput, { ...props,
|
|
47
|
+
return /* @__PURE__ */ jsx(DateInput, { ...props, endDate: selectsRange && Array.isArray(field.value) ? field.value[1] : void 0, error: getError({
|
|
48
|
+
label,
|
|
49
|
+
maxDate,
|
|
50
|
+
minDate
|
|
51
|
+
}, error), format: format || ((value) => {
|
|
48
52
|
if (!value) return "";
|
|
49
53
|
const date = parseDate(value);
|
|
50
54
|
return showMonthYearPicker ? date.toLocaleDateString(void 0, {
|
|
51
|
-
|
|
52
|
-
|
|
55
|
+
month: "numeric",
|
|
56
|
+
year: "numeric"
|
|
53
57
|
}) : date.toLocaleDateString();
|
|
54
|
-
}),
|
|
58
|
+
}), label, maxDate, minDate, name: field.name, onBlur: (e) => {
|
|
59
|
+
field.onBlur();
|
|
60
|
+
onBlur?.(e);
|
|
61
|
+
}, onChange: (val) => {
|
|
55
62
|
if (val && val instanceof Date) {
|
|
56
63
|
onChange?.(val);
|
|
57
64
|
const newDate = parseDate(val);
|
|
@@ -69,14 +76,7 @@ const DateInputField = ({
|
|
|
69
76
|
onChange?.(val);
|
|
70
77
|
field.onChange(val);
|
|
71
78
|
}
|
|
72
|
-
},
|
|
73
|
-
field.onBlur();
|
|
74
|
-
onBlur?.(e);
|
|
75
|
-
}, maxDate, minDate, error: getError({
|
|
76
|
-
minDate,
|
|
77
|
-
maxDate,
|
|
78
|
-
label
|
|
79
|
-
}, error), selectsRange, showMonthYearPicker, startDate: selectsRange && Array.isArray(field.value) ? field.value[0] : void 0, endDate: selectsRange && Array.isArray(field.value) ? field.value[1] : void 0 });
|
|
79
|
+
}, required, selectsRange, showMonthYearPicker, startDate: selectsRange && Array.isArray(field.value) ? field.value[0] : void 0, value: Array.isArray(field.value) ? void 0 : field.value });
|
|
80
80
|
};
|
|
81
81
|
export {
|
|
82
82
|
DateInputField
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const defaultErrors = {
|
|
4
|
+
deps: () => "",
|
|
5
|
+
disabled: () => "",
|
|
6
|
+
max: () => "",
|
|
4
7
|
maxDate: () => "",
|
|
5
8
|
maxLength: () => "",
|
|
6
|
-
minLength: () => "",
|
|
7
|
-
max: () => "",
|
|
8
9
|
min: () => "",
|
|
9
|
-
|
|
10
|
-
pattern: () => "",
|
|
11
|
-
deps: () => "",
|
|
12
|
-
value: () => "",
|
|
10
|
+
minLength: () => "",
|
|
13
11
|
onBlur: () => "",
|
|
14
|
-
disabled: () => "",
|
|
15
12
|
onChange: () => "",
|
|
16
|
-
|
|
13
|
+
pattern: () => "",
|
|
14
|
+
required: () => "",
|
|
17
15
|
setValueAs: () => "",
|
|
16
|
+
shouldUnregister: () => "",
|
|
17
|
+
validate: () => "",
|
|
18
|
+
value: () => "",
|
|
18
19
|
valueAsDate: () => "",
|
|
19
|
-
valueAsNumber: () => ""
|
|
20
|
-
shouldUnregister: () => ""
|
|
20
|
+
valueAsNumber: () => ""
|
|
21
21
|
};
|
|
22
22
|
exports.defaultErrors = defaultErrors;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
const defaultErrors = {
|
|
2
|
+
deps: () => "",
|
|
3
|
+
disabled: () => "",
|
|
4
|
+
max: () => "",
|
|
2
5
|
maxDate: () => "",
|
|
3
6
|
maxLength: () => "",
|
|
4
|
-
minLength: () => "",
|
|
5
|
-
max: () => "",
|
|
6
7
|
min: () => "",
|
|
7
|
-
|
|
8
|
-
pattern: () => "",
|
|
9
|
-
deps: () => "",
|
|
10
|
-
value: () => "",
|
|
8
|
+
minLength: () => "",
|
|
11
9
|
onBlur: () => "",
|
|
12
|
-
disabled: () => "",
|
|
13
10
|
onChange: () => "",
|
|
14
|
-
|
|
11
|
+
pattern: () => "",
|
|
12
|
+
required: () => "",
|
|
15
13
|
setValueAs: () => "",
|
|
14
|
+
shouldUnregister: () => "",
|
|
15
|
+
validate: () => "",
|
|
16
|
+
value: () => "",
|
|
16
17
|
valueAsDate: () => "",
|
|
17
|
-
valueAsNumber: () => ""
|
|
18
|
-
shouldUnregister: () => ""
|
|
18
|
+
valueAsNumber: () => ""
|
|
19
19
|
};
|
|
20
20
|
export {
|
|
21
21
|
defaultErrors
|
|
@@ -21,7 +21,7 @@ const StyledForm = /* @__PURE__ */ _styled__default.default("form", process.env.
|
|
|
21
21
|
styles: "display:contents"
|
|
22
22
|
} : {
|
|
23
23
|
name: "49aokf",
|
|
24
|
-
styles: "display:contents/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9ob21lL3J1bm5lci93b3JrL3VsdHJhdmlvbGV0L3VsdHJhdmlvbGV0L3BhY2thZ2VzL2Zvcm0vc3JjL2NvbXBvbmVudHMvRm9ybS9pbmRleC50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBb0I4QiIsImZpbGUiOiIvaG9tZS9ydW5uZXIvd29yay91bHRyYXZpb2xldC91bHRyYXZpb2xldC9wYWNrYWdlcy9mb3JtL3NyYy9jb21wb25lbnRzL0Zvcm0vaW5kZXgudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBjbGllbnQnXG5cbmltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJ1xuaW1wb3J0IHR5cGUgeyBSZWFjdE5vZGUgfSBmcm9tICdyZWFjdCdcbmltcG9ydCB0eXBlIHsgRmllbGRWYWx1ZXMsIFVzZUZvcm1SZXR1cm4gfSBmcm9tICdyZWFjdC1ob29rLWZvcm0nXG5pbXBvcnQgeyBGb3JtUHJvdmlkZXIgfSBmcm9tICdyZWFjdC1ob29rLWZvcm0nXG5pbXBvcnQgeyBFcnJvclByb3ZpZGVyIH0gZnJvbSAnLi4vLi4vcHJvdmlkZXJzJ1xuaW1wb3J0IHR5cGUgeyBGb3JtRXJyb3JzIH0gZnJvbSAnLi4vLi4vdHlwZXMnXG5pbXBvcnQgeyBkZWZ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ZWxkVmFsdWVzPikgPT4ge1xuICBjb25zdCBoYW5kbGVTdWJtaXQgPSBtZXRob2RzLmhhbmRsZVN1Ym1pdChhc3luYyB2YWx1ZXMgPT4ge1xuICAgIGNvbnN0IHJlc3VsdCA9IGF3YWl0IG9uU3VibWl0KHZhbHVlcylcblxuICAgIGlmIChyZXN1bHQpIHtcbiAgICAgIG1ldGhvZHMuc2V0RXJyb3IoJ3Jvb3Quc3VibWl0Jywge1xuICAgICAgICBtZXNzYWdlOiByZXN1bHQsXG4gICAgICAgIHR5cGU6ICdjdXN0b20nLFxuICAgICAgfSlcbiAgICB9XG4gIH0pXG5cbiAgcmV0dXJuIChcbiAgICA8Rm9ybVByb3ZpZGVyIHsuLi5tZXRob2RzfT5cbiAgICAgIDxFcnJvclByb3ZpZGVyIGVycm9ycz17eyAuLi5kZWZhdWx0RXJyb3JzLCAuLi5lcnJvcnMgfX0+XG4gICAgICAgIDxTdHlsZWRGb3JtXG4gICAgICAgICAgbmFtZT17bmFtZX1cbiAgICAgICAgICBub1ZhbGlkYXRlXG4gICAgICAgICAgb25TdWJtaXQ9e2FzeW5jIGUgPT4ge1xuICAgICAgICAgICAgZS5wcmV2ZW50RGVmYXVsdCgpXG4gICAgICAgICAgICBlLnN0b3BQcm9wYWdhdGlvbigpXG4gICAgICAgICAgICBhd2FpdCBoYW5kbGVTdWJtaXQoZSlcbiAgICAgICAgICB9fVxuICAgICAgICA+XG4gICAgICAgICAge2NoaWxkcmVufVxuICAgICAgICA8L1N0eWxlZEZvcm0+XG4gICAgICA8L0Vycm9yUHJvdmlkZXI+XG4gICAgPC9Gb3JtUHJvdmlkZXI+XG4gIClcbn1cbiJdfQ== */",
|
|
25
25
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
26
26
|
});
|
|
27
27
|
const Form = ({
|
|
@@ -35,18 +35,18 @@ const Form = ({
|
|
|
35
35
|
const result = await onSubmit(values);
|
|
36
36
|
if (result) {
|
|
37
37
|
methods.setError("root.submit", {
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
message: result,
|
|
39
|
+
type: "custom"
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
43
|
return /* @__PURE__ */ jsxRuntime.jsx(reactHookForm.FormProvider, { ...methods, children: /* @__PURE__ */ jsxRuntime.jsx(index.ErrorProvider, { errors: {
|
|
44
44
|
...defaultErrors.defaultErrors,
|
|
45
45
|
...errors
|
|
46
|
-
}, children: /* @__PURE__ */ jsxRuntime.jsx(StyledForm, { onSubmit: async (e) => {
|
|
46
|
+
}, children: /* @__PURE__ */ jsxRuntime.jsx(StyledForm, { name, noValidate: true, onSubmit: async (e) => {
|
|
47
47
|
e.preventDefault();
|
|
48
48
|
e.stopPropagation();
|
|
49
49
|
await handleSubmit(e);
|
|
50
|
-
},
|
|
50
|
+
}, children }) }) });
|
|
51
51
|
};
|
|
52
52
|
exports.Form = Form;
|
|
@@ -17,7 +17,7 @@ const StyledForm = /* @__PURE__ */ _styled("form", process.env.NODE_ENV === "pro
|
|
|
17
17
|
styles: "display:contents"
|
|
18
18
|
} : {
|
|
19
19
|
name: "49aokf",
|
|
20
|
-
styles: "display:contents/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9ob21lL3J1bm5lci93b3JrL3VsdHJhdmlvbGV0L3VsdHJhdmlvbGV0L3BhY2thZ2VzL2Zvcm0vc3JjL2NvbXBvbmVudHMvRm9ybS9pbmRleC50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBb0I4QiIsImZpbGUiOiIvaG9tZS9ydW5uZXIvd29yay91bHRyYXZpb2xldC91bHRyYXZpb2xldC9wYWNrYWdlcy9mb3JtL3NyYy9jb21wb25lbnRzL0Zvcm0vaW5kZXgudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBjbGllbnQnXG5cbmltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVk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ICAgICBhd2FpdCBoYW5kbGVTdWJtaXQoZSlcbiAgICAgICAgICB9fVxuICAgICAgICA+XG4gICAgICAgICAge2NoaWxkcmVufVxuICAgICAgICA8L1N0eWxlZEZvcm0+XG4gICAgICA8L0Vycm9yUHJvdmlkZXI+XG4gICAgPC9Gb3JtUHJvdmlkZXI+XG4gIClcbn1cbiJdfQ== */",
|
|
21
21
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
22
22
|
});
|
|
23
23
|
const Form = ({
|
|
@@ -31,19 +31,19 @@ const Form = ({
|
|
|
31
31
|
const result = await onSubmit(values);
|
|
32
32
|
if (result) {
|
|
33
33
|
methods.setError("root.submit", {
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
message: result,
|
|
35
|
+
type: "custom"
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
});
|
|
39
39
|
return /* @__PURE__ */ jsx(FormProvider, { ...methods, children: /* @__PURE__ */ jsx(ErrorProvider, { errors: {
|
|
40
40
|
...defaultErrors,
|
|
41
41
|
...errors
|
|
42
|
-
}, children: /* @__PURE__ */ jsx(StyledForm, { onSubmit: async (e) => {
|
|
42
|
+
}, children: /* @__PURE__ */ jsx(StyledForm, { name, noValidate: true, onSubmit: async (e) => {
|
|
43
43
|
e.preventDefault();
|
|
44
44
|
e.stopPropagation();
|
|
45
45
|
await handleSubmit(e);
|
|
46
|
-
},
|
|
46
|
+
}, children }) }) });
|
|
47
47
|
};
|
|
48
48
|
export {
|
|
49
49
|
Form
|
|
@@ -20,30 +20,30 @@ const KeyValueField = ({
|
|
|
20
20
|
append,
|
|
21
21
|
remove
|
|
22
22
|
} = reactHookForm.useFieldArray({
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
control,
|
|
24
|
+
name
|
|
25
25
|
});
|
|
26
26
|
const canAdd = fields.length !== void 0 && fields.length < maxSize;
|
|
27
27
|
const maxSizeReachedTooltip = addButton.maxSizeReachedTooltip ?? `Cannot add more than ${maxSize} elements`;
|
|
28
28
|
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { gap: 3, children: [
|
|
29
|
-
fields.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(ui.Stack, { gap: 3, children: fields.map((field, index$1) => /* @__PURE__ */ jsxRuntime.jsxs(ui.Row, {
|
|
30
|
-
/* @__PURE__ */ jsxRuntime.jsx(index.TextInputField, {
|
|
31
|
-
/* @__PURE__ */ jsxRuntime.jsx(index.TextInputField, {
|
|
32
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, {
|
|
29
|
+
fields.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(ui.Stack, { gap: 3, children: fields.map((field, index$1) => /* @__PURE__ */ jsxRuntime.jsxs(ui.Row, { alignItems: "end", gap: 2, templateColumns: "1fr 1fr auto", children: [
|
|
30
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.TextInputField, { label: inputKey.label, name: `${name}.${index$1}.key`, readOnly, regex: inputKey.regex, required: inputKey.required }),
|
|
31
|
+
/* @__PURE__ */ jsxRuntime.jsx(index.TextInputField, { autoComplete: "off", label: inputValue.label, name: `${name}.${index$1}.value`, placeholder: inputValue.placeholder, readOnly, regex: inputValue.regex, required: inputValue.required, type: inputValue.type }),
|
|
32
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { "data-testid": `remove-button-${index$1}`, disabled: readOnly, onClick: () => remove(index$1), sentiment: "danger", size: "large", variant: "outlined", children: /* @__PURE__ */ jsxRuntime.jsx(icons.DeleteIcon, {}) })
|
|
33
33
|
] }, field.id)) }) : null,
|
|
34
34
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Stack, { direction: "row", justifyContent: "flex-start", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
35
35
|
ui.Button,
|
|
36
36
|
{
|
|
37
37
|
"data-testid": "add-button",
|
|
38
|
-
variant: "outlined",
|
|
39
|
-
sentiment: "primary",
|
|
40
|
-
fullWidth: addButton.fullWidth,
|
|
41
38
|
disabled: !canAdd || readOnly,
|
|
42
|
-
|
|
39
|
+
fullWidth: addButton.fullWidth,
|
|
43
40
|
onClick: () => append({
|
|
44
41
|
key: "",
|
|
45
42
|
value: ""
|
|
46
43
|
}),
|
|
44
|
+
sentiment: "primary",
|
|
45
|
+
tooltip: !canAdd ? maxSizeReachedTooltip : addButton.tooltip,
|
|
46
|
+
variant: "outlined",
|
|
47
47
|
children: [
|
|
48
48
|
/* @__PURE__ */ jsxRuntime.jsx(icons.PlusIcon, {}),
|
|
49
49
|
addButton.name
|
|
@@ -18,30 +18,30 @@ const KeyValueField = ({
|
|
|
18
18
|
append,
|
|
19
19
|
remove
|
|
20
20
|
} = useFieldArray({
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
control,
|
|
22
|
+
name
|
|
23
23
|
});
|
|
24
24
|
const canAdd = fields.length !== void 0 && fields.length < maxSize;
|
|
25
25
|
const maxSizeReachedTooltip = addButton.maxSizeReachedTooltip ?? `Cannot add more than ${maxSize} elements`;
|
|
26
26
|
return /* @__PURE__ */ jsxs(Stack, { gap: 3, children: [
|
|
27
|
-
fields.length > 0 ? /* @__PURE__ */ jsx(Stack, { gap: 3, children: fields.map((field, index) => /* @__PURE__ */ jsxs(Row, {
|
|
28
|
-
/* @__PURE__ */ jsx(TextInputField, {
|
|
29
|
-
/* @__PURE__ */ jsx(TextInputField, {
|
|
30
|
-
/* @__PURE__ */ jsx(Button, {
|
|
27
|
+
fields.length > 0 ? /* @__PURE__ */ jsx(Stack, { gap: 3, children: fields.map((field, index) => /* @__PURE__ */ jsxs(Row, { alignItems: "end", gap: 2, templateColumns: "1fr 1fr auto", children: [
|
|
28
|
+
/* @__PURE__ */ jsx(TextInputField, { label: inputKey.label, name: `${name}.${index}.key`, readOnly, regex: inputKey.regex, required: inputKey.required }),
|
|
29
|
+
/* @__PURE__ */ jsx(TextInputField, { autoComplete: "off", label: inputValue.label, name: `${name}.${index}.value`, placeholder: inputValue.placeholder, readOnly, regex: inputValue.regex, required: inputValue.required, type: inputValue.type }),
|
|
30
|
+
/* @__PURE__ */ jsx(Button, { "data-testid": `remove-button-${index}`, disabled: readOnly, onClick: () => remove(index), sentiment: "danger", size: "large", variant: "outlined", children: /* @__PURE__ */ jsx(DeleteIcon, {}) })
|
|
31
31
|
] }, field.id)) }) : null,
|
|
32
32
|
/* @__PURE__ */ jsx(Stack, { direction: "row", justifyContent: "flex-start", children: /* @__PURE__ */ jsxs(
|
|
33
33
|
Button,
|
|
34
34
|
{
|
|
35
35
|
"data-testid": "add-button",
|
|
36
|
-
variant: "outlined",
|
|
37
|
-
sentiment: "primary",
|
|
38
|
-
fullWidth: addButton.fullWidth,
|
|
39
36
|
disabled: !canAdd || readOnly,
|
|
40
|
-
|
|
37
|
+
fullWidth: addButton.fullWidth,
|
|
41
38
|
onClick: () => append({
|
|
42
39
|
key: "",
|
|
43
40
|
value: ""
|
|
44
41
|
}),
|
|
42
|
+
sentiment: "primary",
|
|
43
|
+
tooltip: !canAdd ? maxSizeReachedTooltip : addButton.tooltip,
|
|
44
|
+
variant: "outlined",
|
|
45
45
|
children: [
|
|
46
46
|
/* @__PURE__ */ jsx(PlusIcon, {}),
|
|
47
47
|
addButton.name
|
|
@@ -30,9 +30,8 @@ const NumberInputField = ({
|
|
|
30
30
|
error
|
|
31
31
|
}
|
|
32
32
|
} = reactHookForm.useController({
|
|
33
|
-
name,
|
|
34
33
|
control,
|
|
35
|
-
|
|
34
|
+
name,
|
|
36
35
|
rules: {
|
|
37
36
|
max,
|
|
38
37
|
min,
|
|
@@ -41,19 +40,20 @@ const NumberInputField = ({
|
|
|
41
40
|
...validate,
|
|
42
41
|
isInteger: isInteger.isInteger(step)
|
|
43
42
|
}
|
|
44
|
-
}
|
|
43
|
+
},
|
|
44
|
+
shouldUnregister
|
|
45
45
|
});
|
|
46
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ui.NumberInput, { ...props,
|
|
46
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.NumberInput, { ...props, "aria-label": ariaLabel, error: getError({
|
|
47
|
+
isInteger: step,
|
|
48
|
+
label: label ?? ariaLabel ?? name,
|
|
49
|
+
max,
|
|
50
|
+
min
|
|
51
|
+
}, error), label, max, min, name: field.name, onBlur: (event) => {
|
|
47
52
|
field.onBlur();
|
|
48
53
|
onBlur?.(event);
|
|
49
54
|
}, onChange: (newValue) => {
|
|
50
55
|
field.onChange(newValue);
|
|
51
56
|
onChange?.(newValue);
|
|
52
|
-
},
|
|
53
|
-
label: label ?? ariaLabel ?? name,
|
|
54
|
-
max,
|
|
55
|
-
min,
|
|
56
|
-
isInteger: step
|
|
57
|
-
}, error), "aria-label": ariaLabel, required });
|
|
57
|
+
}, required, step, value: field.value });
|
|
58
58
|
};
|
|
59
59
|
exports.NumberInputField = NumberInputField;
|
|
@@ -28,9 +28,8 @@ const NumberInputField = ({
|
|
|
28
28
|
error
|
|
29
29
|
}
|
|
30
30
|
} = useController({
|
|
31
|
-
name,
|
|
32
31
|
control,
|
|
33
|
-
|
|
32
|
+
name,
|
|
34
33
|
rules: {
|
|
35
34
|
max,
|
|
36
35
|
min,
|
|
@@ -39,20 +38,21 @@ const NumberInputField = ({
|
|
|
39
38
|
...validate,
|
|
40
39
|
isInteger: isInteger(step)
|
|
41
40
|
}
|
|
42
|
-
}
|
|
41
|
+
},
|
|
42
|
+
shouldUnregister
|
|
43
43
|
});
|
|
44
|
-
return /* @__PURE__ */ jsx(NumberInput, { ...props,
|
|
44
|
+
return /* @__PURE__ */ jsx(NumberInput, { ...props, "aria-label": ariaLabel, error: getError({
|
|
45
|
+
isInteger: step,
|
|
46
|
+
label: label ?? ariaLabel ?? name,
|
|
47
|
+
max,
|
|
48
|
+
min
|
|
49
|
+
}, error), label, max, min, name: field.name, onBlur: (event) => {
|
|
45
50
|
field.onBlur();
|
|
46
51
|
onBlur?.(event);
|
|
47
52
|
}, onChange: (newValue) => {
|
|
48
53
|
field.onChange(newValue);
|
|
49
54
|
onChange?.(newValue);
|
|
50
|
-
},
|
|
51
|
-
label: label ?? ariaLabel ?? name,
|
|
52
|
-
max,
|
|
53
|
-
min,
|
|
54
|
-
isInteger: step
|
|
55
|
-
}, error), "aria-label": ariaLabel, required });
|
|
55
|
+
}, required, step, value: field.value });
|
|
56
56
|
};
|
|
57
57
|
export {
|
|
58
58
|
NumberInputField
|
|
@@ -30,13 +30,13 @@ const RadioField = ({
|
|
|
30
30
|
error
|
|
31
31
|
}
|
|
32
32
|
} = reactHookForm.useController({
|
|
33
|
-
name,
|
|
34
33
|
control,
|
|
35
|
-
|
|
34
|
+
name,
|
|
36
35
|
rules: {
|
|
37
36
|
required,
|
|
38
37
|
validate
|
|
39
|
-
}
|
|
38
|
+
},
|
|
39
|
+
shouldUnregister
|
|
40
40
|
});
|
|
41
41
|
const errorLabel = react.useMemo(() => {
|
|
42
42
|
if (label && typeof label === "string") {
|
|
@@ -47,14 +47,14 @@ const RadioField = ({
|
|
|
47
47
|
}
|
|
48
48
|
return name;
|
|
49
49
|
}, [label, name, ariaLabel]);
|
|
50
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ui.Radio, { ...props,
|
|
50
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.Radio, { ...props, checked: field.value === value, disabled, error: getError({
|
|
51
51
|
label: errorLabel
|
|
52
|
-
}, error),
|
|
53
|
-
field.onChange(value);
|
|
54
|
-
onChange?.(value);
|
|
55
|
-
}, onBlur: (event) => {
|
|
52
|
+
}, error), name: field.name, onBlur: (event) => {
|
|
56
53
|
field.onBlur();
|
|
57
54
|
onBlur?.(event);
|
|
55
|
+
}, onChange: () => {
|
|
56
|
+
field.onChange(value);
|
|
57
|
+
onChange?.(value);
|
|
58
58
|
}, onFocus, required, value: value ?? "", ...label ? {
|
|
59
59
|
label
|
|
60
60
|
} : {
|