@ultraviolet/form 3.13.6 → 3.13.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.
@@ -0,0 +1,59 @@
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 index = require("../../providers/ErrorContext/index.cjs");
7
+ const TimeInputFieldV2 = ({
8
+ id,
9
+ className,
10
+ onChange,
11
+ placeholder,
12
+ disabled = false,
13
+ readOnly = false,
14
+ helper,
15
+ label,
16
+ autoFocus,
17
+ required = false,
18
+ "data-testid": dataTestId,
19
+ name,
20
+ onFocus,
21
+ onBlur,
22
+ clearable = false,
23
+ labelDescription,
24
+ size = "medium",
25
+ "aria-label": ariaLabel,
26
+ shouldUnregister,
27
+ control,
28
+ timeFormat
29
+ }) => {
30
+ const {
31
+ getError
32
+ } = index.useErrors();
33
+ const {
34
+ field,
35
+ fieldState: {
36
+ error
37
+ }
38
+ } = reactHookForm.useController({
39
+ name,
40
+ shouldUnregister,
41
+ control,
42
+ rules: {
43
+ required
44
+ }
45
+ });
46
+ return /* @__PURE__ */ jsxRuntime.jsx(ui.TimeInputV2, { autoFocus, className, clearable, "data-testid": dataTestId, timeFormat, disabled, error: getError({
47
+ label: label ?? ariaLabel ?? name,
48
+ value: field.value
49
+ }, error), helper, label, labelDescription, onBlur: (event) => {
50
+ onBlur?.(event);
51
+ field.onBlur();
52
+ }, onChange: (value) => {
53
+ field.onChange(value);
54
+ onChange?.(value);
55
+ }, onFocus: (event) => {
56
+ onFocus?.(event);
57
+ }, placeholder, readOnly, required, value: field.value, id, size });
58
+ };
59
+ exports.TimeInputFieldV2 = TimeInputFieldV2;
@@ -0,0 +1,11 @@
1
+ import { TimeInputV2 } 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 TimeInputFieldProps<TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues>> = BaseFieldProps<TFieldValues, TFieldName> & Omit<ComponentProps<typeof TimeInputV2>, 'value' | 'error' | 'name' | 'onChange'>;
6
+ /**
7
+ * This component offers a form field based on Ultraviolet UI TimeInputV2 component
8
+ * @experimental This component is experimental and may be subject to breaking changes in the future.
9
+ */
10
+ export declare const TimeInputFieldV2: <TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ id, className, onChange, placeholder, disabled, readOnly, helper, label, autoFocus, required, "data-testid": dataTestId, name, onFocus, onBlur, clearable, labelDescription, size, "aria-label": ariaLabel, shouldUnregister, control, timeFormat, }: TimeInputFieldProps<TFieldValues, TFieldName>) => import("@emotion/react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -0,0 +1,59 @@
1
+ import { jsx } from "@emotion/react/jsx-runtime";
2
+ import { TimeInputV2 } from "@ultraviolet/ui";
3
+ import { useController } from "react-hook-form";
4
+ import { useErrors } from "../../providers/ErrorContext/index.js";
5
+ const TimeInputFieldV2 = ({
6
+ id,
7
+ className,
8
+ onChange,
9
+ placeholder,
10
+ disabled = false,
11
+ readOnly = false,
12
+ helper,
13
+ label,
14
+ autoFocus,
15
+ required = false,
16
+ "data-testid": dataTestId,
17
+ name,
18
+ onFocus,
19
+ onBlur,
20
+ clearable = false,
21
+ labelDescription,
22
+ size = "medium",
23
+ "aria-label": ariaLabel,
24
+ shouldUnregister,
25
+ control,
26
+ timeFormat
27
+ }) => {
28
+ const {
29
+ getError
30
+ } = useErrors();
31
+ const {
32
+ field,
33
+ fieldState: {
34
+ error
35
+ }
36
+ } = useController({
37
+ name,
38
+ shouldUnregister,
39
+ control,
40
+ rules: {
41
+ required
42
+ }
43
+ });
44
+ return /* @__PURE__ */ jsx(TimeInputV2, { autoFocus, className, clearable, "data-testid": dataTestId, timeFormat, disabled, error: getError({
45
+ label: label ?? ariaLabel ?? name,
46
+ value: field.value
47
+ }, error), helper, label, labelDescription, onBlur: (event) => {
48
+ onBlur?.(event);
49
+ field.onBlur();
50
+ }, onChange: (value) => {
51
+ field.onChange(value);
52
+ onChange?.(value);
53
+ }, onFocus: (event) => {
54
+ onFocus?.(event);
55
+ }, placeholder, readOnly, required, value: field.value, id, size });
56
+ };
57
+ export {
58
+ TimeInputFieldV2
59
+ };
@@ -16,7 +16,10 @@ const VerificationCodeField = ({
16
16
  required,
17
17
  type = "number",
18
18
  disabled,
19
- validate
19
+ validate,
20
+ labelDescription,
21
+ success,
22
+ helper
20
23
  }) => {
21
24
  const {
22
25
  getError
@@ -41,20 +44,13 @@ const VerificationCodeField = ({
41
44
  }
42
45
  }
43
46
  });
44
- return /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { className, gap: 1, justifyContent: "center", alignItems: "center", direction: "column", "aria-label": "verification-code-field", children: [
45
- label ? /* @__PURE__ */ jsxRuntime.jsx("label", { id: `${id}-label`, htmlFor: `${id}-0`, style: {
46
- cursor: "pointer",
47
- flexShrink: 0
48
- }, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { as: "p", variant: "body", prominence: "strong", children: label }) }) : null,
49
- /* @__PURE__ */ jsxRuntime.jsx(ui.VerificationCode, { inputId: id, error: !!error, placeholder, fields, onChange: (event) => {
50
- onChange?.(event);
51
- field.onChange(event);
52
- }, onComplete: (event) => {
53
- onComplete?.(event);
54
- }, type, disabled, required }),
55
- error ? /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { as: "small", variant: "caption", sentiment: "danger", children: getError({
56
- label: label || "verification-code-field"
57
- }, error) }) : null
58
- ] });
47
+ return /* @__PURE__ */ jsxRuntime.jsx(ui.VerificationCode, { className, inputId: id, placeholder, fields, onChange: (event) => {
48
+ onChange?.(event);
49
+ field.onChange(event);
50
+ }, onComplete: (event) => {
51
+ onComplete?.(event);
52
+ }, type, disabled, required, error: getError({
53
+ label: label || "verification-code-field"
54
+ }, error), label, labelDescription, success, helper });
59
55
  };
