@ultraviolet/form 2.0.0-next.3 → 2.0.0-next.5

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.
@@ -90,7 +90,7 @@ const SelectInputField = _ref => {
90
90
  }
91
91
  } = _ref3;
92
92
  return jsx(SelectInput, {
93
- ...field,
93
+ name: field.name,
94
94
  animation: animation,
95
95
  animationDuration: animationDuration,
96
96
  animationOnChange: animationOnChange,
@@ -122,9 +122,7 @@ const SelectInputField = _ref => {
122
122
  placeholder: placeholder,
123
123
  readOnly: readOnly,
124
124
  noTopLabel: noTopLabel,
125
- required: required
126
- // value={value}
127
- ,
125
+ required: required,
128
126
  value: format(field.value),
129
127
  noOptionsMessage: noOptionsMessage,
130
128
  children: children
@@ -1,7 +1,20 @@
1
1
  import { useFormContext, useController } from 'react-hook-form';
2
2
 
3
3
  /**
4
- * @deprecated
4
+ * @deprecated Use [useForm](https://www.react-hook-form.com/api/useform/), [useFormContext](https://www.react-hook-form.com/api/useformcontext/) or [useWatch](https://www.react-hook-form.com/api/usewatch/) to get values. Use [useFormState](https://www.react-hook-form.com/api/useformstate/) to get fields states.
5
+ * @example
6
+ * ```tsx
7
+ * const Input = () {
8
+ * const username = useWatch({
9
+ * name: 'username'
10
+ * })
11
+ *
12
+ * const { errors } = useFormState()
13
+ *
14
+ * console.log(errors.username)
15
+ * }
16
+ * ```
17
+
5
18
  */
6
19
  const useFieldDeprecated = (name, options) => {
7
20
  const {
@@ -1,7 +1,7 @@
1
1
  import { useFieldArray, useWatch } from 'react-hook-form';
2
2
 
3
3
  /**
4
- * @deprecated
4
+ * @deprecated Use [useFieldArray](https://www.react-hook-form.com/api/usefieldarray/)
5
5
  */
6
6
  const useFieldArrayDeprecated = (name, options) => {
7
7
  const {
@@ -3,7 +3,16 @@ import { useFormContext } from 'react-hook-form';
3
3
  import { FormSubmitContext } from '../components/Form/index.js';
4
4
 
5
5
  /**
6
- * @deprecated
6
+ * @deprecated Use [useFormContext](https://www.react-hook-form.com/api/useformcontext/)
7
+ *
8
+ * @example
9
+ * ```tsx
10
+ * const Input = () {
11
+ * const { setValue } = useFormContext()
12
+ *
13
+ * setValue('username', 'John Wick')
14
+ * }
15
+ * ```
7
16
  */
8
17
  const useFormDeprecated = () => {
9
18
  const {
@@ -1,7 +1,18 @@
1
1
  import { useFormContext, useWatch } from 'react-hook-form';
2
2
 
3
3
  /**
4
- * @deprecated
4
+ * @deprecated Use [useForm](https://www.react-hook-form.com/api/useform/), [useFormContext](https://www.react-hook-form.com/api/useformcontext/) or [useWatch](https://www.react-hook-form.com/api/usewatch/) to get values. Use [useFormState](https://www.react-hook-form.com/api/useformstate/) to get form states.
5
+ * @example
6
+ * ```tsx
7
+ * const Input = () {
8
+ * const username = useWatch({
9
+ * name: 'username'
10
+ * })
11
+ *
12
+ * const { isValid } = useFormState()
13
+ * }
14
+ * ```
15
+
5
16
  */
6
17
  const useFormStateDeprecated = _params => {
7
18
  const {
package/dist/index.d.ts CHANGED
@@ -673,7 +673,18 @@ type UseFormStateParams = {
673
673
  subscription?: Record<string, boolean>;
674
674
  };
675
675
  /**
676
- * @deprecated
676
+ * @deprecated Use [useForm](https://www.react-hook-form.com/api/useform/), [useFormContext](https://www.react-hook-form.com/api/useformcontext/) or [useWatch](https://www.react-hook-form.com/api/usewatch/) to get values. Use [useFormState](https://www.react-hook-form.com/api/useformstate/) to get form states.
677
+ * @example
678
+ * ```tsx
679
+ * const Input = () {
680
+ * const username = useWatch({
681
+ * name: 'username'
682
+ * })
683
+ *
684
+ * const { isValid } = useFormState()
685
+ * }
686
+ * ```
687
+
677
688
  */
678
689
  declare const useFormStateDeprecated: <TFieldValues extends FieldValues>(_params?: UseFormStateParams) => {
679
690
  dirtySinceLastSubmit: boolean;
@@ -700,7 +711,20 @@ type Options$1<TFieldValues extends FieldValues> = {
700
711
  validate?: Validate<FieldPathValue<TFieldValues, Path<TFieldValues>>, TFieldValues>;
701
712
  };
702
713
  /**
703
- * @deprecated
714
+ * @deprecated Use [useForm](https://www.react-hook-form.com/api/useform/), [useFormContext](https://www.react-hook-form.com/api/useformcontext/) or [useWatch](https://www.react-hook-form.com/api/usewatch/) to get values. Use [useFormState](https://www.react-hook-form.com/api/useformstate/) to get fields states.
715
+ * @example
716
+ * ```tsx
717
+ * const Input = () {
718
+ * const username = useWatch({
719
+ * name: 'username'
720
+ * })
721
+ *
722
+ * const { errors } = useFormState()
723
+ *
724
+ * console.log(errors.username)
725
+ * }
726
+ * ```
727
+
704
728
  */
705
729
  declare const useFieldDeprecated: <T, TFieldValues extends FieldValues = FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>(name: TFieldName, options?: Options$1<TFieldValues> | undefined) => {
706
730
  input: {
@@ -716,7 +740,16 @@ declare const useFieldDeprecated: <T, TFieldValues extends FieldValues = FieldVa
716
740
  };
717
741
 
718
742
  /**
719
- * @deprecated
743
+ * @deprecated Use [useFormContext](https://www.react-hook-form.com/api/useformcontext/)
744
+ *
745
+ * @example
746
+ * ```tsx
747
+ * const Input = () {
748
+ * const { setValue } = useFormContext()
749
+ *
750
+ * setValue('username', 'John Wick')
751
+ * }
752
+ * ```
720
753
  */
721
754
  declare const useFormDeprecated: <TFieldValues extends FieldValues>() => {
722
755
  change: react_hook_form.UseFormSetValue<TFieldValues>;
@@ -733,7 +766,7 @@ type Options<TFieldValues extends FieldValues> = {
733
766
  subscription?: Record<string, boolean>;
734
767
  };
735
768
  /**
736
- * @deprecated
769
+ * @deprecated Use [useFieldArray](https://www.react-hook-form.com/api/usefieldarray/)
737
770
  */
738
771
  declare const useFieldArrayDeprecated: <T, TFieldValues extends FieldValues = FieldValues>(name: ArrayPath<TFieldValues>, options?: Options<TFieldValues> | undefined) => {
739
772
  fields: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultraviolet/form",
3
- "version": "2.0.0-next.3",
3
+ "version": "2.0.0-next.5",
4
4
  "description": "Ultraviolet Form",
5
5
  "homepage": "https://github.com/scaleway/ultraviolet#readme",
6
6
  "repository": {
@@ -53,7 +53,7 @@
53
53
  "@emotion/styled": "11.11.0",
54
54
  "react-select": "5.8.0",
55
55
  "react-hook-form": "^7.47.0",
56
- "@ultraviolet/ui": "1.26.1"
56
+ "@ultraviolet/ui": "1.27.1"
57
57
  },
58
58
  "scripts": {
59
59
  "build": "rollup -c ../../rollup.config.mjs"