import { Component, KeyboardEvent } from 'react'; import { OmitValueOfKey } from 'tslang'; import { UIComponentProps } from '../../../core'; import { FormControlProps } from '../form.doc'; import { InputBorderStyle, InputSize } from '../input'; export declare type TextAreaValidator = (value: string) => void; export declare type GeneralTextAreaValidator = TextAreaValidator | TextAreaRegexValidator; export interface TextAreaChangeEvent { value: string; } export interface TextAreaRegexValidator { regex: RegExp; message: string; } export interface AutoSizing { minRows: number; maxRows?: number; } export interface TextAreaFormatterData { value: string; cursorOffset: number; } interface TextAreaEventHandlers { onChange?(event: TextAreaChangeEvent): void; onFocus?(): void; onBlur?(): void; onEnter?(event: KeyboardEvent): void; onEsc?(): void; } export interface TextAreaProps extends FormControlProps, TextAreaEventHandlers, OmitValueOfKey, Extract>> { className?: string; /** * Defaults to `'box'`. TODO: consider make it part of the theme schema. */ border?: InputBorderStyle; /** * Defaults to `'middle'`. */ size?: InputSize; /** * A function that throws `Error` with informative `message` or an object with * a regular expression and a violation message. */ validator?: GeneralTextAreaValidator; /** * Placeholder when the value is `empty`. */ placeholder?: string; /** * Specify min/max rows of auto textarea size, or a boolean that works with * `rows` property as its `minRows`. Defaults to `true`. */ autoSizing?: AutoSizing | boolean; /** * If `autoSizing` is set to `true`, it specifies the min rows; otherwise the * fixed rows of the textarea. Defaults to `2`. */ rows?: number; disableNewLine?: boolean; /** * If `autoFocus` is set to `true`, the textarea will show up being focused. * Defaults to `false` */ autoFocus?: boolean; formatter?(data: TextAreaFormatterData): TextAreaFormatterData; } export interface ITextArea extends Component { } export {};