@lunit/oui
Version:
Lunit Oncology UI components
31 lines (30 loc) • 1.42 kB
TypeScript
import type { BoxProps, InputProps as MuiInputProps } from '@mui/material';
import type { RootTextFieldProps, HelperMsgProps } from '../BaseTextField/BaseTextField.types';
interface RootTextInputProps extends RootTextFieldProps, Omit<MuiInputProps, 'size' | 'error' | 'ref' | 'value' | 'defaultValue' | 'onChange'> {
large?: boolean;
leftIcon?: React.ReactNode;
rightIcon?: React.ReactNode;
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
OuterBoxProps?: BoxProps;
InputContainerProps?: BoxProps;
inputSX?: MuiInputProps['sx'];
}
interface InputWithHelperMsgProps extends Omit<RootTextInputProps, 'error'>, Omit<HelperMsgProps, 'error'> {
error?: string;
}
interface PasswordInputWithHelperMsgProps extends Omit<InputWithHelperMsgProps, 'rightIcon' | 'readOnly' | 'onClearButtonClick' | 'InputContainerProps'> {
type: 'password';
}
interface NormalTextInputProps extends InputWithHelperMsgProps {
onClearButtonClick?: () => void;
rightIcon?: React.ReactNode;
}
interface FileInputProps extends NormalTextInputProps {
type: 'file';
accept: string;
onClick: () => void;
}
interface PasswordTextInputProps extends PasswordInputWithHelperMsgProps {
}
type TextInputProps = PasswordTextInputProps | NormalTextInputProps | FileInputProps;
export type { TextInputProps, NormalTextInputProps, PasswordTextInputProps, FileInputProps, RootTextInputProps, };