UNPKG

sailboat-design

Version:
21 lines (20 loc) 1 kB
import React, { ReactNode } from 'react'; import FormItem from './formItem'; import { ValidateError } from 'async-validator'; import useStore, { FormState } from './useStore'; export declare type RenderProps = (form: FormState) => ReactNode; export interface FormProps { children?: ReactNode | RenderProps; name?: string; initialValues?: Record<string, any>; onFinish?: (values: Record<string, any>) => void; onFinishFailed?: (values: Record<string, any>, errors: Record<string, ValidateError[]>) => void; } export declare type IFormContext = Pick<ReturnType<typeof useStore>, 'dispatch' | 'fields' | 'validateField'> & Pick<FormProps, 'initialValues'>; export declare const FormContext: React.Context<IFormContext>; export declare const Form: React.ForwardRefExoticComponent<FormProps & React.RefAttributes<any>>; declare type CompoundedType = typeof Form & { Item: typeof FormItem; }; declare const Compounded: CompoundedType; export default Compounded;