@ultraviolet/form 3.11.1 → 3.12.0
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/SwitchButtonField/index.cjs +35 -0
- package/dist/components/SwitchButtonField/index.d.ts +9 -0
- package/dist/components/SwitchButtonField/index.js +35 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/index.cjs +4 -2
- package/dist/index.js +2 -0
- package/package.json +6 -6
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
4
|
+
const ui = require("@ultraviolet/ui");
|
|
5
|
+
const reactHookForm = require("react-hook-form");
|
|
6
|
+
const SwitchButtonField = ({
|
|
7
|
+
name,
|
|
8
|
+
leftButton,
|
|
9
|
+
rightButton,
|
|
10
|
+
size,
|
|
11
|
+
control,
|
|
12
|
+
shouldUnregister,
|
|
13
|
+
onBlur,
|
|
14
|
+
onChange,
|
|
15
|
+
onFocus,
|
|
16
|
+
tooltip,
|
|
17
|
+
className,
|
|
18
|
+
...props
|
|
19
|
+
}) => {
|
|
20
|
+
const {
|
|
21
|
+
field
|
|
22
|
+
} = reactHookForm.useController({
|
|
23
|
+
name,
|
|
24
|
+
shouldUnregister,
|
|
25
|
+
control
|
|
26
|
+
});
|
|
27
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.SwitchButton, { ...props, name, leftButton, rightButton, onChange: (event) => {
|
|
28
|
+
field.onChange(event);
|
|
29
|
+
onChange?.(event.target);
|
|
30
|
+
}, value: field.value, tooltip, size, className, onFocus, onBlur: (event) => {
|
|
31
|
+
field.onBlur();
|
|
32
|
+
onBlur?.(event);
|
|
33
|
+
} });
|
|
34
|
+
};
|
|
35
|
+
exports.SwitchButtonField = SwitchButtonField;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SwitchButton } 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 SwitchButtonFieldProps<TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues>> = BaseFieldProps<TFieldValues, TFieldName> & Omit<ComponentProps<typeof SwitchButton>, 'value' | 'name' | 'onChange'> & Partial<Pick<ComponentProps<typeof SwitchButton>, 'onChange'>> & {
|
|
6
|
+
name: FieldPath<TFieldValues>;
|
|
7
|
+
};
|
|
8
|
+
export declare const SwitchButtonField: <TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ name, leftButton, rightButton, size, control, shouldUnregister, onBlur, onChange, onFocus, tooltip, className, ...props }: SwitchButtonFieldProps<TFieldValues, TFieldName>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { SwitchButton } from "@ultraviolet/ui";
|
|
3
|
+
import { useController } from "react-hook-form";
|
|
4
|
+
const SwitchButtonField = ({
|
|
5
|
+
name,
|
|
6
|
+
leftButton,
|
|
7
|
+
rightButton,
|
|
8
|
+
size,
|
|
9
|
+
control,
|
|
10
|
+
shouldUnregister,
|
|
11
|
+
onBlur,
|
|
12
|
+
onChange,
|
|
13
|
+
onFocus,
|
|
14
|
+
tooltip,
|
|
15
|
+
className,
|
|
16
|
+
...props
|
|
17
|
+
}) => {
|
|
18
|
+
const {
|
|
19
|
+
field
|
|
20
|
+
} = useController({
|
|
21
|
+
name,
|
|
22
|
+
shouldUnregister,
|
|
23
|
+
control
|
|
24
|
+
});
|
|
25
|
+
return /* @__PURE__ */ jsx(SwitchButton, { ...props, name, leftButton, rightButton, onChange: (event) => {
|
|
26
|
+
field.onChange(event);
|
|
27
|
+
onChange?.(event.target);
|
|
28
|
+
}, value: field.value, tooltip, size, className, onFocus, onBlur: (event) => {
|
|
29
|
+
field.onBlur();
|
|
30
|
+
onBlur?.(event);
|
|
31
|
+
} });
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
SwitchButtonField
|
|
35
|
+
};
|
|
@@ -21,4 +21,5 @@ export { SelectableCardGroupField } from './SelectableCardGroupField';
|
|
|
21
21
|
export { SelectInputFieldV2 } from './SelectInputFieldV2';
|
|
22
22
|
export { UnitInputField } from './UnitInputField';
|
|
23
23
|
export { SliderField } from './SliderField';
|
|
24
|
+
export { SwitchButtonField } from './SwitchButtonField';
|
|
24
25
|
export { VerificationCodeField } from './VerificationCodeField';
|
package/dist/index.cjs
CHANGED
|
@@ -26,7 +26,8 @@ const index$k = require("./components/SelectableCardGroupField/index.cjs");
|
|
|
26
26
|
const index$l = require("./components/SelectInputFieldV2/index.cjs");
|
|
27
27
|
const index$m = require("./components/UnitInputField/index.cjs");
|
|
28
28
|
const index$n = require("./components/SliderField/index.cjs");
|
|
29
|
-
const index$o = require("./components/
|
|
29
|
+
const index$o = require("./components/SwitchButtonField/index.cjs");
|
|
30
|
+
const index$p = require("./components/VerificationCodeField/index.cjs");
|
|
30
31
|
exports.ErrorProvider = index.ErrorProvider;
|
|
31
32
|
exports.useErrors = index.useErrors;
|
|
32
33
|
Object.defineProperty(exports, "useController", {
|
|
@@ -77,4 +78,5 @@ exports.SelectableCardGroupField = index$k.SelectableCardGroupField;
|
|
|
77
78
|
exports.SelectInputFieldV2 = index$l.SelectInputFieldV2;
|
|
78
79
|
exports.UnitInputField = index$m.UnitInputField;
|
|
79
80
|
exports.SliderField = index$n.SliderField;
|
|
80
|
-
exports.
|
|
81
|
+
exports.SwitchButtonField = index$o.SwitchButtonField;
|
|
82
|
+
exports.VerificationCodeField = index$p.VerificationCodeField;
|
package/dist/index.js
CHANGED
|
@@ -24,6 +24,7 @@ import { SelectableCardGroupField } from "./components/SelectableCardGroupField/
|
|
|
24
24
|
import { SelectInputFieldV2 } from "./components/SelectInputFieldV2/index.js";
|
|
25
25
|
import { UnitInputField } from "./components/UnitInputField/index.js";
|
|
26
26
|
import { SliderField } from "./components/SliderField/index.js";
|
|
27
|
+
import { SwitchButtonField } from "./components/SwitchButtonField/index.js";
|
|
27
28
|
import { VerificationCodeField } from "./components/VerificationCodeField/index.js";
|
|
28
29
|
export {
|
|
29
30
|
CheckboxField,
|
|
@@ -43,6 +44,7 @@ export {
|
|
|
43
44
|
SliderField,
|
|
44
45
|
Submit,
|
|
45
46
|
SubmitErrorAlert,
|
|
47
|
+
SwitchButtonField,
|
|
46
48
|
TagInputField,
|
|
47
49
|
TextAreaField,
|
|
48
50
|
TextInputField,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultraviolet/form",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.12.0",
|
|
4
4
|
"description": "Ultraviolet Form",
|
|
5
5
|
"homepage": "https://github.com/scaleway/ultraviolet#readme",
|
|
6
6
|
"repository": {
|
|
@@ -51,15 +51,15 @@
|
|
|
51
51
|
}
|
|
52
52
|
],
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"@emotion/react": "11.13.
|
|
55
|
-
"@emotion/styled": "11.13.
|
|
54
|
+
"@emotion/react": "11.13.5",
|
|
55
|
+
"@emotion/styled": "11.13.5",
|
|
56
56
|
"react": "18.x",
|
|
57
57
|
"react-dom": "18.x"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@babel/core": "7.26.0",
|
|
61
|
-
"@emotion/react": "11.13.
|
|
62
|
-
"@emotion/styled": "11.13.
|
|
61
|
+
"@emotion/react": "11.13.5",
|
|
62
|
+
"@emotion/styled": "11.13.5",
|
|
63
63
|
"@types/final-form-focus": "1.1.7",
|
|
64
64
|
"@types/react": "18.3.12",
|
|
65
65
|
"@types/react-dom": "18.3.1",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"react-hook-form": "7.53.2",
|
|
73
73
|
"react-select": "5.8.3",
|
|
74
74
|
"@ultraviolet/themes": "1.15.0",
|
|
75
|
-
"@ultraviolet/ui": "1.77.
|
|
75
|
+
"@ultraviolet/ui": "1.77.3"
|
|
76
76
|
},
|
|
77
77
|
"scripts": {
|
|
78
78
|
"build:profile": "npx vite-bundle-visualizer -c vite.config.ts",
|