import * as i0 from '@angular/core';
import { InjectionToken, EventEmitter, TemplateRef, OnInit, PipeTransform, OnChanges, AfterViewInit, OnDestroy, ElementRef, QueryList, ChangeDetectorRef, Injector, ViewContainerRef, SimpleChanges } from '@angular/core';
import { MobileMode, MobileModeBase, MobileModeConfig } from '@fundamental-ngx/core/mobile-mode';
import { ControlValueAccessor } from '@angular/forms';
import { Nullable, DynamicComponentService, FocusTrapService, FocusEscapeDirection, AutoCompleteEvent } from '@fundamental-ngx/cdk/utils';
import { FormItemControl } from '@fundamental-ngx/core/form';
import { PopoverComponent } from '@fundamental-ngx/core/popover';
import { PopoverFillMode } from '@fundamental-ngx/core/shared';
import { RepositionScrollStrategy, Overlay } from '@angular/cdk/overlay';
import { SingleDropdownValueControl, FormStates } from '@fundamental-ngx/cdk/forms';
import { ContentDensityObserver } from '@fundamental-ngx/core/content-density';
import { IconFont } from '@fundamental-ngx/core/icon';
import { InputGroupComponent } from '@fundamental-ngx/core/input-group';
import { ListComponent, ListMessageDirective } from '@fundamental-ngx/core/list';
import { KeyValue } from '@angular/common';

interface ComboboxItem {
    item: any;
    index: number;
}

declare const COMBOBOX_COMPONENT: InjectionToken<string[]>;
/**
 * Combobox Interface to have typing and avoid circular dependency between
 * ComboboxComponent <==> ComboboxMobileComponent
 */
interface ComboboxInterface extends MobileMode {
    inputText: string;
    openChange: EventEmitter<boolean>;
    inShellbar: boolean;
    getValue(): any;
    dialogApprove(): void;
    dialogDismiss(backup: string): void;
}
interface ComboboxItemDirectiveContext<T = unknown> {
    $implicit: T;
    inputText: string;
}

declare class ComboboxItemDirective<T = unknown> {
    /**
     * @hidden
     * Used for type support.
     */
    fdComboboxItemUse: T;
    /** Template reference. */
    templateRef: TemplateRef<any>;
    /** @hidden */
    static ngTemplateContextGuard<T>(dir: ComboboxItemDirective<T>, ctx: ComboboxItemDirectiveContext<T>): ctx is ComboboxItemDirectiveContext<T>;
    static ɵfac: i0.ɵɵFactoryDeclaration<ComboboxItemDirective<any>, never>;
    static ɵdir: i0.ɵɵDirectiveDeclaration<ComboboxItemDirective<any>, "[fdComboboxItem]", never, { "fdComboboxItemUse": { "alias": "fdComboboxItemUse"; "required": false; }; }, {}, never, never, true, never>;
}

declare class ComboboxMobileComponent extends MobileModeBase<ComboboxInterface> implements OnInit {
    /** @hidden */
    dialogTemplate: TemplateRef<any>;
    /**
     * @hidden
     * For internal usage
     * Control element, which will be rendered inside dialog.
     * List element, which will be rendered inside dialog.
     */
    childContent: {
        listTemplate: TemplateRef<any>;
        controlTemplate: TemplateRef<any>;
    } | null;
    /** @hidden */
    private _selectedBackup;
    /** @hidden */
    constructor(comboboxComponent: ComboboxInterface);
    /** @hidden */
    ngOnInit(): void;
    /** @hidden */
    handleDismiss(): void;
    /** @hidden */
    handleApprove(): void;
    /** @hidden */
    private _toggleDialog;
    /** @hidden */
    private _listenOnMultiInputOpenChange;
    /** @hidden */
    private _open;
    /** @hidden */
    private _focusInputElementOnceOpened;
    static ɵfac: i0.ɵɵFactoryDeclaration<ComboboxMobileComponent, never>;
    static ɵcmp: i0.ɵɵComponentDeclaration<ComboboxMobileComponent, "fd-combobox-mobile", never, {}, {}, never, never, true, never>;
}

