import { AfterContentInit, ElementRef, EventEmitter, OnChanges, OnDestroy, Renderer2, SimpleChanges, TemplateRef } from '@angular/core';
import { ScrollService } from '../../core/scroll.service';
import { WindowService } from '../../core/window.service';
import { LinkTarget } from '../../display/tags/tag';
import { NavItem } from '../navigation/nav-item';
import { PopoverContentPosition } from '../popover/popover.component';
import * as i0 from "@angular/core";
export type MenuTemplateType = "label" | "iconAndLabel" | "checkAndLabel" | "iconLabelCaption";
export type MenuHostElementClasses = 'bg-transparent';
export interface MenuItem<TValue = any, SItems = any> extends NavItem {
    label: string;
    caption?: string;
    items?: MenuItem<SItems>[];
    checked?: boolean;
    display?: 'default' | 'heading' | 'divider' | 'divided-section';
    value?: TValue;
    classList?: string;
    disabled?: boolean;
    hidden?: boolean;
    readonly?: boolean;
    target?: LinkTarget;
    externalLink?: boolean;
    /** Optional text to display in-place of the default label when the MenuItem is selected. */
    selectedLabel?: string;
    hideIfNoItems?: boolean;
    /** Optional help popover content to display next to the header or individual item. Note: This only will
     *  show when using our built in item templates.
     */
    helpPopover?: string;
    /** Optional help popover position. If not defined a default of 'top-left' will be used. */
    helpPopoverPosition?: PopoverContentPosition;
}
export declare const menuAnimationSpeed = 350;
/**
 * Primitive Menu component that encapsulates known templates
 *
 * @export
 */
