@saas-ui/forms 2.6.4 → 2.6.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/CHANGELOG.md +20 -5
- package/dist/index.d.mts +19 -19
- package/dist/index.d.ts +19 -19
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/create-field.tsx +1 -1
- package/src/form-context.tsx +2 -2
- package/src/watch-field.tsx +7 -5
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@saas-ui/forms",
|
3
|
-
"version": "2.6.
|
3
|
+
"version": "2.6.6",
|
4
4
|
"description": "Fully functional forms for Chakra UI.",
|
5
5
|
"source": "src/index.ts",
|
6
6
|
"exports": {
|
@@ -104,7 +104,7 @@
|
|
104
104
|
"@chakra-ui/react-utils": "^2.0.12",
|
105
105
|
"@chakra-ui/utils": "^2.0.15",
|
106
106
|
"@hookform/resolvers": "^3.3.4",
|
107
|
-
"@saas-ui/core": "2.5.
|
107
|
+
"@saas-ui/core": "2.5.4",
|
108
108
|
"react-hook-form": "^7.50.1"
|
109
109
|
},
|
110
110
|
"peerDependencies": {
|
package/src/create-field.tsx
CHANGED
package/src/form-context.tsx
CHANGED
@@ -40,7 +40,7 @@ export const useFormContext = <
|
|
40
40
|
TSchema = any,
|
41
41
|
>() => {
|
42
42
|
const context = React.useContext(FormContext)
|
43
|
-
const hookContext = useHookFormContext()
|
43
|
+
const hookContext = useHookFormContext<TFieldValues, TContext>()
|
44
44
|
|
45
45
|
return {
|
46
46
|
...hookContext,
|
@@ -60,7 +60,7 @@ export type UseFormReturn<
|
|
60
60
|
TFieldValues extends FieldValues = FieldValues,
|
61
61
|
TContext = any,
|
62
62
|
TSchema = any,
|
63
|
-
> = ReturnType<typeof useFormContext
|
63
|
+
> = ReturnType<typeof useFormContext<TFieldValues, TContext, TSchema>>
|
64
64
|
|
65
65
|
export const FormProvider = <
|
66
66
|
TFieldValues extends FieldValues = FieldValues,
|
package/src/watch-field.tsx
CHANGED
@@ -3,7 +3,8 @@ import { useFormContext, UseFormReturn } from './form-context'
|
|
3
3
|
|
4
4
|
export interface WatchFieldProps<
|
5
5
|
Value = unknown,
|
6
|
-
TFieldValues extends FieldValues = FieldValues
|
6
|
+
TFieldValues extends FieldValues = FieldValues,
|
7
|
+
TContext extends object = object,
|
7
8
|
> {
|
8
9
|
name: string
|
9
10
|
defaultValue?: Value
|
@@ -11,18 +12,19 @@ export interface WatchFieldProps<
|
|
11
12
|
isExact?: boolean
|
12
13
|
children: (
|
13
14
|
value: Value,
|
14
|
-
form: UseFormReturn<TFieldValues>
|
15
|
+
form: UseFormReturn<TFieldValues, TContext>
|
15
16
|
) => React.ReactElement | void
|
16
17
|
}
|
17
18
|
|
18
19
|
export const WatchField = <
|
19
20
|
Value = unknown,
|
20
|
-
TFieldValues extends FieldValues = FieldValues
|
21
|
+
TFieldValues extends FieldValues = FieldValues,
|
22
|
+
TContext extends object = object,
|
21
23
|
>(
|
22
|
-
props: WatchFieldProps<Value, TFieldValues>
|
24
|
+
props: WatchFieldProps<Value, TFieldValues, TContext>
|
23
25
|
) => {
|
24
26
|
const { name, defaultValue, isDisabled, isExact } = props
|
25
|
-
const form = useFormContext<TFieldValues>()
|
27
|
+
const form = useFormContext<TFieldValues, TContext>()
|
26
28
|
|
27
29
|
const field = useWatch({
|
28
30
|
name,
|