@ultraviolet/form 4.0.0-beta.1 → 4.0.0-beta.3

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.
@@ -16,12 +16,12 @@ const CheckboxGroupField = ({
16
16
  control,
17
17
  children,
18
18
  onChange,
19
- label = "",
20
19
  error: customError,
21
20
  name,
22
21
  required = false,
23
22
  shouldUnregister = false,
24
23
  validate,
24
+ legend = "",
25
25
  ...props
26
26
  }) => {
27
27
  const {
@@ -73,7 +73,7 @@ const CheckboxGroupField = ({
73
73
  }
74
74
  onChange?.(event.currentTarget.value);
75
75
  }, error: getError({
76
- label
76
+ label: legend
77
77
  }, error) ?? customError, name, required, children });
78
78
  };
79
79
  CheckboxGroupField.Checkbox = ui.CheckboxGroup.Checkbox;
@@ -2,9 +2,9 @@ import { CheckboxGroup } 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 CheckboxGroupFieldProps<TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues>> = BaseFieldProps<TFieldValues, TFieldName> & Omit<ComponentProps<typeof CheckboxGroup>, 'value' | 'onChange'>;
5
+ type CheckboxGroupFieldProps<TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues>> = Omit<BaseFieldProps<TFieldValues, TFieldName>, 'label'> & Omit<ComponentProps<typeof CheckboxGroup>, 'value' | 'onChange'>;
6
6
  export declare const CheckboxGroupField: {
7
- <TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ control, children, onChange, label, error: customError, name, required, shouldUnregister, validate, ...props }: CheckboxGroupFieldProps<TFieldValues, TFieldName>): import("@emotion/react/jsx-runtime").JSX.Element;
7
+ <TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ control, children, onChange, error: customError, name, required, shouldUnregister, validate, legend, ...props }: CheckboxGroupFieldProps<TFieldValues, TFieldName>): 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
9
  error?: string | import("react").ReactNode;
10
10
  size?: number;
@@ -14,12 +14,12 @@ const CheckboxGroupField = ({
14
14
  control,
15
15
  children,
16
16
  onChange,
17
- label = "",
18
17
  error: customError,
19
18
  name,
20
19
  required = false,
21
20
  shouldUnregister = false,
22
21
  validate,
22
+ legend = "",
23
23
  ...props
24
24
  }) => {
25
25
  const {
@@ -71,7 +71,7 @@ const CheckboxGroupField = ({
71
71
  }
72
72
  onChange?.(event.currentTarget.value);
73
73
  }, error: getError({
74
- label
74
+ label: legend
75
75
  }, error) ?? customError, name, required, children });
76
76
  };
77
77
  CheckboxGroupField.Checkbox = CheckboxGroup.Checkbox;
@@ -11,11 +11,10 @@ const RadioGroupField = ({
11
11
  onChange,
12
12
  required,
13
13
  children,
14
- label = "",
15
14
  error: customError,
16
15
  shouldUnregister = false,
17
16
  validate,
18
- legend,
17
+ legend = "",
19
18
  ...props
20
19
  }) => {
21
20
  const {
@@ -39,7 +38,7 @@ const RadioGroupField = ({
39
38
  field.onChange(event);
40
39
  onChange?.(event.target.value);
41
40
  }, required, value: field.value, error: getError({
42
- label
41
+ label: legend
43
42
  }, error) ?? customError, legend: legend ?? "", children });
44
43
  };
45
44
  RadioGroupField.Radio = ui.RadioGroup.Radio;
@@ -2,9 +2,9 @@ import { RadioGroup } from '@ultraviolet/ui';
2
2
  import type { ComponentProps, JSX } from 'react';
3
3
  import type { FieldPath, FieldValues } from 'react-hook-form';
4
4
  import type { BaseFieldProps } from '../../types';
