@api-client/ui 0.5.21 → 0.5.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/.github/instructions/lit-best-practices.instructions.md +1 -0
  2. package/build/src/md/button/ui-button-group.d.ts +1 -0
  3. package/build/src/md/button/ui-button-group.d.ts.map +1 -1
  4. package/build/src/md/button/ui-button-group.js.map +1 -1
  5. package/build/src/md/button/ui-button.d.ts +2 -0
  6. package/build/src/md/button/ui-button.d.ts.map +1 -1
  7. package/build/src/md/button/ui-button.js.map +1 -1
  8. package/build/src/md/chip/ui-chip.d.ts +1 -0
  9. package/build/src/md/chip/ui-chip.d.ts.map +1 -1
  10. package/build/src/md/chip/ui-chip.js +1 -0
  11. package/build/src/md/chip/ui-chip.js.map +1 -1
  12. package/build/src/md/dialog/internals/Dialog.d.ts +0 -1
  13. package/build/src/md/dialog/internals/Dialog.d.ts.map +1 -1
  14. package/build/src/md/dialog/internals/Dialog.js.map +1 -1
  15. package/build/src/md/dialog/ui-dialog.d.ts +1 -0
  16. package/build/src/md/dialog/ui-dialog.d.ts.map +1 -1
  17. package/build/src/md/dialog/ui-dialog.js.map +1 -1
  18. package/build/src/md/divider/ui-divider.d.ts +1 -0
  19. package/build/src/md/divider/ui-divider.d.ts.map +1 -1
  20. package/build/src/md/divider/ui-divider.js +1 -0
  21. package/build/src/md/divider/ui-divider.js.map +1 -1
  22. package/build/src/md/dropdown-list/ui-dropdown-list.d.ts +1 -0
  23. package/build/src/md/dropdown-list/ui-dropdown-list.d.ts.map +1 -1
  24. package/build/src/md/dropdown-list/ui-dropdown-list.js.map +1 -1
  25. package/build/src/md/icon-button/ui-icon-button.d.ts +2 -0
  26. package/build/src/md/icon-button/ui-icon-button.d.ts.map +1 -1
  27. package/build/src/md/icon-button/ui-icon-button.js.map +1 -1
  28. package/build/src/md/list/internals/ListItem.styles.d.ts.map +1 -1
  29. package/build/src/md/list/internals/ListItem.styles.js +7 -0
  30. package/build/src/md/list/internals/ListItem.styles.js.map +1 -1
  31. package/build/src/md/list/ui-list-item.d.ts +1 -0
  32. package/build/src/md/list/ui-list-item.d.ts.map +1 -1
  33. package/build/src/md/list/ui-list-item.js +1 -0
  34. package/build/src/md/list/ui-list-item.js.map +1 -1
  35. package/build/src/md/list/ui-list.d.ts +1 -0
  36. package/build/src/md/list/ui-list.d.ts.map +1 -1
  37. package/build/src/md/list/ui-list.js.map +1 -1
  38. package/build/src/md/menu/internal/Menu.d.ts +13 -0
  39. package/build/src/md/menu/internal/Menu.d.ts.map +1 -1
  40. package/build/src/md/menu/internal/Menu.js +47 -31
  41. package/build/src/md/menu/internal/Menu.js.map +1 -1
  42. package/build/src/md/menu/internal/Menu.styles.d.ts.map +1 -1
  43. package/build/src/md/menu/internal/Menu.styles.js +14 -2
  44. package/build/src/md/menu/internal/Menu.styles.js.map +1 -1
  45. package/build/src/md/menu/internal/MenuItem.d.ts +22 -0
  46. package/build/src/md/menu/internal/MenuItem.d.ts.map +1 -1
  47. package/build/src/md/menu/internal/MenuItem.js +74 -1
  48. package/build/src/md/menu/internal/MenuItem.js.map +1 -1
  49. package/build/src/md/menu/internal/MenuItem.styles.d.ts.map +1 -1
  50. package/build/src/md/menu/internal/MenuItem.styles.js +23 -0
  51. package/build/src/md/menu/internal/MenuItem.styles.js.map +1 -1
  52. package/build/src/md/menu/ui-menu-item.d.ts +1 -4
  53. package/build/src/md/menu/ui-menu-item.d.ts.map +1 -1
  54. package/build/src/md/menu/ui-menu-item.js +1 -4
  55. package/build/src/md/menu/ui-menu-item.js.map +1 -1
  56. package/build/src/md/menu/ui-menu.d.ts +1 -0
  57. package/build/src/md/menu/ui-menu.d.ts.map +1 -1
  58. package/build/src/md/menu/ui-menu.js.map +1 -1
  59. package/build/src/md/tabs/ui-tabs.d.ts +1 -0
  60. package/build/src/md/tabs/ui-tabs.d.ts.map +1 -1
  61. package/build/src/md/tabs/ui-tabs.js.map +1 -1
  62. package/demo/md/menu/index.ts +146 -1
  63. package/package.json +1 -1
  64. package/src/md/button/ui-button-group.ts +2 -0
  65. package/src/md/button/ui-button.ts +3 -0
  66. package/src/md/chip/ui-chip.ts +2 -0
  67. package/src/md/dialog/internals/Dialog.ts +0 -2
  68. package/src/md/dialog/ui-dialog.ts +2 -0
  69. package/src/md/divider/ui-divider.ts +2 -0
  70. package/src/md/dropdown-list/ui-dropdown-list.ts +2 -0
  71. package/src/md/icon-button/ui-icon-button.ts +3 -0
  72. package/src/md/list/internals/ListItem.styles.ts +7 -0
  73. package/src/md/list/ui-list-item.ts +2 -0
  74. package/src/md/list/ui-list.ts +2 -0
  75. package/src/md/menu/internal/Menu.styles.ts +14 -2
  76. package/src/md/menu/internal/Menu.ts +53 -32
  77. package/src/md/menu/internal/MenuItem.styles.ts +23 -0
  78. package/src/md/menu/internal/MenuItem.ts +49 -0
  79. package/src/md/menu/ui-menu-item.ts +2 -4
  80. package/src/md/menu/ui-menu.ts +2 -0
  81. package/src/md/tabs/ui-tabs.ts +2 -0
  82. package/test/md/menu/Menu.test.ts +346 -0
  83. package/test/md/menu/MenuItem.test.ts +292 -0