type GroupFunction<T = any> = (items: T[]) => {
    [key: string]: T[];
};
declare class ListGroupPipe<T = any> implements PipeTransform {
    /** Group items */
    transform(items: any[], group: GroupFunction<T>): KeyValue<string, T[]>[];
    static ɵfac: i0.ɵɵFactoryDeclaration<ListGroupPipe<any>, never>;
    static ɵpipe: i0.ɵɵPipeDeclaration<ListGroupPipe<any>, "listGroupPipe", true>;
}

/**
 * Allows users to filter through results and select a value.
 *
 * Supports Angular Forms.
 * ```html
 * <fd-combobox
 *      [(ngModel)]="searchTerm"
 *      [dropdownValues]="dropdownValues"
 *      placeholder="Type some text...">
 * </fd-combobox>
 * ```
 */
declare class ComboboxComponent<T = any> implements ComboboxInterface, SingleDropdownValueControl, ControlValueAccessor, OnInit, OnChanges, AfterViewInit, OnDestroy, FormItemControl {
    private readonly _overlay;
    private readonly _cdRef;
    private readonly _injector;
    private readonly _viewContainerRef;
    private readonly _dynamicComponentService;
    private readonly _focusTrapService;
    readonly _contentDensityObserver: ContentDensityObserver;
    /** Id for the Combobox. */
    comboboxId: string;
    /** Id attribute for input element inside Combobox component */
    inputId: string;
    /** Aria-label for Combobox. */
    ariaLabel: Nullable<string>;
    /** Aria-Labelledby for element describing Combobox. */
    ariaLabelledBy: Nullable<string>;
    /** If it is mandatory field */
    required: boolean;
    /** Values to be filtered in the search input. */
    dropdownValues: T[];
    /** Filter function. Accepts an array of objects and a search term as arguments
     * and returns a string. See search input examples for details. */
    filterFn: (contentArray: any[], searchTerm: any) => any[];
    /** Whether the search input is disabled. **/
    disabled: boolean;
    /** Placeholder of the search input. **/
    placeholder: string;
    /**
     * Whether the Combobox is a Search Field
     */
    isSearch: boolean;
    /** Icon to display in the right-side button. */
    glyph: string;
    /** Glyph font family */
    glyphFont: IconFont;
    /**
     * Whether to show the clear search term button
     */
    showClearButton: boolean;
    /**
     *  The trigger events that will open/close the options popover.
     *  Accepts any [HTML DOM Events](https://www.w3schools.com/jsref/dom_obj_event.asp).
     */
    triggers: string[];
    /** Whether the combobox should close, when a click is performed outside its boundaries. True by default */
    closeOnOutsideClick: boolean;
    /**
     * Whether the combobox should open, when any key is pressed in input (except Escape, Space, Enter). True by default
     */
    openOnKeyboardEvent: boolean;
    /**
     *  The state of the form control - applies css classes.
     *  Can be `success`, `error`, `warning`, `information` or blank for default.
     */
    state?: FormStates;
    /**
     * The template with which to display the individual listed items.
     * Use it by passing an ng-template with implicit content. See examples for more info.
     */
    itemTemplate: TemplateRef<ComboboxItemDirectiveContext<T>>;
    /**
     * Function used to handle grouping of items.
     */
    groupFn: Nullable<GroupFunction>;
    /** Max height of the popover. Any overflowing elements will be accessible through scrolling. */
    maxHeight: string;
    /** Max width of the dropdown in pixels. Default is 640px (40rem). */
    dropDownMaxWidthPx: number;
    /**
     * Whether the dropdown should have max width.
     * Set to true if you want the dropdown to take the width of the control.
     * Default is false */
    noDropDownMaxWidth: boolean;
    /** Custom width of the control. */
    width: Nullable<string>;
    /** Search function to execute when the Enter key is pressed on the main input. */
    searchFn: () => void;
    /** Whether the matching string should be highlighted during filtration. */
    highlighting: boolean;
    /** Whether the popover should close when a user selects a result. */
    closeOnSelect: boolean;
    /** Whether the input field should be populated with the result picked by the user. */
    fillOnSelect: boolean;
    /** Whether the autocomplete should be enabled; Enabled by default */
    autoComplete: boolean;
    /**
     * Preset options for the Select body width, whatever is chosen, the body has a 600px limit.
     * * `at-least` will apply a minimum width to the body equivalent to the width of the control. - Default
     * * `equal` will apply a width to the body equivalent to the width of the control.
     * * 'fit-content' will apply width needed to properly display items inside, independent of control.
     */
    fillControlMode: PopoverFillMode;
    /** Defines if combobox should behave same as dropdown. When it's enabled writing inside text input won't
     * trigger onChange function, until it matches one of displayed dropdown values. Also communicating with combobox
     * can be achieved only by objects with same type as dropdownValue */
    communicateByObject: boolean;
    /** Display function. Accepts an object of the same type as the
     * items passed to dropdownValues as argument, and outputs a string.
     * An arrow function can be used to access the *this* keyword in the calling component.
     * See search input examples for details. */
    displayFn: (str: any) => string;
    /**
     * Whether AddOn Button should be focusable
     * @default false
     */
    buttonFocusable: boolean;
    /**
     * Whether clear button should be focusable.
     * @default true
     */
    clearButtonFocusable: boolean;
    /** Whether the combobox is readonly. */
    readOnly: boolean;
    /** Whether the combobox should be built on mobile mode */
    mobile: boolean;
    /** Multi Input Mobile Configuration, it's applied only, when mobile is enabled */
    mobileConfig: MobileModeConfig;
    /** Whether to display the addon button. */
    showDropdownButton: boolean;
    /**
     * Whether to return results where the input matches the entire string. By default, only results that start
     * with the input search term will be returned.
     */
    includes: boolean;
    /**
     * The tooltip for the multi-input icon.
     */
    title: string;
    /** Whether list item options should be rendered as byline. */
    byline: boolean;
    /**
     * Action to perform when user shifts focus from the dropdown.
     * - `close` will close the dropdown preserving previously selected value.
     * - `closeAndSelect` will close the dropdown and select last focused dropdown item.
     */
    tabOutStrategy: 'close' | 'closeAndSelect';
    /** Event emitted when an item is clicked. Use *$event* to retrieve it. */
    readonly itemClicked: EventEmitter<ComboboxItem>;
    /** Event emitted, when the combobox's popover body is opened or closed */
    readonly openChange: EventEmitter<boolean>;
    /** Event emitted when the input text changes. */
    inputTextChange: EventEmitter<string>;
    /** @hidden */
    listComponent: ListComponent;
    /** @hidden */
    searchInputElement: ElementRef<HTMLInputElement>;
    /** @hidden */
    popoverComponent: PopoverComponent;
    /** @hidden */
    inputGroup: InputGroupComponent;
    /** @hidden */
    listMessages: QueryList<ListMessageDirective>;
    /** @hidden */
    controlTemplate: TemplateRef<HTMLElement>;
    /** @hidden */
    listTemplate: TemplateRef<HTMLElement>;
    /** @hidden */
    private readonly _comboboxItemRenderer;
    /** @hidden */
    private readonly items;
    /** When communicateByObject is true, specifies which property of the selected object
     * should be used as the form control value. If not specified, the entire object is returned.
     * Example: if dropdownValues = [{ displayedValue: 'Apple', code: 'A1' }] and valueProperty = 'code',
     * the form control value will be 'A1' instead of the entire object.
     * @default null
     */
    readonly valueProperty: i0.InputSignal<string | null>;
    /** Whether the matching string should be highlighted after combobox value is selected. */
    filterHighlight: boolean;
    /** Keys, that won't trigger the popover's open state, when dispatched on search input */
    readonly nonOpeningKeys: number[];
    /** @hidden */
    readonly _repositionScrollStrategy: RepositionScrollStrategy;
    /** @hidden */
    readonly _defaultFontFamily = "SAP-icons";
    /** Whether the combobox is opened. */
    open: boolean;
    /**
     * Whether or not the input coup is in the shellbar. Only for internal use by combobox component
     * @hidden
     */
    inShellbar: boolean;
    /** @hidden */
    displayedValues: any[];
    /** @hidden */
    inputTextValue: string;
    /** @hidden */
    clearInputBtnFocused: boolean;
    /** @hidden */
    get _customRenderer(): Nullable<TemplateRef<ComboboxItemDirectiveContext<T>>>;
    /** @hidden */
    _itemMousedown: boolean;
    /** @hidden */
    private _subscriptions;
    /** @hidden */
    private _value;
    /** @hidden */
    constructor(_overlay: Overlay, _cdRef: ChangeDetectorRef, _injector: Injector, _viewContainerRef: ViewContainerRef, _dynamicComponentService: DynamicComponentService, _focusTrapService: FocusTrapService, _contentDensityObserver: ContentDensityObserver);
    /** @hidden */
    onChange: (value: any) => void;
    /** @hidden */
    onTouched: () => void;
    /** @hidden */
    ngOnInit(): void;
    /** @hidden */
    ngOnChanges(changes: SimpleChanges): void;
    /** @hidden */
    ngOnDestroy(): void;
    /** @hidden */
    ngAfterViewInit(): void;
    /** @hidden */
    onInputKeydownHandler(event: KeyboardEvent | string): void;
    /** @hidden */
    onItemKeyDownHandler(event: KeyboardEvent, value: any): void;
    /** @hidden */
    onItemFocused(value: any): void;
    /** @hidden */
    onMenuClickHandler(value: any, shouldClosePopover?: boolean): void;
    /** Handle dialog dismissing, closes popover and sets backup data. */
    dialogDismiss(term: any): void;
    /** Handle dialog approval, closes popover and propagates data changes. */
    dialogApprove(): void;
    /** If true value empty */
    get isEmptyValue(): boolean;
    /** Input text of the input. */
    set inputText(value: string);
    get inputText(): string;
    /** Get the glyph value based on whether the combobox is used as a search field or not. */
    get glyphValue(): string;
    /** @hidden */
    _handleClearSearchTerm(): void;
    /** @hidden */
    writeValue(value: any): void;
    /** @hidden */
    registerOnChange(fn: (value: any) => void): void;
    /** @hidden */
    registerOnTouched(fn: () => void): void;
    /** Method passed to list component */
    handleListFocusEscape(direction: FocusEscapeDirection): void;
    /** @hidden */
    handleSearchTermChange(): void;
    /** @hidden */
    onPrimaryButtonClick(): void;
    /** @hidden */
    isOpenChangeHandle(isOpen: boolean): void;
    /** @hidden */
    setDisabledState(isDisabled: boolean): void;
    /** Method that handles complete event from auto complete directive, setting the new value, and closing popover */
    handleAutoComplete(event: AutoCompleteEvent): void;
    /** @hidden */
    handleBlur(): void;
    /** @hidden */
    clearInputBtnFocus(): void;
    /** @hidden */
    clearInputBtnBlur(): void;
    /** Current select value */
    getValue(): any;
    /** @hidden */
    _close(): void;
    /** @hidden */
    isSelected(term: any): boolean;
    /** @hidden */
    _getGroupItemIds(groupIndex: number): string;
    /** Method that picks other value moved from current one by offset, called only when combobox is closed */
    private _chooseOtherItem;
    /** Method that reset filtering for displayed values. It overrides displayed values by all possible dropdown values */
    private _resetDisplayedValues;
    /** @hidden */
    private _addShellbarClass;
    /** @hidden */
    private _defaultDisplay;
    /** @hidden */
    private _defaultFilter;
    /** @hidden */
    private _handleClickActions;
    /** @hidden */
    private _getOptionObjectByDisplayedValue;
    /** @hidden */
    private _refreshDisplayedValues;
    /** @hidden */
    private _propagateChange;
    /** @hidden */
    private setValue;
    /** @hidden */
    private _setUpMobileMode;
    /** @hidden */
    private _setupValueSynchronization;
    /** @hidden */
    private _syncDomValueToModel;
    static ɵfac: i0.ɵɵFactoryDeclaration<ComboboxComponent<any>, never>;
    static ɵcmp: i0.ɵɵComponentDeclaration<ComboboxComponent<any>, "fd-combobox", never, { "comboboxId": { "alias": "comboboxId"; "required": false; }; "inputId": { "alias": "inputId"; "required": false; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; }; "ariaLabelledBy": { "alias": "ariaLabelledBy"; "required": false; }; "required": { "alias": "required"; "required": false; }; "dropdownValues": { "alias": "dropdownValues"; "required": false; }; "filterFn": { "alias": "filterFn"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "isSearch": { "alias": "isSearch"; "required": false; }; "glyph": { "alias": "glyph"; "required": false; }; "glyphFont": { "alias": "glyphFont"; "required": false; }; "showClearButton": { "alias": "showClearButton"; "required": false; }; "triggers": { "alias": "triggers"; "required": false; }; "closeOnOutsideClick": { "alias": "closeOnOutsideClick"; "required": false; }; "openOnKeyboardEvent": { "alias": "openOnKeyboardEvent"; "required": false; }; "state": { "alias": "state"; "required": false; }; "itemTemplate": { "alias": "itemTemplate"; "required": false; }; "groupFn": { "alias": "groupFn"; "required": false; }; "maxHeight": { "alias": "maxHeight"; "required": false; }; "dropDownMaxWidthPx": { "alias": "dropDownMaxWidthPx"; "required": false; }; "noDropDownMaxWidth": { "alias": "noDropDownMaxWidth"; "required": false; }; "width": { "alias": "width"; "required": false; }; "searchFn": { "alias": "searchFn"; "required": false; }; "highlighting": { "alias": "highlighting"; "required": false; }; "closeOnSelect": { "alias": "closeOnSelect"; "required": false; }; "fillOnSelect": { "alias": "fillOnSelect"; "required": false; }; "autoComplete": { "alias": "autoComplete"; "required": false; }; "fillControlMode": { "alias": "fillControlMode"; "required": false; }; "communicateByObject": { "alias": "communicateByObject"; "required": false; }; "displayFn": { "alias": "displayFn"; "required": false; }; "buttonFocusable": { "alias": "buttonFocusable"; "required": false; }; "clearButtonFocusable": { "alias": "clearButtonFocusable"; "required": false; }; "readOnly": { "alias": "readOnly"; "required": false; }; "mobile": { "alias": "mobile"; "required": false; }; "mobileConfig": { "alias": "mobileConfig"; "required": false; }; "showDropdownButton": { "alias": "showDropdownButton"; "required": false; }; "includes": { "alias": "includes"; "required": false; }; "title": { "alias": "title"; "required": false; }; "byline": { "alias": "byline"; "required": false; }; "tabOutStrategy": { "alias": "tabOutStrategy"; "required": false; }; "valueProperty": { "alias": "valueProperty"; "required": false; "isSignal": true; }; }, { "itemClicked": "itemClicked"; "openChange": "openChange"; "inputTextChange": "inputTextChange"; }, ["_comboboxItemRenderer", "listMessages"], ["*", "*"], true, never>;
}

/**
 * @deprecated
 * Use `ComboboxComponent` import instead.
 */
declare class ComboboxModule {
    static ɵfac: i0.ɵɵFactoryDeclaration<ComboboxModule, never>;
    static ɵmod: i0.ɵɵNgModuleDeclaration<ComboboxModule, never, [typeof ComboboxComponent, typeof ComboboxItemDirective, typeof ListGroupPipe], [typeof ComboboxComponent, typeof ComboboxItemDirective, typeof ListGroupPipe]>;
    static ɵinj: i0.ɵɵInjectorDeclaration<ComboboxModule>;
}

declare const FD_COMBOBOX_COMPONENT: InjectionToken<ComboboxInterface>;

export { COMBOBOX_COMPONENT, ComboboxComponent, ComboboxItemDirective, ComboboxMobileComponent, ComboboxModule, FD_COMBOBOX_COMPONENT, ListGroupPipe };
export type { ComboboxInterface, ComboboxItem, ComboboxItemDirectiveContext, GroupFunction };
