/*!
 * Copyright 2020 VMware, Inc.
 * SPDX-License-Identifier: BSD-2-Clause
 */
import { AfterViewInit, ElementRef, EventEmitter, OnDestroy, Provider, QueryList, Renderer2, TrackByFunction } from '@angular/core';
import { ClrDropdown, ClrDropdownMenu, ClrDropdownTrigger } from '@clr/angular';
import { isObservable } from 'rxjs';
import { ActionItem, TextIcon } from '../common/interfaces';
import { CliptextConfig } from '../lib/directives';
import { SubscriptionTracker } from '../common/subscription/subscription-tracker';
import { DropdownFocusHandlerService } from './dropdown-focus-handler.service';
import * as i0 from "@angular/core";
export declare const NESTED_MENU_HIDE_DELAY = 400;
export declare function dropdownFocusHandlerServiceFactory(renderer: Renderer2, existing: DropdownFocusHandlerService): DropdownFocusHandlerService;
export declare const DROPDOWN_FOCUS_HANDLER_PROVIDER: Provider;
/**
 * Arrow keys directions
 */
export declare enum Direction {
    UP = "up",
    DOWN = "down",
    LEFT = "left",
    RIGHT = "right"
}
/**
 * Object wrapping the focusable HTML elements of dropdown menu with the neighbors in 4 directions of each menu item.
 */
export interface MenuItem {
    /**
     * The HTML element of this dropdown menu item
     */
    element: HTMLElement;
    /**
     * Neighboring menu items in all the 4 directions
     */
    up?: MenuItem;
    down?: MenuItem;
    left?: MenuItem;
    right?: MenuItem;
    /**
     * Call back to close the menu for which this menu item can be a trigger. called from {@link DropdownFocusHandlerService}
     */
    closeMenu?: () => void;
}
/**
 * Component used for displaying nested drop downs
 */
