import SlMenuItem from '../menu-item/menu-item.component.js'; import SlDropdown from '../dropdown/dropdown.component.js'; import SlMenu from '../menu/menu.component.js'; import SlInput from '../input/input.component.js'; import ShoelaceElement from '../../internal/shoelace-element.js'; import type { SlChangeEvent } from '../../events/sl-change.js'; import type { SlInputEvent } from '../../events/sl-input.js'; export interface Suggestion { text: string; value: string; } export interface SuggestionSource { (search: string): Promise; } /** * @since 2.0 * @status stable * @viur 0.5 * * @dependency sl-input * @dependency sl-dropdown * @dependency sl-menu * @dependency sl-menu-item * * @event {{ item: SlMenuItem }} sl-item-select - DEPRECATED - Emitted when a suggestion is selected. * @event {{ item: SlMenuItem }} sl-select - Emitted when a suggestion is selected. * @event sl-change - Emitted when the input's value changes. * @event sl-input - Emitted when the input receives input. * * @csspart base - The component's base wrapper, a sl-dropdown. * @csspart input - The sl-input component. * @csspart menu - The sl-menu component. * @csspart menu-item - The sl-menu-item component. */ export default class SlCombobox extends ShoelaceElement { static styles: import("lit").CSSResult; static dependencies: { 'sl-input': typeof SlInput; 'sl-dropdown': typeof SlDropdown; 'sl-menu': typeof SlMenu; 'sl-menu-item': typeof SlMenuItem; }; private comboboxId; private resizeObserver; input: HTMLInputElement; dropdown: SlDropdown; menu: SlMenu; activeItemIndex: number; suggestions: Array<{ text: string; value: string; }>; /** The current input */ value: string; /** The combobox's size. */ size: 'small' | 'medium' | 'large'; /** Draws a pill-style combobox with rounded edges. */ pill: boolean; /** The combobox's label. */ label: string; /** The combobox's name attribute. */ name: string; /** The combobox's help text. */ helpText: string; /** Adds a clear button when the input is populated. */ clearable: boolean; /** Enable this option to prevent the panel from being clipped when the component is placed inside a container with `overflow: auto|scroll`. */ hoist: boolean; /** The input's placeholder text. */ placeholder: string; /** The input's autofocus attribute. */ autofocus: boolean; /** Disables the combobox component. */ disabled: boolean; /** Message displayed when no result found. */ emptyMessage: string; /** The source property is a function executed on user input. The search result is displayed in the suggestions list. */ source?: SuggestionSource; /** If true the suggestions are shown even if the Input is empty */ openEmpty: boolean; connectedCallback(): void; disconnectedCallback(): void; firstUpdated(): void; clear(): void; ignoreInputClick(event: MouseEvent): void; handleInputKeyDown(event: KeyboardEvent): void; handleInputFocus: () => void; onItemSelected(event: CustomEvent): void; handleSlInput(event: SlInputEvent): void; resizeMenu(): void; handleSlChange(event: SlChangeEvent): void; prepareSuggestions(text: string): Promise; highlightSearchTextInSuggestions(items: Suggestion[], searchText: string): { text: string; value: string; }[]; activeDescendant(): string | null; menuItemId(index: number): string; render(): import("lit-html").TemplateResult; } declare global { interface HTMLElementTagNameMap { 'sl-combobox': SlCombobox; } }