import { Directionality } from '@angular/cdk/bidi';
import { SelectionModel } from '@angular/cdk/collections';
import { CdkConnectedOverlay, CdkOverlayOrigin, ConnectedPosition, OverlayContainer } from '@angular/cdk/overlay';
import { CdkVirtualForOf } from '@angular/cdk/scrolling';
import { AfterContentInit, AfterViewInit, ChangeDetectorRef, DestroyRef, DoCheck, ElementRef, EventEmitter, InjectionToken, NgZone, OnDestroy, OnInit, Provider, QueryList, Renderer2, TemplateRef } from '@angular/core';
import { ControlValueAccessor, FormGroupDirective, NgControl, NgForm } from '@angular/forms';
import { ActiveDescendantKeyManager } from '@koobiq/cdk/a11y';
import { CanUpdateErrorState, ErrorStateMatcher, KbqAbstractSelect, KbqComponentColors, KbqLocaleService, KbqOptgroup, KbqOption, KbqOptionBase, KbqOptionSelectionChange, KbqSelectMatcher, KbqSelectSearch, KbqSelectTrigger } from '@koobiq/components/core';
import { KbqCleaner, KbqFormField, KbqFormFieldControl } from '@koobiq/components/form-field';
import { KbqTag } from '@koobiq/components/tags';
import { Observable, Subject } from 'rxjs';
import * as i0 from "@angular/core";
/** Change event object that is emitted when the select value has changed. */
export declare class KbqSelectChange {
    source: KbqSelect;
    value: any;
    constructor(source: KbqSelect, value: any);
}
/** Select panel width type. */
export type KbqSelectPanelWidth = 'auto' | number | null;
/** Options for the `kbq-select` that can be configured using the `KBQ_SELECT_OPTIONS` injection token. */
export type KbqSelectOptions = Partial<{
    /**
     * Width of the panel. If set to `auto`, the panel will match the trigger width.
     * If set to null or an empty string, the panel will grow to match the longest option's text.
     */
    panelWidth: KbqSelectPanelWidth;
    /**
     * Minimum width of the panel. If minWidth is larger than window width or property set to null, it will be ignored.
     */
    panelMinWidth: Exclude<KbqSelectPanelWidth, 'auto'>;
    /**
     * Whether to enable hiding search by default if options is less than minimum.
     *
     * - `'auto'` uses `KBQ_SELECT_SEARCH_MIN_OPTIONS_THRESHOLD` as min value.
     * - number - will enables search hiding and uses value as min.
     * @see KBQ_SELECT_SEARCH_MIN_OPTIONS_THRESHOLD
     */
    searchMinOptionsThreshold: 'auto' | number;
}>;
/** Injection token that can be used to provide the default options for the `kbq-select`. */
export declare const KBQ_SELECT_OPTIONS: InjectionToken<Partial<{
    /**
     * Width of the panel. If set to `auto`, the panel will match the trigger width.
     * If set to null or an empty string, the panel will grow to match the longest option's text.
     */
    panelWidth: KbqSelectPanelWidth;
    /**
     * Minimum width of the panel. If minWidth is larger than window width or property set to null, it will be ignored.
     */
    panelMinWidth: Exclude<KbqSelectPanelWidth, "auto">;
    /**
     * Whether to enable hiding search by default if options is less than minimum.
     *
     * - `'auto'` uses `KBQ_SELECT_SEARCH_MIN_OPTIONS_THRESHOLD` as min value.
     * - number - will enables search hiding and uses value as min.
     * @see KBQ_SELECT_SEARCH_MIN_OPTIONS_THRESHOLD
     */
    searchMinOptionsThreshold: "auto" | number;
}>>;
/** Utility provider for `KBQ_SELECT_OPTIONS`. */
export declare const kbqSelectOptionsProvider: (options: KbqSelectOptions) => Provider;
export declare class KbqSelect extends KbqAbstractSelect implements AfterContentInit, AfterViewInit, OnDestroy, OnInit, DoCheck, ControlValueAccessor, KbqFormFieldControl<any>, CanUpdateErrorState {
    private readonly _changeDetectorRef;
    private readonly _ngZone;
    private readonly _renderer;
    defaultErrorStateMatcher: ErrorStateMatcher;
    elementRef: ElementRef<HTMLElement>;
    private overlayContainer;
    private readonly _dir;
    parentForm: NgForm;
    parentFormGroup: FormGroupDirective;
    private readonly parentFormField;
    ngControl: NgControl;
    private readonly scrollStrategyFactory;
    protected localeService?: KbqLocaleService | undefined;
    /** @docs-private */
    protected readonly destroyRef: DestroyRef;
    protected readonly isBrowser: boolean;
    protected readonly defaultOptions: Partial<{
        /**
         * Width of the panel. If set to `auto`, the panel will match the trigger width.
         * If set to null or an empty string, the panel will grow to match the longest option's text.
         */
        panelWidth: KbqSelectPanelWidth;
        /**
         * Minimum width of the panel. If minWidth is larger than window width or property set to null, it will be ignored.
         */
        panelMinWidth: Exclude<KbqSelectPanelWidth, "auto">;
        /**
         * Whether to enable hiding search by default if options is less than minimum.
         *
         * - `'auto'` uses `KBQ_SELECT_SEARCH_MIN_OPTIONS_THRESHOLD` as min value.
         * - number - will enables search hiding and uses value as min.
         * @see KBQ_SELECT_SEARCH_MIN_OPTIONS_THRESHOLD
         */
        searchMinOptionsThreshold: "auto" | number;
    }> | null;
    private readonly window;
    /** Whether the component is in an error state. */
    errorState: boolean;
    /**
     * Emits whenever the component state changes and should cause the parent
     * form-field to update. Implemented as part of `KbqFormFieldControl`.
     * @docs-private
     */
    readonly stateChanges: Subject<void>;
    /** A name for this control that can be used by `kbq-form-field`. */
    controlType: string;
    hiddenItems: number;
    /** The last measured value for the trigger's client bounding rect. */
    triggerRect: DOMRect;
    /** The cached font-size of the trigger element. */
    triggerFontSize: number;
    /** Deals with the selection logic. */
    selectionModel: SelectionModel<KbqOptionBase>;
    previousSelectionModelSelected: KbqOptionBase[];
    /** Manages keyboard events for options in the panel. */
    keyManager: ActiveDescendantKeyManager<KbqOption>;
    /** The value of the select panel's transform-origin property. */
    transformOrigin: string;
    /** Emits when the panel element is finished transforming in. */
    panelDoneAnimatingStream: Subject<string>;
    /** Strategy that will be used to handle scrolling while the select panel is open. */
    scrollStrategy: any;
    /**
     * The y-offset of the overlay panel in relation to the trigger's top start corner.
     * This must be adjusted to align the selected option text over the trigger text.
     * when the panel opens. Will change based on the y-position of the selected option.
     */
    offsetY: number;
    /**
     * This position config ensures that the top "start" corner of the overlay
     * is aligned with the top "start" of the origin by default (overlapping
     * the trigger completely). If the panel cannot fit below the trigger, it
     * will fall back to a position above the trigger.
     */
    positions: ConnectedPosition[];
    /**
     * Trigger - is a clickable field to open select dropdown panel
     */
    trigger: ElementRef;
    panel: ElementRef;
    optionsContainer: ElementRef;
    overlayDir: CdkConnectedOverlay;
    footer?: ElementRef;
    cdkVirtualForOf?: CdkVirtualForOf<any>;
    tags: QueryList<KbqTag>;
    /** User-supplied override of the trigger element. */
    customTrigger: KbqSelectTrigger;
    customMatcher: KbqSelectMatcher;
    customTagTemplateRef: TemplateRef<any>;
    cleaner: KbqCleaner;
    /** All of the defined select options. */
    options: QueryList<KbqOption>;
    /** All of the defined groups of options. */
    optionGroups: QueryList<KbqOptgroup>;
    search: KbqSelectSearch;
    hiddenItemsText: string;
    /** Classes to be passed to the select panel. Supports the same syntax as `ngClass`. */
    panelClass: string | string[] | Set<string> | {
        [key: string]: any;
    };
    backdropClass: string;
    /** Object used to control when error messages are shown. */
    errorStateMatcher: ErrorStateMatcher;
    /**
     * Function used to sort the values in a select in multiple mode.
     * Follows the same logic as `Array.prototype.sort`.
     */
    sortComparator: (a: KbqOptionBase, b: KbqOptionBase, options: KbqOptionBase[]) => number;
    /**
     * Whether to use a multiline matcher or not. Default is false
     */
    multiline: boolean;
    /**
     * Controls when the search functionality is displayed based on the number of available options.
     *
     * Automatically enables search hiding if value provided, even if `defaultOptions.minOptionsThreshold` is provided.
     * @default undefined
     */
    set searchMinOptionsThreshold(value: 'auto' | number | undefined);
    get searchMinOptionsThreshold(): number | undefined;
    private _searchMinOptionsThreshold;
    /** Combined stream of all of the child options' change events. */
    readonly optionSelectionChanges: Observable<KbqOptionSelectionChange>;
    /** Event emitted when the select panel has been toggled. */
    readonly openedChange: EventEmitter<boolean>;
    /** Event emitted when the select has been opened. */
    readonly openedStream: Observable<void>;
    /** Event emitted when the select has been closed. */
    readonly closedStream: Observable<void>;
    /** Event emitted when the selected value has been changed by the user. */
    readonly selectionChange: EventEmitter<KbqSelectChange>;
    /**
     * Event that emits whenever the raw value of the select changes. This is here primarily
     * to facilitate the two-way binding for the `value` input.
     * @docs-private
     */
    readonly valueChange: EventEmitter<any>;
    get hasBackdrop(): boolean;
    set hasBackdrop(value: boolean);
    private _hasBackdrop;
    get placeholder(): string;
    set placeholder(value: string);
    private _placeholder;
    get required(): boolean;
    set required(value: boolean);
    private _required;
    get multiple(): boolean;
    set multiple(value: boolean);
    private _multiple;
    /**
     * Function to compare the option values with the selected values. The first argument
     * is a value from an option. The second is a value from the selection. A boolean
     * should be returned.
     */
    get compareWith(): (o1: any, o2: any) => boolean;
    set compareWith(fn: (o1: any, o2: any) => boolean);
    /**
     * Function for handling the combination Ctrl + A (select all). By default, the internal handler is used.
     */
    get selectAllHandler(): (event: KeyboardEvent, select: KbqSelect) => void;
    set selectAllHandler(fn: (event: KeyboardEvent, select: KbqSelect) => void);
    /**
     * Width of the panel. If set to `auto`, the panel will match the trigger width.
     * If set to null or an empty string, the panel will grow to match the longest option's text.
     */
    panelWidth: KbqSelectPanelWidth;
    /**
     * Minimum width of the panel.
     * If minWidth is larger than window width, it will be ignored.
     */
    panelMinWidth: Exclude<KbqSelectPanelWidth, 'auto'>;
    /** Value of the select control. */
    get value(): any;
    set value(newValue: any);
    private _value;
    get id(): string;
    set id(value: string);
    private _id;
    get tabIndex(): number;
    set tabIndex(value: number);
    private _tabIndex;
    get disabled(): boolean;
    set disabled(value: boolean);
    private _disabled;
    /** Whether the select is focused. */
    get focused(): boolean;
    set focused(value: boolean);
    panelOpen: boolean;
    private _focused;
    private withVirtualScroll;
    get isEmptySearchResult(): boolean;
    get canShowCleaner(): boolean;
    get selected(): KbqOptionBase | KbqOptionBase[];
    get triggerValue(): string;
    get triggerValues(): KbqOptionBase[];
    get empty(): boolean;
    get firstSelected(): KbqOptionBase | null;
    get firstFiltered(): boolean;
    /** @docs-private */
    get colorForState(): KbqComponentColors;
    /** Whether multiple choice is enabled or not. True if multiple or multiline */
    get multiSelection(): boolean;
    private closeSubscription;
    /** The scroll position of the overlay panel, calculated to center the selected option. */
    private scrollTop;
    /** Unique id for this input. */
    private readonly uid;
    private visibleChanges;
    /** Width of the overlay panel. */
    protected overlayWidth: string | number;
    /** Min width of the overlay panel. */
    protected overlayMinWidth: string | number;
    /** Origin for the overlay panel. */
    protected overlayOrigin?: CdkOverlayOrigin | ElementRef;
    constructor(_changeDetectorRef: ChangeDetectorRef, _ngZone: NgZone, _renderer: Renderer2, defaultErrorStateMatcher: ErrorStateMatcher, elementRef: ElementRef<HTMLElement>, overlayContainer: OverlayContainer, _dir: Directionality, parentForm: NgForm, parentFormGroup: FormGroupDirective, parentFormField: KbqFormField, ngControl: NgControl, scrollStrategyFactory: any, localeService?: KbqLocaleService | undefined);
    ngOnInit(): void;
    ngDoCheck(): void;
    ngAfterContentInit(): void;
    ngAfterViewInit(): void;
    ngOnDestroy(): void;
    updateErrorState(): void;
    hiddenItemsTextFormatter(hiddenItemsText: string, hiddenItems: number): string;
    clearValue($event: any): void;
    /** `View -> model callback called when value changes` */
    onChange: (value: any) => void;
    /** `View -> model callback called when select has been touched` */
    onTouched: () => void;
    resetSearch(): void;
    /** Toggles the overlay panel open or closed. */
    toggle(): void;
    /** Opens the overlay panel. */
    open(): void;
    /** Closes the overlay panel and focuses the host element. */
    close(): void;
    /**
     * Sets the select's value. Part of the ControlValueAccessor interface
     * required to integrate with Angular's core forms API.
     *
     * @param value New value to be written to the model.
     */
    writeValue(value: any): void;
    /**
     * Saves a callback function to be invoked when the select's value
     * changes from user input. Part of the ControlValueAccessor interface
     * required to integrate with Angular's core forms API.
     *
     * @param fn Callback to be triggered when the value changes.
     */
    registerOnChange(fn: (value: any) => void): void;
    /**
     * Saves a callback function to be invoked when the select is blurred
     * by the user. Part of the ControlValueAccessor interface required
     * to integrate with Angular's core forms API.
     *
     * @param fn Callback to be triggered when the component has been touched.
     */
    registerOnTouched(fn: () => {}): void;
    /**
     * Disables the select. Part of the ControlValueAccessor interface required
     * to integrate with Angular's core forms API.
     *
     * @param isDisabled Sets whether the component is disabled.
     */
    setDisabledState(isDisabled: boolean): void;
    isRtl(): boolean;
    handleKeydown(event: KeyboardEvent): void;
    onFocus(): void;
    /**
     * Calls the touched callback only if the panel is closed. Otherwise, the trigger will
     * "blur" to the panel when it opens, causing a false positive.
     */
    onBlur(): void;
    /**
     * Callback that is invoked when the overlay panel has been attached.
     */
    onAttached(): void;
    /** Returns the theme to be used on the panel. */
    getPanelTheme(): string;
    /** Focuses the select element. */
    focus(): void;
    /**
     * Implemented as part of KbqFormFieldControl.
     * @docs-private
     */
    onContainerClick(): void;
    /** Invoked when an option is clicked. */
    onRemoveMatcherItem(option: KbqOptionBase, $event: any): void;
    calculateHiddenItems(): void;
    getItemHeight(): number;
    handleClick($event: MouseEvent): void;
    /** @docs-private */
    protected shouldShowSearch(): boolean;
    private updateLocaleParams;
    private isVisible;
    private currentOverlayPosition;
    private modalOverlayPosition;
    private closingActions;
    private getHeightOfOptionsContainer;
    private updateScrollSize;
    private getTotalItemsWidthInMatcher;
    private getItemWidth;
    /** Handles keyboard events while the select is closed. */
    private handleClosedKeydown;
    /** Handles keyboard events when the selected is open. */
    private handleOpenKeydown;
    private initializeSelection;
    /**
     * Sets the selected option based on a value. If no option can be
     * found with the designated value, the select trigger is cleared.
     */
    private setSelectionByValue;
    private getCorrespondOption;
    /**
     * Finds and selects and option based on its value.
     * @returns Option that has the corresponding value.
     */
    private selectValue;
    /** Sets up a key manager to listen to keyboard events on the overlay panel. */
    private initKeyManager;
    /** Drops current option subscriptions and IDs and resets from scratch. */
    private resetOptions;
    /** Invoked when an option is clicked. */
    private onSelect;
    /** Sorts the selected values in the selected based on their order in the panel. */
    private sortValues;
    /** Emits change event to set the model value. */
    private propagateChanges;
    /**
     * Highlights the selected item. If no option is selected, it will highlight
     * the first item instead.
     */
    private highlightCorrectOption;
    /** Scrolls the active option into view. */
    private scrollActiveOptionIntoView;
    /** Gets how wide the overlay panel should be. */
    private getOverlayWidth;
    /** Comparison function to specify which option is displayed. Defaults to object equality. */
    private _compareWith;
    /** Function for handling the combination Ctrl + A (select all). By default, the internal handler is used. */
    private _selectAllHandler;
    private getTotalVisibleItems;
    private buildTriggerClone;
    static ɵfac: i0.ɵɵFactoryDeclaration<KbqSelect, [null, null, null, null, null, null, { optional: true; }, { optional: true; }, { optional: true; }, { optional: true; host: true; }, { optional: true; self: true; }, null, { optional: true; }]>;
    static ɵcmp: i0.ɵɵComponentDeclaration<KbqSelect, "kbq-select", ["kbqSelect"], { "hiddenItemsText": { "alias": "hiddenItemsText"; "required": false; }; "panelClass": { "alias": "panelClass"; "required": false; }; "backdropClass": { "alias": "backdropClass"; "required": false; }; "errorStateMatcher": { "alias": "errorStateMatcher"; "required": false; }; "sortComparator": { "alias": "sortComparator"; "required": false; }; "multiline": { "alias": "multiline"; "required": false; }; "searchMinOptionsThreshold": { "alias": "searchMinOptionsThreshold"; "required": false; }; "hasBackdrop": { "alias": "hasBackdrop"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "required": { "alias": "required"; "required": false; }; "multiple": { "alias": "multiple"; "required": false; }; "compareWith": { "alias": "compareWith"; "required": false; }; "selectAllHandler": { "alias": "selectAllHandler"; "required": false; }; "panelWidth": { "alias": "panelWidth"; "required": false; }; "panelMinWidth": { "alias": "panelMinWidth"; "required": false; }; "value": { "alias": "value"; "required": false; }; "id": { "alias": "id"; "required": false; }; "tabIndex": { "alias": "tabIndex"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "hiddenItemsTextFormatter": { "alias": "hiddenItemsTextFormatter"; "required": false; }; }, { "openedChange": "openedChange"; "openedStream": "opened"; "closedStream": "closed"; "selectionChange": "selectionChange"; "valueChange": "valueChange"; }, ["footer", "cdkVirtualForOf", "customTrigger", "customMatcher", "customTagTemplateRef", "cleaner", "search", "options", "optionGroups"], ["kbq-select-matcher, [kbq-select-matcher]", "kbq-select-trigger, [kbq-select-trigger]", "kbq-cleaner", "[kbqSelectSearch]", "[kbq-select-search-empty-result]", "*", "kbq-select-footer,[kbq-select-footer]"], false, never>;
    static ngAcceptInputType_multiline: unknown;
    static ngAcceptInputType_multiple: unknown;
    static ngAcceptInputType_panelMinWidth: unknown;
    static ngAcceptInputType_tabIndex: unknown;
    static ngAcceptInputType_disabled: unknown;
}
