import React, { CSSProperties } from 'react'; import { TooltipDirection, TooltipLength } from './tooltip'; import { InputIcons } from './types/input-icons'; import { InputType } from './types/inputs'; import { Units } from './types/units'; import { Omit } from './types/utils'; export interface TextInputProps { children?: React.ReactNode; type: InputType; id: string; onChange: (event: any, value: string | number) => void; value?: string | number; name?: string; fullWidth?: boolean; icon?: InputIcons; inputRef?: React.MutableRefObject; isValid?: boolean; isRequired?: boolean; isDisabled?: boolean; isLarge?: boolean; isSearch?: boolean; label?: string; info?: React.ReactNode; onBlur?: (event: FocusEvent, value: string | number) => void; onFocus?: (event: FocusEvent, value: string | number) => void; resetValue?: string; style?: CSSProperties; step?: number; tooltip?: string | React.ReactElement; tooltipDirection?: TooltipDirection; tooltipLength?: TooltipLength; units?: Units; } /** * Inorder to allow for ...attributes we need to use * Partial> * to add all of those possible types. However, this component is * redefining the function definition for onBlur, onChange, and * onFocus so we must omit the original event hook from the possible props. */ export type HTMLInputElementProps = Partial, 'onBlur' | 'onChange' | 'onFocus'>>; export declare class TextInput extends React.Component { static defaultProps: { fullWidth: boolean; info: string; inputRef: React.RefObject; isDisabled: boolean; isLarge: boolean; isRequired: boolean; isSearch: boolean; isValid: boolean; label: string; onBlur: (...args: any[]) => void; onFocus: (...args: any[]) => void; style: React.CSSProperties; value: string; }; readonly state: { isInputFocused: boolean; }; constructor(props: TextInputProps & Partial>); get inputStyle(): React.CSSProperties; onValueChange(event: any): void; onInputBlur(event: any): void; onInputFocus(event: any): void; onReset(event: React.MouseEvent): void; render(): React.JSX.Element; } export type BaseProps = TextInputProps & HTMLInputElementProps; export declare class StatefulTextInput extends React.Component> { static defaultProps: Partial; readonly state: { value: string | number; }; onValueChange: (event: React.KeyboardEvent | React.MouseEvent) => void; render(): React.JSX.Element; }