@@ -1 +1 @@
1
- {"version":3,"file":"Menu.js","sourceRoot":"","sources":["../../../../../src/md/menu/internal/Menu.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAkC,MAAM,KAAK,CAAA;AAC1D,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,MAAM,MAAM,8BAA8B,CAAA;AAGjD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAEtD,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAA;;sBASlB,MAAM;;;;;;;;;;;;;;;iBAAnB,IAAK,SAAQ,WAAM;;;gCA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I,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAA;QAChC,CAAC;QAED;;WAEG;QACO,gBAAgB;YACxB,kDAAkD;YAClD,IAAI,CAAC,WAAW,EAAE,CAAA;QACpB,CAAC;QAEQ,MAAM;YACb,MAAM,OAAO,GAAG,QAAQ,CAAC;gBACvB,gBAAgB,EAAE,IAAI;aACvB,CAAC,CAAA;YAEF,OAAO,IAAI,CAAA;mBACI,OAAO;4BACE,IAAI,CAAC,gBAAgB;;KAE5C,CAAA;QACH,CAAC;;;AA1OH;;;;;;GAMG;AACH,oBAoOC","sourcesContent":["import { html, PropertyValues, TemplateResult } from 'lit'\nimport { property, state, queryAssignedElements } from 'lit/decorators.js'\nimport { classMap } from 'lit/directives/class-map.js'\nimport { nanoid } from 'nanoid'\nimport UiList from '../../list/internals/List.js'\nimport UiMenuItem from './MenuItem.js'\nimport UiSubMenu from './SubMenu.js'\nimport { setDisabled } from '../../../lib/disabled.js'\nimport UiListItem from '../../list/internals/ListItem.js'\nimport { bound } from '../../../decorators/bound.js'\n\n/**\n * Material Design 3 Menu component with sub-menu support.\n * Uses Popover API and Anchor Positioning API for modern positioning.\n *\n * @fires select - Dispatched when a menu item is selected\n * @fires close - Dispatched when the menu is closed\n */\nexport default class Menu extends UiList {\n /**\n * Whether the menu is currently open\n * @attribute\n */\n @property({ type: Boolean, reflect: true }) accessor open = false\n\n /**\n * Whether the menu is disabled\n * @attribute\n */\n @property({ type: Boolean, reflect: true }) accessor disabled = false\n\n /**\n * Currently active sub-menu\n */\n @state() accessor activeSubMenu: UiSubMenu | null = null\n\n /**\n * Assigned menu items from light DOM\n */\n @queryAssignedElements({ selector: 'ui-menu-item' }) protected accessor assignedMenuItems!: UiMenuItem[]\n\n constructor() {\n super()\n this.selector = 'ui-menu-item'\n this.ariaExpanded = 'false'\n this.addEventListener('beforetoggle', this.handleBeforeToggle.bind(this))\n }\n\n override connectedCallback(): void {\n super.connectedCallback()\n this.setAttribute('role', 'menu')\n this.setAttribute('tabindex', '-1')\n if (!this.hasAttribute('popover')) {\n this.setAttribute('popover', 'auto')\n }\n if (!this.id) {\n this.id = nanoid()\n }\n }\n\n protected override updated(changedProperties: PropertyValues<this>): void {\n super.updated(changedProperties)\n\n if (changedProperties.has('disabled')) {\n setDisabled(this, this.disabled)\n }\n }\n\n override togglePopover(force?: boolean): boolean {\n this.open = !this.open\n this.ariaExpanded = String(this.open)\n this.tabIndex = this.open ? 0 : -1\n const result = super.togglePopover(force)\n if (this.open) {\n this.positionMenu()\n this.focus()\n }\n return result\n }\n\n /**\n * Shows the menu\n */\n show(): void {\n this.tabIndex = 0 // Make menu focusable\n this.ariaExpanded = 'true'\n this.showPopover()\n this.open = true\n this.positionMenu()\n this.focus()\n this.dispatchEvent(new CustomEvent('open', { bubbles: false, composed: true }))\n }\n\n /**\n * Hides the menu\n */\n hide(): void {\n this.tabIndex = -1\n this.ariaExpanded = 'false'\n this.hidePopover()\n this.open = false\n this.closeSubMenu()\n this.dispatchEvent(new CustomEvent('close', { bubbles: false, composed: true }))\n }\n\n positionMenu(): void {\n // when there's more space above the anchor, position the menu above it\n const box = this.getBoundingClientRect()\n // Now, we determine, whether to position the menu above or below the anchor\n // in a way, that if we have enough space below the anchor, we position it below,\n // otherwise we position it above the anchor.\n\n // our starting point is the anchor being positioned below the anchor\n const menuBottom = box.top + box.height\n if (menuBottom <= innerHeight) {\n // if the menu fits below the anchor, we leave it as is.\n return\n }\n // we do not make association from the menu to the anchor, so we make an assumption\n // that the anchor is 40px high, which is the default height of a button.\n // it can be different, but this is a good starting point.\n const anchorHeight = 40\n const anchorBottom = box.top\n const anchorTop = anchorBottom - anchorHeight\n const menuHeight = box.height\n\n const spaceBelow = innerHeight - anchorBottom\n const spaceAbove = anchorTop\n\n const diffBelow = spaceBelow - menuHeight\n const diffAbove = spaceAbove - menuHeight\n // The initial check ensures the menu does not fit below. Now, check if it fits above.\n if (diffAbove >= 0) {\n this.style.setProperty('position-area', 'top span-right')\n } else if (diffAbove > diffBelow) {\n // It doesn't fit in either direction. Choose the one with less overflow (larger, i.e., less negative, diff).\n this.style.setProperty('position-area', 'top span-right')\n this.style.maxHeight = `${spaceAbove}px`\n } else {\n this.style.setProperty('position-area', 'bottom span-right')\n this.style.maxHeight = `${spaceBelow}px`\n }\n }\n\n /**\n * Handles beforetoggle event from popover\n */\n protected handleBeforeToggle(e: Event): void {\n const toggleEvent = e as ToggleEvent\n if (toggleEvent.newState === 'closed') {\n this.open = false\n this.closeSubMenu()\n }\n }\n\n /**\n * Handles keyboard navigation for the menu\n */\n override handleKeydown(e: KeyboardEvent): void {\n if (!this.open || e.defaultPrevented) return\n\n switch (e.key) {\n case 'Escape':\n e.preventDefault()\n this.hide()\n break\n case 'ArrowRight':\n e.preventDefault()\n this.openSubMenu()\n break\n case 'ArrowLeft':\n e.preventDefault()\n this.closeSubMenu()\n break\n default:\n // Let the parent UiList handle other keys\n super.handleKeydown(e)\n }\n }\n\n @bound\n handleSubMenuSelect(e: CustomEvent): void {\n super.notifySelect(e.detail.item, e.detail.index)\n }\n\n /**\n * Opens the sub-menu for the currently active item\n */\n protected openSubMenu(): void {\n const activeItem = this.activeListItem as UiMenuItem\n if (activeItem?.hasSubMenu) {\n activeItem.openSubMenu()\n }\n }\n\n /**\n * Closes the currently open sub-menu\n */\n closeSubMenu(): void {\n if (this.activeSubMenu) {\n this.activeSubMenu.removeEventListener('select', this.handleSubMenuSelect as EventListener)\n this.activeSubMenu.hide()\n this.activeSubMenu = null\n }\n }\n\n /**\n * Sets the active sub-menu\n */\n setActiveSubMenu(subMenu: UiSubMenu | null): void {\n this.activeSubMenu = subMenu\n subMenu?.addEventListener('select', this.handleSubMenuSelect as EventListener)\n }\n\n override notifySelect(item: UiListItem, index?: number): boolean {\n this.hide()\n return super.notifySelect(item, index)\n }\n\n /**\n * Handles sub-menu opening\n */\n protected handleSubMenuOpen(e: CustomEvent): void {\n const subMenu = e.detail.subMenu\n this.setActiveSubMenu(subMenu)\n }\n\n /**\n * Handles slot changes to update menu items\n */\n protected handleSlotChange(): void {\n // Update the items list when slot content changes\n this.updateItems()\n }\n\n override render(): TemplateResult {\n const classes = classMap({\n 'menu-container': true,\n })\n\n return html`\n <div class=${classes}>\n <slot @slotchange=${this.handleSlotChange}></slot>\n </div>\n `\n }\n}\n"]}
1
+ {"version":3,"file":"Menu.js","sourceRoot":"","sources":["../../../../../src/md/menu/internal/Menu.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAkC,MAAM,KAAK,CAAA;AAC1D,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,MAAM,MAAM,8BAA8B,CAAA;AACjD,OAAO,UAAU,MAAM,eAAe,CAAA;AAEtC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAEtD,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAA;;sBAUlB,MAAM;;;;;;;;;;;;;;;iBAAnB,IAAK,SAAQ,WAAM;;;gCAKrC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;oCAM1C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;yCAK1C,KAAK,EAAE;6CAKP,qBAAqB,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC;+CAiInD,KAAK;YAjJsC,iKAAS,IAAI,6BAAJ,IAAI,mFAAQ;YAMrB,6KAAS,QAAQ,6BAAR,QAAQ,2FAAQ;YAK5D,4LAAS,aAAa,6BAAb,aAAa,qGAAyB;YAKH,wMAAmB,iBAAiB,6BAAjB,iBAAiB,6GAAe;YAkIxG,4MAAA,mBAAmB,6DAElB;;;QApJ2C,0BALzB,mDAAI,8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C,WAAW,EAAE,CAAA;QACpB,CAAC;QAEQ,MAAM;YACb,MAAM,OAAO,GAAG,QAAQ,CAAC;gBACvB,gBAAgB,EAAE,IAAI;aACvB,CAAC,CAAA;YAEF,OAAO,IAAI,CAAA;mBACI,OAAO;4BACE,IAAI,CAAC,gBAAgB;;KAE5C,CAAA;QACH,CAAC;;;AA/PH;;;;;;;GAOG;AACH,oBAwPC","sourcesContent":["import { html, PropertyValues, TemplateResult } from 'lit'\nimport { property, state, queryAssignedElements } from 'lit/decorators.js'\nimport { classMap } from 'lit/directives/class-map.js'\nimport { nanoid } from 'nanoid'\nimport UiList from '../../list/internals/List.js'\nimport UiMenuItem from './MenuItem.js'\nimport UiSubMenu from './SubMenu.js'\nimport { setDisabled } from '../../../lib/disabled.js'\nimport UiListItem from '../../list/internals/ListItem.js'\nimport { bound } from '../../../decorators/bound.js'\n\n/**\n * Material Design 3 Menu component with sub-menu support.\n * Uses Popover API and Anchor Positioning API for modern positioning.\n *\n * @fires select - Dispatched when a menu item is selected\n * @fires close - Dispatched when the menu is closed\n * @fires open - Dispatched when the menu is opened\n */\nexport default class Menu extends UiList {\n /**\n * Whether the menu is currently open\n * @attribute\n */\n @property({ type: Boolean, reflect: true }) accessor open = false\n\n /**\n * Whether the menu is disabled\n * @attribute\n */\n @property({ type: Boolean, reflect: true }) accessor disabled = false\n\n /**\n * Currently active sub-menu\n */\n @state() accessor activeSubMenu: UiSubMenu | null = null\n\n /**\n * Assigned menu items from light DOM\n */\n @queryAssignedElements({ selector: 'ui-menu-item' }) protected accessor assignedMenuItems!: UiMenuItem[]\n\n constructor() {\n super()\n this.selector = 'ui-menu-item'\n this.ariaExpanded = 'false'\n this.addEventListener('beforetoggle', this.handleBeforeToggle.bind(this))\n }\n\n override connectedCallback(): void {\n super.connectedCallback()\n this.setAttribute('role', 'menu')\n this.setAttribute('tabindex', '-1')\n if (!this.hasAttribute('popover')) {\n this.setAttribute('popover', 'auto')\n }\n if (!this.id) {\n this.id = nanoid()\n }\n }\n\n protected override updated(changedProperties: PropertyValues<this>): void {\n super.updated(changedProperties)\n\n if (changedProperties.has('disabled')) {\n setDisabled(this, this.disabled)\n }\n }\n\n override togglePopover(force?: boolean): boolean {\n this.open = !this.open\n this.ariaExpanded = String(this.open)\n this.tabIndex = this.open ? 0 : -1\n const result = super.togglePopover(force)\n if (this.open) {\n this.positionMenu()\n this.focus()\n }\n return result\n }\n\n /**\n * Shows the menu\n */\n show(): void {\n this.tabIndex = 0 // Make menu focusable\n this.ariaExpanded = 'true'\n this.showPopover()\n this.open = true\n this.positionMenu()\n this.focus()\n this.dispatchEvent(new CustomEvent('open', { bubbles: false, composed: true }))\n }\n\n /**\n * Hides the menu\n */\n hide(): void {\n this.tabIndex = -1\n this.ariaExpanded = 'false'\n this.hidePopover()\n this.open = false\n this.closeSubMenu()\n this.dispatchEvent(new CustomEvent('close', { bubbles: false, composed: true }))\n }\n\n positionMenu(): void {\n // Let CSS anchor positioning handle the positioning automatically\n // Only intervene if we need to set max-height for overflow cases\n const box = this.getBoundingClientRect()\n const menuBottom = box.top + box.height\n const menuRight = box.left + box.width\n\n // Reset any previous manual positioning to let CSS anchor positioning work\n this.style.removeProperty('position-area')\n this.style.removeProperty('max-height')\n\n // Only set max-height if the menu would overflow\n if (menuBottom > innerHeight) {\n const availableHeight = innerHeight - box.top\n this.style.maxHeight = `${Math.max(200, availableHeight - 20)}px`\n }\n\n if (menuRight > innerWidth) {\n const availableWidth = innerWidth - box.left\n // Let CSS anchor positioning handle horizontal flipping\n // We could set max-width if needed\n if (availableWidth < 200) {\n this.style.maxWidth = `${Math.max(180, availableWidth - 20)}px`\n }\n }\n }\n\n /**\n * Handles beforetoggle event from popover\n */\n protected handleBeforeToggle(e: Event): void {\n const toggleEvent = e as ToggleEvent\n if (toggleEvent.newState === 'closed') {\n this.open = false\n this.closeSubMenu()\n }\n }\n\n /**\n * Handles keyboard navigation for the menu\n */\n override handleKeydown(e: KeyboardEvent): void {\n if (!this.open || e.defaultPrevented) return\n\n switch (e.key) {\n case 'Escape':\n e.preventDefault()\n this.hide()\n break\n case 'ArrowRight':\n e.preventDefault()\n this.openSubMenu()\n break\n case 'ArrowLeft':\n e.preventDefault()\n this.closeSubMenu()\n break\n default:\n // Let the parent UiList handle other keys\n super.handleKeydown(e)\n }\n }\n\n @bound\n handleSubMenuSelect(e: CustomEvent): void {\n super.notifySelect(e.detail.item, e.detail.index)\n }\n\n /**\n * Opens the sub-menu for the currently active item\n */\n protected openSubMenu(): void {\n const activeItem = this.activeListItem as UiMenuItem\n if (activeItem?.hasSubMenu) {\n activeItem.openSubMenu()\n }\n }\n\n /**\n * Closes the currently open sub-menu\n */\n closeSubMenu(): void {\n if (this.activeSubMenu) {\n this.activeSubMenu.removeEventListener('select', this.handleSubMenuSelect as EventListener)\n this.activeSubMenu.hide()\n this.activeSubMenu = null\n }\n }\n\n /**\n * Sets the active sub-menu\n */\n setActiveSubMenu(subMenu: UiSubMenu | null): void {\n this.activeSubMenu = subMenu\n subMenu?.addEventListener('select', this.handleSubMenuSelect as EventListener)\n }\n\n override notifySelect(item: UiListItem, index?: number): boolean {\n // Handle single selection\n if (item instanceof UiMenuItem) {\n this.clearSelection()\n item.selected = true\n }\n\n this.hide()\n return super.notifySelect(item, index)\n }\n\n /**\n * Clears selection from all menu items\n */\n protected clearSelection(): void {\n this.assignedMenuItems.forEach((menuItem) => {\n menuItem.selected = false\n })\n }\n\n /**\n * Gets the currently selected menu item\n */\n get selectedItem(): UiMenuItem | null {\n return this.assignedMenuItems.find((item) => item.selected) || null\n }\n\n /**\n * Sets the selected menu item\n */\n setSelectedItem(item: UiMenuItem | null): void {\n this.clearSelection()\n if (item) {\n item.selected = true\n }\n }\n\n /**\n * Handles sub-menu opening\n */\n protected handleSubMenuOpen(e: CustomEvent): void {\n const subMenu = e.detail.subMenu\n this.setActiveSubMenu(subMenu)\n }\n\n /**\n * Handles slot changes to update menu items\n */\n protected handleSlotChange(): void {\n // Update the items list when slot content changes\n this.updateItems()\n }\n\n override render(): TemplateResult {\n const classes = classMap({\n 'menu-container': true,\n })\n\n return html`\n <div class=${classes}>\n <slot @slotchange=${this.handleSlotChange}></slot>\n </div>\n `\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Menu.styles.d.ts","sourceRoot":"","sources":["../../../../../src/md/menu/internal/Menu.styles.ts"],"names":[],"mappings":";AAEA,wBA0LC"}
1
+ {"version":3,"file":"Menu.styles.d.ts","sourceRoot":"","sources":["../../../../../src/md/menu/internal/Menu.styles.ts"],"names":[],"mappings":";AAEA,wBAsMC"}
@@ -3,7 +3,7 @@ export default css `
3
3
  :host {
4
4
  display: none;
5
5
  position-area: bottom span-right;
6
- position-try: normal flip-block;
6
+ position-try: --menu-fallback-bottom-left, --menu-fallback-top-right, --menu-fallback-top-left, flip-block;
7
7
  position: absolute;
8
8
  margin: 0;
9
9
  padding: 0;
@@ -14,9 +14,21 @@ export default css `
14
14
  overflow: auto;
15
15
  }
16
16
 
17
+ @position-try --menu-fallback-bottom-left {
18
+ position-area: bottom span-left;
19
+ }
20
+
21
+ @position-try --menu-fallback-top-right {
22
+ position-area: top span-right;
23
+ }
24
+
25
+ @position-try --menu-fallback-top-left {
26
+ position-area: top span-left;
27
+ }
28
+
17
29
  :host(:popover-open) {
18
30
  display: block;
19
- background-color: var(--md-sys-color-surface);
31
+ background-color: var(--md-sys-color-surface-container-low);
20
32
  border-radius: var(--md-sys-shape-corner-extra-small);
21
33
  box-shadow: var(--md-sys-elevation-3);
22
34
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Menu.styles.js","sourceRoot":"","sources":["../../../../../src/md/menu/internal/Menu.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAEzB,eAAe,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0LjB,CAAA","sourcesContent":["import { css } from 'lit'\n\nexport default css`\n :host {\n display: none;\n position-area: bottom span-right;\n position-try: normal flip-block;\n position: absolute;\n margin: 0;\n padding: 0;\n border: none;\n overflow: hidden;\n /* in most cases the max-height won't matter as this assumes the whole screen to be available, which is rarely the truth. */\n max-height: 90vh;\n overflow: auto;\n }\n\n :host(:popover-open) {\n display: block;\n background-color: var(--md-sys-color-surface);\n border-radius: var(--md-sys-shape-corner-extra-small);\n box-shadow: var(--md-sys-elevation-3);\n }\n\n .menu-container {\n min-width: 200px;\n padding: 8px 0;\n outline: none;\n }\n\n .menu-divider {\n height: 1px;\n background-color: var(--md-sys-color-outline-variant);\n margin: 8px 0;\n }\n\n /* Menu Item Styles */\n .menu-item {\n position: relative;\n display: flex;\n align-items: center;\n min-height: 48px;\n padding: 0 16px;\n cursor: pointer;\n outline: none;\n transition: background-color 0.2s ease;\n }\n\n .menu-item:hover {\n background-color: var(--md-sys-color-surface-variant);\n }\n\n .menu-item:focus {\n background-color: var(--md-sys-color-surface-variant);\n }\n\n .menu-item[disabled] {\n opacity: 0.38;\n cursor: not-allowed;\n pointer-events: none;\n }\n\n .menu-item-content {\n display: flex;\n align-items: center;\n width: 100%;\n gap: 12px;\n }\n\n .menu-item-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 24px;\n height: 24px;\n color: var(--md-sys-color-on-surface);\n font-size: 20px;\n }\n\n .menu-item-label {\n flex: 1;\n color: var(--md-sys-color-on-surface);\n font-family: var(--md-sys-typescale-label-large-font-family-name);\n font-size: var(--md-sys-typescale-label-large-font-size);\n font-weight: var(--md-sys-typescale-label-large-font-weight);\n line-height: var(--md-sys-typescale-label-large-line-height);\n letter-spacing: var(--md-sys-typescale-label-large-letter-spacing);\n }\n\n .menu-item-arrow {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 24px;\n height: 24px;\n color: var(--md-sys-color-on-surface);\n font-size: 18px;\n font-weight: 500;\n }\n\n .menu-item-with-submenu {\n position: relative;\n }\n\n .menu-item-with-submenu:hover .menu-item-arrow {\n color: var(--md-sys-color-primary);\n }\n\n /* Sub-menu Styles */\n .submenu-container {\n min-width: 200px;\n max-width: 320px;\n background-color: var(--md-sys-color-surface);\n border-radius: var(--md-sys-shape-corner-extra-small);\n box-shadow: var(--md-sys-elevation-level3);\n padding: 8px 0;\n }\n\n /* Submenu positioning with Anchor API */\n ui-sub-menu {\n display: none;\n }\n\n ui-sub-menu:popover-open {\n display: block;\n background-color: var(--md-sys-color-surface);\n border-radius: var(--md-sys-shape-corner-extra-small);\n box-shadow: var(--md-sys-elevation-level3);\n min-width: 200px;\n max-width: 320px;\n padding: 8px 0;\n z-index: 1000;\n }\n\n /* Fallback positioning for browsers without anchor positioning */\n @supports not (anchor-name: --test) {\n ui-sub-menu:popover-open {\n position: fixed;\n transform: translateX(200px);\n }\n }\n\n /* Focus Ring */\n md-focus-ring {\n --md-focus-ring-color: var(--md-sys-color-primary);\n --md-focus-ring-width: 2px;\n }\n\n /* Ripple Effect */\n ui-ripple {\n --md-ripple-color: var(--md-sys-color-primary);\n --md-ripple-opacity: 0.12;\n }\n\n /* Responsive Design */\n @media (max-width: 600px) {\n .menu-container {\n min-width: 180px;\n max-width: 280px;\n }\n\n .submenu-container {\n min-width: 180px;\n max-width: 280px;\n }\n }\n\n /* High Contrast Mode */\n @media (prefers-contrast: high) {\n .menu-container {\n border: 1px solid var(--md-sys-color-outline);\n }\n\n .submenu-container {\n border: 1px solid var(--md-sys-color-outline);\n }\n\n .menu-divider {\n background-color: var(--md-sys-color-outline);\n }\n }\n\n /* Reduced Motion */\n @media (prefers-reduced-motion: reduce) {\n .menu-item {\n transition: none;\n }\n }\n`\n"]}
1
+ {"version":3,"file":"Menu.styles.js","sourceRoot":"","sources":["../../../../../src/md/menu/internal/Menu.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAEzB,eAAe,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsMjB,CAAA","sourcesContent":["import { css } from 'lit'\n\nexport default css`\n :host {\n display: none;\n position-area: bottom span-right;\n position-try: --menu-fallback-bottom-left, --menu-fallback-top-right, --menu-fallback-top-left, flip-block;\n position: absolute;\n margin: 0;\n padding: 0;\n border: none;\n overflow: hidden;\n /* in most cases the max-height won't matter as this assumes the whole screen to be available, which is rarely the truth. */\n max-height: 90vh;\n overflow: auto;\n }\n\n @position-try --menu-fallback-bottom-left {\n position-area: bottom span-left;\n }\n\n @position-try --menu-fallback-top-right {\n position-area: top span-right;\n }\n\n @position-try --menu-fallback-top-left {\n position-area: top span-left;\n }\n\n :host(:popover-open) {\n display: block;\n background-color: var(--md-sys-color-surface-container-low);\n border-radius: var(--md-sys-shape-corner-extra-small);\n box-shadow: var(--md-sys-elevation-3);\n }\n\n .menu-container {\n min-width: 200px;\n padding: 8px 0;\n outline: none;\n }\n\n .menu-divider {\n height: 1px;\n background-color: var(--md-sys-color-outline-variant);\n margin: 8px 0;\n }\n\n /* Menu Item Styles */\n .menu-item {\n position: relative;\n display: flex;\n align-items: center;\n min-height: 48px;\n padding: 0 16px;\n cursor: pointer;\n outline: none;\n transition: background-color 0.2s ease;\n }\n\n .menu-item:hover {\n background-color: var(--md-sys-color-surface-variant);\n }\n\n .menu-item:focus {\n background-color: var(--md-sys-color-surface-variant);\n }\n\n .menu-item[disabled] {\n opacity: 0.38;\n cursor: not-allowed;\n pointer-events: none;\n }\n\n .menu-item-content {\n display: flex;\n align-items: center;\n width: 100%;\n gap: 12px;\n }\n\n .menu-item-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 24px;\n height: 24px;\n color: var(--md-sys-color-on-surface);\n font-size: 20px;\n }\n\n .menu-item-label {\n flex: 1;\n color: var(--md-sys-color-on-surface);\n font-family: var(--md-sys-typescale-label-large-font-family-name);\n font-size: var(--md-sys-typescale-label-large-font-size);\n font-weight: var(--md-sys-typescale-label-large-font-weight);\n line-height: var(--md-sys-typescale-label-large-line-height);\n letter-spacing: var(--md-sys-typescale-label-large-letter-spacing);\n }\n\n .menu-item-arrow {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 24px;\n height: 24px;\n color: var(--md-sys-color-on-surface);\n font-size: 18px;\n font-weight: 500;\n }\n\n .menu-item-with-submenu {\n position: relative;\n }\n\n .menu-item-with-submenu:hover .menu-item-arrow {\n color: var(--md-sys-color-primary);\n }\n\n /* Sub-menu Styles */\n .submenu-container {\n min-width: 200px;\n max-width: 320px;\n background-color: var(--md-sys-color-surface);\n border-radius: var(--md-sys-shape-corner-extra-small);\n box-shadow: var(--md-sys-elevation-level3);\n padding: 8px 0;\n }\n\n /* Submenu positioning with Anchor API */\n ui-sub-menu {\n display: none;\n }\n\n ui-sub-menu:popover-open {\n display: block;\n background-color: var(--md-sys-color-surface);\n border-radius: var(--md-sys-shape-corner-extra-small);\n box-shadow: var(--md-sys-elevation-level3);\n min-width: 200px;\n max-width: 320px;\n padding: 8px 0;\n z-index: 1000;\n }\n\n /* Fallback positioning for browsers without anchor positioning */\n @supports not (anchor-name: --test) {\n ui-sub-menu:popover-open {\n position: fixed;\n transform: translateX(200px);\n }\n }\n\n /* Focus Ring */\n md-focus-ring {\n --md-focus-ring-color: var(--md-sys-color-primary);\n --md-focus-ring-width: 2px;\n }\n\n /* Ripple Effect */\n ui-ripple {\n --md-ripple-color: var(--md-sys-color-primary);\n --md-ripple-opacity: 0.12;\n }\n\n /* Responsive Design */\n @media (max-width: 600px) {\n .menu-container {\n min-width: 180px;\n max-width: 280px;\n }\n\n .submenu-container {\n min-width: 180px;\n max-width: 280px;\n }\n }\n\n /* High Contrast Mode */\n @media (prefers-contrast: high) {\n .menu-container {\n border: 1px solid var(--md-sys-color-outline);\n }\n\n .submenu-container {\n border: 1px solid var(--md-sys-color-outline);\n }\n\n .menu-divider {\n background-color: var(--md-sys-color-outline);\n }\n }\n\n /* Reduced Motion */\n @media (prefers-reduced-motion: reduce) {\n .menu-item {\n transition: none;\n }\n }\n`\n"]}
@@ -3,6 +3,7 @@ import UiListItem from '../../list/internals/ListItem.js';
3
3
  import UiSubMenu from './SubMenu.js';
4
4
  import '@material/web/focus/md-focus-ring.js';
5
5
  import '../../ripple/ui-ripple.js';
6
+ import '../../icons/ui-icon.js';
6
7
  /**
7
8
  * Material Design 3 Menu Item component.
8
9
  *
@@ -16,6 +17,22 @@ export default class UiMenuItem extends UiListItem {
16
17
  * @attribute
17
18
  */
18
19
  accessor submenu: string | undefined;
20
+ /**
21
+ * Whether this menu item is selected
22
+ * @attribute
23
+ */
24
+ accessor selected: boolean;
25
+ /**
26
+ * The value associated with this menu item. Use it to identify value associated with the menu item,
27
+ * when selected.
28
+ * @attribute
29
+ */
30
+ accessor value: string | undefined;
31
+ /**
32
+ * Whether to automatically show a check icon when selected
33
+ * @attribute
34
+ */
35
+ accessor showSelectionIcon: boolean;
19
36
  /**
20
37
  * Whether the menu item has a sub-menu
21
38
  */
@@ -39,6 +56,10 @@ export default class UiMenuItem extends UiListItem {
39
56
  * Updates accessibility attributes
40
57
  */
41
58
  protected updateAccessibility(): void;
59
+ /**
60
+ * Updates the selection state styling
61
+ */
62
+ protected updateSelectionState(): void;
42
63
  /**
43
64
  * Handles mouse enter events
44
65
  */
@@ -73,5 +94,6 @@ export default class UiMenuItem extends UiListItem {
73
94
  protected handleSubMenuSelect(e: CustomEvent): void;
74
95
  render(): TemplateResult;
75
96
  protected renderEnd(): TemplateResult;
97
+ protected renderStart(): TemplateResult;
76
98
  }
77
99
  //# sourceMappingURL=MenuItem.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MenuItem.d.ts","sourceRoot":"","sources":["../../../../../src/md/menu/internal/MenuItem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,cAAc,EAAE,cAAc,EAAE,MAAM,KAAK,CAAA;AAG1D,OAAO,UAAU,MAAM,kCAAkC,CAAA;AACzD,OAAO,SAAS,MAAM,cAAc,CAAA;AAIpC,OAAO,sCAAsC,CAAA;AAC7C,OAAO,2BAA2B,CAAA;AAElC;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,UAAU;IAChD;;;OAGG;IACyB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;IAEhE;;OAEG;IACH,IAAI,UAAU,IAAI,OAAO,CAExB;IAED;;OAEG;IACH,IAAI,cAAc,IAAI,SAAS,GAAG,IAAI,CAGrC;IAED;;OAEG;IACM,SAAS,CAAC,QAAQ,CAAC,WAAW,UAAQ;;IAStC,iBAAiB,IAAI,IAAI;cAUf,OAAO,CAAC,iBAAiB,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI;IASzE;;OAEG;IACH,SAAS,CAAC,sBAAsB,IAAI,IAAI;IAYxC;;OAEG;IACH,SAAS,CAAC,mBAAmB,IAAI,IAAI;IAUrC;;OAEG;IACH,SAAS,CAAC,gBAAgB,IAAI,IAAI;IAMlC;;OAEG;IACH,SAAS,CAAC,gBAAgB,IAAI,IAAI;IASlC;;OAEG;IACa,WAAW,CAAC,CAAC,EAAE,UAAU,GAAG,IAAI;IAUhD;;OAEG;IACH,SAAS,CAAC,mBAAmB,CAAC,CAAC,EAAE,UAAU,GAAG,IAAI;IAIlD;;OAEG;IACH,WAAW,IAAI,IAAI;IAgBnB;;OAEG;IACH,YAAY,IAAI,IAAI;IAQpB;;OAEG;IACH,aAAa,IAAI,IAAI;IAQrB;;OAEG;IACH,SAAS,CAAC,mBAAmB,CAAC,CAAC,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IACa,WAAW,CAAC,CAAC,EAAE,UAAU,GAAG,IAAI;IAUhD;;OAEG;IACH,SAAS,CAAC,mBAAmB,CAAC,CAAC,EAAE,UAAU,GAAG,IAAI;IAIlD;;OAEG;IACH,WAAW,IAAI,IAAI;IAgBnB;;OAEG;IACH,YAAY,IAAI,IAAI;IAQpB;;OAEG;IACH,aAAa,IAAI,IAAI;IAQrB;;OAEG;IACH,SAAS,CAAC,mBAAmB,CAAC,CAAC,EAAE,WAAW,GAAG,IAAI;IAW1C,MAAM,IAAI,cAAc;cAcd,SAAS,IAAI,cAAc;cAQ3B,WAAW,IAAI,cAAc;CAQjD"}
@@ -7,11 +7,21 @@ import { findElementInShadowRoots } from '../../../lib/Dom.js';
7
7
  import { nanoid } from 'nanoid';
8
8
  import '@material/web/focus/md-focus-ring.js';
9
9
  import '../../ripple/ui-ripple.js';
10
+ import '../../icons/ui-icon.js';
10
11
  let UiMenuItem = (() => {
11
12
  let _classSuper = UiListItem;
12
13
  let _submenu_decorators;
13
14
  let _submenu_initializers = [];
14
15
  let _submenu_extraInitializers = [];
16
+ let _selected_decorators;
17
+ let _selected_initializers = [];
18
+ let _selected_extraInitializers = [];
19
+ let _value_decorators;
20
+ let _value_initializers = [];
21
+ let _value_extraInitializers = [];
22
+ let _showSelectionIcon_decorators;
23
+ let _showSelectionIcon_initializers = [];
24
+ let _showSelectionIcon_extraInitializers = [];
15
25
  let _subMenuOpen_decorators;
16
26
  let _subMenuOpen_initializers = [];
17
27
  let _subMenuOpen_extraInitializers = [];
@@ -19,8 +29,14 @@ let UiMenuItem = (() => {
19
29
  static {
20
30
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
21
31
  _submenu_decorators = [property({ type: String })];
32
+ _selected_decorators = [property({ type: Boolean, reflect: true })];
33
+ _value_decorators = [property({ type: String, reflect: true })];
34
+ _showSelectionIcon_decorators = [property({ type: Boolean })];
22
35
  _subMenuOpen_decorators = [state()];
23
36
  __esDecorate(this, null, _submenu_decorators, { kind: "accessor", name: "submenu", static: false, private: false, access: { has: obj => "submenu" in obj, get: obj => obj.submenu, set: (obj, value) => { obj.submenu = value; } }, metadata: _metadata }, _submenu_initializers, _submenu_extraInitializers);
37
+ __esDecorate(this, null, _selected_decorators, { kind: "accessor", name: "selected", static: false, private: false, access: { has: obj => "selected" in obj, get: obj => obj.selected, set: (obj, value) => { obj.selected = value; } }, metadata: _metadata }, _selected_initializers, _selected_extraInitializers);
38
+ __esDecorate(this, null, _value_decorators, { kind: "accessor", name: "value", static: false, private: false, access: { has: obj => "value" in obj, get: obj => obj.value, set: (obj, value) => { obj.value = value; } }, metadata: _metadata }, _value_initializers, _value_extraInitializers);
39
+ __esDecorate(this, null, _showSelectionIcon_decorators, { kind: "accessor", name: "showSelectionIcon", static: false, private: false, access: { has: obj => "showSelectionIcon" in obj, get: obj => obj.showSelectionIcon, set: (obj, value) => { obj.showSelectionIcon = value; } }, metadata: _metadata }, _showSelectionIcon_initializers, _showSelectionIcon_extraInitializers);
24
40
  __esDecorate(this, null, _subMenuOpen_decorators, { kind: "accessor", name: "subMenuOpen", static: false, private: false, access: { has: obj => "subMenuOpen" in obj, get: obj => obj.subMenuOpen, set: (obj, value) => { obj.subMenuOpen = value; } }, metadata: _metadata }, _subMenuOpen_initializers, _subMenuOpen_extraInitializers);
25
41
  if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
26
42
  }
@@ -31,6 +47,38 @@ let UiMenuItem = (() => {
31
47
  */
32
48
  get submenu() { return this.#submenu_accessor_storage; }
33
49
  set submenu(value) { this.#submenu_accessor_storage = value; }
50
+ #selected_accessor_storage = (__runInitializers(this, _submenu_extraInitializers), __runInitializers(this, _selected_initializers, false
51
+ /**
52
+ * The value associated with this menu item. Use it to identify value associated with the menu item,
53
+ * when selected.
54
+ * @attribute
55
+ */
56
+ ));
57
+ /**
58
+ * Whether this menu item is selected
59
+ * @attribute
60
+ */
61
+ get selected() { return this.#selected_accessor_storage; }
62
+ set selected(value) { this.#selected_accessor_storage = value; }
63
+ #value_accessor_storage = (__runInitializers(this, _selected_extraInitializers), __runInitializers(this, _value_initializers, void 0));
64
+ /**
65
+ * The value associated with this menu item. Use it to identify value associated with the menu item,
66
+ * when selected.
67
+ * @attribute
68
+ */
69
+ get value() { return this.#value_accessor_storage; }
70
+ set value(value) { this.#value_accessor_storage = value; }
71
+ #showSelectionIcon_accessor_storage = (__runInitializers(this, _value_extraInitializers), __runInitializers(this, _showSelectionIcon_initializers, false
72
+ /**
73
+ * Whether the menu item has a sub-menu
74
+ */
75
+ ));
76
+ /**
77
+ * Whether to automatically show a check icon when selected
78
+ * @attribute
79
+ */
80
+ get showSelectionIcon() { return this.#showSelectionIcon_accessor_storage; }
81
+ set showSelectionIcon(value) { this.#showSelectionIcon_accessor_storage = value; }
34
82
  /**
35
83
  * Whether the menu item has a sub-menu
36
84
  */
@@ -45,7 +93,7 @@ let UiMenuItem = (() => {
45
93
  return null;
46
94
  return findElementInShadowRoots(this.submenu, this);
47
95
  }
48
- #subMenuOpen_accessor_storage = (__runInitializers(this, _submenu_extraInitializers), __runInitializers(this, _subMenuOpen_initializers, false));
96
+ #subMenuOpen_accessor_storage = (__runInitializers(this, _showSelectionIcon_extraInitializers), __runInitializers(this, _subMenuOpen_initializers, false));
49
97
  /**
50
98
  * Whether the sub-menu is open
51
99
  */
@@ -65,6 +113,8 @@ let UiMenuItem = (() => {
65
113
  if (!this.id) {
66
114
  this.id = nanoid(6);
67
115
  }
116
+ // Initialize selection state
117
+ this.updateSelectionState();
68
118
  }
69
119
  updated(changedProperties) {
70
120
  super.updated(changedProperties);
@@ -72,6 +122,9 @@ let UiMenuItem = (() => {
72
122
  this.updateAccessibility();
73
123
  this.setupSubmenuConnection();
74
124
  }
125
+ if (changedProperties.has('selected')) {
126
+ this.updateSelectionState();
127
+ }
75
128
  }
76
129
  /**
77
130
  * Sets up the connection between this menu item and its submenu
@@ -99,6 +152,19 @@ let UiMenuItem = (() => {
99
152
  this.removeAttribute('aria-expanded');
100
153
  }
101
154
  }
155
+ /**
156
+ * Updates the selection state styling
157
+ */
158
+ updateSelectionState() {
159
+ if (this.selected) {
160
+ this.classList.add('select');
161
+ this.setAttribute('aria-selected', 'true');
162
+ }
163
+ else {
164
+ this.classList.remove('select');
165
+ this.setAttribute('aria-selected', 'false');
166
+ }
167
+ }
102
168
  /**
103
169
  * Handles mouse enter events
104
170
  */
@@ -201,6 +267,13 @@ let UiMenuItem = (() => {
201
267
  <slot name="end" @slotchange=${this.handleSlotChange}></slot>
202
268
  <span class="trailing-supporting-text"><slot name="end-text"></slot></span>
203
269
  ${this.hasSubMenu ? html `<ui-icon class="menu-item-arrow">arrow_right</ui-icon>` : ''}
270
+ </div>`;
271
+ }
272
+ renderStart() {
273
+ const showCheckIcon = this.showSelectionIcon && this.selected;
274
+ return html `<div class="start">
275
+ ${showCheckIcon ? html `<ui-icon class="selection-check">check</ui-icon>` : ''}
276
+ <slot name="start" @slotchange=${this.handleSlotChange}></slot>
204
277
  </div>`;
205
278
  }
206
279
  };
@@ -1 +1 @@
1
- {"version":3,"file":"MenuItem.js","sourceRoot":"","sources":["../../../../../src/md/menu/internal/MenuItem.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAkC,MAAM,KAAK,CAAA;AAC1D,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AACtD,OAAO,UAAU,MAAM,kCAAkC,CAAA;AAEzD,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B,OAAO,sCAAsC,CAAA;AAC7C,OAAO,2BAA2B,CAAA;;sBASM,UAAU;;;;;;;iBAA7B,UAAW,SAAQ,WAAU;;;mCAK/C,QAAQ,CAAC,EAAE,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AE,CAAA;QAC7B,CAAC;QAED;;WAEG;QACH,aAAa;YACX,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;gBACrB,IAAI,CAAC,YAAY,EAAE,CAAA;YACrB,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,WAAW,EAAE,CAAA;YACpB,CAAC;QACH,CAAC;QAED;;WAEG;QACO,mBAAmB,CAAC,CAAc;YAC1C,gCAAgC;YAChC,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,QAAQ,EAAE;gBACxB,MAAM,EAAE,CAAC,CAAC,MAAM;gBAChB,OAAO,EAAE,IAAI;gBACb,QAAQ,EAAE,IAAI;aACf,CAAC,CACH,CAAA;QACH,CAAC;QAEQ,MAAM;YACb,MAAM,OAAO,GAAG,QAAQ,CAAC;gBACvB,SAAS,EAAE,IAAI;gBACf,WAAW,EAAE,IAAI;gBACjB,wBAAwB,EAAE,IAAI,CAAC,UAAU;gBACzC,cAAc,EAAE,IAAI,CAAC,WAAW;aACjC,CAAC,CAAA;YAEF,OAAO,IAAI,CAAA;QACP,IAAI,CAAC,eAAe,EAAE,IAAI,IAAI,CAAC,YAAY,EAAE;mBAClC,OAAO,oBAAoB,IAAI,CAAC,WAAW,EAAE,IAAI,IAAI,CAAC,UAAU,EAAE,IAAI,IAAI,CAAC,SAAS,EAAE;KACpG,CAAA;QACH,CAAC;QAEkB,SAAS;YAC1B,OAAO,IAAI,CAAA;qCACsB,IAAI,CAAC,gBAAgB;;QAElD,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAA,wDAAwD,CAAC,CAAC,CAAC,EAAE;WAChF,CAAA;QACT,CAAC;;;AA5MH;;;;;;GAMG;AACH,0BAsMC","sourcesContent":["import { html, PropertyValues, TemplateResult } from 'lit'\nimport { property, state } from 'lit/decorators.js'\nimport { classMap } from 'lit/directives/class-map.js'\nimport UiListItem from '../../list/internals/ListItem.js'\nimport UiSubMenu from './SubMenu.js'\nimport { findElementInShadowRoots } from '../../../lib/Dom.js'\nimport { nanoid } from 'nanoid'\n\nimport '@material/web/focus/md-focus-ring.js'\nimport '../../ripple/ui-ripple.js'\n\n/**\n * Material Design 3 Menu Item component.\n *\n * @slot - The menu item content (label, icon, etc.)\n * @fires select - Dispatched when the menu item is selected\n * @fires submenu-open - Dispatched when a sub-menu is opened\n */\nexport default class UiMenuItem extends UiListItem {\n /**\n * The ID of the associated submenu\n * @attribute\n */\n @property({ type: String }) accessor submenu: string | undefined\n\n /**\n * Whether the menu item has a sub-menu\n */\n get hasSubMenu(): boolean {\n return !!this.submenu && !!this.subMenuElement\n }\n\n /**\n * Reference to the sub-menu element\n */\n get subMenuElement(): UiSubMenu | null {\n if (!this.submenu) return null\n return findElementInShadowRoots(this.submenu, this) as UiSubMenu | null\n }\n\n /**\n * Whether the sub-menu is open\n */\n @state() protected accessor subMenuOpen = false\n\n constructor() {\n super()\n this.addEventListener('mouseenter', this.handleMouseEnter.bind(this))\n this.addEventListener('mouseleave', this.handleMouseLeave.bind(this))\n this.addEventListener('click', this.handleMenuItemClick.bind(this))\n }\n\n override connectedCallback(): void {\n super.connectedCallback()\n this.setAttribute('role', 'menuitem')\n\n // Generate ID if not present (needed for submenu anchoring)\n if (!this.id) {\n this.id = nanoid(6)\n }\n }\n\n protected override updated(changedProperties: PropertyValues<this>): void {\n super.updated(changedProperties)\n\n if (changedProperties.has('submenu')) {\n this.updateAccessibility()\n this.setupSubmenuConnection()\n }\n }\n\n /**\n * Sets up the connection between this menu item and its submenu\n */\n protected setupSubmenuConnection(): void {\n if (this.subMenuElement) {\n this.subMenuElement.anchor = this.id\n\n // Find parent menu and set it on the submenu\n const parentMenu = this.closest('ui-menu, ui-sub-menu') as UiSubMenu\n if (parentMenu) {\n this.subMenuElement.setParentMenu(parentMenu)\n }\n }\n }\n\n /**\n * Updates accessibility attributes\n */\n protected updateAccessibility(): void {\n if (this.hasSubMenu) {\n this.setAttribute('aria-haspopup', 'true')\n this.setAttribute('aria-expanded', String(this.subMenuOpen))\n } else {\n this.removeAttribute('aria-haspopup')\n this.removeAttribute('aria-expanded')\n }\n }\n\n /**\n * Handles mouse enter events\n */\n protected handleMouseEnter(): void {\n if (this.hasSubMenu && !this.subMenuOpen) {\n this.openSubMenu()\n }\n }\n\n /**\n * Handles mouse leave events\n */\n protected handleMouseLeave(): void {\n // Close sub-menu after a delay to allow moving to sub-menu\n setTimeout(() => {\n if (this.subMenuOpen && !this.matches(':hover') && !this.subMenuElement?.matches(':hover')) {\n this.closeSubMenu()\n }\n }, 100)\n }\n\n /**\n * Handles click events\n */\n public override handleClick(e: MouseEvent): void {\n if (this.hasSubMenu) {\n e.preventDefault()\n e.stopPropagation()\n this.toggleSubMenu()\n } else {\n super.handleClick(e)\n }\n }\n\n /**\n * Handles menu item click events\n */\n protected handleMenuItemClick(e: MouseEvent): void {\n this.handleClick(e)\n }\n\n /**\n * Opens the sub-menu\n */\n openSubMenu(): void {\n if (!this.hasSubMenu || this.subMenuOpen) return\n\n this.subMenuOpen = true\n this.updateAccessibility()\n this.subMenuElement?.show()\n\n this.dispatchEvent(\n new CustomEvent('submenu-open', {\n detail: { subMenu: this.subMenuElement },\n bubbles: true,\n composed: true,\n })\n )\n }\n\n /**\n * Closes the sub-menu\n */\n closeSubMenu(): void {\n if (!this.subMenuOpen) return\n\n this.subMenuOpen = false\n this.updateAccessibility()\n this.subMenuElement?.hide()\n }\n\n /**\n * Toggles the sub-menu\n */\n toggleSubMenu(): void {\n if (this.subMenuOpen) {\n this.closeSubMenu()\n } else {\n this.openSubMenu()\n }\n }\n\n /**\n * Handles sub-menu item selection\n */\n protected handleSubMenuSelect(e: CustomEvent): void {\n // Bubble up the selection event\n this.dispatchEvent(\n new CustomEvent('select', {\n detail: e.detail,\n bubbles: true,\n composed: true,\n })\n )\n }\n\n override render(): TemplateResult {\n const classes = classMap({\n 'surface': true,\n 'menu-item': true,\n 'menu-item-with-submenu': this.hasSubMenu,\n 'submenu-open': this.subMenuOpen,\n })\n\n return html`\n ${this.renderFocusRing()} ${this.renderRipple()}\n <div class=${classes} role=\"menuitem\">${this.renderStart()} ${this.renderBody()} ${this.renderEnd()}</div>\n `\n }\n\n protected override renderEnd(): TemplateResult {\n return html`<div class=\"end\">\n <slot name=\"end\" @slotchange=${this.handleSlotChange}></slot>\n <span class=\"trailing-supporting-text\"><slot name=\"end-text\"></slot></span>\n ${this.hasSubMenu ? html`<ui-icon class=\"menu-item-arrow\">arrow_right</ui-icon>` : ''}\n </div>`\n }\n}\n"]}
1
+ {"version":3,"file":"MenuItem.js","sourceRoot":"","sources":["../../../../../src/md/menu/internal/MenuItem.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAkC,MAAM,KAAK,CAAA;AAC1D,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AACtD,OAAO,UAAU,MAAM,kCAAkC,CAAA;AAEzD,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B,OAAO,sCAAsC,CAAA;AAC7C,OAAO,2BAA2B,CAAA;AAClC,OAAO,wBAAwB,CAAA;;sBASS,UAAU;;;;;;;;;;;;;;;;iBAA7B,UAAW,SAAQ,WAAU;;;mCAK/C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oCAM1B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;iCAO1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;6CAMzC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uCAoB3B,KAAK,EAAE;YAvCoB,0KAAS,OAAO,6BAAP,OAAO,yFAAoB;YAMpB,6KAAS,QAAQ,6BAAR,QAAQ,2FAAQ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AO,EAAE,IAAI;gBACb,QAAQ,EAAE,IAAI;aACf,CAAC,CACH,CAAA;QACH,CAAC;QAEQ,MAAM;YACb,MAAM,OAAO,GAAG,QAAQ,CAAC;gBACvB,SAAS,EAAE,IAAI;gBACf,WAAW,EAAE,IAAI;gBACjB,wBAAwB,EAAE,IAAI,CAAC,UAAU;gBACzC,cAAc,EAAE,IAAI,CAAC,WAAW;aACjC,CAAC,CAAA;YAEF,OAAO,IAAI,CAAA;QACP,IAAI,CAAC,eAAe,EAAE,IAAI,IAAI,CAAC,YAAY,EAAE;mBAClC,OAAO,oBAAoB,IAAI,CAAC,WAAW,EAAE,IAAI,IAAI,CAAC,UAAU,EAAE,IAAI,IAAI,CAAC,SAAS,EAAE;KACpG,CAAA;QACH,CAAC;QAEkB,SAAS;YAC1B,OAAO,IAAI,CAAA;qCACsB,IAAI,CAAC,gBAAgB;;QAElD,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAA,wDAAwD,CAAC,CAAC,CAAC,EAAE;WAChF,CAAA;QACT,CAAC;QAEkB,WAAW;YAC5B,MAAM,aAAa,GAAG,IAAI,CAAC,iBAAiB,IAAI,IAAI,CAAC,QAAQ,CAAA;YAE7D,OAAO,IAAI,CAAA;QACP,aAAa,CAAC,CAAC,CAAC,IAAI,CAAA,kDAAkD,CAAC,CAAC,CAAC,EAAE;uCAC5C,IAAI,CAAC,gBAAgB;WACjD,CAAA;QACT,CAAC;;;AA5PH;;;;;;GAMG;AACH,0BAsPC","sourcesContent":["import { html, PropertyValues, TemplateResult } from 'lit'\nimport { property, state } from 'lit/decorators.js'\nimport { classMap } from 'lit/directives/class-map.js'\nimport UiListItem from '../../list/internals/ListItem.js'\nimport UiSubMenu from './SubMenu.js'\nimport { findElementInShadowRoots } from '../../../lib/Dom.js'\nimport { nanoid } from 'nanoid'\n\nimport '@material/web/focus/md-focus-ring.js'\nimport '../../ripple/ui-ripple.js'\nimport '../../icons/ui-icon.js'\n\n/**\n * Material Design 3 Menu Item component.\n *\n * @slot - The menu item content (label, icon, etc.)\n * @fires select - Dispatched when the menu item is selected\n * @fires submenu-open - Dispatched when a sub-menu is opened\n */\nexport default class UiMenuItem extends UiListItem {\n /**\n * The ID of the associated submenu\n * @attribute\n */\n @property({ type: String }) accessor submenu: string | undefined\n\n /**\n * Whether this menu item is selected\n * @attribute\n */\n @property({ type: Boolean, reflect: true }) accessor selected = false\n\n /**\n * The value associated with this menu item. Use it to identify value associated with the menu item,\n * when selected.\n * @attribute\n */\n @property({ type: String, reflect: true }) accessor value: string | undefined\n\n /**\n * Whether to automatically show a check icon when selected\n * @attribute\n */\n @property({ type: Boolean }) accessor showSelectionIcon = false\n\n /**\n * Whether the menu item has a sub-menu\n */\n get hasSubMenu(): boolean {\n return !!this.submenu && !!this.subMenuElement\n }\n\n /**\n * Reference to the sub-menu element\n */\n get subMenuElement(): UiSubMenu | null {\n if (!this.submenu) return null\n return findElementInShadowRoots(this.submenu, this) as UiSubMenu | null\n }\n\n /**\n * Whether the sub-menu is open\n */\n @state() protected accessor subMenuOpen = false\n\n constructor() {\n super()\n this.addEventListener('mouseenter', this.handleMouseEnter.bind(this))\n this.addEventListener('mouseleave', this.handleMouseLeave.bind(this))\n this.addEventListener('click', this.handleMenuItemClick.bind(this))\n }\n\n override connectedCallback(): void {\n super.connectedCallback()\n this.setAttribute('role', 'menuitem')\n\n // Generate ID if not present (needed for submenu anchoring)\n if (!this.id) {\n this.id = nanoid(6)\n }\n\n // Initialize selection state\n this.updateSelectionState()\n }\n\n protected override updated(changedProperties: PropertyValues<this>): void {\n super.updated(changedProperties)\n\n if (changedProperties.has('submenu')) {\n this.updateAccessibility()\n this.setupSubmenuConnection()\n }\n\n if (changedProperties.has('selected')) {\n this.updateSelectionState()\n }\n }\n\n /**\n * Sets up the connection between this menu item and its submenu\n */\n protected setupSubmenuConnection(): void {\n if (this.subMenuElement) {\n this.subMenuElement.anchor = this.id\n\n // Find parent menu and set it on the submenu\n const parentMenu = this.closest('ui-menu, ui-sub-menu') as UiSubMenu\n if (parentMenu) {\n this.subMenuElement.setParentMenu(parentMenu)\n }\n }\n }\n\n /**\n * Updates accessibility attributes\n */\n protected updateAccessibility(): void {\n if (this.hasSubMenu) {\n this.setAttribute('aria-haspopup', 'true')\n this.setAttribute('aria-expanded', String(this.subMenuOpen))\n } else {\n this.removeAttribute('aria-haspopup')\n this.removeAttribute('aria-expanded')\n }\n }\n\n /**\n * Updates the selection state styling\n */\n protected updateSelectionState(): void {\n if (this.selected) {\n this.classList.add('select')\n this.setAttribute('aria-selected', 'true')\n } else {\n this.classList.remove('select')\n this.setAttribute('aria-selected', 'false')\n }\n }\n\n /**\n * Handles mouse enter events\n */\n protected handleMouseEnter(): void {\n if (this.hasSubMenu && !this.subMenuOpen) {\n this.openSubMenu()\n }\n }\n\n /**\n * Handles mouse leave events\n */\n protected handleMouseLeave(): void {\n // Close sub-menu after a delay to allow moving to sub-menu\n setTimeout(() => {\n if (this.subMenuOpen && !this.matches(':hover') && !this.subMenuElement?.matches(':hover')) {\n this.closeSubMenu()\n }\n }, 100)\n }\n\n /**\n * Handles click events\n */\n public override handleClick(e: MouseEvent): void {\n if (this.hasSubMenu) {\n e.preventDefault()\n e.stopPropagation()\n this.toggleSubMenu()\n } else {\n super.handleClick(e)\n }\n }\n\n /**\n * Handles menu item click events\n */\n protected handleMenuItemClick(e: MouseEvent): void {\n this.handleClick(e)\n }\n\n /**\n * Opens the sub-menu\n */\n openSubMenu(): void {\n if (!this.hasSubMenu || this.subMenuOpen) return\n\n this.subMenuOpen = true\n this.updateAccessibility()\n this.subMenuElement?.show()\n\n this.dispatchEvent(\n new CustomEvent('submenu-open', {\n detail: { subMenu: this.subMenuElement },\n bubbles: true,\n composed: true,\n })\n )\n }\n\n /**\n * Closes the sub-menu\n */\n closeSubMenu(): void {\n if (!this.subMenuOpen) return\n\n this.subMenuOpen = false\n this.updateAccessibility()\n this.subMenuElement?.hide()\n }\n\n /**\n * Toggles the sub-menu\n */\n toggleSubMenu(): void {\n if (this.subMenuOpen) {\n this.closeSubMenu()\n } else {\n this.openSubMenu()\n }\n }\n\n /**\n * Handles sub-menu item selection\n */\n protected handleSubMenuSelect(e: CustomEvent): void {\n // Bubble up the selection event\n this.dispatchEvent(\n new CustomEvent('select', {\n detail: e.detail,\n bubbles: true,\n composed: true,\n })\n )\n }\n\n override render(): TemplateResult {\n const classes = classMap({\n 'surface': true,\n 'menu-item': true,\n 'menu-item-with-submenu': this.hasSubMenu,\n 'submenu-open': this.subMenuOpen,\n })\n\n return html`\n ${this.renderFocusRing()} ${this.renderRipple()}\n <div class=${classes} role=\"menuitem\">${this.renderStart()} ${this.renderBody()} ${this.renderEnd()}</div>\n `\n }\n\n protected override renderEnd(): TemplateResult {\n return html`<div class=\"end\">\n <slot name=\"end\" @slotchange=${this.handleSlotChange}></slot>\n <span class=\"trailing-supporting-text\"><slot name=\"end-text\"></slot></span>\n ${this.hasSubMenu ? html`<ui-icon class=\"menu-item-arrow\">arrow_right</ui-icon>` : ''}\n </div>`\n }\n\n protected override renderStart(): TemplateResult {\n const showCheckIcon = this.showSelectionIcon && this.selected\n\n return html`<div class=\"start\">\n ${showCheckIcon ? html`<ui-icon class=\"selection-check\">check</ui-icon>` : ''}\n <slot name=\"start\" @slotchange=${this.handleSlotChange}></slot>\n </div>`\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"MenuItem.styles.d.ts","sourceRoot":"","sources":["../../../../../src/md/menu/internal/MenuItem.styles.ts"],"names":[],"mappings":";AAEA,wBA6DC"}
1
+ {"version":3,"file":"MenuItem.styles.d.ts","sourceRoot":"","sources":["../../../../../src/md/menu/internal/MenuItem.styles.ts"],"names":[],"mappings":";AAEA,wBAoFC"}
@@ -53,6 +53,7 @@ export default css `
53
53
  md-focus-ring {
54
54
  --md-focus-ring-color: var(--md-sys-color-primary);
55
55
  --md-focus-ring-width: 2px;
56
+ z-index: 2;
56
57
  }
57
58
 
58
59
  /* Ripple Effect */
@@ -60,5 +61,27 @@ export default css `
60
61
  --md-ripple-color: var(--md-sys-color-primary);
61
62
  --md-ripple-opacity: 0.12;
62
63
  }
64
+
65
+ /* Selected state */
66
+ :host(.select) .menu-item,
67
+ :host([selected]) .menu-item {
68
+ background-color: var(--md-sys-color-secondary-container);
69
+ color: var(--md-sys-color-on-secondary-container);
70
+ }
71
+
72
+ :host(.select) .menu-item:hover,
73
+ :host([selected]) .menu-item:hover {
74
+ background-color: var(--md-sys-color-secondary-container);
75
+ opacity: 0.92;
76
+ }
77
+
78
+ /* Selection check icon */
79
+ .selection-check {
80
+ color: var(--md-sys-color-on-surface-variant);
81
+ fill: var(--md-sys-color-on-surface-variant);
82
+ width: 24px;
83
+ height: 24px;
84
+ margin-right: 8px;
85
+ }
63
86
  `;
64
87
  //# sourceMappingURL=MenuItem.styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MenuItem.styles.js","sourceRoot":"","sources":["../../../../../src/md/menu/internal/MenuItem.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAEzB,eAAe,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6DjB,CAAA","sourcesContent":["import { css } from 'lit'\n\nexport default css`\n :host {\n display: block;\n position: relative;\n }\n\n .menu-item {\n position: relative;\n display: flex;\n align-items: center;\n min-height: 48px;\n padding: 0 16px;\n cursor: pointer;\n outline: none;\n transition: background-color 0.2s ease;\n }\n\n .menu-item:hover {\n background-color: var(--md-sys-color-surface-variant);\n }\n\n .menu-item:focus {\n background-color: var(--md-sys-color-surface-variant);\n }\n\n .menu-item[disabled] {\n opacity: 0.38;\n cursor: not-allowed;\n pointer-events: none;\n }\n\n .menu-item-with-submenu {\n position: relative;\n }\n\n .menu-item-with-submenu:hover .menu-item-arrow {\n color: var(--md-sys-color-primary);\n }\n\n .menu-item-arrow {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 24px;\n height: 24px;\n color: var(--md-sys-color-on-surface);\n font-size: 18px;\n font-weight: 500;\n }\n\n /* Focus Ring */\n md-focus-ring {\n --md-focus-ring-color: var(--md-sys-color-primary);\n --md-focus-ring-width: 2px;\n }\n\n /* Ripple Effect */\n ui-ripple {\n --md-ripple-color: var(--md-sys-color-primary);\n --md-ripple-opacity: 0.12;\n }\n`\n"]}
1
+ {"version":3,"file":"MenuItem.styles.js","sourceRoot":"","sources":["../../../../../src/md/menu/internal/MenuItem.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAEzB,eAAe,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoFjB,CAAA","sourcesContent":["import { css } from 'lit'\n\nexport default css`\n :host {\n display: block;\n position: relative;\n }\n\n .menu-item {\n position: relative;\n display: flex;\n align-items: center;\n min-height: 48px;\n padding: 0 16px;\n cursor: pointer;\n outline: none;\n transition: background-color 0.2s ease;\n }\n\n .menu-item:hover {\n background-color: var(--md-sys-color-surface-variant);\n }\n\n .menu-item:focus {\n background-color: var(--md-sys-color-surface-variant);\n }\n\n .menu-item[disabled] {\n opacity: 0.38;\n cursor: not-allowed;\n pointer-events: none;\n }\n\n .menu-item-with-submenu {\n position: relative;\n }\n\n .menu-item-with-submenu:hover .menu-item-arrow {\n color: var(--md-sys-color-primary);\n }\n\n .menu-item-arrow {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 24px;\n height: 24px;\n color: var(--md-sys-color-on-surface);\n font-size: 18px;\n font-weight: 500;\n }\n\n /* Focus Ring */\n md-focus-ring {\n --md-focus-ring-color: var(--md-sys-color-primary);\n --md-focus-ring-width: 2px;\n z-index: 2;\n }\n\n /* Ripple Effect */\n ui-ripple {\n --md-ripple-color: var(--md-sys-color-primary);\n --md-ripple-opacity: 0.12;\n }\n\n /* Selected state */\n :host(.select) .menu-item,\n :host([selected]) .menu-item {\n background-color: var(--md-sys-color-secondary-container);\n color: var(--md-sys-color-on-secondary-container);\n }\n\n :host(.select) .menu-item:hover,\n :host([selected]) .menu-item:hover {\n background-color: var(--md-sys-color-secondary-container);\n opacity: 0.92;\n }\n\n /* Selection check icon */\n .selection-check {\n color: var(--md-sys-color-on-surface-variant);\n fill: var(--md-sys-color-on-surface-variant);\n width: 24px;\n height: 24px;\n margin-right: 8px;\n }\n`\n"]}
@@ -4,10 +4,6 @@ import Element from './internal/MenuItem.js';
4
4
  * Material Design 3 Menu Item component.
5
5
  *
6
6
  * @element ui-menu-item
7
- * @attribute {Object} data - The menu item data object
8
- * @attribute {boolean} disabled - Whether the menu item is disabled
9
- * @fires select - Dispatched when the menu item is selected
10
- * @fires submenu-open - Dispatched when a sub-menu is opened
11
7
  */
12
8
  export declare class UiMenuItemElement extends Element {
13
9
  static styles: CSSResultOrNative[];
@@ -17,4 +13,5 @@ declare global {
17
13
  'ui-menu-item': UiMenuItemElement;
18
14
  }
19
15
  }
16
+ export { ListItemImage, ListItemLines } from '../list/internals/ListItem.js';
20
17
  //# sourceMappingURL=ui-menu-item.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ui-menu-item.d.ts","sourceRoot":"","sources":["../../../../src/md/menu/ui-menu-item.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,KAAK,CAAA;AAE5C,OAAO,OAAO,MAAM,wBAAwB,CAAA;AAI5C;;;;;;;;GAQG;AACH,qBACa,iBAAkB,SAAQ,OAAO;IAC5C,OAAgB,MAAM,EAAE,iBAAiB,EAAE,CAAuB;CACnE;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,iBAAiB,CAAA;KAClC;CACF"}
1
+ {"version":3,"file":"ui-menu-item.d.ts","sourceRoot":"","sources":["../../../../src/md/menu/ui-menu-item.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,KAAK,CAAA;AAE5C,OAAO,OAAO,MAAM,wBAAwB,CAAA;AAI5C;;;;GAIG;AACH,qBACa,iBAAkB,SAAQ,OAAO;IAC5C,OAAgB,MAAM,EAAE,iBAAiB,EAAE,CAAuB;CACnE;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,iBAAiB,CAAA;KAClC;CACF;AAED,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA"}
@@ -7,10 +7,6 @@ import listStyles from '../list/internals/ListItem.styles.js';
7
7
  * Material Design 3 Menu Item component.
8
8
  *
9
9
  * @element ui-menu-item
10
- * @attribute {Object} data - The menu item data object
11
- * @attribute {boolean} disabled - Whether the menu item is disabled
12
- * @fires select - Dispatched when the menu item is selected
13
- * @fires submenu-open - Dispatched when a sub-menu is opened
14
10
  */
15
11
  let UiMenuItemElement = (() => {
16
12
  let _classDecorators = [customElement('ui-menu-item')];
@@ -34,4 +30,5 @@ let UiMenuItemElement = (() => {
34
30
  return UiMenuItemElement = _classThis;
35
31
  })();
36
32
  export { UiMenuItemElement };
33
+ export { ListItemImage, ListItemLines } from '../list/internals/ListItem.js';
37
34
  //# sourceMappingURL=ui-menu-item.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ui-menu-item.js","sourceRoot":"","sources":["../../../../src/md/menu/ui-menu-item.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,OAAO,MAAM,wBAAwB,CAAA;AAC5C,OAAO,MAAM,MAAM,+BAA+B,CAAA;AAClD,OAAO,UAAU,MAAM,sCAAsC,CAAA;AAE7D;;;;;;;;GAQG;IAEU,iBAAiB;4BAD7B,aAAa,CAAC,cAAc,CAAC;;;;sBACS,OAAO;iCAAf,SAAQ,WAAO;;;;YAA9C,6KAEC;;;;QADC,MAAM,CAAU,MAAM,GAAwB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;;YADvD,uDAAiB;;;;;SAAjB,iBAAiB","sourcesContent":["import type { CSSResultOrNative } from 'lit'\nimport { customElement } from 'lit/decorators.js'\nimport Element from './internal/MenuItem.js'\nimport styles from './internal/MenuItem.styles.js'\nimport listStyles from '../list/internals/ListItem.styles.js'\n\n/**\n * Material Design 3 Menu Item component.\n *\n * @element ui-menu-item\n * @attribute {Object} data - The menu item data object\n * @attribute {boolean} disabled - Whether the menu item is disabled\n * @fires select - Dispatched when the menu item is selected\n * @fires submenu-open - Dispatched when a sub-menu is opened\n */\n@customElement('ui-menu-item')\nexport class UiMenuItemElement extends Element {\n static override styles: CSSResultOrNative[] = [styles, listStyles]\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ui-menu-item': UiMenuItemElement\n }\n}\n"]}
1
+ {"version":3,"file":"ui-menu-item.js","sourceRoot":"","sources":["../../../../src/md/menu/ui-menu-item.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,OAAO,MAAM,wBAAwB,CAAA;AAC5C,OAAO,MAAM,MAAM,+BAA+B,CAAA;AAClD,OAAO,UAAU,MAAM,sCAAsC,CAAA;AAE7D;;;;GAIG;IAEU,iBAAiB;4BAD7B,aAAa,CAAC,cAAc,CAAC;;;;sBACS,OAAO;iCAAf,SAAQ,WAAO;;;;YAA9C,6KAEC;;;;QADC,MAAM,CAAU,MAAM,GAAwB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;;YADvD,uDAAiB;;;;;SAAjB,iBAAiB;AAU9B,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA","sourcesContent":["import type { CSSResultOrNative } from 'lit'\nimport { customElement } from 'lit/decorators.js'\nimport Element from './internal/MenuItem.js'\nimport styles from './internal/MenuItem.styles.js'\nimport listStyles from '../list/internals/ListItem.styles.js'\n\n/**\n * Material Design 3 Menu Item component.\n *\n * @element ui-menu-item\n */\n@customElement('ui-menu-item')\nexport class UiMenuItemElement extends Element {\n static override styles: CSSResultOrNative[] = [styles, listStyles]\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ui-menu-item': UiMenuItemElement\n }\n}\n\nexport { ListItemImage, ListItemLines } from '../list/internals/ListItem.js'\n"]}
@@ -19,4 +19,5 @@ declare global {
19
19
  'ui-menu': UiMenuElement;
20
20
  }
21
21
  }
22
+ export type { UiListItemsChange, UiListSelection } from '../list/internals/List.js';
22
23
  //# sourceMappingURL=ui-menu.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ui-menu.d.ts","sourceRoot":"","sources":["../../../../src/md/menu/ui-menu.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,KAAK,CAAA;AAE5C,OAAO,OAAO,MAAM,oBAAoB,CAAA;AAGxC;;;;;;;;;;GAUG;AACH,qBACa,aAAc,SAAQ,OAAO;IACxC,OAAgB,MAAM,EAAE,iBAAiB,EAAE,CAAW;CACvD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,SAAS,EAAE,aAAa,CAAA;KACzB;CACF"}
1
+ {"version":3,"file":"ui-menu.d.ts","sourceRoot":"","sources":["../../../../src/md/menu/ui-menu.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,KAAK,CAAA;AAE5C,OAAO,OAAO,MAAM,oBAAoB,CAAA;AAGxC;;;;;;;;;;GAUG;AACH,qBACa,aAAc,SAAQ,OAAO;IACxC,OAAgB,MAAM,EAAE,iBAAiB,EAAE,CAAW;CACvD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,SAAS,EAAE,aAAa,CAAA;KACzB;CACF;AAED,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"ui-menu.js","sourceRoot":"","sources":["../../../../src/md/menu/ui-menu.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,OAAO,MAAM,oBAAoB,CAAA;AACxC,OAAO,MAAM,MAAM,2BAA2B,CAAA;AAE9C;;;;;;;;;;GAUG;IAEU,aAAa;4BADzB,aAAa,CAAC,SAAS,CAAC;;;;sBACU,OAAO;6BAAf,SAAQ,WAAO;;;;YAA1C,6KAEC;;;;QADC,MAAM,CAAU,MAAM,GAAwB,CAAC,MAAM,CAAC,CAAA;;YAD3C,uDAAa;;;;;SAAb,aAAa","sourcesContent":["import type { CSSResultOrNative } from 'lit'\nimport { customElement } from 'lit/decorators.js'\nimport Element from './internal/Menu.js'\nimport styles from './internal/Menu.styles.js'\n\n/**\n * Material Design 3 Menu component with sub-menu support.\n *\n * @element ui-menu\n * @attribute {boolean} open - Whether the menu is currently open\n * @attribute {boolean} anchored - Whether the menu should be positioned relative to an anchor element\n * @attribute {boolean} disabled - Whether the menu is disabled\n * @fires select - Dispatched when a menu item is selected\n * @fires close - Dispatched when the menu is closed\n * @fires open - Dispatched when the menu is opened\n */\n@customElement('ui-menu')\nexport class UiMenuElement extends Element {\n static override styles: CSSResultOrNative[] = [styles]\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ui-menu': UiMenuElement\n }\n}\n"]}
1
+ {"version":3,"file":"ui-menu.js","sourceRoot":"","sources":["../../../../src/md/menu/ui-menu.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,OAAO,MAAM,oBAAoB,CAAA;AACxC,OAAO,MAAM,MAAM,2BAA2B,CAAA;AAE9C;;;;;;;;;;GAUG;IAEU,aAAa;4BADzB,aAAa,CAAC,SAAS,CAAC;;;;sBACU,OAAO;6BAAf,SAAQ,WAAO;;;;YAA1C,6KAEC;;;;QADC,MAAM,CAAU,MAAM,GAAwB,CAAC,MAAM,CAAC,CAAA;;YAD3C,uDAAa;;;;;SAAb,aAAa","sourcesContent":["import type { CSSResultOrNative } from 'lit'\nimport { customElement } from 'lit/decorators.js'\nimport Element from './internal/Menu.js'\nimport styles from './internal/Menu.styles.js'\n\n/**\n * Material Design 3 Menu component with sub-menu support.\n *\n * @element ui-menu\n * @attribute {boolean} open - Whether the menu is currently open\n * @attribute {boolean} anchored - Whether the menu should be positioned relative to an anchor element\n * @attribute {boolean} disabled - Whether the menu is disabled\n * @fires select - Dispatched when a menu item is selected\n * @fires close - Dispatched when the menu is closed\n * @fires open - Dispatched when the menu is opened\n */\n@customElement('ui-menu')\nexport class UiMenuElement extends Element {\n static override styles: CSSResultOrNative[] = [styles]\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ui-menu': UiMenuElement\n }\n}\n\nexport type { UiListItemsChange, UiListSelection } from '../list/internals/List.js'\n"]}
@@ -8,4 +8,5 @@ declare global {
8
8
  'ui-tabs': UiTabsElement;
9
9
  }
10
10
  }
11
+ export { TabsPriority, type TabSelectionDetail } from './internals/Tabs.js';
11
12
  //# sourceMappingURL=ui-tabs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ui-tabs.d.ts","sourceRoot":"","sources":["../../../../src/md/tabs/ui-tabs.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,qBAAqB,CAAA;AAEzC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,KAAK,CAAA;AAE5C,qBACa,aAAc,SAAQ,OAAO;IACxC,OAAgB,MAAM,EAAE,iBAAiB,EAAE,CAAW;CACvD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,SAAS,EAAE,aAAa,CAAA;KACzB;CACF"}
1
+ {"version":3,"file":"ui-tabs.d.ts","sourceRoot":"","sources":["../../../../src/md/tabs/ui-tabs.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,qBAAqB,CAAA;AAEzC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,KAAK,CAAA;AAE5C,qBACa,aAAc,SAAQ,OAAO;IACxC,OAAgB,MAAM,EAAE,iBAAiB,EAAE,CAAW;CACvD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,SAAS,EAAE,aAAa,CAAA;KACzB;CACF;AAED,OAAO,EAAE,YAAY,EAAE,KAAK,kBAAkB,EAAE,MAAM,qBAAqB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"ui-tabs.js","sourceRoot":"","sources":["../../../../src/md/tabs/ui-tabs.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,OAAO,MAAM,qBAAqB,CAAA;AACzC,OAAO,MAAM,MAAM,4BAA4B,CAAA;IAIlC,aAAa;4BADzB,aAAa,CAAC,SAAS,CAAC;;;;sBACU,OAAO;6BAAf,SAAQ,WAAO;;;;YAA1C,6KAEC;;;;QADC,MAAM,CAAU,MAAM,GAAwB,CAAC,MAAM,CAAC,CAAA;;YAD3C,uDAAa;;;;;SAAb,aAAa","sourcesContent":["import { customElement } from 'lit/decorators.js'\nimport Element from './internals/Tabs.js'\nimport styles from './internals/Tabs.styles.js'\nimport type { CSSResultOrNative } from 'lit'\n\n@customElement('ui-tabs')\nexport class UiTabsElement extends Element {\n static override styles: CSSResultOrNative[] = [styles]\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ui-tabs': UiTabsElement\n }\n}\n"]}
1
+ {"version":3,"file":"ui-tabs.js","sourceRoot":"","sources":["../../../../src/md/tabs/ui-tabs.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,OAAO,MAAM,qBAAqB,CAAA;AACzC,OAAO,MAAM,MAAM,4BAA4B,CAAA;IAIlC,aAAa;4BADzB,aAAa,CAAC,SAAS,CAAC;;;;sBACU,OAAO;6BAAf,SAAQ,WAAO;;;;YAA1C,6KAEC;;;;QADC,MAAM,CAAU,MAAM,GAAwB,CAAC,MAAM,CAAC,CAAA;;YAD3C,uDAAa;;;;;SAAb,aAAa","sourcesContent":["import { customElement } from 'lit/decorators.js'\nimport Element from './internals/Tabs.js'\nimport styles from './internals/Tabs.styles.js'\nimport type { CSSResultOrNative } from 'lit'\n\n@customElement('ui-tabs')\nexport class UiTabsElement extends Element {\n static override styles: CSSResultOrNative[] = [styles]\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ui-tabs': UiTabsElement\n }\n}\n\nexport { TabsPriority, type TabSelectionDetail } from './internals/Tabs.js'\n"]}