5
- type RadioGroupFieldProps<TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues>> = BaseFieldProps<TFieldValues, TFieldName> & Omit<ComponentProps<typeof RadioGroup>, 'value' | 'onChange' | 'legend'> & Partial<Pick<ComponentProps<typeof RadioGroup>, 'legend'>>;
5
+ type RadioGroupFieldProps<TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues>> = Omit<BaseFieldProps<TFieldValues, TFieldName>, 'label'> & Omit<ComponentProps<typeof RadioGroup>, 'value' | 'onChange' | 'legend'> & Partial<Pick<ComponentProps<typeof RadioGroup>, 'legend'>>;
6
6
  export declare const RadioGroupField: {
7
- <TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ control, name, onChange, required, children, label, error: customError, shouldUnregister, validate, legend, ...props }: RadioGroupFieldProps<TFieldValues, TFieldName>): JSX.Element;
7
+ <TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ control, name, onChange, required, children, error: customError, shouldUnregister, validate, legend, ...props }: RadioGroupFieldProps<TFieldValues, TFieldName>): JSX.Element;
8
8
  Radio: ({ onFocus, onBlur, disabled, error, name, value, label, helper, className, autoFocus, onKeyDown, tooltip, "data-testid": dataTestId, }: Omit<({
9
9
  error?: import("react").ReactNode;
10
10
  value: string | number;
@@ -9,11 +9,10 @@ const RadioGroupField = ({
9
9
  onChange,
10
10
  required,
11
11
  children,
12
- label = "",
13
12
  error: customError,
14
13
  shouldUnregister = false,
15
14
  validate,
16
- legend,
15
+ legend = "",
17
16
  ...props
18
17
  }) => {
19
18
  const {
@@ -37,7 +36,7 @@ const RadioGroupField = ({
37
36
  field.onChange(event);
38
37
  onChange?.(event.target.value);
39
38
  }, required, value: field.value, error: getError({
40
- label
39
+ label: legend
41
40
  }, error) ?? customError, legend: legend ?? "", children });
42
41
  };
43
42
  RadioGroupField.Radio = RadioGroup.Radio;
@@ -7,13 +7,13 @@ const reactHookForm = require("react-hook-form");
7
7
  const index = require("../../providers/ErrorContext/index.cjs");
8
8
  const SelectableCardGroupField = ({
9
9
  className,
10
- legend,
10
+ legend = "",
11
+ legendDescription,
11
12
  control,
12
13
  name,
13
14
  onChange,
14
15
  required = false,
15
16
  children,
16
- label = "",
17
17
  error: customError,
18
18
  helper,
19
19
  columns = 1,
@@ -39,7 +39,7 @@ const SelectableCardGroupField = ({
39
39
  validate
40
40
  }
41
41
  });
42
- return /* @__PURE__ */ jsxRuntime.jsx(ui.SelectableCardGroup, { legend, name, type, showTick, value: field.value, onChange: (event) => {
42
+ return /* @__PURE__ */ jsxRuntime.jsx(ui.SelectableCardGroup, { legend, legendDescription, name, type, showTick, value: field.value, onChange: (event) => {
43
43
  if (type === "checkbox") {
44
44
  const fieldValue = field.value ?? [];
45
45
  if (fieldValue?.includes(event.currentTarget.value)) {
@@ -52,7 +52,7 @@ const SelectableCardGroupField = ({
52
52
  }
53
53
  onChange?.(event.currentTarget.value);
54
54
  }, error: getError({
55
- label
55
+ label: legend
56
56
  }, error) ?? customError, className, columns, helper, required, children });
57
57
  };
58
58
  SelectableCardGroupField.Card = ui.SelectableCardGroup.Card;
@@ -2,9 +2,9 @@ import { SelectableCardGroup } from '@ultraviolet/ui';
2
2
  import type { ComponentProps, JSX } from 'react';
3
3
  import type { FieldPath, FieldValues } from 'react-hook-form';
4
4
  import type { BaseFieldProps } from '../../types';
5
- type SelectableCardGroupFieldProps<TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues>> = BaseFieldProps<TFieldValues, TFieldName> & Omit<BaseFieldProps<TFieldValues, TFieldName>, 'label'> & Partial<Pick<ComponentProps<typeof SelectableCardGroup>, 'helper' | 'error' | 'columns' | 'children' | 'showTick' | 'type' | 'className'>> & Pick<ComponentProps<typeof SelectableCardGroup>, 'legend'>;
5
+ type SelectableCardGroupFieldProps<TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues>> = Omit<BaseFieldProps<TFieldValues, TFieldName>, 'label'> & Partial<Pick<ComponentProps<typeof SelectableCardGroup>, 'helper' | 'error' | 'columns' | 'children' | 'showTick' | 'type' | 'className'>> & Pick<ComponentProps<typeof SelectableCardGroup>, 'legend' | 'legendDescription'>;
6
6
  export declare const SelectableCardGroupField: {
7
- <TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ className, legend, control, name, onChange, required, children, label, error: customError, helper, columns, showTick, type, shouldUnregister, validate, }: SelectableCardGroupFieldProps<TFieldValues, TFieldName>): JSX.Element;
7
+ <TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ className, legend, legendDescription, control, name, onChange, required, children, error: customError, helper, columns, showTick, type, shouldUnregister, validate, }: SelectableCardGroupFieldProps<TFieldValues, TFieldName>): JSX.Element;
8
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;
9
9
  };
10
10
  export {};
@@ -5,13 +5,13 @@ import { useController } from "react-hook-form";
5
5
  import { useErrors } from "../../providers/ErrorContext/index.js";
6
6
  const SelectableCardGroupField = ({
7
7
  className,
8
- legend,
8
+ legend = "",
9
+ legendDescription,
9
10
  control,
10
11
  name,
11
12
  onChange,
12
13
  required = false,
13
14
  children,
14
- label = "",
15
15
  error: customError,
16
16
  helper,
17
17
  columns = 1,
@@ -37,7 +37,7 @@ const SelectableCardGroupField = ({
37
37
  validate
38
38
  }
39
39
  });
40
- return /* @__PURE__ */ jsx(SelectableCardGroup, { legend, name, type, showTick, value: field.value, onChange: (event) => {
40
+ return /* @__PURE__ */ jsx(SelectableCardGroup, { legend, legendDescription, name, type, showTick, value: field.value, onChange: (event) => {
41
41
  if (type === "checkbox") {
42
42
  const fieldValue = field.value ?? [];
43
43
  if (fieldValue?.includes(event.currentTarget.value)) {
@@ -50,7 +50,7 @@ const SelectableCardGroupField = ({
50
50
  }
51
51
  onChange?.(event.currentTarget.value);
52
52
  }, error: getError({
53
- label
53
+ label: legend
54
54
  }, error) ?? customError, className, columns, helper, required, children });
55
55
  };
56
56
  SelectableCardGroupField.Card = SelectableCardGroup.Card;
@@ -6,7 +6,7 @@ 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 SelectableCardOptionGroupField = ({
9
- legend,
9
+ legend = "",
10
10
  control,
11
11
  name,
12
12
  optionName,
@@ -14,7 +14,6 @@ const SelectableCardOptionGroupField = ({
14
14
  onChangeOption,
15
15
  required = false,
16
16
  children,
17
- label = "",
18
17
  error: customError,
19
18
  shouldUnregister = false,
20
19
  validate,
@@ -53,7 +52,7 @@ const SelectableCardOptionGroupField = ({
53
52
  optionField.onChange(value);
54
53
  onChangeOption?.(value);
55
54
  }, error: getError({
56
- label
55
+ label: legend
57
56
  }, error) ?? customError, required, ...props, children });
58
57
  };
59
58
  SelectableCardOptionGroupField.Option = ui.SelectableCardOptionGroup.Option;
@@ -2,11 +2,11 @@ import { SelectableCardOptionGroup } from '@ultraviolet/ui';
2
2
  import type { ComponentProps, JSX } from 'react';
3
3
  import type { FieldPath, FieldValues } from 'react-hook-form';
4
4
  import type { BaseFieldProps } from '../../types';
5
- type SelectableCardOptionGroupFieldProps<TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues>> = Omit<ComponentProps<typeof SelectableCardOptionGroup>, 'onChange' | 'onChangeOption'> & Partial<Pick<ComponentProps<typeof SelectableCardOptionGroup>, 'onChangeOption' | 'onChange'>> & BaseFieldProps<TFieldValues, TFieldName> & Omit<BaseFieldProps<TFieldValues, TFieldName>, 'label'> & {
5
+ type SelectableCardOptionGroupFieldProps<TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues>> = Omit<ComponentProps<typeof SelectableCardOptionGroup>, 'onChange' | 'onChangeOption'> & Partial<Pick<ComponentProps<typeof SelectableCardOptionGroup>, 'onChangeOption' | 'onChange'>> & Omit<BaseFieldProps<TFieldValues, TFieldName>, 'label'> & {
6
6
  optionName?: string;
7
7
  };
8
8
  export declare const SelectableCardOptionGroupField: {
9
- <TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ legend, control, name, optionName, onChange, onChangeOption, required, children, label, error: customError, shouldUnregister, validate, ...props }: SelectableCardOptionGroupFieldProps<TFieldValues, TFieldName>): JSX.Element;
9
+ <TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ legend, control, name, optionName, onChange, onChangeOption, required, children, error: customError, shouldUnregister, validate, ...props }: SelectableCardOptionGroupFieldProps<TFieldValues, TFieldName>): JSX.Element;
10
10
  Option: ({ value, label, labelDescription, "aria-label": ariaLabel, children, className, options, optionPlaceholder, image, disabled, id, "data-testid": dataTestId, tooltip, }: Omit<import("node_modules/@ultraviolet/ui/dist/components/SelectableCard").SelectableCardProps & import("react").RefAttributes<HTMLDivElement>, "onChange"> & {
11
11
  value: string;
12
12
  className?: string;
@@ -4,7 +4,7 @@ import { SelectableCardOptionGroup } from "@ultraviolet/ui";
4
4
  import { useController } from "react-hook-form";
5
5
  import { useErrors } from "../../providers/ErrorContext/index.js";
6
6
  const SelectableCardOptionGroupField = ({
7
- legend,
7
+ legend = "",
8
8
  control,
9
9
  name,
10
10
  optionName,
@@ -12,7 +12,6 @@ const SelectableCardOptionGroupField = ({
12
12
  onChangeOption,
13
13
  required = false,
14
14
  children,
15
- label = "",
16
15
  error: customError,
17
16
  shouldUnregister = false,
18
17
  validate,
@@ -51,7 +50,7 @@ const SelectableCardOptionGroupField = ({
51
50
  optionField.onChange(value);
52
51
  onChangeOption?.(value);
53
52
  }, error: getError({
54
- label
53
+ label: legend
55
54
  }, error) ?? customError, required, ...props, children });
56
55
  };
57
56
  SelectableCardOptionGroupField.Option = SelectableCardOptionGroup.Option;
@@ -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> & Partial<Pick<ComponentProps<typeof ToggleGroup>, 'className' | 'helper' | 'direction' | 'children' | 'error' | 'legend' | 'description'>> & Required<Pick<ComponentProps<typeof ToggleGroup>, 'legend'>>;
5
+ type ToggleGroupFieldProps<TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues>> = Omit<BaseFieldProps<TFieldValues, TFieldName>, 'label'> & Partial<Pick<ComponentProps<typeof ToggleGroup>, 'className' | 'helper' | 'direction' | 'children' | 'error' | 'legend' | 'legendDescription' | 'description'>> & Required<Pick<ComponentProps<typeof ToggleGroup>, 'legend'>>;
6
6
  export declare const ToggleGroupField: {
7
- <TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ legend, control, className, helper, description, direction, children, onChange, label, error: customError, name, required, shouldUnregister, validate, }: ToggleGroupFieldProps<TFieldValues, TFieldName>): import("@emotion/react/jsx-runtime").JSX.Element;
7
+ <TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ legend, legendDescription, control, className, helper, description, direction, children, onChange, error: customError, name, required, shouldUnregister, validate, }: 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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultraviolet/form",
3
- "version": "4.0.0-beta.1",
3
+ "version": "4.0.0-beta.3",
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.1"
58
+ "@ultraviolet/ui": "2.0.0-beta.3"
59
59
  },
60
60
  "devDependencies": {
61
- "@babel/core": "7.26.10",
61
+ "@babel/core": "7.27.1",
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.0.12",
66
- "@types/react-dom": "19.0.4",
67
- "react": "19.0.0",
68
- "react-dom": "19.0.0",
69
- "@ultraviolet/ui": "2.0.0-beta.1",
65
+ "@types/react": "19.1.4",
66
+ "@types/react-dom": "19.1.5",
67
+ "react": "19.1.0",
68
+ "react-dom": "19.1.0",
69
+ "@ultraviolet/ui": "2.0.0-beta.3",
70
70
  "@utils/test": "0.0.1"
71
71
  },
72
72
  "dependencies": {
73
73
  "@babel/runtime": "7.27.1",
74
74
  "react-hook-form": "7.55.0",
75
75
  "react-select": "5.10.0",
76
- "@ultraviolet/icons": "4.0.0-beta.1",
77
- "@ultraviolet/themes": "2.0.0-beta.0"
76
+ "@ultraviolet/icons": "4.0.0-beta.2",
77
+ "@ultraviolet/themes": "2.0.0-beta.1"
78
78
  },
79
79
  "scripts": {
80
80
  "build:profile": "npx vite-bundle-visualizer -c vite.config.ts",