import { EventEmitter } from '../../stencil-public-runtime'; import { AutocompleteType } from "../../type/autocomplete"; import { InputTextType, InputControlsLayoutType, InputControlsIconType, InputSizeType, MdsInputEventDetail } from "../../type/input"; import { ThemeInputVariantType } from "../../type/variant"; import { TypographyInputType } from "../../type/typography"; import { InputTipItemVariantType } from "../../type/input-tip"; import { MdsValidationErrors, MdsValidatorFn } from './meta/validators'; export interface MdsInputInterface { autocomplete?: AutocompleteType; autofocus?: boolean; controlsIcon?: InputControlsIconType; controlsLayout?: InputControlsLayoutType; datalist?: string[]; disabled?: boolean; icon?: string; max?: string; maxLength?: number; min?: string; minLength?: number; name?: string; pattern?: string; placeholder?: string; readOnly?: boolean; required?: boolean; step?: string; tabindex?: number; tip?: string; type: InputTextType; typography?: TypographyInputType; value?: string; variant?: ThemeInputVariantType; } /** * @part color-picker-button - Selects the button that opens the colour picker of a `color` field * @part counter-button-decrease - Selects the button used to decrease the input value * @part counter-button-increase - Selects the button used to increase the input value * @part field - Selects the native input field used by the component * @part mic-toggle-button - Selects the button that starts and stops the speech to text * @part password-toggle-button - Selects the button used to show or hide password * @part password-mask-items - Selects the items wrapper used to mask the password * @part password-mask-item - Selects the item used to mask the password * @part tip-count - Selects the mds-input-tip-item shown when maxlength attribute is set, can be used to hide it if needed * @part tip-top - Selects the verbose status of input on top of element * @part tip-bottom - Selects the verbose status of input on bottom of element * @category forms */ export declare class MdsInput { private nativeInput?; private tabindex?; private defaultValue; private inputValidation; private customValidators; private isValid; private validated; private speechToTextLabelKey; private speechToTextIcon; private recognition; private speechButton; private colorPicker?; private datalistId; el: HTMLMdsInputElement; hasFocus: boolean; isRecording: boolean; currentLengthLabel: string; countVariant: InputTipItemVariantType; isPasswordVisible: boolean; private colorText; private t; internals: ElementInternals; private formDisabled; /** * The accessible name of the native control: the label a screen reader announces. An * `mds-input-field` around the component passes its own label down here, so the attribute * is only written by hand when the input stands on its own. The placeholder is deliberately * not a fallback: it disappears as soon as the field is filled. */ readonly accessibleName?: string; /** * Specifies whether the element should have autocomplete enabled */ readonly autocomplete?: AutocompleteType; /** * Specifies that the element should automatically get focus when the page loads */ readonly autofocus: boolean; /** * Specifies if the spinner icon is shown, replacing the icon if present. A `color` field keeps * its swatch, which shows the value, and shows the spinner at its end, before the picker button * (read-only or disabled, the field has no picker button and the spinner takes the end) */ readonly await: boolean; /** * Specifies the layout of the counter buttons when the input type is set to `number`: stacked at * the end (`vertical`) or one at each end (`horizontal`). A read-only or disabled field has no * counter buttons, and its text takes the room they leave */ readonly controlsLayout?: InputControlsLayoutType; /** * Specifies the icon type of the counter buttons when the input type is set to `number` */ readonly controlsIcon?: InputControlsIconType; /** * A list of search terms to be searched from the input field, * it should be used with type="search" input. */ readonly datalist?: string[]; /** * If true, the element is displayed as disabled. The buttons that change the value (the counter * buttons of a number, the microphone, the picker of a colour) are not shown: the end of the * field is left to the badge of its state */ readonly disabled?: boolean; /** * An icon displayed at the left of the input, inside the field; the spinner of `await` takes * its place. A `color` field ignores it: its swatch stands there, one mark at the start */ icon?: string; /** * Specifies the maximum value, with `type="number"` or `type="date"`: a number, or a date in ISO * format (YYYY-MM-DD) such as `2046-12-04` * @example '180' */ readonly max?: string | number; /** * Specifies the maximum number of characters allowed in an element. * Use it with input type="text". * If maxlength is set to 0 or a negative number it will be considered as undefined. */ maxlength?: number; /** * Toggles text recognition. A read-only or disabled field has no dictation button. A `color` * field ignores it: a colour code is typed or picked, not dictated, and its end holds the button * of the picker */ readonly mic?: boolean; /** * Specifies the minimum value, with `type="number"` or `type="date"`: a number, or a date in ISO * format (YYYY-MM-DD) such as `1988-04-15` * @example '-3' */ readonly min?: string | number; /** * Specifies the minimum number of characters allowed in an element * use it with input type="number" */ readonly minlength?: number; /** * Is needed to reference the form data after the form is submitted */ readonly name?: string; /** * Specifies a regular expression the whole value has to match, as the pattern attribute of a * native input: a value that does not match stops the submit of the form * @example '[0-9]{5}' */ readonly pattern?: string; /** * Specifies a short hint that describes the expected value of the element */ readonly placeholder?: string; /** * Specifies that the element is read-only. The buttons that change the value (the counter * buttons of a number, the microphone, the picker of a colour) are not shown, as on a disabled * field; the password toggle stays, since it shows the value without changing it */ readonly readonly?: boolean; /** * Specifies that the element must be filled out before submitting the form */ readonly required?: boolean; /** * Sets the variant of the input field */ variant?: ThemeInputVariantType; /** * Sets the word(s) of the tip of the input field */ readonly tip?: string; /** * Specifies the height of the field, the same as `mds-button`: `sm` 28px, `md` 36px, `lg` 48px. * A textarea keeps its own height (`--mds-input-textarea-min-height`) */ readonly size?: InputSizeType; /** * Specifies the interval between legal numbers in an input field * @example '0.01' */ readonly step?: string; /** * Specifies the type of input element. `color` holds a colour: the field stays a text field, * where the code is typed and validated, with a swatch of the colour at its start and a button * at its end that opens the colour picker of the platform. Its value, in the change event and * in the form, is the colour as * `#rrggbb` in lower case, or `''` while the text is empty or names no colour, which is a * validation error; the text also takes `#rgb` and the code without `#`, in any case, and is * written back as `#rrggbb` when the field is left */ readonly type?: InputTextType; /** * Specifies the typography of input element */ typography: TypographyInputType; /** * Specifies the value of the input element. With `type="color"`, a colour as `#rrggbb`: a value * set as `#rgb`, without `#` or in upper case is written so, and one that names no colour is * shown as it is, with its error, while the value becomes `''` */ value: string; /** * Emits an InputChangeEventDetail when the value of the input element changes */ changeEvent: EventEmitter; /** * Emits a KeyboardEvent when a keyboard key is pressed on the focused input element */ keyDownEvent: EventEmitter; /** * Emits a void event when input element is blurred */ blurEvent: EventEmitter; /** * Emits a void event when input element is focused */ focusEvent: EventEmitter; /** * Emits a void event when input speech recognition ends */ speechEvent: EventEmitter; /** * Emits a boolean event when a input execute validation */ validationEvent: EventEmitter; formDisabledCallback(disabled: boolean): void; private isDisabled; private canEdit; /** * Like a native input, a form reset brings back the value of load and forgets the validation * shown on blur: the field looks pristine until the next blur. */ formResetCallback(): void; connectedCallback(): void; componentWillLoad(): void; /** A colour field (`type="color"`): its text is typed and validated, its value is its colour. */ private isColor; /** * What the validators check: the value, or the text of a colour field while it names no colour * (its value is `''` then), so that it fails the colour validator instead of passing for an * empty field. */ private checkedValue; /** * Shows a text in a colour field and takes its colour as the value, as at load and on reset: a * colour written as `#rrggbb`, any other text as it is, with the value `''`. */ private showColor; /** * Keeps the text of a colour field with its value when the value changes. The value of the text * leaves the text alone, as the user typed it until they leave the field; any other comes from * outside (code, a framework) and is shown, as `#rrggbb` when it is a colour. A value that is * no `#rrggbb` is set again to its colour, or to `''`, as a native input sanitizes its value * (HTML, value sanitization of the color and number types). Returns true when it sets the value * again, whose watcher goes on in its place. */ private syncColorText; componentDidLoad(): void; componentDidRender(): void; /** * Builds the validators from scratch: the ones of the type, the ones of the constraint props and * the custom ones. A rebuild instead of an append, so that a rule changed after load replaces * the old one instead of stacking on it. */ private buildValidation; /** * As on a native input, `pattern` constrains the text types, not a number, a date, a time or a * colour, whose format is fixed. */ private patternApplies; /** The number held by `min` or `max`, `undefined` when the prop is unset or not a number. */ private numericBound; /** * Reports the validity of the value to the form, decided by the same validators that drive the * variant: like a native `required`, an invalid field stops the submit of its form. Runs on every * change of the value or of the rules, not on blur: the form can be submitted without a blur. */ private updateFormValidity; /** * A submit stopped by an invalid field, or a `checkValidity()` of its form, validates the field * as a blur does, so that it shows what is wrong. */ protected invalidHandler(): void; /** * Rebuilds the validators when a prop they derive from changes after load, as it does with the * React wrappers under SSR, which set the props on an element that has already loaded. */ protected validationRulesChanged(): void; /** A field that becomes a colour field shows its value as its text, and takes its colour. */ protected typeChanged(): void; /** * Emits the change event when the component value changes */ protected valueChanged(): void; /** * What follows a change of what the field holds: its value, or the text of a colour field, * which can change while the value stays `''`. */ private followValue; protected variantChanged(newValue: ThemeInputVariantType): void; private maxLengthChanged; /** * Adds a validator to the input. * @param validator the validator function to add */ addValidator(validator: MdsValidatorFn): Promise; /** * Removes a previously added validator from the input. * @param validator the validator function to remove */ removeValidator(validator: MdsValidatorFn): Promise; /** * Returns if validator is presen * @param validator validator to check if it is present * @returns if a validator is present or not, if no validator given, return if there are at least one validator */ hasValidator(validator?: MdsValidatorFn): Promise; /** * Returns the current validation errors, or `null` if the value is valid. * @returns the validation errors, or `null` when valid */ getErrors(): Promise; private validateInput; private countMaxLength; protected disabledChanged(newValue: boolean): void; protected readonlyChanged(): void; /** * A field that becomes read-only or disabled loses its dictation button, with which the user * would stop a dictation: one in progress stops at once, emitting `mdsInputSpeechEnd`. */ private stopLockedDictation; /** * Sets focus on the specified `my-input`. * Use this method instead * of the global `input.focus()`. */ setFocus(): Promise; /** * Returns the native `` element used under the hood. */ getInputElement(): Promise; private onInput; /** * The text of a colour field, typed or picked: the value becomes its colour, or `''`, and its * watcher follows; a text that leaves the value as it was is followed here. */ private typeColor; /** * Opens the colour picker of the platform from its button, or from the swatch with the pointer, * on a field the user can change. The picker always holds a colour: black for an empty field, * the default of a native colour input. */ private openColorPicker; /** The colour picked writes the text and the value, as if typed: the same events follow. */ private onColorPick; private onKeyDown; private onBlur; private onFocus; private stepUp; private stepDown; private toggleTextRecognition; private readonly handlePasswordToggleClick; private onSpeechRecognitionError; private startRecognition; private stopRecognition; /** The buttons inside the field: the default `md` fits a 48px field, `sm` the smaller ones. */ private buttonSize; /** * The type of the native input: a colour field is a text field, where the code is typed (the * picker is the colour input under the swatch); a password shown is a text field too. */ private nativeType; /** The mark at the start of the field: the swatch of a colour field, else the icon or spinner. */ private hasLeadingMark; /** * The picker button of a colour field, shown while the user can change the value: a read-only * or disabled field offers no way to change it, as the swatch shows the colour, and leaves the * end of the field to the badge of its state (vittorio 2026-11-11: the button clashed with it). */ private hasColorPicker; /** * The dictation button, shown while the user can change the value: a read-only or disabled field * offers no way to change it, and leaves its end to the badge of its state, as a colour field * does with its picker button (vittorio 2026-11-11). */ private hasMicButton; /** * The counter buttons of a number, shown while the user can change the value: a read-only or * disabled number is a plain field, its text takes their room, and its end is left to the badge * of its state, as with the microphone (vittorio 2026-11-11, #1368). */ private hasSteppers; /** The mark at the end of the field: the microphone, or the picker button of a colour field. */ private hasTrailingMark; /** * The name of the picker button of a colour field: what it does, and for which field, since a * form can hold more than one colour field and each has a button of its own. */ private colorPickerName; render(): any; }