@ultraviolet/form 2.4.2 → 2.5.1

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.
@@ -1,6 +1,7 @@
1
1
  import { TagInput } from '@ultraviolet/ui';
2
2
  import { useController } from 'react-hook-form';
3
3
  import { jsx } from '@emotion/react/jsx-runtime';
4
+ import { useErrors } from '../../providers/ErrorContext/index.js';
4
5
 
5
6
  const TagInputField = ({
6
7
  className,
@@ -13,10 +14,23 @@ const TagInputField = ({
13
14
  rules,
14
15
  variant,
15
16
  shouldUnregister = false,
16
- 'data-testid': dataTestId
17
+ 'data-testid': dataTestId,
18
+ clearable,
19
+ label,
20
+ labelDescription,
21
+ size,
22
+ success,
23
+ readOnly,
24
+ tooltip
17
25
  }) => {
18
26
  const {
19
- field
27
+ getError
28
+ } = useErrors();
29
+ const {
30
+ field,
31
+ fieldState: {
32
+ error
33
+ }
20
34
  } = useController({
21
35
  name,
22
36
  rules: {
@@ -30,14 +44,24 @@ const TagInputField = ({
30
44
  className: className,
31
45
  disabled: disabled,
32
46
  id: id,
33
- onChange: event => {
34
- field.onChange(event);
35
- onChange?.(event);
47
+ onChange: newTags => {
48
+ field.onChange(newTags);
49
+ onChange?.(newTags);
36
50
  },
37
51
  placeholder: placeholder,
38
52
  variant: variant,
39
- tags: field.value,
40
- "data-testid": dataTestId
53
+ value: field.value,
54
+ "data-testid": dataTestId,
55
+ clearable: clearable,
56
+ label: label,
57
+ labelDescription: labelDescription,
58
+ size: size,
59
+ success: success,
60
+ error: getError({
61
+ label: label ?? ''
62
+ }, error),
63
+ readOnly: readOnly,
64
+ tooltip: tooltip
41
65
  });
42
66
  };
43
67
 
package/dist/index.d.ts CHANGED
@@ -264,8 +264,8 @@ declare const SubmitErrorAlert: ({ className }: {
264
264
  className?: string | undefined;
265
265
  }) => _emotion_react_jsx_runtime.JSX.Element | null;
266
266
 
267
- type TagInputFieldProps<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>> = BaseFieldProps<TFieldValues, TName> & Partial<Pick<ComponentProps<typeof TagInput>, 'tags' | 'variant' | 'placeholder' | 'disabled' | 'className' | 'id' | 'data-testid'>>;
268
- declare const TagInputField: <TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ className, disabled, id, name, onChange, placeholder, required, rules, variant, shouldUnregister, "data-testid": dataTestId, }: TagInputFieldProps<TFieldValues, TName>) => _emotion_react_jsx_runtime.JSX.Element;
267
+ type TagInputFieldProps<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>> = BaseFieldProps<TFieldValues, TName> & Partial<Pick<ComponentProps<typeof TagInput>, 'variant' | 'placeholder' | 'disabled' | 'className' | 'id' | 'data-testid' | 'clearable' | 'label' | 'labelDescription' | 'size' | 'success' | 'readOnly' | 'tooltip'>>;
268
+ declare const TagInputField: <TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ className, disabled, id, name, onChange, placeholder, required, rules, variant, shouldUnregister, "data-testid": dataTestId, clearable, label, labelDescription, size, success, readOnly, tooltip, }: TagInputFieldProps<TFieldValues, TName>) => _emotion_react_jsx_runtime.JSX.Element;
269
269
 
270
270
  type TextAreaFieldProps<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>> = BaseFieldProps<TFieldValues, TName> & Omit<ComponentProps<typeof TextArea>, 'value' | 'error' | 'name' | 'onChange'> & {
271
271
  regex?: (RegExp | RegExp[])[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultraviolet/form",
3
- "version": "2.4.2",
3
+ "version": "2.5.1",
4
4
  "description": "Ultraviolet Form",
5
5
  "homepage": "https://github.com/scaleway/ultraviolet#readme",
6
6
  "repository": {
@@ -36,7 +36,7 @@
36
36
  "@emotion/styled": "11.11.0",
37
37
  "react": "18.x",
38
38
  "react-dom": "18.x",
39
- "react-hook-form": "7.49.3"
39
+ "react-hook-form": "7.50.1"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@babel/core": "7.23.9",
@@ -52,8 +52,8 @@
52
52
  "@emotion/react": "11.11.3",
53
53
  "@emotion/styled": "11.11.0",
54
54
  "react-select": "5.8.0",
55
- "react-hook-form": "7.49.3",
56
- "@ultraviolet/ui": "1.32.2"
55
+ "react-hook-form": "7.50.1",
56
+ "@ultraviolet/ui": "1.34.0"
57
57
  },
58
58
  "scripts": {
59
59
  "build": "rollup -c ../../rollup.config.mjs",