export declare class MenuComponent implements AfterContentInit, OnDestroy, OnChanges {
    private el;
    private renderer;
    private windowService;
    private scrollService;
    /**
     * Input for the menu's template id
     */
    id?: string;
    /**
     * Id bound to the host element
     */
    attrId?: string;
    /**
     * Array of items to display
     *
     * @memberof MenuComponent
     */
    items: Array<MenuItem>;
    /**
     *  Selected item; annotates the item
     *  when displayed with 'selected' class
     *
     * @memberof MenuComponent
     */
    selected: MenuItem | null;
    /**
     * The parent menu item. If defined, a header with the parent's label and a
     * back button will be displayed.
     */
    parent?: MenuItem;
    /**
     * Display template
     *
     * @memberof MenuComponent
     */
    templateType: MenuTemplateType;
    /**
     * Optional custom template for the menu items. Must declare a template
     * input variable called "item" like so: <ng-template #templateName let-item>,
     * where item represents the menuItem.
     * Will override the choice for templateType if provided.
     *
     * @memberof MenuComponent
     */
    customMenuTemplate?: TemplateRef<any>;
    /**
     * The menu's title
     */
    title?: string;
    /**
     * Show message when there are no items
     */
    showNoItems?: boolean;
    /**
     * Text to show when menu is empty and showNoItems is true
     */
    noDataText: string;
    /**
     * Controls whether keyboard navigation is enabled
     */
    enableKeyNav?: boolean;
    /**
     * Item currently highlighted by keyboard navigation
     */
    highlightedItem: MenuItem | null;
    /**
     * Tells the menu to maintain the selected/lastSelected item. Turning this off is useful for
     * action type menus that are displayed on the screen at all times and you do not
     * want the item to be selected when clicked.
     */
    maintainSelectedItem: boolean;
    /**
     * Will prevent text-wrapping of menu items and truncate instead. Also turns on a tooltip for the menu item. Default: false;
     */
    truncateItems: boolean;
    /**
     * When true, the space for the icon is preserved for menu items that do not have icons.
     * Only applicable for iconAndLabel menus.
     */
    preserveIconSpace: boolean;
    /**
     * Reference to the toggle button.  Set when menu is used as part of a DropdownComponent.
     */
    dropdownToggleButton?: ElementRef;
    /**
     * Emitted when `selected` is changed. Emits the referenced object.
     *
     * @memberof MenuComponent
     */
    selectedChanged: EventEmitter<MenuItem>;
    /**
     * Emitted when the menu has a parent and back is clicked
     * @memberof MenuComponent
     */
    menuClosed: EventEmitter<void>;
    /**
     * The item template that is loaded into the component template
     *
     * @memberof MenuComponent
     */
    internalizedTemplate: TemplateRef<any>;
    /**
     * Index of the item currently highlighted using keyboard nav
     */
    highlightedItemIndex: number;
    /**
     * A reference to the menu label template
     */
    private labelTemplate;
    /**
     * A reference to the menu icon and label template
     */
    private iconAndLabelTemplate;
    /**
     * A reference to the menu check and label template
     */
    private checkAndLabelTemplate;
    /**
     * A reference to the menu icon, label and caption template
     */
    private iconLabelCaptionTemplate;
    /**
     * Contains the function used to remove the even listener from the renderer
     */
    private removeKeydownListener?;
    /**
     * Last item this.selected was set to via selectItem().
     * This isn't necessarily the same as this.selected, because this.selected is an input property
     * and could have been changed by a consumer through some means other than selectItem().
     * This allows us to prevent double-calls to selectItem() with the same input.
     */
    private lastSelected;
    /**
     * Flattened array of all selectable items in the menu. Makes it easier to keep track of the currently highlighted item for keyboard navigation.
     */
    private selectableItems;
    /**
     * Helper function to return a flat list of all selectable items in the provided menu items. Filters out headings and divided-sections.
     * This makes it much easier to keep track of currently highlighted items for keyboard navigation.
     */
    static getSelectableItems(items: MenuItem[]): MenuItem[];
    /**
     * Returns an ID for the provided item based on its index in the provided items array. This mimics the behavior of the MenuComponent's
     * generated IDs for items that don't have provided IDs. This is used in MenuComponent and ComboboxComponent to scroll to specific items.
     * NOTE: If the items array does not match what is displayed in the menu, this function will not return the correct ID.
     *
     * Returns null if the not found
     * @param items The MenuItems array to search through.
     * @param item The item to generate the ID for.
     * @param menuComponentId Used to prefix the generated ID. This should be the ID of the menu component the item is present in.
     * @memberof MenuComponent
     */
    static getIndexedItemId(items: MenuItem[], item?: MenuItem | null, menuComponentId?: string): string | null;
    constructor(el: ElementRef, renderer: Renderer2, windowService: WindowService, scrollService: ScrollService);
    ngOnChanges(changes: SimpleChanges): void;
    /**
     * Sets & displays the interalized template based on
     * the set template.
     * @see { @link https://angular.io/guide/lifecycle-hooks|Angular Lifecycle Hooks}
     *
     * @memberof MenuComponent
     */
    ngAfterContentInit(): void;
    ngOnDestroy(): void;
    /**
     * When a menu item is selected, open a child menu if the item has items, call
     * the item's click method if defined, or emit the selected item.
     *
     * @param item The selected item
     * @memberof MenuComponent
     */
    selectItem(event: Event, item: MenuItem, isKeyEvent?: boolean): void;
    /**
     * Close the current menu and open the parent menu
     * @memberof MenuComponent
     */
    back(event: Event): void;
    /**
     * Emit the selected item
     * @param item The selected item
     */
    onSelection(item: MenuItem): void;
    /**
     * Open or close the child menu. When the child menu closes, the selected
     * item is reset.
     * @memberof MenuComponent
     */
    toggleChildMenu(open: boolean): void;
    /**
     * Handle key presses to navigate the menu
     */
    keyNavigate(event: KeyboardEvent): void;
    /**
     * Scroll to the item currently marked as 'is-selected'. Wait a tick for the
     * NgClassDirecitve or NavItemActiveDirective to respond to the model changes
     * and update the view.
     */
    scrollToSelectedItem(): void;
    private moveHighlightedUpOrDown;
    /**
     * Scroll to the specified menu item.
   * If no item is provided, it will scroll to the first item.
     *
   * @param item The menu item to scroll to.
     * @memberof MenuComponent
     */
    private scrollMenu;
    private scrollToHighlightedItem;
    private addKeydownListener;
    /**
     * Sets the menu item ids using its index if item doesn't already have one
     */
    private setItemIds;
    static ɵfac: i0.ɵɵFactoryDeclaration<MenuComponent, never>;
    static ɵcmp: i0.ɵɵComponentDeclaration<MenuComponent, "ec-menu", never, { "id": { "alias": "id"; "required": false; }; "items": { "alias": "items"; "required": false; }; "selected": { "alias": "selected"; "required": false; }; "parent": { "alias": "parent"; "required": false; }; "templateType": { "alias": "templateType"; "required": false; }; "customMenuTemplate": { "alias": "customMenuTemplate"; "required": false; }; "title": { "alias": "title"; "required": false; }; "showNoItems": { "alias": "showNoItems"; "required": false; }; "noDataText": { "alias": "noDataText"; "required": false; }; "enableKeyNav": { "alias": "enableKeyNav"; "required": false; }; "highlightedItem": { "alias": "highlightedItem"; "required": false; }; "maintainSelectedItem": { "alias": "maintainSelectedItem"; "required": false; }; "truncateItems": { "alias": "truncateItems"; "required": false; }; "preserveIconSpace": { "alias": "preserveIconSpace"; "required": false; }; "dropdownToggleButton": { "alias": "dropdownToggleButton"; "required": false; }; }, { "selectedChanged": "selectedChanged"; "menuClosed": "menuClosed"; }, never, never, false, never>;
}
