@m3e/web 2.1.3 → 2.2.1

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 (210) hide show
  1. package/README.md +5 -2
  2. package/dist/all.js +2916 -391
  3. package/dist/all.js.map +1 -1
  4. package/dist/all.min.js +77 -41
  5. package/dist/all.min.js.map +1 -1
  6. package/dist/app-bar.js +14 -7
  7. package/dist/app-bar.js.map +1 -1
  8. package/dist/app-bar.min.js +1 -1
  9. package/dist/app-bar.min.js.map +1 -1
  10. package/dist/autocomplete.js +59 -23
  11. package/dist/autocomplete.js.map +1 -1
  12. package/dist/autocomplete.min.js +1 -1
  13. package/dist/autocomplete.min.js.map +1 -1
  14. package/dist/bottom-sheet.js +8 -27
  15. package/dist/bottom-sheet.js.map +1 -1
  16. package/dist/bottom-sheet.min.js +1 -1
  17. package/dist/bottom-sheet.min.js.map +1 -1
  18. package/dist/calendar.js +1082 -0
  19. package/dist/calendar.js.map +1 -0
  20. package/dist/calendar.min.js +43 -0
  21. package/dist/calendar.min.js.map +1 -0
  22. package/dist/chips.js +2 -6
  23. package/dist/chips.js.map +1 -1
  24. package/dist/chips.min.js +1 -1
  25. package/dist/chips.min.js.map +1 -1
  26. package/dist/core-a11y.js +23 -9
  27. package/dist/core-a11y.js.map +1 -1
  28. package/dist/core-a11y.min.js +4 -4
  29. package/dist/core-a11y.min.js.map +1 -1
  30. package/dist/core-anchoring.js +135 -15
  31. package/dist/core-anchoring.js.map +1 -1
  32. package/dist/core-anchoring.min.js +1 -1
  33. package/dist/core-anchoring.min.js.map +1 -1
  34. package/dist/core.js +101 -1
  35. package/dist/core.js.map +1 -1
  36. package/dist/core.min.js +1 -1
  37. package/dist/core.min.js.map +1 -1
  38. package/dist/css-custom-data.json +1146 -646
  39. package/dist/custom-elements.json +31433 -26898
  40. package/dist/datepicker.js +573 -0
  41. package/dist/datepicker.js.map +1 -0
  42. package/dist/datepicker.min.js +7 -0
  43. package/dist/datepicker.min.js.map +1 -0
  44. package/dist/drawer-container.js +10 -4
  45. package/dist/drawer-container.js.map +1 -1
  46. package/dist/drawer-container.min.js +1 -1
  47. package/dist/drawer-container.min.js.map +1 -1
  48. package/dist/fab-menu.js +1 -1
  49. package/dist/fab-menu.js.map +1 -1
  50. package/dist/fab-menu.min.js +1 -1
  51. package/dist/fab-menu.min.js.map +1 -1
  52. package/dist/form-field.js +2 -6
  53. package/dist/form-field.js.map +1 -1
  54. package/dist/form-field.min.js +3 -3
  55. package/dist/form-field.min.js.map +1 -1
  56. package/dist/html-custom-data.json +553 -187
  57. package/dist/menu.js +3 -7
  58. package/dist/menu.js.map +1 -1
  59. package/dist/menu.min.js +1 -1
  60. package/dist/menu.min.js.map +1 -1
  61. package/dist/nav-bar.js +17 -7
  62. package/dist/nav-bar.js.map +1 -1
  63. package/dist/nav-bar.min.js +1 -1
  64. package/dist/nav-bar.min.js.map +1 -1
  65. package/dist/nav-menu.js +3 -11
  66. package/dist/nav-menu.js.map +1 -1
  67. package/dist/nav-menu.min.js +1 -1
  68. package/dist/nav-menu.min.js.map +1 -1
  69. package/dist/nav-rail.js +2 -6
  70. package/dist/nav-rail.js.map +1 -1
  71. package/dist/nav-rail.min.js +1 -1
  72. package/dist/nav-rail.min.js.map +1 -1
  73. package/dist/option.js +4 -8
  74. package/dist/option.js.map +1 -1
  75. package/dist/option.min.js +1 -1
  76. package/dist/option.min.js.map +1 -1
  77. package/dist/paginator.js.map +1 -1
  78. package/dist/paginator.min.js.map +1 -1
  79. package/dist/search.js +821 -0
  80. package/dist/search.js.map +1 -0
  81. package/dist/search.min.js +7 -0
  82. package/dist/search.min.js.map +1 -0
  83. package/dist/segmented-button.js +2 -2
  84. package/dist/segmented-button.js.map +1 -1
  85. package/dist/segmented-button.min.js.map +1 -1
  86. package/dist/select.js +4 -15
  87. package/dist/select.js.map +1 -1
  88. package/dist/select.min.js +1 -1
  89. package/dist/select.min.js.map +1 -1
  90. package/dist/snackbar.js +2 -6
  91. package/dist/snackbar.js.map +1 -1
  92. package/dist/snackbar.min.js +1 -1
  93. package/dist/snackbar.min.js.map +1 -1
  94. package/dist/split-button.js +1 -1
  95. package/dist/split-button.js.map +1 -1
  96. package/dist/split-button.min.js.map +1 -1
  97. package/dist/src/all.d.ts +3 -0
  98. package/dist/src/all.d.ts.map +1 -1
  99. package/dist/src/app-bar/AppBarElement.d.ts +6 -4
  100. package/dist/src/app-bar/AppBarElement.d.ts.map +1 -1
  101. package/dist/src/autocomplete/AutocompleteElement.d.ts +7 -2
  102. package/dist/src/autocomplete/AutocompleteElement.d.ts.map +1 -1
  103. package/dist/src/autocomplete/AutocompleteQueryEventDetail.d.ts +12 -0
  104. package/dist/src/autocomplete/AutocompleteQueryEventDetail.d.ts.map +1 -0
  105. package/dist/src/autocomplete/QueryEventDetail.d.ts +3 -8
  106. package/dist/src/autocomplete/QueryEventDetail.d.ts.map +1 -1
  107. package/dist/src/autocomplete/index.d.ts +1 -0
  108. package/dist/src/autocomplete/index.d.ts.map +1 -1
  109. package/dist/src/bottom-sheet/BottomSheetElement.d.ts.map +1 -1
  110. package/dist/src/calendar/CalendarElement.d.ts +213 -0
  111. package/dist/src/calendar/CalendarElement.d.ts.map +1 -0
  112. package/dist/src/calendar/CalendarView.d.ts +3 -0
  113. package/dist/src/calendar/CalendarView.d.ts.map +1 -0
  114. package/dist/src/calendar/CalendarViewElementBase.d.ts +28 -0
  115. package/dist/src/calendar/CalendarViewElementBase.d.ts.map +1 -0
  116. package/dist/src/calendar/MonthViewElement.d.ts +36 -0
  117. package/dist/src/calendar/MonthViewElement.d.ts.map +1 -0
  118. package/dist/src/calendar/MultiYearViewElement.d.ts +27 -0
  119. package/dist/src/calendar/MultiYearViewElement.d.ts.map +1 -0
  120. package/dist/src/calendar/YearViewElement.d.ts +27 -0
  121. package/dist/src/calendar/YearViewElement.d.ts.map +1 -0
  122. package/dist/src/calendar/index.d.ts +7 -0
  123. package/dist/src/calendar/index.d.ts.map +1 -0
  124. package/dist/src/calendar/utils.d.ts +24 -0
  125. package/dist/src/calendar/utils.d.ts.map +1 -0
  126. package/dist/src/chips/InputChipSetElement.d.ts.map +1 -1
  127. package/dist/src/core/a11y/FocusTrapElement.d.ts.map +1 -1
  128. package/dist/src/core/a11y/InteractivityChecker.d.ts.map +1 -1
  129. package/dist/src/core/anchoring/AnchorOptions.d.ts +1 -1
  130. package/dist/src/core/anchoring/AnchorOptions.d.ts.map +1 -1
  131. package/dist/src/core/anchoring/FloatingPanelElement.d.ts +18 -3
  132. package/dist/src/core/anchoring/FloatingPanelElement.d.ts.map +1 -1
  133. package/dist/src/core/anchoring/positionAnchor.d.ts.map +1 -1
  134. package/dist/src/core/shared/controllers/InertController.d.ts +19 -0
  135. package/dist/src/core/shared/controllers/InertController.d.ts.map +1 -0
  136. package/dist/src/core/shared/controllers/index.d.ts +1 -0
  137. package/dist/src/core/shared/controllers/index.d.ts.map +1 -1
  138. package/dist/src/core/shared/converters/dateConverter.d.ts +4 -0
  139. package/dist/src/core/shared/converters/dateConverter.d.ts.map +1 -0
  140. package/dist/src/core/shared/converters/index.d.ts +1 -0
  141. package/dist/src/core/shared/converters/index.d.ts.map +1 -1
  142. package/dist/src/core/shared/utils/index.d.ts +1 -0
  143. package/dist/src/core/shared/utils/index.d.ts.map +1 -1
  144. package/dist/src/core/shared/utils/registerStyleSheet.d.ts +7 -0
  145. package/dist/src/core/shared/utils/registerStyleSheet.d.ts.map +1 -0
  146. package/dist/src/datepicker/DatepickerElement.d.ts +239 -0
  147. package/dist/src/datepicker/DatepickerElement.d.ts.map +1 -0
  148. package/dist/src/datepicker/DatepickerToggleElement.d.ts +21 -0
  149. package/dist/src/datepicker/DatepickerToggleElement.d.ts.map +1 -0
  150. package/dist/src/datepicker/DatepickerVariant.d.ts +3 -0
  151. package/dist/src/datepicker/DatepickerVariant.d.ts.map +1 -0
  152. package/dist/src/datepicker/index.d.ts +4 -0
  153. package/dist/src/datepicker/index.d.ts.map +1 -0
  154. package/dist/src/drawer-container/DrawerContainerElement.d.ts +2 -2
  155. package/dist/src/drawer-container/DrawerContainerElement.d.ts.map +1 -1
  156. package/dist/src/form-field/FormFieldElement.d.ts.map +1 -1
  157. package/dist/src/menu/MenuElement.d.ts.map +1 -1
  158. package/dist/src/nav-bar/NavBarElement.d.ts +3 -1
  159. package/dist/src/nav-bar/NavBarElement.d.ts.map +1 -1
  160. package/dist/src/nav-menu/NavMenuElement.d.ts.map +1 -1
  161. package/dist/src/nav-menu/NavMenuItemElement.d.ts.map +1 -1
  162. package/dist/src/nav-rail/NavRailElement.d.ts.map +1 -1
  163. package/dist/src/option/OptionPanelElement.d.ts.map +1 -1
  164. package/dist/src/paginator/PageEventDetail.d.ts +6 -11
  165. package/dist/src/paginator/PageEventDetail.d.ts.map +1 -1
  166. package/dist/src/paginator/PaginatorElement.d.ts +2 -2
  167. package/dist/src/paginator/PaginatorElement.d.ts.map +1 -1
  168. package/dist/src/paginator/PaginatorPageEventDetail.d.ts +12 -0
  169. package/dist/src/paginator/PaginatorPageEventDetail.d.ts.map +1 -0
  170. package/dist/src/paginator/index.d.ts +1 -0
  171. package/dist/src/paginator/index.d.ts.map +1 -1
  172. package/dist/src/search/SearchBarElement.d.ts +92 -0
  173. package/dist/src/search/SearchBarElement.d.ts.map +1 -0
  174. package/dist/src/search/SearchViewElement.d.ts +150 -0
  175. package/dist/src/search/SearchViewElement.d.ts.map +1 -0
  176. package/dist/src/search/SearchViewMode.d.ts +3 -0
  177. package/dist/src/search/SearchViewMode.d.ts.map +1 -0
  178. package/dist/src/search/SearchViewQueryEventDetail.d.ts +12 -0
  179. package/dist/src/search/SearchViewQueryEventDetail.d.ts.map +1 -0
  180. package/dist/src/search/index.d.ts +5 -0
  181. package/dist/src/search/index.d.ts.map +1 -0
  182. package/dist/src/search/styles/SearchBarStyle.d.ts +12 -0
  183. package/dist/src/search/styles/SearchBarStyle.d.ts.map +1 -0
  184. package/dist/src/search/styles/SearchBarToken.d.ts +27 -0
  185. package/dist/src/search/styles/SearchBarToken.d.ts.map +1 -0
  186. package/dist/src/search/styles/SearchViewStyle.d.ts +12 -0
  187. package/dist/src/search/styles/SearchViewStyle.d.ts.map +1 -0
  188. package/dist/src/search/styles/SearchViewToken.d.ts +26 -0
  189. package/dist/src/search/styles/SearchViewToken.d.ts.map +1 -0
  190. package/dist/src/search/styles/index.d.ts +3 -0
  191. package/dist/src/search/styles/index.d.ts.map +1 -0
  192. package/dist/src/segmented-button/ButtonSegmentElement.d.ts +2 -2
  193. package/dist/src/select/SelectElement.d.ts.map +1 -1
  194. package/dist/src/snackbar/SnackbarElement.d.ts.map +1 -1
  195. package/dist/src/split-button/SplitButtonElement.d.ts +1 -1
  196. package/dist/src/stepper/StepperElement.d.ts +3 -1
  197. package/dist/src/stepper/StepperElement.d.ts.map +1 -1
  198. package/dist/src/switch/SwitchElement.d.ts +2 -2
  199. package/dist/stepper.js +18 -12
  200. package/dist/stepper.js.map +1 -1
  201. package/dist/stepper.min.js +1 -1
  202. package/dist/stepper.min.js.map +1 -1
  203. package/dist/switch.js +2 -2
  204. package/dist/switch.js.map +1 -1
  205. package/dist/switch.min.js.map +1 -1
  206. package/dist/tooltip.js +1 -1
  207. package/dist/tooltip.js.map +1 -1
  208. package/dist/tooltip.min.js +1 -1
  209. package/dist/tooltip.min.js.map +1 -1
  210. package/package.json +16 -1
package/dist/nav-bar.js CHANGED
@@ -6,11 +6,11 @@
6
6
  import { __classPrivateFieldGet, __classPrivateFieldSet, __decorate } from 'tslib';
7
7
  import { LitElement, html, css, nothing } from 'lit';
8
8
  import { state, property, query } from 'lit/decorators.js';
9
- import { AttachInternals, Role, setCustomState, DesignToken, customElement, LinkButton, Selected, KeyboardClick, Focusable, DisabledInteractive, Disabled, renderPseudoLink } from '@m3e/web/core';
9
+ import { ReconnectedCallback, AttachInternals, Role, setCustomState, DesignToken, customElement, LinkButton, Selected, KeyboardClick, Focusable, DisabledInteractive, Disabled, renderPseudoLink } from '@m3e/web/core';
10
10
  import { SelectionManager, selectionManager } from '@m3e/web/core/a11y';
11
11
  import { M3eBreakpointObserver, Breakpoint } from '@m3e/web/core/layout';
12
12
 
13
- var _M3eNavBarElement_instances, _M3eNavBarElement_breakpointUnobserve, _M3eNavBarElement_handleSlotChange, _M3eNavBarElement_handleChange, _a;
13
+ var _M3eNavBarElement_instances, _M3eNavBarElement_breakpointUnobserve, _M3eNavBarElement_initBreakpointMonitoring, _M3eNavBarElement_handleSlotChange, _M3eNavBarElement_handleChange, _a;
14
14
  /**
15
15
  * A horizontal bar, typically used on smaller devices, that allows a user to switch between 3-5 views.
16
16
  *
@@ -42,7 +42,7 @@ var _M3eNavBarElement_instances, _M3eNavBarElement_breakpointUnobserve, _M3eNavB
42
42
  * @cssprop --m3e-nav-bar-container-color - Background color of the navigation bar container.
43
43
  * @cssprop --m3e-nav-bar-vertical-item-width - Minimum width of vertical nav items.
44
44
  */
