@saas-ui/forms 2.0.0-next.7 → 2.0.0-next.9

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/src/form.tsx CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react'
2
2
 
3
3
  import { chakra, HTMLChakraProps, forwardRef } from '@chakra-ui/react'
4
- import { cx, runIfFn } from '@chakra-ui/utils'
4
+ import { FocusableElement, cx, runIfFn } from '@chakra-ui/utils'
5
5
 
6
6
  import {
7
7
  useForm,
@@ -29,15 +29,18 @@ import { SubmitButton } from './submit-button'
29
29
  import { DisplayIf, DisplayIfProps } from './display-if'
30
30
  import { ArrayField, ArrayFieldProps } from './array-field'
31
31
  import { ObjectField, ObjectFieldProps } from './object-field'
32
+ import { UseArrayFieldReturn } from './use-array-field'
32
33
 
33
34
  export interface FormRenderContext<
34
35
  TFieldValues extends FieldValues = FieldValues,
35
36
  TContext extends object = object,
36
37
  TFieldTypes = FieldProps<TFieldValues>
37
38
  > extends UseFormReturn<TFieldValues, TContext> {
38
- Field: React.FC<TFieldTypes>
39
+ Field: React.FC<TFieldTypes & React.RefAttributes<FocusableElement>>
39
40
  DisplayIf: React.FC<DisplayIfProps<TFieldValues>>
40
- ArrayField: React.FC<ArrayFieldProps<TFieldValues>>
41
+ ArrayField: React.FC<
42
+ ArrayFieldProps<TFieldValues> & React.RefAttributes<UseArrayFieldReturn>
43
+ >
41
44
  ObjectField: React.FC<ObjectFieldProps<TFieldValues>>
42
45
  }
43
46
 
@@ -188,7 +191,7 @@ export const Form = forwardRef(
188
191
  >
189
192
  {runIfFn(_children, {
190
193
  Field: DefaultField as any,
191
- DisplayIf: DisplayIf,
194
+ DisplayIf: DisplayIf as any,
192
195
  ArrayField: ArrayField as any,
193
196
  ObjectField: ObjectField as any,
194
197
  ...methods,