@ultraviolet/form 4.0.0-beta.1 → 4.0.0-beta.11
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 +3 -3
- package/dist/components/CheckboxGroupField/index.d.ts +2 -2
- package/dist/components/CheckboxGroupField/index.js +3 -3
- 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/KeyValueField/index.cjs +1 -1
- package/dist/components/KeyValueField/index.d.ts +6 -6
- package/dist/components/KeyValueField/index.js +1 -1
- package/dist/components/NumberInputField/index.cjs +24 -24
- package/dist/components/NumberInputField/index.d.ts +3 -9
- package/dist/components/NumberInputField/index.js +24 -24
- package/dist/components/RadioGroupField/index.cjs +3 -4
- package/dist/components/RadioGroupField/index.d.ts +2 -2
- package/dist/components/RadioGroupField/index.js +3 -4
- package/dist/components/SelectInputField/index.cjs +19 -71
- package/dist/components/SelectInputField/index.d.ts +3 -81
- package/dist/components/SelectInputField/index.js +20 -72
- 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 +6 -10
- package/dist/components/SelectableCardGroupField/index.d.ts +2 -2
- package/dist/components/SelectableCardGroupField/index.js +6 -10
- package/dist/components/SelectableCardOptionGroupField/index.cjs +2 -3
- package/dist/components/SelectableCardOptionGroupField/index.d.ts +5 -5
- package/dist/components/SelectableCardOptionGroupField/index.js +2 -3
- package/dist/components/SwitchButtonField/index.cjs +2 -3
- package/dist/components/SwitchButtonField/index.d.ts +9 -2
- package/dist/components/SwitchButtonField/index.js +2 -3
- 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/TextInputField/index.cjs +19 -73
- package/dist/components/TextInputField/index.d.ts +5 -11
- package/dist/components/TextInputField/index.js +19 -73
- package/dist/components/{TimeInputFieldV2 → TimeInputField}/index.cjs +6 -20
- package/dist/components/TimeInputField/index.d.ts +11 -0
- package/dist/components/{TimeInputFieldV2 → TimeInputField}/index.js +7 -21
- 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/dist/components/index.d.ts +2 -6
- package/dist/index.cjs +36 -44
- package/dist/index.js +3 -11
- package/package.json +11 -11
- package/dist/components/NumberInputFieldV2/index.cjs +0 -72
- package/dist/components/NumberInputFieldV2/index.d.ts +0 -9
- package/dist/components/NumberInputFieldV2/index.js +0 -72
- package/dist/components/SelectInputFieldV2/index.cjs +0 -50
- package/dist/components/SelectInputFieldV2/index.d.ts +0 -7
- package/dist/components/SelectInputFieldV2/index.js +0 -50
- package/dist/components/TextInputFieldV2/index.cjs +0 -90
- package/dist/components/TextInputFieldV2/index.d.ts +0 -12
- package/dist/components/TextInputFieldV2/index.js +0 -90
- package/dist/components/TimeField/index.cjs +0 -68
- package/dist/components/TimeField/index.d.ts +0 -7
- package/dist/components/TimeField/index.js +0 -68
- package/dist/components/TimeInputFieldV2/index.d.ts +0 -11
|
@@ -6,22 +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 ToggleField = ({
|
|
9
|
-
className,
|
|
10
|
-
disabled,
|
|
11
9
|
label,
|
|
12
10
|
name,
|
|
13
11
|
control,
|
|
14
12
|
onChange,
|
|
15
13
|
required,
|
|
16
|
-
size,
|
|
17
|
-
tooltip,
|
|
18
|
-
labelPosition,
|
|
19
14
|
parse,
|
|
20
15
|
format,
|
|
21
|
-
"data-testid": dataTestId,
|
|
22
16
|
shouldUnregister = false,
|
|
23
17
|
validate,
|
|
24
|
-
"aria-label": ariaLabel
|
|
18
|
+
"aria-label": ariaLabel,
|
|
19
|
+
...props
|
|
25
20
|
}) => {
|
|
26
21
|
const {
|
|
27
22
|
field,
|
|
@@ -46,14 +41,14 @@ const ToggleField = ({
|
|
|
46
41
|
}
|
|
47
42
|
return field.value;
|
|
48
43
|
};
|
|
49
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ui.Toggle, { name: field.name, ref: field.ref, checked: transformedValue(),
|
|
44
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.Toggle, { ...props, name: field.name, ref: field.ref, checked: transformedValue(), onChange: (event) => {
|
|
50
45
|
if (parse) {
|
|
51
46
|
field.onChange(parse(event.target.checked));
|
|
52
47
|
} else {
|
|
53
48
|
field.onChange(event);
|
|
54
49
|
}
|
|
55
50
|
onChange?.(event.target.checked);
|
|
56
|
-
}, label,
|
|
51
|
+
}, label, required, error: getError({
|
|
57
52
|
label: typeof label === "string" ? label : ariaLabel ?? name
|
|
58
53
|
}, error) });
|
|
59
54
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Toggle } from '@ultraviolet/ui';
|
|
2
2
|
import type { ComponentProps } from 'react';
|
|
3
|
-
import type { FieldPath, FieldValues } from 'react-hook-form';
|
|
3
|
+
import type { FieldPath, FieldValues, PathValue } from 'react-hook-form';
|
|
4
4
|
import type { BaseFieldProps } from '../../types';
|
|
5
|
-
type ToggleFieldProps<TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues>> = Omit<BaseFieldProps<TFieldValues, TFieldName>, 'label'> &
|
|
6
|
-
parse?: (value: boolean) =>
|
|
7
|
-
format?: (value:
|
|
5
|
+
type ToggleFieldProps<TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues>> = Omit<BaseFieldProps<TFieldValues, TFieldName>, 'label'> & Omit<ComponentProps<typeof Toggle>, 'value' | 'onChange'> & {
|
|
6
|
+
parse?: (value: boolean) => PathValue<TFieldValues, TFieldName>;
|
|
7
|
+
format?: (value: PathValue<TFieldValues, TFieldName>) => boolean;
|
|
8
8
|
};
|
|
9
|
-
export declare const ToggleField: <TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({
|
|
9
|
+
export declare const ToggleField: <TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ label, name, control, onChange, required, parse, format, shouldUnregister, validate, "aria-label": ariaLabel, ...props }: ToggleFieldProps<TFieldValues, TFieldName>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
10
10
|
export {};
|
|
@@ -4,22 +4,17 @@ import { Toggle } from "@ultraviolet/ui";
|
|
|
4
4
|
import { useController } from "react-hook-form";
|
|
5
5
|
import { useErrors } from "../../providers/ErrorContext/index.js";
|
|
6
6
|
const ToggleField = ({
|
|
7
|
-
className,
|
|
8
|
-
disabled,
|
|
9
7
|
label,
|
|
10
8
|
name,
|
|
11
9
|
control,
|
|
12
10
|
onChange,
|
|
13
11
|
required,
|
|
14
|
-
size,
|
|
15
|
-
tooltip,
|
|
16
|
-
labelPosition,
|
|
17
12
|
parse,
|
|
18
13
|
format,
|
|
19
|
-
"data-testid": dataTestId,
|
|
20
14
|
shouldUnregister = false,
|
|
21
15
|
validate,
|
|
22
|
-
"aria-label": ariaLabel
|
|
16
|
+
"aria-label": ariaLabel,
|
|
17
|
+
...props
|
|
23
18
|
}) => {
|
|
24
19
|
const {
|
|
25
20
|
field,
|
|
@@ -44,14 +39,14 @@ const ToggleField = ({
|
|
|
44
39
|
}
|
|
45
40
|
return field.value;
|
|
46
41
|
};
|
|
47
|
-
return /* @__PURE__ */ jsx(Toggle, { name: field.name, ref: field.ref, checked: transformedValue(),
|
|
42
|
+
return /* @__PURE__ */ jsx(Toggle, { ...props, name: field.name, ref: field.ref, checked: transformedValue(), onChange: (event) => {
|
|
48
43
|
if (parse) {
|
|
49
44
|
field.onChange(parse(event.target.checked));
|
|
50
45
|
} else {
|
|
51
46
|
field.onChange(event);
|
|
52
47
|
}
|
|
53
48
|
onChange?.(event.target.checked);
|
|
54
|
-
}, label,
|
|
49
|
+
}, label, required, error: getError({
|
|
55
50
|
label: typeof label === "string" ? label : ariaLabel ?? name
|
|
56
51
|
}, error) });
|
|
57
52
|
};
|
|
@@ -2,9 +2,9 @@ import { ToggleGroup } 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 ToggleGroupFieldProps<TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues>> = BaseFieldProps<TFieldValues, TFieldName> &
|
|
5
|
+
type ToggleGroupFieldProps<TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues>> = BaseFieldProps<TFieldValues, TFieldName> & Omit<ComponentProps<typeof ToggleGroup>, 'value' | 'onChange'>;
|
|
6
6
|
export declare const ToggleGroupField: {
|
|
7
|
-
<TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ legend, control,
|
|
7
|
+
<TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ legend, control, onChange, error: customError, name, required, shouldUnregister, validate, ...props }: ToggleGroupFieldProps<TFieldValues, TFieldName>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
8
8
|
Toggle: ({ disabled, name, value, label, helper, error, className, "data-testid": dataTestId, }: Omit<{
|
|
9
9
|
id?: string;
|
|
10
10
|
checked?: boolean;
|
|
@@ -6,28 +6,18 @@ 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 UnitInputField = ({
|
|
9
|
-
id,
|
|
10
9
|
name,
|
|
11
10
|
max = Number.MAX_SAFE_INTEGER,
|
|
12
11
|
min = 0,
|
|
13
|
-
size,
|
|
14
|
-
placeholder,
|
|
15
|
-
placeholderUnit,
|
|
16
12
|
onChange,
|
|
17
13
|
onChangeUnitValue,
|
|
18
|
-
|
|
19
|
-
options,
|
|
20
|
-
className,
|
|
21
|
-
label,
|
|
14
|
+
label = "",
|
|
22
15
|
required,
|
|
23
|
-
width,
|
|
24
|
-
selectInputWidth,
|
|
25
|
-
helper,
|
|
26
16
|
shouldUnregister = false,
|
|
27
17
|
validate,
|
|
28
18
|
control,
|
|
29
19
|
optionName,
|
|
30
|
-
|
|
20
|
+
...props
|
|
31
21
|
}) => {
|
|
32
22
|
const {
|
|
33
23
|
getError
|
|
@@ -55,14 +45,14 @@ const UnitInputField = ({
|
|
|
55
45
|
validate
|
|
56
46
|
}
|
|
57
47
|
});
|
|
58
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ui.UnitInput, {
|
|
48
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.UnitInput, { ...props, name, required, max, min, error: getError({
|
|
59
49
|
label
|
|
60
|
-
}, valueFieldState.error),
|
|
50
|
+
}, valueFieldState.error), onChange: (event) => {
|
|
61
51
|
valueField.onChange(event);
|
|
62
52
|
onChange?.(event);
|
|
63
53
|
}, onChangeUnitValue: (event) => {
|
|
64
54
|
unitField.onChange(event);
|
|
65
55
|
onChangeUnitValue?.(event);
|
|
66
|
-
}, value: valueField.value, unitValue: unitField.value,
|
|
56
|
+
}, value: valueField.value, unitValue: unitField.value, label });
|
|
67
57
|
};
|
|
68
58
|
exports.UnitInputField = UnitInputField;
|
|
@@ -2,10 +2,8 @@ import { UnitInput } 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 UnitInputFieldProps<TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues>> = BaseFieldProps<TFieldValues, TFieldName> &
|
|
6
|
-
onChangeUnitValue?: ComponentProps<typeof UnitInput>['onChangeUnitValue'];
|
|
7
|
-
label: string;
|
|
5
|
+
type UnitInputFieldProps<TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues>> = BaseFieldProps<TFieldValues, TFieldName> & Omit<ComponentProps<typeof UnitInput>, 'value' | 'onChange' | 'label'> & {
|
|
8
6
|
optionName?: string;
|
|
9
7
|
};
|
|
10
|
-
export declare const UnitInputField: <TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({
|
|
8
|
+
export declare const UnitInputField: <TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ name, max, min, onChange, onChangeUnitValue, label, required, shouldUnregister, validate, control, optionName, ...props }: UnitInputFieldProps<TFieldValues, TFieldName>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
11
9
|
export {};
|
|
@@ -4,28 +4,18 @@ import { UnitInput } from "@ultraviolet/ui";
|
|
|
4
4
|
import { useController } from "react-hook-form";
|
|
5
5
|
import { useErrors } from "../../providers/ErrorContext/index.js";
|
|
6
6
|
const UnitInputField = ({
|
|
7
|
-
id,
|
|
8
7
|
name,
|
|
9
8
|
max = Number.MAX_SAFE_INTEGER,
|
|
10
9
|
min = 0,
|
|
11
|
-
size,
|
|
12
|
-
placeholder,
|
|
13
|
-
placeholderUnit,
|
|
14
10
|
onChange,
|
|
15
11
|
onChangeUnitValue,
|
|
16
|
-
|
|
17
|
-
options,
|
|
18
|
-
className,
|
|
19
|
-
label,
|
|
12
|
+
label = "",
|
|
20
13
|
required,
|
|
21
|
-
width,
|
|
22
|
-
selectInputWidth,
|
|
23
|
-
helper,
|
|
24
14
|
shouldUnregister = false,
|
|
25
15
|
validate,
|
|
26
16
|
control,
|
|
27
17
|
optionName,
|
|
28
|
-
|
|
18
|
+
...props
|
|
29
19
|
}) => {
|
|
30
20
|
const {
|
|
31
21
|
getError
|
|
@@ -53,15 +43,15 @@ const UnitInputField = ({
|
|
|
53
43
|
validate
|
|
54
44
|
}
|
|
55
45
|
});
|
|
56
|
-
return /* @__PURE__ */ jsx(UnitInput, {
|
|
46
|
+
return /* @__PURE__ */ jsx(UnitInput, { ...props, name, required, max, min, error: getError({
|
|
57
47
|
label
|
|
58
|
-
}, valueFieldState.error),
|
|
48
|
+
}, valueFieldState.error), onChange: (event) => {
|
|
59
49
|
valueField.onChange(event);
|
|
60
50
|
onChange?.(event);
|
|
61
51
|
}, onChangeUnitValue: (event) => {
|
|
62
52
|
unitField.onChange(event);
|
|
63
53
|
onChangeUnitValue?.(event);
|
|
64
|
-
}, value: valueField.value, unitValue: unitField.value,
|
|
54
|
+
}, value: valueField.value, unitValue: unitField.value, label });
|
|
65
55
|
};
|
|
66
56
|
export {
|
|
67
57
|
UnitInputField
|
|
@@ -6,21 +6,14 @@ 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 VerificationCodeField = ({
|
|
9
|
-
className,
|
|
10
9
|
fields,
|
|
11
|
-
|
|
10
|
+
inputId = "verification-code-input",
|
|
12
11
|
label,
|
|
13
12
|
name,
|
|
14
13
|
onChange,
|
|
15
|
-
onComplete,
|
|
16
|
-
placeholder,
|
|
17
14
|
required,
|
|
18
|
-
type = "number",
|
|
19
|
-
disabled,
|
|
20
15
|
validate,
|
|
21
|
-
|
|
22
|
-
success,
|
|
23
|
-
helper
|
|
16
|
+
...props
|
|
24
17
|
}) => {
|
|
25
18
|
const {
|
|
26
19
|
getError
|
|
@@ -45,13 +38,11 @@ const VerificationCodeField = ({
|
|
|
45
38
|
}
|
|
46
39
|
}
|
|
47
40
|
});
|
|
48
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ui.VerificationCode, {
|
|
41
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.VerificationCode, { ...props, inputId, fields, onChange: (event) => {
|
|
49
42
|
onChange?.(event);
|
|
50
43
|
field.onChange(event);
|
|
51
|
-
},
|
|
52
|
-
onComplete?.(event);
|
|
53
|
-
}, type, disabled, required, error: getError({
|
|
44
|
+
}, required, error: getError({
|
|
54
45
|
label: label || "verification-code-field"
|
|
55
|
-
}, error), label
|
|
46
|
+
}, error), label });
|
|
56
47
|
};
|
|
57
48
|
exports.VerificationCodeField = VerificationCodeField;
|
|
@@ -2,11 +2,6 @@ import { VerificationCode } 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 VerificationCodeFieldProps<TFieldValues extends FieldValues,
|
|
6
|
-
|
|
7
|
-
id?: string;
|
|
8
|
-
name: string;
|
|
9
|
-
label?: string;
|
|
10
|
-
};
|
|
11
|
-
export declare const VerificationCodeField: <TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ className, fields, id, label, name, onChange, onComplete, placeholder, required, type, disabled, validate, labelDescription, success, helper, }: VerificationCodeFieldProps<TFieldValues, TName>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
5
|
+
type VerificationCodeFieldProps<TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues>> = BaseFieldProps<TFieldValues, TFieldName> & Omit<ComponentProps<typeof VerificationCode>, 'value'>;
|
|
6
|
+
export declare const VerificationCodeField: <TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ fields, inputId, label, name, onChange, required, validate, ...props }: VerificationCodeFieldProps<TFieldValues, TName>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
12
7
|
export {};
|
|
@@ -4,21 +4,14 @@ import { VerificationCode } from "@ultraviolet/ui";
|
|
|
4
4
|
import { useController } from "react-hook-form";
|
|
5
5
|
import { useErrors } from "../../providers/ErrorContext/index.js";
|
|
6
6
|
const VerificationCodeField = ({
|
|
7
|
-
className,
|
|
8
7
|
fields,
|
|
9
|
-
|
|
8
|
+
inputId = "verification-code-input",
|
|
10
9
|
label,
|
|
11
10
|
name,
|
|
12
11
|
onChange,
|
|
13
|
-
onComplete,
|
|
14
|
-
placeholder,
|
|
15
12
|
required,
|
|
16
|
-
type = "number",
|
|
17
|
-
disabled,
|
|
18
13
|
validate,
|
|
19
|
-
|
|
20
|
-
success,
|
|
21
|
-
helper
|
|
14
|
+
...props
|
|
22
15
|
}) => {
|
|
23
16
|
const {
|
|
24
17
|
getError
|
|
@@ -43,14 +36,12 @@ const VerificationCodeField = ({
|
|
|
43
36
|
}
|
|
44
37
|
}
|
|
45
38
|
});
|
|
46
|
-
return /* @__PURE__ */ jsx(VerificationCode, {
|
|
39
|
+
return /* @__PURE__ */ jsx(VerificationCode, { ...props, inputId, fields, onChange: (event) => {
|
|
47
40
|
onChange?.(event);
|
|
48
41
|
field.onChange(event);
|
|
49
|
-
},
|
|
50
|
-
onComplete?.(event);
|
|
51
|
-
}, type, disabled, required, error: getError({
|
|
42
|
+
}, required, error: getError({
|
|
52
43
|
label: label || "verification-code-field"
|
|
53
|
-
}, error), label
|
|
44
|
+
}, error), label });
|
|
54
45
|
};
|
|
55
46
|
export {
|
|
56
47
|
VerificationCodeField
|
|
@@ -3,23 +3,19 @@ export { CheckboxGroupField } from './CheckboxGroupField';
|
|
|
3
3
|
export { DateField } from './DateField';
|
|
4
4
|
export { Form } from './Form';
|
|
5
5
|
export { RadioField } from './RadioField';
|
|
6
|
-
export { SelectInputField } from './SelectInputField';
|
|
7
6
|
export { SelectableCardField } from './SelectableCardField';
|
|
8
7
|
export { NumberInputField } from './NumberInputField';
|
|
9
|
-
export { NumberInputFieldV2 } from './NumberInputFieldV2';
|
|
10
8
|
export { SubmitErrorAlert } from './SubmitErrorAlert';
|
|
11
9
|
export { TagInputField } from './TagInputField';
|
|
12
10
|
export { TextAreaField } from './TextAreaField';
|
|
13
11
|
export { TextInputField } from './TextInputField';
|
|
14
|
-
export {
|
|
15
|
-
export { TimeField } from './TimeField';
|
|
16
|
-
export { TimeInputFieldV2 } from './TimeInputFieldV2';
|
|
12
|
+
export { TimeInputField } from './TimeInputField';
|
|
17
13
|
export { ToggleField } from './ToggleField';
|
|
18
14
|
export { Submit } from './Submit';
|
|
19
15
|
export { RadioGroupField } from './RadioGroupField';
|
|
20
16
|
export { KeyValueField } from './KeyValueField';
|
|
21
17
|
export { SelectableCardGroupField } from './SelectableCardGroupField';
|
|
22
|
-
export {
|
|
18
|
+
export { SelectInputField } from './SelectInputField';
|
|
23
19
|
export { UnitInputField } from './UnitInputField';
|
|
24
20
|
export { SliderField } from './SliderField';
|
|
25
21
|
export { SwitchButtonField } from './SwitchButtonField';
|
package/dist/index.cjs
CHANGED
|
@@ -8,28 +8,24 @@ const index$2 = require("./components/CheckboxField/index.cjs");
|
|
|
8
8
|
const index$3 = require("./components/CheckboxGroupField/index.cjs");
|
|
9
9
|
const index$4 = require("./components/DateField/index.cjs");
|
|
10
10
|
const index$5 = require("./components/RadioField/index.cjs");
|
|
11
|
-
const index$6 = require("./components/
|
|
12
|
-
const index$7 = require("./components/
|
|
13
|
-
const index$8 = require("./components/
|
|
14
|
-
const index$9 = require("./components/
|
|
15
|
-
const index$a = require("./components/
|
|
16
|
-
const index$b = require("./components/
|
|
17
|
-
const index$c = require("./components/
|
|
18
|
-
const index$d = require("./components/
|
|
19
|
-
const index$e = require("./components/
|
|
20
|
-
const index$f = require("./components/
|
|
21
|
-
const index$g = require("./components/
|
|
22
|
-
const index$h = require("./components/
|
|
23
|
-
const index$i = require("./components/
|
|
24
|
-
const index$j = require("./components/
|
|
25
|
-
const index$k = require("./components/
|
|
26
|
-
const index$l = require("./components/
|
|
27
|
-
const index$m = require("./components/
|
|
28
|
-
const index$n = require("./components/
|
|
29
|
-
const index$o = require("./components/SliderField/index.cjs");
|
|
30
|
-
const index$p = require("./components/SwitchButtonField/index.cjs");
|
|
31
|
-
const index$q = require("./components/VerificationCodeField/index.cjs");
|
|
32
|
-
const index$r = require("./components/SelectableCardOptionGroupField/index.cjs");
|
|
11
|
+
const index$6 = require("./components/SelectableCardField/index.cjs");
|
|
12
|
+
const index$7 = require("./components/NumberInputField/index.cjs");
|
|
13
|
+
const index$8 = require("./components/SubmitErrorAlert/index.cjs");
|
|
14
|
+
const index$9 = require("./components/TagInputField/index.cjs");
|
|
15
|
+
const index$a = require("./components/TextAreaField/index.cjs");
|
|
16
|
+
const index$b = require("./components/TextInputField/index.cjs");
|
|
17
|
+
const index$c = require("./components/TimeInputField/index.cjs");
|
|
18
|
+
const index$d = require("./components/ToggleField/index.cjs");
|
|
19
|
+
const index$e = require("./components/Submit/index.cjs");
|
|
20
|
+
const index$f = require("./components/RadioGroupField/index.cjs");
|
|
21
|
+
const index$g = require("./components/KeyValueField/index.cjs");
|
|
22
|
+
const index$h = require("./components/SelectableCardGroupField/index.cjs");
|
|
23
|
+
const index$i = require("./components/SelectInputField/index.cjs");
|
|
24
|
+
const index$j = require("./components/UnitInputField/index.cjs");
|
|
25
|
+
const index$k = require("./components/SliderField/index.cjs");
|
|
26
|
+
const index$l = require("./components/SwitchButtonField/index.cjs");
|
|
27
|
+
const index$m = require("./components/VerificationCodeField/index.cjs");
|
|
28
|
+
const index$n = require("./components/SelectableCardOptionGroupField/index.cjs");
|
|
33
29
|
exports.ErrorProvider = index.ErrorProvider;
|
|
34
30
|
exports.useErrors = index.useErrors;
|
|
35
31
|
Object.defineProperty(exports, "useController", {
|
|
@@ -62,25 +58,21 @@ exports.CheckboxField = index$2.CheckboxField;
|
|
|
62
58
|
exports.CheckboxGroupField = index$3.CheckboxGroupField;
|
|
63
59
|
exports.DateField = index$4.DateField;
|
|
64
60
|
exports.RadioField = index$5.RadioField;
|
|
65
|
-
exports.
|
|
66
|
-
exports.
|
|
67
|
-
exports.
|
|
68
|
-
exports.
|
|
69
|
-
exports.
|
|
70
|
-
exports.
|
|
71
|
-
exports.
|
|
72
|
-
exports.
|
|
73
|
-
exports.
|
|
74
|
-
exports.
|
|
75
|
-
exports.
|
|
76
|
-
exports.
|
|
77
|
-
exports.
|
|
78
|
-
exports.
|
|
79
|
-
exports.
|
|
80
|
-
exports.
|
|
81
|
-
exports.
|
|
82
|
-
exports.
|
|
83
|
-
exports.SliderField = index$o.SliderField;
|
|
84
|
-
exports.SwitchButtonField = index$p.SwitchButtonField;
|
|
85
|
-
exports.VerificationCodeField = index$q.VerificationCodeField;
|
|
86
|
-
exports.SelectableCardOptionGroupField = index$r.SelectableCardOptionGroupField;
|
|
61
|
+
exports.SelectableCardField = index$6.SelectableCardField;
|
|
62
|
+
exports.NumberInputField = index$7.NumberInputField;
|
|
63
|
+
exports.SubmitErrorAlert = index$8.SubmitErrorAlert;
|
|
64
|
+
exports.TagInputField = index$9.TagInputField;
|
|
65
|
+
exports.TextAreaField = index$a.TextAreaField;
|
|
66
|
+
exports.TextInputField = index$b.TextInputField;
|
|
67
|
+
exports.TimeInputField = index$c.TimeInputField;
|
|
68
|
+
exports.ToggleField = index$d.ToggleField;
|
|
69
|
+
exports.Submit = index$e.Submit;
|
|
70
|
+
exports.RadioGroupField = index$f.RadioGroupField;
|
|
71
|
+
exports.KeyValueField = index$g.KeyValueField;
|
|
72
|
+
exports.SelectableCardGroupField = index$h.SelectableCardGroupField;
|
|
73
|
+
exports.SelectInputField = index$i.SelectInputField;
|
|
74
|
+
exports.UnitInputField = index$j.UnitInputField;
|
|
75
|
+
exports.SliderField = index$k.SliderField;
|
|
76
|
+
exports.SwitchButtonField = index$l.SwitchButtonField;
|
|
77
|
+
exports.VerificationCodeField = index$m.VerificationCodeField;
|
|
78
|
+
exports.SelectableCardOptionGroupField = index$n.SelectableCardOptionGroupField;
|
package/dist/index.js
CHANGED
|
@@ -6,23 +6,19 @@ import { CheckboxField } from "./components/CheckboxField/index.js";
|
|
|
6
6
|
import { CheckboxGroupField } from "./components/CheckboxGroupField/index.js";
|
|
7
7
|
import { DateField } from "./components/DateField/index.js";
|
|
8
8
|
import { RadioField } from "./components/RadioField/index.js";
|
|
9
|
-
import { SelectInputField } from "./components/SelectInputField/index.js";
|
|
10
9
|
import { SelectableCardField } from "./components/SelectableCardField/index.js";
|
|
11
10
|
import { NumberInputField } from "./components/NumberInputField/index.js";
|
|
12
|
-
import { NumberInputFieldV2 } from "./components/NumberInputFieldV2/index.js";
|
|
13
11
|
import { SubmitErrorAlert } from "./components/SubmitErrorAlert/index.js";
|
|
14
12
|
import { TagInputField } from "./components/TagInputField/index.js";
|
|
15
13
|
import { TextAreaField } from "./components/TextAreaField/index.js";
|
|
16
14
|
import { TextInputField } from "./components/TextInputField/index.js";
|
|
17
|
-
import {
|
|
18
|
-
import { TimeField } from "./components/TimeField/index.js";
|
|
19
|
-
import { TimeInputFieldV2 } from "./components/TimeInputFieldV2/index.js";
|
|
15
|
+
import { TimeInputField } from "./components/TimeInputField/index.js";
|
|
20
16
|
import { ToggleField } from "./components/ToggleField/index.js";
|
|
21
17
|
import { Submit } from "./components/Submit/index.js";
|
|
22
18
|
import { RadioGroupField } from "./components/RadioGroupField/index.js";
|
|
23
19
|
import { KeyValueField } from "./components/KeyValueField/index.js";
|
|
24
20
|
import { SelectableCardGroupField } from "./components/SelectableCardGroupField/index.js";
|
|
25
|
-
import {
|
|
21
|
+
import { SelectInputField } from "./components/SelectInputField/index.js";
|
|
26
22
|
import { UnitInputField } from "./components/UnitInputField/index.js";
|
|
27
23
|
import { SliderField } from "./components/SliderField/index.js";
|
|
28
24
|
import { SwitchButtonField } from "./components/SwitchButtonField/index.js";
|
|
@@ -36,11 +32,9 @@ export {
|
|
|
36
32
|
Form,
|
|
37
33
|
KeyValueField,
|
|
38
34
|
NumberInputField,
|
|
39
|
-
NumberInputFieldV2,
|
|
40
35
|
RadioField,
|
|
41
36
|
RadioGroupField,
|
|
42
37
|
SelectInputField,
|
|
43
|
-
SelectInputFieldV2,
|
|
44
38
|
SelectableCardField,
|
|
45
39
|
SelectableCardGroupField,
|
|
46
40
|
SelectableCardOptionGroupField,
|
|
@@ -51,9 +45,7 @@ export {
|
|
|
51
45
|
TagInputField,
|
|
52
46
|
TextAreaField,
|
|
53
47
|
TextInputField,
|
|
54
|
-
|
|
55
|
-
TimeField,
|
|
56
|
-
TimeInputFieldV2,
|
|
48
|
+
TimeInputField,
|
|
57
49
|
ToggleField,
|
|
58
50
|
UnitInputField,
|
|
59
51
|
VerificationCodeField,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultraviolet/form",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.11",
|
|
4
4
|
"description": "Ultraviolet Form",
|
|
5
5
|
"homepage": "https://github.com/scaleway/ultraviolet#readme",
|
|
6
6
|
"repository": {
|
|
@@ -55,26 +55,26 @@
|
|
|
55
55
|
"@emotion/styled": "11.14.0",
|
|
56
56
|
"react": "18.x || 19.x",
|
|
57
57
|
"react-dom": "18.x || 19.x",
|
|
58
|
-
"@ultraviolet/ui": "2.0.0-beta.
|
|
58
|
+
"@ultraviolet/ui": "2.0.0-beta.10"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@babel/core": "7.
|
|
61
|
+
"@babel/core": "7.27.4",
|
|
62
62
|
"@emotion/react": "11.14.0",
|
|
63
63
|
"@emotion/styled": "11.14.0",
|
|
64
64
|
"@types/final-form-focus": "1.1.7",
|
|
65
|
-
"@types/react": "19.
|
|
66
|
-
"@types/react-dom": "19.
|
|
67
|
-
"react": "19.
|
|
68
|
-
"react-dom": "19.
|
|
69
|
-
"@ultraviolet/ui": "2.0.0-beta.
|
|
65
|
+
"@types/react": "19.1.8",
|
|
66
|
+
"@types/react-dom": "19.1.6",
|
|
67
|
+
"react": "19.1.0",
|
|
68
|
+
"react-dom": "19.1.0",
|
|
69
|
+
"@ultraviolet/ui": "2.0.0-beta.10",
|
|
70
70
|
"@utils/test": "0.0.1"
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@babel/runtime": "7.27.
|
|
73
|
+
"@babel/runtime": "7.27.6",
|
|
74
74
|
"react-hook-form": "7.55.0",
|
|
75
75
|
"react-select": "5.10.0",
|
|
76
|
-
"@ultraviolet/icons": "4.0.0-beta.
|
|
77
|
-
"@ultraviolet/themes": "2.0.0-beta.
|
|
76
|
+
"@ultraviolet/icons": "4.0.0-beta.5",
|
|
77
|
+
"@ultraviolet/themes": "2.0.0-beta.2"
|
|
78
78
|
},
|
|
79
79
|
"scripts": {
|
|
80
80
|
"build:profile": "npx vite-bundle-visualizer -c vite.config.ts",
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
5
|
-
const ui = require("@ultraviolet/ui");
|
|
6
|
-
const reactHookForm = require("react-hook-form");
|
|
7
|
-
const isInteger = require("../../validators/isInteger.cjs");
|
|
8
|
-
const index = require("../../providers/ErrorContext/index.cjs");
|
|
9
|
-
const NumberInputFieldV2 = ({
|
|
10
|
-
disabled,
|
|
11
|
-
control,
|
|
12
|
-
max = Number.MAX_SAFE_INTEGER,
|
|
13
|
-
min = 0,
|
|
14
|
-
name,
|
|
15
|
-
onChange,
|
|
16
|
-
onBlur,
|
|
17
|
-
size,
|
|
18
|
-
step,
|
|
19
|
-
unit,
|
|
20
|
-
tooltip,
|
|
21
|
-
className,
|
|
22
|
-
label,
|
|
23
|
-
labelDescription,
|
|
24
|
-
id,
|
|
25
|
-
placeholder,
|
|
26
|
-
success,
|
|
27
|
-
helper,
|
|
28
|
-
controls = true,
|
|
29
|
-
"aria-label": ariaLabel,
|
|
30
|
-
"data-testid": dataTestId,
|
|
31
|
-
required,
|
|
32
|
-
autoFocus,
|
|
33
|
-
readOnly,
|
|
34
|
-
shouldUnregister = false,
|
|
35
|
-
validate
|
|
36
|
-
}) => {
|
|
37
|
-
const {
|
|
38
|
-
getError
|
|
39
|
-
} = index.useErrors();
|
|
40
|
-
const {
|
|
41
|
-
field,
|
|
42
|
-
fieldState: {
|
|
43
|
-
error
|
|
44
|
-
}
|
|
45
|
-
} = reactHookForm.useController({
|
|
46
|
-
name,
|
|
47
|
-
control,
|
|
48
|
-
shouldUnregister,
|
|
49
|
-
rules: {
|
|
50
|
-
max,
|
|
51
|
-
min,
|
|
52
|
-
required,
|
|
53
|
-
validate: {
|
|
54
|
-
...validate,
|
|
55
|
-
isInteger: isInteger.isInteger(step)
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ui.NumberInputV2, { name: field.name, value: field.value, disabled, onBlur: (event) => {
|
|
60
|
-
field.onBlur();
|
|
61
|
-
onBlur?.(event);
|
|
62
|
-
}, onChange: (newValue) => {
|
|
63
|
-
field.onChange(newValue);
|
|
64
|
-
onChange?.(newValue);
|
|
65
|
-
}, max, min, size, step, className, "data-testid": dataTestId, id, label, labelDescription, placeholder, error: getError({
|
|
66
|
-
label: label ?? ariaLabel ?? name,
|
|
67
|
-
max,
|
|
68
|
-
min,
|
|
69
|
-
isInteger: step
|
|
70
|
-
}, error), success, helper, tooltip, unit, "aria-label": ariaLabel, autoFocus, readOnly, required, controls });
|
|
71
|
-
};
|
|
72
|
-
exports.NumberInputFieldV2 = NumberInputFieldV2;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { NumberInputV2 } from '@ultraviolet/ui';
|
|
2
|
-
import type { ComponentProps } from 'react';
|
|
3
|
-
import type { FieldPath, FieldValues } from 'react-hook-form';
|
|
4
|
-
import type { BaseFieldProps } from '../../types';
|
|
5
|
-
type NumberInputV2Props<TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues>> = BaseFieldProps<TFieldValues, TFieldName> & Partial<Pick<ComponentProps<typeof NumberInputV2>, 'disabled' | 'id' | 'onBlur' | 'onChange' | 'onFocus' | 'value' | 'data-testid' | 'label' | 'aria-label' | 'tooltip' | 'unit' | 'size' | 'step' | 'className' | 'placeholder' | 'error' | 'success' | 'helper' | 'labelDescription' | 'autoFocus' | 'readOnly' | 'min' | 'max' | 'controls'>> & {
|
|
6
|
-
className?: string;
|
|
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;
|
|
9
|
-
export {};
|