45
- let M3eNavBarElement = class M3eNavBarElement extends AttachInternals(Role(LitElement, "navigation")) {
45
+ let M3eNavBarElement = class M3eNavBarElement extends ReconnectedCallback(AttachInternals(Role(LitElement, "navigation"))) {
46
46
  constructor() {
47
47
  super(...arguments);
48
48
  _M3eNavBarElement_instances.add(this);
@@ -78,15 +78,19 @@ let M3eNavBarElement = class M3eNavBarElement extends AttachInternals(Role(LitEl
78
78
  __classPrivateFieldGet(this, _M3eNavBarElement_breakpointUnobserve, "f")?.call(this);
79
79
  }
80
80
  /** @inheritdoc */
81
+ reconnectedCallback() {
82
+ super.reconnectedCallback();
83
+ if (this.mode === "auto") {
84
+ __classPrivateFieldGet(this, _M3eNavBarElement_instances, "m", _M3eNavBarElement_initBreakpointMonitoring).call(this);
85
+ }
86
+ }
87
+ /** @inheritdoc */
81
88
  willUpdate(changedProperties) {
82
89
  super.willUpdate(changedProperties);
83
90
  if (changedProperties.has("mode")) {
84
91
  __classPrivateFieldGet(this, _M3eNavBarElement_breakpointUnobserve, "f")?.call(this);
85
92
  if (this.mode === "auto") {
86
- __classPrivateFieldSet(this, _M3eNavBarElement_breakpointUnobserve, M3eBreakpointObserver.observe([Breakpoint.XSmall, Breakpoint.Small], matches => {
87
- this._mode = matches.get(Breakpoint.XSmall) || matches.get(Breakpoint.Small) ? "compact" : "expanded";
88
- this._updateItems();
89
- }), "f");
93
+ __classPrivateFieldGet(this, _M3eNavBarElement_instances, "m", _M3eNavBarElement_initBreakpointMonitoring).call(this);
90
94
  } else {
91
95
  this._mode = undefined;
92
96
  this._updateItems();
@@ -114,6 +118,12 @@ let M3eNavBarElement = class M3eNavBarElement extends AttachInternals(Role(LitEl
114
118
  _M3eNavBarElement_breakpointUnobserve = new WeakMap();
115
119
  _M3eNavBarElement_instances = new WeakSet();
116
120
  _a = selectionManager;
121
+ _M3eNavBarElement_initBreakpointMonitoring = function _M3eNavBarElement_initBreakpointMonitoring() {
122
+ __classPrivateFieldSet(this, _M3eNavBarElement_breakpointUnobserve, M3eBreakpointObserver.observe([Breakpoint.XSmall, Breakpoint.Small], matches => {
123
+ this._mode = matches.get(Breakpoint.XSmall) || matches.get(Breakpoint.Small) ? "compact" : "expanded";
124
+ this._updateItems();
125
+ }), "f");
126
+ };
117
127
  _M3eNavBarElement_handleSlotChange = function _M3eNavBarElement_handleSlotChange() {
118
128
  this[selectionManager].setItems([...this.querySelectorAll("m3e-nav-item")]);
119
129
  this._updateItems();
@@ -1 +1 @@
1
- {"version":3,"file":"nav-bar.js","sources":["../../src/nav-bar/NavBarElement.ts","../../src/nav-bar/NavItemElement.ts"],"sourcesContent":["import { css, CSSResultGroup, html, LitElement, PropertyValues } from \"lit\";\r\nimport { property, state } from \"lit/decorators.js\";\r\n\r\nimport { AttachInternals, customElement, DesignToken, Role, setCustomState } from \"@m3e/web/core\";\r\n\r\nimport { SelectionManager, selectionManager } from \"@m3e/web/core/a11y\";\r\nimport { Breakpoint, M3eBreakpointObserver } from \"@m3e/web/core/layout\";\r\n\r\nimport { M3eNavItemElement } from \"./NavItemElement\";\r\nimport { NavItemOrientation } from \"./NavItemOrientation\";\r\nimport { NavBarMode } from \"./NavBarMode\";\r\n\r\n/**\r\n * A horizontal bar, typically used on smaller devices, that allows a user to switch between 3-5 views.\r\n *\r\n * @description\r\n * The `m3e-nav-bar` component provides a horizontal navigation bar for switching between primary destinations in\r\n * an application. Designed for smaller devices, it supports 3-5 interactive items, orientation, and theming\r\n * via CSS custom properties.\r\n *\r\n * @example\r\n * The following example illustrates a nav bar with vertically oriented items.\r\n * ```html\r\n * <m3e-nav-bar>\r\n * <m3e-nav-item><m3e-icon slot=\"icon\" name=\"news\"></m3e-icon>News</m3e-nav-item>\r\n * <m3e-nav-item><m3e-icon slot=\"icon\" name=\"globe\"></m3e-icon>Global</m3e-nav-item>\r\n * <m3e-nav-item><m3e-icon slot=\"icon\" name=\"star\"></m3e-icon>For you</m3e-nav-item>\r\n * <m3e-nav-item><m3e-icon slot=\"icon\" name=\"newsstand\"></m3e-icon>Trending</m3e-nav-item>\r\n * </m3e-nav-bar>\r\n * ```\r\n *\r\n * @tag m3e-nav-bar\r\n *\r\n * @slot - Renders the items of the bar.\r\n *\r\n * @attr mode - The mode in which items in the bar are presented.\r\n *\r\n * @fires change - Emitted when the selected state of an item changes.\r\n *\r\n * @cssprop --m3e-nav-bar-height - Height of the navigation bar.\r\n * @cssprop --m3e-nav-bar-container-color - Background color of the navigation bar container.\r\n * @cssprop --m3e-nav-bar-vertical-item-width - Minimum width of vertical nav items.\r\n */\r\n@customElement(\"m3e-nav-bar\")\r\nexport class M3eNavBarElement extends AttachInternals(Role(LitElement, \"navigation\")) {\r\n /** The styles of the element. */\r\n static override styles: CSSResultGroup = css`\r\n :host {\r\n display: block;\r\n overflow-x: auto;\r\n overflow-y: hidden;\r\n scrollbar-width: ${DesignToken.scrollbar.thinWidth};\r\n scrollbar-color: ${DesignToken.scrollbar.color};\r\n min-height: var(--m3e-nav-bar-height, 4rem);\r\n }\r\n .base {\r\n display: flex;\r\n align-items: stretch;\r\n justify-content: center;\r\n box-sizing: border-box;\r\n min-height: inherit;\r\n height: inherit;\r\n width: 100%;\r\n background-color: var(--m3e-nav-bar-container-color, ${DesignToken.color.surfaceContainer});\r\n --_nav-item-min-width: var(--m3e-nav-bar-vertical-item-width, 7rem);\r\n }\r\n `;\r\n\r\n /** @internal */ readonly [selectionManager] = new SelectionManager<M3eNavItemElement>().disableRovingTabIndex();\r\n /** @private */ #breakpointUnobserve?: () => void;\r\n /** @private */ @state() private _mode?: Exclude<NavBarMode, \"auto\">;\r\n\r\n /**\r\n * The mode in which items in the bar are presented.\r\n * @default \"compact\"\r\n */\r\n @property({ reflect: true }) mode: NavBarMode = \"compact\";\r\n\r\n /** The items of the bar. */\r\n get items(): readonly M3eNavItemElement[] {\r\n return this[selectionManager].items;\r\n }\r\n\r\n /** The selected item. */\r\n get selected(): M3eNavItemElement | null {\r\n return this[selectionManager].selectedItems[0] ?? null;\r\n }\r\n\r\n /** The current mode applied to the bar. */\r\n get currentMode(): Exclude<NavBarMode, \"auto\"> {\r\n return this._mode ?? (this.mode !== \"compact\" ? \"expanded\" : \"compact\");\r\n }\r\n set currentMode(value: Exclude<NavBarMode, \"auto\">) {\r\n this._mode = value;\r\n }\r\n\r\n /** @inheritdoc */\r\n override disconnectedCallback(): void {\r\n super.disconnectedCallback();\r\n\r\n this._mode = undefined;\r\n this.#breakpointUnobserve?.();\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override willUpdate(changedProperties: PropertyValues): void {\r\n super.willUpdate(changedProperties);\r\n\r\n if (changedProperties.has(\"mode\")) {\r\n this.#breakpointUnobserve?.();\r\n\r\n if (this.mode === \"auto\") {\r\n this.#breakpointUnobserve = M3eBreakpointObserver.observe([Breakpoint.XSmall, Breakpoint.Small], (matches) => {\r\n this._mode = matches.get(Breakpoint.XSmall) || matches.get(Breakpoint.Small) ? \"compact\" : \"expanded\";\r\n this._updateItems();\r\n });\r\n } else {\r\n this._mode = undefined;\r\n this._updateItems();\r\n }\r\n }\r\n if (changedProperties.has(\"_mode\")) {\r\n this._updateItems();\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override render(): unknown {\r\n return html`<div class=\"base\">\r\n <slot @change=\"${this.#handleChange}\" @slotchange=\"${this.#handleSlotChange}\"></slot>\r\n </div>`;\r\n }\r\n\r\n /** @private */\r\n #handleSlotChange(): void {\r\n this[selectionManager].setItems([...this.querySelectorAll(\"m3e-nav-item\")]);\r\n this._updateItems();\r\n }\r\n\r\n /** @private */\r\n #handleChange(e: Event): void {\r\n e.stopPropagation();\r\n this.dispatchEvent(new Event(\"change\", { bubbles: true }));\r\n }\r\n\r\n /** @internal */\r\n protected _updateItems(): void {\r\n const orientation: NavItemOrientation = this.currentMode === \"compact\" ? \"vertical\" : \"horizontal\";\r\n this._updateOrientation(orientation);\r\n setCustomState(this, \"-compact\", orientation === \"vertical\");\r\n }\r\n\r\n /** @internal */\r\n protected _updateOrientation(orientation: NavItemOrientation): void {\r\n this[selectionManager].items.forEach((x) => (x.orientation = orientation));\r\n }\r\n}\r\n\r\ndeclare global {\r\n interface HTMLElementTagNameMap {\r\n \"m3e-nav-bar\": M3eNavBarElement;\r\n }\r\n}\r\n","import { css, CSSResultGroup, html, LitElement, nothing, PropertyValues } from \"lit\";\r\nimport { property, query } from \"lit/decorators.js\";\r\n\r\nimport {\r\n AttachInternals,\r\n customElement,\r\n DesignToken,\r\n Disabled,\r\n DisabledInteractive,\r\n Focusable,\r\n KeyboardClick,\r\n LinkButton,\r\n M3eFocusRingElement,\r\n M3eRippleElement,\r\n M3eStateLayerElement,\r\n renderPseudoLink,\r\n Role,\r\n Selected,\r\n} from \"@m3e/web/core\";\r\n\r\nimport { selectionManager } from \"@m3e/web/core/a11y\";\r\n\r\nimport type { M3eNavBarElement } from \"./NavBarElement\";\r\nimport { NavItemOrientation } from \"./NavItemOrientation\";\r\n\r\n/**\r\n * An item, placed in a navigation bar or rail, used to navigate to destinations in an application.\r\n *\r\n * @description\r\n * The `m3e-nav-item` component represents an interactive navigation item for use in navigation bars\r\n * or rails. Designed according to Material 3 principles, it supports icon and label slots, selection state,\r\n * orientation, and extensive theming via CSS custom properties.\r\n *\r\n * @example\r\n * The following example illustrates a nav bar with vertically oriented items.\r\n * ```html\r\n * <m3e-nav-bar>\r\n * <m3e-nav-item><m3e-icon slot=\"icon\" name=\"news\"></m3e-icon>News</m3e-nav-item>\r\n * <m3e-nav-item><m3e-icon slot=\"icon\" name=\"globe\"></m3e-icon>Global</m3e-nav-item>\r\n * <m3e-nav-item><m3e-icon slot=\"icon\" name=\"star\"></m3e-icon>For you</m3e-nav-item>\r\n * <m3e-nav-item><m3e-icon slot=\"icon\" name=\"newsstand\"></m3e-icon>Trending</m3e-nav-item>\r\n * </m3e-nav-bar>\r\n * ```\r\n *\r\n * @tag m3e-nav-item\r\n *\r\n * @slot - Renders the label of the item.\r\n * @slot icon - Renders the icon of the item.\r\n * @slot selected-icon - Renders the icon of the item when selected.\r\n *\r\n * @attr disabled - A value indicating whether the element is disabled.\r\n * @attr disabled-interactive - A value indicating whether the element is disabled and interactive.\r\n * @attr download - A value indicating whether the `target` of the link button will be downloaded, optionally specifying the new name of the file.\r\n * @attr href - The URL to which the link button points.\r\n * @attr orientation - The layout orientation of the item.\r\n * @attr rel - The relationship between the `target` of the link button and the document.\r\n * @attr selected - A value indicating whether the element is selected.\r\n * @attr target - The target of the link button.\r\n *\r\n * @fires input - Emitted when the selected state changes.\r\n * @fires change - Emitted when the selected state changes.\r\n * @fires click - Emitted when the element is clicked.\r\n *\r\n * @cssprop --m3e-nav-item-label-text-font-size - Font size for the label text.\r\n * @cssprop --m3e-nav-item-label-text-font-weight - Font weight for the label text.\r\n * @cssprop --m3e-nav-item-label-text-line-height - Line height for the label text.\r\n * @cssprop --m3e-nav-item-label-text-tracking - Letter spacing for the label text.\r\n * @cssprop --m3e-nav-item-shape - Border radius of the nav item.\r\n * @cssprop --m3e-nav-item-icon-size - Size of the icon.\r\n * @cssprop --m3e-nav-item-spacing - Spacing between icon and label.\r\n * @cssprop --m3e-nav-item-inactive-label-text-color - Color of the label text when inactive.\r\n * @cssprop --m3e-nav-item-inactive-icon-color - Color of the icon when inactive.\r\n * @cssprop --m3e-nav-item-inactive-hover-state-layer-color - State layer color on hover when inactive.\r\n * @cssprop --m3e-nav-item-inactive-focus-state-layer-color - State layer color on focus when inactive.\r\n * @cssprop --m3e-nav-item-inactive-pressed-state-layer-color - State layer color on press when inactive.\r\n * @cssprop --m3e-nav-item-active-label-text-color - Color of the label text when active/selected.\r\n * @cssprop --m3e-nav-item-active-icon-color - Color of the icon when active/selected.\r\n * @cssprop --m3e-nav-item-active-container-color - Container color when active/selected.\r\n * @cssprop --m3e-nav-item-active-hover-state-layer-color - State layer color on hover when active.\r\n * @cssprop --m3e-nav-item-active-focus-state-layer-color - State layer color on focus when active.\r\n * @cssprop --m3e-nav-item-active-pressed-state-layer-color - State layer color on press when active.\r\n * @cssprop --m3e-nav-item-focus-ring-shape - Border radius for the focus ring.\r\n * @cssprop --m3e-nav-item-disabled-label-text-color - Color of the label text when disabled.\r\n * @cssprop --m3e-nav-item-disabled-label-text-opacity - Opacity of the label text when disabled.\r\n * @cssprop --m3e-nav-item-disabled-icon-color - Color of the icon when disabled.\r\n * @cssprop --m3e-nav-item-disabled-icon-opacity - Opacity of the icon when disabled.\r\n * @cssprop --m3e-horizontal-nav-item-padding - Padding for horizontal orientation.\r\n * @cssprop --m3e-horizontal-nav-item-active-indicator-height - Height of the active indicator in horizontal orientation.\r\n * @cssprop --m3e-vertical-nav-item-active-indicator-width - Width of the active indicator in vertical orientation.\r\n * @cssprop --m3e-vertical-nav-item-active-indicator-height - Height of the active indicator in vertical orientation.\r\n * @cssprop --m3e-vertical-nav-item-active-indicator-margin - Margin for the active indicator in vertical orientation.\r\n */\r\n@customElement(\"m3e-nav-item\")\r\nexport class M3eNavItemElement extends LinkButton(\r\n Selected(KeyboardClick(Focusable(DisabledInteractive(Disabled(AttachInternals(Role(LitElement, \"button\"), true)))))),\r\n) {\r\n /** The styles of the element. */\r\n static override styles: CSSResultGroup = css`\r\n :host {\r\n display: inline-block;\r\n vertical-align: middle;\r\n position: relative;\r\n outline: none;\r\n user-select: none;\r\n flex: 1;\r\n font-size: var(--m3e-nav-item-label-text-font-size, ${DesignToken.typescale.standard.label.medium.fontSize});\r\n font-weight: var(\r\n --m3e-nav-item-label-text-font-weight,\r\n ${DesignToken.typescale.standard.label.medium.fontWeight}\r\n );\r\n line-height: var(\r\n --m3e-nav-item-label-text-line-height,\r\n ${DesignToken.typescale.standard.label.medium.lineHeight}\r\n );\r\n letter-spacing: var(--m3e-nav-item-label-text-tracking, ${DesignToken.typescale.standard.label.medium.tracking});\r\n border-radius: var(--m3e-nav-item-shape, ${DesignToken.shape.corner.full});\r\n min-width: var(--_nav-item-min-width);\r\n align-self: var(--_nav-item-align-self);\r\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\r\n }\r\n :host([orientation=\"horizontal\"]) {\r\n max-width: fit-content;\r\n }\r\n :host(:not(:disabled):not([disabled-interactive])) {\r\n cursor: pointer;\r\n }\r\n :host([disabled-interactive]) {\r\n cursor: not-allowed;\r\n }\r\n .outer {\r\n height: 100%;\r\n }\r\n .outer,\r\n .inner {\r\n display: flex;\r\n align-items: center;\r\n justify-content: var(--_nav-item-justify-content, center);\r\n position: relative;\r\n border-radius: inherit;\r\n }\r\n .icon-wrapper {\r\n position: relative;\r\n flex: none;\r\n }\r\n .base {\r\n justify-content: unset;\r\n box-sizing: border-box;\r\n vertical-align: middle;\r\n display: inline-flex;\r\n align-items: center;\r\n justify-content: center;\r\n position: relative;\r\n width: 100%;\r\n }\r\n .icon {\r\n position: absolute;\r\n }\r\n .label {\r\n vertical-align: middle;\r\n }\r\n ::slotted([slot=\"icon\"]),\r\n ::slotted([slot=\"selected-icon\"]) {\r\n width: 1em;\r\n font-size: var(--m3e-nav-item-icon-size, 1.5rem) !important;\r\n }\r\n :host(:not([selected]):not(:disabled):not([disabled-interactive])) .outer {\r\n --m3e-state-layer-hover-color: var(\r\n --m3e-nav-item-inactive-hover-state-layer-color,\r\n ${DesignToken.color.onSecondaryContainer}\r\n );\r\n --m3e-state-layer-focus-color: var(\r\n --m3e-nav-item-inactive-focus-state-layer-color,\r\n ${DesignToken.color.onSecondaryContainer}\r\n );\r\n --m3e-ripple-color: var(\r\n --m3e-nav-item-inactive-pressed-state-layer-color,\r\n ${DesignToken.color.onSecondaryContainer}\r\n );\r\n }\r\n :host(:not([selected]):not(:disabled):not([disabled-interactive])) .label {\r\n color: var(--m3e-nav-item-inactive-label-text-color, ${DesignToken.color.onSurfaceVariant});\r\n }\r\n :host(:not([selected]):not(:disabled):not([disabled-interactive])) .icon {\r\n color: var(--m3e-nav-item-inactive-icon-color, ${DesignToken.color.onSecondaryContainer});\r\n }\r\n :host([selected]:not(:disabled):not([disabled-interactive])) .outer {\r\n --m3e-state-layer-hover-color: var(\r\n --m3e-nav-item-active-hover-state-layer-color,\r\n ${DesignToken.color.onSecondaryContainer}\r\n );\r\n --m3e-state-layer-focus-color: var(\r\n --m3e-nav-item-active-focus-state-layer-color,\r\n ${DesignToken.color.onSecondaryContainer}\r\n );\r\n --m3e-ripple-color: var(\r\n --m3e-nav-item-active-pressed-state-layer-color,\r\n ${DesignToken.color.onSecondaryContainer}\r\n );\r\n }\r\n :host([selected]:not(:disabled):not([disabled-interactive])) .label {\r\n color: var(--m3e-nav-item-active-label-text-color, ${DesignToken.color.secondary});\r\n }\r\n :host([selected]:not(:disabled):not([disabled-interactive])) .state-layer {\r\n background-color: var(--m3e-nav-item-active-container-color, ${DesignToken.color.secondaryContainer});\r\n }\r\n :host([selected]:not(:disabled):not([disabled-interactive])) .icon {\r\n color: var(--m3e-nav-item-active-icon-color, ${DesignToken.color.onSecondaryContainer});\r\n }\r\n :host([orientation=\"vertical\"]) .outer {\r\n align-self: stretch;\r\n align-items: flex-start;\r\n }\r\n :host([orientation=\"vertical\"]) .label {\r\n text-align: center;\r\n display: -webkit-box;\r\n -webkit-line-clamp: 2;\r\n -webkit-box-orient: vertical;\r\n overflow: hidden;\r\n line-clamp: 2;\r\n }\r\n :host([orientation=\"vertical\"]) .base {\r\n flex-direction: column;\r\n row-gap: var(--m3e-nav-item-spacing, 0.25rem);\r\n }\r\n :host([orientation=\"vertical\"]) .base {\r\n margin-block: var(--m3e-vertical-nav-item-active-indicator-margin, 0.375rem);\r\n }\r\n :host([orientation=\"vertical\"]) .state-layer,\r\n :host([orientation=\"vertical\"]) .ripple {\r\n top: var(--m3e-vertical-nav-item-active-indicator-margin, 0.375rem);\r\n bottom: unset;\r\n }\r\n :host([orientation=\"vertical\"]) .state-layer,\r\n :host([orientation=\"vertical\"]) .ripple,\r\n :host([orientation=\"vertical\"]) .icon-wrapper {\r\n width: var(--m3e-vertical-nav-item-active-indicator-width, 3.5rem);\r\n }\r\n :host([orientation=\"vertical\"]) .state-layer,\r\n :host([orientation=\"vertical\"]) .ripple,\r\n :host([orientation=\"vertical\"]) .icon-wrapper {\r\n height: var(--m3e-vertical-nav-item-active-indicator-height, 2rem);\r\n }\r\n :host([orientation=\"vertical\"]) .icon {\r\n top: calc(\r\n calc(var(--m3e-vertical-nav-item-active-indicator-height, 2rem) / 2) - calc(\r\n var(--m3e-nav-item-icon-size, 1.5rem) / 2\r\n )\r\n );\r\n left: calc(\r\n calc(var(--m3e-vertical-nav-item-active-indicator-width, 3.5rem) / 2) - calc(\r\n var(--m3e-nav-item-icon-size, 1.5rem) / 2\r\n )\r\n );\r\n }\r\n :host([orientation=\"vertical\"]) .focus-ring {\r\n border-radius: var(--m3e-nav-item-focus-ring-shape, ${DesignToken.shape.corner.medium});\r\n }\r\n :host([orientation=\"horizontal\"]) .icon-wrapper {\r\n width: var(--m3e-nav-item-icon-size, 1.5rem);\r\n height: var(--m3e-nav-item-icon-size, 1.5rem);\r\n }\r\n :host([orientation=\"horizontal\"]) .base {\r\n padding: var(--m3e-horizontal-nav-item-padding, 1rem);\r\n }\r\n :host([orientation=\"horizontal\"]) .label {\r\n flex: 1 1 auto;\r\n }\r\n :host([orientation=\"horizontal\"]) .base {\r\n column-gap: var(--m3e-nav-item-spacing, 0.25rem);\r\n }\r\n :host([orientation=\"horizontal\"]) .inner {\r\n height: var(--m3e-horizontal-nav-item-active-indicator-height, 2.5rem);\r\n width: fit-content;\r\n }\r\n .state-layer,\r\n .ripple {\r\n margin-inline: auto;\r\n }\r\n :host(:disabled) .label,\r\n :host([disabled-interactive]) .label {\r\n color: color-mix(\r\n in srgb,\r\n var(--m3e-nav-item-disabled-label-text-color, ${DesignToken.color.onSurface})\r\n var(--m3e-nav-item-disabled-label-text-opacity, 38%),\r\n transparent\r\n );\r\n }\r\n :host(:disabled) .icon,\r\n :host([disabled-interactive]) .icon {\r\n color: color-mix(\r\n in srgb,\r\n var(--m3e-nav-item-disabled-icon-color, ${DesignToken.color.onSurface})\r\n var(--m3e-nav-item-disabled-icon-opacity, 38%),\r\n transparent\r\n );\r\n }\r\n a {\r\n all: unset;\r\n display: block;\r\n position: absolute;\r\n top: 0px;\r\n left: 0px;\r\n right: 0px;\r\n bottom: 0px;\r\n z-index: 1;\r\n }\r\n @media (forced-colors: active) {\r\n :host(:disabled) .label,\r\n :host([disabled-interactive]) .label,\r\n :host(:disabled) .icon,\r\n :host([disabled-interactive]) .icon {\r\n color: GrayText;\r\n }\r\n :host(:not([selected]):not(:disabled):not([disabled-interactive])) .label,\r\n :host(:not([selected]):not(:disabled):not([disabled-interactive])) .icon {\r\n color: ButtonText;\r\n }\r\n :host([selected]:not(:disabled):not([disabled-interactive])) .state-layer {\r\n background-color: ButtonText;\r\n }\r\n :host([orientation=\"vertical\"][selected]:not(:disabled):not([disabled-interactive])) .label {\r\n color: ButtonText;\r\n }\r\n :host([orientation=\"horizontal\"][selected]:not(:disabled):not([disabled-interactive])) .label,\r\n :host([selected]:not(:disabled):not([disabled-interactive])) .icon {\r\n forced-color-adjust: none;\r\n color: ButtonFace;\r\n }\r\n }\r\n `;\r\n\r\n /** @private */ readonly #clickHandler = (e: Event) => this.#handleClick(e);\r\n /** @private */ @query(\".focus-ring\") private readonly _focusRing?: M3eFocusRingElement;\r\n /** @private */ @query(\".state-layer\") private readonly _stateLayer?: M3eStateLayerElement;\r\n /** @private */ @query(\".ripple\") private readonly _ripple?: M3eRippleElement;\r\n\r\n /**\r\n * The layout orientation of the item.\r\n * @default \"vertical\"\r\n */\r\n @property({ reflect: true }) orientation: NavItemOrientation = \"vertical\";\r\n\r\n /** The navigation bar to which this item belongs. */\r\n get navBar(): M3eNavBarElement | null {\r\n return this.closest(\"m3e-nav-bar\") ?? this.closest(\"m3e-nav-rail\") ?? null;\r\n }\r\n\r\n /** @inheritdoc */\r\n override connectedCallback(): void {\r\n super.connectedCallback();\r\n this.addEventListener(\"click\", this.#clickHandler, { capture: true });\r\n }\r\n\r\n /** @inheritdoc */\r\n override disconnectedCallback(): void {\r\n super.disconnectedCallback();\r\n this.removeEventListener(\"click\", this.#clickHandler, { capture: true });\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override update(changedProperties: PropertyValues<this>): void {\r\n super.update(changedProperties);\r\n\r\n if (changedProperties.has(\"selected\")) {\r\n this.ariaSelected = null;\r\n this.ariaPressed = null;\r\n this.ariaCurrent = `${this.selected}`;\r\n for (const icon of this.querySelectorAll(\"m3e-icon\")) {\r\n icon.toggleAttribute(\"filled\", this.selected);\r\n }\r\n this.navBar?.[selectionManager].notifySelectionChange(this);\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override updated(_changedProperties: PropertyValues<this>): void {\r\n super.updated(_changedProperties);\r\n\r\n if (_changedProperties.has(\"orientation\")) {\r\n this._focusRing?.attach(this);\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override firstUpdated(_changedProperties: PropertyValues<this>): void {\r\n super.firstUpdated(_changedProperties);\r\n [this._focusRing, this._stateLayer, this._ripple].forEach((x) => x?.attach(this));\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override render(): unknown {\r\n const disabled = this.disabled || this.disabledInteractive;\r\n return html`${this.orientation === \"vertical\"\r\n ? html`<m3e-focus-ring class=\"focus-ring\" inward></m3e-focus-ring>`\r\n : nothing}\r\n <div class=\"outer\">\r\n ${this[renderPseudoLink]()}\r\n <div class=\"inner\">\r\n ${this.orientation === \"horizontal\" ? html`<m3e-focus-ring class=\"focus-ring\"></m3e-focus-ring>` : nothing}\r\n <m3e-state-layer class=\"state-layer\" ?disabled=\"${disabled}\"></m3e-state-layer>\r\n <m3e-ripple class=\"ripple\" centered ?disabled=\"${disabled}\"></m3e-ripple>\r\n <div class=\"touch\" aria-hidden=\"true\"></div>\r\n <div class=\"base\">\r\n <div class=\"icon-wrapper\" aria-hidden=\"true\">\r\n <div class=\"icon\">\r\n <slot name=\"icon\" aria-hidden=\"true\"></slot>\r\n </div>\r\n </div>\r\n <div class=\"label\">\r\n <slot></slot>\r\n </div>\r\n </div>\r\n </div>\r\n </div>`;\r\n }\r\n\r\n /** @private */\r\n #handleClick(e: Event): void {\r\n if (e.defaultPrevented) return;\r\n\r\n this.selected = true;\r\n if (this.dispatchEvent(new Event(\"input\", { bubbles: true, composed: true, cancelable: true }))) {\r\n this.navBar?.[selectionManager].notifySelectionChange(this);\r\n this.dispatchEvent(new Event(\"change\", { bubbles: true }));\r\n } else {\r\n this.selected = false;\r\n }\r\n }\r\n}\r\n\r\ndeclare global {\r\n interface HTMLElementTagNameMap {\r\n \"m3e-nav-item\": M3eNavItemElement;\r\n }\r\n}\r\n"],"names":["M3eNavBarElement","AttachInternals","Role","LitElement","constructor","SelectionManager","disableRovingTabIndex","_M3eNavBarElement_breakpointUnobserve","set","mode","items","selectionManager","selected","selectedItems","currentMode","_mode","value","disconnectedCallback","undefined","__classPrivateFieldGet","call","willUpdate","changedProperties","has","__classPrivateFieldSet","M3eBreakpointObserver","observe","Breakpoint","XSmall","Small","matches","get","_updateItems","render","html","_M3eNavBarElement_instances","_M3eNavBarElement_handleChange","_M3eNavBarElement_handleSlotChange","orientation","_updateOrientation","setCustomState","forEach","x","setItems","querySelectorAll","e","stopPropagation","dispatchEvent","Event","bubbles","styles","css","DesignToken","scrollbar","thinWidth","color","surfaceContainer","__decorate","state","prototype","property","reflect","customElement","M3eNavItemElement","LinkButton","Selected","KeyboardClick","Focusable","DisabledInteractive","Disabled","_M3eNavItemElement_clickHandler","navBar","closest","connectedCallback","addEventListener","capture","removeEventListener","update","ariaSelected","ariaPressed","ariaCurrent","icon","toggleAttribute","notifySelectionChange","updated","_changedProperties","_focusRing","attach","firstUpdated","_stateLayer","_ripple","disabled","disabledInteractive","nothing","renderPseudoLink","defaultPrevented","composed","cancelable","typescale","standard","label","medium","fontSize","fontWeight","lineHeight","tracking","shape","corner","full","onSecondaryContainer","onSurfaceVariant","secondary","secondaryContainer","onSurface","query"],"mappings":";;;;;;;;;;;;;AAYA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BG;AAEI,IAAMA,gBAAgB,GAAtB,MAAMA,gBAAiB,SAAQC,eAAe,CAACC,IAAI,CAACC,UAAU,EAAE,YAAY,CAAC,CAAC,CAAA;AAA9EC,EAAAA,WAAAA,GAAA;;;AAwBL;IAA0B,QAAkB,GAAG,IAAIC,gBAAgB,EAAqB,CAACC,qBAAqB,EAAE;AAChH;AAAgBC,IAAAA,qCAAA,CAAAC,GAAA,CAAA,IAAA,EAAA,MAAA,CAAA;AAGhB;;;AAGG;IAC0B,IAAA,CAAAC,IAAI,GAAe,SAAS;AAgF3D,EAAA;AA9EE;EACA,IAAIC,KAAKA,GAAA;AACP,IAAA,OAAO,IAAI,CAACC,gBAAgB,CAAC,CAACD,KAAK;AACrC,EAAA;AAEA;EACA,IAAIE,QAAQA,GAAA;IACV,OAAO,IAAI,CAACD,gBAAgB,CAAC,CAACE,aAAa,CAAC,CAAC,CAAC,IAAI,IAAI;AACxD,EAAA;AAEA;EACA,IAAIC,WAAWA,GAAA;AACb,IAAA,OAAO,IAAI,CAACC,KAAK,KAAK,IAAI,CAACN,IAAI,KAAK,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC;AACzE,EAAA;EACA,IAAIK,WAA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CAAA,m8BAAA,CAlMrD;AA2OiCxD,UAAA,CAAA,CAAtCyD,KAAK,CAAC,aAAa,CAAC,CAAmD,EAAAnD,iBAAA,CAAAJ,SAAA,EAAA,YAAA,EAAA,MAAA,CAAA;AAChCF,UAAA,CAAA,CAAvCyD,KAAK,CAAC,cAAc,CAAC,CAAqD,EAAAnD,iBAAA,CAAAJ,SAAA,EAAA,aAAA,EAAA,MAAA,CAAA;AACxCF,UAAA,CAAA,CAAlCyD,KAAK,CAAC,SAAS,CAAC,CAA6C,EAAAnD,iBAAA,CAAAJ,SAAA,EAAA,SAAA,EAAA,MAAA,CAAA;AAMjDF,UAAA,CAAA,CAA5BG,QAAQ,CAAC;AAAEC,EAAAA,OAAO,EAAE;CAAM,CAAC,CAA8C,EAAAE,iBAAA,CAAAJ,SAAA,EAAA,aAAA,EAAA,MAAA,CAAA;AAvP/DI,iBAAiB,GAAAN,UAAA,CAAA,CAD7BK,aAAa,CAAC,cAAc,CAAC,CACjB,EAAAC,iBAAiB,CA+U7B;;;;"}
1
+ {"version":3,"file":"nav-bar.js","sources":["../../src/nav-bar/NavBarElement.ts","../../src/nav-bar/NavItemElement.ts"],"sourcesContent":["import { css, CSSResultGroup, html, LitElement, PropertyValues } from \"lit\";\r\nimport { property, state } from \"lit/decorators.js\";\r\n\r\nimport { AttachInternals, customElement, DesignToken, ReconnectedCallback, Role, setCustomState } from \"@m3e/web/core\";\r\n\r\nimport { SelectionManager, selectionManager } from \"@m3e/web/core/a11y\";\r\nimport { Breakpoint, M3eBreakpointObserver } from \"@m3e/web/core/layout\";\r\n\r\nimport { M3eNavItemElement } from \"./NavItemElement\";\r\nimport { NavItemOrientation } from \"./NavItemOrientation\";\r\nimport { NavBarMode } from \"./NavBarMode\";\r\n\r\n/**\r\n * A horizontal bar, typically used on smaller devices, that allows a user to switch between 3-5 views.\r\n *\r\n * @description\r\n * The `m3e-nav-bar` component provides a horizontal navigation bar for switching between primary destinations in\r\n * an application. Designed for smaller devices, it supports 3-5 interactive items, orientation, and theming\r\n * via CSS custom properties.\r\n *\r\n * @example\r\n * The following example illustrates a nav bar with vertically oriented items.\r\n * ```html\r\n * <m3e-nav-bar>\r\n * <m3e-nav-item><m3e-icon slot=\"icon\" name=\"news\"></m3e-icon>News</m3e-nav-item>\r\n * <m3e-nav-item><m3e-icon slot=\"icon\" name=\"globe\"></m3e-icon>Global</m3e-nav-item>\r\n * <m3e-nav-item><m3e-icon slot=\"icon\" name=\"star\"></m3e-icon>For you</m3e-nav-item>\r\n * <m3e-nav-item><m3e-icon slot=\"icon\" name=\"newsstand\"></m3e-icon>Trending</m3e-nav-item>\r\n * </m3e-nav-bar>\r\n * ```\r\n *\r\n * @tag m3e-nav-bar\r\n *\r\n * @slot - Renders the items of the bar.\r\n *\r\n * @attr mode - The mode in which items in the bar are presented.\r\n *\r\n * @fires change - Emitted when the selected state of an item changes.\r\n *\r\n * @cssprop --m3e-nav-bar-height - Height of the navigation bar.\r\n * @cssprop --m3e-nav-bar-container-color - Background color of the navigation bar container.\r\n * @cssprop --m3e-nav-bar-vertical-item-width - Minimum width of vertical nav items.\r\n */\r\n@customElement(\"m3e-nav-bar\")\r\nexport class M3eNavBarElement extends ReconnectedCallback(AttachInternals(Role(LitElement, \"navigation\"))) {\r\n /** The styles of the element. */\r\n static override styles: CSSResultGroup = css`\r\n :host {\r\n display: block;\r\n overflow-x: auto;\r\n overflow-y: hidden;\r\n scrollbar-width: ${DesignToken.scrollbar.thinWidth};\r\n scrollbar-color: ${DesignToken.scrollbar.color};\r\n min-height: var(--m3e-nav-bar-height, 4rem);\r\n }\r\n .base {\r\n display: flex;\r\n align-items: stretch;\r\n justify-content: center;\r\n box-sizing: border-box;\r\n min-height: inherit;\r\n height: inherit;\r\n width: 100%;\r\n background-color: var(--m3e-nav-bar-container-color, ${DesignToken.color.surfaceContainer});\r\n --_nav-item-min-width: var(--m3e-nav-bar-vertical-item-width, 7rem);\r\n }\r\n `;\r\n\r\n /** @internal */ readonly [selectionManager] = new SelectionManager<M3eNavItemElement>().disableRovingTabIndex();\r\n /** @private */ #breakpointUnobserve?: () => void;\r\n /** @private */ @state() private _mode?: Exclude<NavBarMode, \"auto\">;\r\n\r\n /**\r\n * The mode in which items in the bar are presented.\r\n * @default \"compact\"\r\n */\r\n @property({ reflect: true }) mode: NavBarMode = \"compact\";\r\n\r\n /** The items of the bar. */\r\n get items(): readonly M3eNavItemElement[] {\r\n return this[selectionManager].items;\r\n }\r\n\r\n /** The selected item. */\r\n get selected(): M3eNavItemElement | null {\r\n return this[selectionManager].selectedItems[0] ?? null;\r\n }\r\n\r\n /** The current mode applied to the bar. */\r\n get currentMode(): Exclude<NavBarMode, \"auto\"> {\r\n return this._mode ?? (this.mode !== \"compact\" ? \"expanded\" : \"compact\");\r\n }\r\n set currentMode(value: Exclude<NavBarMode, \"auto\">) {\r\n this._mode = value;\r\n }\r\n\r\n /** @inheritdoc */\r\n override disconnectedCallback(): void {\r\n super.disconnectedCallback();\r\n\r\n this._mode = undefined;\r\n this.#breakpointUnobserve?.();\r\n }\r\n\r\n /** @inheritdoc */\r\n override reconnectedCallback(): void {\r\n super.reconnectedCallback();\r\n\r\n if (this.mode === \"auto\") {\r\n this.#initBreakpointMonitoring();\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override willUpdate(changedProperties: PropertyValues): void {\r\n super.willUpdate(changedProperties);\r\n\r\n if (changedProperties.has(\"mode\")) {\r\n this.#breakpointUnobserve?.();\r\n\r\n if (this.mode === \"auto\") {\r\n this.#initBreakpointMonitoring();\r\n } else {\r\n this._mode = undefined;\r\n this._updateItems();\r\n }\r\n }\r\n if (changedProperties.has(\"_mode\")) {\r\n this._updateItems();\r\n }\r\n }\r\n\r\n /** @private */\r\n #initBreakpointMonitoring(): void {\r\n this.#breakpointUnobserve = M3eBreakpointObserver.observe([Breakpoint.XSmall, Breakpoint.Small], (matches) => {\r\n this._mode = matches.get(Breakpoint.XSmall) || matches.get(Breakpoint.Small) ? \"compact\" : \"expanded\";\r\n this._updateItems();\r\n });\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override render(): unknown {\r\n return html`<div class=\"base\">\r\n <slot @change=\"${this.#handleChange}\" @slotchange=\"${this.#handleSlotChange}\"></slot>\r\n </div>`;\r\n }\r\n\r\n /** @private */\r\n #handleSlotChange(): void {\r\n this[selectionManager].setItems([...this.querySelectorAll(\"m3e-nav-item\")]);\r\n this._updateItems();\r\n }\r\n\r\n /** @private */\r\n #handleChange(e: Event): void {\r\n e.stopPropagation();\r\n this.dispatchEvent(new Event(\"change\", { bubbles: true }));\r\n }\r\n\r\n /** @internal */\r\n protected _updateItems(): void {\r\n const orientation: NavItemOrientation = this.currentMode === \"compact\" ? \"vertical\" : \"horizontal\";\r\n this._updateOrientation(orientation);\r\n setCustomState(this, \"-compact\", orientation === \"vertical\");\r\n }\r\n\r\n /** @internal */\r\n protected _updateOrientation(orientation: NavItemOrientation): void {\r\n this[selectionManager].items.forEach((x) => (x.orientation = orientation));\r\n }\r\n}\r\n\r\ndeclare global {\r\n interface HTMLElementTagNameMap {\r\n \"m3e-nav-bar\": M3eNavBarElement;\r\n }\r\n}\r\n","import { css, CSSResultGroup, html, LitElement, nothing, PropertyValues } from \"lit\";\r\nimport { property, query } from \"lit/decorators.js\";\r\n\r\nimport {\r\n AttachInternals,\r\n customElement,\r\n DesignToken,\r\n Disabled,\r\n DisabledInteractive,\r\n Focusable,\r\n KeyboardClick,\r\n LinkButton,\r\n M3eFocusRingElement,\r\n M3eRippleElement,\r\n M3eStateLayerElement,\r\n renderPseudoLink,\r\n Role,\r\n Selected,\r\n} from \"@m3e/web/core\";\r\n\r\nimport { selectionManager } from \"@m3e/web/core/a11y\";\r\n\r\nimport type { M3eNavBarElement } from \"./NavBarElement\";\r\nimport { NavItemOrientation } from \"./NavItemOrientation\";\r\n\r\n/**\r\n * An item, placed in a navigation bar or rail, used to navigate to destinations in an application.\r\n *\r\n * @description\r\n * The `m3e-nav-item` component represents an interactive navigation item for use in navigation bars\r\n * or rails. Designed according to Material 3 principles, it supports icon and label slots, selection state,\r\n * orientation, and extensive theming via CSS custom properties.\r\n *\r\n * @example\r\n * The following example illustrates a nav bar with vertically oriented items.\r\n * ```html\r\n * <m3e-nav-bar>\r\n * <m3e-nav-item><m3e-icon slot=\"icon\" name=\"news\"></m3e-icon>News</m3e-nav-item>\r\n * <m3e-nav-item><m3e-icon slot=\"icon\" name=\"globe\"></m3e-icon>Global</m3e-nav-item>\r\n * <m3e-nav-item><m3e-icon slot=\"icon\" name=\"star\"></m3e-icon>For you</m3e-nav-item>\r\n * <m3e-nav-item><m3e-icon slot=\"icon\" name=\"newsstand\"></m3e-icon>Trending</m3e-nav-item>\r\n * </m3e-nav-bar>\r\n * ```\r\n *\r\n * @tag m3e-nav-item\r\n *\r\n * @slot - Renders the label of the item.\r\n * @slot icon - Renders the icon of the item.\r\n * @slot selected-icon - Renders the icon of the item when selected.\r\n *\r\n * @attr disabled - A value indicating whether the element is disabled.\r\n * @attr disabled-interactive - A value indicating whether the element is disabled and interactive.\r\n * @attr download - A value indicating whether the `target` of the link button will be downloaded, optionally specifying the new name of the file.\r\n * @attr href - The URL to which the link button points.\r\n * @attr orientation - The layout orientation of the item.\r\n * @attr rel - The relationship between the `target` of the link button and the document.\r\n * @attr selected - A value indicating whether the element is selected.\r\n * @attr target - The target of the link button.\r\n *\r\n * @fires input - Emitted when the selected state changes.\r\n * @fires change - Emitted when the selected state changes.\r\n * @fires click - Emitted when the element is clicked.\r\n *\r\n * @cssprop --m3e-nav-item-label-text-font-size - Font size for the label text.\r\n * @cssprop --m3e-nav-item-label-text-font-weight - Font weight for the label text.\r\n * @cssprop --m3e-nav-item-label-text-line-height - Line height for the label text.\r\n * @cssprop --m3e-nav-item-label-text-tracking - Letter spacing for the label text.\r\n * @cssprop --m3e-nav-item-shape - Border radius of the nav item.\r\n * @cssprop --m3e-nav-item-icon-size - Size of the icon.\r\n * @cssprop --m3e-nav-item-spacing - Spacing between icon and label.\r\n * @cssprop --m3e-nav-item-inactive-label-text-color - Color of the label text when inactive.\r\n * @cssprop --m3e-nav-item-inactive-icon-color - Color of the icon when inactive.\r\n * @cssprop --m3e-nav-item-inactive-hover-state-layer-color - State layer color on hover when inactive.\r\n * @cssprop --m3e-nav-item-inactive-focus-state-layer-color - State layer color on focus when inactive.\r\n * @cssprop --m3e-nav-item-inactive-pressed-state-layer-color - State layer color on press when inactive.\r\n * @cssprop --m3e-nav-item-active-label-text-color - Color of the label text when active/selected.\r\n * @cssprop --m3e-nav-item-active-icon-color - Color of the icon when active/selected.\r\n * @cssprop --m3e-nav-item-active-container-color - Container color when active/selected.\r\n * @cssprop --m3e-nav-item-active-hover-state-layer-color - State layer color on hover when active.\r\n * @cssprop --m3e-nav-item-active-focus-state-layer-color - State layer color on focus when active.\r\n * @cssprop --m3e-nav-item-active-pressed-state-layer-color - State layer color on press when active.\r\n * @cssprop --m3e-nav-item-focus-ring-shape - Border radius for the focus ring.\r\n * @cssprop --m3e-nav-item-disabled-label-text-color - Color of the label text when disabled.\r\n * @cssprop --m3e-nav-item-disabled-label-text-opacity - Opacity of the label text when disabled.\r\n * @cssprop --m3e-nav-item-disabled-icon-color - Color of the icon when disabled.\r\n * @cssprop --m3e-nav-item-disabled-icon-opacity - Opacity of the icon when disabled.\r\n * @cssprop --m3e-horizontal-nav-item-padding - Padding for horizontal orientation.\r\n * @cssprop --m3e-horizontal-nav-item-active-indicator-height - Height of the active indicator in horizontal orientation.\r\n * @cssprop --m3e-vertical-nav-item-active-indicator-width - Width of the active indicator in vertical orientation.\r\n * @cssprop --m3e-vertical-nav-item-active-indicator-height - Height of the active indicator in vertical orientation.\r\n * @cssprop --m3e-vertical-nav-item-active-indicator-margin - Margin for the active indicator in vertical orientation.\r\n */\r\n@customElement(\"m3e-nav-item\")\r\nexport class M3eNavItemElement extends LinkButton(\r\n Selected(KeyboardClick(Focusable(DisabledInteractive(Disabled(AttachInternals(Role(LitElement, \"button\"), true)))))),\r\n) {\r\n /** The styles of the element. */\r\n static override styles: CSSResultGroup = css`\r\n :host {\r\n display: inline-block;\r\n vertical-align: middle;\r\n position: relative;\r\n outline: none;\r\n user-select: none;\r\n flex: 1;\r\n font-size: var(--m3e-nav-item-label-text-font-size, ${DesignToken.typescale.standard.label.medium.fontSize});\r\n font-weight: var(\r\n --m3e-nav-item-label-text-font-weight,\r\n ${DesignToken.typescale.standard.label.medium.fontWeight}\r\n );\r\n line-height: var(\r\n --m3e-nav-item-label-text-line-height,\r\n ${DesignToken.typescale.standard.label.medium.lineHeight}\r\n );\r\n letter-spacing: var(--m3e-nav-item-label-text-tracking, ${DesignToken.typescale.standard.label.medium.tracking});\r\n border-radius: var(--m3e-nav-item-shape, ${DesignToken.shape.corner.full});\r\n min-width: var(--_nav-item-min-width);\r\n align-self: var(--_nav-item-align-self);\r\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\r\n }\r\n :host([orientation=\"horizontal\"]) {\r\n max-width: fit-content;\r\n }\r\n :host(:not(:disabled):not([disabled-interactive])) {\r\n cursor: pointer;\r\n }\r\n :host([disabled-interactive]) {\r\n cursor: not-allowed;\r\n }\r\n .outer {\r\n height: 100%;\r\n }\r\n .outer,\r\n .inner {\r\n display: flex;\r\n align-items: center;\r\n justify-content: var(--_nav-item-justify-content, center);\r\n position: relative;\r\n border-radius: inherit;\r\n }\r\n .icon-wrapper {\r\n position: relative;\r\n flex: none;\r\n }\r\n .base {\r\n justify-content: unset;\r\n box-sizing: border-box;\r\n vertical-align: middle;\r\n display: inline-flex;\r\n align-items: center;\r\n justify-content: center;\r\n position: relative;\r\n width: 100%;\r\n }\r\n .icon {\r\n position: absolute;\r\n }\r\n .label {\r\n vertical-align: middle;\r\n }\r\n ::slotted([slot=\"icon\"]),\r\n ::slotted([slot=\"selected-icon\"]) {\r\n width: 1em;\r\n font-size: var(--m3e-nav-item-icon-size, 1.5rem) !important;\r\n }\r\n :host(:not([selected]):not(:disabled):not([disabled-interactive])) .outer {\r\n --m3e-state-layer-hover-color: var(\r\n --m3e-nav-item-inactive-hover-state-layer-color,\r\n ${DesignToken.color.onSecondaryContainer}\r\n );\r\n --m3e-state-layer-focus-color: var(\r\n --m3e-nav-item-inactive-focus-state-layer-color,\r\n ${DesignToken.color.onSecondaryContainer}\r\n );\r\n --m3e-ripple-color: var(\r\n --m3e-nav-item-inactive-pressed-state-layer-color,\r\n ${DesignToken.color.onSecondaryContainer}\r\n );\r\n }\r\n :host(:not([selected]):not(:disabled):not([disabled-interactive])) .label {\r\n color: var(--m3e-nav-item-inactive-label-text-color, ${DesignToken.color.onSurfaceVariant});\r\n }\r\n :host(:not([selected]):not(:disabled):not([disabled-interactive])) .icon {\r\n color: var(--m3e-nav-item-inactive-icon-color, ${DesignToken.color.onSecondaryContainer});\r\n }\r\n :host([selected]:not(:disabled):not([disabled-interactive])) .outer {\r\n --m3e-state-layer-hover-color: var(\r\n --m3e-nav-item-active-hover-state-layer-color,\r\n ${DesignToken.color.onSecondaryContainer}\r\n );\r\n --m3e-state-layer-focus-color: var(\r\n --m3e-nav-item-active-focus-state-layer-color,\r\n ${DesignToken.color.onSecondaryContainer}\r\n );\r\n --m3e-ripple-color: var(\r\n --m3e-nav-item-active-pressed-state-layer-color,\r\n ${DesignToken.color.onSecondaryContainer}\r\n );\r\n }\r\n :host([selected]:not(:disabled):not([disabled-interactive])) .label {\r\n color: var(--m3e-nav-item-active-label-text-color, ${DesignToken.color.secondary});\r\n }\r\n :host([selected]:not(:disabled):not([disabled-interactive])) .state-layer {\r\n background-color: var(--m3e-nav-item-active-container-color, ${DesignToken.color.secondaryContainer});\r\n }\r\n :host([selected]:not(:disabled):not([disabled-interactive])) .icon {\r\n color: var(--m3e-nav-item-active-icon-color, ${DesignToken.color.onSecondaryContainer});\r\n }\r\n :host([orientation=\"vertical\"]) .outer {\r\n align-self: stretch;\r\n align-items: flex-start;\r\n }\r\n :host([orientation=\"vertical\"]) .label {\r\n text-align: center;\r\n display: -webkit-box;\r\n -webkit-line-clamp: 2;\r\n -webkit-box-orient: vertical;\r\n overflow: hidden;\r\n line-clamp: 2;\r\n }\r\n :host([orientation=\"vertical\"]) .base {\r\n flex-direction: column;\r\n row-gap: var(--m3e-nav-item-spacing, 0.25rem);\r\n }\r\n :host([orientation=\"vertical\"]) .base {\r\n margin-block: var(--m3e-vertical-nav-item-active-indicator-margin, 0.375rem);\r\n }\r\n :host([orientation=\"vertical\"]) .state-layer,\r\n :host([orientation=\"vertical\"]) .ripple {\r\n top: var(--m3e-vertical-nav-item-active-indicator-margin, 0.375rem);\r\n bottom: unset;\r\n }\r\n :host([orientation=\"vertical\"]) .state-layer,\r\n :host([orientation=\"vertical\"]) .ripple,\r\n :host([orientation=\"vertical\"]) .icon-wrapper {\r\n width: var(--m3e-vertical-nav-item-active-indicator-width, 3.5rem);\r\n }\r\n :host([orientation=\"vertical\"]) .state-layer,\r\n :host([orientation=\"vertical\"]) .ripple,\r\n :host([orientation=\"vertical\"]) .icon-wrapper {\r\n height: var(--m3e-vertical-nav-item-active-indicator-height, 2rem);\r\n }\r\n :host([orientation=\"vertical\"]) .icon {\r\n top: calc(\r\n calc(var(--m3e-vertical-nav-item-active-indicator-height, 2rem) / 2) - calc(\r\n var(--m3e-nav-item-icon-size, 1.5rem) / 2\r\n )\r\n );\r\n left: calc(\r\n calc(var(--m3e-vertical-nav-item-active-indicator-width, 3.5rem) / 2) - calc(\r\n var(--m3e-nav-item-icon-size, 1.5rem) / 2\r\n )\r\n );\r\n }\r\n :host([orientation=\"vertical\"]) .focus-ring {\r\n border-radius: var(--m3e-nav-item-focus-ring-shape, ${DesignToken.shape.corner.medium});\r\n }\r\n :host([orientation=\"horizontal\"]) .icon-wrapper {\r\n width: var(--m3e-nav-item-icon-size, 1.5rem);\r\n height: var(--m3e-nav-item-icon-size, 1.5rem);\r\n }\r\n :host([orientation=\"horizontal\"]) .base {\r\n padding: var(--m3e-horizontal-nav-item-padding, 1rem);\r\n }\r\n :host([orientation=\"horizontal\"]) .label {\r\n flex: 1 1 auto;\r\n }\r\n :host([orientation=\"horizontal\"]) .base {\r\n column-gap: var(--m3e-nav-item-spacing, 0.25rem);\r\n }\r\n :host([orientation=\"horizontal\"]) .inner {\r\n height: var(--m3e-horizontal-nav-item-active-indicator-height, 2.5rem);\r\n width: fit-content;\r\n }\r\n .state-layer,\r\n .ripple {\r\n margin-inline: auto;\r\n }\r\n :host(:disabled) .label,\r\n :host([disabled-interactive]) .label {\r\n color: color-mix(\r\n in srgb,\r\n var(--m3e-nav-item-disabled-label-text-color, ${DesignToken.color.onSurface})\r\n var(--m3e-nav-item-disabled-label-text-opacity, 38%),\r\n transparent\r\n );\r\n }\r\n :host(:disabled) .icon,\r\n :host([disabled-interactive]) .icon {\r\n color: color-mix(\r\n in srgb,\r\n var(--m3e-nav-item-disabled-icon-color, ${DesignToken.color.onSurface})\r\n var(--m3e-nav-item-disabled-icon-opacity, 38%),\r\n transparent\r\n );\r\n }\r\n a {\r\n all: unset;\r\n display: block;\r\n position: absolute;\r\n top: 0px;\r\n left: 0px;\r\n right: 0px;\r\n bottom: 0px;\r\n z-index: 1;\r\n }\r\n @media (forced-colors: active) {\r\n :host(:disabled) .label,\r\n :host([disabled-interactive]) .label,\r\n :host(:disabled) .icon,\r\n :host([disabled-interactive]) .icon {\r\n color: GrayText;\r\n }\r\n :host(:not([selected]):not(:disabled):not([disabled-interactive])) .label,\r\n :host(:not([selected]):not(:disabled):not([disabled-interactive])) .icon {\r\n color: ButtonText;\r\n }\r\n :host([selected]:not(:disabled):not([disabled-interactive])) .state-layer {\r\n background-color: ButtonText;\r\n }\r\n :host([orientation=\"vertical\"][selected]:not(:disabled):not([disabled-interactive])) .label {\r\n color: ButtonText;\r\n }\r\n :host([orientation=\"horizontal\"][selected]:not(:disabled):not([disabled-interactive])) .label,\r\n :host([selected]:not(:disabled):not([disabled-interactive])) .icon {\r\n forced-color-adjust: none;\r\n color: ButtonFace;\r\n }\r\n }\r\n `;\r\n\r\n /** @private */ readonly #clickHandler = (e: Event) => this.#handleClick(e);\r\n /** @private */ @query(\".focus-ring\") private readonly _focusRing?: M3eFocusRingElement;\r\n /** @private */ @query(\".state-layer\") private readonly _stateLayer?: M3eStateLayerElement;\r\n /** @private */ @query(\".ripple\") private readonly _ripple?: M3eRippleElement;\r\n\r\n /**\r\n * The layout orientation of the item.\r\n * @default \"vertical\"\r\n */\r\n @property({ reflect: true }) orientation: NavItemOrientation = \"vertical\";\r\n\r\n /** The navigation bar to which this item belongs. */\r\n get navBar(): M3eNavBarElement | null {\r\n return this.closest(\"m3e-nav-bar\") ?? this.closest(\"m3e-nav-rail\") ?? null;\r\n }\r\n\r\n /** @inheritdoc */\r\n override connectedCallback(): void {\r\n super.connectedCallback();\r\n this.addEventListener(\"click\", this.#clickHandler, { capture: true });\r\n }\r\n\r\n /** @inheritdoc */\r\n override disconnectedCallback(): void {\r\n super.disconnectedCallback();\r\n this.removeEventListener(\"click\", this.#clickHandler, { capture: true });\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override update(changedProperties: PropertyValues<this>): void {\r\n super.update(changedProperties);\r\n\r\n if (changedProperties.has(\"selected\")) {\r\n this.ariaSelected = null;\r\n this.ariaPressed = null;\r\n this.ariaCurrent = `${this.selected}`;\r\n for (const icon of this.querySelectorAll(\"m3e-icon\")) {\r\n icon.toggleAttribute(\"filled\", this.selected);\r\n }\r\n this.navBar?.[selectionManager].notifySelectionChange(this);\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override updated(_changedProperties: PropertyValues<this>): void {\r\n super.updated(_changedProperties);\r\n\r\n if (_changedProperties.has(\"orientation\")) {\r\n this._focusRing?.attach(this);\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override firstUpdated(_changedProperties: PropertyValues<this>): void {\r\n super.firstUpdated(_changedProperties);\r\n [this._focusRing, this._stateLayer, this._ripple].forEach((x) => x?.attach(this));\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override render(): unknown {\r\n const disabled = this.disabled || this.disabledInteractive;\r\n return html`${this.orientation === \"vertical\"\r\n ? html`<m3e-focus-ring class=\"focus-ring\" inward></m3e-focus-ring>`\r\n : nothing}\r\n <div class=\"outer\">\r\n ${this[renderPseudoLink]()}\r\n <div class=\"inner\">\r\n ${this.orientation === \"horizontal\" ? html`<m3e-focus-ring class=\"focus-ring\"></m3e-focus-ring>` : nothing}\r\n <m3e-state-layer class=\"state-layer\" ?disabled=\"${disabled}\"></m3e-state-layer>\r\n <m3e-ripple class=\"ripple\" centered ?disabled=\"${disabled}\"></m3e-ripple>\r\n <div class=\"touch\" aria-hidden=\"true\"></div>\r\n <div class=\"base\">\r\n <div class=\"icon-wrapper\" aria-hidden=\"true\">\r\n <div class=\"icon\">\r\n <slot name=\"icon\" aria-hidden=\"true\"></slot>\r\n </div>\r\n </div>\r\n <div class=\"label\">\r\n <slot></slot>\r\n </div>\r\n </div>\r\n </div>\r\n </div>`;\r\n }\r\n\r\n /** @private */\r\n #handleClick(e: Event): void {\r\n if (e.defaultPrevented) return;\r\n\r\n this.selected = true;\r\n if (this.dispatchEvent(new Event(\"input\", { bubbles: true, composed: true, cancelable: true }))) {\r\n this.navBar?.[selectionManager].notifySelectionChange(this);\r\n this.dispatchEvent(new Event(\"change\", { bubbles: true }));\r\n } else {\r\n this.selected = false;\r\n }\r\n }\r\n}\r\n\r\ndeclare global {\r\n interface HTMLElementTagNameMap {\r\n \"m3e-nav-item\": M3eNavItemElement;\r\n }\r\n}\r\n"],"names":["M3eNavBarElement","ReconnectedCallback","AttachInternals","Role","LitElement","constructor","SelectionManager","disableRovingTabIndex","_M3eNavBarElement_breakpointUnobserve","set","mode","items","selectionManager","selected","selectedItems","currentMode","_mode","value","disconnectedCallback","undefined","__classPrivateFieldGet","call","reconnectedCallback","_M3eNavBarElement_instances","_M3eNavBarElement_initBreakpointMonitoring","willUpdate","changedProperties","has","_updateItems","render","html","_M3eNavBarElement_handleChange","_M3eNavBarElement_handleSlotChange","orientation","_updateOrientation","setCustomState","forEach","x","__classPrivateFieldSet","M3eBreakpointObserver","observe","Breakpoint","XSmall","Small","matches","get","setItems","querySelectorAll","e","stopPropagation","dispatchEvent","Event","bubbles","styles","css","DesignToken","scrollbar","thinWidth","color","surfaceContainer","__decorate","state","prototype","property","reflect","customElement","M3eNavItemElement","LinkButton","Selected","KeyboardClick","Focusable","DisabledInteractive","Disabled","_M3eNavItemElement_clickHandler","navBar","closest","connectedCallback","addEventListener","capture","removeEventListener","update","ariaSelected","ariaPressed","ariaCurrent","icon","toggleAttribute","notifySelectionChange","updated","_changedProperties","_focusRing","attach","firstUpdated","_stateLayer","_ripple","disabled","disabledInteractive","nothing","renderPseudoLink","defaultPrevented","composed","cancelable","typescale","standard","label","medium","fontSize","fontWeight","lineHeight","tracking","shape","corner","full","onSecondaryContainer","onSurfaceVariant","secondary","secondaryContainer","onSurface","query"],"mappings":";;;;;;;;;;;;;AAYA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BG;AAEI,IAAMA,gBAAgB,GAAtB,MAAMA,gBAAiB,SAAQC,mBAAmB,CAACC,eAAe,CAACC,IAAI,CAACC,UAAU,EAAE,YAAY,CAAC,CAAC,CAAC,CAAA;AAAnGC,EAAAA,WAAAA,GAAA;;;AAwBL;IAA0B,QAAkB,GAAG,IAAIC,gBAAgB,EAAqB,CAACC,qBAAqB,EAAE;AAChH;AAAgBC,IAAAA,qCAAA,CAAAC,GAAA,CAAA,IAAA,EAAA,MAAA,CAAA;AAGhB;;;AAGG;IAC0B,IAAA,CAAAC,IAAI,GAAe,SAAS;AA8F3D,EAAA;AA5FE;EACA,IAAIC,KAAKA,GAAA;AACP,IAAA,OAAO,IAAI,CAACC,gBAAgB,CAAC,CAACD,KAAK;AACrC,EAAA;AAEA;EACA,IAAIE,QAAQA,GAAA;IACV,OAAO,IAAI,CAACD,gBAAgB,CAAC,CAACE,aAAa,CAAC,CAAC,CAAC,IAAI,IAAI;AACxD,EAAA;AAEA;EACA,IAAIC,WAAWA,GAAA;AACb,IAAA,OAAO,IAAI,CAACC,K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et as e,__classPrivateFieldSet as t,__decorate as i}from"tslib";import{LitElement as a,html as o,css as r,nothing as n}from"lit";import{state as l,property as s,query as c}from"lit/decorators.js";import{AttachInternals as d,Role as v,setCustomState as m,DesignToken as h,customElement as p,LinkButton as b,Selected as u,KeyboardClick as g,Focusable as f,DisabledInteractive as y,Disabled as w,renderPseudoLink as x}from"@m3e/web/core";import{SelectionManager as $,selectionManager as k}from"@m3e/web/core/a11y";import{M3eBreakpointObserver as _,Breakpoint as z}from"@m3e/web/core/layout";var S,C,E,I,j;let B=class extends(d(v(a,"navigation"))){constructor(){super(...arguments),S.add(this),this[j]=(new $).disableRovingTabIndex(),C.set(this,void 0),this.mode="compact"}get items(){return this[k].items}get selected(){return this[k].selectedItems[0]??null}get currentMode(){return this._mode??("compact"!==this.mode?"expanded":"compact")}set currentMode(e){this._mode=e}disconnectedCallback(){super.disconnectedCallback(),this._mode=void 0,e(this,C,"f")?.call(this)}willUpdate(i){super.willUpdate(i),i.has("mode")&&(e(this,C,"f")?.call(this),"auto"===this.mode?t(this,C,_.observe([z.XSmall,z.Small],e=>{this._mode=e.get(z.XSmall)||e.get(z.Small)?"compact":"expanded",this._updateItems()}),"f"):(this._mode=void 0,this._updateItems())),i.has("_mode")&&this._updateItems()}render(){return o`<div class="base"><slot @change="${e(this,S,"m",I)}" @slotchange="${e(this,S,"m",E)}"></slot></div>`}_updateItems(){const e="compact"===this.currentMode?"vertical":"horizontal";this._updateOrientation(e),m(this,"-compact","vertical"===e)}_updateOrientation(e){this[k].items.forEach(t=>t.orientation=e)}};var W,M,T;C=new WeakMap,S=new WeakSet,j=k,E=function(){this[k].setItems([...this.querySelectorAll("m3e-nav-item")]),this._updateItems()},I=function(e){e.stopPropagation(),this.dispatchEvent(new Event("change",{bubbles:!0}))},B.styles=r`:host { display: block; overflow-x: auto; overflow-y: hidden; scrollbar-width: ${h.scrollbar.thinWidth}; scrollbar-color: ${h.scrollbar.color}; min-height: var(--m3e-nav-bar-height, 4rem); } .base { display: flex; align-items: stretch; justify-content: center; box-sizing: border-box; min-height: inherit; height: inherit; width: 100%; background-color: var(--m3e-nav-bar-container-color, ${h.color.surfaceContainer}); --_nav-item-min-width: var(--m3e-nav-bar-vertical-item-width, 7rem); }`,i([l()],B.prototype,"_mode",void 0),i([s({reflect:!0})],B.prototype,"mode",void 0),B=i([p("m3e-nav-bar")],B);let L=class extends(b(u(g(f(y(w(d(v(a,"button"),!0)))))))){constructor(){super(...arguments),W.add(this),M.set(this,t=>e(this,W,"m",T).call(this,t)),this.orientation="vertical"}get navBar(){return this.closest("m3e-nav-bar")??this.closest("m3e-nav-rail")??null}connectedCallback(){super.connectedCallback(),this.addEventListener("click",e(this,M,"f"),{capture:!0})}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",e(this,M,"f"),{capture:!0})}update(e){if(super.update(e),e.has("selected")){this.ariaSelected=null,this.ariaPressed=null,this.ariaCurrent=`${this.selected}`;for(const e of this.querySelectorAll("m3e-icon"))e.toggleAttribute("filled",this.selected);this.navBar?.[k].notifySelectionChange(this)}}updated(e){super.updated(e),e.has("orientation")&&this._focusRing?.attach(this)}firstUpdated(e){super.firstUpdated(e),[this._focusRing,this._stateLayer,this._ripple].forEach(e=>e?.attach(this))}render(){const e=this.disabled||this.disabledInteractive;return o`${"vertical"===this.orientation?o`<m3e-focus-ring class="focus-ring" inward></m3e-focus-ring>`:n}<div class="outer">${this[x]()}<div class="inner">${"horizontal"===this.orientation?o`<m3e-focus-ring class="focus-ring"></m3e-focus-ring>`:n}<m3e-state-layer class="state-layer" ?disabled="${e}"></m3e-state-layer><m3e-ripple class="ripple" centered ?disabled="${e}"></m3e-ripple><div class="touch" aria-hidden="true"></div><div class="base"><div class="icon-wrapper" aria-hidden="true"><div class="icon"><slot name="icon" aria-hidden="true"></slot></div></div><div class="label"><slot></slot></div></div></div></div>`}};M=new WeakMap,W=new WeakSet,T=function(e){e.defaultPrevented||(this.selected=!0,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0,cancelable:!0}))?(this.navBar?.[k].notifySelectionChange(this),this.dispatchEvent(new Event("change",{bubbles:!0}))):this.selected=!1)},L.styles=r`:host { display: inline-block; vertical-align: middle; position: relative; outline: none; user-select: none; flex: 1; font-size: var(--m3e-nav-item-label-text-font-size, ${h.typescale.standard.label.medium.fontSize}); font-weight: var( --m3e-nav-item-label-text-font-weight, ${h.typescale.standard.label.medium.fontWeight} ); line-height: var( --m3e-nav-item-label-text-line-height, ${h.typescale.standard.label.medium.lineHeight} ); letter-spacing: var(--m3e-nav-item-label-text-tracking, ${h.typescale.standard.label.medium.tracking}); border-radius: var(--m3e-nav-item-shape, ${h.shape.corner.full}); min-width: var(--_nav-item-min-width); align-self: var(--_nav-item-align-self); -webkit-tap-highlight-color: rgba(0, 0, 0, 0); } :host([orientation="horizontal"]) { max-width: fit-content; } :host(:not(:disabled):not([disabled-interactive])) { cursor: pointer; } :host([disabled-interactive]) { cursor: not-allowed; } .outer { height: 100%; } .outer, .inner { display: flex; align-items: center; justify-content: var(--_nav-item-justify-content, center); position: relative; border-radius: inherit; } .icon-wrapper { position: relative; flex: none; } .base { justify-content: unset; box-sizing: border-box; vertical-align: middle; display: inline-flex; align-items: center; justify-content: center; position: relative; width: 100%; } .icon { position: absolute; } .label { vertical-align: middle; } ::slotted([slot="icon"]), ::slotted([slot="selected-icon"]) { width: 1em; font-size: var(--m3e-nav-item-icon-size, 1.5rem) !important; } :host(:not([selected]):not(:disabled):not([disabled-interactive])) .outer { --m3e-state-layer-hover-color: var( --m3e-nav-item-inactive-hover-state-layer-color, ${h.color.onSecondaryContainer} ); --m3e-state-layer-focus-color: var( --m3e-nav-item-inactive-focus-state-layer-color, ${h.color.onSecondaryContainer} ); --m3e-ripple-color: var( --m3e-nav-item-inactive-pressed-state-layer-color, ${h.color.onSecondaryContainer} ); } :host(:not([selected]):not(:disabled):not([disabled-interactive])) .label { color: var(--m3e-nav-item-inactive-label-text-color, ${h.color.onSurfaceVariant}); } :host(:not([selected]):not(:disabled):not([disabled-interactive])) .icon { color: var(--m3e-nav-item-inactive-icon-color, ${h.color.onSecondaryContainer}); } :host([selected]:not(:disabled):not([disabled-interactive])) .outer { --m3e-state-layer-hover-color: var( --m3e-nav-item-active-hover-state-layer-color, ${h.color.onSecondaryContainer} ); --m3e-state-layer-focus-color: var( --m3e-nav-item-active-focus-state-layer-color, ${h.color.onSecondaryContainer} ); --m3e-ripple-color: var( --m3e-nav-item-active-pressed-state-layer-color, ${h.color.onSecondaryContainer} ); } :host([selected]:not(:disabled):not([disabled-interactive])) .label { color: var(--m3e-nav-item-active-label-text-color, ${h.color.secondary}); } :host([selected]:not(:disabled):not([disabled-interactive])) .state-layer { background-color: var(--m3e-nav-item-active-container-color, ${h.color.secondaryContainer}); } :host([selected]:not(:disabled):not([disabled-interactive])) .icon { color: var(--m3e-nav-item-active-icon-color, ${h.color.onSecondaryContainer}); } :host([orientation="vertical"]) .outer { align-self: stretch; align-items: flex-start; } :host([orientation="vertical"]) .label { text-align: center; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-clamp: 2; } :host([orientation="vertical"]) .base { flex-direction: column; row-gap: var(--m3e-nav-item-spacing, 0.25rem); } :host([orientation="vertical"]) .base { margin-block: var(--m3e-vertical-nav-item-active-indicator-margin, 0.375rem); } :host([orientation="vertical"]) .state-layer, :host([orientation="vertical"]) .ripple { top: var(--m3e-vertical-nav-item-active-indicator-margin, 0.375rem); bottom: unset; } :host([orientation="vertical"]) .state-layer, :host([orientation="vertical"]) .ripple, :host([orientation="vertical"]) .icon-wrapper { width: var(--m3e-vertical-nav-item-active-indicator-width, 3.5rem); } :host([orientation="vertical"]) .state-layer, :host([orientation="vertical"]) .ripple, :host([orientation="vertical"]) .icon-wrapper { height: var(--m3e-vertical-nav-item-active-indicator-height, 2rem); } :host([orientation="vertical"]) .icon { top: calc( calc(var(--m3e-vertical-nav-item-active-indicator-height, 2rem) / 2) - calc( var(--m3e-nav-item-icon-size, 1.5rem) / 2 ) ); left: calc( calc(var(--m3e-vertical-nav-item-active-indicator-width, 3.5rem) / 2) - calc( var(--m3e-nav-item-icon-size, 1.5rem) / 2 ) ); } :host([orientation="vertical"]) .focus-ring { border-radius: var(--m3e-nav-item-focus-ring-shape, ${h.shape.corner.medium}); } :host([orientation="horizontal"]) .icon-wrapper { width: var(--m3e-nav-item-icon-size, 1.5rem); height: var(--m3e-nav-item-icon-size, 1.5rem); } :host([orientation="horizontal"]) .base { padding: var(--m3e-horizontal-nav-item-padding, 1rem); } :host([orientation="horizontal"]) .label { flex: 1 1 auto; } :host([orientation="horizontal"]) .base { column-gap: var(--m3e-nav-item-spacing, 0.25rem); } :host([orientation="horizontal"]) .inner { height: var(--m3e-horizontal-nav-item-active-indicator-height, 2.5rem); width: fit-content; } .state-layer, .ripple { margin-inline: auto; } :host(:disabled) .label, :host([disabled-interactive]) .label { color: color-mix( in srgb, var(--m3e-nav-item-disabled-label-text-color, ${h.color.onSurface}) var(--m3e-nav-item-disabled-label-text-opacity, 38%), transparent ); } :host(:disabled) .icon, :host([disabled-interactive]) .icon { color: color-mix( in srgb, var(--m3e-nav-item-disabled-icon-color, ${h.color.onSurface}) var(--m3e-nav-item-disabled-icon-opacity, 38%), transparent ); } a { all: unset; display: block; position: absolute; top: 0px; left: 0px; right: 0px; bottom: 0px; z-index: 1; } @media (forced-colors: active) { :host(:disabled) .label, :host([disabled-interactive]) .label, :host(:disabled) .icon, :host([disabled-interactive]) .icon { color: GrayText; } :host(:not([selected]):not(:disabled):not([disabled-interactive])) .label, :host(:not([selected]):not(:disabled):not([disabled-interactive])) .icon { color: ButtonText; } :host([selected]:not(:disabled):not([disabled-interactive])) .state-layer { background-color: ButtonText; } :host([orientation="vertical"][selected]:not(:disabled):not([disabled-interactive])) .label { color: ButtonText; } :host([orientation="horizontal"][selected]:not(:disabled):not([disabled-interactive])) .label, :host([selected]:not(:disabled):not([disabled-interactive])) .icon { forced-color-adjust: none; color: ButtonFace; } }`,i([c(".focus-ring")],L.prototype,"_focusRing",void 0),i([c(".state-layer")],L.prototype,"_stateLayer",void 0),i([c(".ripple")],L.prototype,"_ripple",void 0),i([s({reflect:!0})],L.prototype,"orientation",void 0),L=i([p("m3e-nav-item")],L);export{B as M3eNavBarElement,L as M3eNavItemElement};
6
+ import{__classPrivateFieldGet as e,__classPrivateFieldSet as t,__decorate as i}from"tslib";import{LitElement as a,html as o,css as r,nothing as n}from"lit";import{state as l,property as s,query as c}from"lit/decorators.js";import{ReconnectedCallback as d,AttachInternals as h,Role as m,setCustomState as v,DesignToken as b,customElement as p,LinkButton as u,Selected as f,KeyboardClick as g,Focusable as y,DisabledInteractive as w,Disabled as x,renderPseudoLink as $}from"@m3e/web/core";import{SelectionManager as k,selectionManager as _}from"@m3e/web/core/a11y";import{M3eBreakpointObserver as z,Breakpoint as S}from"@m3e/web/core/layout";var C,E,I,j,B,W;let M=class extends(d(h(m(a,"navigation")))){constructor(){super(...arguments),C.add(this),this[W]=(new k).disableRovingTabIndex(),E.set(this,void 0),this.mode="compact"}get items(){return this[_].items}get selected(){return this[_].selectedItems[0]??null}get currentMode(){return this._mode??("compact"!==this.mode?"expanded":"compact")}set currentMode(e){this._mode=e}disconnectedCallback(){super.disconnectedCallback(),this._mode=void 0,e(this,E,"f")?.call(this)}reconnectedCallback(){super.reconnectedCallback(),"auto"===this.mode&&e(this,C,"m",I).call(this)}willUpdate(t){super.willUpdate(t),t.has("mode")&&(e(this,E,"f")?.call(this),"auto"===this.mode?e(this,C,"m",I).call(this):(this._mode=void 0,this._updateItems())),t.has("_mode")&&this._updateItems()}render(){return o`<div class="base"><slot @change="${e(this,C,"m",B)}" @slotchange="${e(this,C,"m",j)}"></slot></div>`}_updateItems(){const e="compact"===this.currentMode?"vertical":"horizontal";this._updateOrientation(e),v(this,"-compact","vertical"===e)}_updateOrientation(e){this[_].items.forEach(t=>t.orientation=e)}};var T,L,R;E=new WeakMap,C=new WeakSet,W=_,I=function(){t(this,E,z.observe([S.XSmall,S.Small],e=>{this._mode=e.get(S.XSmall)||e.get(S.Small)?"compact":"expanded",this._updateItems()}),"f")},j=function(){this[_].setItems([...this.querySelectorAll("m3e-nav-item")]),this._updateItems()},B=function(e){e.stopPropagation(),this.dispatchEvent(new Event("change",{bubbles:!0}))},M.styles=r`:host { display: block; overflow-x: auto; overflow-y: hidden; scrollbar-width: ${b.scrollbar.thinWidth}; scrollbar-color: ${b.scrollbar.color}; min-height: var(--m3e-nav-bar-height, 4rem); } .base { display: flex; align-items: stretch; justify-content: center; box-sizing: border-box; min-height: inherit; height: inherit; width: 100%; background-color: var(--m3e-nav-bar-container-color, ${b.color.surfaceContainer}); --_nav-item-min-width: var(--m3e-nav-bar-vertical-item-width, 7rem); }`,i([l()],M.prototype,"_mode",void 0),i([s({reflect:!0})],M.prototype,"mode",void 0),M=i([p("m3e-nav-bar")],M);let U=class extends(u(f(g(y(w(x(h(m(a,"button"),!0)))))))){constructor(){super(...arguments),T.add(this),L.set(this,t=>e(this,T,"m",R).call(this,t)),this.orientation="vertical"}get navBar(){return this.closest("m3e-nav-bar")??this.closest("m3e-nav-rail")??null}connectedCallback(){super.connectedCallback(),this.addEventListener("click",e(this,L,"f"),{capture:!0})}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",e(this,L,"f"),{capture:!0})}update(e){if(super.update(e),e.has("selected")){this.ariaSelected=null,this.ariaPressed=null,this.ariaCurrent=`${this.selected}`;for(const e of this.querySelectorAll("m3e-icon"))e.toggleAttribute("filled",this.selected);this.navBar?.[_].notifySelectionChange(this)}}updated(e){super.updated(e),e.has("orientation")&&this._focusRing?.attach(this)}firstUpdated(e){super.firstUpdated(e),[this._focusRing,this._stateLayer,this._ripple].forEach(e=>e?.attach(this))}render(){const e=this.disabled||this.disabledInteractive;return o`${"vertical"===this.orientation?o`<m3e-focus-ring class="focus-ring" inward></m3e-focus-ring>`:n}<div class="outer">${this[$]()}<div class="inner">${"horizontal"===this.orientation?o`<m3e-focus-ring class="focus-ring"></m3e-focus-ring>`:n}<m3e-state-layer class="state-layer" ?disabled="${e}"></m3e-state-layer><m3e-ripple class="ripple" centered ?disabled="${e}"></m3e-ripple><div class="touch" aria-hidden="true"></div><div class="base"><div class="icon-wrapper" aria-hidden="true"><div class="icon"><slot name="icon" aria-hidden="true"></slot></div></div><div class="label"><slot></slot></div></div></div></div>`}};L=new WeakMap,T=new WeakSet,R=function(e){e.defaultPrevented||(this.selected=!0,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0,cancelable:!0}))?(this.navBar?.[_].notifySelectionChange(this),this.dispatchEvent(new Event("change",{bubbles:!0}))):this.selected=!1)},U.styles=r`:host { display: inline-block; vertical-align: middle; position: relative; outline: none; user-select: none; flex: 1; font-size: var(--m3e-nav-item-label-text-font-size, ${b.typescale.standard.label.medium.fontSize}); font-weight: var( --m3e-nav-item-label-text-font-weight, ${b.typescale.standard.label.medium.fontWeight} ); line-height: var( --m3e-nav-item-label-text-line-height, ${b.typescale.standard.label.medium.lineHeight} ); letter-spacing: var(--m3e-nav-item-label-text-tracking, ${b.typescale.standard.label.medium.tracking}); border-radius: var(--m3e-nav-item-shape, ${b.shape.corner.full}); min-width: var(--_nav-item-min-width); align-self: var(--_nav-item-align-self); -webkit-tap-highlight-color: rgba(0, 0, 0, 0); } :host([orientation="horizontal"]) { max-width: fit-content; } :host(:not(:disabled):not([disabled-interactive])) { cursor: pointer; } :host([disabled-interactive]) { cursor: not-allowed; } .outer { height: 100%; } .outer, .inner { display: flex; align-items: center; justify-content: var(--_nav-item-justify-content, center); position: relative; border-radius: inherit; } .icon-wrapper { position: relative; flex: none; } .base { justify-content: unset; box-sizing: border-box; vertical-align: middle; display: inline-flex; align-items: center; justify-content: center; position: relative; width: 100%; } .icon { position: absolute; } .label { vertical-align: middle; } ::slotted([slot="icon"]), ::slotted([slot="selected-icon"]) { width: 1em; font-size: var(--m3e-nav-item-icon-size, 1.5rem) !important; } :host(:not([selected]):not(:disabled):not([disabled-interactive])) .outer { --m3e-state-layer-hover-color: var( --m3e-nav-item-inactive-hover-state-layer-color, ${b.color.onSecondaryContainer} ); --m3e-state-layer-focus-color: var( --m3e-nav-item-inactive-focus-state-layer-color, ${b.color.onSecondaryContainer} ); --m3e-ripple-color: var( --m3e-nav-item-inactive-pressed-state-layer-color, ${b.color.onSecondaryContainer} ); } :host(:not([selected]):not(:disabled):not([disabled-interactive])) .label { color: var(--m3e-nav-item-inactive-label-text-color, ${b.color.onSurfaceVariant}); } :host(:not([selected]):not(:disabled):not([disabled-interactive])) .icon { color: var(--m3e-nav-item-inactive-icon-color, ${b.color.onSecondaryContainer}); } :host([selected]:not(:disabled):not([disabled-interactive])) .outer { --m3e-state-layer-hover-color: var( --m3e-nav-item-active-hover-state-layer-color, ${b.color.onSecondaryContainer} ); --m3e-state-layer-focus-color: var( --m3e-nav-item-active-focus-state-layer-color, ${b.color.onSecondaryContainer} ); --m3e-ripple-color: var( --m3e-nav-item-active-pressed-state-layer-color, ${b.color.onSecondaryContainer} ); } :host([selected]:not(:disabled):not([disabled-interactive])) .label { color: var(--m3e-nav-item-active-label-text-color, ${b.color.secondary}); } :host([selected]:not(:disabled):not([disabled-interactive])) .state-layer { background-color: var(--m3e-nav-item-active-container-color, ${b.color.secondaryContainer}); } :host([selected]:not(:disabled):not([disabled-interactive])) .icon { color: var(--m3e-nav-item-active-icon-color, ${b.color.onSecondaryContainer}); } :host([orientation="vertical"]) .outer { align-self: stretch; align-items: flex-start; } :host([orientation="vertical"]) .label { text-align: center; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-clamp: 2; } :host([orientation="vertical"]) .base { flex-direction: column; row-gap: var(--m3e-nav-item-spacing, 0.25rem); } :host([orientation="vertical"]) .base { margin-block: var(--m3e-vertical-nav-item-active-indicator-margin, 0.375rem); } :host([orientation="vertical"]) .state-layer, :host([orientation="vertical"]) .ripple { top: var(--m3e-vertical-nav-item-active-indicator-margin, 0.375rem); bottom: unset; } :host([orientation="vertical"]) .state-layer, :host([orientation="vertical"]) .ripple, :host([orientation="vertical"]) .icon-wrapper { width: var(--m3e-vertical-nav-item-active-indicator-width, 3.5rem); } :host([orientation="vertical"]) .state-layer, :host([orientation="vertical"]) .ripple, :host([orientation="vertical"]) .icon-wrapper { height: var(--m3e-vertical-nav-item-active-indicator-height, 2rem); } :host([orientation="vertical"]) .icon { top: calc( calc(var(--m3e-vertical-nav-item-active-indicator-height, 2rem) / 2) - calc( var(--m3e-nav-item-icon-size, 1.5rem) / 2 ) ); left: calc( calc(var(--m3e-vertical-nav-item-active-indicator-width, 3.5rem) / 2) - calc( var(--m3e-nav-item-icon-size, 1.5rem) / 2 ) ); } :host([orientation="vertical"]) .focus-ring { border-radius: var(--m3e-nav-item-focus-ring-shape, ${b.shape.corner.medium}); } :host([orientation="horizontal"]) .icon-wrapper { width: var(--m3e-nav-item-icon-size, 1.5rem); height: var(--m3e-nav-item-icon-size, 1.5rem); } :host([orientation="horizontal"]) .base { padding: var(--m3e-horizontal-nav-item-padding, 1rem); } :host([orientation="horizontal"]) .label { flex: 1 1 auto; } :host([orientation="horizontal"]) .base { column-gap: var(--m3e-nav-item-spacing, 0.25rem); } :host([orientation="horizontal"]) .inner { height: var(--m3e-horizontal-nav-item-active-indicator-height, 2.5rem); width: fit-content; } .state-layer, .ripple { margin-inline: auto; } :host(:disabled) .label, :host([disabled-interactive]) .label { color: color-mix( in srgb, var(--m3e-nav-item-disabled-label-text-color, ${b.color.onSurface}) var(--m3e-nav-item-disabled-label-text-opacity, 38%), transparent ); } :host(:disabled) .icon, :host([disabled-interactive]) .icon { color: color-mix( in srgb, var(--m3e-nav-item-disabled-icon-color, ${b.color.onSurface}) var(--m3e-nav-item-disabled-icon-opacity, 38%), transparent ); } a { all: unset; display: block; position: absolute; top: 0px; left: 0px; right: 0px; bottom: 0px; z-index: 1; } @media (forced-colors: active) { :host(:disabled) .label, :host([disabled-interactive]) .label, :host(:disabled) .icon, :host([disabled-interactive]) .icon { color: GrayText; } :host(:not([selected]):not(:disabled):not([disabled-interactive])) .label, :host(:not([selected]):not(:disabled):not([disabled-interactive])) .icon { color: ButtonText; } :host([selected]:not(:disabled):not([disabled-interactive])) .state-layer { background-color: ButtonText; } :host([orientation="vertical"][selected]:not(:disabled):not([disabled-interactive])) .label { color: ButtonText; } :host([orientation="horizontal"][selected]:not(:disabled):not([disabled-interactive])) .label, :host([selected]:not(:disabled):not([disabled-interactive])) .icon { forced-color-adjust: none; color: ButtonFace; } }`,i([c(".focus-ring")],U.prototype,"_focusRing",void 0),i([c(".state-layer")],U.prototype,"_stateLayer",void 0),i([c(".ripple")],U.prototype,"_ripple",void 0),i([s({reflect:!0})],U.prototype,"orientation",void 0),U=i([p("m3e-nav-item")],U);export{M as M3eNavBarElement,U as M3eNavItemElement};
7
7
  //# sourceMappingURL=nav-bar.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"nav-bar.min.js","sources":["../../src/nav-bar/NavBarElement.ts","../../src/nav-bar/NavItemElement.ts"],"sourcesContent":["import { css, CSSResultGroup, html, LitElement, PropertyValues } from \"lit\";\r\nimport { property, state } from \"lit/decorators.js\";\r\n\r\nimport { AttachInternals, customElement, DesignToken, Role, setCustomState } from \"@m3e/web/core\";\r\n\r\nimport { SelectionManager, selectionManager } from \"@m3e/web/core/a11y\";\r\nimport { Breakpoint, M3eBreakpointObserver } from \"@m3e/web/core/layout\";\r\n\r\nimport { M3eNavItemElement } from \"./NavItemElement\";\r\nimport { NavItemOrientation } from \"./NavItemOrientation\";\r\nimport { NavBarMode } from \"./NavBarMode\";\r\n\r\n/**\r\n * A horizontal bar, typically used on smaller devices, that allows a user to switch between 3-5 views.\r\n *\r\n * @description\r\n * The `m3e-nav-bar` component provides a horizontal navigation bar for switching between primary destinations in\r\n * an application. Designed for smaller devices, it supports 3-5 interactive items, orientation, and theming\r\n * via CSS custom properties.\r\n *\r\n * @example\r\n * The following example illustrates a nav bar with vertically oriented items.\r\n * ```html\r\n * <m3e-nav-bar>\r\n * <m3e-nav-item><m3e-icon slot=\"icon\" name=\"news\"></m3e-icon>News</m3e-nav-item>\r\n * <m3e-nav-item><m3e-icon slot=\"icon\" name=\"globe\"></m3e-icon>Global</m3e-nav-item>\r\n * <m3e-nav-item><m3e-icon slot=\"icon\" name=\"star\"></m3e-icon>For you</m3e-nav-item>\r\n * <m3e-nav-item><m3e-icon slot=\"icon\" name=\"newsstand\"></m3e-icon>Trending</m3e-nav-item>\r\n * </m3e-nav-bar>\r\n * ```\r\n *\r\n * @tag m3e-nav-bar\r\n *\r\n * @slot - Renders the items of the bar.\r\n *\r\n * @attr mode - The mode in which items in the bar are presented.\r\n *\r\n * @fires change - Emitted when the selected state of an item changes.\r\n *\r\n * @cssprop --m3e-nav-bar-height - Height of the navigation bar.\r\n * @cssprop --m3e-nav-bar-container-color - Background color of the navigation bar container.\r\n * @cssprop --m3e-nav-bar-vertical-item-width - Minimum width of vertical nav items.\r\n */\r\n@customElement(\"m3e-nav-bar\")\r\nexport class M3eNavBarElement extends AttachInternals(Role(LitElement, \"navigation\")) {\r\n /** The styles of the element. */\r\n static override styles: CSSResultGroup = css`\r\n :host {\r\n display: block;\r\n overflow-x: auto;\r\n overflow-y: hidden;\r\n scrollbar-width: ${DesignToken.scrollbar.thinWidth};\r\n scrollbar-color: ${DesignToken.scrollbar.color};\r\n min-height: var(--m3e-nav-bar-height, 4rem);\r\n }\r\n .base {\r\n display: flex;\r\n align-items: stretch;\r\n justify-content: center;\r\n box-sizing: border-box;\r\n min-height: inherit;\r\n height: inherit;\r\n width: 100%;\r\n background-color: var(--m3e-nav-bar-container-color, ${DesignToken.color.surfaceContainer});\r\n --_nav-item-min-width: var(--m3e-nav-bar-vertical-item-width, 7rem);\r\n }\r\n `;\r\n\r\n /** @internal */ readonly [selectionManager] = new SelectionManager<M3eNavItemElement>().disableRovingTabIndex();\r\n /** @private */ #breakpointUnobserve?: () => void;\r\n /** @private */ @state() private _mode?: Exclude<NavBarMode, \"auto\">;\r\n\r\n /**\r\n * The mode in which items in the bar are presented.\r\n * @default \"compact\"\r\n */\r\n @property({ reflect: true }) mode: NavBarMode = \"compact\";\r\n\r\n /** The items of the bar. */\r\n get items(): readonly M3eNavItemElement[] {\r\n return this[selectionManager].items;\r\n }\r\n\r\n /** The selected item. */\r\n get selected(): M3eNavItemElement | null {\r\n return this[selectionManager].selectedItems[0] ?? null;\r\n }\r\n\r\n /** The current mode applied to the bar. */\r\n get currentMode(): Exclude<NavBarMode, \"auto\"> {\r\n return this._mode ?? (this.mode !== \"compact\" ? \"expanded\" : \"compact\");\r\n }\r\n set currentMode(value: Exclude<NavBarMode, \"auto\">) {\r\n this._mode = value;\r\n }\r\n\r\n /** @inheritdoc */\r\n override disconnectedCallback(): void {\r\n super.disconnectedCallback();\r\n\r\n this._mode = undefined;\r\n this.#breakpointUnobserve?.();\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override willUpdate(changedProperties: PropertyValues): void {\r\n super.willUpdate(changedProperties);\r\n\r\n if (changedProperties.has(\"mode\")) {\r\n this.#breakpointUnobserve?.();\r\n\r\n if (this.mode === \"auto\") {\r\n this.#breakpointUnobserve = M3eBreakpointObserver.observe([Breakpoint.XSmall, Breakpoint.Small], (matches) => {\r\n this._mode = matches.get(Breakpoint.XSmall) || matches.get(Breakpoint.Small) ? \"compact\" : \"expanded\";\r\n this._updateItems();\r\n });\r\n } else {\r\n this._mode = undefined;\r\n this._updateItems();\r\n }\r\n }\r\n if (changedProperties.has(\"_mode\")) {\r\n this._updateItems();\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override render(): unknown {\r\n return html`<div class=\"base\">\r\n <slot @change=\"${this.#handleChange}\" @slotchange=\"${this.#handleSlotChange}\"></slot>\r\n </div>`;\r\n }\r\n\r\n /** @private */\r\n #handleSlotChange(): void {\r\n this[selectionManager].setItems([...this.querySelectorAll(\"m3e-nav-item\")]);\r\n this._updateItems();\r\n }\r\n\r\n /** @private */\r\n #handleChange(e: Event): void {\r\n e.stopPropagation();\r\n this.dispatchEvent(new Event(\"change\", { bubbles: true }));\r\n }\r\n\r\n /** @internal */\r\n protected _updateItems(): void {\r\n const orientation: NavItemOrientation = this.currentMode === \"compact\" ? \"vertical\" : \"horizontal\";\r\n this._updateOrientation(orientation);\r\n setCustomState(this, \"-compact\", orientation === \"vertical\");\r\n }\r\n\r\n /** @internal */\r\n protected _updateOrientation(orientation: NavItemOrientation): void {\r\n this[selectionManager].items.forEach((x) => (x.orientation = orientation));\r\n }\r\n}\r\n\r\ndeclare global {\r\n interface HTMLElementTagNameMap {\r\n \"m3e-nav-bar\": M3eNavBarElement;\r\n }\r\n}\r\n","import { css, CSSResultGroup, html, LitElement, nothing, PropertyValues } from \"lit\";\r\nimport { property, query } from \"lit/decorators.js\";\r\n\r\nimport {\r\n AttachInternals,\r\n customElement,\r\n DesignToken,\r\n Disabled,\r\n DisabledInteractive,\r\n Focusable,\r\n KeyboardClick,\r\n LinkButton,\r\n M3eFocusRingElement,\r\n M3eRippleElement,\r\n M3eStateLayerElement,\r\n renderPseudoLink,\r\n Role,\r\n Selected,\r\n} from \"@m3e/web/core\";\r\n\r\nimport { selectionManager } from \"@m3e/web/core/a11y\";\r\n\r\nimport type { M3eNavBarElement } from \"./NavBarElement\";\r\nimport { NavItemOrientation } from \"./NavItemOrientation\";\r\n\r\n/**\r\n * An item, placed in a navigation bar or rail, used to navigate to destinations in an application.\r\n *\r\n * @description\r\n * The `m3e-nav-item` component represents an interactive navigation item for use in navigation bars\r\n * or rails. Designed according to Material 3 principles, it supports icon and label slots, selection state,\r\n * orientation, and extensive theming via CSS custom properties.\r\n *\r\n * @example\r\n * The following example illustrates a nav bar with vertically oriented items.\r\n * ```html\r\n * <m3e-nav-bar>\r\n * <m3e-nav-item><m3e-icon slot=\"icon\" name=\"news\"></m3e-icon>News</m3e-nav-item>\r\n * <m3e-nav-item><m3e-icon slot=\"icon\" name=\"globe\"></m3e-icon>Global</m3e-nav-item>\r\n * <m3e-nav-item><m3e-icon slot=\"icon\" name=\"star\"></m3e-icon>For you</m3e-nav-item>\r\n * <m3e-nav-item><m3e-icon slot=\"icon\" name=\"newsstand\"></m3e-icon>Trending</m3e-nav-item>\r\n * </m3e-nav-bar>\r\n * ```\r\n *\r\n * @tag m3e-nav-item\r\n *\r\n * @slot - Renders the label of the item.\r\n * @slot icon - Renders the icon of the item.\r\n * @slot selected-icon - Renders the icon of the item when selected.\r\n *\r\n * @attr disabled - A value indicating whether the element is disabled.\r\n * @attr disabled-interactive - A value indicating whether the element is disabled and interactive.\r\n * @attr download - A value indicating whether the `target` of the link button will be downloaded, optionally specifying the new name of the file.\r\n * @attr href - The URL to which the link button points.\r\n * @attr orientation - The layout orientation of the item.\r\n * @attr rel - The relationship between the `target` of the link button and the document.\r\n * @attr selected - A value indicating whether the element is selected.\r\n * @attr target - The target of the link button.\r\n *\r\n * @fires input - Emitted when the selected state changes.\r\n * @fires change - Emitted when the selected state changes.\r\n * @fires click - Emitted when the element is clicked.\r\n *\r\n * @cssprop --m3e-nav-item-label-text-font-size - Font size for the label text.\r\n * @cssprop --m3e-nav-item-label-text-font-weight - Font weight for the label text.\r\n * @cssprop --m3e-nav-item-label-text-line-height - Line height for the label text.\r\n * @cssprop --m3e-nav-item-label-text-tracking - Letter spacing for the label text.\r\n * @cssprop --m3e-nav-item-shape - Border radius of the nav item.\r\n * @cssprop --m3e-nav-item-icon-size - Size of the icon.\r\n * @cssprop --m3e-nav-item-spacing - Spacing between icon and label.\r\n * @cssprop --m3e-nav-item-inactive-label-text-color - Color of the label text when inactive.\r\n * @cssprop --m3e-nav-item-inactive-icon-color - Color of the icon when inactive.\r\n * @cssprop --m3e-nav-item-inactive-hover-state-layer-color - State layer color on hover when inactive.\r\n * @cssprop --m3e-nav-item-inactive-focus-state-layer-color - State layer color on focus when inactive.\r\n * @cssprop --m3e-nav-item-inactive-pressed-state-layer-color - State layer color on press when inactive.\r\n * @cssprop --m3e-nav-item-active-label-text-color - Color of the label text when active/selected.\r\n * @cssprop --m3e-nav-item-active-icon-color - Color of the icon when active/selected.\r\n * @cssprop --m3e-nav-item-active-container-color - Container color when active/selected.\r\n * @cssprop --m3e-nav-item-active-hover-state-layer-color - State layer color on hover when active.\r\n * @cssprop --m3e-nav-item-active-focus-state-layer-color - State layer color on focus when active.\r\n * @cssprop --m3e-nav-item-active-pressed-state-layer-color - State layer color on press when active.\r\n * @cssprop --m3e-nav-item-focus-ring-shape - Border radius for the focus ring.\r\n * @cssprop --m3e-nav-item-disabled-label-text-color - Color of the label text when disabled.\r\n * @cssprop --m3e-nav-item-disabled-label-text-opacity - Opacity of the label text when disabled.\r\n * @cssprop --m3e-nav-item-disabled-icon-color - Color of the icon when disabled.\r\n * @cssprop --m3e-nav-item-disabled-icon-opacity - Opacity of the icon when disabled.\r\n * @cssprop --m3e-horizontal-nav-item-padding - Padding for horizontal orientation.\r\n * @cssprop --m3e-horizontal-nav-item-active-indicator-height - Height of the active indicator in horizontal orientation.\r\n * @cssprop --m3e-vertical-nav-item-active-indicator-width - Width of the active indicator in vertical orientation.\r\n * @cssprop --m3e-vertical-nav-item-active-indicator-height - Height of the active indicator in vertical orientation.\r\n * @cssprop --m3e-vertical-nav-item-active-indicator-margin - Margin for the active indicator in vertical orientation.\r\n */\r\n@customElement(\"m3e-nav-item\")\r\nexport class M3eNavItemElement extends LinkButton(\r\n Selected(KeyboardClick(Focusable(DisabledInteractive(Disabled(AttachInternals(Role(LitElement, \"button\"), true)))))),\r\n) {\r\n /** The styles of the element. */\r\n static override styles: CSSResultGroup = css`\r\n :host {\r\n display: inline-block;\r\n vertical-align: middle;\r\n position: relative;\r\n outline: none;\r\n user-select: none;\r\n flex: 1;\r\n font-size: var(--m3e-nav-item-label-text-font-size, ${DesignToken.typescale.standard.label.medium.fontSize});\r\n font-weight: var(\r\n --m3e-nav-item-label-text-font-weight,\r\n ${DesignToken.typescale.standard.label.medium.fontWeight}\r\n );\r\n line-height: var(\r\n --m3e-nav-item-label-text-line-height,\r\n ${DesignToken.typescale.standard.label.medium.lineHeight}\r\n );\r\n letter-spacing: var(--m3e-nav-item-label-text-tracking, ${DesignToken.typescale.standard.label.medium.tracking});\r\n border-radius: var(--m3e-nav-item-shape, ${DesignToken.shape.corner.full});\r\n min-width: var(--_nav-item-min-width);\r\n align-self: var(--_nav-item-align-self);\r\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\r\n }\r\n :host([orientation=\"horizontal\"]) {\r\n max-width: fit-content;\r\n }\r\n :host(:not(:disabled):not([disabled-interactive])) {\r\n cursor: pointer;\r\n }\r\n :host([disabled-interactive]) {\r\n cursor: not-allowed;\r\n }\r\n .outer {\r\n height: 100%;\r\n }\r\n .outer,\r\n .inner {\r\n display: flex;\r\n align-items: center;\r\n justify-content: var(--_nav-item-justify-content, center);\r\n position: relative;\r\n border-radius: inherit;\r\n }\r\n .icon-wrapper {\r\n position: relative;\r\n flex: none;\r\n }\r\n .base {\r\n justify-content: unset;\r\n box-sizing: border-box;\r\n vertical-align: middle;\r\n display: inline-flex;\r\n align-items: center;\r\n justify-content: center;\r\n position: relative;\r\n width: 100%;\r\n }\r\n .icon {\r\n position: absolute;\r\n }\r\n .label {\r\n vertical-align: middle;\r\n }\r\n ::slotted([slot=\"icon\"]),\r\n ::slotted([slot=\"selected-icon\"]) {\r\n width: 1em;\r\n font-size: var(--m3e-nav-item-icon-size, 1.5rem) !important;\r\n }\r\n :host(:not([selected]):not(:disabled):not([disabled-interactive])) .outer {\r\n --m3e-state-layer-hover-color: var(\r\n --m3e-nav-item-inactive-hover-state-layer-color,\r\n ${DesignToken.color.onSecondaryContainer}\r\n );\r\n --m3e-state-layer-focus-color: var(\r\n --m3e-nav-item-inactive-focus-state-layer-color,\r\n ${DesignToken.color.onSecondaryContainer}\r\n );\r\n --m3e-ripple-color: var(\r\n --m3e-nav-item-inactive-pressed-state-layer-color,\r\n ${DesignToken.color.onSecondaryContainer}\r\n );\r\n }\r\n :host(:not([selected]):not(:disabled):not([disabled-interactive])) .label {\r\n color: var(--m3e-nav-item-inactive-label-text-color, ${DesignToken.color.onSurfaceVariant});\r\n }\r\n :host(:not([selected]):not(:disabled):not([disabled-interactive])) .icon {\r\n color: var(--m3e-nav-item-inactive-icon-color, ${DesignToken.color.onSecondaryContainer});\r\n }\r\n :host([selected]:not(:disabled):not([disabled-interactive])) .outer {\r\n --m3e-state-layer-hover-color: var(\r\n --m3e-nav-item-active-hover-state-layer-color,\r\n ${DesignToken.color.onSecondaryContainer}\r\n );\r\n --m3e-state-layer-focus-color: var(\r\n --m3e-nav-item-active-focus-state-layer-color,\r\n ${DesignToken.color.onSecondaryContainer}\r\n );\r\n --m3e-ripple-color: var(\r\n --m3e-nav-item-active-pressed-state-layer-color,\r\n ${DesignToken.color.onSecondaryContainer}\r\n );\r\n }\r\n :host([selected]:not(:disabled):not([disabled-interactive])) .label {\r\n color: var(--m3e-nav-item-active-label-text-color, ${DesignToken.color.secondary});\r\n }\r\n :host([selected]:not(:disabled):not([disabled-interactive])) .state-layer {\r\n background-color: var(--m3e-nav-item-active-container-color, ${DesignToken.color.secondaryContainer});\r\n }\r\n :host([selected]:not(:disabled):not([disabled-interactive])) .icon {\r\n color: var(--m3e-nav-item-active-icon-color, ${DesignToken.color.onSecondaryContainer});\r\n }\r\n :host([orientation=\"vertical\"]) .outer {\r\n align-self: stretch;\r\n align-items: flex-start;\r\n }\r\n :host([orientation=\"vertical\"]) .label {\r\n text-align: center;\r\n display: -webkit-box;\r\n -webkit-line-clamp: 2;\r\n -webkit-box-orient: vertical;\r\n overflow: hidden;\r\n line-clamp: 2;\r\n }\r\n :host([orientation=\"vertical\"]) .base {\r\n flex-direction: column;\r\n row-gap: var(--m3e-nav-item-spacing, 0.25rem);\r\n }\r\n :host([orientation=\"vertical\"]) .base {\r\n margin-block: var(--m3e-vertical-nav-item-active-indicator-margin, 0.375rem);\r\n }\r\n :host([orientation=\"vertical\"]) .state-layer,\r\n :host([orientation=\"vertical\"]) .ripple {\r\n top: var(--m3e-vertical-nav-item-active-indicator-margin, 0.375rem);\r\n bottom: unset;\r\n }\r\n :host([orientation=\"vertical\"]) .state-layer,\r\n :host([orientation=\"vertical\"]) .ripple,\r\n :host([orientation=\"vertical\"]) .icon-wrapper {\r\n width: var(--m3e-vertical-nav-item-active-indicator-width, 3.5rem);\r\n }\r\n :host([orientation=\"vertical\"]) .state-layer,\r\n :host([orientation=\"vertical\"]) .ripple,\r\n :host([orientation=\"vertical\"]) .icon-wrapper {\r\n height: var(--m3e-vertical-nav-item-active-indicator-height, 2rem);\r\n }\r\n :host([orientation=\"vertical\"]) .icon {\r\n top: calc(\r\n calc(var(--m3e-vertical-nav-item-active-indicator-height, 2rem) / 2) - calc(\r\n var(--m3e-nav-item-icon-size, 1.5rem) / 2\r\n )\r\n );\r\n left: calc(\r\n calc(var(--m3e-vertical-nav-item-active-indicator-width, 3.5rem) / 2) - calc(\r\n var(--m3e-nav-item-icon-size, 1.5rem) / 2\r\n )\r\n );\r\n }\r\n :host([orientation=\"vertical\"]) .focus-ring {\r\n border-radius: var(--m3e-nav-item-focus-ring-shape, ${DesignToken.shape.corner.medium});\r\n }\r\n :host([orientation=\"horizontal\"]) .icon-wrapper {\r\n width: var(--m3e-nav-item-icon-size, 1.5rem);\r\n height: var(--m3e-nav-item-icon-size, 1.5rem);\r\n }\r\n :host([orientation=\"horizontal\"]) .base {\r\n padding: var(--m3e-horizontal-nav-item-padding, 1rem);\r\n }\r\n :host([orientation=\"horizontal\"]) .label {\r\n flex: 1 1 auto;\r\n }\r\n :host([orientation=\"horizontal\"]) .base {\r\n column-gap: var(--m3e-nav-item-spacing, 0.25rem);\r\n }\r\n :host([orientation=\"horizontal\"]) .inner {\r\n height: var(--m3e-horizontal-nav-item-active-indicator-height, 2.5rem);\r\n width: fit-content;\r\n }\r\n .state-layer,\r\n .ripple {\r\n margin-inline: auto;\r\n }\r\n :host(:disabled) .label,\r\n :host([disabled-interactive]) .label {\r\n color: color-mix(\r\n in srgb,\r\n var(--m3e-nav-item-disabled-label-text-color, ${DesignToken.color.onSurface})\r\n var(--m3e-nav-item-disabled-label-text-opacity, 38%),\r\n transparent\r\n );\r\n }\r\n :host(:disabled) .icon,\r\n :host([disabled-interactive]) .icon {\r\n color: color-mix(\r\n in srgb,\r\n var(--m3e-nav-item-disabled-icon-color, ${DesignToken.color.onSurface})\r\n var(--m3e-nav-item-disabled-icon-opacity, 38%),\r\n transparent\r\n );\r\n }\r\n a {\r\n all: unset;\r\n display: block;\r\n position: absolute;\r\n top: 0px;\r\n left: 0px;\r\n right: 0px;\r\n bottom: 0px;\r\n z-index: 1;\r\n }\r\n @media (forced-colors: active) {\r\n :host(:disabled) .label,\r\n :host([disabled-interactive]) .label,\r\n :host(:disabled) .icon,\r\n :host([disabled-interactive]) .icon {\r\n color: GrayText;\r\n }\r\n :host(:not([selected]):not(:disabled):not([disabled-interactive])) .label,\r\n :host(:not([selected]):not(:disabled):not([disabled-interactive])) .icon {\r\n color: ButtonText;\r\n }\r\n :host([selected]:not(:disabled):not([disabled-interactive])) .state-layer {\r\n background-color: ButtonText;\r\n }\r\n :host([orientation=\"vertical\"][selected]:not(:disabled):not([disabled-interactive])) .label {\r\n color: ButtonText;\r\n }\r\n :host([orientation=\"horizontal\"][selected]:not(:disabled):not([disabled-interactive])) .label,\r\n :host([selected]:not(:disabled):not([disabled-interactive])) .icon {\r\n forced-color-adjust: none;\r\n color: ButtonFace;\r\n }\r\n }\r\n `;\r\n\r\n /** @private */ readonly #clickHandler = (e: Event) => this.#handleClick(e);\r\n /** @private */ @query(\".focus-ring\") private readonly _focusRing?: M3eFocusRingElement;\r\n /** @private */ @query(\".state-layer\") private readonly _stateLayer?: M3eStateLayerElement;\r\n /** @private */ @query(\".ripple\") private readonly _ripple?: M3eRippleElement;\r\n\r\n /**\r\n * The layout orientation of the item.\r\n * @default \"vertical\"\r\n */\r\n @property({ reflect: true }) orientation: NavItemOrientation = \"vertical\";\r\n\r\n /** The navigation bar to which this item belongs. */\r\n get navBar(): M3eNavBarElement | null {\r\n return this.closest(\"m3e-nav-bar\") ?? this.closest(\"m3e-nav-rail\") ?? null;\r\n }\r\n\r\n /** @inheritdoc */\r\n override connectedCallback(): void {\r\n super.connectedCallback();\r\n this.addEventListener(\"click\", this.#clickHandler, { capture: true });\r\n }\r\n\r\n /** @inheritdoc */\r\n override disconnectedCallback(): void {\r\n super.disconnectedCallback();\r\n this.removeEventListener(\"click\", this.#clickHandler, { capture: true });\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override update(changedProperties: PropertyValues<this>): void {\r\n super.update(changedProperties);\r\n\r\n if (changedProperties.has(\"selected\")) {\r\n this.ariaSelected = null;\r\n this.ariaPressed = null;\r\n this.ariaCurrent = `${this.selected}`;\r\n for (const icon of this.querySelectorAll(\"m3e-icon\")) {\r\n icon.toggleAttribute(\"filled\", this.selected);\r\n }\r\n this.navBar?.[selectionManager].notifySelectionChange(this);\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override updated(_changedProperties: PropertyValues<this>): void {\r\n super.updated(_changedProperties);\r\n\r\n if (_changedProperties.has(\"orientation\")) {\r\n this._focusRing?.attach(this);\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override firstUpdated(_changedProperties: PropertyValues<this>): void {\r\n super.firstUpdated(_changedProperties);\r\n [this._focusRing, this._stateLayer, this._ripple].forEach((x) => x?.attach(this));\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override render(): unknown {\r\n const disabled = this.disabled || this.disabledInteractive;\r\n return html`${this.orientation === \"vertical\"\r\n ? html`<m3e-focus-ring class=\"focus-ring\" inward></m3e-focus-ring>`\r\n : nothing}\r\n <div class=\"outer\">\r\n ${this[renderPseudoLink]()}\r\n <div class=\"inner\">\r\n ${this.orientation === \"horizontal\" ? html`<m3e-focus-ring class=\"focus-ring\"></m3e-focus-ring>` : nothing}\r\n <m3e-state-layer class=\"state-layer\" ?disabled=\"${disabled}\"></m3e-state-layer>\r\n <m3e-ripple class=\"ripple\" centered ?disabled=\"${disabled}\"></m3e-ripple>\r\n <div class=\"touch\" aria-hidden=\"true\"></div>\r\n <div class=\"base\">\r\n <div class=\"icon-wrapper\" aria-hidden=\"true\">\r\n <div class=\"icon\">\r\n <slot name=\"icon\" aria-hidden=\"true\"></slot>\r\n </div>\r\n </div>\r\n <div class=\"label\">\r\n <slot></slot>\r\n </div>\r\n </div>\r\n </div>\r\n </div>`;\r\n }\r\n\r\n /** @private */\r\n #handleClick(e: Event): void {\r\n if (e.defaultPrevented) return;\r\n\r\n this.selected = true;\r\n if (this.dispatchEvent(new Event(\"input\", { bubbles: true, composed: true, cancelable: true }))) {\r\n this.navBar?.[selectionManager].notifySelectionChange(this);\r\n this.dispatchEvent(new Event(\"change\", { bubbles: true }));\r\n } else {\r\n this.selected = false;\r\n }\r\n }\r\n}\r\n\r\ndeclare global {\r\n interface HTMLElementTagNameMap {\r\n \"m3e-nav-item\": M3eNavItemElement;\r\n }\r\n}\r\n"],"names":["M3eNavBarElement","AttachInternals","Role","LitElement","constructor","this","SelectionManager","disableRovingTabIndex","_M3eNavBarElement_breakpointUnobserve","set","mode","items","selectionManager","selected","selectedItems","currentMode","_mode","value","disconnectedCallback","super","undefined","__classPrivateFieldGet","call","willUpdate","changedProperties","has","__classPrivateFieldSet","M3eBreakpointObserver","observe","Breakpoint","XSmall","Small","matches","get","_updateItems","render","html","_M3eNavBarElement_instances","_M3eNavBarElement_handleChange","_M3eNavBarElement_handleSlotChange","orientation","_updateOrientation","setCustomState","forEach","x","setItems","querySelectorAll","e","stopPropagation","dispatchEvent","Event","bubbles","styles","css","DesignToken","scrollbar","thinWidth","color","surfaceContainer","__decorate","state","prototype","property","reflect","customElement","M3eNavItemElement","LinkButton","Selected","KeyboardClick","Focusable","DisabledInteractive","Disabled","_M3eNavItemElement_clickHandler","navBar","closest","connectedCallback","addEventListener","capture","removeEventListener","update","ariaSelected","ariaPressed","ariaCurrent","icon","toggleAttribute","notifySelectionChange","updated","_changedProperties","_focusRing","attach","firstUpdated","_stateLayer","_ripple","disabled","disabledInteractive","nothing","renderPseudoLink","defaultPrevented","composed","cancelable","typescale","standard","label","medium","fontSize","fontWeight","lineHeight","tracking","shape","corner","full","onSecondaryContainer","onSurfaceVariant","secondary","secondaryContainer","onSurface","query"],"mappings":";;;;;qnBA4CO,IAAMA,EAAN,cAA+BC,EAAgBC,EAAKC,EAAY,gBAAhEC,WAAAA,mCAwBqBC,SAAqB,IAAIC,GAAsCC,wBACzEC,EAAAC,IAAAJ,aAOaA,KAAAK,KAAmB,SAgFlD,CA7EE,SAAIC,GACF,OAAON,KAAKO,GAAkBD,KAChC,CAGA,YAAIE,GACF,OAAOR,KAAKO,GAAkBE,cAAc,IAAM,IACpD,CAGA,eAAIC,GACF,OAAOV,KAAKW,QAAwB,YAAdX,KAAKK,KAAqB,WAAa,UAC/D,CACA,eAAIK,CAAYE,GACdZ,KAAKW,MAAQC,CACf,CAGSC,oBAAAA,GACPC,MAAMD,uBAENb,KAAKW,WAAQI,EACbC,EAAAhB,KAAIG,EAAA,MAAuBc,KAA3BjB,KACF,CAGmBkB,UAAAA,CAAWC,GAC5BL,MAAMI,WAAWC,GAEbA,EAAkBC,IAAI,UACxBJ,EAAAhB,KAAIG,EAAA,MAAuBc,KAA3BjB,MAEkB,SAAdA,KAAKK,KACPgB,EAAArB,KAAIG,EAAwBmB,EAAsBC,QAAQ,CAACC,EAAWC,OAAQD,EAAWE,OAASC,IAChG3B,KAAKW,MAAQgB,EAAQC,IAAIJ,EAAWC,SAAWE,EAAQC,IAAIJ,EAAWE,OAAS,UAAY,WAC3F1B,KAAK6B,uBAGP7B,KAAKW,WAAQI,EACbf,KAAK6B,iBAGLV,EAAkBC,IAAI,UACxBpB,KAAK6B,cAET,CAGmBC,MAAAA,GACjB,OAAOC,CAAI,oCACQf,EAAAhB,KAAIgC,EAAA,IAAAC,oBAAgCjB,EAAAhB,KAAIgC,EAAA,IAAAE,mBAE7D,CAeUL,YAAAA,GACR,MAAMM,EAAuD,YAArBnC,KAAKU,YAA4B,WAAa,aACtFV,KAAK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AAMsD,gHAIlBzD,EAAYG,MAAMsD,uGAIlBzD,EAAYG,MAAMsD,8JAIiCzD,EAAYG,MAAMuD,kJAGxB1D,EAAYG,MAAMsD,qLAK/DzD,EAAYG,MAAMsD,8GAIlBzD,EAAYG,MAAMsD,qGAIlBzD,EAAYG,MAAMsD,sJAI+BzD,EAAYG,MAAMwD,0JAGR3D,EAAYG,MAAMyD,4IAGlC5D,EAAYG,MAAMsD,6+CAiDXzD,EAAYsD,MAAMC,OAAON,8tBA2B7BjD,EAAYG,MAAM0D,sNASxB7D,EAAYG,MAAM0D,+8BAyCXxD,EAAA,CAAtCyD,EAAM,gBAAiEnD,EAAAJ,UAAA,qBAChCF,EAAA,CAAvCyD,EAAM,iBAAoEnD,EAAAJ,UAAA,sBACxCF,EAAA,CAAlCyD,EAAM,YAAuDnD,EAAAJ,UAAA,kBAMjDF,EAAA,CAA5BG,EAAS,CAAEC,SAAS,KAAqDE,EAAAJ,UAAA,mBAAA,GAvP/DI,EAAiBN,EAAA,CAD7BK,EAAc,iBACFC"}
1
+ {"version":3,"file":"nav-bar.min.js","sources":["../../src/nav-bar/NavBarElement.ts","../../src/nav-bar/NavItemElement.ts"],"sourcesContent":["import { css, CSSResultGroup, html, LitElement, PropertyValues } from \"lit\";\r\nimport { property, state } from \"lit/decorators.js\";\r\n\r\nimport { AttachInternals, customElement, DesignToken, ReconnectedCallback, Role, setCustomState } from \"@m3e/web/core\";\r\n\r\nimport { SelectionManager, selectionManager } from \"@m3e/web/core/a11y\";\r\nimport { Breakpoint, M3eBreakpointObserver } from \"@m3e/web/core/layout\";\r\n\r\nimport { M3eNavItemElement } from \"./NavItemElement\";\r\nimport { NavItemOrientation } from \"./NavItemOrientation\";\r\nimport { NavBarMode } from \"./NavBarMode\";\r\n\r\n/**\r\n * A horizontal bar, typically used on smaller devices, that allows a user to switch between 3-5 views.\r\n *\r\n * @description\r\n * The `m3e-nav-bar` component provides a horizontal navigation bar for switching between primary destinations in\r\n * an application. Designed for smaller devices, it supports 3-5 interactive items, orientation, and theming\r\n * via CSS custom properties.\r\n *\r\n * @example\r\n * The following example illustrates a nav bar with vertically oriented items.\r\n * ```html\r\n * <m3e-nav-bar>\r\n * <m3e-nav-item><m3e-icon slot=\"icon\" name=\"news\"></m3e-icon>News</m3e-nav-item>\r\n * <m3e-nav-item><m3e-icon slot=\"icon\" name=\"globe\"></m3e-icon>Global</m3e-nav-item>\r\n * <m3e-nav-item><m3e-icon slot=\"icon\" name=\"star\"></m3e-icon>For you</m3e-nav-item>\r\n * <m3e-nav-item><m3e-icon slot=\"icon\" name=\"newsstand\"></m3e-icon>Trending</m3e-nav-item>\r\n * </m3e-nav-bar>\r\n * ```\r\n *\r\n * @tag m3e-nav-bar\r\n *\r\n * @slot - Renders the items of the bar.\r\n *\r\n * @attr mode - The mode in which items in the bar are presented.\r\n *\r\n * @fires change - Emitted when the selected state of an item changes.\r\n *\r\n * @cssprop --m3e-nav-bar-height - Height of the navigation bar.\r\n * @cssprop --m3e-nav-bar-container-color - Background color of the navigation bar container.\r\n * @cssprop --m3e-nav-bar-vertical-item-width - Minimum width of vertical nav items.\r\n */\r\n@customElement(\"m3e-nav-bar\")\r\nexport class M3eNavBarElement extends ReconnectedCallback(AttachInternals(Role(LitElement, \"navigation\"))) {\r\n /** The styles of the element. */\r\n static override styles: CSSResultGroup = css`\r\n :host {\r\n display: block;\r\n overflow-x: auto;\r\n overflow-y: hidden;\r\n scrollbar-width: ${DesignToken.scrollbar.thinWidth};\r\n scrollbar-color: ${DesignToken.scrollbar.color};\r\n min-height: var(--m3e-nav-bar-height, 4rem);\r\n }\r\n .base {\r\n display: flex;\r\n align-items: stretch;\r\n justify-content: center;\r\n box-sizing: border-box;\r\n min-height: inherit;\r\n height: inherit;\r\n width: 100%;\r\n background-color: var(--m3e-nav-bar-container-color, ${DesignToken.color.surfaceContainer});\r\n --_nav-item-min-width: var(--m3e-nav-bar-vertical-item-width, 7rem);\r\n }\r\n `;\r\n\r\n /** @internal */ readonly [selectionManager] = new SelectionManager<M3eNavItemElement>().disableRovingTabIndex();\r\n /** @private */ #breakpointUnobserve?: () => void;\r\n /** @private */ @state() private _mode?: Exclude<NavBarMode, \"auto\">;\r\n\r\n /**\r\n * The mode in which items in the bar are presented.\r\n * @default \"compact\"\r\n */\r\n @property({ reflect: true }) mode: NavBarMode = \"compact\";\r\n\r\n /** The items of the bar. */\r\n get items(): readonly M3eNavItemElement[] {\r\n return this[selectionManager].items;\r\n }\r\n\r\n /** The selected item. */\r\n get selected(): M3eNavItemElement | null {\r\n return this[selectionManager].selectedItems[0] ?? null;\r\n }\r\n\r\n /** The current mode applied to the bar. */\r\n get currentMode(): Exclude<NavBarMode, \"auto\"> {\r\n return this._mode ?? (this.mode !== \"compact\" ? \"expanded\" : \"compact\");\r\n }\r\n set currentMode(value: Exclude<NavBarMode, \"auto\">) {\r\n this._mode = value;\r\n }\r\n\r\n /** @inheritdoc */\r\n override disconnectedCallback(): void {\r\n super.disconnectedCallback();\r\n\r\n this._mode = undefined;\r\n this.#breakpointUnobserve?.();\r\n }\r\n\r\n /** @inheritdoc */\r\n override reconnectedCallback(): void {\r\n super.reconnectedCallback();\r\n\r\n if (this.mode === \"auto\") {\r\n this.#initBreakpointMonitoring();\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override willUpdate(changedProperties: PropertyValues): void {\r\n super.willUpdate(changedProperties);\r\n\r\n if (changedProperties.has(\"mode\")) {\r\n this.#breakpointUnobserve?.();\r\n\r\n if (this.mode === \"auto\") {\r\n this.#initBreakpointMonitoring();\r\n } else {\r\n this._mode = undefined;\r\n this._updateItems();\r\n }\r\n }\r\n if (changedProperties.has(\"_mode\")) {\r\n this._updateItems();\r\n }\r\n }\r\n\r\n /** @private */\r\n #initBreakpointMonitoring(): void {\r\n this.#breakpointUnobserve = M3eBreakpointObserver.observe([Breakpoint.XSmall, Breakpoint.Small], (matches) => {\r\n this._mode = matches.get(Breakpoint.XSmall) || matches.get(Breakpoint.Small) ? \"compact\" : \"expanded\";\r\n this._updateItems();\r\n });\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override render(): unknown {\r\n return html`<div class=\"base\">\r\n <slot @change=\"${this.#handleChange}\" @slotchange=\"${this.#handleSlotChange}\"></slot>\r\n </div>`;\r\n }\r\n\r\n /** @private */\r\n #handleSlotChange(): void {\r\n this[selectionManager].setItems([...this.querySelectorAll(\"m3e-nav-item\")]);\r\n this._updateItems();\r\n }\r\n\r\n /** @private */\r\n #handleChange(e: Event): void {\r\n e.stopPropagation();\r\n this.dispatchEvent(new Event(\"change\", { bubbles: true }));\r\n }\r\n\r\n /** @internal */\r\n protected _updateItems(): void {\r\n const orientation: NavItemOrientation = this.currentMode === \"compact\" ? \"vertical\" : \"horizontal\";\r\n this._updateOrientation(orientation);\r\n setCustomState(this, \"-compact\", orientation === \"vertical\");\r\n }\r\n\r\n /** @internal */\r\n protected _updateOrientation(orientation: NavItemOrientation): void {\r\n this[selectionManager].items.forEach((x) => (x.orientation = orientation));\r\n }\r\n}\r\n\r\ndeclare global {\r\n interface HTMLElementTagNameMap {\r\n \"m3e-nav-bar\": M3eNavBarElement;\r\n }\r\n}\r\n","import { css, CSSResultGroup, html, LitElement, nothing, PropertyValues } from \"lit\";\r\nimport { property, query } from \"lit/decorators.js\";\r\n\r\nimport {\r\n AttachInternals,\r\n customElement,\r\n DesignToken,\r\n Disabled,\r\n DisabledInteractive,\r\n Focusable,\r\n KeyboardClick,\r\n LinkButton,\r\n M3eFocusRingElement,\r\n M3eRippleElement,\r\n M3eStateLayerElement,\r\n renderPseudoLink,\r\n Role,\r\n Selected,\r\n} from \"@m3e/web/core\";\r\n\r\nimport { selectionManager } from \"@m3e/web/core/a11y\";\r\n\r\nimport type { M3eNavBarElement } from \"./NavBarElement\";\r\nimport { NavItemOrientation } from \"./NavItemOrientation\";\r\n\r\n/**\r\n * An item, placed in a navigation bar or rail, used to navigate to destinations in an application.\r\n *\r\n * @description\r\n * The `m3e-nav-item` component represents an interactive navigation item for use in navigation bars\r\n * or rails. Designed according to Material 3 principles, it supports icon and label slots, selection state,\r\n * orientation, and extensive theming via CSS custom properties.\r\n *\r\n * @example\r\n * The following example illustrates a nav bar with vertically oriented items.\r\n * ```html\r\n * <m3e-nav-bar>\r\n * <m3e-nav-item><m3e-icon slot=\"icon\" name=\"news\"></m3e-icon>News</m3e-nav-item>\r\n * <m3e-nav-item><m3e-icon slot=\"icon\" name=\"globe\"></m3e-icon>Global</m3e-nav-item>\r\n * <m3e-nav-item><m3e-icon slot=\"icon\" name=\"star\"></m3e-icon>For you</m3e-nav-item>\r\n * <m3e-nav-item><m3e-icon slot=\"icon\" name=\"newsstand\"></m3e-icon>Trending</m3e-nav-item>\r\n * </m3e-nav-bar>\r\n * ```\r\n *\r\n * @tag m3e-nav-item\r\n *\r\n * @slot - Renders the label of the item.\r\n * @slot icon - Renders the icon of the item.\r\n * @slot selected-icon - Renders the icon of the item when selected.\r\n *\r\n * @attr disabled - A value indicating whether the element is disabled.\r\n * @attr disabled-interactive - A value indicating whether the element is disabled and interactive.\r\n * @attr download - A value indicating whether the `target` of the link button will be downloaded, optionally specifying the new name of the file.\r\n * @attr href - The URL to which the link button points.\r\n * @attr orientation - The layout orientation of the item.\r\n * @attr rel - The relationship between the `target` of the link button and the document.\r\n * @attr selected - A value indicating whether the element is selected.\r\n * @attr target - The target of the link button.\r\n *\r\n * @fires input - Emitted when the selected state changes.\r\n * @fires change - Emitted when the selected state changes.\r\n * @fires click - Emitted when the element is clicked.\r\n *\r\n * @cssprop --m3e-nav-item-label-text-font-size - Font size for the label text.\r\n * @cssprop --m3e-nav-item-label-text-font-weight - Font weight for the label text.\r\n * @cssprop --m3e-nav-item-label-text-line-height - Line height for the label text.\r\n * @cssprop --m3e-nav-item-label-text-tracking - Letter spacing for the label text.\r\n * @cssprop --m3e-nav-item-shape - Border radius of the nav item.\r\n * @cssprop --m3e-nav-item-icon-size - Size of the icon.\r\n * @cssprop --m3e-nav-item-spacing - Spacing between icon and label.\r\n * @cssprop --m3e-nav-item-inactive-label-text-color - Color of the label text when inactive.\r\n * @cssprop --m3e-nav-item-inactive-icon-color - Color of the icon when inactive.\r\n * @cssprop --m3e-nav-item-inactive-hover-state-layer-color - State layer color on hover when inactive.\r\n * @cssprop --m3e-nav-item-inactive-focus-state-layer-color - State layer color on focus when inactive.\r\n * @cssprop --m3e-nav-item-inactive-pressed-state-layer-color - State layer color on press when inactive.\r\n * @cssprop --m3e-nav-item-active-label-text-color - Color of the label text when active/selected.\r\n * @cssprop --m3e-nav-item-active-icon-color - Color of the icon when active/selected.\r\n * @cssprop --m3e-nav-item-active-container-color - Container color when active/selected.\r\n * @cssprop --m3e-nav-item-active-hover-state-layer-color - State layer color on hover when active.\r\n * @cssprop --m3e-nav-item-active-focus-state-layer-color - State layer color on focus when active.\r\n * @cssprop --m3e-nav-item-active-pressed-state-layer-color - State layer color on press when active.\r\n * @cssprop --m3e-nav-item-focus-ring-shape - Border radius for the focus ring.\r\n * @cssprop --m3e-nav-item-disabled-label-text-color - Color of the label text when disabled.\r\n * @cssprop --m3e-nav-item-disabled-label-text-opacity - Opacity of the label text when disabled.\r\n * @cssprop --m3e-nav-item-disabled-icon-color - Color of the icon when disabled.\r\n * @cssprop --m3e-nav-item-disabled-icon-opacity - Opacity of the icon when disabled.\r\n * @cssprop --m3e-horizontal-nav-item-padding - Padding for horizontal orientation.\r\n * @cssprop --m3e-horizontal-nav-item-active-indicator-height - Height of the active indicator in horizontal orientation.\r\n * @cssprop --m3e-vertical-nav-item-active-indicator-width - Width of the active indicator in vertical orientation.\r\n * @cssprop --m3e-vertical-nav-item-active-indicator-height - Height of the active indicator in vertical orientation.\r\n * @cssprop --m3e-vertical-nav-item-active-indicator-margin - Margin for the active indicator in vertical orientation.\r\n */\r\n@customElement(\"m3e-nav-item\")\r\nexport class M3eNavItemElement extends LinkButton(\r\n Selected(KeyboardClick(Focusable(DisabledInteractive(Disabled(AttachInternals(Role(LitElement, \"button\"), true)))))),\r\n) {\r\n /** The styles of the element. */\r\n static override styles: CSSResultGroup = css`\r\n :host {\r\n display: inline-block;\r\n vertical-align: middle;\r\n position: relative;\r\n outline: none;\r\n user-select: none;\r\n flex: 1;\r\n font-size: var(--m3e-nav-item-label-text-font-size, ${DesignToken.typescale.standard.label.medium.fontSize});\r\n font-weight: var(\r\n --m3e-nav-item-label-text-font-weight,\r\n ${DesignToken.typescale.standard.label.medium.fontWeight}\r\n );\r\n line-height: var(\r\n --m3e-nav-item-label-text-line-height,\r\n ${DesignToken.typescale.standard.label.medium.lineHeight}\r\n );\r\n letter-spacing: var(--m3e-nav-item-label-text-tracking, ${DesignToken.typescale.standard.label.medium.tracking});\r\n border-radius: var(--m3e-nav-item-shape, ${DesignToken.shape.corner.full});\r\n min-width: var(--_nav-item-min-width);\r\n align-self: var(--_nav-item-align-self);\r\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\r\n }\r\n :host([orientation=\"horizontal\"]) {\r\n max-width: fit-content;\r\n }\r\n :host(:not(:disabled):not([disabled-interactive])) {\r\n cursor: pointer;\r\n }\r\n :host([disabled-interactive]) {\r\n cursor: not-allowed;\r\n }\r\n .outer {\r\n height: 100%;\r\n }\r\n .outer,\r\n .inner {\r\n display: flex;\r\n align-items: center;\r\n justify-content: var(--_nav-item-justify-content, center);\r\n position: relative;\r\n border-radius: inherit;\r\n }\r\n .icon-wrapper {\r\n position: relative;\r\n flex: none;\r\n }\r\n .base {\r\n justify-content: unset;\r\n box-sizing: border-box;\r\n vertical-align: middle;\r\n display: inline-flex;\r\n align-items: center;\r\n justify-content: center;\r\n position: relative;\r\n width: 100%;\r\n }\r\n .icon {\r\n position: absolute;\r\n }\r\n .label {\r\n vertical-align: middle;\r\n }\r\n ::slotted([slot=\"icon\"]),\r\n ::slotted([slot=\"selected-icon\"]) {\r\n width: 1em;\r\n font-size: var(--m3e-nav-item-icon-size, 1.5rem) !important;\r\n }\r\n :host(:not([selected]):not(:disabled):not([disabled-interactive])) .outer {\r\n --m3e-state-layer-hover-color: var(\r\n --m3e-nav-item-inactive-hover-state-layer-color,\r\n ${DesignToken.color.onSecondaryContainer}\r\n );\r\n --m3e-state-layer-focus-color: var(\r\n --m3e-nav-item-inactive-focus-state-layer-color,\r\n ${DesignToken.color.onSecondaryContainer}\r\n );\r\n --m3e-ripple-color: var(\r\n --m3e-nav-item-inactive-pressed-state-layer-color,\r\n ${DesignToken.color.onSecondaryContainer}\r\n );\r\n }\r\n :host(:not([selected]):not(:disabled):not([disabled-interactive])) .label {\r\n color: var(--m3e-nav-item-inactive-label-text-color, ${DesignToken.color.onSurfaceVariant});\r\n }\r\n :host(:not([selected]):not(:disabled):not([disabled-interactive])) .icon {\r\n color: var(--m3e-nav-item-inactive-icon-color, ${DesignToken.color.onSecondaryContainer});\r\n }\r\n :host([selected]:not(:disabled):not([disabled-interactive])) .outer {\r\n --m3e-state-layer-hover-color: var(\r\n --m3e-nav-item-active-hover-state-layer-color,\r\n ${DesignToken.color.onSecondaryContainer}\r\n );\r\n --m3e-state-layer-focus-color: var(\r\n --m3e-nav-item-active-focus-state-layer-color,\r\n ${DesignToken.color.onSecondaryContainer}\r\n );\r\n --m3e-ripple-color: var(\r\n --m3e-nav-item-active-pressed-state-layer-color,\r\n ${DesignToken.color.onSecondaryContainer}\r\n );\r\n }\r\n :host([selected]:not(:disabled):not([disabled-interactive])) .label {\r\n color: var(--m3e-nav-item-active-label-text-color, ${DesignToken.color.secondary});\r\n }\r\n :host([selected]:not(:disabled):not([disabled-interactive])) .state-layer {\r\n background-color: var(--m3e-nav-item-active-container-color, ${DesignToken.color.secondaryContainer});\r\n }\r\n :host([selected]:not(:disabled):not([disabled-interactive])) .icon {\r\n color: var(--m3e-nav-item-active-icon-color, ${DesignToken.color.onSecondaryContainer});\r\n }\r\n :host([orientation=\"vertical\"]) .outer {\r\n align-self: stretch;\r\n align-items: flex-start;\r\n }\r\n :host([orientation=\"vertical\"]) .label {\r\n text-align: center;\r\n display: -webkit-box;\r\n -webkit-line-clamp: 2;\r\n -webkit-box-orient: vertical;\r\n overflow: hidden;\r\n line-clamp: 2;\r\n }\r\n :host([orientation=\"vertical\"]) .base {\r\n flex-direction: column;\r\n row-gap: var(--m3e-nav-item-spacing, 0.25rem);\r\n }\r\n :host([orientation=\"vertical\"]) .base {\r\n margin-block: var(--m3e-vertical-nav-item-active-indicator-margin, 0.375rem);\r\n }\r\n :host([orientation=\"vertical\"]) .state-layer,\r\n :host([orientation=\"vertical\"]) .ripple {\r\n top: var(--m3e-vertical-nav-item-active-indicator-margin, 0.375rem);\r\n bottom: unset;\r\n }\r\n :host([orientation=\"vertical\"]) .state-layer,\r\n :host([orientation=\"vertical\"]) .ripple,\r\n :host([orientation=\"vertical\"]) .icon-wrapper {\r\n width: var(--m3e-vertical-nav-item-active-indicator-width, 3.5rem);\r\n }\r\n :host([orientation=\"vertical\"]) .state-layer,\r\n :host([orientation=\"vertical\"]) .ripple,\r\n :host([orientation=\"vertical\"]) .icon-wrapper {\r\n height: var(--m3e-vertical-nav-item-active-indicator-height, 2rem);\r\n }\r\n :host([orientation=\"vertical\"]) .icon {\r\n top: calc(\r\n calc(var(--m3e-vertical-nav-item-active-indicator-height, 2rem) / 2) - calc(\r\n var(--m3e-nav-item-icon-size, 1.5rem) / 2\r\n )\r\n );\r\n left: calc(\r\n calc(var(--m3e-vertical-nav-item-active-indicator-width, 3.5rem) / 2) - calc(\r\n var(--m3e-nav-item-icon-size, 1.5rem) / 2\r\n )\r\n );\r\n }\r\n :host([orientation=\"vertical\"]) .focus-ring {\r\n border-radius: var(--m3e-nav-item-focus-ring-shape, ${DesignToken.shape.corner.medium});\r\n }\r\n :host([orientation=\"horizontal\"]) .icon-wrapper {\r\n width: var(--m3e-nav-item-icon-size, 1.5rem);\r\n height: var(--m3e-nav-item-icon-size, 1.5rem);\r\n }\r\n :host([orientation=\"horizontal\"]) .base {\r\n padding: var(--m3e-horizontal-nav-item-padding, 1rem);\r\n }\r\n :host([orientation=\"horizontal\"]) .label {\r\n flex: 1 1 auto;\r\n }\r\n :host([orientation=\"horizontal\"]) .base {\r\n column-gap: var(--m3e-nav-item-spacing, 0.25rem);\r\n }\r\n :host([orientation=\"horizontal\"]) .inner {\r\n height: var(--m3e-horizontal-nav-item-active-indicator-height, 2.5rem);\r\n width: fit-content;\r\n }\r\n .state-layer,\r\n .ripple {\r\n margin-inline: auto;\r\n }\r\n :host(:disabled) .label,\r\n :host([disabled-interactive]) .label {\r\n color: color-mix(\r\n in srgb,\r\n var(--m3e-nav-item-disabled-label-text-color, ${DesignToken.color.onSurface})\r\n var(--m3e-nav-item-disabled-label-text-opacity, 38%),\r\n transparent\r\n );\r\n }\r\n :host(:disabled) .icon,\r\n :host([disabled-interactive]) .icon {\r\n color: color-mix(\r\n in srgb,\r\n var(--m3e-nav-item-disabled-icon-color, ${DesignToken.color.onSurface})\r\n var(--m3e-nav-item-disabled-icon-opacity, 38%),\r\n transparent\r\n );\r\n }\r\n a {\r\n all: unset;\r\n display: block;\r\n position: absolute;\r\n top: 0px;\r\n left: 0px;\r\n right: 0px;\r\n bottom: 0px;\r\n z-index: 1;\r\n }\r\n @media (forced-colors: active) {\r\n :host(:disabled) .label,\r\n :host([disabled-interactive]) .label,\r\n :host(:disabled) .icon,\r\n :host([disabled-interactive]) .icon {\r\n color: GrayText;\r\n }\r\n :host(:not([selected]):not(:disabled):not([disabled-interactive])) .label,\r\n :host(:not([selected]):not(:disabled):not([disabled-interactive])) .icon {\r\n color: ButtonText;\r\n }\r\n :host([selected]:not(:disabled):not([disabled-interactive])) .state-layer {\r\n background-color: ButtonText;\r\n }\r\n :host([orientation=\"vertical\"][selected]:not(:disabled):not([disabled-interactive])) .label {\r\n color: ButtonText;\r\n }\r\n :host([orientation=\"horizontal\"][selected]:not(:disabled):not([disabled-interactive])) .label,\r\n :host([selected]:not(:disabled):not([disabled-interactive])) .icon {\r\n forced-color-adjust: none;\r\n color: ButtonFace;\r\n }\r\n }\r\n `;\r\n\r\n /** @private */ readonly #clickHandler = (e: Event) => this.#handleClick(e);\r\n /** @private */ @query(\".focus-ring\") private readonly _focusRing?: M3eFocusRingElement;\r\n /** @private */ @query(\".state-layer\") private readonly _stateLayer?: M3eStateLayerElement;\r\n /** @private */ @query(\".ripple\") private readonly _ripple?: M3eRippleElement;\r\n\r\n /**\r\n * The layout orientation of the item.\r\n * @default \"vertical\"\r\n */\r\n @property({ reflect: true }) orientation: NavItemOrientation = \"vertical\";\r\n\r\n /** The navigation bar to which this item belongs. */\r\n get navBar(): M3eNavBarElement | null {\r\n return this.closest(\"m3e-nav-bar\") ?? this.closest(\"m3e-nav-rail\") ?? null;\r\n }\r\n\r\n /** @inheritdoc */\r\n override connectedCallback(): void {\r\n super.connectedCallback();\r\n this.addEventListener(\"click\", this.#clickHandler, { capture: true });\r\n }\r\n\r\n /** @inheritdoc */\r\n override disconnectedCallback(): void {\r\n super.disconnectedCallback();\r\n this.removeEventListener(\"click\", this.#clickHandler, { capture: true });\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override update(changedProperties: PropertyValues<this>): void {\r\n super.update(changedProperties);\r\n\r\n if (changedProperties.has(\"selected\")) {\r\n this.ariaSelected = null;\r\n this.ariaPressed = null;\r\n this.ariaCurrent = `${this.selected}`;\r\n for (const icon of this.querySelectorAll(\"m3e-icon\")) {\r\n icon.toggleAttribute(\"filled\", this.selected);\r\n }\r\n this.navBar?.[selectionManager].notifySelectionChange(this);\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override updated(_changedProperties: PropertyValues<this>): void {\r\n super.updated(_changedProperties);\r\n\r\n if (_changedProperties.has(\"orientation\")) {\r\n this._focusRing?.attach(this);\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override firstUpdated(_changedProperties: PropertyValues<this>): void {\r\n super.firstUpdated(_changedProperties);\r\n [this._focusRing, this._stateLayer, this._ripple].forEach((x) => x?.attach(this));\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override render(): unknown {\r\n const disabled = this.disabled || this.disabledInteractive;\r\n return html`${this.orientation === \"vertical\"\r\n ? html`<m3e-focus-ring class=\"focus-ring\" inward></m3e-focus-ring>`\r\n : nothing}\r\n <div class=\"outer\">\r\n ${this[renderPseudoLink]()}\r\n <div class=\"inner\">\r\n ${this.orientation === \"horizontal\" ? html`<m3e-focus-ring class=\"focus-ring\"></m3e-focus-ring>` : nothing}\r\n <m3e-state-layer class=\"state-layer\" ?disabled=\"${disabled}\"></m3e-state-layer>\r\n <m3e-ripple class=\"ripple\" centered ?disabled=\"${disabled}\"></m3e-ripple>\r\n <div class=\"touch\" aria-hidden=\"true\"></div>\r\n <div class=\"base\">\r\n <div class=\"icon-wrapper\" aria-hidden=\"true\">\r\n <div class=\"icon\">\r\n <slot name=\"icon\" aria-hidden=\"true\"></slot>\r\n </div>\r\n </div>\r\n <div class=\"label\">\r\n <slot></slot>\r\n </div>\r\n </div>\r\n </div>\r\n </div>`;\r\n }\r\n\r\n /** @private */\r\n #handleClick(e: Event): void {\r\n if (e.defaultPrevented) return;\r\n\r\n this.selected = true;\r\n if (this.dispatchEvent(new Event(\"input\", { bubbles: true, composed: true, cancelable: true }))) {\r\n this.navBar?.[selectionManager].notifySelectionChange(this);\r\n this.dispatchEvent(new Event(\"change\", { bubbles: true }));\r\n } else {\r\n this.selected = false;\r\n }\r\n }\r\n}\r\n\r\ndeclare global {\r\n interface HTMLElementTagNameMap {\r\n \"m3e-nav-item\": M3eNavItemElement;\r\n }\r\n}\r\n"],"names":["M3eNavBarElement","ReconnectedCallback","AttachInternals","Role","LitElement","constructor","this","SelectionManager","disableRovingTabIndex","_M3eNavBarElement_breakpointUnobserve","set","mode","items","selectionManager","selected","selectedItems","currentMode","_mode","value","disconnectedCallback","super","undefined","__classPrivateFieldGet","call","reconnectedCallback","_M3eNavBarElement_instances","_M3eNavBarElement_initBreakpointMonitoring","willUpdate","changedProperties","has","_updateItems","render","html","_M3eNavBarElement_handleChange","_M3eNavBarElement_handleSlotChange","orientation","_updateOrientation","setCustomState","forEach","x","__classPrivateFieldSet","M3eBreakpointObserver","observe","Breakpoint","XSmall","Small","matches","get","setItems","querySelectorAll","e","stopPropagation","dispatchEvent","Event","bubbles","styles","css","DesignToken","scrollbar","thinWidth","color","surfaceContainer","__decorate","state","prototype","property","reflect","customElement","M3eNavItemElement","LinkButton","Selected","KeyboardClick","Focusable","DisabledInteractive","Disabled","_M3eNavItemElement_clickHandler","navBar","closest","connectedCallback","addEventListener","capture","removeEventListener","update","ariaSelected","ariaPressed","ariaCurrent","icon","toggleAttribute","notifySelectionChange","updated","_changedProperties","_focusRing","attach","firstUpdated","_stateLayer","_ripple","disabled","disabledInteractive","nothing","renderPseudoLink","defaultPrevented","composed","cancelable","typescale","standard","label","medium","fontSize","fontWeight","lineHeight","tracking","shape","corner","full","onSecondaryContainer","onSurfaceVariant","secondary","secondaryContainer","onSurface","query"],"mappings":";;;;;gpBA4CO,IAAMA,EAAN,cAA+BC,EAAoBC,EAAgBC,EAAKC,EAAY,iBAApFC,WAAAA,mCAwBqBC,SAAqB,IAAIC,GAAsCC,wBACzEC,EAAAC,IAAAJ,aAOaA,KAAAK,KAAmB,SA8FlD,CA3FE,SAAIC,GACF,OAAON,KAAKO,GAAkBD,KAChC,CAGA,YAAIE,GACF,OAAOR,KAAKO,GAAkBE,cAAc,IAAM,IACpD,CAGA,eAAIC,GACF,OAAOV,KAAKW,QAAwB,YAAdX,KAAKK,KAAqB,WAAa,UAC/D,CACA,eAAIK,CAAYE,GACdZ,KAAKW,MAAQC,CACf,CAGSC,oBAAAA,GACPC,MAAMD,uBAENb,KAAKW,WAAQI,EACbC,EAAAhB,KAAIG,EAAA,MAAuBc,KAA3BjB,KACF,CAGSkB,mBAAAA,GACPJ,MAAMI,sBAEY,SAAdlB,KAAKK,MACPW,EAAAhB,KAAImB,EAAA,IAAAC,GAA0BH,KAA9BjB,KAEJ,CAGmBqB,UAAAA,CAAWC,GAC5BR,MAAMO,WAAWC,GAEbA,EAAkBC,IAAI,UACxBP,EAAAhB,KAAIG,EAAA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CHANGED
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import { __classPrivateFieldGet, __classPrivateFieldSet, __decorate } from 'tslib';
7
7
  import { LitElement, html, css, unsafeCSS } from 'lit';
8
- import { Selected, Disabled, EventAttribute, AttachInternals, Role, setCustomState, hasAssignedNodes, hasCustomState, DesignToken, customElement, scrollIntoViewIfNeeded, PressedController, FocusController, deleteCustomState } from '@m3e/web/core';
8
+ import { Selected, Disabled, EventAttribute, AttachInternals, Role, setCustomState, hasAssignedNodes, hasCustomState, registerStyleSheet, DesignToken, customElement, scrollIntoViewIfNeeded, PressedController, FocusController, deleteCustomState } from '@m3e/web/core';
9
9
  import { selectionManager, SelectionManager } from '@m3e/web/core/a11y';
10
10
  import { M3eDirectionality } from '@m3e/web/core/bidi';
11
11
  import { query, state, property } from 'lit/decorators.js';
@@ -319,11 +319,7 @@ _M3eNavMenuItemElement_handleCollapsibleEvent = function _M3eNavMenuItemElement_
319
319
  }));
320
320
  };
321
321
  (() => {
322
- if (typeof window !== "undefined") {
323
- const lightDomStyle = new CSSStyleSheet();
324
- lightDomStyle.replaceSync(css`m3e-nav-menu-item > m3e-divider { margin-block: var(--m3e-nav-menu-divider-margin, 0.25rem); flex: none; } m3e-nav-menu-item > m3e-nav-menu-item:first-of-type { margin-block-start: var(--m3e-nav-menu-item-vertical-inset, 0.25rem); } m3e-nav-menu-item > m3e-nav-menu-item:last-of-type { margin-block-end: var(--m3e-nav-menu-item-vertical-inset, 0.25rem); }`.toString());
325
- document.adoptedStyleSheets = [...document.adoptedStyleSheets, lightDomStyle];
326
- }
322
+ registerStyleSheet(css`m3e-nav-menu-item > m3e-divider { margin-block: var(--m3e-nav-menu-divider-margin, 0.25rem); flex: none; } m3e-nav-menu-item > m3e-nav-menu-item:first-of-type { margin-block-start: var(--m3e-nav-menu-item-vertical-inset, 0.25rem); } m3e-nav-menu-item > m3e-nav-menu-item:last-of-type { margin-block-end: var(--m3e-nav-menu-item-vertical-inset, 0.25rem); }`);
327
323
  })();
328
324
  /** The styles of the element. */
329
325
  M3eNavMenuItemElement.styles = css`:host { display: block; flex: none; outline: none; user-select: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); } .base { display: flex; align-items: center; position: relative; padding-inline: var(--m3e-nav-menu-item-padding, 1.5rem); height: calc(var(--m3e-nav-menu-item-height, 3.5rem) + ${DesignToken.density.calc(-3)}); column-gap: var(--m3e-nav-menu-item-spacing, 0.75rem); font-size: var(--m3e-nav-menu-item-font-size, ${DesignToken.typescale.standard.label.large.fontSize}); font-weight: var(--m3e-nav-menu-item-font-weight, ${DesignToken.typescale.standard.label.large.fontWeight}); line-height: var(--m3e-nav-menu-item-line-height, ${DesignToken.typescale.standard.label.large.lineHeight}); letter-spacing: var(--m3e-nav-menu-item-tracking, ${DesignToken.typescale.standard.label.large.tracking}); transition: ${unsafeCSS(`color ${DesignToken.motion.duration.short4} ${DesignToken.motion.easing.standard},
@@ -646,11 +642,7 @@ _M3eNavMenuElement_updateItemFocusVisible = function _M3eNavMenuElement_updateIt
646
642
  }
647
643
  };
648
644
  (() => {
649
- if (typeof window !== "undefined") {
650
- const lightDomStyle = new CSSStyleSheet();
651
- lightDomStyle.replaceSync(css`m3e-nav-menu > m3e-divider { margin-block: var(--m3e-nav-menu-divider-margin, 0.25rem); flex: none; }`.toString());
652
- document.adoptedStyleSheets = [...document.adoptedStyleSheets, lightDomStyle];
653
- }
645
+ registerStyleSheet(css`m3e-nav-menu > m3e-divider { margin-block: var(--m3e-nav-menu-divider-margin, 0.25rem); flex: none; }`);
654
646
  })();
655
647
  /** The styles of the element. */
656
648
  M3eNavMenuElement.styles = css`:host { display: block; outline: none; overflow-y: auto; overflow-x: hidden; min-height: 0; scrollbar-width: ${DesignToken.scrollbar.width}; scrollbar-color: ${DesignToken.scrollbar.color}; } .base { width: 100%; display: flex; flex-direction: column; position: relative; min-height: inherit; box-sizing: border-box; padding-block-start: var(--m3e-nav-menu-padding-top, 0.5rem); padding-block-end: var(--m3e-nav-menu-padding-bottom, 0.5rem); padding-inline-start: var(--m3e-nav-menu-padding-left, 0.75rem); padding-inline-end: var(--m3e-nav-menu-padding-right, 0.75rem); }`;