@ultraviolet/form 4.0.0-beta.6 → 4.0.0-beta.8
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/DateField/index.cjs +7 -17
- package/dist/components/DateField/index.d.ts +3 -13
- package/dist/components/DateField/index.js +7 -17
- package/dist/components/Form/index.cjs +20 -1
- package/dist/components/Form/index.js +18 -1
- package/dist/components/NumberInputFieldV2/index.cjs +5 -18
- package/dist/components/NumberInputFieldV2/index.d.ts +2 -4
- package/dist/components/NumberInputFieldV2/index.js +5 -18
- package/dist/components/SelectableCardField/index.cjs +5 -11
- package/dist/components/SelectableCardField/index.d.ts +3 -11
- package/dist/components/SelectableCardField/index.js +5 -11
- package/dist/components/SelectableCardGroupField/index.cjs +4 -8
- package/dist/components/SelectableCardGroupField/index.d.ts +2 -2
- package/dist/components/SelectableCardGroupField/index.js +4 -8
- package/dist/components/TagInputField/index.cjs +5 -16
- package/dist/components/TagInputField/index.d.ts +2 -2
- package/dist/components/TagInputField/index.js +5 -16
- package/dist/components/TextAreaField/index.cjs +5 -19
- package/dist/components/TextAreaField/index.d.ts +1 -1
- package/dist/components/TextAreaField/index.js +5 -19
- package/dist/components/TextInputFieldV2/index.cjs +4 -32
- package/dist/components/TextInputFieldV2/index.d.ts +1 -1
- package/dist/components/TextInputFieldV2/index.js +4 -32
- package/dist/components/TimeInputFieldV2/index.cjs +4 -18
- package/dist/components/TimeInputFieldV2/index.d.ts +1 -1
- package/dist/components/TimeInputFieldV2/index.js +4 -18
- package/dist/components/ToggleField/index.cjs +4 -9
- package/dist/components/ToggleField/index.d.ts +5 -5
- package/dist/components/ToggleField/index.js +4 -9
- package/dist/components/ToggleGroupField/index.d.ts +2 -2
- package/dist/components/UnitInputField/index.cjs +5 -15
- package/dist/components/UnitInputField/index.d.ts +2 -4
- package/dist/components/UnitInputField/index.js +5 -15
- package/dist/components/VerificationCodeField/index.cjs +5 -14
- package/dist/components/VerificationCodeField/index.d.ts +2 -7
- package/dist/components/VerificationCodeField/index.js +5 -14
- package/package.json +6 -6
|
@@ -15,25 +15,15 @@ const DateField = ({
|
|
|
15
15
|
control,
|
|
16
16
|
label = "",
|
|
17
17
|
format,
|
|
18
|
-
locale,
|
|
19
|
-
maxDate: maxDate$1,
|
|
20
18
|
minDate: minDate$1,
|
|
21
|
-
|
|
19
|
+
maxDate: maxDate$1,
|
|
22
20
|
onChange,
|
|
23
21
|
onBlur,
|
|
24
|
-
onFocus,
|
|
25
22
|
validate,
|
|
26
|
-
autoFocus = false,
|
|
27
|
-
excludeDates,
|
|
28
23
|
selectsRange,
|
|
29
|
-
size,
|
|
30
|
-
placeholder,
|
|
31
|
-
tooltip,
|
|
32
|
-
clearable,
|
|
33
|
-
"data-testid": dataTestId,
|
|
34
|
-
shouldUnregister = false,
|
|
35
24
|
showMonthYearPicker,
|
|
36
|
-
|
|
25
|
+
shouldUnregister = false,
|
|
26
|
+
...props
|
|
37
27
|
}) => {
|
|
38
28
|
const {
|
|
39
29
|
getError
|
|
@@ -56,14 +46,14 @@ const DateField = ({
|
|
|
56
46
|
}
|
|
57
47
|
}
|
|
58
48
|
});
|
|
59
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ui.DateInput, { name: field.name, label,
|
|
49
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.DateInput, { ...props, name: field.name, label, value: Array.isArray(field.value) ? void 0 : field.value, format: format || ((value) => {
|
|
60
50
|
if (!value) return "";
|
|
61
51
|
const date = parseDate(value);
|
|
62
52
|
return showMonthYearPicker ? date.toLocaleDateString(void 0, {
|
|
63
53
|
year: "numeric",
|
|
64
54
|
month: "numeric"
|
|
65
55
|
}) : date.toLocaleDateString();
|
|
66
|
-
}),
|
|
56
|
+
}), required, onChange: (val) => {
|
|
67
57
|
if (val && val instanceof Date) {
|
|
68
58
|
onChange?.(val);
|
|
69
59
|
const newDate = parseDate(val);
|
|
@@ -84,10 +74,10 @@ const DateField = ({
|
|
|
84
74
|
}, onBlur: (e) => {
|
|
85
75
|
field.onBlur();
|
|
86
76
|
onBlur?.(e);
|
|
87
|
-
},
|
|
77
|
+
}, maxDate: maxDate$1, minDate: minDate$1, error: getError({
|
|
88
78
|
minDate: minDate$1,
|
|
89
79
|
maxDate: maxDate$1,
|
|
90
80
|
label
|
|
91
|
-
}, error),
|
|
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 });
|
|
92
82
|
};
|
|
93
83
|
exports.DateField = DateField;
|
|
@@ -1,17 +1,7 @@
|
|
|
1
1
|
import { DateInput } from '@ultraviolet/ui';
|
|
2
|
-
import type { ComponentProps
|
|
2
|
+
import type { ComponentProps } from 'react';
|
|
3
3
|
import type { FieldPath, FieldValues } from 'react-hook-form';
|
|
4
4
|
import type { BaseFieldProps } from '../../types';
|
|
5
|
-
type DateFieldProps<TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues>> = BaseFieldProps<TFieldValues, TFieldName> & Omit<ComponentProps<typeof DateInput>, '
|
|
6
|
-
|
|
7
|
-
minDate?: Date;
|
|
8
|
-
disabled?: boolean;
|
|
9
|
-
required?: boolean;
|
|
10
|
-
locale?: string;
|
|
11
|
-
onBlur?: (event: FocusEvent<HTMLElement>) => void;
|
|
12
|
-
onFocus?: (value: FocusEvent<HTMLElement>) => void;
|
|
13
|
-
autoFocus?: boolean;
|
|
14
|
-
placeholder?: string;
|
|
15
|
-
};
|
|
16
|
-
export declare const DateField: <TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ required, name, control, label, format, locale, maxDate, minDate, disabled, onChange, onBlur, onFocus, validate, autoFocus, excludeDates, selectsRange, size, placeholder, tooltip, clearable, "data-testid": dataTestId, shouldUnregister, showMonthYearPicker, input, }: DateFieldProps<TFieldValues, TFieldName>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
5
|
+
type DateFieldProps<TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues>> = BaseFieldProps<TFieldValues, TFieldName> & Omit<ComponentProps<typeof DateInput>, 'required' | 'name' | 'onChange'>;
|
|
6
|
+
export declare const DateField: <TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ required, name, control, label, format, minDate, maxDate, onChange, onBlur, validate, selectsRange, showMonthYearPicker, shouldUnregister, ...props }: DateFieldProps<TFieldValues, TFieldName>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
17
7
|
export {};
|
|
@@ -13,25 +13,15 @@ const DateField = ({
|
|
|
13
13
|
control,
|
|
14
14
|
label = "",
|
|
15
15
|
format,
|
|
16
|
-
locale,
|
|
17
|
-
maxDate,
|
|
18
16
|
minDate,
|
|
19
|
-
|
|
17
|
+
maxDate,
|
|
20
18
|
onChange,
|
|
21
19
|
onBlur,
|
|
22
|
-
onFocus,
|
|
23
20
|
validate,
|
|
24
|
-
autoFocus = false,
|
|
25
|
-
excludeDates,
|
|
26
21
|
selectsRange,
|
|
27
|
-
size,
|
|
28
|
-
placeholder,
|
|
29
|
-
tooltip,
|
|
30
|
-
clearable,
|
|
31
|
-
"data-testid": dataTestId,
|
|
32
|
-
shouldUnregister = false,
|
|
33
22
|
showMonthYearPicker,
|
|
34
|
-
|
|
23
|
+
shouldUnregister = false,
|
|
24
|
+
...props
|
|
35
25
|
}) => {
|
|
36
26
|
const {
|
|
37
27
|
getError
|
|
@@ -54,14 +44,14 @@ const DateField = ({
|
|
|
54
44
|
}
|
|
55
45
|
}
|
|
56
46
|
});
|
|
57
|
-
return /* @__PURE__ */ jsx(DateInput, { name: field.name, label,
|
|
47
|
+
return /* @__PURE__ */ jsx(DateInput, { ...props, name: field.name, label, value: Array.isArray(field.value) ? void 0 : field.value, format: format || ((value) => {
|
|
58
48
|
if (!value) return "";
|
|
59
49
|
const date = parseDate(value);
|
|
60
50
|
return showMonthYearPicker ? date.toLocaleDateString(void 0, {
|
|
61
51
|
year: "numeric",
|
|
62
52
|
month: "numeric"
|
|
63
53
|
}) : date.toLocaleDateString();
|
|
64
|
-
}),
|
|
54
|
+
}), required, onChange: (val) => {
|
|
65
55
|
if (val && val instanceof Date) {
|
|
66
56
|
onChange?.(val);
|
|
67
57
|
const newDate = parseDate(val);
|
|
@@ -82,11 +72,11 @@ const DateField = ({
|
|
|
82
72
|
}, onBlur: (e) => {
|
|
83
73
|
field.onBlur();
|
|
84
74
|
onBlur?.(e);
|
|
85
|
-
},
|
|
75
|
+
}, maxDate, minDate, error: getError({
|
|
86
76
|
minDate,
|
|
87
77
|
maxDate,
|
|
88
78
|
label
|
|
89
|
-
}, error),
|
|
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 });
|
|
90
80
|
};
|
|
91
81
|
export {
|
|
92
82
|
DateField
|
|
@@ -2,9 +2,28 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
4
|
const jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
5
|
+
const _styled = require("@emotion/styled/base");
|
|
5
6
|
const reactHookForm = require("react-hook-form");
|
|
6
7
|
const defaultErrors = require("./defaultErrors.cjs");
|
|
7
8
|
const index = require("../../providers/ErrorContext/index.cjs");
|
|
9
|
+
const _interopDefaultCompat = (e) => e && typeof e === "object" && "default" in e ? e : { default: e };
|
|
10
|
+
const _styled__default = /* @__PURE__ */ _interopDefaultCompat(_styled);
|
|
11
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__() {
|
|
12
|
+
return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop).";
|
|
13
|
+
}
|
|
14
|
+
const StyledForm = /* @__PURE__ */ _styled__default.default("form", process.env.NODE_ENV === "production" ? {
|
|
15
|
+
target: "ep3wzi00"
|
|
16
|
+
} : {
|
|
17
|
+
target: "ep3wzi00",
|
|
18
|
+
label: "StyledForm"
|
|
19
|
+
})(process.env.NODE_ENV === "production" ? {
|
|
20
|
+
name: "49aokf",
|
|
21
|
+
styles: "display:contents"
|
|
22
|
+
} : {
|
|
23
|
+
name: "49aokf",
|
|
24
|
+
styles: "display:contents/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9ob21lL3J1bm5lci93b3JrL3VsdHJhdmlvbGV0L3VsdHJhdmlvbGV0L3BhY2thZ2VzL2Zvcm0vc3JjL2NvbXBvbmVudHMvRm9ybS9pbmRleC50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBb0I4QiIsImZpbGUiOiIvaG9tZS9ydW5uZXIvd29yay91bHRyYXZpb2xldC91bHRyYXZpb2xldC9wYWNrYWdlcy9mb3JtL3NyYy9jb21wb25lbnRzL0Zvcm0vaW5kZXgudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBjbGllbnQnXG5cbmltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJ1xuaW1wb3J0IHR5cGUgeyBSZWFjdE5vZGUgfSBmcm9tICdyZWFjdCdcbmltcG9ydCB0eXBlIHsgRmllbGRWYWx1ZXMsIFVzZUZvcm1SZXR1cm4gfSBmcm9tICdyZWFjdC1ob29rLWZvcm0nXG5pbXBvcnQgeyBGb3JtUHJvdmlkZXIgfSBmcm9tICdyZWFjdC1ob29rLWZvcm0nXG5pbXBvcnQgeyBFcnJvclByb3ZpZGVyIH0gZnJvbSAnLi4vLi4vcHJvdmlkZXJzJ1xuaW1wb3J0IHR5cGUgeyBGb3JtRXJyb3JzIH0gZnJvbSAnLi4vLi4vdHlwZXMnXG5pbXBvcnQgeyBkZWZhdWx0RXJyb3JzIH0gZnJvbSAnLi9kZWZhdWx0RXJyb3JzJ1xuXG50eXBlIE9uU3VibWl0UmV0dXJuID0gc3RyaW5nIHwgbnVsbCB8IHVuZGVmaW5lZCB8IHZvaWRcblxudHlwZSBGb3JtUHJvcHM8VEZpZWxkVmFsdWVzIGV4dGVuZHMgRmllbGRWYWx1ZXM+ID0ge1xuICBjaGlsZHJlbj86IFJlYWN0Tm9kZVxuICBlcnJvcnM6IEZvcm1FcnJvcnNcbiAgbmFtZT86IHN0cmluZ1xuICBvblN1Ym1pdDogKGRhdGE6IFRGaWVsZFZhbHVlcykgPT4gUHJvbWlzZTxPblN1Ym1pdFJldHVybj4gfCBPblN1Ym1pdFJldHVyblxuICBtZXRob2RzOiBVc2VGb3JtUmV0dXJuPFRGaWVsZFZhbHVlcz5cbn1cblxuY29uc3QgU3R5bGVkRm9ybSA9IHN0eWxlZC5mb3JtYFxuICBkaXNwbGF5OiBjb250ZW50cztcbmBcblxuZXhwb3J0IGNvbnN0IEZvcm0gPSA8VEZpZWxkVmFsdWVzIGV4dGVuZHMgRmllbGRWYWx1ZXM+KHtcbiAgY2hpbGRyZW4sXG4gIG1ldGhvZHMsXG4gIGVycm9ycyxcbiAgb25TdWJtaXQsXG4gIG5hbWUsXG59OiBGb3JtUHJvcHM8VEZpZWxkVmFsdWVzPikgPT4ge1xuICBjb25zdCBoYW5kbGVTdWJtaXQgPSBtZXRob2RzLmhhbmRsZVN1Ym1pdChhc3luYyB2YWx1ZXMgPT4ge1xuICAgIGNvbnN0IHJlc3VsdCA9IGF3YWl0IG9uU3VibWl0KHZhbHVlcylcblxuICAgIGlmIChyZXN1bHQpIHtcbiAgICAgIG1ldGhvZHMuc2V0RXJyb3IoJ3Jvb3Quc3VibWl0Jywge1xuICAgICAgICB0eXBlOiAnY3VzdG9tJyxcbiAgICAgICAgbWVzc2FnZTogcmVzdWx0LFxuICAgICAgfSlcbiAgICB9XG4gIH0pXG5cbiAgcmV0dXJuIChcbiAgICA8Rm9ybVByb3ZpZGVyIHsuLi5tZXRob2RzfT5cbiAgICAgIDxFcnJvclByb3ZpZGVyIGVycm9ycz17eyAuLi5kZWZhdWx0RXJyb3JzLCAuLi5lcnJvcnMgfX0+XG4gICAgICAgIDxTdHlsZWRGb3JtXG4gICAgICAgICAgb25TdWJtaXQ9e2FzeW5jIGUgPT4ge1xuICAgICAgICAgICAgZS5wcmV2ZW50RGVmYXVsdCgpXG4gICAgICAgICAgICBlLnN0b3BQcm9wYWdhdGlvbigpXG4gICAgICAgICAgICBhd2FpdCBoYW5kbGVTdWJtaXQoZSlcbiAgICAgICAgICB9fVxuICAgICAgICAgIG5hbWU9e25hbWV9XG4gICAgICAgICAgbm9WYWxpZGF0ZVxuICAgICAgICA+XG4gICAgICAgICAge2NoaWxkcmVufVxuICAgICAgICA8L1N0eWxlZEZvcm0+XG4gICAgICA8L0Vycm9yUHJvdmlkZXI+XG4gICAgPC9Gb3JtUHJvdmlkZXI+XG4gIClcbn1cbiJdfQ== */",
|
|
25
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
26
|
+
});
|
|
8
27
|
const Form = ({
|
|
9
28
|
children,
|
|
10
29
|
methods,
|
|
@@ -24,7 +43,7 @@ const Form = ({
|
|
|
24
43
|
return /* @__PURE__ */ jsxRuntime.jsx(reactHookForm.FormProvider, { ...methods, children: /* @__PURE__ */ jsxRuntime.jsx(index.ErrorProvider, { errors: {
|
|
25
44
|
...defaultErrors.defaultErrors,
|
|
26
45
|
...errors
|
|
27
|
-
}, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
46
|
+
}, children: /* @__PURE__ */ jsxRuntime.jsx(StyledForm, { onSubmit: async (e) => {
|
|
28
47
|
e.preventDefault();
|
|
29
48
|
e.stopPropagation();
|
|
30
49
|
await handleSubmit(e);
|
|
@@ -1,8 +1,25 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from "@emotion/react/jsx-runtime";
|
|
3
|
+
import _styled from "@emotion/styled/base";
|
|
3
4
|
import { FormProvider } from "react-hook-form";
|
|
4
5
|
import { defaultErrors } from "./defaultErrors.js";
|
|
5
6
|
import { ErrorProvider } from "../../providers/ErrorContext/index.js";
|
|
7
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__() {
|
|
8
|
+
return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop).";
|
|
9
|
+
}
|
|
10
|
+
const StyledForm = /* @__PURE__ */ _styled("form", process.env.NODE_ENV === "production" ? {
|
|
11
|
+
target: "ep3wzi00"
|
|
12
|
+
} : {
|
|
13
|
+
target: "ep3wzi00",
|
|
14
|
+
label: "StyledForm"
|
|
15
|
+
})(process.env.NODE_ENV === "production" ? {
|
|
16
|
+
name: "49aokf",
|
|
17
|
+
styles: "display:contents"
|
|
18
|
+
} : {
|
|
19
|
+
name: "49aokf",
|
|
20
|
+
styles: "display:contents/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9ob21lL3J1bm5lci93b3JrL3VsdHJhdmlvbGV0L3VsdHJhdmlvbGV0L3BhY2thZ2VzL2Zvcm0vc3JjL2NvbXBvbmVudHMvRm9ybS9pbmRleC50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBb0I4QiIsImZpbGUiOiIvaG9tZS9ydW5uZXIvd29yay91bHRyYXZpb2xldC91bHRyYXZpb2xldC9wYWNrYWdlcy9mb3JtL3NyYy9jb21wb25lbnRzL0Zvcm0vaW5kZXgudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBjbGllbnQnXG5cbmltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJ1xuaW1wb3J0IHR5cGUgeyBSZWFjdE5vZGUgfSBmcm9tICdyZWFjdCdcbmltcG9ydCB0eXBlIHsgRmllbGRWYWx1ZXMsIFVzZUZvcm1SZXR1cm4gfSBmcm9tICdyZWFjdC1ob29rLWZvcm0nXG5pbXBvcnQgeyBGb3JtUHJvdmlkZXIgfSBmcm9tICdyZWFjdC1ob29rLWZvcm0nXG5pbXBvcnQgeyBFcnJvclByb3ZpZGVyIH0gZnJvbSAnLi4vLi4vcHJvdmlkZXJzJ1xuaW1wb3J0IHR5cGUgeyBGb3JtRXJyb3JzIH0gZnJvbSAnLi4vLi4vdHlwZXMnXG5pbXBvcnQgeyBkZWZhdWx0RXJyb3JzIH0gZnJvbSAnLi9kZWZhdWx0RXJyb3JzJ1xuXG50eXBlIE9uU3VibWl0UmV0dXJuID0gc3RyaW5nIHwgbnVsbCB8IHVuZGVmaW5lZCB8IHZvaWRcblxudHlwZSBGb3JtUHJvcHM8VEZpZWxkVmFsdWVzIGV4dGVuZHMgRmllbGRWYWx1ZXM+ID0ge1xuICBjaGlsZHJlbj86IFJlYWN0Tm9kZVxuICBlcnJvcnM6IEZvcm1FcnJvcnNcbiAgbmFtZT86IHN0cmluZ1xuICBvblN1Ym1pdDogKGRhdGE6IFRGaWVsZFZhbHVlcykgPT4gUHJvbWlzZTxPblN1Ym1pdFJldHVybj4gfCBPblN1Ym1pdFJldHVyblxuICBtZXRob2RzOiBVc2VGb3JtUmV0dXJuPFRGaWVsZFZhbHVlcz5cbn1cblxuY29uc3QgU3R5bGVkRm9ybSA9IHN0eWxlZC5mb3JtYFxuICBkaXNwbGF5OiBjb250ZW50cztcbmBcblxuZXhwb3J0IGNvbnN0IEZvcm0gPSA8VEZpZWxkVmFsdWVzIGV4dGVuZHMgRmllbGRWYWx1ZXM+KHtcbiAgY2hpbGRyZW4sXG4gIG1ldGhvZHMsXG4gIGVycm9ycyxcbiAgb25TdWJtaXQsXG4gIG5hbWUsXG59OiBGb3JtUHJvcHM8VEZpZWxkVmFsdWVzPikgPT4ge1xuICBjb25zdCBoYW5kbGVTdWJtaXQgPSBtZXRob2RzLmhhbmRsZVN1Ym1pdChhc3luYyB2YWx1ZXMgPT4ge1xuICAgIGNvbnN0IHJlc3VsdCA9IGF3YWl0IG9uU3VibWl0KHZhbHVlcylcblxuICAgIGlmIChyZXN1bHQpIHtcbiAgICAgIG1ldGhvZHMuc2V0RXJyb3IoJ3Jvb3Quc3VibWl0Jywge1xuICAgICAgICB0eXBlOiAnY3VzdG9tJyxcbiAgICAgICAgbWVzc2FnZTogcmVzdWx0LFxuICAgICAgfSlcbiAgICB9XG4gIH0pXG5cbiAgcmV0dXJuIChcbiAgICA8Rm9ybVByb3ZpZGVyIHsuLi5tZXRob2RzfT5cbiAgICAgIDxFcnJvclByb3ZpZGVyIGVycm9ycz17eyAuLi5kZWZhdWx0RXJyb3JzLCAuLi5lcnJvcnMgfX0+XG4gICAgICAgIDxTdHlsZWRGb3JtXG4gICAgICAgICAgb25TdWJtaXQ9e2FzeW5jIGUgPT4ge1xuICAgICAgICAgICAgZS5wcmV2ZW50RGVmYXVsdCgpXG4gICAgICAgICAgICBlLnN0b3BQcm9wYWdhdGlvbigpXG4gICAgICAgICAgICBhd2FpdCBoYW5kbGVTdWJtaXQoZSlcbiAgICAgICAgICB9fVxuICAgICAgICAgIG5hbWU9e25hbWV9XG4gICAgICAgICAgbm9WYWxpZGF0ZVxuICAgICAgICA+XG4gICAgICAgICAge2NoaWxkcmVufVxuICAgICAgICA8L1N0eWxlZEZvcm0+XG4gICAgICA8L0Vycm9yUHJvdmlkZXI+XG4gICAgPC9Gb3JtUHJvdmlkZXI+XG4gIClcbn1cbiJdfQ== */",
|
|
21
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
22
|
+
});
|
|
6
23
|
const Form = ({
|
|
7
24
|
children,
|
|
8
25
|
methods,
|
|
@@ -22,7 +39,7 @@ const Form = ({
|
|
|
22
39
|
return /* @__PURE__ */ jsx(FormProvider, { ...methods, children: /* @__PURE__ */ jsx(ErrorProvider, { errors: {
|
|
23
40
|
...defaultErrors,
|
|
24
41
|
...errors
|
|
25
|
-
}, children: /* @__PURE__ */ jsx(
|
|
42
|
+
}, children: /* @__PURE__ */ jsx(StyledForm, { onSubmit: async (e) => {
|
|
26
43
|
e.preventDefault();
|
|
27
44
|
e.stopPropagation();
|
|
28
45
|
await handleSubmit(e);
|
|
@@ -7,32 +7,19 @@ const reactHookForm = require("react-hook-form");
|
|
|
7
7
|
const isInteger = require("../../validators/isInteger.cjs");
|
|
8
8
|
const index = require("../../providers/ErrorContext/index.cjs");
|
|
9
9
|
const NumberInputFieldV2 = ({
|
|
10
|
-
disabled,
|
|
11
10
|
control,
|
|
12
11
|
max = Number.MAX_SAFE_INTEGER,
|
|
13
12
|
min = 0,
|
|
14
13
|
name,
|
|
15
14
|
onChange,
|
|
16
15
|
onBlur,
|
|
17
|
-
size,
|
|
18
16
|
step,
|
|
19
|
-
unit,
|
|
20
|
-
tooltip,
|
|
21
|
-
className,
|
|
22
17
|
label,
|
|
23
|
-
labelDescription,
|
|
24
|
-
id,
|
|
25
|
-
placeholder,
|
|
26
|
-
success,
|
|
27
|
-
helper,
|
|
28
|
-
controls = true,
|
|
29
18
|
"aria-label": ariaLabel,
|
|
30
|
-
"data-testid": dataTestId,
|
|
31
19
|
required,
|
|
32
|
-
autoFocus,
|
|
33
|
-
readOnly,
|
|
34
20
|
shouldUnregister = false,
|
|
35
|
-
validate
|
|
21
|
+
validate,
|
|
22
|
+
...props
|
|
36
23
|
}) => {
|
|
37
24
|
const {
|
|
38
25
|
getError
|
|
@@ -56,17 +43,17 @@ const NumberInputFieldV2 = ({
|
|
|
56
43
|
}
|
|
57
44
|
}
|
|
58
45
|
});
|
|
59
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ui.NumberInputV2, { name: field.name, value: field.value,
|
|
46
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.NumberInputV2, { ...props, name: field.name, value: field.value, onBlur: (event) => {
|
|
60
47
|
field.onBlur();
|
|
61
48
|
onBlur?.(event);
|
|
62
49
|
}, onChange: (newValue) => {
|
|
63
50
|
field.onChange(newValue);
|
|
64
51
|
onChange?.(newValue);
|
|
65
|
-
}, max, min,
|
|
52
|
+
}, max, min, step, label, error: getError({
|
|
66
53
|
label: label ?? ariaLabel ?? name,
|
|
67
54
|
max,
|
|
68
55
|
min,
|
|
69
56
|
isInteger: step
|
|
70
|
-
}, error),
|
|
57
|
+
}, error), "aria-label": ariaLabel, required });
|
|
71
58
|
};
|
|
72
59
|
exports.NumberInputFieldV2 = NumberInputFieldV2;
|
|
@@ -2,8 +2,6 @@ import { NumberInputV2 } from '@ultraviolet/ui';
|
|
|
2
2
|
import type { ComponentProps } from 'react';
|
|
3
3
|
import type { FieldPath, FieldValues } from 'react-hook-form';
|
|
4
4
|
import type { BaseFieldProps } from '../../types';
|
|
5
|
-
type NumberInputV2Props<TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues>> = BaseFieldProps<TFieldValues, TFieldName> &
|
|
6
|
-
|
|
7
|
-
};
|
|
8
|
-
export declare const NumberInputFieldV2: <TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ disabled, control, max, min, name, onChange, onBlur, size, step, unit, tooltip, className, label, labelDescription, id, placeholder, success, helper, controls, "aria-label": ariaLabel, "data-testid": dataTestId, required, autoFocus, readOnly, shouldUnregister, validate, }: NumberInputV2Props<TFieldValues, TFieldName>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
5
|
+
type NumberInputV2Props<TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues>> = BaseFieldProps<TFieldValues, TFieldName> & Omit<ComponentProps<typeof NumberInputV2>, 'onChange'>;
|
|
6
|
+
export declare const NumberInputFieldV2: <TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ control, max, min, name, onChange, onBlur, step, label, "aria-label": ariaLabel, required, shouldUnregister, validate, ...props }: NumberInputV2Props<TFieldValues, TFieldName>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
9
7
|
export {};
|
|
@@ -5,32 +5,19 @@ import { useController } from "react-hook-form";
|
|
|
5
5
|
import { isInteger } from "../../validators/isInteger.js";
|
|
6
6
|
import { useErrors } from "../../providers/ErrorContext/index.js";
|
|
7
7
|
const NumberInputFieldV2 = ({
|
|
8
|
-
disabled,
|
|
9
8
|
control,
|
|
10
9
|
max = Number.MAX_SAFE_INTEGER,
|
|
11
10
|
min = 0,
|
|
12
11
|
name,
|
|
13
12
|
onChange,
|
|
14
13
|
onBlur,
|
|
15
|
-
size,
|
|
16
14
|
step,
|
|
17
|
-
unit,
|
|
18
|
-
tooltip,
|
|
19
|
-
className,
|
|
20
15
|
label,
|
|
21
|
-
labelDescription,
|
|
22
|
-
id,
|
|
23
|
-
placeholder,
|
|
24
|
-
success,
|
|
25
|
-
helper,
|
|
26
|
-
controls = true,
|
|
27
16
|
"aria-label": ariaLabel,
|
|
28
|
-
"data-testid": dataTestId,
|
|
29
17
|
required,
|
|
30
|
-
autoFocus,
|
|
31
|
-
readOnly,
|
|
32
18
|
shouldUnregister = false,
|
|
33
|
-
validate
|
|
19
|
+
validate,
|
|
20
|
+
...props
|
|
34
21
|
}) => {
|
|
35
22
|
const {
|
|
36
23
|
getError
|
|
@@ -54,18 +41,18 @@ const NumberInputFieldV2 = ({
|
|
|
54
41
|
}
|
|
55
42
|
}
|
|
56
43
|
});
|
|
57
|
-
return /* @__PURE__ */ jsx(NumberInputV2, { name: field.name, value: field.value,
|
|
44
|
+
return /* @__PURE__ */ jsx(NumberInputV2, { ...props, name: field.name, value: field.value, onBlur: (event) => {
|
|
58
45
|
field.onBlur();
|
|
59
46
|
onBlur?.(event);
|
|
60
47
|
}, onChange: (newValue) => {
|
|
61
48
|
field.onChange(newValue);
|
|
62
49
|
onChange?.(newValue);
|
|
63
|
-
}, max, min,
|
|
50
|
+
}, max, min, step, label, error: getError({
|
|
64
51
|
label: label ?? ariaLabel ?? name,
|
|
65
52
|
max,
|
|
66
53
|
min,
|
|
67
54
|
isInteger: step
|
|
68
|
-
}, error),
|
|
55
|
+
}, error), "aria-label": ariaLabel, required });
|
|
69
56
|
};
|
|
70
57
|
export {
|
|
71
58
|
NumberInputFieldV2
|
|
@@ -9,23 +9,17 @@ const SelectableCardField = ({
|
|
|
9
9
|
control,
|
|
10
10
|
value,
|
|
11
11
|
onChange,
|
|
12
|
-
showTick,
|
|
13
12
|
type,
|
|
14
|
-
disabled,
|
|
15
|
-
children,
|
|
16
|
-
className,
|
|
17
13
|
onFocus,
|
|
18
14
|
onBlur,
|
|
19
15
|
required,
|
|
20
|
-
tooltip,
|
|
21
|
-
id,
|
|
22
16
|
label,
|
|
23
17
|
shouldUnregister = false,
|
|
24
18
|
validate,
|
|
25
19
|
productIcon,
|
|
26
20
|
illustration,
|
|
27
|
-
"
|
|
28
|
-
|
|
21
|
+
"aria-label": ariaLabel,
|
|
22
|
+
...props
|
|
29
23
|
}) => {
|
|
30
24
|
const {
|
|
31
25
|
field,
|
|
@@ -42,7 +36,7 @@ const SelectableCardField = ({
|
|
|
42
36
|
}
|
|
43
37
|
});
|
|
44
38
|
const isChecked = type === "checkbox" && Array.isArray(field.value) && value ? (field.value ?? []).includes(value) : field.value === value;
|
|
45
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ui.SelectableCard, { ...productIcon ? {
|
|
39
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.SelectableCard, { ...props, ...productIcon ? {
|
|
46
40
|
productIcon
|
|
47
41
|
} : {
|
|
48
42
|
illustration
|
|
@@ -50,7 +44,7 @@ const SelectableCardField = ({
|
|
|
50
44
|
label
|
|
51
45
|
} : {
|
|
52
46
|
"aria-label": ariaLabel
|
|
53
|
-
}, isError: !!error,
|
|
47
|
+
}, isError: !!error, checked: isChecked, onChange: (event) => {
|
|
54
48
|
if (type === "checkbox") {
|
|
55
49
|
const fieldValue = field.value ?? [];
|
|
56
50
|
if (fieldValue?.includes(event.currentTarget.value)) {
|
|
@@ -67,6 +61,6 @@ const SelectableCardField = ({
|
|
|
67
61
|
onBlur?.(event);
|
|
68
62
|
}, onFocus: (event) => {
|
|
69
63
|
onFocus?.(event);
|
|
70
|
-
}, type,
|
|
64
|
+
}, type, value: value ?? "", name: field.name });
|
|
71
65
|
};
|
|
72
66
|
exports.SelectableCardField = SelectableCardField;
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
import { SelectableCard } from '@ultraviolet/ui';
|
|
2
2
|
import type { ComponentProps } from 'react';
|
|
3
3
|
import type { FieldPath, FieldValues } from 'react-hook-form';
|
|
4
|
-
import type { BaseFieldProps
|
|
5
|
-
type SelectableCardFieldProps<TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues>> = Omit<BaseFieldProps<TFieldValues, TFieldName>, 'label'> &
|
|
6
|
-
|
|
7
|
-
} & ({
|
|
8
|
-
illustration?: ComponentProps<typeof SelectableCard>['illustration'];
|
|
9
|
-
productIcon?: never;
|
|
10
|
-
} | {
|
|
11
|
-
productIcon?: ComponentProps<typeof SelectableCard>['productIcon'];
|
|
12
|
-
illustration?: never;
|
|
13
|
-
}) & LabelProp;
|
|
14
|
-
export declare const SelectableCardField: <TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ name, control, value, onChange, showTick, type, disabled, children, className, onFocus, onBlur, required, tooltip, id, label, shouldUnregister, validate, productIcon, illustration, "data-testid": dataTestId, "aria-label": ariaLabel, }: SelectableCardFieldProps<TFieldValues, TFieldName>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
4
|
+
import type { BaseFieldProps } from '../../types';
|
|
5
|
+
type SelectableCardFieldProps<TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues>> = Omit<BaseFieldProps<TFieldValues, TFieldName>, 'label'> & Omit<ComponentProps<typeof SelectableCard>, 'name' | 'onChange'>;
|
|
6
|
+
export declare const SelectableCardField: <TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ name, control, value, onChange, type, onFocus, onBlur, required, label, shouldUnregister, validate, productIcon, illustration, "aria-label": ariaLabel, ...props }: SelectableCardFieldProps<TFieldValues, TFieldName>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
15
7
|
export {};
|
|
@@ -7,23 +7,17 @@ const SelectableCardField = ({
|
|
|
7
7
|
control,
|
|
8
8
|
value,
|
|
9
9
|
onChange,
|
|
10
|
-
showTick,
|
|
11
10
|
type,
|
|
12
|
-
disabled,
|
|
13
|
-
children,
|
|
14
|
-
className,
|
|
15
11
|
onFocus,
|
|
16
12
|
onBlur,
|
|
17
13
|
required,
|
|
18
|
-
tooltip,
|
|
19
|
-
id,
|
|
20
14
|
label,
|
|
21
15
|
shouldUnregister = false,
|
|
22
16
|
validate,
|
|
23
17
|
productIcon,
|
|
24
18
|
illustration,
|
|
25
|
-
"
|
|
26
|
-
|
|
19
|
+
"aria-label": ariaLabel,
|
|
20
|
+
...props
|
|
27
21
|
}) => {
|
|
28
22
|
const {
|
|
29
23
|
field,
|
|
@@ -40,7 +34,7 @@ const SelectableCardField = ({
|
|
|
40
34
|
}
|
|
41
35
|
});
|
|
42
36
|
const isChecked = type === "checkbox" && Array.isArray(field.value) && value ? (field.value ?? []).includes(value) : field.value === value;
|
|
43
|
-
return /* @__PURE__ */ jsx(SelectableCard, { ...productIcon ? {
|
|
37
|
+
return /* @__PURE__ */ jsx(SelectableCard, { ...props, ...productIcon ? {
|
|
44
38
|
productIcon
|
|
45
39
|
} : {
|
|
46
40
|
illustration
|
|
@@ -48,7 +42,7 @@ const SelectableCardField = ({
|
|
|
48
42
|
label
|
|
49
43
|
} : {
|
|
50
44
|
"aria-label": ariaLabel
|
|
51
|
-
}, isError: !!error,
|
|
45
|
+
}, isError: !!error, checked: isChecked, onChange: (event) => {
|
|
52
46
|
if (type === "checkbox") {
|
|
53
47
|
const fieldValue = field.value ?? [];
|
|
54
48
|
if (fieldValue?.includes(event.currentTarget.value)) {
|
|
@@ -65,7 +59,7 @@ const SelectableCardField = ({
|
|
|
65
59
|
onBlur?.(event);
|
|
66
60
|
}, onFocus: (event) => {
|
|
67
61
|
onFocus?.(event);
|
|
68
|
-
}, type,
|
|
62
|
+
}, type, value: value ?? "", name: field.name });
|
|
69
63
|
};
|
|
70
64
|
export {
|
|
71
65
|
SelectableCardField
|
|
@@ -6,21 +6,17 @@ const ui = require("@ultraviolet/ui");
|
|
|
6
6
|
const reactHookForm = require("react-hook-form");
|
|
7
7
|
const index = require("../../providers/ErrorContext/index.cjs");
|
|
8
8
|
const SelectableCardGroupField = ({
|
|
9
|
-
className,
|
|
10
9
|
legend = "",
|
|
11
|
-
legendDescription,
|
|
12
10
|
control,
|
|
13
11
|
name,
|
|
14
12
|
onChange,
|
|
15
13
|
required = false,
|
|
16
|
-
children,
|
|
17
14
|
error: customError,
|
|
18
|
-
helper,
|
|
19
15
|
columns = 1,
|
|
20
|
-
showTick,
|
|
21
16
|
type = "radio",
|
|
22
17
|
shouldUnregister = false,
|
|
23
|
-
validate
|
|
18
|
+
validate,
|
|
19
|
+
...props
|
|
24
20
|
}) => {
|
|
25
21
|
const {
|
|
26
22
|
getError
|
|
@@ -39,7 +35,7 @@ const SelectableCardGroupField = ({
|
|
|
39
35
|
validate
|
|
40
36
|
}
|
|
41
37
|
});
|
|
42
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ui.SelectableCardGroup, {
|
|
38
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.SelectableCardGroup, { ...props, legend, name, type, value: field.value, onChange: (event) => {
|
|
43
39
|
if (type === "checkbox") {
|
|
44
40
|
const fieldValue = field.value ?? [];
|
|
45
41
|
if (fieldValue?.includes(event.currentTarget.value)) {
|
|
@@ -53,7 +49,7 @@ const SelectableCardGroupField = ({
|
|
|
53
49
|
onChange?.(event.currentTarget.value);
|
|
54
50
|
}, error: getError({
|
|
55
51
|
label: legend
|
|
56
|
-
}, error) ?? customError,
|
|
52
|
+
}, error) ?? customError, columns, required });
|
|
57
53
|
};
|
|
58
54
|
SelectableCardGroupField.Card = ui.SelectableCardGroup.Card;
|
|
59
55
|
exports.SelectableCardGroupField = SelectableCardGroupField;
|
|
@@ -2,9 +2,9 @@ import { SelectableCardGroup } from '@ultraviolet/ui';
|
|
|
2
2
|
import type { ComponentProps, JSX } from 'react';
|
|
3
3
|
import type { FieldPath, FieldValues } from 'react-hook-form';
|
|
4
4
|
import type { BaseFieldProps } from '../../types';
|
|
5
|
-
type SelectableCardGroupFieldProps<TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues>> =
|
|
5
|
+
type SelectableCardGroupFieldProps<TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues>> = BaseFieldProps<TFieldValues, TFieldName> & Omit<ComponentProps<typeof SelectableCardGroup>, 'name' | 'onChange'>;
|
|
6
6
|
export declare const SelectableCardGroupField: {
|
|
7
|
-
<TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({
|
|
7
|
+
<TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ legend, control, name, onChange, required, error: customError, columns, type, shouldUnregister, validate, ...props }: SelectableCardGroupFieldProps<TFieldValues, TFieldName>): JSX.Element;
|
|
8
8
|
Card: ({ value, disabled, children, className, isError, onFocus, onBlur, tooltip, id, label, "data-testid": dataTestId, }: import("node_modules/@ultraviolet/ui/dist/components/SelectableCardGroup").CardSelectableCardProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
9
9
|
};
|
|
10
10
|
export {};
|
|
@@ -4,21 +4,17 @@ import { SelectableCardGroup } from "@ultraviolet/ui";
|
|
|
4
4
|
import { useController } from "react-hook-form";
|
|
5
5
|
import { useErrors } from "../../providers/ErrorContext/index.js";
|
|
6
6
|
const SelectableCardGroupField = ({
|
|
7
|
-
className,
|
|
8
7
|
legend = "",
|
|
9
|
-
legendDescription,
|
|
10
8
|
control,
|
|
11
9
|
name,
|
|
12
10
|
onChange,
|
|
13
11
|
required = false,
|
|
14
|
-
children,
|
|
15
12
|
error: customError,
|
|
16
|
-
helper,
|
|
17
13
|
columns = 1,
|
|
18
|
-
showTick,
|
|
19
14
|
type = "radio",
|
|
20
15
|
shouldUnregister = false,
|
|
21
|
-
validate
|
|
16
|
+
validate,
|
|
17
|
+
...props
|
|
22
18
|
}) => {
|
|
23
19
|
const {
|
|
24
20
|
getError
|
|
@@ -37,7 +33,7 @@ const SelectableCardGroupField = ({
|
|
|
37
33
|
validate
|
|
38
34
|
}
|
|
39
35
|
});
|
|
40
|
-
return /* @__PURE__ */ jsx(SelectableCardGroup, {
|
|
36
|
+
return /* @__PURE__ */ jsx(SelectableCardGroup, { ...props, legend, name, type, value: field.value, onChange: (event) => {
|
|
41
37
|
if (type === "checkbox") {
|
|
42
38
|
const fieldValue = field.value ?? [];
|
|
43
39
|
if (fieldValue?.includes(event.currentTarget.value)) {
|
|
@@ -51,7 +47,7 @@ const SelectableCardGroupField = ({
|
|
|
51
47
|
onChange?.(event.currentTarget.value);
|
|
52
48
|
}, error: getError({
|
|
53
49
|
label: legend
|
|
54
|
-
}, error) ?? customError,
|
|
50
|
+
}, error) ?? customError, columns, required });
|
|
55
51
|
};
|
|
56
52
|
SelectableCardGroupField.Card = SelectableCardGroup.Card;
|
|
57
53
|
export {
|
|
@@ -8,26 +8,15 @@ const validateRegex = require("../../utils/validateRegex.cjs");
|
|
|
8
8
|
const index = require("../../providers/ErrorContext/index.cjs");
|
|
9
9
|
const TagInputField = ({
|
|
10
10
|
regex: regexes,
|
|
11
|
-
className,
|
|
12
|
-
disabled,
|
|
13
|
-
id,
|
|
14
11
|
control,
|
|
15
12
|
name,
|
|
16
13
|
onChange,
|
|
17
|
-
placeholder,
|
|
18
14
|
required,
|
|
19
|
-
variant,
|
|
20
15
|
shouldUnregister = false,
|
|
21
|
-
"data-testid": dataTestId,
|
|
22
|
-
clearable,
|
|
23
16
|
label,
|
|
24
|
-
labelDescription,
|
|
25
|
-
size,
|
|
26
|
-
success,
|
|
27
|
-
readOnly,
|
|
28
|
-
tooltip,
|
|
29
17
|
validate,
|
|
30
|
-
"aria-label": ariaLabel
|
|
18
|
+
"aria-label": ariaLabel,
|
|
19
|
+
...props
|
|
31
20
|
}) => {
|
|
32
21
|
const {
|
|
33
22
|
getError
|
|
@@ -51,12 +40,12 @@ const TagInputField = ({
|
|
|
51
40
|
}
|
|
52
41
|
}
|
|
53
42
|
});
|
|
54
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ui.TagInput, { name: field.name,
|
|
43
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.TagInput, { ...props, name: field.name, onChange: (newTags) => {
|
|
55
44
|
field.onChange(newTags);
|
|
56
45
|
onChange?.(newTags);
|
|
57
|
-
},
|
|
46
|
+
}, value: field.value, label, "aria-label": ariaLabel, error: getError({
|
|
58
47
|
regex: regexes,
|
|
59
48
|
label: label ?? ariaLabel ?? name
|
|
60
|
-
}, error)
|
|
49
|
+
}, error) });
|
|
61
50
|
};
|
|
62
51
|
exports.TagInputField = TagInputField;
|
|
@@ -2,7 +2,7 @@ import { TagInput } from '@ultraviolet/ui';
|
|
|
2
2
|
import type { ComponentProps } from 'react';
|
|
3
3
|
import type { FieldPath, FieldValues } from 'react-hook-form';
|
|
4
4
|
import type { BaseFieldProps } from '../../types';
|
|
5
|
-
export type TagInputFieldProps<TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues>> = BaseFieldProps<TFieldValues, TFieldName> &
|
|
5
|
+
export type TagInputFieldProps<TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues>> = BaseFieldProps<TFieldValues, TFieldName> & Omit<ComponentProps<typeof TagInput>, 'name' | 'onChange'> & {
|
|
6
6
|
regex?: (RegExp | RegExp[])[];
|
|
7
7
|
};
|
|
8
|
-
export declare const TagInputField: <TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ regex: regexes,
|
|
8
|
+
export declare const TagInputField: <TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ regex: regexes, control, name, onChange, required, shouldUnregister, label, validate, "aria-label": ariaLabel, ...props }: TagInputFieldProps<TFieldValues, TFieldName>) => import("@emotion/react/jsx-runtime").JSX.Element;
|