@synergy-design-system/components
Version:
This package provides the base of the Synergy Design System as native web components. It uses [lit](https://www.lit.dev) and parts of [shoelace](https://shoelace.style/). Synergy officially supports the latest two versions of all major browsers (as define
74 lines (73 loc) • 3.08 kB
TypeScript
/**
* ---------------------------------------------------------------------
* 🔒 AUTOGENERATED BY VENDORISM
* Removing this comment will prevent it from being managed by it.
* ---------------------------------------------------------------------
*/
import SynergyElement from '../../internal/synergy-element.js';
import SynIcon from '../icon/icon.component.js';
import SynPopup from '../popup/popup.component.js';
import SynSpinner from '../spinner/spinner.component.js';
import type { CSSResultGroup } from 'lit';
/**
* @summary Menu items provide options for the user to pick from in a menu.
* @documentation https://synergy-design-system.github.io/?path=/docs/components-syn-menu-item--docs
* @status stable
* @since 2.0
*
* @dependency syn-icon
* @dependency syn-popup
* @dependency syn-spinner
*
* @slot - The menu item's label.
* @slot prefix - Used to prepend an icon or similar element to the menu item.
* @slot suffix - Used to append an icon or similar element to the menu item.
* @slot submenu - Used to denote a nested menu.
*
* @csspart base - The component's base wrapper.
* @csspart checked-icon - The checked icon, which is only visible when the menu item is checked.
* @csspart prefix - The prefix container.
* @csspart label - The menu item label.
* @csspart suffix - The suffix container.
* @csspart spinner - The spinner that shows when the menu item is in the loading state.
* @csspart spinner__base - The spinner's base part.
* @csspart submenu-icon - The submenu icon, visible only when the menu item has a submenu (not yet implemented).
*
* @cssproperty [--submenu-offset=-2px] - The distance submenus shift to overlap the parent menu.
*/
export default class SynMenuItem extends SynergyElement {
static styles: CSSResultGroup;
static dependencies: {
'syn-icon': typeof SynIcon;
'syn-popup': typeof SynPopup;
'syn-spinner': typeof SynSpinner;
};
private cachedTextLabel;
private readonly localize;
defaultSlot: HTMLSlotElement;
menuItem: HTMLElement;
/** The type of menu item to render. To use `checked`, this value must be set to `checkbox`. */
type: 'normal' | 'checkbox';
/** Draws the item in a checked state. */
checked: boolean;
/** A unique value to store in the menu item. This can be used as a way to identify menu items when selected. */
value: string;
/** Draws the menu item in a loading state. */
loading: boolean;
/** Draws the menu item in a disabled state, preventing selection. */
disabled: boolean;
private readonly hasSlotController;
private submenuController;
connectedCallback(): void;
disconnectedCallback(): void;
private handleDefaultSlotChange;
private handleHostClick;
private handleMouseOver;
handleCheckedChange(): void;
handleDisabledChange(): void;
handleTypeChange(): void;
/** Returns a text label based on the contents of the menu item's default slot. */
getTextLabel(): string;
isSubmenu(): boolean;
render(): import("lit").TemplateResult<1>;
}