UNPKG

@limetech/lime-elements

Version:
49 lines (45 loc) 2.2 kB
import { r as registerInstance, h, H as Host } from './index-DBTJNfo7.js'; import { n as normalizeHotkeyString } from './hotkeys-BxrRWYts.js'; const menuItemMetaCss = () => `@charset "UTF-8";:host(limel-menu-item-meta){order:4;transform:translateX(0.5rem);display:inline-flex;align-items:center;gap:0.5rem;max-width:50%}*{box-sizing:border-box}limel-badge{--badge-background-color:var( --notification-badge-background-color, rgb(var(--color-red-default)) );--badge-text-color:var( --notification-badge-text-color, rgb(var(--color-white)) )}.command-text{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;opacity:0.7;font-size:var(--limel-theme-default-small-font-size)}.chevron{flex-shrink:0;border-color:transparent;border-left-color:var(--limel-theme-text-secondary-on-background-color);border-width:0.25rem 0 0.25rem 0.375rem;border-style:solid}`; const MenuItemMeta = class { constructor(hostRef) { registerInstance(this, hostRef); /** * Will be set to `true` when the menu item is disabled. */ this.disabled = false; /** * Shows a submenu chevron to indicate nested items */ this.showChevron = false; } render() { return (h(Host, { key: '4341b1cd34952fdd2dc40bc3c4b7eb909646d880' }, this.renderCommandText(), this.renderBadge(), this.renderChevron())); } renderCommandText() { if (this.hotkey) { const hotkey = normalizeHotkeyString(this.hotkey); if (hotkey) { return h("limel-hotkey", { value: hotkey, disabled: this.disabled }); } } if (!this.commandText) { return; } return h("span", { class: "command-text" }, this.commandText); } renderBadge() { if (this.badge === undefined) { return; } return h("limel-badge", { label: String(this.badge) }); } renderChevron() { if (!this.showChevron) { return; } return h("div", { class: "chevron", "aria-hidden": "true" }); } }; MenuItemMeta.style = menuItemMetaCss(); export { MenuItemMeta as limel_menu_item_meta };