import * as _angular_core from '@angular/core'; import { OnInit, OnDestroy, OnChanges, AfterViewInit, DoCheck, InputSignal, Signal, WritableSignal, TemplateRef, QueryList, ElementRef, SimpleChanges } from '@angular/core'; import * as i1 from '@eui/components/shared'; import { ControlValueAccessor, FormControl, AbstractControl } from '@angular/forms'; import { BehaviorSubject } from 'rxjs'; import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling'; import { CdkDragDrop, CdkDragStart, CdkDragRelease } from '@angular/cdk/drag-drop'; import { EuiChipTooltip, EuiChip } from '@eui/components/eui-chip'; import { EuiTemplateDirective } from '@eui/components/directives'; /** * @description * Option group component for organizing `eui-autocomplete` options into labeled sections. * Used internally by `eui-autocomplete` when groupBy property is configured on the parent. * Provides semantic grouping with ARIA optgroup role for accessibility. * Automatically renders group headers based on the groupBy property path. * Content is projected via ng-content to contain individual `eui-autocomplete-option` components. * Not intended for direct use in templates - managed internally by eui-autocomplete. * * @usageNotes * This component is used internally when groupBy is configured on eui-autocomplete: * ```html * * * ``` * * ```ts * countries: EuiAutoCompleteItem[] = [ * { id: 1, label: 'China', metadata: { continent: 'Asia' } }, * { id: 2, label: 'Japan', metadata: { continent: 'Asia' } }, * { id: 3, label: 'France', metadata: { continent: 'Europe' } }, * { id: 4, label: 'Germany', metadata: { continent: 'Europe' } } * ]; * // Results in two groups: "Asia" and "Europe" * ``` * * ### Accessibility * - Uses role="optgroup" for proper ARIA semantics * - Group label is announced by screen readers before grouped options * - Provides clear visual and semantic separation between option categories * - Keyboard navigation flows naturally through grouped options * * ### Notes * - Automatically created by parent autocomplete when groupBy is set * - groupBy supports nested property paths using dot notation * - Groups are sorted alphabetically by default * - Empty groups are automatically filtered out * - Group labels are extracted from the data structure, not manually specified * - Component is automatically instantiated by parent autocomplete */ declare class EuiAutocompleteOptionGroupComponent { /** * ARIA role for the host element to ensure proper accessibility. * @default 'optgroup' */ role: string; /** * @description * Computes and returns the CSS classes for the component based on its current state. * * @returns {string} Space-separated string of CSS class names */ get cssClasses(): string; /** * Text label displayed as the group header. * Identifies the category or section name for the grouped options. * Required for proper group identification. */ label: _angular_core.InputSignal; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } /** * @description * Component used internally by `eui-autocomplete` to display individual options in the dropdown panel. * Represents a single selectable item with support for active, disabled, and grouped states. * Automatically rendered by the parent autocomplete component based on autocompleteData. * Supports visual variants through BaseStatesDirective for custom styling. * Not intended for direct use in templates - managed internally by eui-autocomplete. * * @usageNotes * This component is used internally by eui-autocomplete. Configure options via the parent component: * ```html * * ``` * * ```ts * items: EuiAutoCompleteItem[] = [ * { id: 1, label: 'Option 1' }, * { id: 2, label: 'Option 2', isDisabled: true }, * { id: 3, label: 'Option 3', variant: 'success' } * ]; * ``` * * ### Accessibility * - Uses role="option" for proper ARIA semantics within listbox * - Active state is visually indicated and announced to screen readers * - Disabled options are not selectable and announced as disabled * - Keyboard navigation automatically highlights active option * * ### Notes * - isActive indicates the currently focused/highlighted option during keyboard navigation * - isDisabled prevents selection and applies disabled styling * - isGroupItem applies special styling when option is within a group * - Visual variants (euiVariant) can be applied for custom option styling * - Component is automatically instantiated by parent autocomplete */ declare class EuiAutocompleteOptionComponent { /** * ARIA role for the host element to ensure proper accessibility. * @default 'option' */ role: string; /** * @description * Computes and returns the CSS classes for the component based on its current state. * * @returns {string} Space-separated string of CSS class names */ get cssClasses(): string; /** * Whether the option is active in the panel. * * @default false */ isActive: _angular_core.InputSignalWithTransform; /** * Whether the option is disabled in the panel. * * @default false */ isDisabled: _angular_core.InputSignalWithTransform; /** * Whether the option is displayed inside a group. * * @default false */ isGroupItem: _angular_core.InputSignalWithTransform; private baseStatesDirective; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } interface EuiAutoCompleteItem { id?: string | number; euiInternalId?: string; label: string; typeClass?: 'primary' | 'secondary' | 'info' | 'success' | 'warning' | 'danger' | 'accent'; variant?: 'primary' | 'secondary' | 'info' | 'success' | 'warning' | 'danger' | 'accent'; sizeClass?: 'euiSizeS' | 'euiSizeM' | 'euiSizeL' | 'euiSizeXL' | 'euiSize2XL'; iconClass?: string; isRemovable?: boolean; isOutline?: boolean; isRounded?: boolean; dragAndDropSource?: string; isDisabled?: boolean; iconSvgName?: string; tooltip?: EuiChipTooltip; metadata?: METADATA; [id: string]: any; } interface EuiChipDragDrop { type: string; chip: EuiChip; chips: EuiChip[]; } /** * @description * `eui-autocomplete` component with dropdown suggestions, optional chip display for multiple selections, and comprehensive keyboard navigation. * Provides type-ahead functionality with filtering, grouping, sorting, and async data support. * Implements ControlValueAccessor for Angular forms integration with validation support. * `eui-autocomplete` supports single or multiple selection modes with chips for visual representation of selected items. * Built on Angular CDK Overlay for positioning and virtual scrolling for performance with large datasets. * `eui-autocomplete` includes accessibility features with ARIA attributes, live announcer, and keyboard navigation. * * @usageNotes * #### Basic single selection * ```html * * ``` * * #### Multiple selection with chips * ```html * * * ``` * * #### With grouping and async data * ```html * * * ``` * * #### In reactive form with validation * ```html * * * ``` * * ```ts * fruits: EuiAutoCompleteItem[] = [ * { id: 1, label: 'Apple' }, * { id: 2, label: 'Banana' }, * { id: 3, label: 'Orange' } * ]; * * onSelectionChange(items: EuiAutoCompleteItem[]): void { * console.log('Selected:', items); * } * ``` * * ### Accessibility * - Uses ARIA live announcer to announce option navigation for screen readers * - Keyboard navigation: Arrow Up/Down to navigate options, Enter to select, Escape to close * - Tab key closes panel and optionally adds chip (with isAddOnBlur) * - Backspace removes last chip when input is empty (chipsPosition='inside') * - aria-required attribute automatically set when used with Validators.required * - Each option has role="option" for proper screen reader identification * - Panel positioning adjusts automatically to stay within viewport * * ### Notes * - Each EuiAutoCompleteItem must have unique `id` and `label` properties * - Use hasChips for multiple selection mode, omit for single selection * - chipsPosition options: 'top' (default), 'bottom', 'inside' (chips within input) * - matching options: 'contains' (default) or 'startWith' for filtering behavior * - Set isForceSelection to require selection from available options only * - isFreeValueAllowed (default true) allows custom values not in the list * - Virtual scrolling automatically handles large datasets efficiently * - groupBy accepts nested property paths (e.g., 'metadata.category.name') * - Use isAsync with dynamic data loading, update autocompleteData when ready * - Chips can be drag-and-dropped when isChipsDragAndDrop is enabled * - Panel width defaults to input width, override with panelWidth property */ declare class EuiAutocompleteComponent implements OnInit, OnDestroy, ControlValueAccessor, OnChanges, AfterViewInit, DoCheck { /** * @description * Computes and returns the CSS classes for the component based on its current state. * * @returns {string} Space-separated string of CSS class names */ get cssClasses(): string; /** * Sets the id on the text input. */ inputId: InputSignal; /** * Datas to be used in the autocomplete. */ autocompleteData: InputSignal; /** * Sets the maximum number of options that will be visible in the autocomplete panel. * * @default 5 */ visibleOptions: _angular_core.InputSignalWithTransform; /** * Sets the way the options should be retrieved. * * @default 'contains' */ matching: InputSignal<'startWith' | 'contains'>; /** * Sets the placeholder of the text input. */ placeholder: InputSignal; /** * Sets the options that will be selected by default. */ autocompleteDataSelected: EuiAutoCompleteItem[]; /** * Sets the sort criteria of the chips. * * @type {('ASC' | 'DESC')} * @default 'ASC' */ chipsSortOrder: InputSignal<'ASC' | 'DESC'>; /** * In combination with `isChipsSorted`. Sets the sort criteria of the options in the panel. * * @type {('ASC' | 'DESC')} * @default 'ASC' */ itemsSortOrder: InputSignal<'ASC' | 'DESC'>; /** * In Combination with `isItemsSorted`. Sets the position of the chips relative to the text input. * * @type {('top' | 'bottom' | 'inside')} * @default 'top'' */ /** * @deprecated The 'inside' option will be removed in eUI 23. Please, use 'top' as default. */ chipsPosition: InputSignal<'top' | 'bottom' | 'inside'>; /** * Sets a grouping among the options. */ groupBy: InputSignal; /** * In combination with `maxVisibleChipsCount`, sets the label of the 'more label' button, if not provided an arrow right icon will be displayed only. */ toggleLinkMoreLabel: InputSignal; /** * In combination with `maxVisibleChipsCount`, sets the label of the 'less label' button, if not provided an arrow left icon will be displayed only. */ toggleLinkLessLabel: InputSignal; /** * Sets a CSS class to be added on the options panel container. */ classList: InputSignal; /** * Sets the width of the options panel. * * @type {(string | number)} */ panelWidth: InputSignal; /** * In combination with `hasChips`. Whether the user can add a value, which is not part of the options, to craete a chip. * * @default true */ isFreeValueAllowed: _angular_core.InputSignalWithTransform; /** * Whether autocomplete is in readonly mode. * * @default false */ isReadonly: _angular_core.InputSignalWithTransform; /** * Whether loading spinner is displayed in text input. * * @default false */ isLoading: _angular_core.InputSignalWithTransform; /** * Whether autocomplete will display the selected values with chips. * * @default false */ hasChips: _angular_core.InputSignalWithTransform; /** * Whether autocomplete will get the data asynchronously. * * @default false */ isAsync: _angular_core.InputSignalWithTransform; /** * Whether this chip is sorted on their label. * * @default false */ isChipsSorted: _angular_core.InputSignalWithTransform; /** * Whether this item in the panel is sorted on their label. * * @default false */ isItemsSorted: _angular_core.InputSignalWithTransform; /** * Whether the grops of items are sorted on their label. * * @default true */ isGroupSorted: _angular_core.InputSignalWithTransform; /** * Whether the chip can be removed from the selection. * When a chip is removed, its value goes back in the panel. * * @default true */ isChipsRemovable: _angular_core.InputSignalWithTransform; /** * Whether the chips can have multiple times the same value. * With this option, the value is not removed from the panel when choosen. * * @default false */ isDuplicateValueAllowed: _angular_core.InputSignalWithTransform; /** * In combination with `hasChips`. Whether the chip is added when the text input is blurred. * * @default false */ isAddOnBlur: _angular_core.InputSignalWithTransform; /** * In combination with `hasChips` and `isFreeValueAllowed=false`. Whether the text input is empty after blurring when no value has been selected in the panel. * * @default false */ isForceSelection: _angular_core.InputSignalWithTransform; /** * Whether a limited amount, defined by this option, is used to display the chips. */ maxVisibleChipsCount: _angular_core.InputSignalWithTransform; /** * Whether the chips label length is limited by the value of this option. */ chipsLabelTruncateCount: _angular_core.InputSignalWithTransform; /** * In combination with `maxVisibleChipsCount`. Whether all chips are shown by default. * * @default false */ isMaxVisibleChipsOpened: _angular_core.InputSignalWithTransform; /** * Whether the chips can be drag and dropped. * * @default false */ isChipsDragAndDrop: _angular_core.InputSignalWithTransform; readonly isVisibleChipsOpened: Signal; autocompleteOptions: WritableSignal[]>; selectedOptionIndex: number; autocompleteControl: FormControl; isDisabled: boolean; chips: EuiChip[]; distinctOptionGroups: string[]; groupedOptions: BehaviorSubject<{ [id: string]: { options: EuiAutoCompleteItem[]; ancestorLength: number; }; }>; globalOptionIndex: number; itemSize: number; autocompleteOptionTemplate: TemplateRef<{ $implicit: EuiAutoCompleteItem; }>; autocompleteOptGroupTemplate: TemplateRef<{ $implicit: { label: string; }; }>; templates: QueryList; templatePortalContent: TemplateRef; inputContainerRef: ElementRef; virtualScrolling: CdkVirtualScrollViewport; input: ElementRef; /** * Event emitted when the panel is closed. */ panelClose: _angular_core.OutputEmitterRef; /** * Event emitted when the panel is opened. */ panelOpen: _angular_core.OutputEmitterRef; /** * Event emitted when the text input gets the focus. */ inputFocus: _angular_core.OutputEmitterRef; /** * Event emitted when the text input is blurred. */ inputBlur: _angular_core.OutputEmitterRef; /** * Event emitted when the text input is cleared. */ clear: _angular_core.OutputEmitterRef; /** * Event emitted when an option is selected or when the selection is modified. */ selectionChange: _angular_core.OutputEmitterRef[]>; /** * Event emitted when an option is selected. */ itemAdd: _angular_core.OutputEmitterRef>; /** * Event emitted when an option is removed. */ itemRemove: _angular_core.OutputEmitterRef>; /** * Event emitted when the value of the text input changes. */ inputChange: _angular_core.OutputEmitterRef; /** * Event emitted when a chip drag starts. */ chipDragStart: _angular_core.OutputEmitterRef; /** * Event emitted when a chip drag is released. */ chipDragRelease: _angular_core.OutputEmitterRef; /** * Event emitted when a chip is dropped. */ chipDrop: _angular_core.OutputEmitterRef; protected hasAriaRequiredAttribute: boolean; private destroy$; private overlayRef; private isOpen$; private templatePortal; private keyboardOptionSelectorHandlerSubscription; private addOnBlurClickHandlerSubscription; private isForceSelectionSubscription; private keyboardSubscription; private autocompleteOptionsSubscription; private scrollDispatcherSubscription; private windowResizeSubscription; private value; private TOP; private BOTTOM; private preferredPositons; private overlay; private cd; private viewContainerRef; private elementRef; private liveAnnouncer; private scrollDispatcher; private euiAppShellService; private baseStatesDirective; private control; private platformId; private localIsMaxVisibleChipsOpened; private readonly injector; constructor(); get isChipsPositionInside(): boolean; ngOnChanges(c: SimpleChanges): void; ngOnInit(): void; ngDoCheck(): void; ngAfterViewInit(): void; ngOnDestroy(): void; /** * Calculates the height that the virtual scroll need to have. * * @type {number} */ get cdkVirtualScrollViewport(): number; /** * Returns the opening state of the panel. * * @type {boolean} */ get isOpen(): boolean; /** * Checks if autocomplete options are available. * * @returns {boolean} `true` if options are present, otherwise `false`. */ get hasOptionsResult(): boolean; toggleTags(): void; /** * Method that creates and opens the panel containing autocomplete options. */ openPanel(): void; /** * Closes the autocomplete panel. */ closePanel(): void; /** * Method called when an option is selected. * * @param e Selected option */ onOptionSelected(e: EuiAutoCompleteItem): void; /** * Method called when an option is added through the text input. * * @param value Value to add */ add(value: string): void; optionsTrackByFn(index: number, item: EuiAutoCompleteItem): string | number; writeValue(value: EuiAutoCompleteItem | EuiAutoCompleteItem[]): void; setDisabledState(isDisabled: boolean): void; registerOnChange(fn: () => void): void; registerOnTouched(fn: () => void): void; onClear(): void; /** * Text input focus handler. */ onFocus(): void; /** * Text input blur handler. */ onBlur(): void; /** * Called when a chip is removed. * * @param e Object containing the chip to remove. */ onChipRemove(chip: EuiChip): void; /** * Called when a chip is dropped for reordering or from a source to another. * * @param e Object containing the chip dropped. */ onChipDropped(e: CdkDragDrop): void; /** * Called when a chip is dragged for reordering or from a source to another. * * @param e Object containing the chip dragged. */ onChipDragStarted(e: CdkDragStart): void; /** * Called when a chip is released for reordering or from a source to another. * * @param e Object containing the chip released. */ onChipDragReleased(e: CdkDragRelease): void; /** * Calculates the item size for virtual scrolling. * * @returns a number representing the item size. */ private getItemSize; /** * Re-order options panel based on the input valuea and sort order. * * @param value Value to filter the options. * @param isItemsSorted If the items are sorted. */ private setOptions; /** * Return the position strategy for the panel. * * @returns A CDK position strategy. */ private getPositionStrategy; /** * Return the scroll strategy for the panel. * * @returns A CDK scroll strategy. */ private getScrollStrategy; /** * Refine the options based on the input value. * * @param inputValue Value to filter the options. * @returns An array of options. */ private filterOptions; /** * Converts EuiAutoCompleteItem array to EuiChip array. * * @param items Array of EuiAutoCompleteItem. * @returns An array of EuiChip */ private mapToChip; /** * Sort an array of objects based on their label. * * @param tab Array to order * @param sortOrder Sort order criteria * @returns A sorted array */ private orderArray; /** * Transforms array of EuiAutoCompleteItem into a grouped object. * * @param options Array of EuiAutoCompleteItem * @param groupBy Label of the group * @returns An object containing the grouped options and the distinct option groups. */ private groupingHandler; /** * Indicates if the origin element is visible in the scrollable parent. * * @param origin Origin of the autocomplete * @param scrollableParent Scrollable container * @returns A boolean, true if visible else false. */ private isVisible; private onChange; private onTouch; /** * Updates the `aria-required` attribute on the input element. * @private */ private updateInputAriaRequiredAttribute; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } /** * @description * Validator checking if the user choose the value in the panel. * * @returns A validator function that returns an error with the `isInData` to false and a list of invalid values if the validation * check fails, otherwise `null`. * * @usageNotes * ```html *
*
* * * @if (renderFormChips('autoCompleteChips')) { * Value in not part of the data * } *
*
* ``` * * ```ts * autocompleteDataFormChips: EuiAutoCompleteItem[] = [ * { id: 1, label: 'Ananas' }, * { id: 2, label: 'Apple' }, * { id: 3, label: 'Banana' }, * { id: 4, label: 'Blackberry' }, * { id: 5, label: 'Coconut' }, * { id: 6, label: 'Kiwi' }, * { id: 7, label: 'Lemon' }, * { id: 9, label: 'Lime' }, * { id: 10, label: 'Orange' }, * { id: 11, label: 'Strawberry' }, * { id: 12, label: 'Raspberry' }, * ] * * this.formChips = new FormGroup({ * autoCompleteChips: new FormControl(null, [euiAutocompleteForceSelectionFromData]), * }); * ``` */ declare const euiAutocompleteForceSelectionFromData: (control: AbstractControl) => { isInData: { isInData: boolean; invalidValues: EuiAutoCompleteItem | EuiAutoCompleteItem[]; }; } | null; declare const EUI_AUTOCOMPLETE: readonly [typeof EuiAutocompleteComponent, typeof EuiAutocompleteOptionComponent, typeof EuiAutocompleteOptionGroupComponent]; export { EUI_AUTOCOMPLETE, EuiAutocompleteComponent, EuiAutocompleteOptionComponent, EuiAutocompleteOptionGroupComponent, euiAutocompleteForceSelectionFromData }; export type { EuiAutoCompleteItem, EuiChipDragDrop }; //# sourceMappingURL=eui-components-eui-autocomplete.d.ts.map