UNPKG

react-formal

Version:

Classy HTML form management for React

32 lines (31 loc) 950 B
import React from 'react'; import { Errors } from './types'; import { ValidationPathSpec } from './errorManager'; export interface FormActions { yupContext: any; onSubmit: () => void; onReset: () => void; onValidate: (fields: Array<ValidationPathSpec | string>, event: string, args: any[]) => void; onFieldError: (name: string, errors: Errors) => void; formHasValidation: () => boolean; } export declare const BITS: { errors: number; touched: number; actions: number; submits: number; resets: number; }; export interface FormContextValue { touched: Record<string, boolean>; errors: Errors; actions: FormActions; submits: { submitCount: number; submitAttempts: number; submitting: boolean; }; resets: number; } export declare const FormContext: React.Context<FormContextValue>; export declare const useFormContext: (observedBits: number) => FormContextValue;