import { default as React, ReactNode } from 'react'; import { VALID_ICON_NAMES } from '../icons/iconNames'; import { IconName } from '../types/Icon.types'; export { VALID_ICON_NAMES }; type TextInputElement = HTMLInputElement | HTMLTextAreaElement; interface TextInputBaseProps { /** * Label used as input placeholder _and_ floating label. * Also wired to `aria-label` — when omitted, provide an accessible * name some other way (e.g. `aria-label` or `aria-labelledby`). */ label?: string; /** Sets the controlled value of the input */ value?: string | number; /** Sets the [uncontrolled](https://reactjs.org/docs/uncontrolled-components.html) value of the input */ defaultValue?: string | number; /** function that formats the input value on blur */ formatter?: (value: string) => string; /** Name of Narmi icon to place at the start of the input box */ startIcon?: IconName; /** Name of Narmi icon to place at the end of the input box */ endIcon?: IconName; /** JSX content slot at input start for custom buttons and icons */ startContent?: ReactNode; /** JSX content slot at input end for custom buttons and icons */ endContent?: ReactNode; /** Display an X at the end of label that clears input and calls onChange on click. */ showClearButton?: boolean; /** Applies search styling to the input box (forwarded to the base Input) */ search?: boolean; /** When false, the consumer can take full control over where the error renders */ renderError?: boolean; /** Text of error message to display under the input */ error?: string | string[] | null; /** Maximum number of characters allowed in the input */ maxLength?: number; /** Optional value for `data-testid` attribute */ testId?: string; /** Native `type` of the input element; ignored when `multiline` is set */ type?: "text" | "tel" | "number" | "email" | "password" | "search" | "time" | "date" | "datetime-local"; /** Native element prop passed to the underlying input/textarea element. Defaults to false. */ required?: boolean; /** * Form-integration key read by parent form wrappers (e.g. cerulean * `ContextForm.Field`) via element props. Not used by this component * and not forwarded to the DOM. */ field?: string; } type OverriddenNativeKeys = "onChange" | "onBlur" | "type" | "value" | "defaultValue" | "children" | "maxLength" | "required"; export interface SingleLineTextInputProps extends TextInputBaseProps, Omit, OverriddenNativeKeys> { /** When true, the input is displayed as an auto-growing textarea */ multiline?: false; /** Callback invoked with event object on input change */ onChange?: React.ChangeEventHandler; /** Callback invoked with event object on input blur */ onBlur?: React.FocusEventHandler; } export interface MultilineTextInputProps extends TextInputBaseProps, Omit, OverriddenNativeKeys> { /** When true, the input is displayed as an auto-growing textarea */ multiline: true; /** Callback invoked with event object on textarea change */ onChange?: React.ChangeEventHandler; /** Callback invoked with event object on textarea blur */ onBlur?: React.FocusEventHandler; } export type TextInputProps = SingleLineTextInputProps | MultilineTextInputProps; /** * Narmi flavored text input with floating label */ declare const TextInput: React.ForwardRefExoticComponent>; export default TextInput; //# sourceMappingURL=index.d.ts.map