import type { OpenDetail } from '../shared/events.js'; import { UiElement } from '../shared/element.js'; import { UiMenuItem } from './menu-item.js'; import { type MenuSize, type MenuFocus, type MenuSelectDetail } from './menu-shared.js'; export * from './menu-item.js'; export * from './menu-divider.js'; export * from './menu-group.js'; export { openMenuFromKey } from './menu-shared.js'; export type { MenuSize, MenuFocus, MenuSelectDetail } from './menu-shared.js'; export type MenuPlacement = 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end'; /** Items in flattened-tree order: direct children, through ``s and groups. */ export declare function collectMenuItems(root: Element): UiMenuItem[]; declare const UiMenu_base: (new (...args: any[]) => import("../shared/align.ts").AlignAlias) & typeof UiElement; /** * Carbon `Menu`: the floating `role=menu` list behind `` and ``, * usable on its own with `show(anchor)`. Lives in the top layer (`popover="manual"`) at document * coordinates next to `anchor` (flips when it doesn't fit). On open, focus moves to the first * enabled item; Up/Down wrap, Home/End jump; Escape or Tab close and return focus; so does * activating an item, clicking outside or focus leaving. * * Nested submenus: ``s inside an item (see ``). * * @slot - ``, ``, `` * @fires ui-toggle - detail: { open } after it opens or closes * @attr align - Carbon's name for `placement` (same values) * @cssprop --ui-menu-padding / --ui-menu-border / --ui-menu-radius / --ui-menu-shadow - The menu box, as the dropdown lists * @cssprop --ui-menu-item-radius / --ui-menu-item-ink - Its rows (on ``) * @cssprop --ui-menu-min-width / --ui-menu-max-width - Width range (default 160px to 288px; Kanok: 180px to 320px) * @cssprop --ui-menu-item-height / --ui-menu-item-active-outline / --ui-menu-item-active-background - Every row's height and the focused row's ring or fill (on ``) */ export declare class UiMenu extends UiMenu_base { static readonly styles: import("lit").CSSResult; open: boolean; /** Accessible name of the menu (the trigger's label). */ label: string; size: MenuSize; placement: MenuPlacement; /** Make the menu as wide as the anchor (Carbon menu button with `bottom` / `top`). */ matchWidth: boolean; /** What the menu is positioned against; `show(anchor)` sets it. */ anchor: Element | null; private returnFocus; connectedCallback(): void; disconnectedCallback(): void; /** * Open next to `anchor`; `focus: 'last'` starts on the last item (Up Arrow on a menu button), * `none` leaves focus where it is (a submenu opened by hover). */ show(anchor?: Element, focus?: MenuFocus): void; /** Focus the first or last enabled item. */ focusItem(which: 'first' | 'last'): void; /** A submenu: the `` a `` renders for its child items. */ private get parentItem(); private initialFocus; private readonly typeahead; readonly hide: () => void; get items(): UiMenuItem[]; private enabledItems; protected updated(changed: Map): void; private onOpen; /** Inside the menu in the flattened tree: items may be light-DOM children slotted in from a parent component. */ private isInside; private onClose; private untrack?; private stopOutside?; private stopTracking; private readonly reposition; private position; /** Push row size and the icon / selection columns to every item (Carbon `with-icons` / `with-selectable-items`). */ private readonly sync; private readonly onDocumentPointerDown; private readonly onFocusOut; private readonly onKeydown; render(): import("lit-html").TemplateResult<1>; } export interface UiMenuEventMap extends HTMLElementEventMap { 'ui-toggle': CustomEvent; 'ui-select': CustomEvent; } /** Typed listeners for UiMenu's events (declaration merging with the class). */ export interface UiMenu { addEventListener(type: K, listener: (this: UiMenu, event: UiMenuEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; removeEventListener(type: K, listener: (this: UiMenu, event: UiMenuEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void; removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; } declare global { interface HTMLElementTagNameMap { 'ui-menu': UiMenu; } }