UNPKG

@paradise-ui/text-field

Version:

An enhanced version of common <input> component

44 lines (41 loc) 1.37 kB
import { InputHTMLAttributes, ReactNode } from 'react'; import { ComponentSize } from '@paradise-ui/common'; type TextFieldVariant = 'outlined' | 'line' | 'filled'; type TextFieldType = 'text' | 'number' | 'email' | 'url' | 'password' | 'search' | 'tel'; interface TextFieldElementClass { root?: string; labelBlock?: string; label?: string; secondaryLabel?: string; inputBlock?: string; inputPrefix?: string; input?: string; inputSuffix?: string; messageBlock?: string; helperText?: string; errorMessage?: string; [key: string]: string | undefined; } interface TextFieldElementClassProps extends TextFieldProps { focus?: boolean; [key: string]: unknown; } interface TextFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'prefix' | 'size' | 'type'> { label?: ReactNode; secondaryLabel?: ReactNode; variant?: TextFieldVariant; size?: ComponentSize; name?: string; className?: string; type?: TextFieldType; placeholder?: string; invalid?: boolean; disabled?: boolean; value?: string; prefix?: ReactNode; suffix?: ReactNode; helperText?: ReactNode; errorMessage?: ReactNode; onChange?: (value: string) => void; } export type { TextFieldElementClass, TextFieldElementClassProps, TextFieldProps, TextFieldType, TextFieldVariant };