/** * Due to the recursive nature of the menu, we need to disable the event * bubbling and native event listener rules for this component. */ import { EventEmitter } from '../../stencil-public-runtime'; import type { Placement } from '@floating-ui/dom'; /** * @slot trigger - The button element that toggles the menu popover * @slot content - The content of the menu, should be wrapped in a ul element containing nv-menuitem elements */ export declare class NvMenu { el: HTMLNvMenuElement; private triggerElement; private popoverElement; private isHandlingKeyDown; /****************************************************************************/ /** * Use this to toggle the initial visibility of the menu, by default the menu * is hidden. */ open: boolean; /** * Use this if the menu is nested inside another menu. This will prevent the * parent menu from closing when the child menu is opened. */ readonly nested: boolean; /** * Use this to disable the menu from closing automatically when a menu item is * selected. */ readonly disableCloseOnSelect: boolean; /** * Decides where the menu shows up next to the button it's linked to (above, * below, to the sides). If there isn't enough room, it will adjust its * position on the axis to fit on the screen, so users can always see it. */ readonly placement: Placement; /** * List of items used to automatically generate dropdown items. This * provides an alternative to using the slot manually. * * @example * items = [{ * "label": "Option 1", * "value": "option1", * }, * { * "label": "Option 2", * "value": "option2", * }] */ readonly items?: { /** * The label of the menu item. */ label: string; /** * The value of the menu item. */ value?: string; /** * Whether the menu item is disabled. */ disabled?: boolean; /** * Whether the menu item has a submenu. */ hasSubmenu?: boolean; /** * The icon of the menu item. */ icon?: string; /** * The shortcut of the menu item. */ shortcut?: string; /** * Whether the menu item is nested. */ nested?: boolean; /** * The submenu items of the menu item. */ submenuItems?: InstanceType['items']; }[]; /****************************************************************************/ /** * Opens the menu. */ show(): Promise; /** * Closes the menu. */ close(): Promise; private focusFirstItem; private handleOpenChanged; /****************************************************************************/ /** * Emitted from nv-menuitem elements with the corresponding id and name when * selected (via click or keyboard). This event listener can be attached to * either the nv-menu or the nv-menuitem element. */ menuitemSelected: EventEmitter; /****************************************************************************/ handleMenuItemSelect(event: CustomEvent): void; handleKeydown(event: KeyboardEvent): void; /****************************************************************************/ componentWillRender(): void; /****************************************************************************/ /** * Generates menu items from the `items` property. * @param {MenuItem[]} items - The items to display in the menu. * @returns {HTMLElement[]} The rendered items. */ private renderMenuItems; render(): any; }