react-form-with-constraints
Version:
Simple form validation for React
33 lines (32 loc) • 1.12 kB
TypeScript
import * as React from 'react';
import { Field } from './Field';
import { FormWithConstraintsChildContext } from './FormWithConstraints';
export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
innerRef?: React.Ref<HTMLInputElement>;
classes: {
[index: string]: string | undefined;
isPending?: string;
hasErrors?: string;
hasWarnings?: string;
hasInfos?: string;
isValid?: string;
};
}
interface InputState {
field: undefined | 'pending' | Field;
}
export declare type InputContext = FormWithConstraintsChildContext;
export declare class Input extends React.Component<InputProps, InputState> {
static contextTypes: React.ValidationMap<InputContext>;
context: InputContext;
static defaultProps: InputProps;
state: InputState;
componentDidMount(): void;
componentWillUnmount(): void;
fieldWillValidate: (fieldName: string) => void;
fieldDidValidate: (field: Field) => void;
fieldDidReset: (field: Field) => void;
fieldValidationStates(): string[];
render(): JSX.Element;
}
export {};