@ultraviolet/form 2.14.4 → 2.14.6

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 CHANGED
@@ -5,7 +5,7 @@
5
5
  Ultraviolet Form is an extension of Ultraviolet UI including everything to build forms using React.
6
6
  It is using [React Hook Form](https://react-hook-form.com/) under the hood.
7
7
 
8
- ## Installation
8
+ ## Get Started
9
9
 
10
10
  ```sh
11
11
  $ pnpm add @ultraviolet/form @emotion/react @emotion/styled
@@ -6,17 +6,17 @@ type CheckboxGroupFieldProps<TFieldValues extends FieldValues, TName extends Fie
6
6
  export declare const CheckboxGroupField: {
7
7
  <TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ legend, className, helper, direction, children, onChange, label, error: customError, name, required, shouldUnregister, rules, }: CheckboxGroupFieldProps<TFieldValues, TName>): import("@emotion/react/jsx-runtime").JSX.Element;
8
8
  Checkbox: ({ onFocus, onBlur, disabled, error, name, value, children, helper, className, autoFocus, "data-testid": dataTestId, required, }: Omit<({
9
- error?: import("react").ReactNode;
10
- size?: number | undefined;
11
- progress?: boolean | undefined;
9
+ error?: string | import("react").ReactNode;
10
+ size?: number;
11
+ progress?: boolean;
12
12
  helper?: import("react").ReactNode;
13
- disabled?: boolean | undefined;
14
- checked?: boolean | "indeterminate" | undefined;
15
- className?: string | undefined;
16
- "data-visibility"?: string | undefined;
17
- required?: boolean | undefined;
18
- 'data-testid'?: string | undefined;
19
- tooltip?: string | undefined;
13
+ disabled?: boolean;
14
+ checked?: boolean | "indeterminate";
15
+ className?: string;
16
+ "data-visibility"?: string;
17
+ required?: boolean;
18
+ 'data-testid'?: string;
19
+ tooltip?: string;
20
20
  } & Pick<import("react").InputHTMLAttributes<HTMLInputElement>, "value" | "onChange" | "onBlur" | "name" | "onFocus" | "autoFocus" | "id" | "tabIndex"> & (({
21
21
  "aria-label"?: undefined;
22
22
  } & {
@@ -23,6 +23,7 @@ const NumberInputFieldV2 = ({
23
23
  success,
24
24
  helper,
25
25
  rules,
26
+ controls = true,
26
27
  "aria-label": ariaLabel,
27
28
  "data-testid": dataTestId,
28
29
  required,
@@ -58,6 +59,6 @@ const NumberInputFieldV2 = ({
58
59
  label: label ?? "",
59
60
  max,
60
61
  min
61
- }, error), success, helper, tooltip, unit, "aria-label": ariaLabel, autoFocus, readOnly, required });
62
+ }, error), success, helper, tooltip, unit, "aria-label": ariaLabel, autoFocus, readOnly, required, controls });
62
63
  };
63
64
  exports.NumberInputFieldV2 = NumberInputFieldV2;
@@ -2,10 +2,10 @@ 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, TName extends FieldPath<TFieldValues>> = BaseFieldProps<TFieldValues, TName> & Partial<Pick<ComponentProps<typeof NumberInputV2>, 'disabled' | 'id' | 'onBlur' | 'onChange' | 'onFocus' | 'value' | 'data-testid' | 'label' | 'tooltip' | 'unit' | 'size' | 'step' | 'className' | 'placeholder' | 'error' | 'success' | 'helper' | 'labelDescription' | 'aria-label' | 'autoFocus' | 'readOnly' | 'min' | 'max'>> & {
5
+ type NumberInputV2Props<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>> = BaseFieldProps<TFieldValues, TName> & Partial<Pick<ComponentProps<typeof NumberInputV2>, 'disabled' | 'id' | 'onBlur' | 'onChange' | 'onFocus' | 'value' | 'data-testid' | 'label' | 'tooltip' | 'unit' | 'size' | 'step' | 'className' | 'placeholder' | 'error' | 'success' | 'helper' | 'labelDescription' | 'aria-label' | 'autoFocus' | 'readOnly' | 'min' | 'max' | 'controls'>> & {
6
6
  className?: string;
7
7
  name: string;
8
8
  required?: boolean;
9
9
  };
10
- export declare const NumberInputFieldV2: <TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ disabled, max, min, name, onChange, onBlur, size, step, unit, tooltip, className, label, labelDescription, id, placeholder, success, helper, rules, "aria-label": ariaLabel, "data-testid": dataTestId, required, autoFocus, readOnly, shouldUnregister, }: NumberInputV2Props<TFieldValues, TName>) => import("@emotion/react/jsx-runtime").JSX.Element;
10
+ export declare const NumberInputFieldV2: <TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ disabled, max, min, name, onChange, onBlur, size, step, unit, tooltip, className, label, labelDescription, id, placeholder, success, helper, rules, controls, "aria-label": ariaLabel, "data-testid": dataTestId, required, autoFocus, readOnly, shouldUnregister, }: NumberInputV2Props<TFieldValues, TName>) => import("@emotion/react/jsx-runtime").JSX.Element;
11
11
  export {};
@@ -21,6 +21,7 @@ const NumberInputFieldV2 = ({
21
21
  success,
22
22
  helper,
23
23
  rules,
24
+ controls = true,
24
25
  "aria-label": ariaLabel,
25
26
  "data-testid": dataTestId,
26
27
  required,
@@ -56,7 +57,7 @@ const NumberInputFieldV2 = ({
56
57
  label: label ?? "",
57
58
  max,
58
59
  min
59
- }, error), success, helper, tooltip, unit, "aria-label": ariaLabel, autoFocus, readOnly, required });
60
+ }, error), success, helper, tooltip, unit, "aria-label": ariaLabel, autoFocus, readOnly, required, controls });
60
61
  };
61
62
  export {
62
63
  NumberInputFieldV2
@@ -9,20 +9,20 @@ export declare const RadioGroupField: {
9
9
  <TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ className, legend, name, onChange, required, rules, children, label, error: customError, helper, direction, shouldUnregister, }: RadioGroupFieldProps<TFieldValues, TName>): JSX.Element;
10
10
  Radio: ({ onFocus, onBlur, disabled, error, name, value, label, helper, className, autoFocus, onKeyDown, "data-testid": dataTestId, }: Omit<({
11
11
  error?: import("react").ReactNode;
12
- checked?: boolean | undefined;
12
+ checked?: boolean;
13
13
  value: string | number;
14
14
  helper?: import("react").ReactNode;
15
- className?: string | undefined;
16
- 'data-testid'?: string | undefined;
17
- tooltip?: string | undefined;
15
+ className?: string;
16
+ 'data-testid'?: string;
17
+ tooltip?: string;
18
18
  } & Required<Pick<import("react").InputHTMLAttributes<HTMLInputElement>, "onChange">> & (Pick<import("react").InputHTMLAttributes<HTMLInputElement>, "required" | "onBlur" | "disabled" | "name" | "onFocus" | "autoFocus" | "id" | "onKeyDown"> & ({
19
19
  'aria-label': string;
20
- label?: undefined;
20
+ label?: never;
21
21
  } | {
22
- 'aria-label'?: undefined;
22
+ 'aria-label'?: never;
23
23
  label: import("react").ReactNode;
24
24
  }))) & import("react").RefAttributes<HTMLInputElement>, "required" | "onChange" | "checked"> & {
25
- name?: string | undefined;
25
+ name?: string;
26
26
  }) => import("@emotion/react/jsx-runtime").JSX.Element;
27
27
  };
28
28
  export {};
@@ -53,8 +53,7 @@ const SelectInputField = ({
53
53
  })), [optionsProp, children]);
54
54
  const parse = React.useMemo(() => multiple ? parseProp : (option) => parseProp(option?.value ?? null, name), [multiple, parseProp, name]);
55
55
  const format = React.useCallback((val) => {
56
- if (multiple)
57
- return formatProp(val, name);
56
+ if (multiple) return formatProp(val, name);
58
57
  const find = (opts, valueToFind) => opts?.find((option) => option.value === valueToFind);
59
58
  let selected = "";
60
59
  if (val && options) {
@@ -77,6 +77,6 @@ export type SelectInputFieldProps<TFieldValues extends FieldValues, TName extend
77
77
  };
78
78
  export declare const SelectInputField: {
79
79
  <TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ animation, animationDuration, animationOnChange, children, className, disabled, format: formatProp, id, inputId, isClearable, isLoading, isSearchable, label, maxLength, menuPortalTarget, minLength, multiple, name, onBlur, onChange, onFocus, options: optionsProp, parse: parseProp, placeholder, readOnly, required, rules, noTopLabel, emptyState, customStyle, shouldUnregister, "data-testid": dataTestId, }: SelectInputFieldProps<TFieldValues, TName>): import("@emotion/react/jsx-runtime").JSX.Element;
80
- Option: (props: Partial<OptionProps<import("@ultraviolet/ui").SelectOption, boolean, GroupBase<import("@ultraviolet/ui").SelectOption>> & import("@ultraviolet/ui").SelectOption>) => import("react").JSX.Element;
80
+ Option: (props: Partial<OptionProps<import("@ultraviolet/ui").SelectOption> & import("@ultraviolet/ui").SelectOption>) => import("react").JSX.Element;
81
81
  };
82
82
  export {};
@@ -51,8 +51,7 @@ const SelectInputField = ({
51
51
  })), [optionsProp, children]);
52
52
  const parse = useMemo(() => multiple ? parseProp : (option) => parseProp(option?.value ?? null, name), [multiple, parseProp, name]);
53
53
  const format = useCallback((val) => {
54
- if (multiple)
55
- return formatProp(val, name);
54
+ if (multiple) return formatProp(val, name);
56
55
  const find = (opts, valueToFind) => opts?.find((option) => option.value === valueToFind);
57
56
  let selected = "";
58
57
  if (val && options) {
@@ -5,38 +5,6 @@ import type { BaseFieldProps } from '../../types';
5
5
  type SelectableCardGroupFieldProps<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>> = BaseFieldProps<TFieldValues, TName> & Omit<BaseFieldProps<TFieldValues, TName>, 'label' | 'onChange'> & Partial<Pick<ComponentProps<typeof SelectableCardGroup>, 'helper' | 'error' | 'columns' | 'children' | 'showTick' | 'type' | 'className' | 'onChange'>> & Pick<ComponentProps<typeof SelectableCardGroup>, 'legend'>;
6
6
  export declare const SelectableCardGroupField: {
7
7
  <TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ className, legend, name, onChange, required, rules, children, label, error: customError, helper, columns, showTick, type, shouldUnregister, }: SelectableCardGroupFieldProps<TFieldValues, TName>): JSX.Element;
8
- Card: ({ value, disabled, children, className, isError, onFocus, onBlur, tooltip, id, label, "data-testid": dataTestId, }: {
9
- value: string | number;
10
- onBlur?: import("react").FocusEventHandler<HTMLInputElement> | undefined;
11
- disabled?: boolean | undefined;
12
- children?: import("react").ReactNode | (({ disabled, checked, }: Pick<{
13
- name?: string | undefined;
14
- children?: import("react").ReactNode | any;
15
- value: string | number;
16
- onChange: import("react").ChangeEventHandler<HTMLInputElement>;
17
- showTick?: boolean | undefined;
18
- type?: "checkbox" | "radio" | undefined;
19
- disabled?: boolean | undefined;
20
- checked?: boolean | undefined;
21
- className?: string | undefined;
22
- isError?: boolean | undefined;
23
- onFocus?: import("react").FocusEventHandler<HTMLInputElement> | undefined;
24
- onBlur?: import("react").FocusEventHandler<HTMLInputElement> | undefined;
25
- id?: string | undefined;
26
- tooltip?: string | undefined;
27
- label?: import("react").ReactNode;
28
- 'data-testid'?: string | undefined;
29
- }, "disabled" | "checked">) => import("react").ReactNode);
30
- className?: string | undefined;
31
- ref?: import("react").LegacyRef<HTMLDivElement> | undefined;
32
- name?: string | undefined;
33
- label?: import("react").ReactNode;
34
- onFocus?: import("react").FocusEventHandler<HTMLInputElement> | undefined;
35
- id?: string | undefined;
36
- 'data-testid'?: string | undefined;
37
- tooltip?: string | undefined;
38
- key?: import("react").Key | null | undefined;
39
- isError?: boolean | undefined;
40
- }) => import("@emotion/react/jsx-runtime").JSX.Element;
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;
41
9
  };
42
10
  export {};
@@ -49,8 +49,7 @@ const TimeField = ({
49
49
  }
50
50
  });
51
51
  return /* @__PURE__ */ jsxRuntime.jsx(ui.TimeInput, { name: field.name, placeholder, schedule, required, value: parseTime(field.value), onChange: (val) => {
52
- if (!val)
53
- return;
52
+ if (!val) return;
54
53
  onChange?.(val);
55
54
  const [hours, minutes] = val.value.split(":");
56
55
  const date = field.value ? new Date(field.value) : /* @__PURE__ */ new Date();
@@ -47,8 +47,7 @@ const TimeField = ({
47
47
  }
48
48
  });
49
49
  return /* @__PURE__ */ jsx(TimeInput, { name: field.name, placeholder, schedule, required, value: parseTime(field.value), onChange: (val) => {
50
- if (!val)
51
- return;
50
+ if (!val) return;
52
51
  onChange?.(val);
53
52
  const [hours, minutes] = val.value.split(":");
54
53
  const date = field.value ? new Date(field.value) : /* @__PURE__ */ new Date();
@@ -6,20 +6,20 @@ type ToggleGroupFieldProps<TFieldValues extends FieldValues, TName extends Field
6
6
  export declare const ToggleGroupField: {
7
7
  <TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ legend, className, helper, direction, children, onChange, label, error: customError, name, required, shouldUnregister, }: ToggleGroupFieldProps<TFieldValues, TName>): import("@emotion/react/jsx-runtime").JSX.Element;
8
8
  Toggle: ({ disabled, name, value, label, helper, error, className, "data-testid": dataTestId, }: Omit<{
9
- id?: string | undefined;
10
- checked?: boolean | undefined;
9
+ id?: string;
10
+ checked?: boolean;
11
11
  name: string;
12
- tooltip?: string | undefined;
13
- onChange?: import("react").ChangeEventHandler<HTMLInputElement> | undefined;
14
- size?: "small" | "large" | undefined;
15
- labelPosition?: "left" | "right" | undefined;
12
+ tooltip?: string;
13
+ onChange?: import("react").ChangeEventHandler<HTMLInputElement>;
14
+ size?: "large" | "small";
15
+ labelPosition?: "left" | "right";
16
16
  label?: import("react").ReactNode;
17
17
  helper?: import("react").ReactNode;
18
- disabled?: boolean | undefined;
19
- className?: string | undefined;
20
- required?: boolean | undefined;
21
- error?: string | boolean | undefined;
22
- 'data-testid'?: string | undefined;
18
+ disabled?: boolean;
19
+ className?: string;
20
+ required?: boolean;
21
+ error?: boolean | string;
22
+ 'data-testid'?: string;
23
23
  } & Pick<import("react").InputHTMLAttributes<HTMLInputElement>, "value"> & import("react").RefAttributes<HTMLInputElement>, "required" | "onChange" | "checked"> & {
24
24
  value: string;
25
25
  }) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { FieldValues } from 'react-hook-form';
3
2
  /**
4
3
  * @deprecated Use [useFormContext](https://www.react-hook-form.com/api/useformcontext/)
@@ -19,5 +18,5 @@ export declare const useFormDeprecated: <TFieldValues extends FieldValues>() =>
19
18
  batch: (callback: () => void) => void;
20
19
  restart: import("react-hook-form").UseFormReset<TFieldValues>;
21
20
  reset: import("react-hook-form").UseFormReset<TFieldValues>;
22
- submit: (e?: import("react").BaseSyntheticEvent<object, any, any> | undefined) => Promise<void>;
21
+ submit: (e?: import("react").BaseSyntheticEvent) => Promise<void>;
23
22
  };
@@ -21,10 +21,10 @@ export declare const useFormStateDeprecated: <TFieldValues extends FieldValues>(
21
21
  dirtySinceLastSubmit: boolean;
22
22
  submitErrors: (Record<string, Partial<{
23
23
  type: string | number;
24
- message: string;
24
+ message: import("react-hook-form").Message;
25
25
  }>> & Partial<{
26
26
  type: string | number;
27
- message: string;
27
+ message: import("react-hook-form").Message;
28
28
  }>) | undefined;
29
29
  values: TFieldValues;
30
30
  hasValidationErrors: boolean;
@@ -1,5 +1,5 @@
1
1
  declare const _default: {
2
- minDate: (minDate?: Date | undefined) => (value: Date) => boolean;
3
- maxDate: (maxDate?: Date | undefined) => (value: Date) => boolean;
2
+ minDate: (minDate?: Date) => (value: Date) => boolean;
3
+ maxDate: (maxDate?: Date) => (value: Date) => boolean;
4
4
  };
5
5
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultraviolet/form",
3
- "version": "2.14.4",
3
+ "version": "2.14.6",
4
4
  "description": "Ultraviolet Form",
5
5
  "homepage": "https://github.com/scaleway/ultraviolet#readme",
6
6
  "repository": {
@@ -55,12 +55,12 @@
55
55
  "@emotion/styled": "11.11.5",
56
56
  "react": "18.x",
57
57
  "react-dom": "18.x",
58
- "react-hook-form": "7.51.5"
58
+ "react-hook-form": "7.52.0"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@babel/core": "7.24.7",
62
62
  "@types/final-form-focus": "1.1.7",
63
- "@types/react": "18.3.1",
63
+ "@types/react": "18.3.3",
64
64
  "@types/react-dom": "18.3.0",
65
65
  "react": "18.3.1",
66
66
  "react-dom": "18.3.1",
@@ -71,8 +71,8 @@
71
71
  "@emotion/react": "11.11.4",
72
72
  "@emotion/styled": "11.11.5",
73
73
  "react-select": "5.8.0",
74
- "react-hook-form": "7.51.5",
75
- "@ultraviolet/ui": "1.55.3",
74
+ "react-hook-form": "7.52.0",
75
+ "@ultraviolet/ui": "1.56.1",
76
76
  "@ultraviolet/themes": "1.12.0"
77
77
  },
78
78
  "scripts": {