@mintplayer/web-components 2.1.1 → 2.3.0
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/a11y/index.mjs +26 -2
- package/a11y/src/dismiss-stack.d.ts +25 -0
- package/a11y/src/error-text.d.ts +41 -0
- package/a11y/src/focus-restore.d.ts +116 -0
- package/a11y/src/focus-trap.d.ts +69 -0
- package/a11y/src/form-associated.d.ts +48 -0
- package/a11y/src/host-aria.d.ts +154 -0
- package/a11y/src/index.d.ts +16 -0
- package/a11y/src/inert-regions.d.ts +52 -0
- package/a11y/src/live-announcer.d.ts +8 -0
- package/a11y/src/roving-focus.d.ts +118 -0
- package/a11y/src/testing/expect-idref-resolves.d.ts +31 -0
- package/a11y/src/testing/index.d.ts +1 -0
- package/accordion/index.d.ts +1 -0
- package/accordion/index.mjs +549 -0
- package/accordion/src/components/index.d.ts +3 -0
- package/accordion/src/components/mp-accordion-tab.d.ts +30 -0
- package/accordion/src/components/mp-accordion.d.ts +66 -0
- package/accordion/src/index.d.ts +3 -0
- package/accordion/src/styles/index.d.ts +1 -0
- package/calendar/index.mjs +1 -1
- package/calendar/src/mp-calendar.element.d.ts +2 -0
- package/carousel/index.d.ts +1 -0
- package/carousel/index.mjs +994 -0
- package/carousel/src/components/index.d.ts +1 -0
- package/carousel/src/components/mp-carousel.d.ts +58 -0
- package/carousel/src/index.d.ts +3 -0
- package/carousel/src/styles/index.d.ts +1 -0
- package/carousel/src/types/carousel.d.ts +10 -0
- package/carousel/src/types/index.d.ts +1 -0
- package/checkbox/index.mjs +1 -1
- package/checkbox/src/components/mp-checkbox.d.ts +59 -1
- package/chunks/focus-restore-DxuP1Oe2.mjs +94 -0
- package/chunks/focus-trap-DTOLJ5bb.mjs +121 -0
- package/chunks/form-associated-axmc5sY0.mjs +58 -0
- package/chunks/host-aria-WSGs7SPQ.mjs +152 -0
- package/chunks/inert-regions-DXCnn1LN.mjs +48 -0
- package/chunks/invalid-feedback.styles-he0JYrJm.mjs +11 -0
- package/chunks/{live-announcer-CZDTKulf.mjs → live-announcer-Bi0orG4n.mjs} +9 -9
- package/chunks/{mp-calendar.element-UC68iDbi.mjs → mp-calendar.element-u6uS31_j.mjs} +136 -105
- package/chunks/mp-checkbox-Ph2mMRGz.mjs +312 -0
- package/chunks/{mp-datatable-Bfw0KGkV.mjs → mp-datatable-BwTlh9A_.mjs} +265 -103
- package/chunks/{mp-pagination-BGxsawFL.mjs → mp-pagination-Dea75mD4.mjs} +25 -22
- package/chunks/mp-radio-BjW1HNSc.mjs +300 -0
- package/chunks/{mp-select-BDS1-YGn.mjs → mp-select-Ctu-v1-p.mjs} +163 -40
- package/chunks/{mp-splitter-C8cGCmac.mjs → mp-splitter-LszuRDbR.mjs} +53 -46
- package/chunks/{mp-tab-page-D1b4x-y2.mjs → mp-tab-page-CaCzX1ym.mjs} +46 -45
- package/chunks/{mp-timepicker.element-BwEiwX92.mjs → mp-timepicker.element-Bz393NDQ.mjs} +93 -86
- package/chunks/{mp-toggle-button-dLZNDUVz.mjs → mp-toggle-button-Kz6sIgBJ.mjs} +131 -37
- package/chunks/{mp-treeview-C48F63xb.mjs → mp-treeview-tkWu28iF.mjs} +67 -43
- package/chunks/overlay-controller-DPt13i8p.mjs +314 -0
- package/chunks/roving-focus-CrL9982a.mjs +129 -0
- package/code-snippet/index.mjs +21 -13
- package/code-snippet/src/mp-code-snippet.element.d.ts +6 -0
- package/datatable/index.mjs +1 -1
- package/datatable/src/components/mp-datatable.d.ts +50 -0
- package/datatable/src/types/index.d.ts +2 -0
- package/datatable/src/types/labels.d.ts +30 -0
- package/datepicker/index.mjs +45 -22
- package/datepicker/src/mp-datepicker.element.d.ts +30 -0
- package/datetime-picker/index.mjs +15 -9
- package/dock/index.mjs +365 -209
- package/dock/src/components/mint-dock-manager.element.d.ts +63 -3
- package/dropdown-menu/index.mjs +135 -90
- package/dropdown-menu/src/components/mp-dropdown-menu.d.ts +12 -3
- package/file-manager/index.mjs +279 -214
- package/file-manager/src/components/mp-file-manager.d.ts +22 -0
- package/file-manager/src/types/messages.d.ts +9 -0
- package/multi-range/index.mjs +26 -10
- package/multi-range/src/mint-multi-range.element.d.ts +7 -0
- package/navbar/index.mjs +53 -39
- package/navbar/src/components/mp-navbar.d.ts +1 -0
- package/otp-input/index.mjs +82 -48
- package/otp-input/src/mint-otp-input.element.d.ts +31 -3
- package/overlay/index.mjs +2 -258
- package/overlay/src/overlay-controller.d.ts +64 -4
- package/package.json +21 -1
- package/pagination/index.mjs +1 -1
- package/query-builder/index.mjs +117 -87
- package/query-builder/src/model/messages.d.ts +9 -0
- package/radio/index.mjs +2 -160
- package/radio/src/components/mp-radio.d.ts +58 -3
- package/radio-group/index.d.ts +1 -0
- package/radio-group/index.mjs +145 -0
- package/radio-group/src/components/mp-radio-group.d.ts +52 -0
- package/radio-group/src/index.d.ts +1 -0
- package/radio-group/src/styles/radio-group.styles.d.ts +2 -0
- package/ribbon/index.mjs +316 -304
- package/ribbon/src/mp-ribbon.element.d.ts +16 -0
- package/scheduler/index.mjs +219 -132
- package/scheduler/src/components/mp-scheduler.d.ts +3 -0
- package/scheduler/src/views/base-view.d.ts +23 -0
- package/select/index.mjs +1 -1
- package/select/src/components/mp-select.d.ts +60 -3
- package/shell/index.mjs +142 -31
- package/shell/src/components/mp-shell.d.ts +1 -0
- package/signature-pad/index.d.ts +1 -0
- package/signature-pad/index.mjs +230 -0
- package/signature-pad/src/index.d.ts +2 -0
- package/signature-pad/src/mp-signature-pad.element.d.ts +143 -0
- package/signature-pad/src/mp-signature-pad.element.template.d.ts +2 -0
- package/signature-pad/src/types/signature.d.ts +12 -0
- package/splitter/index.mjs +1 -1
- package/splitter/src/components/mp-splitter.d.ts +7 -0
- package/splitter/src/index.d.ts +1 -1
- package/swiper-core/index.d.ts +1 -0
- package/swiper-core/index.mjs +184 -0
- package/swiper-core/src/index-machine.d.ts +59 -0
- package/swiper-core/src/index.d.ts +4 -0
- package/swiper-core/src/keymap.d.ts +2 -0
- package/swiper-core/src/models/index.d.ts +1 -0
- package/swiper-core/src/models/types.d.ts +99 -0
- package/swiper-core/src/pointer-arbiter.d.ts +45 -0
- package/tab-control/index.mjs +1 -1
- package/tile-manager/index.mjs +110 -93
- package/timeline/index.mjs +138 -54
- package/timeline/src/components/mp-timeline.d.ts +15 -0
- package/timepicker/index.mjs +1 -1
- package/timepicker/src/mp-time-list.element.d.ts +13 -4
- package/timepicker/src/mp-timepicker.element.d.ts +29 -0
- package/toggle-button/index.mjs +1 -1
- package/toggle-button/src/components/mp-toggle-button.d.ts +32 -1
- package/tree-select/index.mjs +233 -121
- package/tree-select/src/components/mp-tree-select.d.ts +37 -0
- package/treeview/index.mjs +1 -1
- package/treeview/src/components/mp-treeview.d.ts +10 -1
- package/chunks/mp-checkbox-BokLL7BS.mjs +0 -211
- package/dropdown/src/styles/dropdown.styles.d.ts +0 -2
|
@@ -142,6 +142,13 @@ export declare class MpFileManager extends LitElement {
|
|
|
142
142
|
private _expandedTreeIds;
|
|
143
143
|
private _clipboard;
|
|
144
144
|
private _searchQuery;
|
|
145
|
+
private _searchAnnounceTimer;
|
|
146
|
+
/** Roving tab stop for the icon-view options. */
|
|
147
|
+
private _iconFocusId;
|
|
148
|
+
/** Operations + async outcomes are invisible without announcements. */
|
|
149
|
+
private readonly liveAnnouncer;
|
|
150
|
+
/** Upload FAILURE interrupts (assertive) — a missed failure costs data. */
|
|
151
|
+
private readonly alertAnnouncer;
|
|
145
152
|
private _renameTarget;
|
|
146
153
|
private _renameInputRef;
|
|
147
154
|
private _dragDepth;
|
|
@@ -261,12 +268,27 @@ export declare class MpFileManager extends LitElement {
|
|
|
261
268
|
private getBreadcrumb;
|
|
262
269
|
render(): TemplateResult;
|
|
263
270
|
private renderContextMenu;
|
|
271
|
+
/**
|
|
272
|
+
* Where focus returns when the menu closes. Captured at open, before focus
|
|
273
|
+
* moves into the menu; <body> is excluded so an unfocused open cannot
|
|
274
|
+
* "restore" to nowhere (the OverlayController lesson).
|
|
275
|
+
*/
|
|
276
|
+
private _contextMenuReturnTarget;
|
|
277
|
+
/** APG menu: one tab stop, arrows move focus, disabled items are skipped. */
|
|
278
|
+
private readonly contextMenuRoving;
|
|
264
279
|
private openContextMenu;
|
|
280
|
+
private onContextMenuKeydown;
|
|
265
281
|
private closeContextMenu;
|
|
266
282
|
private renderToolbar;
|
|
267
283
|
private renderBreadcrumb;
|
|
268
284
|
private renderListView;
|
|
269
285
|
private renderNameCell;
|
|
286
|
+
/**
|
|
287
|
+
* listbox/option, not grid/gridcell (Phase E): the cards were gridcells
|
|
288
|
+
* with no row chain — an invalid grid — and the wrap-reflow layout has no
|
|
289
|
+
* stable row/column geometry to expose anyway. Options rove: one tab stop
|
|
290
|
+
* for the whole surface, arrows move between cards.
|
|
291
|
+
*/
|
|
270
292
|
private renderIconGridView;
|
|
271
293
|
private renderIconCard;
|
|
272
294
|
private resolveIcon;
|
|
@@ -34,7 +34,16 @@ export interface FileManagerMessages {
|
|
|
34
34
|
conflictReplace: string;
|
|
35
35
|
conflictSkip: string;
|
|
36
36
|
conflictRename: string;
|
|
37
|
+
announceDeleted: (count: number) => string;
|
|
38
|
+
announcePasted: (count: number) => string;
|
|
39
|
+
announceNewFolder: (name: string) => string;
|
|
40
|
+
announceRenamed: (from: string, to: string) => string;
|
|
41
|
+
announceUploadDone: (name: string) => string;
|
|
42
|
+
announceUploadFailed: (name: string) => string;
|
|
43
|
+
announceSearchResults: (count: number) => string;
|
|
37
44
|
ariaToolbar: string;
|
|
45
|
+
ariaFileOperations: string;
|
|
46
|
+
ariaViewMode: string;
|
|
38
47
|
ariaBreadcrumb: string;
|
|
39
48
|
ariaFileList: string;
|
|
40
49
|
ariaFileManager: string;
|
package/multi-range/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { html as o, unsafeCSS as
|
|
1
|
+
import { html as o, unsafeCSS as m, LitElement as c, nothing as u } from "lit";
|
|
2
2
|
o`<!-- Track + thumbs are rendered dynamically by render(). This file exists so the
|
|
3
3
|
codegen-wc target produces a \`styles\` export from the sibling .scss; the
|
|
4
4
|
\`template\` export it generates here is intentionally unused. -->`;
|
|
5
|
-
const
|
|
5
|
+
const b = m(`:host {
|
|
6
6
|
display: block;
|
|
7
7
|
position: relative;
|
|
8
8
|
box-sizing: border-box;
|
|
@@ -169,7 +169,7 @@ const d = h(`:host {
|
|
|
169
169
|
transition: none;
|
|
170
170
|
}
|
|
171
171
|
}`);
|
|
172
|
-
class
|
|
172
|
+
class d extends c {
|
|
173
173
|
constructor() {
|
|
174
174
|
super(...arguments), this.min = 0, this.max = 100, this.step = 1, this.minDistance = 0, this.orientation = "horizontal", this.disabled = !1, this.formatValue = null, this._value = null, this.dragState = null, this.trackEl = null, this.rtlDuringGesture = null, this.onThumbPointerDown = (t, e) => {
|
|
175
175
|
this.disabled || this.startDrag(t, e.pointerId, e.currentTarget);
|
|
@@ -194,10 +194,10 @@ class b extends m {
|
|
|
194
194
|
if (this.disabled) return;
|
|
195
195
|
const r = this.keyboardTarget(t, e.key);
|
|
196
196
|
r !== null && (e.preventDefault(), this.moveThumb(t, r) && this.dispatchValueChange());
|
|
197
|
-
};
|
|
197
|
+
}, this._thumbLabels = null;
|
|
198
198
|
}
|
|
199
199
|
static {
|
|
200
|
-
this.styles = [
|
|
200
|
+
this.styles = [b];
|
|
201
201
|
}
|
|
202
202
|
static get observedAttributes() {
|
|
203
203
|
return [
|
|
@@ -372,22 +372,38 @@ class b extends m {
|
|
|
372
372
|
const r = e ? `bottom: ${t.from}%; height: ${t.to - t.from}%;` : `inset-inline-start: ${t.from}%; width: ${t.to - t.from}%;`;
|
|
373
373
|
return o`<div class="fill" part="fill" style=${r}></div>`;
|
|
374
374
|
}
|
|
375
|
+
/** Per-thumb accessible names. Defaults: Minimum/Maximum value for a pair,
|
|
376
|
+
* "Value K of N" beyond that — two identical "20, slider" announcements
|
|
377
|
+
* are indistinguishable without a name. Property-only. */
|
|
378
|
+
get thumbLabels() {
|
|
379
|
+
return this._thumbLabels;
|
|
380
|
+
}
|
|
381
|
+
set thumbLabels(t) {
|
|
382
|
+
this._thumbLabels = t ?? null, this.requestUpdate();
|
|
383
|
+
}
|
|
384
|
+
thumbName(t) {
|
|
385
|
+
const e = this._thumbLabels?.[t];
|
|
386
|
+
if (e) return e;
|
|
387
|
+
const r = this.value.length;
|
|
388
|
+
return r === 2 ? t === 0 ? "Minimum value" : "Maximum value" : `Value ${t + 1} of ${r}`;
|
|
389
|
+
}
|
|
375
390
|
renderThumb(t, e, r) {
|
|
376
|
-
const i = this.percent(t), s = r ? `bottom: ${i}%;` : `inset-inline-start: ${i}%;`, a = this.formatThumb(t), n = this.dragState?.thumbIndex === e,
|
|
391
|
+
const i = this.percent(t), s = r ? `bottom: ${i}%;` : `inset-inline-start: ${i}%;`, a = this.formatThumb(t), n = this.dragState?.thumbIndex === e, h = this.formatValue ? a : null;
|
|
377
392
|
return o`
|
|
378
393
|
<button
|
|
379
394
|
class="thumb"
|
|
380
395
|
part="thumb"
|
|
381
396
|
type="button"
|
|
382
397
|
role="slider"
|
|
398
|
+
aria-label=${this.thumbName(e)}
|
|
383
399
|
data-thumb-index=${e}
|
|
384
400
|
data-dragging=${n ? "true" : "false"}
|
|
385
401
|
aria-valuemin=${this.min}
|
|
386
402
|
aria-valuemax=${this.max}
|
|
387
403
|
aria-valuenow=${t}
|
|
388
404
|
aria-orientation=${this.orientation}
|
|
389
|
-
aria-valuetext=${
|
|
390
|
-
|
|
405
|
+
aria-valuetext=${h ?? u}
|
|
406
|
+
aria-disabled=${this.disabled ? "true" : u}
|
|
391
407
|
style=${s}
|
|
392
408
|
@pointerdown=${(l) => this.onThumbPointerDown(e, l)}
|
|
393
409
|
@keydown=${(l) => this.onThumbKeyDown(e, l)}
|
|
@@ -401,7 +417,7 @@ class b extends m {
|
|
|
401
417
|
return [...this.value];
|
|
402
418
|
}
|
|
403
419
|
}
|
|
404
|
-
typeof customElements < "u" && !customElements.get("mp-multi-range") && customElements.define("mp-multi-range",
|
|
420
|
+
typeof customElements < "u" && !customElements.get("mp-multi-range") && customElements.define("mp-multi-range", d);
|
|
405
421
|
export {
|
|
406
|
-
|
|
422
|
+
d as MintMultiRangeElement
|
|
407
423
|
};
|
|
@@ -113,6 +113,13 @@ export declare class MintMultiRangeElement extends LitElement {
|
|
|
113
113
|
private keyboardTarget;
|
|
114
114
|
protected render(): TemplateResult;
|
|
115
115
|
private renderFill;
|
|
116
|
+
private _thumbLabels;
|
|
117
|
+
/** Per-thumb accessible names. Defaults: Minimum/Maximum value for a pair,
|
|
118
|
+
* "Value K of N" beyond that — two identical "20, slider" announcements
|
|
119
|
+
* are indistinguishable without a name. Property-only. */
|
|
120
|
+
get thumbLabels(): string[] | null;
|
|
121
|
+
set thumbLabels(value: string[] | null);
|
|
122
|
+
private thumbName;
|
|
116
123
|
private renderThumb;
|
|
117
124
|
/** Returns a copy of the current values. */
|
|
118
125
|
getValues(): number[];
|
package/navbar/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { unsafeCSS as
|
|
2
|
-
import {
|
|
3
|
-
const p =
|
|
1
|
+
import { unsafeCSS as n, LitElement as d, html as o } from "lit";
|
|
2
|
+
import { O as v } from "../chunks/overlay-controller-DPt13i8p.mjs";
|
|
3
|
+
const p = n(`.navbar {
|
|
4
4
|
--bs-navbar-padding-x: 0;
|
|
5
5
|
--bs-navbar-padding-y: 0.5rem;
|
|
6
6
|
--bs-navbar-color: rgba(var(--bs-emphasis-color-rgb), 0.65);
|
|
@@ -806,7 +806,7 @@ const p = e(`.navbar {
|
|
|
806
806
|
width: 0;
|
|
807
807
|
height: 0;
|
|
808
808
|
}
|
|
809
|
-
}`), c =
|
|
809
|
+
}`), c = n(`:host, *, *::before, *::after {
|
|
810
810
|
box-sizing: border-box;
|
|
811
811
|
}
|
|
812
812
|
|
|
@@ -846,7 +846,7 @@ const p = e(`.navbar {
|
|
|
846
846
|
:host([disabled]) ::slotted(button) {
|
|
847
847
|
color: var(--bs-nav-link-disabled-color, var(--bs-navbar-disabled-color, inherit)) !important;
|
|
848
848
|
pointer-events: none;
|
|
849
|
-
}`), g =
|
|
849
|
+
}`), g = n(`:host, *, *::before, *::after {
|
|
850
850
|
box-sizing: border-box;
|
|
851
851
|
}
|
|
852
852
|
|
|
@@ -870,7 +870,7 @@ const p = e(`.navbar {
|
|
|
870
870
|
::slotted(a:hover),
|
|
871
871
|
::slotted(a:focus) {
|
|
872
872
|
color: var(--bs-navbar-brand-hover-color, inherit) !important;
|
|
873
|
-
}`), h =
|
|
873
|
+
}`), h = n(`:host, *, *::before, *::after {
|
|
874
874
|
box-sizing: border-box;
|
|
875
875
|
}
|
|
876
876
|
|
|
@@ -1076,10 +1076,10 @@ class r extends d {
|
|
|
1076
1076
|
return this.constructor.observedAttributes.includes("defer-hydration") || this.shadowRoot?.replaceChildren(), super.createRenderRoot();
|
|
1077
1077
|
}
|
|
1078
1078
|
connectedCallback() {
|
|
1079
|
-
super.connectedCallback(), this.setAttribute("data-js", ""), this.style.getPropertyValue("--mp-navbar-breakpoint") || this.#l(this.getAttribute("breakpoint")), this.addEventListener("click", this.#
|
|
1079
|
+
super.connectedCallback(), this.setAttribute("data-js", ""), this.style.getPropertyValue("--mp-navbar-breakpoint") || this.#l(this.getAttribute("breakpoint")), this.addEventListener("click", this.#e);
|
|
1080
1080
|
}
|
|
1081
1081
|
disconnectedCallback() {
|
|
1082
|
-
super.disconnectedCallback(), this.removeEventListener("click", this.#
|
|
1082
|
+
super.disconnectedCallback(), this.removeEventListener("click", this.#e);
|
|
1083
1083
|
}
|
|
1084
1084
|
/**
|
|
1085
1085
|
* Clicking a navigation link (an `<a href>` — a routerLink renders one) should
|
|
@@ -1088,20 +1088,20 @@ class r extends d {
|
|
|
1088
1088
|
* (excluded), so opening a dropdown doesn't collapse the bar. Collapsing in
|
|
1089
1089
|
* wide mode is a no-op (the collapse is always shown there).
|
|
1090
1090
|
*/
|
|
1091
|
-
#
|
|
1091
|
+
#e = (a) => {
|
|
1092
1092
|
a.composedPath().find(
|
|
1093
1093
|
(t) => t instanceof HTMLAnchorElement && t.hasAttribute("href") && !t.classList.contains("dropdown-toggle")
|
|
1094
1094
|
) && (this.querySelectorAll("mp-navbar-dropdown").forEach(
|
|
1095
1095
|
(t) => t.close?.()
|
|
1096
1096
|
), this.toggle(!1));
|
|
1097
1097
|
};
|
|
1098
|
-
attributeChangedCallback(a,
|
|
1099
|
-
super.attributeChangedCallback(a,
|
|
1098
|
+
attributeChangedCallback(a, e, t) {
|
|
1099
|
+
super.attributeChangedCallback(a, e, t), a === "color" ? this.#a(t) : a === "breakpoint" ? this.#l(t) : a === "expanded" ? this.#o(t !== null, !1) : a === "aria-label" && this.requestUpdate();
|
|
1100
1100
|
}
|
|
1101
1101
|
/** Solid colors need `data-bs-theme` for text/link contrast; adaptive names inherit the page theme. */
|
|
1102
1102
|
#a(a) {
|
|
1103
|
-
const
|
|
1104
|
-
|
|
1103
|
+
const e = this.#n(a);
|
|
1104
|
+
e ? this.setAttribute("data-bs-theme", e) : this.getAttribute("data-bs-theme") && this.removeAttribute("data-bs-theme");
|
|
1105
1105
|
}
|
|
1106
1106
|
#n(a) {
|
|
1107
1107
|
return a ? a === "light" || a === "white" ? "light" : a === "body" || a === "transparent" || a.startsWith("body-") ? null : "dark" : null;
|
|
@@ -1123,15 +1123,15 @@ class r extends d {
|
|
|
1123
1123
|
* (matchMedia gate) without any DI/context.
|
|
1124
1124
|
*/
|
|
1125
1125
|
#l(a) {
|
|
1126
|
-
const
|
|
1127
|
-
this.setAttribute("data-breakpoint",
|
|
1126
|
+
const e = a ?? "md", t = r.#i[e] ?? 768;
|
|
1127
|
+
this.setAttribute("data-breakpoint", e), this.style.setProperty("--mp-navbar-breakpoint", `${t}px`);
|
|
1128
1128
|
}
|
|
1129
|
-
get #
|
|
1129
|
+
get #t() {
|
|
1130
1130
|
return this.renderRoot?.querySelector(".navbar-toggle") ?? null;
|
|
1131
1131
|
}
|
|
1132
1132
|
/** Whether the collapse is (visually) expanded — the toggle's checked state. */
|
|
1133
1133
|
get expanded() {
|
|
1134
|
-
return this.#
|
|
1134
|
+
return this.#t?.checked ?? this.hasAttribute("expanded");
|
|
1135
1135
|
}
|
|
1136
1136
|
set expanded(a) {
|
|
1137
1137
|
this.toggle(a);
|
|
@@ -1142,16 +1142,20 @@ class r extends d {
|
|
|
1142
1142
|
* dismiss-on-navigate) don't fire the checkbox's `change` event, so syncing
|
|
1143
1143
|
* aria only there left `aria-expanded` stale after every programmatic close.
|
|
1144
1144
|
*/
|
|
1145
|
-
#o(a,
|
|
1146
|
-
const t = this.#
|
|
1147
|
-
t && (t.checked = a, t.setAttribute("aria-expanded", String(a)),
|
|
1145
|
+
#o(a, e = !0) {
|
|
1146
|
+
const t = this.#t;
|
|
1147
|
+
t && (t.checked = a, t.setAttribute("aria-expanded", String(a)), e && this.#s(a));
|
|
1148
1148
|
}
|
|
1149
1149
|
/** Programmatically open/close the collapse. */
|
|
1150
1150
|
toggle(a) {
|
|
1151
|
-
this.#o(a ?? !(this.#
|
|
1151
|
+
this.#o(a ?? !(this.#t?.checked ?? !1));
|
|
1152
|
+
}
|
|
1153
|
+
firstUpdated() {
|
|
1154
|
+
const a = this.#t;
|
|
1155
|
+
a && (a.setAttribute("role", "button"), a.setAttribute("aria-expanded", String(a.checked)));
|
|
1152
1156
|
}
|
|
1153
1157
|
#d = () => {
|
|
1154
|
-
this.#o(this.#
|
|
1158
|
+
this.#o(this.#t?.checked ?? !1);
|
|
1155
1159
|
};
|
|
1156
1160
|
#r = (a) => {
|
|
1157
1161
|
a.key === "Enter" && (a.preventDefault(), this.toggle());
|
|
@@ -1170,13 +1174,15 @@ class r extends d {
|
|
|
1170
1174
|
return o`
|
|
1171
1175
|
<nav class="navbar" part="nav" aria-label=${a}>
|
|
1172
1176
|
<slot name="brand"></slot>
|
|
1177
|
+
<!-- No role="button"/aria-expanded HERE: this render is also the
|
|
1178
|
+
static DSD chrome, where no script can keep aria-expanded true —
|
|
1179
|
+
the native checkbox's checked state is the correct self-updating
|
|
1180
|
+
channel with JS off. firstUpdated() upgrades the live tier. -->
|
|
1173
1181
|
<input
|
|
1174
1182
|
type="checkbox"
|
|
1175
1183
|
id="mp-navbar-toggle"
|
|
1176
1184
|
class="navbar-toggle"
|
|
1177
|
-
role="button"
|
|
1178
1185
|
aria-label="Toggle navigation"
|
|
1179
|
-
aria-expanded="false"
|
|
1180
1186
|
aria-controls="navbar-collapse"
|
|
1181
1187
|
@change=${this.#d}
|
|
1182
1188
|
@keydown=${this.#r}
|
|
@@ -1190,8 +1196,12 @@ class r extends d {
|
|
|
1190
1196
|
</label>
|
|
1191
1197
|
<div class="navbar-collapse" id="navbar-collapse" part="collapse">
|
|
1192
1198
|
<div class="navbar-collapse-inner">
|
|
1193
|
-
|
|
1194
|
-
|
|
1199
|
+
<!-- div, not ul: the flat-tree children are slotted item WCs, not
|
|
1200
|
+
<li>, so a native list violates the ul content model (axe
|
|
1201
|
+
"list", serious, on every page). Nav items in a nav landmark
|
|
1202
|
+
need no list semantics. -->
|
|
1203
|
+
<div class="navbar-nav nav-start" part="nav-start"><slot></slot></div>
|
|
1204
|
+
<div class="navbar-nav nav-end" part="nav-end"><slot name="end"></slot></div>
|
|
1195
1205
|
</div>
|
|
1196
1206
|
</div>
|
|
1197
1207
|
</nav>
|
|
@@ -1208,6 +1218,10 @@ class m extends i {
|
|
|
1208
1218
|
static {
|
|
1209
1219
|
this.styles = [c];
|
|
1210
1220
|
}
|
|
1221
|
+
// No host role. The navbar's nav groups are plain divs (not lists):
|
|
1222
|
+
// arbitrary slotted content — dropdowns, forms, buttons — can never satisfy
|
|
1223
|
+
// a list's required-children contract, so the navbar carries no list
|
|
1224
|
+
// semantics and items claim no listitem (axe list/aria-required-parent).
|
|
1211
1225
|
render() {
|
|
1212
1226
|
return o`<slot></slot>`;
|
|
1213
1227
|
}
|
|
@@ -1229,15 +1243,15 @@ class s extends i {
|
|
|
1229
1243
|
static get observedAttributes() {
|
|
1230
1244
|
return [...super.observedAttributes ?? [], "data-open", "data-menu-open"];
|
|
1231
1245
|
}
|
|
1232
|
-
#
|
|
1246
|
+
#e = !1;
|
|
1233
1247
|
#a = null;
|
|
1234
1248
|
#n = null;
|
|
1235
1249
|
/** Open via either path — inline (`data-open`) or overlay (`data-menu-open`). */
|
|
1236
1250
|
get #i() {
|
|
1237
1251
|
return this.hasAttribute("data-open") || this.hasAttribute("data-menu-open");
|
|
1238
1252
|
}
|
|
1239
|
-
attributeChangedCallback(a,
|
|
1240
|
-
super.attributeChangedCallback(a,
|
|
1253
|
+
attributeChangedCallback(a, e, t) {
|
|
1254
|
+
super.attributeChangedCallback(a, e, t), (a === "data-open" || a === "data-menu-open") && this.requestUpdate();
|
|
1241
1255
|
}
|
|
1242
1256
|
/** min-width px per Bootstrap breakpoint — mirrors mp-navbar's map. */
|
|
1243
1257
|
static #l = {
|
|
@@ -1249,17 +1263,17 @@ class s extends i {
|
|
|
1249
1263
|
xxl: 1400
|
|
1250
1264
|
};
|
|
1251
1265
|
/** Wide mode = at/above the navbar breakpoint (matchMedia). Small/no-JS = false. */
|
|
1252
|
-
get #
|
|
1266
|
+
get #t() {
|
|
1253
1267
|
return this.#n?.matches ?? !1;
|
|
1254
1268
|
}
|
|
1255
1269
|
connectedCallback() {
|
|
1256
|
-
super.connectedCallback(), this.setAttribute("data-js", ""), this.#
|
|
1270
|
+
super.connectedCallback(), this.setAttribute("data-js", ""), this.#e = !!this.closest("mp-dropdown-menu");
|
|
1257
1271
|
const a = this.closest("mp-navbar")?.getAttribute("breakpoint") ?? "md";
|
|
1258
1272
|
if (this.setAttribute("data-expand", a), typeof window < "u" && window.matchMedia) {
|
|
1259
|
-
const
|
|
1260
|
-
this.#n = window.matchMedia(`(min-width: ${
|
|
1273
|
+
const e = s.#l[a] ?? 768;
|
|
1274
|
+
this.#n = window.matchMedia(`(min-width: ${e}px)`), this.#n.addEventListener("change", this.#o);
|
|
1261
1275
|
}
|
|
1262
|
-
this.addEventListener("keydown", this.#v), this.#
|
|
1276
|
+
this.addEventListener("keydown", this.#v), this.#e && (this.setAttribute("data-submenu", ""), this.#a = new v(this, {
|
|
1263
1277
|
anchor: () => this.renderRoot?.querySelector(".dropdown-toggle") ?? null,
|
|
1264
1278
|
trigger: () => this.renderRoot?.querySelector(".dropdown-toggle") ?? null,
|
|
1265
1279
|
// The default-slotted panel: `<mp-dropdown-menu>` directly (React/Vue), or a
|
|
@@ -1293,7 +1307,7 @@ class s extends i {
|
|
|
1293
1307
|
a.composedPath().includes(this) || this.#r(!1);
|
|
1294
1308
|
};
|
|
1295
1309
|
#b() {
|
|
1296
|
-
this.#
|
|
1310
|
+
this.#e && this.#t && this.#a ? this.#a.toggle() : this.#r(!this.#d);
|
|
1297
1311
|
}
|
|
1298
1312
|
/** Close the dropdown (both the overlay and the inline paths). Public so the
|
|
1299
1313
|
* parent `mp-navbar` can dismiss every dropdown when a nav link is clicked. */
|
|
@@ -1327,9 +1341,9 @@ class s extends i {
|
|
|
1327
1341
|
/** Move focus to the first item control of the slotted menu (this menu's own
|
|
1328
1342
|
* items only — nested submenus keep theirs). */
|
|
1329
1343
|
#g() {
|
|
1330
|
-
const a = this.querySelector(':scope > :not([slot="label"])'),
|
|
1331
|
-
if (!
|
|
1332
|
-
const t = [...
|
|
1344
|
+
const a = this.querySelector(':scope > :not([slot="label"])'), e = a?.matches("mp-dropdown-menu") ? a : a?.querySelector("mp-dropdown-menu");
|
|
1345
|
+
if (!e) return;
|
|
1346
|
+
const t = [...e.querySelectorAll(".dropdown-item")].find((b) => b.closest("mp-dropdown-menu") === e);
|
|
1333
1347
|
(t?.querySelector("a, button") ?? t)?.focus();
|
|
1334
1348
|
}
|
|
1335
1349
|
render() {
|
|
@@ -1340,7 +1354,7 @@ class s extends i {
|
|
|
1340
1354
|
role="button"
|
|
1341
1355
|
tabindex="0"
|
|
1342
1356
|
aria-haspopup="menu"
|
|
1343
|
-
aria-expanded
|
|
1357
|
+
aria-expanded=${this.#i ? "true" : "false"}
|
|
1344
1358
|
@mousedown=${this.#p}
|
|
1345
1359
|
@keydown=${this.#c}
|
|
1346
1360
|
><slot name="label"></slot></a>
|