import { UiElement } from '../shared/element.js'; import { type MenuFocus, type MenuSelectDetail } from './menu-shared.js'; export type MenuItemKind = 'default' | 'danger'; /** * Carbon `MenuItem` / `MenuItemSelectable` (`selectable`) / radio item (inside a * ``). Activating it (click, Enter, Space) fires `ui-select` * and closes the menu. `kind="danger"` turns red on hover/focus; `danger-description` is read * after the label. `shortcut` is a hint only (nothing is registered). * * Submenu (Carbon nested `MenuItem`): put ``s (and groups / dividers) inside an item. * It shows a chevron and opens them in a `` beside it — on hover, click, Enter, Space or * Right Arrow (Left in RTL), which focuses the first item; Left Arrow or Escape closes just that * level and returns focus to the item. Activating a leaf fires `ui-select` and closes every level. * * @slot - Extra label content after `label`; `` children move to the submenu * @slot submenu - The submenu's items (children that are menu items get this slot automatically) * @slot icon - 16px icon (shown when any item in the menu has one — Carbon `renderIcon`) * @fires ui-select - detail: { value, label, checked } when activated (not when disabled) * @csspart icon - Icon cell * @csspart label - Label cell * @csspart shortcut - Shortcut hint * @csspart submenu - The nested `` * @csspart submenu-icon - The chevron of an item with a submenu * @cssprop --ui-menu-item-height - Row height for every size (default 24 / 32 / 40 / 48px by size; Kanok: 32px) * @cssprop --ui-menu-item-active-outline / --ui-menu-item-active-background - The focused row: its ring and its fill (default focus, transparent) * @cssprop --ui-menu-item-pointer-outline - The ring of a row focused by a mouse open or click, not the keyboard (default the focused row's ring, as Carbon; Kanok: none) */ export declare class UiMenuItem extends UiElement { static readonly styles: import("lit").CSSResult[]; label: string; /** Reported in `ui-select`; defaults to `label`. */ value: string; shortcut: string; kind: MenuItemKind; disabled: boolean; /** Carbon `MenuItemSelectable`: a `menuitemcheckbox` that toggles `checked`. */ selectable: boolean; checked: boolean; dangerDescription: string; /** Set by ``: this item is a `menuitemradio`. */ radio: boolean; /** True when the item has child items, which it shows in a submenu. */ private hasSubmenu; private submenuOpen; private readonly submenu?; private hoverTimer?; get selectValue(): string; constructor(); private readonly onKeydown; private readonly onPointerEnter; /** Leaving the item and its submenu (which is inside it in the DOM, so moving into it doesn't count). */ private readonly onPointerLeave; private readonly onFocusOut; /** Open the submenu; `focus` picks the item that takes focus (`none` for hover). */ openSubmenu(focus?: MenuFocus): void; closeSubmenu(): void; disconnectedCallback(): void; /** Children that are menu items go to the submenu; anything else stays label content. */ private readonly onDefaultSlotChange; private readonly syncHasSubmenu; connectedCallback(): void; protected updated(): void; /** What a click / Enter / Space does: opens the submenu, else toggles / selects and fires `ui-select`. */ activate(): void; private readonly onSubmenuToggle; /** The trailing cell: the submenu chevron, else the shortcut hint. */ private renderEnd; render(): import("lit-html").TemplateResult<1>; } export interface UiMenuItemEventMap extends HTMLElementEventMap { 'ui-select': CustomEvent; } /** Typed listeners for UiMenuItem's events (declaration merging with the class). */ export interface UiMenuItem { addEventListener(type: K, listener: (this: UiMenuItem, event: UiMenuItemEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; removeEventListener(type: K, listener: (this: UiMenuItem, event: UiMenuItemEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void; removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; } declare global { interface HTMLElementTagNameMap { 'ui-menu-item': UiMenuItem; } }