import { TextFieldSize } from '@mezzanine-ui/core/text-field'; import { MouseEventHandler, ReactNode } from 'react'; import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types'; /** * Padding info provided to children function */ export interface TextFieldPaddingInfo { /** * ClassName that applies the same padding as TextField's current size. * Use this when you want to move padding from TextField to input/textarea. */ paddingClassName: string; } /** * Base props shared by all TextField variants */ export interface TextFieldBaseProps extends Omit, 'children' | 'defaultValue' | 'onChange' | 'prefix'> { /** * Whether the field is active (focused/opened/expanded). * @default false */ active?: boolean; /** * The input/textarea element, or a function that receives padding info. * When using function form, TextField will not apply padding (you control it). */ children: ReactNode | ((paddingInfo: TextFieldPaddingInfo) => ReactNode); /** * Additional class name to apply to the root element. */ className?: string; /** * Whether to show the clear button. * @default false */ clearable?: boolean; /** * Force clear button visibility logic to ignore input value check. * @default false */ forceShowClearable?: boolean; /** * Whether to hide the suffix when the clear button is visible. * @default false */ hideSuffixWhenClearable?: boolean; /** * Whether the field is in error state. * @default false */ error?: boolean; /** * Whether the field should take the full width of its container. * @default true */ fullWidth?: boolean; /** * The callback will be fired after clear icon clicked. */ onClear?: MouseEventHandler; /** * The size of field. * @default 'main' */ size?: TextFieldSize; /** * Whether the field is in warning state. * @default false */ warning?: boolean; } /** * Affix props - prefix and suffix */ export type TextFieldAffixProps = { /** * The prefix addon of the field. */ prefix?: ReactNode; /** * The suffix addon of the field. */ suffix?: ReactNode; }; /** * Interactive state - typing, disabled, and readonly are mutually exclusive */ export type TextFieldInteractiveStateProps = { /** * Whether the user is currently typing. * If not provided, will be auto-detected. */ typing?: boolean; disabled?: never; readonly?: never; } | { typing?: never; /** * Whether the field is disabled. * @default false */ disabled: true; readonly?: never; } | { typing?: never; disabled?: never; /** * Whether the field is readonly. * @default false */ readonly: true; } | { typing?: never; disabled?: never; readonly?: never; }; export type TextFieldProps = TextFieldBaseProps & TextFieldAffixProps & TextFieldInteractiveStateProps; /** * The react component for `mezzanine` text field. */ declare const TextField: import("react").ForwardRefExoticComponent>; export default TextField;