UNPKG

@undermuz/use-form

Version:
22 lines (19 loc) 1.13 kB
import { IFields, IErrors } from '../useForm/reducer.js'; import { MutableRefObject } from 'react'; import './useReducer.js'; interface ExoticComponentWithDisplayName<P = unknown> extends React.ExoticComponent<P> { defaultProps?: Partial<P>; displayName?: string; } type AnyComponent<P = any> = ExoticComponentWithDisplayName<P> | React.ComponentType<P>; type KnownWebTarget = keyof JSX.IntrinsicElements | AnyComponent; type WebTarget = string | KnownWebTarget; declare const useIsFormSuccess: () => boolean; declare const useIsFormCanceling: () => boolean; declare const useIsFormSending: () => boolean; declare const useIsFormHasErrors: () => boolean; declare const useFormFields: () => IFields; declare const useFormErrors: () => IErrors; declare const useFormSubmit: (onSend: Function, onSucceed: (value: any) => any, onError?: ((reason: any) => any) | undefined) => () => void; declare const useRefBy: <T = any>(by: T) => MutableRefObject<T>; export { WebTarget, useFormErrors, useFormFields, useFormSubmit, useIsFormCanceling, useIsFormHasErrors, useIsFormSending, useIsFormSuccess, useRefBy };