@m3e/web 2.5.3 → 2.5.5
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.
- package/dist/all.js +394 -348
- package/dist/all.js.map +1 -1
- package/dist/all.min.js +56 -56
- package/dist/all.min.js.map +1 -1
- package/dist/autocomplete.js +14 -14
- package/dist/autocomplete.js.map +1 -1
- package/dist/autocomplete.min.js +1 -1
- package/dist/autocomplete.min.js.map +1 -1
- package/dist/bottom-sheet.js +11 -14
- package/dist/bottom-sheet.js.map +1 -1
- package/dist/bottom-sheet.min.js +1 -1
- package/dist/bottom-sheet.min.js.map +1 -1
- package/dist/breadcrumb.js +4 -4
- package/dist/breadcrumb.js.map +1 -1
- package/dist/breadcrumb.min.js +1 -1
- package/dist/breadcrumb.min.js.map +1 -1
- package/dist/button-group.js +5 -5
- package/dist/button-group.js.map +1 -1
- package/dist/button-group.min.js +1 -1
- package/dist/button-group.min.js.map +1 -1
- package/dist/button.js +15 -15
- package/dist/button.js.map +1 -1
- package/dist/button.min.js +1 -1
- package/dist/button.min.js.map +1 -1
- package/dist/checkbox.js +1 -1
- package/dist/checkbox.js.map +1 -1
- package/dist/checkbox.min.js +1 -1
- package/dist/checkbox.min.js.map +1 -1
- package/dist/chips.js +11 -11
- package/dist/chips.js.map +1 -1
- package/dist/chips.min.js +1 -1
- package/dist/chips.min.js.map +1 -1
- package/dist/core-a11y.js +5 -3
- package/dist/core-a11y.js.map +1 -1
- package/dist/core-a11y.min.js +4 -4
- package/dist/core-a11y.min.js.map +1 -1
- package/dist/core-anchoring.js +4 -4
- package/dist/core-anchoring.js.map +1 -1
- package/dist/core-anchoring.min.js +1 -1
- package/dist/core-anchoring.min.js.map +1 -1
- package/dist/core.js +78 -64
- package/dist/core.js.map +1 -1
- package/dist/core.min.js +1 -1
- package/dist/core.min.js.map +1 -1
- package/dist/css-custom-data.json +200 -185
- package/dist/custom-elements.json +1598 -1524
- package/dist/datepicker.js +12 -12
- package/dist/datepicker.js.map +1 -1
- package/dist/datepicker.min.js +1 -1
- package/dist/datepicker.min.js.map +1 -1
- package/dist/dialog.js +4 -4
- package/dist/dialog.js.map +1 -1
- package/dist/dialog.min.js +1 -1
- package/dist/dialog.min.js.map +1 -1
- package/dist/drawer-container.js +14 -14
- package/dist/drawer-container.js.map +1 -1
- package/dist/drawer-container.min.js +1 -1
- package/dist/drawer-container.min.js.map +1 -1
- package/dist/expansion-panel.js +4 -4
- package/dist/expansion-panel.js.map +1 -1
- package/dist/expansion-panel.min.js +1 -1
- package/dist/expansion-panel.min.js.map +1 -1
- package/dist/fab-menu.js +4 -4
- package/dist/fab-menu.js.map +1 -1
- package/dist/fab-menu.min.js +1 -1
- package/dist/fab-menu.min.js.map +1 -1
- package/dist/fab.js +2 -2
- package/dist/fab.js.map +1 -1
- package/dist/fab.min.js +1 -1
- package/dist/fab.min.js.map +1 -1
- package/dist/form-field.js +19 -19
- package/dist/form-field.js.map +1 -1
- package/dist/form-field.min.js +2 -2
- package/dist/form-field.min.js.map +1 -1
- package/dist/html-custom-data.json +54 -44
- package/dist/icon-button.js +15 -15
- package/dist/icon-button.js.map +1 -1
- package/dist/icon-button.min.js +1 -1
- package/dist/icon-button.min.js.map +1 -1
- package/dist/icon.js +1 -1
- package/dist/icon.js.map +1 -1
- package/dist/icon.min.js +1 -1
- package/dist/icon.min.js.map +1 -1
- package/dist/list.js +16 -16
- package/dist/list.js.map +1 -1
- package/dist/list.min.js +1 -1
- package/dist/list.min.js.map +1 -1
- package/dist/menu.js +20 -20
- package/dist/menu.js.map +1 -1
- package/dist/menu.min.js +1 -1
- package/dist/menu.min.js.map +1 -1
- package/dist/nav-bar.js +40 -10
- package/dist/nav-bar.js.map +1 -1
- package/dist/nav-bar.min.js +1 -1
- package/dist/nav-bar.min.js.map +1 -1
- package/dist/nav-menu.js +10 -10
- package/dist/nav-menu.js.map +1 -1
- package/dist/nav-menu.min.js +1 -1
- package/dist/nav-menu.min.js.map +1 -1
- package/dist/nav-rail.js +15 -11
- package/dist/nav-rail.js.map +1 -1
- package/dist/nav-rail.min.js +1 -1
- package/dist/nav-rail.min.js.map +1 -1
- package/dist/option.js +13 -13
- package/dist/option.js.map +1 -1
- package/dist/option.min.js +1 -1
- package/dist/option.min.js.map +1 -1
- package/dist/paginator.js +2 -2
- package/dist/paginator.js.map +1 -1
- package/dist/paginator.min.js +2 -2
- package/dist/paginator.min.js.map +1 -1
- package/dist/radio-group.js +2 -2
- package/dist/radio-group.js.map +1 -1
- package/dist/radio-group.min.js +1 -1
- package/dist/radio-group.min.js.map +1 -1
- package/dist/search.js +15 -15
- package/dist/search.js.map +1 -1
- package/dist/search.min.js +1 -1
- package/dist/search.min.js.map +1 -1
- package/dist/segmented-button.js +7 -7
- package/dist/segmented-button.js.map +1 -1
- package/dist/segmented-button.min.js +1 -1
- package/dist/segmented-button.min.js.map +1 -1
- package/dist/select.js +6 -6
- package/dist/select.js.map +1 -1
- package/dist/select.min.js +1 -1
- package/dist/select.min.js.map +1 -1
- package/dist/slider.js +5 -5
- package/dist/slider.js.map +1 -1
- package/dist/slider.min.js +1 -1
- package/dist/slider.min.js.map +1 -1
- package/dist/split-pane.js +10 -10
- package/dist/split-pane.js.map +1 -1
- package/dist/split-pane.min.js +1 -1
- package/dist/split-pane.min.js.map +1 -1
- package/dist/src/autocomplete/AutocompleteElement.d.ts.map +1 -1
- package/dist/src/bottom-sheet/BottomSheetElement.d.ts +1 -1
- package/dist/src/bottom-sheet/BottomSheetElement.d.ts.map +1 -1
- package/dist/src/button/styles/ButtonSizeStyle.d.ts.map +1 -1
- package/dist/src/button/styles/ButtonStyle.d.ts.map +1 -1
- package/dist/src/button/styles/ButtonVariantStyle.d.ts.map +1 -1
- package/dist/src/button-group/ButtonGroupElement.d.ts.map +1 -1
- package/dist/src/checkbox/CheckboxElement.d.ts.map +1 -1
- package/dist/src/chips/InputChipElement.d.ts.map +1 -1
- package/dist/src/core/a11y/InteractivityChecker.d.ts +2 -1
- package/dist/src/core/a11y/InteractivityChecker.d.ts.map +1 -1
- package/dist/src/core/anchoring/FloatingPanelElement.d.ts +1 -1
- package/dist/src/core/shared/mixins/SuppressInitialAnimation.d.ts +9 -2
- package/dist/src/core/shared/mixins/SuppressInitialAnimation.d.ts.map +1 -1
- package/dist/src/core/shared/mixins/index.d.ts +0 -1
- package/dist/src/core/shared/mixins/index.d.ts.map +1 -1
- package/dist/src/core/shared/primitives/CollapsibleElement.d.ts +13 -0
- package/dist/src/core/shared/primitives/CollapsibleElement.d.ts.map +1 -1
- package/dist/src/core/shared/primitives/CollapsibleOrientation.d.ts +3 -0
- package/dist/src/core/shared/primitives/CollapsibleOrientation.d.ts.map +1 -0
- package/dist/src/core/shared/primitives/index.d.ts +1 -0
- package/dist/src/core/shared/primitives/index.d.ts.map +1 -1
- package/dist/src/datepicker/DatepickerElement.d.ts +1 -1
- package/dist/src/dialog/DialogElement.d.ts.map +1 -1
- package/dist/src/drawer-container/styles/DrawerContainerStyle.d.ts.map +1 -1
- package/dist/src/expansion-panel/ExpansionPanelElement.d.ts.map +1 -1
- package/dist/src/fab/FabElement.d.ts.map +1 -1
- package/dist/src/fab/styles/FabStyle.d.ts.map +1 -1
- package/dist/src/fab-menu/FabMenuElement.d.ts +1 -1
- package/dist/src/form-field/FormFieldElement.d.ts.map +1 -1
- package/dist/src/icon/IconElement.d.ts.map +1 -1
- package/dist/src/icon-button/styles/IconButtonSizeStyle.d.ts.map +1 -1
- package/dist/src/icon-button/styles/IconButtonStyle.d.ts.map +1 -1
- package/dist/src/icon-button/styles/IconButtonVariantStyle.d.ts.map +1 -1
- package/dist/src/menu/MenuElement.d.ts +1 -1
- package/dist/src/nav-bar/NavItemElement.d.ts +7 -1
- package/dist/src/nav-bar/NavItemElement.d.ts.map +1 -1
- package/dist/src/nav-menu/NavMenuItemElement.d.ts.map +1 -1
- package/dist/src/nav-rail/NavRailElement.d.ts +10 -5
- package/dist/src/nav-rail/NavRailElement.d.ts.map +1 -1
- package/dist/src/paginator/PaginatorElement.d.ts.map +1 -1
- package/dist/src/search/SearchBarElement.d.ts.map +1 -1
- package/dist/src/search/SearchViewElement.d.ts.map +1 -1
- package/dist/src/search/styles/SearchBarStyle.d.ts.map +1 -1
- package/dist/src/split-pane/SplitPaneElement.d.ts.map +1 -1
- package/dist/src/stepper/StepperElement.d.ts.map +1 -1
- package/dist/src/toolbar/ToolbarElement.d.ts.map +1 -1
- package/dist/src/tree/TreeItemElement.d.ts.map +1 -1
- package/dist/stepper.js +6 -6
- package/dist/stepper.js.map +1 -1
- package/dist/stepper.min.js +1 -1
- package/dist/stepper.min.js.map +1 -1
- package/dist/tabs.js +5 -5
- package/dist/tabs.js.map +1 -1
- package/dist/tabs.min.js +1 -1
- package/dist/tabs.min.js.map +1 -1
- package/dist/toc.js +7 -7
- package/dist/toc.js.map +1 -1
- package/dist/toc.min.js +1 -1
- package/dist/toc.min.js.map +1 -1
- package/dist/toolbar.js +2 -1
- package/dist/toolbar.js.map +1 -1
- package/dist/toolbar.min.js +1 -1
- package/dist/toolbar.min.js.map +1 -1
- package/dist/tooltip.js +3 -3
- package/dist/tooltip.js.map +1 -1
- package/dist/tooltip.min.js +1 -1
- package/dist/tooltip.min.js.map +1 -1
- package/dist/tree.js +9 -9
- package/dist/tree.js.map +1 -1
- package/dist/tree.min.js +1 -1
- package/dist/tree.min.js.map +1 -1
- package/package.json +1 -1
- package/dist/src/core/shared/mixins/EventAttribute.d.ts +0 -11
- package/dist/src/core/shared/mixins/EventAttribute.d.ts.map +0 -1
package/dist/nav-bar.js
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* See LICENSE file in the project root for full license text.
|
|
5
5
|
*/
|
|
6
6
|
import { __classPrivateFieldGet, __classPrivateFieldSet, __decorate } from 'tslib';
|
|
7
|
-
import { LitElement, html, css, nothing } from 'lit';
|
|
7
|
+
import { LitElement, html, css, nothing, unsafeCSS } from 'lit';
|
|
8
8
|
import { state, property, query } from 'lit/decorators.js';
|
|
9
|
-
import { ReconnectedCallback, AttachInternals, Role, setCustomState, DesignToken, customElement, LinkButton, Selected, KeyboardClick, Focusable, DisabledInteractive, Disabled, renderPseudoLink, hasAssignedNodes } from '@m3e/web/core';
|
|
9
|
+
import { ReconnectedCallback, AttachInternals, Role, setCustomState, DesignToken, customElement, SuppressInitialAnimation, LinkButton, Selected, KeyboardClick, Focusable, DisabledInteractive, Disabled, ResizeController, resumeAnimation, renderPseudoLink, hasAssignedNodes } 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
|
|
|
@@ -108,7 +108,7 @@ let M3eNavBarElement = class M3eNavBarElement extends ReconnectedCallback(Attach
|
|
|
108
108
|
_updateItems() {
|
|
109
109
|
const orientation = this.currentMode === "compact" ? "vertical" : "horizontal";
|
|
110
110
|
this._updateOrientation(orientation);
|
|
111
|
-
setCustomState(this, "
|
|
111
|
+
setCustomState(this, "--compact", orientation === "vertical");
|
|
112
112
|
}
|
|
113
113
|
/** @internal */
|
|
114
114
|
_updateOrientation(orientation) {
|
|
@@ -142,7 +142,7 @@ __decorate([property({
|
|
|
142
142
|
})], M3eNavBarElement.prototype, "mode", void 0);
|
|
143
143
|
M3eNavBarElement = __decorate([customElement("m3e-nav-bar")], M3eNavBarElement);
|
|
144
144
|
|
|
145
|
-
var _M3eNavItemElement_instances, _M3eNavItemElement_clickHandler, _M3eNavItemElement_handleClick, _M3eNavItemElement_handleSelectedIconSlotChange;
|
|
145
|
+
var _M3eNavItemElement_instances, _M3eNavItemElement_inRail, _M3eNavItemElement_clickHandler, _M3eNavItemElement_resizeController, _M3eNavItemElement_handleClick, _M3eNavItemElement_handleSelectedIconSlotChange, _M3eNavItemElement_handleStateLayerResize, _M3eNavItemElement_initResizeObserver;
|
|
146
146
|
/**
|
|
147
147
|
* An item, placed in a navigation bar or rail, used to navigate to destinations in an application.
|
|
148
148
|
*
|
|
@@ -210,12 +210,19 @@ var _M3eNavItemElement_instances, _M3eNavItemElement_clickHandler, _M3eNavItemEl
|
|
|
210
210
|
* @cssprop --m3e-vertical-nav-item-active-indicator-height - Height of the active indicator in vertical orientation.
|
|
211
211
|
* @cssprop --m3e-vertical-nav-item-active-indicator-margin - Margin for the active indicator in vertical orientation.
|
|
212
212
|
*/
|
|
213
|
-
let M3eNavItemElement = class M3eNavItemElement extends LinkButton(Selected(KeyboardClick(Focusable(DisabledInteractive(Disabled(AttachInternals(Role(LitElement, "button"), true))))))) {
|
|
213
|
+
let M3eNavItemElement = class M3eNavItemElement extends ReconnectedCallback(SuppressInitialAnimation(LinkButton(Selected(KeyboardClick(Focusable(DisabledInteractive(Disabled(AttachInternals(Role(LitElement, "button"), true))))))))) {
|
|
214
214
|
constructor() {
|
|
215
215
|
super(...arguments);
|
|
216
216
|
_M3eNavItemElement_instances.add(this);
|
|
217
217
|
/** @private */
|
|
218
|
+
_M3eNavItemElement_inRail.set(this, false);
|
|
219
|
+
/** @private */
|
|
218
220
|
_M3eNavItemElement_clickHandler.set(this, e => __classPrivateFieldGet(this, _M3eNavItemElement_instances, "m", _M3eNavItemElement_handleClick).call(this, e));
|
|
221
|
+
/** @private */
|
|
222
|
+
_M3eNavItemElement_resizeController.set(this, new ResizeController(this, {
|
|
223
|
+
target: null,
|
|
224
|
+
callback: entries => __classPrivateFieldGet(this, _M3eNavItemElement_instances, "m", _M3eNavItemElement_handleStateLayerResize).call(this, entries)
|
|
225
|
+
}));
|
|
219
226
|
/**
|
|
220
227
|
* The layout orientation of the item.
|
|
221
228
|
* @default "vertical"
|
|
@@ -226,8 +233,15 @@ let M3eNavItemElement = class M3eNavItemElement extends LinkButton(Selected(Keyb
|
|
|
226
233
|
get navBar() {
|
|
227
234
|
return this.closest("m3e-nav-bar") ?? this.closest("m3e-nav-rail") ?? null;
|
|
228
235
|
}
|
|
236
|
+
/** @internal */
|
|
237
|
+
[(_M3eNavItemElement_inRail = new WeakMap(), _M3eNavItemElement_clickHandler = new WeakMap(), _M3eNavItemElement_resizeController = new WeakMap(), _M3eNavItemElement_instances = new WeakSet(), resumeAnimation)]() {
|
|
238
|
+
if (__classPrivateFieldGet(this, _M3eNavItemElement_inRail, "f")) {
|
|
239
|
+
super[resumeAnimation]();
|
|
240
|
+
}
|
|
241
|
+
}
|
|
229
242
|
/** @inheritdoc */
|
|
230
243
|
connectedCallback() {
|
|
244
|
+
__classPrivateFieldSet(this, _M3eNavItemElement_inRail, this.closest("m3e-nav-rail") !== null, "f");
|
|
231
245
|
super.connectedCallback();
|
|
232
246
|
this.addEventListener("click", __classPrivateFieldGet(this, _M3eNavItemElement_clickHandler, "f"), {
|
|
233
247
|
capture: true
|
|
@@ -239,6 +253,12 @@ let M3eNavItemElement = class M3eNavItemElement extends LinkButton(Selected(Keyb
|
|
|
239
253
|
this.removeEventListener("click", __classPrivateFieldGet(this, _M3eNavItemElement_clickHandler, "f"), {
|
|
240
254
|
capture: true
|
|
241
255
|
});
|
|
256
|
+
__classPrivateFieldSet(this, _M3eNavItemElement_inRail, false, "f");
|
|
257
|
+
}
|
|
258
|
+
/** @inheritdoc */
|
|
259
|
+
reconnectedCallback() {
|
|
260
|
+
super.reconnectedCallback();
|
|
261
|
+
__classPrivateFieldGet(this, _M3eNavItemElement_instances, "m", _M3eNavItemElement_initResizeObserver).call(this);
|
|
242
262
|
}
|
|
243
263
|
/** @inheritdoc */
|
|
244
264
|
update(changedProperties) {
|
|
@@ -264,15 +284,15 @@ let M3eNavItemElement = class M3eNavItemElement extends LinkButton(Selected(Keyb
|
|
|
264
284
|
firstUpdated(_changedProperties) {
|
|
265
285
|
super.firstUpdated(_changedProperties);
|
|
266
286
|
[this._focusRing, this._stateLayer, this._ripple].forEach(x => x?.attach(this));
|
|
287
|
+
__classPrivateFieldGet(this, _M3eNavItemElement_instances, "m", _M3eNavItemElement_initResizeObserver).call(this);
|
|
267
288
|
}
|
|
268
289
|
/** @inheritdoc */
|
|
269
290
|
render() {
|
|
270
291
|
const disabled = this.disabled || this.disabledInteractive;
|
|
271
|
-
|
|
292
|
+
const label = html`<div class="label"><slot></slot></div>`;
|
|
293
|
+
return html`${this.orientation === "vertical" ? html`<m3e-focus-ring class="focus-ring" inward></m3e-focus-ring>` : nothing}<div class="outer">${this[renderPseudoLink]()}<div class="inner">${this.orientation === "horizontal" ? html`<m3e-focus-ring class="focus-ring"></m3e-focus-ring>` : nothing}<m3e-state-layer class="state-layer" ?disabled="${disabled}"></m3e-state-layer><m3e-ripple class="ripple" centered ?disabled="${disabled}"></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"></slot><slot name="selected-icon" @slotchange="${__classPrivateFieldGet(this, _M3eNavItemElement_instances, "m", _M3eNavItemElement_handleSelectedIconSlotChange)}"></slot></div></div><m3e-collapsible orientation="horizontal" ?no-animate="${!__classPrivateFieldGet(this, _M3eNavItemElement_inRail, "f")}" ?open="${this.orientation === "horizontal"}">${this.orientation === "horizontal" ? label : nothing}</m3e-collapsible>${this.orientation === "horizontal" ? nothing : label}</div></div></div>`;
|
|
272
294
|
}
|
|
273
295
|
};
|
|
274
|
-
_M3eNavItemElement_clickHandler = new WeakMap();
|
|
275
|
-
_M3eNavItemElement_instances = new WeakSet();
|
|
276
296
|
_M3eNavItemElement_handleClick = function _M3eNavItemElement_handleClick(e) {
|
|
277
297
|
if (e.defaultPrevented) return;
|
|
278
298
|
this.selected = true;
|
|
@@ -290,13 +310,23 @@ _M3eNavItemElement_handleClick = function _M3eNavItemElement_handleClick(e) {
|
|
|
290
310
|
}
|
|
291
311
|
};
|
|
292
312
|
_M3eNavItemElement_handleSelectedIconSlotChange = function _M3eNavItemElement_handleSelectedIconSlotChange(e) {
|
|
293
|
-
setCustomState(this, "
|
|
313
|
+
setCustomState(this, "--with-selected-icon", hasAssignedNodes(e.target));
|
|
314
|
+
};
|
|
315
|
+
_M3eNavItemElement_handleStateLayerResize = function _M3eNavItemElement_handleStateLayerResize(entries) {
|
|
316
|
+
if (entries.length === 0 || this.orientation === "vertical") return;
|
|
317
|
+
this._inner?.style.setProperty("--_expanded-width", `${entries[0].contentRect.width}px`);
|
|
318
|
+
};
|
|
319
|
+
_M3eNavItemElement_initResizeObserver = function _M3eNavItemElement_initResizeObserver() {
|
|
320
|
+
if (this._stateLayer && __classPrivateFieldGet(this, _M3eNavItemElement_inRail, "f")) {
|
|
321
|
+
__classPrivateFieldGet(this, _M3eNavItemElement_resizeController, "f").observe(this._stateLayer);
|
|
322
|
+
}
|
|
294
323
|
};
|
|
295
324
|
/** The styles of the element. */
|
|
296
|
-
M3eNavItemElement.styles = css`: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, ${DesignToken.typescale.standard.label.medium.fontSize}); font-weight: var( --m3e-nav-item-label-text-font-weight, ${DesignToken.typescale.standard.label.medium.fontWeight} ); line-height: var( --m3e-nav-item-label-text-line-height, ${DesignToken.typescale.standard.label.medium.lineHeight} ); letter-spacing: var(--m3e-nav-item-label-text-tracking, ${DesignToken.typescale.standard.label.medium.tracking}); border-radius: var(--m3e-nav-item-shape, ${DesignToken.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])) slot[name="selected-icon"], :host(:not(:state(-with-selected-icon))) slot[name="selected-icon"], :host([selected]:state(-with-selected-icon)) slot[name="icon"] { display: none; } :host(:not([selected]):not(:disabled):not([disabled-interactive])) .outer { --m3e-state-layer-hover-color: var( --m3e-nav-item-inactive-hover-state-layer-color, ${DesignToken.color.onSecondaryContainer} ); --m3e-state-layer-focus-color: var( --m3e-nav-item-inactive-focus-state-layer-color, ${DesignToken.color.onSecondaryContainer} ); --m3e-ripple-color: var( --m3e-nav-item-inactive-pressed-state-layer-color, ${DesignToken.color.onSecondaryContainer} ); } :host(:not([selected]):not(:disabled):not([disabled-interactive])) .label { color: var(--m3e-nav-item-inactive-label-text-color, ${DesignToken.color.onSurfaceVariant}); } :host(:not([selected]):not(:disabled):not([disabled-interactive])) .icon { color: var(--m3e-nav-item-inactive-icon-color, ${DesignToken.color.onSurfaceVariant}); } :host([selected]:not(:disabled):not([disabled-interactive])) .outer { --m3e-state-layer-hover-color: var( --m3e-nav-item-active-hover-state-layer-color, ${DesignToken.color.onSecondaryContainer} ); --m3e-state-layer-focus-color: var( --m3e-nav-item-active-focus-state-layer-color, ${DesignToken.color.onSecondaryContainer} ); --m3e-ripple-color: var( --m3e-nav-item-active-pressed-state-layer-color, ${DesignToken.color.onSecondaryContainer} ); } :host([selected]:not(:disabled):not([disabled-interactive]):not([orientation="horizontal"])) .label { color: var(--m3e-nav-item-active-label-text-color, ${DesignToken.color.secondary}); } :host([selected]:not(:disabled):not([disabled-interactive])) .state-layer { background-color: var(--m3e-nav-item-active-container-color, ${DesignToken.color.secondaryContainer}); } :host([selected]:not(:disabled):not([disabled-interactive])[orientation="horizontal"]) .label, :host([selected]:not(:disabled):not([disabled-interactive])) .icon { color: var(--m3e-nav-item-active-icon-color, ${DesignToken.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, ${DesignToken.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, ${DesignToken.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, ${DesignToken.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; } }`;
|
|
325
|
+
M3eNavItemElement.styles = css`: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, ${DesignToken.typescale.standard.label.medium.fontSize}); font-weight: var( --m3e-nav-item-label-text-font-weight, ${DesignToken.typescale.standard.label.medium.fontWeight} ); line-height: var( --m3e-nav-item-label-text-line-height, ${DesignToken.typescale.standard.label.medium.lineHeight} ); letter-spacing: var(--m3e-nav-item-label-text-tracking, ${DesignToken.typescale.standard.label.medium.tracking}); border-radius: var(--m3e-nav-item-shape, ${DesignToken.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%; } :host(:not(:is(:state(--no-animate), :--no-animate))) .base { transition: ${unsafeCSS(`margin-top ${DesignToken.motion.duration.short1} ${DesignToken.motion.easing.standard}`)}; } .icon { position: absolute; } .label { vertical-align: middle; } :host([orientation="horizontal"]) .label { white-space: nowrap; } ::slotted([slot="icon"]), ::slotted([slot="selected-icon"]) { width: 1em; font-size: var(--m3e-nav-item-icon-size, 1.5rem) !important; } :host(:not(:is(:state(--no-animate), :--no-animate))) .state-layer, :host(:not(:is(:state(--no-animate), :--no-animate))) .ripple { transition: ${unsafeCSS(`height ${DesignToken.motion.duration.short1} ${DesignToken.motion.easing.standard}`)}; } :host(:not([selected])) slot[name="selected-icon"], :host(:not(:is(:state(--with-selected-icon), :--with-selected-icon))) slot[name="selected-icon"], :host([selected]:is(:state(--with-selected-icon), :--with-selected-icon)) slot[name="icon"] { display: none; } :host(:not([selected]):not(:disabled):not([disabled-interactive])) .outer { --m3e-state-layer-hover-color: var( --m3e-nav-item-inactive-hover-state-layer-color, ${DesignToken.color.onSecondaryContainer} ); --m3e-state-layer-focus-color: var( --m3e-nav-item-inactive-focus-state-layer-color, ${DesignToken.color.onSecondaryContainer} ); --m3e-ripple-color: var( --m3e-nav-item-inactive-pressed-state-layer-color, ${DesignToken.color.onSecondaryContainer} ); } :host(:not([selected]):not(:disabled):not([disabled-interactive])) .label { color: var(--m3e-nav-item-inactive-label-text-color, ${DesignToken.color.onSurfaceVariant}); } :host(:not([selected]):not(:disabled):not([disabled-interactive])) .icon { color: var(--m3e-nav-item-inactive-icon-color, ${DesignToken.color.onSurfaceVariant}); } :host([selected]:not(:disabled):not([disabled-interactive])) .outer { --m3e-state-layer-hover-color: var( --m3e-nav-item-active-hover-state-layer-color, ${DesignToken.color.onSecondaryContainer} ); --m3e-state-layer-focus-color: var( --m3e-nav-item-active-focus-state-layer-color, ${DesignToken.color.onSecondaryContainer} ); --m3e-ripple-color: var( --m3e-nav-item-active-pressed-state-layer-color, ${DesignToken.color.onSecondaryContainer} ); } :host([selected]:not(:disabled):not([disabled-interactive]):not([orientation="horizontal"])) .label { color: var(--m3e-nav-item-active-label-text-color, ${DesignToken.color.secondary}); } :host([selected]:not(:disabled):not([disabled-interactive])) .state-layer { background-color: var(--m3e-nav-item-active-container-color, ${DesignToken.color.secondaryContainer}); } :host([selected]:not(:disabled):not([disabled-interactive])[orientation="horizontal"]) .label, :host([selected]:not(:disabled):not([disabled-interactive])) .icon { color: var(--m3e-nav-item-active-icon-color, ${DesignToken.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="horizongal"]) .base { margin-top: 0; } :host([orientation="vertical"]) .base { margin-top: var(--m3e-vertical-nav-item-active-indicator-margin, 0.375rem); margin-bottom: 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(:not(:is(:state(--no-animate), :--no-animate))[orientation="vertical"]) .state-layer, :host(:not(:is(:state(--no-animate), :--no-animate))[orientation="vertical"]) .ripple { animation: collapse ${DesignToken.motion.duration.medium1}; } @keyframes collapse { from { width: var(--_expanded-width, var(--m3e-vertical-nav-item-active-indicator-width, 3.5rem)); } to { 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, ${DesignToken.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"]) .state-layer, :host([orientation="horizontal"]) .ripple, :host([orientation="horizontal"]) .inner { height: var(--m3e-horizontal-nav-item-active-indicator-height, 2.5rem); } :host([orientation="horizontal"]) .inner { width: fit-content; } .state-layer, .ripple { margin-inline: auto; } :host(:is(:state(--first), :--first):not(:is(:state(--no-animate), :--no-animate))[orientation="horizontal"]) .icon-wrapper, :host(:not(:is(:state(--first), :--first)):not(:is(:state(--no-animate), :--no-animate))[orientation="vertical"]) .icon-wrapper { animation: ${unsafeCSS(`slide-down ${DesignToken.motion.duration.short2} ${DesignToken.motion.easing.standard}`)}; } :host(:not(:is(:state(--first), :--first)):not(:is(:state(--no-animate), :--no-animate))[orientation="horizontal"]) .icon-wrapper, :host(:is(:state(--first), :--first):not(:is(:state(--no-animate), :--no-animate))[orientation="vertical"]) .icon-wrapper { animation: ${unsafeCSS(`slide-up ${DesignToken.motion.duration.short2} ${DesignToken.motion.easing.standard}`)}; } @keyframes slide-down { from { transform: translateY(-4px); } to { transform: translateY(0); } } @keyframes slide-up { from { transform: translateY(4px); } to { transform: translateY(0); } } :host(:not(:is(:state(--no-animate), :--no-animate))[orientation="horizontal"]) .label { animation: horizontal-fade-in ${DesignToken.motion.duration.medium1}; } :host(:not(:is(:state(--no-animate), :--no-animate))[orientation="vertical"]) .label { animation: vertical-fade-in ${DesignToken.motion.duration.medium1}; } @keyframes horizontal-fade-in { from { opacity: 0; } to { opacity: 1; } } @keyframes vertical-fade-in { from { opacity: 0; } to { opacity: 1; } } :host(:disabled) .label, :host([disabled-interactive]) .label { color: color-mix( in srgb, var(--m3e-nav-item-disabled-label-text-color, ${DesignToken.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, ${DesignToken.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 (prefers-reduced-motion) { :host(:is(:state(--first), :--first):not(:is(:state(--no-animate), :--no-animate))[orientation="horizontal"]) .icon-wrapper, :host(:not(:is(:state(--first), :--first)):not(:is(:state(--no-animate), :--no-animate))[orientation="vertical"]) .icon-wrapper, :host( :not(:is(:state(--first), :--first)):not(:is(:state(--no-animate), :--no-animate))[orientation="horizontal"] ) .icon-wrapper, :host(:is(:state(--first), :--first):not(:is(:state(--no-animate), :--no-animate))[orientation="vertical"]) .icon-wrapper, :host(:not(:is(:state(--no-animate), :--no-animate))[orientation="vertical"]) .state-layer, :host(:not(:is(:state(--no-animate), :--no-animate))[orientation="vertical"]) .ripple, :host(:not(:is(:state(--no-animate), :--no-animate))[orientation="horizontal"]) .label, :host(:not(:is(:state(--no-animate), :--no-animate))[orientation="vertical"]) .label { animation: none; } :host(:not(:is(:state(--no-animate), :--no-animate))) .state-layer, :host(:not(:is(:state(--no-animate), :--no-animate))) .ripple, :host(:not(:is(:state(--no-animate), :--no-animate))) .base { transition: none; } } @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; } }`;
|
|
297
326
|
__decorate([query(".focus-ring")], M3eNavItemElement.prototype, "_focusRing", void 0);
|
|
298
327
|
__decorate([query(".state-layer")], M3eNavItemElement.prototype, "_stateLayer", void 0);
|
|
299
328
|
__decorate([query(".ripple")], M3eNavItemElement.prototype, "_ripple", void 0);
|
|
329
|
+
__decorate([query(".inner")], M3eNavItemElement.prototype, "_inner", void 0);
|
|
300
330
|
__decorate([property({
|
|
301
331
|
reflect: true
|
|
302
332
|
})], M3eNavItemElement.prototype, "orientation", void 0);
|
package/dist/nav-bar.js.map
CHANGED
|
@@ -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, 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 hasAssignedNodes,\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 setCustomState,\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])) slot[name=\"selected-icon\"],\r\n :host(:not(:state(-with-selected-icon))) slot[name=\"selected-icon\"],\r\n :host([selected]:state(-with-selected-icon)) slot[name=\"icon\"] {\r\n display: none;\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.onSurfaceVariant});\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]):not([orientation=\"horizontal\"])) .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])[orientation=\"horizontal\"]) .label,\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\" aria-hidden=\"true\">\r\n <slot name=\"icon\"></slot>\r\n <slot name=\"selected-icon\" @slotchange=\"${this.#handleSelectedIconSlotChange}\"></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 /** @private */\r\n #handleSelectedIconSlotChange(e: Event): void {\r\n setCustomState(this, \"-with-selected-icon\", hasAssignedNodes(<HTMLSlotElement>e.target));\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","_M3eNavItemElement_instances","_M3eNavItemElement_handleSelectedIconSlotChange","defaultPrevented","composed","cancelable","hasAssignedNodes","target","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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rD,WAAW,CAACG,KAAK,CAAC8D,SAAS,6MASjCjE,WAAW,CAACG,KAAK,CAAC8D,SAAS,CAAA,m8BAAA,CAxMrD;AAiPiC5D,UAAA,CAAA,CAAtC6D,KAAK,CAAC,aAAa,CAAC,CAAmD,EAAAvD,iBAAA,CAAAJ,SAAA,EAAA,YAAA,EAAA,MAAA,CAAA;AAChCF,UAAA,CAAA,CAAvC6D,KAAK,CAAC,cAAc,CAAC,CAAqD,EAAAvD,iBAAA,CAAAJ,SAAA,EAAA,aAAA,EAAA,MAAA,CAAA;AACxCF,UAAA,CAAA,CAAlC6D,KAAK,CAAC,SAAS,CAAC,CAA6C,EAAAvD,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;AA7P/DI,iBAAiB,GAAAN,UAAA,CAAA,CAD7BK,aAAa,CAAC,cAAc,CAAC,CACjB,EAAAC,iBAAiB,CA2V7B;;;;"}
|
|
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, unsafeCSS } 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 hasAssignedNodes,\r\n KeyboardClick,\r\n LinkButton,\r\n M3eFocusRingElement,\r\n M3eRippleElement,\r\n M3eStateLayerElement,\r\n ReconnectedCallback,\r\n renderPseudoLink,\r\n ResizeController,\r\n resumeAnimation,\r\n Role,\r\n Selected,\r\n setCustomState,\r\n SuppressInitialAnimation,\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 ReconnectedCallback(\r\n SuppressInitialAnimation(\r\n LinkButton(\r\n Selected(\r\n KeyboardClick(Focusable(DisabledInteractive(Disabled(AttachInternals(Role(LitElement, \"button\"), true))))),\r\n ),\r\n ),\r\n ),\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 :host(:not(:is(:state(--no-animate), :--no-animate))) .base {\r\n transition: ${unsafeCSS(\r\n `margin-top ${DesignToken.motion.duration.short1} ${DesignToken.motion.easing.standard}`,\r\n )};\r\n }\r\n .icon {\r\n position: absolute;\r\n }\r\n .label {\r\n vertical-align: middle;\r\n }\r\n :host([orientation=\"horizontal\"]) .label {\r\n white-space: nowrap;\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(:is(:state(--no-animate), :--no-animate))) .state-layer,\r\n :host(:not(:is(:state(--no-animate), :--no-animate))) .ripple {\r\n transition: ${unsafeCSS(`height ${DesignToken.motion.duration.short1} ${DesignToken.motion.easing.standard}`)};\r\n }\r\n :host(:not([selected])) slot[name=\"selected-icon\"],\r\n :host(:not(:is(:state(--with-selected-icon), :--with-selected-icon))) slot[name=\"selected-icon\"],\r\n :host([selected]:is(:state(--with-selected-icon), :--with-selected-icon)) slot[name=\"icon\"] {\r\n display: none;\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.onSurfaceVariant});\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]):not([orientation=\"horizontal\"])) .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])[orientation=\"horizontal\"]) .label,\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=\"horizongal\"]) .base {\r\n margin-top: 0;\r\n }\r\n :host([orientation=\"vertical\"]) .base {\r\n margin-top: var(--m3e-vertical-nav-item-active-indicator-margin, 0.375rem);\r\n margin-bottom: 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(:not(:is(:state(--no-animate), :--no-animate))[orientation=\"vertical\"]) .state-layer,\r\n :host(:not(:is(:state(--no-animate), :--no-animate))[orientation=\"vertical\"]) .ripple {\r\n animation: collapse ${DesignToken.motion.duration.medium1};\r\n }\r\n @keyframes collapse {\r\n from {\r\n width: var(--_expanded-width, var(--m3e-vertical-nav-item-active-indicator-width, 3.5rem));\r\n }\r\n to {\r\n width: var(--m3e-vertical-nav-item-active-indicator-width, 3.5rem);\r\n }\r\n }\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\"]) .state-layer,\r\n :host([orientation=\"horizontal\"]) .ripple,\r\n :host([orientation=\"horizontal\"]) .inner {\r\n height: var(--m3e-horizontal-nav-item-active-indicator-height, 2.5rem);\r\n }\r\n :host([orientation=\"horizontal\"]) .inner {\r\n width: fit-content;\r\n }\r\n .state-layer,\r\n .ripple {\r\n margin-inline: auto;\r\n }\r\n :host(:is(:state(--first), :--first):not(:is(:state(--no-animate), :--no-animate))[orientation=\"horizontal\"])\r\n .icon-wrapper,\r\n :host(:not(:is(:state(--first), :--first)):not(:is(:state(--no-animate), :--no-animate))[orientation=\"vertical\"])\r\n .icon-wrapper {\r\n animation: ${unsafeCSS(`slide-down ${DesignToken.motion.duration.short2} ${DesignToken.motion.easing.standard}`)};\r\n }\r\n :host(:not(:is(:state(--first), :--first)):not(:is(:state(--no-animate), :--no-animate))[orientation=\"horizontal\"])\r\n .icon-wrapper,\r\n :host(:is(:state(--first), :--first):not(:is(:state(--no-animate), :--no-animate))[orientation=\"vertical\"])\r\n .icon-wrapper {\r\n animation: ${unsafeCSS(`slide-up ${DesignToken.motion.duration.short2} ${DesignToken.motion.easing.standard}`)};\r\n }\r\n @keyframes slide-down {\r\n from {\r\n transform: translateY(-4px);\r\n }\r\n to {\r\n transform: translateY(0);\r\n }\r\n }\r\n @keyframes slide-up {\r\n from {\r\n transform: translateY(4px);\r\n }\r\n to {\r\n transform: translateY(0);\r\n }\r\n }\r\n :host(:not(:is(:state(--no-animate), :--no-animate))[orientation=\"horizontal\"]) .label {\r\n animation: horizontal-fade-in ${DesignToken.motion.duration.medium1};\r\n }\r\n :host(:not(:is(:state(--no-animate), :--no-animate))[orientation=\"vertical\"]) .label {\r\n animation: vertical-fade-in ${DesignToken.motion.duration.medium1};\r\n }\r\n @keyframes horizontal-fade-in {\r\n from {\r\n opacity: 0;\r\n }\r\n to {\r\n opacity: 1;\r\n }\r\n }\r\n @keyframes vertical-fade-in {\r\n from {\r\n opacity: 0;\r\n }\r\n to {\r\n opacity: 1;\r\n }\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 (prefers-reduced-motion) {\r\n :host(:is(:state(--first), :--first):not(:is(:state(--no-animate), :--no-animate))[orientation=\"horizontal\"])\r\n .icon-wrapper,\r\n :host(:not(:is(:state(--first), :--first)):not(:is(:state(--no-animate), :--no-animate))[orientation=\"vertical\"])\r\n .icon-wrapper,\r\n :host(\r\n :not(:is(:state(--first), :--first)):not(:is(:state(--no-animate), :--no-animate))[orientation=\"horizontal\"]\r\n )\r\n .icon-wrapper,\r\n :host(:is(:state(--first), :--first):not(:is(:state(--no-animate), :--no-animate))[orientation=\"vertical\"])\r\n .icon-wrapper,\r\n :host(:not(:is(:state(--no-animate), :--no-animate))[orientation=\"vertical\"]) .state-layer,\r\n :host(:not(:is(:state(--no-animate), :--no-animate))[orientation=\"vertical\"]) .ripple,\r\n :host(:not(:is(:state(--no-animate), :--no-animate))[orientation=\"horizontal\"]) .label,\r\n :host(:not(:is(:state(--no-animate), :--no-animate))[orientation=\"vertical\"]) .label {\r\n animation: none;\r\n }\r\n :host(:not(:is(:state(--no-animate), :--no-animate))) .state-layer,\r\n :host(:not(:is(:state(--no-animate), :--no-animate))) .ripple,\r\n :host(:not(:is(:state(--no-animate), :--no-animate))) .base {\r\n transition: none;\r\n }\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 */ #inRail = false;\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 /** @private */ @query(\".inner\") private readonly _inner?: HTMLElement;\r\n\r\n /** @private */ readonly #resizeController = new ResizeController(this, {\r\n target: null,\r\n callback: (entries) => this.#handleStateLayerResize(entries),\r\n });\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 /** @internal */\r\n override [resumeAnimation](): void {\r\n if (this.#inRail) {\r\n super[resumeAnimation]();\r\n }\r\n }\r\n\r\n /** @inheritdoc */\r\n override connectedCallback(): void {\r\n this.#inRail = this.closest(\"m3e-nav-rail\") !== null;\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 this.#inRail = false;\r\n }\r\n\r\n /** @inheritdoc */\r\n override reconnectedCallback(): void {\r\n super.reconnectedCallback();\r\n this.#initResizeObserver();\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 this.#initResizeObserver();\r\n }\r\n\r\n /** @inheritdoc */\r\n protected override render(): unknown {\r\n const disabled = this.disabled || this.disabledInteractive;\r\n const label = html`<div class=\"label\"><slot></slot></div>`;\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\"></slot>\r\n <slot name=\"selected-icon\" @slotchange=\"${this.#handleSelectedIconSlotChange}\"></slot>\r\n </div>\r\n </div>\r\n\r\n <m3e-collapsible\r\n orientation=\"horizontal\"\r\n ?no-animate=\"${!this.#inRail}\"\r\n ?open=\"${this.orientation === \"horizontal\"}\"\r\n >\r\n ${this.orientation === \"horizontal\" ? label : nothing}\r\n </m3e-collapsible>\r\n\r\n ${this.orientation === \"horizontal\" ? nothing : label}\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 /** @private */\r\n #handleSelectedIconSlotChange(e: Event): void {\r\n setCustomState(this, \"--with-selected-icon\", hasAssignedNodes(<HTMLSlotElement>e.target));\r\n }\r\n\r\n /** @private */\r\n #handleStateLayerResize(entries: ResizeObserverEntry[]): void {\r\n if (entries.length === 0 || this.orientation === \"vertical\") return;\r\n this._inner?.style.setProperty(\"--_expanded-width\", `${entries[0].contentRect.width}px`);\r\n }\r\n\r\n /** @private */\r\n #initResizeObserver(): void {\r\n if (this._stateLayer && this.#inRail) {\r\n this.#resizeController.observe(this._stateLayer);\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","SuppressInitialAnimation","LinkButton","Selected","KeyboardClick","Focusable","DisabledInteractive","Disabled","_M3eNavItemElement_inRail","_M3eNavItemElement_clickHandler","_M3eNavItemElement_resizeController","ResizeController","target","callback","entries","_M3eNavItemElement_instances","_M3eNavItemElement_handleStateLayerResize","navBar","closest","WeakMap","WeakSet","resumeAnimation","connectedCallback","addEventListener","capture","removeEventListener","_M3eNavItemElement_initResizeObserver","update","ariaSelected","ariaPressed","ariaCurrent","icon","toggleAttribute","notifySelectionChange","updated","_changedProperties","_focusRing","attach","firstUpdated","_stateLayer","_ripple","disabled","disabledInteractive","label","nothing","renderPseudoLink","_M3eNavItemElement_handleSelectedIconSlotChange","defaultPrevented","composed","cancelable","hasAssignedNodes","length","_inner","style","setProperty","contentRect","width","typescale","standard","medium","fontSize","fontWeight","lineHeight","tracking","shape","corner","full","unsafeCSS","motion","duration","short1","easing","onSecondaryContainer","onSurfaceVariant","secondary","secondaryContainer","medium1","short2","onSurface","query"],"mappings":";;;;;;;;;;;;;AAYA;;;;;;;;;;;;;;;;;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QAAQ,CAAC,CAAuC,EAAA/E,iBAAA,CAAAJ,SAAA,EAAA,QAAA,EAAA,MAAA,CAAA;AAW1CF,UAAA,CAAA,CAA5BG,QAAQ,CAAC;AAAEC,EAAAA,OAAO,EAAE;CAAM,CAAC,CAA8C,EAAAE,iBAAA,CAAAJ,SAAA,EAAA,aAAA,EAAA,MAAA,CAAA;AApX/DI,iBAAiB,GAAAN,UAAA,CAAA,CAD7BK,aAAa,CAAC,cAAc,CAAC,CACjB,EAAAC,iBAAiB,CAuf7B;;;;"}
|
package/dist/nav-bar.min.js
CHANGED
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* Copyright (c) 2025–2026 matraic
|
|
4
4
|
* See LICENSE file in the project root for full license text.
|
|
5
5
|
*/
|
|
6
|
-
import{__classPrivateFieldGet as e,__classPrivateFieldSet as t,__decorate as i}from"tslib";import{LitElement as a,html as o,css as n,nothing as r}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 $,hasAssignedNodes as k}from"@m3e/web/core";import{SelectionManager as z,selectionManager as _}from"@m3e/web/core/a11y";import{M3eBreakpointObserver as S,Breakpoint as C}from"@m3e/web/core/layout";var E,I,j,B,W,M;let T=class extends(d(h(m(a,"navigation")))){constructor(){super(...arguments),E.add(this),this[M]=(new z).disableRovingTabIndex(),I.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,I,"f")?.call(this)}reconnectedCallback(){super.reconnectedCallback(),"auto"===this.mode&&e(this,E,"m",j).call(this)}willUpdate(t){super.willUpdate(t),t.has("mode")&&(e(this,I,"f")?.call(this),"auto"===this.mode?e(this,E,"m",j).call(this):(this._mode=void 0,this._updateItems())),t.has("_mode")&&this._updateItems()}render(){return o`<div class="base"><slot @change="${e(this,E,"m",W)}" @slotchange="${e(this,E,"m",B)}"></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 L,R,U,A;I=new WeakMap,E=new WeakSet,M=_,j=function(){t(this,I,S.observe([C.XSmall,C.Small],e=>{this._mode=e.get(C.XSmall)||e.get(C.Small)?"compact":"expanded",this._updateItems()}),"f")},B=function(){this[_].setItems([...this.querySelectorAll("m3e-nav-item")]),this._updateItems()},W=function(e){e.stopPropagation(),this.dispatchEvent(new Event("change",{bubbles:!0}))},T.styles=n`: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()],T.prototype,"_mode",void 0),i([s({reflect:!0})],T.prototype,"mode",void 0),T=i([p("m3e-nav-bar")],T);let P=class extends(u(f(g(y(w(x(h(m(a,"button"),!0)))))))){constructor(){super(...arguments),L.add(this),R.set(this,t=>e(this,L,"m",U).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,R,"f"),{capture:!0})}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",e(this,R,"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 t=this.disabled||this.disabledInteractive;return o`${"vertical"===this.orientation?o`<m3e-focus-ring class="focus-ring" inward></m3e-focus-ring>`:r}<div class="outer">${this[$]()}<div class="inner">${"horizontal"===this.orientation?o`<m3e-focus-ring class="focus-ring"></m3e-focus-ring>`:r}<m3e-state-layer class="state-layer" ?disabled="${t}"></m3e-state-layer><m3e-ripple class="ripple" centered ?disabled="${t}"></m3e-ripple><div class="touch" aria-hidden="true"></div><div class="base"><div class="icon-wrapper" aria-hidden="true"><div class="icon" aria-hidden="true"><slot name="icon"></slot><slot name="selected-icon" @slotchange="${e(this,L,"m",A)}"></slot></div></div><div class="label"><slot></slot></div></div></div></div>`}};R=new WeakMap,L=new WeakSet,U=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)},A=function(e){v(this,"-with-selected-icon",k(e.target))},P.styles=n`: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])) slot[name="selected-icon"], :host(:not(:state(-with-selected-icon))) slot[name="selected-icon"], :host([selected]:state(-with-selected-icon)) slot[name="icon"] { display: none; } :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.onSurfaceVariant}); } :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]):not([orientation="horizontal"])) .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])[orientation="horizontal"]) .label, :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")],P.prototype,"_focusRing",void 0),i([c(".state-layer")],P.prototype,"_stateLayer",void 0),i([c(".ripple")],P.prototype,"_ripple",void 0),i([s({reflect:!0})],P.prototype,"orientation",void 0),P=i([p("m3e-nav-item")],P);export{T as M3eNavBarElement,P as M3eNavItemElement};
|
|
6
|
+
import{__classPrivateFieldGet as t,__classPrivateFieldSet as e,__decorate as i}from"tslib";import{LitElement as a,html as o,css as n,nothing as r,unsafeCSS as s}from"lit";import{state as l,property as c,query as d}from"lit/decorators.js";import{ReconnectedCallback as m,AttachInternals as h,Role as v,setCustomState as p,DesignToken as b,customElement as u,SuppressInitialAnimation as f,LinkButton as g,Selected as y,KeyboardClick as w,Focusable as $,DisabledInteractive as x,Disabled as z,ResizeController as k,resumeAnimation as _,renderPseudoLink as S,hasAssignedNodes as C}from"@m3e/web/core";import{SelectionManager as E,selectionManager as I}from"@m3e/web/core/a11y";import{M3eBreakpointObserver as W,Breakpoint as j}from"@m3e/web/core/layout";var B,M,L,R,T,P;let U=class extends(m(h(v(a,"navigation")))){constructor(){super(...arguments),B.add(this),this[P]=(new E).disableRovingTabIndex(),M.set(this,void 0),this.mode="compact"}get items(){return this[I].items}get selected(){return this[I].selectedItems[0]??null}get currentMode(){return this._mode??("compact"!==this.mode?"expanded":"compact")}set currentMode(t){this._mode=t}disconnectedCallback(){super.disconnectedCallback(),this._mode=void 0,t(this,M,"f")?.call(this)}reconnectedCallback(){super.reconnectedCallback(),"auto"===this.mode&&t(this,B,"m",L).call(this)}willUpdate(e){super.willUpdate(e),e.has("mode")&&(t(this,M,"f")?.call(this),"auto"===this.mode?t(this,B,"m",L).call(this):(this._mode=void 0,this._updateItems())),e.has("_mode")&&this._updateItems()}render(){return o`<div class="base"><slot @change="${t(this,B,"m",T)}" @slotchange="${t(this,B,"m",R)}"></slot></div>`}_updateItems(){const t="compact"===this.currentMode?"vertical":"horizontal";this._updateOrientation(t),p(this,"--compact","vertical"===t)}_updateOrientation(t){this[I].items.forEach(e=>e.orientation=t)}};var Y,A,q,O,V,X,F,G;M=new WeakMap,B=new WeakSet,P=I,L=function(){e(this,M,W.observe([j.XSmall,j.Small],t=>{this._mode=t.get(j.XSmall)||t.get(j.Small)?"compact":"expanded",this._updateItems()}),"f")},R=function(){this[I].setItems([...this.querySelectorAll("m3e-nav-item")]),this._updateItems()},T=function(t){t.stopPropagation(),this.dispatchEvent(new Event("change",{bubbles:!0}))},U.styles=n`: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()],U.prototype,"_mode",void 0),i([c({reflect:!0})],U.prototype,"mode",void 0),U=i([u("m3e-nav-bar")],U);let H=class extends(m(f(g(y(w($(x(z(h(v(a,"button"),!0)))))))))){constructor(){super(...arguments),Y.add(this),A.set(this,!1),q.set(this,e=>t(this,Y,"m",V).call(this,e)),O.set(this,new k(this,{target:null,callback:e=>t(this,Y,"m",F).call(this,e)})),this.orientation="vertical"}get navBar(){return this.closest("m3e-nav-bar")??this.closest("m3e-nav-rail")??null}[(A=new WeakMap,q=new WeakMap,O=new WeakMap,Y=new WeakSet,_)](){t(this,A,"f")&&super[_]()}connectedCallback(){e(this,A,null!==this.closest("m3e-nav-rail"),"f"),super.connectedCallback(),this.addEventListener("click",t(this,q,"f"),{capture:!0})}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",t(this,q,"f"),{capture:!0}),e(this,A,!1,"f")}reconnectedCallback(){super.reconnectedCallback(),t(this,Y,"m",G).call(this)}update(t){if(super.update(t),t.has("selected")){this.ariaSelected=null,this.ariaPressed=null,this.ariaCurrent=`${this.selected}`;for(const t of this.querySelectorAll("m3e-icon"))t.toggleAttribute("filled",this.selected);this.navBar?.[I].notifySelectionChange(this)}}updated(t){super.updated(t),t.has("orientation")&&this._focusRing?.attach(this)}firstUpdated(e){super.firstUpdated(e),[this._focusRing,this._stateLayer,this._ripple].forEach(t=>t?.attach(this)),t(this,Y,"m",G).call(this)}render(){const e=this.disabled||this.disabledInteractive,i=o`<div class="label"><slot></slot></div>`;return o`${"vertical"===this.orientation?o`<m3e-focus-ring class="focus-ring" inward></m3e-focus-ring>`:r}<div class="outer">${this[S]()}<div class="inner">${"horizontal"===this.orientation?o`<m3e-focus-ring class="focus-ring"></m3e-focus-ring>`:r}<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"></slot><slot name="selected-icon" @slotchange="${t(this,Y,"m",X)}"></slot></div></div><m3e-collapsible orientation="horizontal" ?no-animate="${!t(this,A,"f")}" ?open="${"horizontal"===this.orientation}">${"horizontal"===this.orientation?i:r}</m3e-collapsible>${"horizontal"===this.orientation?r:i}</div></div></div>`}};V=function(t){t.defaultPrevented||(this.selected=!0,this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0,cancelable:!0}))?(this.navBar?.[I].notifySelectionChange(this),this.dispatchEvent(new Event("change",{bubbles:!0}))):this.selected=!1)},X=function(t){p(this,"--with-selected-icon",C(t.target))},F=function(t){0!==t.length&&"vertical"!==this.orientation&&this._inner?.style.setProperty("--_expanded-width",`${t[0].contentRect.width}px`)},G=function(){this._stateLayer&&t(this,A,"f")&&t(this,O,"f").observe(this._stateLayer)},H.styles=n`: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%; } :host(:not(:is(:state(--no-animate), :--no-animate))) .base { transition: ${s(`margin-top ${b.motion.duration.short1} ${b.motion.easing.standard}`)}; } .icon { position: absolute; } .label { vertical-align: middle; } :host([orientation="horizontal"]) .label { white-space: nowrap; } ::slotted([slot="icon"]), ::slotted([slot="selected-icon"]) { width: 1em; font-size: var(--m3e-nav-item-icon-size, 1.5rem) !important; } :host(:not(:is(:state(--no-animate), :--no-animate))) .state-layer, :host(:not(:is(:state(--no-animate), :--no-animate))) .ripple { transition: ${s(`height ${b.motion.duration.short1} ${b.motion.easing.standard}`)}; } :host(:not([selected])) slot[name="selected-icon"], :host(:not(:is(:state(--with-selected-icon), :--with-selected-icon))) slot[name="selected-icon"], :host([selected]:is(:state(--with-selected-icon), :--with-selected-icon)) slot[name="icon"] { display: none; } :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.onSurfaceVariant}); } :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]):not([orientation="horizontal"])) .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])[orientation="horizontal"]) .label, :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="horizongal"]) .base { margin-top: 0; } :host([orientation="vertical"]) .base { margin-top: var(--m3e-vertical-nav-item-active-indicator-margin, 0.375rem); margin-bottom: 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(:not(:is(:state(--no-animate), :--no-animate))[orientation="vertical"]) .state-layer, :host(:not(:is(:state(--no-animate), :--no-animate))[orientation="vertical"]) .ripple { animation: collapse ${b.motion.duration.medium1}; } @keyframes collapse { from { width: var(--_expanded-width, var(--m3e-vertical-nav-item-active-indicator-width, 3.5rem)); } to { 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"]) .state-layer, :host([orientation="horizontal"]) .ripple, :host([orientation="horizontal"]) .inner { height: var(--m3e-horizontal-nav-item-active-indicator-height, 2.5rem); } :host([orientation="horizontal"]) .inner { width: fit-content; } .state-layer, .ripple { margin-inline: auto; } :host(:is(:state(--first), :--first):not(:is(:state(--no-animate), :--no-animate))[orientation="horizontal"]) .icon-wrapper, :host(:not(:is(:state(--first), :--first)):not(:is(:state(--no-animate), :--no-animate))[orientation="vertical"]) .icon-wrapper { animation: ${s(`slide-down ${b.motion.duration.short2} ${b.motion.easing.standard}`)}; } :host(:not(:is(:state(--first), :--first)):not(:is(:state(--no-animate), :--no-animate))[orientation="horizontal"]) .icon-wrapper, :host(:is(:state(--first), :--first):not(:is(:state(--no-animate), :--no-animate))[orientation="vertical"]) .icon-wrapper { animation: ${s(`slide-up ${b.motion.duration.short2} ${b.motion.easing.standard}`)}; } @keyframes slide-down { from { transform: translateY(-4px); } to { transform: translateY(0); } } @keyframes slide-up { from { transform: translateY(4px); } to { transform: translateY(0); } } :host(:not(:is(:state(--no-animate), :--no-animate))[orientation="horizontal"]) .label { animation: horizontal-fade-in ${b.motion.duration.medium1}; } :host(:not(:is(:state(--no-animate), :--no-animate))[orientation="vertical"]) .label { animation: vertical-fade-in ${b.motion.duration.medium1}; } @keyframes horizontal-fade-in { from { opacity: 0; } to { opacity: 1; } } @keyframes vertical-fade-in { from { opacity: 0; } to { opacity: 1; } } :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 (prefers-reduced-motion) { :host(:is(:state(--first), :--first):not(:is(:state(--no-animate), :--no-animate))[orientation="horizontal"]) .icon-wrapper, :host(:not(:is(:state(--first), :--first)):not(:is(:state(--no-animate), :--no-animate))[orientation="vertical"]) .icon-wrapper, :host( :not(:is(:state(--first), :--first)):not(:is(:state(--no-animate), :--no-animate))[orientation="horizontal"] ) .icon-wrapper, :host(:is(:state(--first), :--first):not(:is(:state(--no-animate), :--no-animate))[orientation="vertical"]) .icon-wrapper, :host(:not(:is(:state(--no-animate), :--no-animate))[orientation="vertical"]) .state-layer, :host(:not(:is(:state(--no-animate), :--no-animate))[orientation="vertical"]) .ripple, :host(:not(:is(:state(--no-animate), :--no-animate))[orientation="horizontal"]) .label, :host(:not(:is(:state(--no-animate), :--no-animate))[orientation="vertical"]) .label { animation: none; } :host(:not(:is(:state(--no-animate), :--no-animate))) .state-layer, :host(:not(:is(:state(--no-animate), :--no-animate))) .ripple, :host(:not(:is(:state(--no-animate), :--no-animate))) .base { transition: none; } } @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([d(".focus-ring")],H.prototype,"_focusRing",void 0),i([d(".state-layer")],H.prototype,"_stateLayer",void 0),i([d(".ripple")],H.prototype,"_ripple",void 0),i([d(".inner")],H.prototype,"_inner",void 0),i([c({reflect:!0})],H.prototype,"orientation",void 0),H=i([u("m3e-nav-item")],H);export{U as M3eNavBarElement,H as M3eNavItemElement};
|
|
7
7
|
//# sourceMappingURL=nav-bar.min.js.map
|