import { Directionality } from '@angular/cdk/bidi';
import { SelectionModel } from '@angular/cdk/collections';
import { CdkDragDrop } from '@angular/cdk/drag-drop';
import { AfterContentInit, AfterViewInit, ChangeDetectorRef, DoCheck, ElementRef, EventEmitter, OnDestroy, QueryList } from '@angular/core';
import { ControlValueAccessor, FormGroupDirective, NgControl, NgForm } from '@angular/forms';
import { FocusKeyManager } from '@koobiq/cdk/a11y';
import { CanUpdateErrorState, ErrorStateMatcher, KbqOrientation } from '@koobiq/components/core';
import { KbqCleaner, KbqFormFieldControl } from '@koobiq/components/form-field';
import { Observable, Subject } from 'rxjs';
import { KbqTagTextControl } from './tag-text-control';
import { KbqTag, KbqTagEditChange, KbqTagEvent, KbqTagFocusEvent, KbqTagSelectionChange } from './tag.component';
import * as i0 from "@angular/core";
import * as i1 from "@angular/cdk/drag-drop";
/** Change event object that is emitted when the tag list value has changed. */
export declare class KbqTagListChange {
    source: KbqTagList;
    value: any;
    constructor(source: KbqTagList, value: any);
}
export type KbqTagListDroppedEvent = Pick<CdkDragDrop<unknown>, 'event' | 'previousIndex' | 'currentIndex'> & {
    tag: KbqTag;
};
export declare class KbqTagList implements KbqFormFieldControl<any>, ControlValueAccessor, AfterContentInit, DoCheck, OnDestroy, CanUpdateErrorState, AfterViewInit {
    protected elementRef: ElementRef<HTMLElement>;
    private changeDetectorRef;
    defaultErrorStateMatcher: ErrorStateMatcher;
    private dir;
    parentForm: NgForm;
    parentFormGroup: FormGroupDirective;
    ngControl: NgControl;
    private readonly dropList;
    private readonly destroyRef;
    private readonly focusMonitor;
    /**
     * Implemented as part of KbqFormFieldControl.
     *
     * @docs-private
     */
    readonly controlType: string;
    /**
     * 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>;
    /**
     * Combined stream of all of the child tags' selection change events.
     *
     * @docs-private
     */
    get tagSelectionChanges(): Observable<KbqTagSelectionChange>;
    /**
     * Combined stream of all of the child tags' focus change events.
     *
     * @docs-private
     */
    get tagFocusChanges(): Observable<KbqTagFocusEvent>;
    /**
     * Combined stream of all of the child tags' blur change events.
     *
     * @docs-private
     */
    get tagBlurChanges(): Observable<KbqTagEvent>;
    /**
     * Combined stream of all of the child tags' remove change events.
     *
     * @docs-private
     */
    get tagRemoveChanges(): Observable<KbqTagEvent>;
    /**
     * Combined stream of all of the child tags' edit change events.
     *
     * @docs-private
     */
    get tagEditChanges(): Observable<KbqTagEditChange>;
    /**
     * The array of selected tags inside tag list.
     *
     * @docs-private
     */
    get selected(): KbqTag[];
    /** @docs-private */
    get canShowCleaner(): boolean;
    /**
     * @deprecated Unused. Will be removed in next major release.
     *
     * @docs-private
     */
    multiple: boolean;
    /**
     * A 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.
     *
     * @deprecated Unused. Will be removed in next major release.
     */
    compareWith: (o1: any, o2: any) => boolean;
    /**
     * Implemented as part of KbqFormFieldControl.
     * @docs-private
     */
    get value(): any;
    set value(value: any);
    private _value;
    /**
     * Implemented as part of KbqFormFieldControl.
     * @docs-private
     */
    get id(): string;
    /**
     * Implemented as part of KbqFormFieldControl.
     * @docs-private
     */
    get required(): boolean;
    set required(value: boolean);
    private _required;
    /**
     * Implemented as part of KbqFormFieldControl.
     * @docs-private
     */
    get placeholder(): string;
    set placeholder(value: string);
    private _placeholder;
    /** Whether any tags or the kbqTagInput inside of this tag-list has focus. */
    get focused(): boolean;
    /**
     * Implemented as part of KbqFormFieldControl.
     * @docs-private
     */
    get empty(): boolean;
    /**
     * Implemented as part of KbqFormFieldControl.
     * @docs-private
     */
    get shouldLabelFloat(): boolean;
    /**
     * Implemented as part of KbqFormFieldControl.
     * @docs-private
     */
    get disabled(): boolean;
    set disabled(value: boolean);
    private _disabled;
    get draggable(): boolean;
    set draggable(value: boolean);
    private _draggable;
    /**
     * Emits when the user drops tag inside tag list container.
     */
    readonly dropped: EventEmitter<KbqTagListDroppedEvent>;
    /**
     * Whether or not this tag list is selectable. When a tag list is not selectable,
     * the selected states for all the tags inside the tag list are always ignored.
     */
    selectable: boolean;
    /** Whether the tags in the list are editable. */
    editable: boolean;
    /** Whether the tags in the list are removable. */
    get removable(): boolean;
    set removable(value: boolean);
    private _removable;
    /**
     * Tab index of the tag list. This property is ignored when the tag list contains a tag input or is disabled.
     *
     * @docs-private
     */
    get tabIndex(): number | null;
    set tabIndex(value: number);
    private _tabIndex;
    /**
     * Event that emits whenever the raw value of the tag-list changes. This is here primarily
     * to facilitate the two-way binding for the `value` input.
     * @docs-private
     */
    readonly valueChange: EventEmitter<any>;
    /** @docs-private */
    uid: string;
    /**
     * User defined tab index.
     * When it is not null, use user defined tab index. Otherwise use tabIndex
     *
     * @docs-private
     */
    userTabIndex: number | null;
    /** @docs-private */
    keyManager: FocusKeyManager<KbqTag>;
    /**
     * @docs-private
     *
     * @deprecated Unused. Will be removed in next major release.
     */
    selectionModel: SelectionModel<KbqTag>;
    /**
     * @docs-private
     *
     * @deprecated Unused. Will be removed in next major release.
     */
    tagChanges: EventEmitter<any>;
    /** An object used to control when error messages are shown. */
    errorStateMatcher: ErrorStateMatcher;
    /**
     * Orientation of the tag list.
     *
     * @deprecated Unused. Will be removed in next major release.
     */
    orientation: KbqOrientation;
    /** Event emitted when the selected tag list value has been changed by the user. */
    readonly change: EventEmitter<KbqTagListChange>;
    /** @docs-private */
    cleaner: KbqCleaner;
    /**
     * The tag components contained within this tag list.
     *
     * @docs-private
     */
    tags: QueryList<KbqTag>;
    /**
     * Whether the component is in an error state.
     *
     * @docs-private
     */
    errorState: boolean;
    /** The tag input to add more tags */
    private tagInput;
    /**
     * When a tag is destroyed, we store the index of the destroyed tag until the tags
     * query list notifies about the update. This is necessary because we cannot determine an
     * appropriate tag that should receive focus until the array of tags updated completely.
     */
    private lastDestroyedTagIndex;
    /** Subscription to focus changes in the tags. */
    private tagFocusSubscription;
    /** Subscription to blur changes in the tags. */
    private tagBlurSubscription;
    /** Subscription to remove changes in tags. */
    private tagRemoveSubscription;
    /** Subscription to edit changes in tags. */
    private tagEditSubscription;
    constructor(elementRef: ElementRef<HTMLElement>, changeDetectorRef: ChangeDetectorRef, defaultErrorStateMatcher: ErrorStateMatcher, dir: Directionality, parentForm: NgForm, parentFormGroup: FormGroupDirective, ngControl: NgControl);
    ngDoCheck(): void;
    ngAfterContentInit(): void;
    ngAfterViewInit(): void;
    ngOnDestroy(): void;
    /** @docs-private */
    updateErrorState(): void;
    /** @docs-private */
    onTouched: () => void;
    /** @docs-private */
    onChange: (value: any) => void;
    /**
     * Associates an HTML input element with this tag list.
     *
     * @docs-private
     */
    registerInput(inputElement: KbqTagTextControl): void;
    /**
     * Implemented as part of ControlValueAccessor.
     */
    writeValue(value: any): void;
    /**
     * Implemented as part of ControlValueAccessor.
     */
    registerOnChange(fn: (value: any) => void): void;
    /**
     * Implemented as part of ControlValueAccessor.
     */
    registerOnTouched(fn: () => void): void;
    /**
     * Implemented as part of ControlValueAccessor.
     */
    setDisabledState(isDisabled: boolean): void;
    /**
     * Implemented as part of KbqFormFieldControl.
     *
     * @docs-private
     */
    onContainerClick(): void;
    /**
     * Focuses the tag list. If there is a tag input, focuses that instead.
     */
    focus(): void;
    /**
     * Focuses the tag input inside the tag list.
     *
     * @docs-private
     */
    focusInput(): void;
    /**
     * Pass events to the keyboard manager. Available here for tests.
     *
     * @docs-private
     */
    keydown(event: KeyboardEvent): void;
    /**
     * @docs-private
     *
     * @deprecated Unused. Will be removed in next major release.
     */
    setSelectionByValue(_value: any, _isUserInput?: boolean): void;
    /** When blurred, mark the field as touched when focus moved outside the tag list. */
    blur(): void;
    /** Mark the field as touched */
    markAsTouched(): void;
    /**
     * Check the tab index as you should not be allowed to focus an empty list.
     *
     * @docs-private
     */
    protected updateTabIndex(): void;
    /**
     * If the amount of tags changed, we need to update the
     * key manager state and focus the next closest tag.
     *
     * @docs-private
     */
    protected updateFocusForDestroyedTags(): void;
    /**
     * Utility to ensure all indexes are valid.
     *
     * @param index The index to be checked.
     * @returns True if the index is valid for our list of tags.
     */
    private isValidIndex;
    private isInputElement;
    private isInputEmpty;
    private isTagElement;
    private selectAll;
    /**
     * Unselects all tags in the list.
     *
     * @docs-private
     */
    unselectAll(): void;
    /**
     * Removes all selected tags from the list.
     *
     * @docs-private
     */
    removeSelected(): void;
    private propagateTagsChanges;
    private resetTags;
    private dropSubscriptions;
    /** Listens to user-generated selection events on each tag. */
    private listenToTagsFocus;
    private listenToTagsRemoved;
    private listenToTagsEdit;
    /** Checks whether any of the tags is focused. */
    private hasFocusedTag;
    private syncTagsRemovableState;
    /** Revalidate control. */
    private revalidate;
    private setupDropListInitialProperties;
    private syncDropListDisabledState;
    private setupFocusMonitor;
    static ɵfac: i0.ɵɵFactoryDeclaration<KbqTagList, [null, null, null, { optional: true; }, { optional: true; }, { optional: true; }, { optional: true; self: true; }]>;
    static ɵcmp: i0.ɵɵComponentDeclaration<KbqTagList, "kbq-tag-list", ["kbqTagList"], { "multiple": { "alias": "multiple"; "required": false; }; "compareWith": { "alias": "compareWith"; "required": false; }; "value": { "alias": "value"; "required": false; }; "required": { "alias": "required"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "draggable": { "alias": "draggable"; "required": false; }; "selectable": { "alias": "selectable"; "required": false; }; "editable": { "alias": "editable"; "required": false; }; "removable": { "alias": "removable"; "required": false; }; "tabIndex": { "alias": "tabIndex"; "required": false; }; "errorStateMatcher": { "alias": "errorStateMatcher"; "required": false; }; "orientation": { "alias": "orientation"; "required": false; }; }, { "dropped": "dropped"; "valueChange": "valueChange"; "change": "change"; }, ["cleaner", "tags"], ["*", "kbq-cleaner"], false, [{ directive: typeof i1.CdkDropList; inputs: {}; outputs: {}; }]>;
    static ngAcceptInputType_multiple: unknown;
    static ngAcceptInputType_disabled: unknown;
    static ngAcceptInputType_draggable: unknown;
    static ngAcceptInputType_selectable: unknown;
    static ngAcceptInputType_editable: unknown;
    static ngAcceptInputType_removable: unknown;
}
