@ucloud-fe/react-components
Version:
UCloud react components
46 lines (45 loc) • 1.55 kB
TypeScript
import React, { InputHTMLAttributes, ReactNode } from 'react';
import { Size } from '../../type';
export interface DefinedInputProps {
/**
* @deprecated 使用 suffix 替换
* 图标,传入 string 时为图标类型,也可直接传入图标组件
*/
icon?: string | ReactNode;
/** 前缀 */
prefix?: ReactNode;
/** 后缀 */
suffix?: ReactNode;
/** 是否可清空 */
clearable?: boolean | {
autoFocus?: boolean;
callOnChange?: boolean;
};
/** 尺寸 */
size?: Size;
/** 状态 */
status?: 'default' | 'error' | string;
/** 展示变更为块占位 */
block?: boolean;
/** 点击 clear 按钮回调 */
onClear?: () => void;
/** 自定义样式 */
customStyle?: {
border?: string;
boxShadow?: string;
background?: string;
};
/** @ignore */
onFocus?: InputHTMLAttributes<HTMLInputElement>['onFocus'];
/** @ignore */
onBlur?: InputHTMLAttributes<HTMLInputElement>['onBlur'];
}
export declare type InputRef = {
/** input 焦点 */
focus: (options?: FocusOptions) => void;
/** input 元素 */
input?: HTMLInputElement | null;
};
export declare type InputProps = DefinedInputProps & Omit<InputHTMLAttributes<HTMLInputElement>, keyof DefinedInputProps>;
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<DefinedInputProps & Omit<React.InputHTMLAttributes<HTMLInputElement>, keyof DefinedInputProps> & React.RefAttributes<InputRef>>>;
export default _default;