@ultraviolet/form 4.0.0-beta.2 → 4.0.0-beta.20
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/README.md +191 -3
- package/dist/components/CheckboxGroupField/index.cjs +3 -3
- package/dist/components/CheckboxGroupField/index.d.ts +3 -5
- package/dist/components/CheckboxGroupField/index.js +3 -3
- package/dist/components/{DateField → DateInputField}/index.cjs +9 -19
- package/dist/components/DateInputField/index.d.ts +7 -0
- package/dist/components/{DateField → DateInputField}/index.js +9 -19
- 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/RadioField/index.d.ts +1 -4
- package/dist/components/RadioGroupField/index.cjs +3 -4
- package/dist/components/RadioGroupField/index.d.ts +19 -9
- 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/SliderField/index.d.ts +1 -1
- package/dist/components/SwitchButtonField/index.cjs +2 -3
- package/dist/components/SwitchButtonField/index.d.ts +11 -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 +3 -7
- package/dist/index.cjs +38 -46
- package/dist/index.js +5 -13
- package/package.json +12 -12
- package/dist/components/DateField/index.d.ts +0 -17
- 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
package/dist/index.cjs
CHANGED
|
@@ -6,30 +6,26 @@ const useOnFieldChange = require("./hooks/useOnFieldChange.cjs");
|
|
|
6
6
|
const index$1 = require("./components/Form/index.cjs");
|
|
7
7
|
const index$2 = require("./components/CheckboxField/index.cjs");
|
|
8
8
|
const index$3 = require("./components/CheckboxGroupField/index.cjs");
|
|
9
|
-
const index$4 = require("./components/
|
|
9
|
+
const index$4 = require("./components/DateInputField/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", {
|
|
@@ -60,27 +56,23 @@ exports.useOnFieldChange = useOnFieldChange.useOnFieldChange;
|
|
|
60
56
|
exports.Form = index$1.Form;
|
|
61
57
|
exports.CheckboxField = index$2.CheckboxField;
|
|
62
58
|
exports.CheckboxGroupField = index$3.CheckboxGroupField;
|
|
63
|
-
exports.
|
|
59
|
+
exports.DateInputField = index$4.DateInputField;
|
|
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
|
@@ -4,25 +4,21 @@ import { useOnFieldChange } from "./hooks/useOnFieldChange.js";
|
|
|
4
4
|
import { Form } from "./components/Form/index.js";
|
|
5
5
|
import { CheckboxField } from "./components/CheckboxField/index.js";
|
|
6
6
|
import { CheckboxGroupField } from "./components/CheckboxGroupField/index.js";
|
|
7
|
-
import {
|
|
7
|
+
import { DateInputField } from "./components/DateInputField/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";
|
|
@@ -31,16 +27,14 @@ import { SelectableCardOptionGroupField } from "./components/SelectableCardOptio
|
|
|
31
27
|
export {
|
|
32
28
|
CheckboxField,
|
|
33
29
|
CheckboxGroupField,
|
|
34
|
-
|
|
30
|
+
DateInputField,
|
|
35
31
|
ErrorProvider,
|
|
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.20",
|
|
4
4
|
"description": "Ultraviolet Form",
|
|
5
5
|
"homepage": "https://github.com/scaleway/ultraviolet#readme",
|
|
6
6
|
"repository": {
|
|
@@ -52,29 +52,29 @@
|
|
|
52
52
|
],
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"@emotion/react": "11.14.0",
|
|
55
|
-
"@emotion/styled": "11.14.
|
|
55
|
+
"@emotion/styled": "11.14.1",
|
|
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.19"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@babel/core": "7.27.
|
|
61
|
+
"@babel/core": "7.27.7",
|
|
62
62
|
"@emotion/react": "11.14.0",
|
|
63
|
-
"@emotion/styled": "11.14.
|
|
63
|
+
"@emotion/styled": "11.14.1",
|
|
64
64
|
"@types/final-form-focus": "1.1.7",
|
|
65
|
-
"@types/react": "19.1.
|
|
66
|
-
"@types/react-dom": "19.1.
|
|
65
|
+
"@types/react": "19.1.8",
|
|
66
|
+
"@types/react-dom": "19.1.6",
|
|
67
67
|
"react": "19.1.0",
|
|
68
68
|
"react-dom": "19.1.0",
|
|
69
|
-
"@ultraviolet/ui": "2.0.0-beta.
|
|
69
|
+
"@ultraviolet/ui": "2.0.0-beta.19",
|
|
70
70
|
"@utils/test": "0.0.1"
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@babel/runtime": "7.27.
|
|
74
|
-
"react-hook-form": "7.
|
|
73
|
+
"@babel/runtime": "7.27.6",
|
|
74
|
+
"react-hook-form": "7.56.3",
|
|
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.9",
|
|
77
|
+
"@ultraviolet/themes": "2.0.0-beta.3"
|
|
78
78
|
},
|
|
79
79
|
"scripts": {
|
|
80
80
|
"build:profile": "npx vite-bundle-visualizer -c vite.config.ts",
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { DateInput } from '@ultraviolet/ui';
|
|
2
|
-
import type { ComponentProps, FocusEvent } from 'react';
|
|
3
|
-
import type { FieldPath, FieldValues } from 'react-hook-form';
|
|
4
|
-
import type { BaseFieldProps } from '../../types';
|
|
5
|
-
type DateFieldProps<TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues>> = BaseFieldProps<TFieldValues, TFieldName> & Omit<ComponentProps<typeof DateInput>, 'maxDate' | 'minDate' | 'disabled' | 'required' | 'locale' | 'name' | 'onChange' | 'onFocus' | 'onBlur' | 'autoFocus' | 'stardDate' | 'endDate'> & {
|
|
6
|
-
maxDate?: Date;
|
|
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;
|
|
17
|
-
export {};
|
|
@@ -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 {};
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx } from "@emotion/react/jsx-runtime";
|
|
3
|
-
import { NumberInputV2 } from "@ultraviolet/ui";
|
|
4
|
-
import { useController } from "react-hook-form";
|
|
5
|
-
import { isInteger } from "../../validators/isInteger.js";
|
|
6
|
-
import { useErrors } from "../../providers/ErrorContext/index.js";
|
|
7
|
-
const NumberInputFieldV2 = ({
|
|
8
|
-
disabled,
|
|
9
|
-
control,
|
|
10
|
-
max = Number.MAX_SAFE_INTEGER,
|
|
11
|
-
min = 0,
|
|
12
|
-
name,
|
|
13
|
-
onChange,
|
|
14
|
-
onBlur,
|
|
15
|
-
size,
|
|
16
|
-
step,
|
|
17
|
-
unit,
|
|
18
|
-
tooltip,
|
|
19
|
-
className,
|
|
20
|
-
label,
|
|
21
|
-
labelDescription,
|
|
22
|
-
id,
|
|
23
|
-
placeholder,
|
|
24
|
-
success,
|
|
25
|
-
helper,
|
|
26
|
-
controls = true,
|
|
27
|
-
"aria-label": ariaLabel,
|
|
28
|
-
"data-testid": dataTestId,
|
|
29
|
-
required,
|
|
30
|
-
autoFocus,
|
|
31
|
-
readOnly,
|
|
32
|
-
shouldUnregister = false,
|
|
33
|
-
validate
|
|
34
|
-
}) => {
|
|
35
|
-
const {
|
|
36
|
-
getError
|
|
37
|
-
} = useErrors();
|
|
38
|
-
const {
|
|
39
|
-
field,
|
|
40
|
-
fieldState: {
|
|
41
|
-
error
|
|
42
|
-
}
|
|
43
|
-
} = useController({
|
|
44
|
-
name,
|
|
45
|
-
control,
|
|
46
|
-
shouldUnregister,
|
|
47
|
-
rules: {
|
|
48
|
-
max,
|
|
49
|
-
min,
|
|
50
|
-
required,
|
|
51
|
-
validate: {
|
|
52
|
-
...validate,
|
|
53
|
-
isInteger: isInteger(step)
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
return /* @__PURE__ */ jsx(NumberInputV2, { name: field.name, value: field.value, disabled, onBlur: (event) => {
|
|
58
|
-
field.onBlur();
|
|
59
|
-
onBlur?.(event);
|
|
60
|
-
}, onChange: (newValue) => {
|
|
61
|
-
field.onChange(newValue);
|
|
62
|
-
onChange?.(newValue);
|
|
63
|
-
}, max, min, size, step, className, "data-testid": dataTestId, id, label, labelDescription, placeholder, error: getError({
|
|
64
|
-
label: label ?? ariaLabel ?? name,
|
|
65
|
-
max,
|
|
66
|
-
min,
|
|
67
|
-
isInteger: step
|
|
68
|
-
}, error), success, helper, tooltip, unit, "aria-label": ariaLabel, autoFocus, readOnly, required, controls });
|
|
69
|
-
};
|
|
70
|
-
export {
|
|
71
|
-
NumberInputFieldV2
|
|
72
|
-
};
|
|
@@ -1,50 +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 react = require("react");
|
|
7
|
-
const reactHookForm = require("react-hook-form");
|
|
8
|
-
const index = require("../../providers/ErrorContext/index.cjs");
|
|
9
|
-
const SelectInputFieldV2 = ({
|
|
10
|
-
label = "",
|
|
11
|
-
onBlur,
|
|
12
|
-
required,
|
|
13
|
-
name,
|
|
14
|
-
"aria-label": ariaLabel,
|
|
15
|
-
shouldUnregister = false,
|
|
16
|
-
control,
|
|
17
|
-
validate,
|
|
18
|
-
onChange,
|
|
19
|
-
multiselect,
|
|
20
|
-
...props
|
|
21
|
-
}) => {
|
|
22
|
-
const {
|
|
23
|
-
field,
|
|
24
|
-
fieldState: {
|
|
25
|
-
error
|
|
26
|
-
}
|
|
27
|
-
} = reactHookForm.useController({
|
|
28
|
-
name,
|
|
29
|
-
control,
|
|
30
|
-
shouldUnregister,
|
|
31
|
-
rules: {
|
|
32
|
-
required,
|
|
33
|
-
validate
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
const {
|
|
37
|
-
getError
|
|
38
|
-
} = index.useErrors();
|
|
39
|
-
const handleChange = react.useCallback((value) => {
|
|
40
|
-
onChange?.(value);
|
|
41
|
-
field.onChange(value);
|
|
42
|
-
}, [onChange, field]);
|
|
43
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ui.SelectInputV2, { name: field.name, multiselect, required, onBlur: (event) => {
|
|
44
|
-
field.onBlur();
|
|
45
|
-
onBlur?.(event);
|
|
46
|
-
}, value: field.value, error: getError({
|
|
47
|
-
label: label ?? ariaLabel ?? name
|
|
48
|
-
}, error), label, "aria-label": ariaLabel, onChange: handleChange, ...props });
|
|
49
|
-
};
|
|
50
|
-
exports.SelectInputFieldV2 = SelectInputFieldV2;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { SelectInputV2 } 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 SelectInputFieldV2Props<TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues>> = BaseFieldProps<TFieldValues, TFieldName> & Omit<ComponentProps<typeof SelectInputV2>, 'value' | 'onChange'>;
|
|
6
|
-
export declare const SelectInputFieldV2: <TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ label, onBlur, required, name, "aria-label": ariaLabel, shouldUnregister, control, validate, onChange, multiselect, ...props }: SelectInputFieldV2Props<TFieldValues, TFieldName>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
7
|
-
export {};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx } from "@emotion/react/jsx-runtime";
|
|
3
|
-
import { SelectInputV2 } from "@ultraviolet/ui";
|
|
4
|
-
import { useCallback } from "react";
|
|
5
|
-
import { useController } from "react-hook-form";
|
|
6
|
-
import { useErrors } from "../../providers/ErrorContext/index.js";
|
|
7
|
-
const SelectInputFieldV2 = ({
|
|
8
|
-
label = "",
|
|
9
|
-
onBlur,
|
|
10
|
-
required,
|
|
11
|
-
name,
|
|
12
|
-
"aria-label": ariaLabel,
|
|
13
|
-
shouldUnregister = false,
|
|
14
|
-
control,
|
|
15
|
-
validate,
|
|
16
|
-
onChange,
|
|
17
|
-
multiselect,
|
|
18
|
-
...props
|
|
19
|
-
}) => {
|
|
20
|
-
const {
|
|
21
|
-
field,
|
|
22
|
-
fieldState: {
|
|
23
|
-
error
|
|
24
|
-
}
|
|
25
|
-
} = useController({
|
|
26
|
-
name,
|
|
27
|
-
control,
|
|
28
|
-
shouldUnregister,
|
|
29
|
-
rules: {
|
|
30
|
-
required,
|
|
31
|
-
validate
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
const {
|
|
35
|
-
getError
|
|
36
|
-
} = useErrors();
|
|
37
|
-
const handleChange = useCallback((value) => {
|
|
38
|
-
onChange?.(value);
|
|
39
|
-
field.onChange(value);
|
|
40
|
-
}, [onChange, field]);
|
|
41
|
-
return /* @__PURE__ */ jsx(SelectInputV2, { name: field.name, multiselect, required, onBlur: (event) => {
|
|
42
|
-
field.onBlur();
|
|
43
|
-
onBlur?.(event);
|
|
44
|
-
}, value: field.value, error: getError({
|
|
45
|
-
label: label ?? ariaLabel ?? name
|
|
46
|
-
}, error), label, "aria-label": ariaLabel, onChange: handleChange, ...props });
|
|
47
|
-
};
|
|
48
|
-
export {
|
|
49
|
-
SelectInputFieldV2
|
|
50
|
-
};
|
|
@@ -1,90 +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 validateRegex = require("../../utils/validateRegex.cjs");
|
|
8
|
-
const index = require("../../providers/ErrorContext/index.cjs");
|
|
9
|
-
const TextInputField = ({
|
|
10
|
-
regex: regexes,
|
|
11
|
-
id,
|
|
12
|
-
className,
|
|
13
|
-
tabIndex,
|
|
14
|
-
onChange,
|
|
15
|
-
placeholder,
|
|
16
|
-
disabled = false,
|
|
17
|
-
readOnly = false,
|
|
18
|
-
success,
|
|
19
|
-
helper,
|
|
20
|
-
tooltip,
|
|
21
|
-
label,
|
|
22
|
-
autoFocus,
|
|
23
|
-
required = false,
|
|
24
|
-
"data-testid": dataTestId,
|
|
25
|
-
name,
|
|
26
|
-
onFocus,
|
|
27
|
-
onBlur,
|
|
28
|
-
clearable = false,
|
|
29
|
-
labelDescription,
|
|
30
|
-
type = "text",
|
|
31
|
-
prefix,
|
|
32
|
-
suffix,
|
|
33
|
-
size = "large",
|
|
34
|
-
loading,
|
|
35
|
-
onRandomize,
|
|
36
|
-
minLength,
|
|
37
|
-
maxLength,
|
|
38
|
-
"aria-labelledby": ariaLabelledBy,
|
|
39
|
-
"aria-label": ariaLabel,
|
|
40
|
-
autoComplete,
|
|
41
|
-
shouldUnregister,
|
|
42
|
-
validate,
|
|
43
|
-
control,
|
|
44
|
-
role,
|
|
45
|
-
"aria-live": ariaLive,
|
|
46
|
-
"aria-atomic": ariaAtomic,
|
|
47
|
-
onKeyDown,
|
|
48
|
-
onKeyUp
|
|
49
|
-
}) => {
|
|
50
|
-
const {
|
|
51
|
-
getError
|
|
52
|
-
} = index.useErrors();
|
|
53
|
-
const {
|
|
54
|
-
field,
|
|
55
|
-
fieldState: {
|
|
56
|
-
error
|
|
57
|
-
}
|
|
58
|
-
} = reactHookForm.useController({
|
|
59
|
-
name,
|
|
60
|
-
shouldUnregister,
|
|
61
|
-
control,
|
|
62
|
-
rules: {
|
|
63
|
-
required,
|
|
64
|
-
validate: {
|
|
65
|
-
...regexes ? {
|
|
66
|
-
pattern: (value) => validateRegex.validateRegex(value, regexes)
|
|
67
|
-
} : {},
|
|
68
|
-
...validate
|
|
69
|
-
},
|
|
70
|
-
minLength,
|
|
71
|
-
maxLength
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ui.TextInputV2, { autoFocus, className, clearable, "data-testid": dataTestId, disabled, error: getError({
|
|
75
|
-
regex: regexes,
|
|
76
|
-
minLength,
|
|
77
|
-
maxLength,
|
|
78
|
-
label: label ?? ariaLabel ?? name,
|
|
79
|
-
value: field.value
|
|
80
|
-
}, error), helper, label, loading, labelDescription, minLength, maxLength, name, onBlur: (event) => {
|
|
81
|
-
onBlur?.(event);
|
|
82
|
-
field.onBlur();
|
|
83
|
-
}, onChange: (event) => {
|
|
84
|
-
field.onChange(event);
|
|
85
|
-
onChange?.(event.target.value);
|
|
86
|
-
}, onFocus: (event) => {
|
|
87
|
-
onFocus?.(event);
|
|
88
|
-
}, placeholder, readOnly, required, success, tabIndex, tooltip, type, value: field.value === void 0 ? "" : field.value, id, prefix, suffix, size, onRandomize, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, autoComplete, role, "aria-live": ariaLive, "aria-atomic": ariaAtomic, onKeyDown, onKeyUp });
|
|
89
|
-
};
|
|
90
|
-
exports.TextInputField = TextInputField;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { TextInputV2 } 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 TextInputFieldProps<TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues>> = BaseFieldProps<TFieldValues, TFieldName> & Omit<ComponentProps<typeof TextInputV2>, 'value' | 'error' | 'name' | 'onChange'> & {
|
|
6
|
-
regex?: (RegExp | RegExp[])[];
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* This component offers a form field based on Ultraviolet UI TextInputV2 component
|
|
10
|
-
*/
|
|
11
|
-
export declare const TextInputField: <TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ regex: regexes, id, className, tabIndex, onChange, placeholder, disabled, readOnly, success, helper, tooltip, label, autoFocus, required, "data-testid": dataTestId, name, onFocus, onBlur, clearable, labelDescription, type, prefix, suffix, size, loading, onRandomize, minLength, maxLength, "aria-labelledby": ariaLabelledBy, "aria-label": ariaLabel, autoComplete, shouldUnregister, validate, control, role, "aria-live": ariaLive, "aria-atomic": ariaAtomic, onKeyDown, onKeyUp, }: TextInputFieldProps<TFieldValues, TFieldName>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
12
|
-
export {};
|