import { ReactNode, ChangeEvent, FocusEvent, KeyboardEvent, MouseEvent, InputHTMLAttributes } from 'react'; import { INPUT_TYPES, InputSize, InputStatus } from './common'; import { InputWithHoverProps } from './utils/create-hover-feature'; type NativeInputProps = Omit, 'style' | 'size' | 'defaultValue' | 'prefix'>; export interface InputProps extends NativeInputProps, InputWithHoverProps { /** * 自定义 class */ className?: string; /** * 输入值 */ value?: string | number; /** * 默认值 */ defaultValue?: string | number; /** * 输入类型 */ type?: (typeof INPUT_TYPES)[number]; /** * 尺寸 * use config context `baseSize` as default */ size?: InputSize; /** * 是否禁用 */ disabled?: boolean; /** * 是否只读(样式与 disabled 一致) * @private 因为我们约定其语义和 disabled 一致 */ readOnly?: boolean; /** * 文本框状态 */ status?: InputStatus; /** * 提示内容,基本样式会跟随 status * * @private */ hint?: ReactNode; /** * 最大输入长度 * * @private */ maxLength?: number; /** * 是否提供清除按钮 */ withClear?: boolean; /** * 是否在 blur 时进行对 value 进行 trim */ trimOnBlur?: boolean; /** * 输入框内前缀 */ prefix?: ReactNode; /** * 输入框内后缀 */ suffix?: ReactNode; /** * 输入框组合的前缀部分 * * @private */ prepend?: ReactNode; /** * 输入框组合的后缀部分 * * @private */ append?: ReactNode; /** * 值变化时的回调 */ onChange?: (e: ChangeEvent | FocusEvent) => void; /** * 按下回车的回调 */ onPressEnter?: (e: KeyboardEvent) => void; /** * 按下按键的回调 */ onKeyDown?: (e: KeyboardEvent) => void; /** * 点击清除按钮的回调 */ onClickClear?: (e: MouseEvent) => void; /** * @private * 仅供内部组件使用 */ prefixInnerPadding?: number; /** * @private * 仅供内部组件使用 */ suffixInnerPadding?: number; } export declare const INPUT_PROP_VALUE_WARNING: string; /** * Input 对外 ref 暴露的接口(forwardRef + useImperativeHandle) * * 保留原 class 实例对外可用的 `focus` / `blur` / `select` 方法, * 以及原生 input 节点 `elemInput`(num-input / suggest / date-picker / * time-picker / rich-text 等消费方直接读取 `.elemInput`)。 */ export interface InputHandle { /** * focus input element */ focus(options?: FocusOptions): void; /** * blur input element */ blur(): void; /** * select input element */ select(): void; /** * 原生 input DOM 节点 */ elemInput: HTMLInputElement; } export declare const Input: import("react").ForwardRefExoticComponent>; export {};