export declare class DropdownComponent implements AfterViewInit {
    private parentVcdDropdown;
    private focusHandler;
    private _dropdownItemContents;
    private _items;
    /**
     * To access the private key lastAvailabilityValue from the template
     */
    lastAvailabilityValue: symbol;
    /**
     * Decides what goes into the action buttons
     * @param textIcon An enum that describes the possible ways to display the button title
     */
    set dropdownItemContents(textIcon: TextIcon);
    get dropdownItemContents(): TextIcon;
    /**
     * Nested list of dropdown objects
     */
    set items(items: ActionItem<unknown, unknown>[]);
    get items(): ActionItem<unknown, unknown>[];
    dropdownMenuUpdated: EventEmitter<{
        menu: HTMLElement;
    }>;
    constructor(parentVcdDropdown: DropdownComponent, focusHandler: DropdownFocusHandlerService);
    set clrDropdownMenu(val: ClrDropdownMenu);
    private _clrDropdownMenu;
    set dropdownTriggerEl(val: ElementRef<HTMLElement>);
    _dropdownTriggerEl: HTMLElement;
    set clrDropdownMenuEl(val: ElementRef<HTMLElement>);
    _clrDropdownMenuEl: HTMLElement;
    /**
     * If a icon should be displayed inside contextual buttons
     */
    shouldShowIcon: boolean;
    /**
     * If a text should be displayed inside contextual buttons
     */
    shouldShowText: boolean;
    /**
     * If the contextual buttons with icons should have a tooltip
     */
    shouldShowTooltip: boolean;
    /**
     * Default configuration for vcdShowClippedText directive
     */
    clipTextConfig: CliptextConfig;
    /**
     * Text Content of the button that opens the root dropdown when clicked
     */
    dropdownTriggerBtnTxt: string;
    /**
     * Icon shown in the button that opens the root dropdown when clicked
     */
    dropdownTriggerBtnIcon: string;
    /**
     * The position the root dropdown with respect to root dropdown trigger button. Refer to {@link clrPosition} for it's values
     */
    dropdownPosition: string;
    /**
     * The position of all the nested dropdowns {@link clrPosition}. Default is 'bottom-left'
     */
    nestedDropdownPosition: string;
    /**
     * Argument for {@link ActionItem.handler} and {@link ActionItem.disabled} methods. Please refer to
     * {@link ActionMenuComponent.selectedEntities}
     */
    selectedEntities: unknown[];
    /**
     * Used for displaying different button contents in the root dropdown trigger button vs nested dropdown trigger button
     */
    isNestedDropdown: boolean;
    isDropdownDisabled: boolean;
    /**
     * Css class name added to the dropdown trigger buttons
     */
    dropdownTriggerButtonClassName: string;
    /**
     * To toggle open and close states when hovered over
     */
    clrDropdown: ClrDropdown;
    /**
     * The button that opens this dropdown when clicked. Used for preventing the clarity frameworks click handler logic
     * from executing
     */
    clrDropdownTrigger: ClrDropdownTrigger;
    /**
     * List of nested dropdown children that belong to this dropdown. Used to close when a different child in this menu list is
     * hovered over
     */
    vcdDropdownChildren: QueryList<DropdownComponent>;
    /**
     * Used for deciding if the availability has to be passed through an Async pipe in the template
     */
    isObservable: typeof isObservable;
    private hideTimeout;
    /**
     * The {@link ngForTrackBy} method used for rendering of a dropdown actions or for rendering nested drop downs
     * NOTE: Without this, nested drop downs don't get rendered on the screen
     */
    trackByFunction: TrackByFunction<ActionItem<unknown, unknown>>;
    /**
     * Nested menus are toggled using the mouseover and mouseout events instead of mouse clicks. So the claritys
     * click handler which conflicts with that is prevented from executing
     */
    ngAfterViewInit(): void;
    /**
     * To check in the HTML, if a dropdown item of separator type should be used to add a separator item in the dropdown
     * This is required because,
     * 1. As each item decides its own availability, some groups may become empty and we collapse separators before them
     * 2. A separator is not required if it is the first item in the dropdown list
     * @param index Position of the dropdown item in the dropdown list
     * @param currentItem The current item in the list that is being iterated over
     */
    shouldRenderAsSeparator(index: number, currentItem: ActionItem<unknown, unknown>): boolean;
    /**
     * Handles the mouseover events on this dropdown's children that are of {@link #DROPDOWN_ITEM_SELECTOR} and
     * {@link #NESTED_DROPDOWN_TRIGGER_SELECTOR} type. When mouse is hovered on a child of type...
     * - DROPDOWN_ITEM_SELECTOR: Any open children of dropdown type have to be closed. This is because, user will always not mouse out of
     * a nested dropdown host(<vcd-dropdown>) to trigger the close event. He can move the mouse from nested dropdown's item to this
     * dropdown's item directly
     * - NESTED_DROPDOWN_TRIGGER_SELECTOR: Any open children of parent dropdown have to be closed and this dropdown has to be opened. We ask
     * the parent to close its children because, the mouse over events are not propagated upwards when hovered over a child of nested
     * dropdown type
     */
    onMouseOver(event: Event): void;
    /**
     * Handles the mouseout events on this dropdown's children that are of {@link #NESTED_DROPDOWN_TRIGGER_SELECTOR} type
     */
    onMouseOut(event: Event): void;
    private closeOpenVcdDropdownChildren;
    /**
     * When space or enter key is pressed on the focused dropdown menu item, it has to be clicked
     * @param event Space or Enter key press event
     */
    onDropdownItemActivated(event: Event): void;
    /**
     * When space or enter is pressed on a nested trigger, the nested menu has to be opened. So, we trigger a mouseover event which opens
     * the nested menu
     * @param event Space or Enter key press event
     */
    onDropdownTriggerActivated(event: Event): void;
    /**
     * We use [clrDisabled] instead of [disabled] to show that a dropdown item is disabled. However, it doesn't prevent the item from
     * getting activated when it is clicked. So, we make sure the action is not disabled before clicking it
     */
    onItemClicked(item: ActionItem<any, any>): void;
    /**
     * To visually disable a displayed action
     */
    isItemDisabled(item: ActionItem<any, any>): boolean;
    /**
     * When an esc key is pressed on a dropdown item, the behavior should be same as pressing left arrow key on the item. This is
     * being handled here instead of inside the {@link DropdownFocusHandlerService} because, the escape event is being absorned by
     * Claritys focus handling logic before it reaches the service.
     */
    onDropdownEscPressed(event: Event): void;
    static ɵfac: i0.ɵɵFactoryDeclaration<DropdownComponent, [{ optional: true; skipSelf: true; }, null]>;
    static ɵcmp: i0.ɵɵComponentDeclaration<DropdownComponent, "vcd-dropdown", never, { "dropdownItemContents": "dropdownItemContents"; "items": "items"; "dropdownTriggerBtnTxt": "dropdownTriggerBtnTxt"; "dropdownTriggerBtnIcon": "dropdownTriggerBtnIcon"; "dropdownPosition": "dropdownPosition"; "nestedDropdownPosition": "nestedDropdownPosition"; "selectedEntities": "selectedEntities"; "isNestedDropdown": "isNestedDropdown"; "isDropdownDisabled": "isDropdownDisabled"; "dropdownTriggerButtonClassName": "dropdownTriggerButtonClassName"; "trackByFunction": "trackByFunction"; }, { "dropdownMenuUpdated": "dropdownMenuUpdated"; }, never, never, false, never>;
}
/**
 * Added on to vcd-dropdown component to link menu items of the dropdown on which this directive is added. each item is linked to its
 * neighbors in the 4 directions. It then uses the {@link DropdownFocusHandlerService} to move the DOM focus between the menu items.
 */
