UNPKG

@douyinfe/semi-ui

Version:

A modern, comprehensive, flexible design system and UI library. Connect DesignOps & DevOps. Quickly build beautiful React apps. Maintained by Douyin-fe team.

51 lines (50 loc) 2.16 kB
import React from 'react'; import { ValidateStatus } from '../_base/baseComponent'; import '@douyinfe/semi-foundation/lib/cjs/input/textarea.css'; type OmitTextareaAttr = 'onChange' | 'onInput' | 'prefix' | 'size' | 'onFocus' | 'onBlur' | 'onKeyDown' | 'onKeyPress' | 'onKeyUp' | 'onResize'; export type AutosizeRow = { minRows?: number; maxRows?: number; }; export interface TextAreaProps extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, OmitTextareaAttr> { autosize?: boolean | AutosizeRow; borderless?: boolean; placeholder?: string; value?: string; rows?: number; cols?: number; maxCount?: number; validateStatus?: ValidateStatus; defaultValue?: string; disabled?: boolean; readonly?: boolean; autoFocus?: boolean; showCounter?: boolean; showClear?: boolean; onClear?: (e: React.MouseEvent<HTMLTextAreaElement>) => void; onChange?: (value: string, e: React.MouseEvent<HTMLTextAreaElement>) => void; onBlur?: (e: React.FocusEvent<HTMLTextAreaElement>) => void; onFocus?: (e: React.FocusEvent<HTMLTextAreaElement>) => void; onInput?: (e: React.MouseEvent<HTMLTextAreaElement>) => void; onKeyDown?: (e: React.KeyboardEvent<HTMLTextAreaElement>) => void; onKeyUp?: (e: React.KeyboardEvent<HTMLTextAreaElement>) => void; onKeyPress?: (e: React.KeyboardEvent<HTMLTextAreaElement>) => void; onEnterPress?: (e: React.KeyboardEvent<HTMLTextAreaElement>) => void; onPressEnter?: (e: React.KeyboardEvent<HTMLTextAreaElement>) => void; onResize?: (data: { height: number; }) => void; getValueLength?: (value: string) => number; forwardRef?: ((instance: HTMLTextAreaElement) => void) | React.MutableRefObject<HTMLTextAreaElement> | null; disabledEnterStartNewLine?: boolean; } export interface TextAreaState { value: string; isFocus: boolean; isHover: boolean; height: number; minLength: number; cachedValue?: string; } declare const ForwardTextarea: React.ForwardRefExoticComponent<Omit<TextAreaProps, "forwardRef"> & React.RefAttributes<HTMLTextAreaElement>>; export default ForwardTextarea;