UNPKG

@baseplate-dev/ui-components

Version:

Shared UI component library

22 lines 1.18 kB
import type { ForwardedRef } from 'react'; import type { ControllerRenderProps, FieldPath, FieldValues, UseControllerProps, UseControllerReturn } from 'react-hook-form'; interface UseControllerMergedOptions<TValue, TRef> { onChange?: (value: TValue) => void; onBlur?: React.FocusEventHandler<TRef>; disabled?: boolean; } /** * A hook to wrap useController from react-hook-form that allows * passing in properties and refs that will be merged with the * controller's properties and ref. */ export declare function useControllerMerged<TValue, TRef, TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>(props: UseControllerProps<TFieldValues, TName>, options: UseControllerMergedOptions<TValue, TRef>, ref?: ForwardedRef<TRef>): Omit<UseControllerReturn<TFieldValues, TName>, 'field'> & { field: Omit<ControllerRenderProps, 'ref' | 'onChange' | 'value' | 'onBlur'> & { ref: ForwardedRef<TRef> | undefined; onChange: (value: TValue) => void; value: TValue; onBlur: React.FocusEventHandler<TRef>; }; }; export {}; //# sourceMappingURL=use-controller-merged.d.ts.map