export declare class DropdownFocusHandlerDirective implements AfterViewInit, OnDestroy {
    private parentVcdDropdown;
    private parentFocusHandler;
    private hostVcdDropdown;
    private focusHandlerService;
    private renderer;
    private subscriptionTracker;
    constructor(parentVcdDropdown: DropdownComponent, parentFocusHandler: DropdownFocusHandlerDirective, hostVcdDropdown: DropdownComponent, focusHandlerService: DropdownFocusHandlerService, renderer: Renderer2, subscriptionTracker: SubscriptionTracker);
    /**
     * List of focusable menu items with their neighbors in 4 directions.
     */
    menuItems: MenuItem[];
    /**
     * The menu item which can toggle this menu. This can be the root dropdown trigger or nested menu trigger
     */
    private menuTrigger;
    private dropdownTriggerEl;
    private clrDropdownMenuEl;
    private isRootDropdown;
    private timeoutId;
    private unlistenRightArrowKeyPress;
    /**
     * After a dropdown menu is opened, it creates {@link MenuItem} for each of the menu items along with their trigger menu item and links
     * them. It also then moves the focus to first item in the opened menu list.
     */
    ngAfterViewInit(): void;
    /**
     * Sometimes when the right arrow key is pressed on a nested menu trigger, the event is propagating to sibling nested menu triggers and
     * the event handlers attached to the menu triggers by clarity to toggle the menus are being invoked. Because of this, pressing right
     * arrow on a nested menu is opening other sibling menus as well
     */
    private listenToRightArrowKeyPressOnNestedTrigger;
    private reset;
    ngOnDestroy(): void;
    private registerRootMenuContainer;
    private moveFocusToFirstItem;
    private getDropdownItemElement;
    private linkMenuItems;
    private closeVcdDropdown;
    private get rootMenuTrigger();
    private get nestedMenuTrigger();
    private linkVertical;
    static ɵfac: i0.ɵɵFactoryDeclaration<DropdownFocusHandlerDirective, [{ optional: true; skipSelf: true; }, { optional: true; skipSelf: true; }, { host: true; }, null, null, null]>;
    static ɵdir: i0.ɵɵDirectiveDeclaration<DropdownFocusHandlerDirective, "vcd-dropdown[vcdDropdownFocusHandler]", never, {}, {}, never, never, false, never>;
}
