UNPKG

@undermuz/use-form

Version:
51 lines (48 loc) 1.42 kB
import * as react from 'react'; import { ReactElement, ChangeEvent, FocusEvent } from 'react'; import { IError } from '../useForm/reducer.js'; import '../utils/useReducer.js'; interface IConnectToForm { id?: string; name: string; inputName?: string; disabled?: boolean; type?: string; children: ReactElement; IsFilled?: (v: any) => boolean; onRefInput?: Function; onRef?: Function; } interface IInputProps { id: string; name: string; label: string; disabled: boolean; value: any; onChange: (event: ChangeEvent<HTMLInputElement>) => void; onFocus: (event: FocusEvent<HTMLInputElement>) => void; onBlur: (event: ChangeEvent<HTMLInputElement>) => void; } interface IConnectedProps { id?: string; inputProps: IInputProps; name: string; value: any; label: string; errors: IError | null; disabled: boolean; isFocused: boolean; isTouched: boolean; isFilled: boolean; isSucceed: boolean; isDisabled: boolean; hasError: boolean; onChange: Function; onFocus: Function; onBlur: Function; onRefInput?: Function; onRef?: Function; onError: Function; } declare const ConnectToForm: (props: IConnectToForm) => ReactElement<any, string | react.JSXElementConstructor<any>> | null; export { ConnectToForm, IConnectToForm, IConnectedProps, IInputProps };