import TerraElement, { type TerraFormControl } from '../../internal/terra-element.js'; import TerraIcon from '../icon/icon.component.js'; import type { CSSResultGroup } from 'lit'; /** * @summary A text input component with consistent styling across the design system. * @documentation https://terra-ui.netlify.app/components/input * @status stable * @since 1.0 * * @dependency terra-icon * * @slot prefix - Used to prepend content (like an icon) to the input. * @slot suffix - Used to append content (like an icon) to the input. When `clearable` or `resettable` is true, this slot is overridden. * @slot clear-icon - An icon to use in lieu of the default clear icon. * @slot show-password-icon - An icon to use in lieu of the default show password icon. * @slot hide-password-icon - An icon to use in lieu of the default hide password icon. * @slot help-text - Text that describes how to use the input. Alternatively, you can use the `help-text` attribute. * * @event terra-input - Emitted when the input receives input. * @event terra-change - Emitted when an alteration to the control's value is committed by the user. * @event terra-focus - Emitted when the control gains focus. * @event terra-blur - Emitted when the control loses focus. * @event terra-invalid - Emitted when the form control has been checked for validity and its constraints aren't satisfied. * @event terra-clear - Emitted when the clear button is activated. * * @csspart base - The component's base wrapper. * @csspart input - The internal input control. * @csspart prefix - The container for prefix content. * @csspart suffix - The container for suffix content. * @csspart clear-button - The clear button. * @csspart password-toggle-button - The password toggle button. * @csspart form-control-help-text - The help text's wrapper. * @csspart form-control-error-text - The error text's wrapper. */ export default class TerraInput extends TerraElement implements TerraFormControl { static styles: CSSResultGroup; static dependencies: { 'terra-icon': typeof TerraIcon; }; private readonly formControlController; private readonly hasSlotController; input: HTMLInputElement; hasFocus: boolean; private validationErrorMessage; private __numberInput; private __dateInput; title: string; type: 'date' | 'datetime-local' | 'email' | 'number' | 'password' | 'search' | 'tel' | 'text' | 'time' | 'url'; name: string; value: string; placeholder: string; size: 'small' | 'medium' | 'large'; filled: boolean; pill: boolean; disabled: boolean; readonly: boolean; required: boolean; autocomplete?: string; minlength?: number; maxlength?: number; min?: number | string; max?: number | string; step?: number | 'any'; pattern?: string; inputMode: 'none' | 'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url'; label: string; hideLabel: boolean; helpText: string; errorText: string; clearable: boolean; passwordToggle: boolean; passwordVisible: boolean; noSpinButtons: boolean; autofocus: boolean; enterkeyhint?: 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send'; spellcheck: boolean; /** The default value of the form control. Primarily used for resetting the form control. */ defaultValue: string; /** * When true, shows a reset icon in the suffix that clears the input value when clicked. * The input will be reset to its `defaultValue` (or empty string if no defaultValue is set). */ resettable: boolean; /** * By default, form controls are associated with the nearest containing `