60
56
  exports.VerificationCodeField = VerificationCodeField;
@@ -2,11 +2,11 @@ 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, TName extends FieldPath<TFieldValues>> = BaseFieldProps<TFieldValues, TName> & Partial<Pick<ComponentProps<typeof VerificationCode>, 'disabled' | 'error' | 'fields' | 'initialValue' | 'onChange' | 'onComplete' | 'placeholder' | 'required' | 'type'>> & {
5
+ type VerificationCodeFieldProps<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>> = BaseFieldProps<TFieldValues, TName> & Partial<Pick<ComponentProps<typeof VerificationCode>, 'disabled' | 'error' | 'fields' | 'initialValue' | 'onChange' | 'onComplete' | 'placeholder' | 'required' | 'type' | 'labelDescription' | 'success' | 'helper'>> & {
6
6
  className?: string;
7
7
  id?: string;
8
8
  name: string;
9
9
  label?: string;
10
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, }: VerificationCodeFieldProps<TFieldValues, TName>) => import("@emotion/react/jsx-runtime").JSX.Element;
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;
12
12
  export {};
@@ -1,5 +1,5 @@
1
- import { jsxs, jsx } from "@emotion/react/jsx-runtime";
2
- import { Stack, Text, VerificationCode } from "@ultraviolet/ui";
1
+ import { jsx } from "@emotion/react/jsx-runtime";
2
+ import { VerificationCode } from "@ultraviolet/ui";
3
3
  import { useController } from "react-hook-form";
4
4
  import { useErrors } from "../../providers/ErrorContext/index.js";
