UNPKG

2.32 kBTypeScriptView Raw
1import React, { ReactNode } from 'react';
2import { NativeProps } from '../../utils/native-props';
3declare type NativeInputProps = React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
4declare type AriaProps = {
5 role?: string;
6};
7export declare type InputProps = Pick<NativeInputProps, 'maxLength' | 'minLength' | 'autoComplete' | 'autoFocus' | 'pattern' | 'inputMode' | 'type' | 'name' | 'onFocus' | 'onBlur' | 'autoCapitalize' | 'autoCorrect' | 'onKeyDown' | 'onKeyUp' | 'onCompositionStart' | 'onCompositionEnd' | 'onClick' | 'step' | 'id' | 'placeholder' | 'readOnly' | 'disabled' | 'enterKeyHint'> & {
8 value?: string;
9 defaultValue?: string;
10 onChange?: (val: string) => void;
11 clearable?: boolean;
12 clearIcon?: ReactNode;
13 onlyShowClearWhenFocus?: boolean;
14 onClear?: () => void;
15 onEnterPress?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
16 min?: number;
17 max?: number;
18} & NativeProps<'--font-size' | '--color' | '--placeholder-color' | '--text-align'> & AriaProps;
19export declare type InputRef = {
20 clear: () => void;
21 focus: () => void;
22 blur: () => void;
23 nativeElement: HTMLInputElement | null;
24};
25export declare const Input: React.ForwardRefExoticComponent<Pick<NativeInputProps, "pattern" | "id" | "onClick" | "disabled" | "onCompositionEnd" | "onCompositionStart" | "onFocus" | "onBlur" | "onKeyDown" | "onKeyUp" | "type" | "step" | "autoFocus" | "placeholder" | "autoCapitalize" | "autoCorrect" | "inputMode" | "name" | "readOnly" | "autoComplete" | "enterKeyHint" | "maxLength" | "minLength"> & {
26 value?: string | undefined;
27 defaultValue?: string | undefined;
28 onChange?: ((val: string) => void) | undefined;
29 clearable?: boolean | undefined;
30 clearIcon?: ReactNode;
31 onlyShowClearWhenFocus?: boolean | undefined;
32 onClear?: (() => void) | undefined;
33 onEnterPress?: ((e: React.KeyboardEvent<HTMLInputElement>) => void) | undefined;
34 min?: number | undefined;
35 max?: number | undefined;
36} & {
37 className?: string | undefined;
38 style?: (React.CSSProperties & Partial<Record<"--color" | "--font-size" | "--placeholder-color" | "--text-align", string>>) | undefined;
39 tabIndex?: number | undefined;
40} & React.AriaAttributes & AriaProps & React.RefAttributes<InputRef>>;
41export {};
42
\No newline at end of file