import type { EventEmitter } from '../../stencil-public-runtime'; import type { IconName } from '../mud-icon/mud-icon.types'; import type { SearchInputChangeDetail, SearchInputSearchDetail, SearchInputShape, SearchInputSize } from './mud-search-input.types'; import type { LocaleProp } from '../../utils/locale'; /** * Search Input — single-line search-entry control. * * Pattern B (atom-interactive, form-associated): renders its own * `` inside shadow DOM. Adds a leading magnifying-glass * icon and an optional trailing clear `×` button that appears whenever the * control carries a value. Visual primitives (border, focus ring, label, * helper, sizes, states) are shared with `mud-text-input`; specific * affordances (icon-start, icon-end-clear, submit-button) live in the * `--search-input-*` token namespace. * * Per the Figma "Search Input" component the field has two silhouettes, * selected via the `shape` prop: * - `rectangular` (default) — corners use `borderRadius.8`. * - `circular` — corners flip to `borderRadius.full` (9999px), and the * trailing submit button becomes a perfect circle. * * Optional axes per Figma "Search Input": * - `loading` — async query is in flight; a trailing spinner appears next to * the value/placeholder and the control is announced as `aria-busy`. * - `with-button` — adds a trailing brand-blue submit button that fires * `mudSearch` on click. Coexists with the clear button and the loading * spinner. * * @element mud-search-input * * @slot label - Rich label content, replaces the `label` prop when present. * @slot helper - Rich helper / hint content, replaces the `helper-text` prop. * @slot icon-start - Leading icon override. Defaults to `mud-icon[name="search"]`. * @slot icon-end - Trailing slot. Suppresses the built-in clear `×` button when content is assigned here. */ export declare class MudSearchInput { /** * Silhouette. `rectangular` uses lightly-rounded corners; `circular` * renders a fully-rounded (pill) field with a circular submit button. * @default 'rectangular' */ shape: SearchInputShape; /** * Visual size rung. `md` is 40px tall, `lg` is 48px tall. * @default 'md' */ size: SearchInputSize; /** * Disables interactivity. The internal control receives the native * `disabled` attribute. * @default false */ disabled: boolean; /** * Marks the field as mandatory. Adds a red asterisk to the label and sets * `aria-required` on the internal control. * @default false */ required: boolean; /** * Shows the trailing clear `×` button when a value is present. Set to * `false` to suppress the affordance entirely (useful for always-on * filters). * @default true */ clearable: boolean; /** * Indicates an in-flight query. Keeps the leading magnifying-glass icon as * the role indicator and reveals a trailing brand-coloured `mud-spinner` * next to the value; the clear `×` is suppressed while the query is in * flight and the control is announced as `aria-busy`. The field stays * focusable; emitting `mudSearch` while loading is the consumer's * responsibility (typically debounced). * @default false */ loading: boolean; /** * Renders a trailing brand-blue submit button (the Figma "Button=True" * axis). Clicking the button — or pressing Enter inside the input — * dispatches `mudSearch` with the current value. When the field is empty * or disabled, the button enters a disabled visual state and does not * fire the event. * @default false */ withButton: boolean; /** * Language of the built-in copy. Unset, the component follows the closest ancestor `lang` * (`` included), else `ro-MD`. */ locale?: LocaleProp; /** * Accessible label for the trailing submit button. Overrides the `locale`'s copy when set * to a non-empty string. * @default 'Caută' (ro-MD) */ submitLabel?: string; /** * Validation message reported when the field is `required` and empty. Overrides the * `locale`'s copy when set to a non-empty string. * @default 'Completați acest câmp.' (ro-MD) */ requiredMessage?: string; /** * Current value of the control. Reflects to the host attribute. * @default '' */ value: string; /** Form-control `name`. Used during form submission. */ name?: string; /** Placeholder shown when the control is empty. */ placeholder?: string; /** Plain-text label. Use the `label` slot for richer content. */ label?: string; /** Plain-text helper / hint shown below the control. */ helperText?: string; /** * Icon name for the leading icon (rendered via the local SVG library). * Override by providing an element to the `icon-start` slot. * @default 'search' */ iconName: IconName; /** * Accessible label for the trailing clear button. Overrides the `locale`'s copy when set * to a non-empty string. * @default 'Șterge' (ro-MD) */ clearLabel?: string; /** Native `autocomplete` attribute forwarded to the internal control. */ autocomplete?: string; /** Native `maxlength` constraint. */ maxLength?: number; /** Native `minlength` constraint. */ minLength?: number; private hasLabelSlot; private hasHelperSlot; private hasIconStartSlot; private hasIconEndSlot; private isFocused; private fieldsetDisabled; /** The host's `aria-label` (attribute or native `ariaLabel` property), mirrored to the internal control when no visible label is present. */ private resolvedAriaLabel?; host: HTMLMudSearchInputElement; internals: ElementInternals; /** Fires on every keystroke. `detail.value` is the current control value. */ mudInput: EventEmitter; /** Fires when the value is committed (typically on `blur`). `detail.value` is the committed value. */ mudChange: EventEmitter; /** Fires when the user submits the query (Enter key or submit button). `detail.value` is the submitted query. */ mudSearch: EventEmitter; /** Fires when the value is cleared by the user (clear button or Escape key). */ mudClear: EventEmitter; /** Fires when the internal control gains focus. */ mudFocus: EventEmitter; /** Fires when the internal control loses focus. */ mudBlur: EventEmitter; private readonly instanceId; private readonly labelId; private readonly helperId; private initialValue; private nativeEl?; private stopAriaLabel?; private stopLang?; validateShape(next: SearchInputShape): void; validateSize(next: SearchInputSize): void; handleValueChange(next: string): void; handleRequiredChange(): void; handleLocaleChange(): void; connectedCallback(): void; disconnectedCallback(): void; /** Built-in strings in the resolved locale, with the override props on top. */ private messages; componentWillLoad(): void; /** * Reflects required + value into `ElementInternals` so the host participates * in native form validation. Anchored on the native input so a11y focus * lands on the visible control. */ formDisabledCallback(disabled: boolean): void; formResetCallback(): void; formStateRestoreCallback(state: string | File | FormData | null): void; private syncValidity; private onLabelSlotChange; private onHelperSlotChange; private onIconStartSlotChange; private onIconEndSlotChange; private slotHasContent; private handleInput; private handleChange; private handleFocus; private handleBlur; private handleKeyDown; private handleClearClick; private handleSubmitClick; private clearValue; private isInert; private hasVisibleLabel; private hasHelperMessage; private describedBy; private showClearButton; render(): any; }