5
5
  const VerificationCodeField = ({
@@ -14,7 +14,10 @@ const VerificationCodeField = ({
14
14
  required,
15
15
  type = "number",
16
16
  disabled,
17
- validate
17
+ validate,
18
+ labelDescription,
19
+ success,
20
+ helper
18
21
  }) => {
19
22
  const {
20
23
  getError
@@ -39,21 +42,14 @@ const VerificationCodeField = ({
39
42
  }
40
43
  }
41
44
  });
42
- return /* @__PURE__ */ jsxs(Stack, { className, gap: 1, justifyContent: "center", alignItems: "center", direction: "column", "aria-label": "verification-code-field", children: [
43
- label ? /* @__PURE__ */ jsx("label", { id: `${id}-label`, htmlFor: `${id}-0`, style: {
44
- cursor: "pointer",
45
- flexShrink: 0
46
- }, children: /* @__PURE__ */ jsx(Text, { as: "p", variant: "body", prominence: "strong", children: label }) }) : null,
47
- /* @__PURE__ */ jsx(VerificationCode, { inputId: id, error: !!error, placeholder, fields, onChange: (event) => {
48
- onChange?.(event);
49
- field.onChange(event);
50
- }, onComplete: (event) => {
51
- onComplete?.(event);
52
- }, type, disabled, required }),
53
- error ? /* @__PURE__ */ jsx(Text, { as: "small", variant: "caption", sentiment: "danger", children: getError({
54
- label: label || "verification-code-field"
55
- }, error) }) : null
56
- ] });
45
+ return /* @__PURE__ */ jsx(VerificationCode, { className, inputId: id, placeholder, fields, onChange: (event) => {
46
+ onChange?.(event);
47
+ field.onChange(event);
48
+ }, onComplete: (event) => {
49
+ onComplete?.(event);
50
+ }, type, disabled, required, error: getError({
51
+ label: label || "verification-code-field"
52
+ }, error), label, labelDescription, success, helper });
57
53
  };
58
54
  export {
59
55
  VerificationCodeField
@@ -13,6 +13,7 @@ export { TextAreaField } from './TextAreaField';
13
13
  export { TextInputField } from './TextInputField';
14
14
  export { TextInputField as TextInputFieldV2 } from './TextInputFieldV2';
15
15
  export { TimeField } from './TimeField';
16
+ export { TimeInputFieldV2 } from './TimeInputFieldV2';
16
17
  export { ToggleField } from './ToggleField';
17
18
  export { Submit } from './Submit';
18
19
  export { RadioGroupField } from './RadioGroupField';
package/dist/index.cjs CHANGED
@@ -18,16 +18,17 @@ const index$c = require("./components/TextAreaField/index.cjs");
18
18
  const index$d = require("./components/TextInputField/index.cjs");
19
19
  const index$e = require("./components/TextInputFieldV2/index.cjs");
20
20
  const index$f = require("./components/TimeField/index.cjs");
21
- const index$g = require("./components/ToggleField/index.cjs");
22
- const index$h = require("./components/Submit/index.cjs");
23
- const index$i = require("./components/RadioGroupField/index.cjs");
24
- const index$j = require("./components/KeyValueField/index.cjs");
25
- const index$k = require("./components/SelectableCardGroupField/index.cjs");
26
- const index$l = require("./components/SelectInputFieldV2/index.cjs");
27
- const index$m = require("./components/UnitInputField/index.cjs");
28
- const index$n = require("./components/SliderField/index.cjs");
29
- const index$o = require("./components/SwitchButtonField/index.cjs");
30
- const index$p = require("./components/VerificationCodeField/index.cjs");
21
+ const index$g = require("./components/TimeInputFieldV2/index.cjs");
22
+ const index$h = require("./components/ToggleField/index.cjs");
23
+ const index$i = require("./components/Submit/index.cjs");
24
+ const index$j = require("./components/RadioGroupField/index.cjs");
25
+ const index$k = require("./components/KeyValueField/index.cjs");
26
+ const index$l = require("./components/SelectableCardGroupField/index.cjs");
27
+ const index$m = require("./components/SelectInputFieldV2/index.cjs");
28
+ const index$n = require("./components/UnitInputField/index.cjs");
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");
31
32
  exports.ErrorProvider = index.ErrorProvider;
32
33
  exports.useErrors = index.useErrors;
33
34
  Object.defineProperty(exports, "useController", {
@@ -70,13 +71,14 @@ exports.TextAreaField = index$c.TextAreaField;
70
71
  exports.TextInputField = index$d.TextInputField;
71
72
  exports.TextInputFieldV2 = index$e.TextInputField;
72
73
  exports.TimeField = index$f.TimeField;
73
- exports.ToggleField = index$g.ToggleField;
74
- exports.Submit = index$h.Submit;
75
- exports.RadioGroupField = index$i.RadioGroupField;
76
- exports.KeyValueField = index$j.KeyValueField;
77
- exports.SelectableCardGroupField = index$k.SelectableCardGroupField;
78
- exports.SelectInputFieldV2 = index$l.SelectInputFieldV2;
79
- exports.UnitInputField = index$m.UnitInputField;
80
- exports.SliderField = index$n.SliderField;
81
- exports.SwitchButtonField = index$o.SwitchButtonField;
82
- exports.VerificationCodeField = index$p.VerificationCodeField;
74
+ exports.TimeInputFieldV2 = index$g.TimeInputFieldV2;
75
+ exports.ToggleField = index$h.ToggleField;
76
+ exports.Submit = index$i.Submit;
77
+ exports.RadioGroupField = index$j.RadioGroupField;
78
+ exports.KeyValueField = index$k.KeyValueField;
79
+ exports.SelectableCardGroupField = index$l.SelectableCardGroupField;
80
+ exports.SelectInputFieldV2 = index$m.SelectInputFieldV2;
81
+ exports.UnitInputField = index$n.UnitInputField;
82
+ exports.SliderField = index$o.SliderField;
83
+ exports.SwitchButtonField = index$p.SwitchButtonField;
84
+ exports.VerificationCodeField = index$q.VerificationCodeField;
package/dist/index.js CHANGED
@@ -16,6 +16,7 @@ import { TextAreaField } from "./components/TextAreaField/index.js";
16
16
  import { TextInputField } from "./components/TextInputField/index.js";
17
17
  import { TextInputField as TextInputField2 } from "./components/TextInputFieldV2/index.js";
18
18
  import { TimeField } from "./components/TimeField/index.js";
19
+ import { TimeInputFieldV2 } from "./components/TimeInputFieldV2/index.js";
19
20
  import { ToggleField } from "./components/ToggleField/index.js";
20
21
  import { Submit } from "./components/Submit/index.js";
21
22
  import { RadioGroupField } from "./components/RadioGroupField/index.js";
@@ -50,6 +51,7 @@ export {
50
51
  TextInputField,
51
52
  TextInputField2 as TextInputFieldV2,
52
53
  TimeField,
54
+ TimeInputFieldV2,
53
55
  ToggleField,
54
56
  UnitInputField,
55
57
  VerificationCodeField,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultraviolet/form",
3
- "version": "3.13.6",
3
+ "version": "3.13.8",
4
4
  "description": "Ultraviolet Form",
5
5
  "homepage": "https://github.com/scaleway/ultraviolet#readme",
6
6
  "repository": {
@@ -61,7 +61,7 @@
61
61
  "@emotion/react": "11.14.0",
62
62
  "@emotion/styled": "11.14.0",
63
63
  "@types/final-form-focus": "1.1.7",
64
- "@types/react": "19.0.5",
64
+ "@types/react": "19.0.7",
65
65
  "@types/react-dom": "19.0.3",
66
66
  "react": "19.0.0",
67
67
  "react-dom": "19.0.0",
@@ -71,8 +71,8 @@
71
71
  "@babel/runtime": "7.26.0",
72
72
  "react-hook-form": "7.54.2",
73
73
  "react-select": "5.8.3",
74
- "@ultraviolet/themes": "1.15.0",
75
- "@ultraviolet/ui": "1.83.2"
74
+ "@ultraviolet/ui": "1.84.1",
75
+ "@ultraviolet/themes": "1.15.0"
76
76
  },
77
77
  "scripts": {
78
78
  "build:profile": "npx vite-bundle-visualizer -c vite.config.ts",