import { IconProp } from '@fortawesome/fontawesome-svg-core'; import { Component, KeyboardEvent, MouseEvent } from 'react'; import { StyledComponentCSS } from '../../../core'; import { FormControlProps } from '../form.doc'; export declare type InputBorderStyle = 'box' | 'underline'; export declare type InputSize = 'large' | 'middle' | 'small' | 'compact'; export interface InputBoxStyleOptions { size?: InputSize; } export declare type InputBoxStyleGenerator = (options: InputBoxStyleOptions) => StyledComponentCSS; export interface InputUnderlineStyleOptions { size?: InputSize; withTopPlaceholder?: boolean; } export declare type InputUnderlineStyleGenerator = (options: InputUnderlineStyleOptions) => StyledComponentCSS; export declare type InputType = 'text' | 'password' | 'select'; export declare type InputValidator = (value: string, formDataMap?: Map) => void; export declare type GeneralInputValidator = InputValidator | InputRegexValidator; export interface InputChangeEvent { value: string; } export interface InputRegexValidator { regex: RegExp; message: string; } export interface IgnoreInvalidOptions { typingValidator: GeneralInputValidator; normalizer(value: string | undefined): string | undefined; } export interface InputProps extends FormControlProps { className?: string; /** * A function that throws `Error` with informative `message` or an object with * a regular expression and a violation message. */ validator?: GeneralInputValidator; /** * Defaults to `'box'`. TODO: consider make it part of the theme schema. */ border?: InputBorderStyle; /** * Defaults to `'middle'`. */ size?: InputSize; icon?: IconProp; /** * Placeholder when the value is `empty`. */ placeholder?: string; /** * Defaults to `'text'`. */ type?: InputType; autoComplete?: string; /** * To control the direction of the angleDown when type is 'select'. */ selecting?: boolean; normalizer?(value: string | undefined): string | undefined; onChange?(event: InputChangeEvent): void; onClick?(event: MouseEvent): void; onKeyDown?(event: KeyboardEvent): void; } export interface IInput extends Component { /** * Input 组件对应的 HTML 元素 */ element: HTMLElement; }