import type { FormFieldProps } from "../FormField"; import type { FocusEvents, HTMLInputBaseProps, KeyboardEvents, MouseEvents, RebuiltInputCommonProps } from "../sharedHelpers/types"; export interface RowRange { min: number; max: number; } /** * Character length constraint for inputs. * Only extend this for text-based inputs where character limits make sense. */ interface InputLengthConstraint { /** * The maximum number of characters supported by the input. * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefmaxlength} */ readonly maxLength?: number; } export interface InputTextProps extends HTMLInputBaseProps, MouseEvents, FocusEvents, KeyboardEvents, RebuiltInputCommonProps, InputLengthConstraint { /** * When false, the placeholder text only serves as a standard placeholder and * disappears when the user types, instead of floating above the value as a * mini label. * @default true */ readonly showMiniLabel?: boolean; /** * Use this when you're expecting a long answer. */ readonly multiline?: boolean; /** * Specifies the visible height of a long answer form field. Can be in the * form of a single number to set a static height, or an object with a min * and max keys indicating the minimum number of visible rows, and the * maximum number of visible rows. */ readonly rows?: number | RowRange; /** * Toolbar to render content below the input. */ readonly toolbar?: FormFieldProps["toolbar"]; /** * Determines the visibility of the toolbar. */ readonly toolbarVisibility?: FormFieldProps["toolbarVisibility"]; /** * The current value of the input. */ readonly value: string; /** * Custom onChange handler that provides the new value as the first argument. */ readonly onChange?: (newValue: string, event?: React.ChangeEvent) => void; /** * @deprecated Use `onKeyDown` or `onKeyUp` instead. */ readonly onEnter?: FormFieldProps["onEnter"]; } export {};