@mintplayer/web-components 2.2.0 → 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.
Files changed (107) hide show
  1. package/a11y/index.mjs +26 -2
  2. package/a11y/src/dismiss-stack.d.ts +25 -0
  3. package/a11y/src/error-text.d.ts +41 -0
  4. package/a11y/src/focus-restore.d.ts +116 -0
  5. package/a11y/src/focus-trap.d.ts +69 -0
  6. package/a11y/src/form-associated.d.ts +48 -0
  7. package/a11y/src/host-aria.d.ts +154 -0
  8. package/a11y/src/index.d.ts +16 -0
  9. package/a11y/src/inert-regions.d.ts +52 -0
  10. package/a11y/src/live-announcer.d.ts +8 -0
  11. package/a11y/src/roving-focus.d.ts +118 -0
  12. package/a11y/src/testing/expect-idref-resolves.d.ts +31 -0
  13. package/a11y/src/testing/index.d.ts +1 -0
  14. package/accordion/index.mjs +180 -174
  15. package/accordion/src/components/mp-accordion.d.ts +18 -13
  16. package/calendar/index.mjs +1 -1
  17. package/calendar/src/mp-calendar.element.d.ts +2 -0
  18. package/carousel/index.mjs +211 -164
  19. package/carousel/src/components/mp-carousel.d.ts +1 -0
  20. package/checkbox/index.mjs +1 -1
  21. package/checkbox/src/components/mp-checkbox.d.ts +59 -1
  22. package/chunks/focus-restore-DxuP1Oe2.mjs +94 -0
  23. package/chunks/focus-trap-DTOLJ5bb.mjs +121 -0
  24. package/chunks/form-associated-axmc5sY0.mjs +58 -0
  25. package/chunks/host-aria-WSGs7SPQ.mjs +152 -0
  26. package/chunks/inert-regions-DXCnn1LN.mjs +48 -0
  27. package/chunks/invalid-feedback.styles-he0JYrJm.mjs +11 -0
  28. package/chunks/{live-announcer-CZDTKulf.mjs → live-announcer-Bi0orG4n.mjs} +9 -9
  29. package/chunks/{mp-calendar.element-UC68iDbi.mjs → mp-calendar.element-u6uS31_j.mjs} +136 -105
  30. package/chunks/mp-checkbox-Ph2mMRGz.mjs +312 -0
  31. package/chunks/{mp-datatable-Bfw0KGkV.mjs → mp-datatable-BwTlh9A_.mjs} +265 -103
  32. package/chunks/{mp-pagination-BGxsawFL.mjs → mp-pagination-Dea75mD4.mjs} +25 -22
  33. package/chunks/mp-radio-BjW1HNSc.mjs +300 -0
  34. package/chunks/{mp-select-BDS1-YGn.mjs → mp-select-Ctu-v1-p.mjs} +163 -40
  35. package/chunks/{mp-splitter-C8cGCmac.mjs → mp-splitter-LszuRDbR.mjs} +53 -46
  36. package/chunks/{mp-tab-page-D1b4x-y2.mjs → mp-tab-page-CaCzX1ym.mjs} +46 -45
  37. package/chunks/{mp-timepicker.element-BwEiwX92.mjs → mp-timepicker.element-Bz393NDQ.mjs} +93 -86
  38. package/chunks/{mp-toggle-button-dLZNDUVz.mjs → mp-toggle-button-Kz6sIgBJ.mjs} +131 -37
  39. package/chunks/{mp-treeview-C48F63xb.mjs → mp-treeview-tkWu28iF.mjs} +67 -43
  40. package/chunks/overlay-controller-DPt13i8p.mjs +314 -0
  41. package/chunks/roving-focus-CrL9982a.mjs +129 -0
  42. package/code-snippet/index.mjs +21 -13
  43. package/code-snippet/src/mp-code-snippet.element.d.ts +6 -0
  44. package/datatable/index.mjs +1 -1
  45. package/datatable/src/components/mp-datatable.d.ts +50 -0
  46. package/datatable/src/types/index.d.ts +2 -0
  47. package/datatable/src/types/labels.d.ts +30 -0
  48. package/datepicker/index.mjs +45 -22
  49. package/datepicker/src/mp-datepicker.element.d.ts +30 -0
  50. package/datetime-picker/index.mjs +15 -9
  51. package/dock/index.mjs +365 -209
  52. package/dock/src/components/mint-dock-manager.element.d.ts +63 -3
  53. package/dropdown-menu/index.mjs +135 -90
  54. package/dropdown-menu/src/components/mp-dropdown-menu.d.ts +12 -3
  55. package/file-manager/index.mjs +279 -214
  56. package/file-manager/src/components/mp-file-manager.d.ts +22 -0
  57. package/file-manager/src/types/messages.d.ts +9 -0
  58. package/multi-range/index.mjs +26 -10
  59. package/multi-range/src/mint-multi-range.element.d.ts +7 -0
  60. package/navbar/index.mjs +53 -39
  61. package/navbar/src/components/mp-navbar.d.ts +1 -0
  62. package/otp-input/index.mjs +82 -48
  63. package/otp-input/src/mint-otp-input.element.d.ts +31 -3
  64. package/overlay/index.mjs +2 -258
  65. package/overlay/src/overlay-controller.d.ts +64 -4
  66. package/package.json +9 -1
  67. package/pagination/index.mjs +1 -1
  68. package/query-builder/index.mjs +117 -87
  69. package/query-builder/src/model/messages.d.ts +9 -0
  70. package/radio/index.mjs +2 -160
  71. package/radio/src/components/mp-radio.d.ts +58 -3
  72. package/radio-group/index.d.ts +1 -0
  73. package/radio-group/index.mjs +145 -0
  74. package/radio-group/src/components/mp-radio-group.d.ts +52 -0
  75. package/radio-group/src/index.d.ts +1 -0
  76. package/radio-group/src/styles/radio-group.styles.d.ts +2 -0
  77. package/ribbon/index.mjs +316 -304
  78. package/ribbon/src/mp-ribbon.element.d.ts +16 -0
  79. package/scheduler/index.mjs +219 -132
  80. package/scheduler/src/components/mp-scheduler.d.ts +3 -0
  81. package/scheduler/src/views/base-view.d.ts +23 -0
  82. package/select/index.mjs +1 -1
  83. package/select/src/components/mp-select.d.ts +60 -3
  84. package/shell/index.mjs +142 -31
  85. package/shell/src/components/mp-shell.d.ts +1 -0
  86. package/signature-pad/index.d.ts +1 -0
  87. package/signature-pad/index.mjs +230 -0
  88. package/signature-pad/src/index.d.ts +2 -0
  89. package/signature-pad/src/mp-signature-pad.element.d.ts +143 -0
  90. package/signature-pad/src/mp-signature-pad.element.template.d.ts +2 -0
  91. package/signature-pad/src/types/signature.d.ts +12 -0
  92. package/splitter/index.mjs +1 -1
  93. package/splitter/src/components/mp-splitter.d.ts +7 -0
  94. package/tab-control/index.mjs +1 -1
  95. package/tile-manager/index.mjs +110 -93
  96. package/timeline/index.mjs +138 -54
  97. package/timeline/src/components/mp-timeline.d.ts +15 -0
  98. package/timepicker/index.mjs +1 -1
  99. package/timepicker/src/mp-time-list.element.d.ts +13 -4
  100. package/timepicker/src/mp-timepicker.element.d.ts +29 -0
  101. package/toggle-button/index.mjs +1 -1
  102. package/toggle-button/src/components/mp-toggle-button.d.ts +32 -1
  103. package/tree-select/index.mjs +233 -121
  104. package/tree-select/src/components/mp-tree-select.d.ts +37 -0
  105. package/treeview/index.mjs +1 -1
  106. package/treeview/src/components/mp-treeview.d.ts +10 -1
  107. package/chunks/mp-checkbox-BokLL7BS.mjs +0 -211
@@ -9,6 +9,7 @@ export declare class MintDockManagerElement extends LitElement {
9
9
  private static readonly TOUCH_LONG_PRESS_MS;
10
10
  private static readonly TOUCH_LONG_PRESS_SLOP_PX;
11
11
  private static readonly TOUCH_PRESS_FEEDBACK_DELAY_MS;
12
+ private static readonly PANE_MOVE_ZONE_ORDER;
12
13
  private documentRef;
13
14
  private windowRef;
14
15
  private rootEl;
@@ -22,10 +23,19 @@ export declare class MintDockManagerElement extends LitElement {
22
23
  /**
23
24
  * Active keyboard-driven pane move (Phase 7 of WC ARIA PRD). The user
24
25
  * pressed M on a focused tab; until they pick a destination key (T/R/B/L
25
- * to dock to a side, F to float) or Escape, we intercept letter keys and
26
- * route them to the synthetic-drop pipeline.
26
+ * to dock to a side of the current stack, F to float), cycle to an enumerated
27
+ * target with the arrows and press Enter, or cancel with Escape, we intercept
28
+ * those keys and route them to the synthetic-drop pipeline.
27
29
  */
28
30
  private paneMoveMode;
31
+ /**
32
+ * Index into buildPaneMoveCandidates() of the target the arrow keys have
33
+ * cycled to, or null while no candidate is highlighted (move mode armed but
34
+ * no arrow pressed yet). Written only by cyclePaneMoveCandidate and cleared
35
+ * only by clearPaneMoveState, both of which update the drop indicator in the
36
+ * same call so the visual highlight can never disagree with the index.
37
+ */
38
+ private paneMoveCandidateIndex;
29
39
  private dropJoystickTarget;
30
40
  private rootLayout;
31
41
  private floatingLayouts;
@@ -70,6 +80,14 @@ export declare class MintDockManagerElement extends LitElement {
70
80
  private resolveWindow;
71
81
  private parseLayout;
72
82
  private ensureSnapshot;
83
+ /**
84
+ * renderLayout() clears with innerHTML = '' — the exact rebuild FocusRestore
85
+ * exists for: a focused intersection handle (id'd by data-key) or a pane's
86
+ * tab button (id tabId + '-header-button', one shadow root deeper) is
87
+ * destroyed on every relayout, dropping focus to <body> mid-drag or between
88
+ * keyboard moves.
89
+ */
90
+ private readonly layoutFocusRestore;
73
91
  private renderLayout;
74
92
  private renderNode;
75
93
  private renderFloatingPanes;
@@ -93,6 +111,16 @@ export declare class MintDockManagerElement extends LitElement {
93
111
  private endCornerResize;
94
112
  private onIntersectionDoubleClick;
95
113
  private beginFloatingDrag;
114
+ /** The percent-of-host size of the dimension a handle drives (width for
115
+ * horizontal/corner handles, height for pure-vertical ones). */
116
+ private syncFloatingResizerValue;
117
+ /**
118
+ * Keyboard resize for floating panes — the same edge-anchored math as the
119
+ * pointer path (left/top handles move the edge outward, right/bottom grow),
120
+ * ±10px per arrow, Shift for 1px. Off-axis arrows and modifier chords pass
121
+ * through untouched.
122
+ */
123
+ private onFloatingResizeKeydown;
96
124
  private beginFloatingResize;
97
125
  private handleFloatingDragMove;
98
126
  private endFloatingDrag;
@@ -246,10 +274,37 @@ export declare class MintDockManagerElement extends LitElement {
246
274
  * Keyboard handler on the dock root, registered in capture phase so it
247
275
  * runs before mp-tab-control's shadow-internal handlers swallow Arrow /
248
276
  * Home / End / Enter. M opens move mode on a focused tab; subsequent
249
- * letter keys (T/R/B/L/F) commit the move; Escape cancels.
277
+ * letter keys (T/R/B/L/F) commit the move, arrows cycle enumerated drop
278
+ * targets and Enter commits the highlighted one; Escape cancels.
250
279
  */
251
280
  private onRootKeyDown;
281
+ /**
282
+ * Cancel move mode when focus leaves the dock entirely. Moves WITHIN the
283
+ * dock (tab to tab, tab to pane content) keep it armed — the commit always
284
+ * applies to the pane captured at arm time, which the announcement named.
285
+ */
286
+ private onRootFocusOut;
287
+ /** Composed-tree containment: true for shadow content AND slotted light DOM. */
288
+ private isWithinDock;
252
289
  private handlePaneMoveModeKey;
290
+ /**
291
+ * Enumerated keyboard drop targets, in cycle order: every docked leaf stack
292
+ * except the one the moving pane currently sits in (T/R/B/L already split
293
+ * that one), each contributing its four side zones, then a single `float`
294
+ * candidate last. Rebuilt on every cycle step so it can never describe a
295
+ * layout that has since changed.
296
+ *
297
+ * The identity carried forward is `data-path`, produced by the same
298
+ * formatPath() that renderStack() stamps onto each `.dock-stack` and that the
299
+ * pointer drop path parses back — which is what makes an enumerated commit
300
+ * land exactly where a pointer drop on that stack would.
301
+ */
302
+ private buildPaneMoveCandidates;
303
+ private cyclePaneMoveCandidate;
304
+ private highlightPaneMoveCandidate;
305
+ private commitHighlightedPaneMoveCandidate;
306
+ /** Sole exit point for move mode: drops the arming AND any highlight together. */
307
+ private clearPaneMoveState;
253
308
  /**
254
309
  * Walk the focused element through nested shadow roots to find a focused
255
310
  * tab button, then map it back to the dock's pane name + source path via
@@ -263,6 +318,11 @@ export declare class MintDockManagerElement extends LitElement {
263
318
  * doesn't apply here.
264
319
  */
265
320
  private synthesiseDragStateForKeyboardMove;
321
+ /**
322
+ * `targetPath` omitted (the T/R/B/L keys) means the source stack is also the
323
+ * target stack, and handleDrop creates a sibling split with the moved pane on
324
+ * the chosen side. An enumerated candidate passes its own target instead.
325
+ */
266
326
  private commitPaneMoveToZone;
267
327
  private commitPaneMoveAsFloat;
268
328
  /**
@@ -1,10 +1,12 @@
1
- import { LitElement as a, unsafeCSS as p, nothing as l, html as b } from "lit";
2
- class c extends a {
1
+ import { LitElement as p, unsafeCSS as l, nothing as b, html as c } from "lit";
2
+ import "lit/directives/ref.js";
3
+ import { H as w } from "../chunks/host-aria-WSGs7SPQ.mjs";
4
+ class m extends p {
3
5
  createRenderRoot() {
4
6
  return this.constructor.observedAttributes.includes("defer-hydration") || this.shadowRoot?.replaceChildren(), super.createRenderRoot();
5
7
  }
6
8
  }
7
- const w = p(`.dropup,
9
+ const h = l(`.dropup,
8
10
  .dropend,
9
11
  .dropdown,
10
12
  .dropstart,
@@ -410,16 +412,80 @@ const w = p(`.dropup,
410
412
  white-space: nowrap;
411
413
  list-style: none;
412
414
  }`);
413
- class m extends c {
415
+ class u extends m {
416
+ constructor() {
417
+ super(...arguments), this.#r = 0, this._inputLabel = null, this.#d = new w(this, {
418
+ referenceTarget: () => this.renderRoot?.querySelector("ul") ?? null
419
+ }), this.#p = () => {
420
+ this.#t();
421
+ }, this.#i = (o) => {
422
+ if (this.mode === "menu")
423
+ switch (o.key) {
424
+ case "ArrowDown":
425
+ this.#l(1), o.preventDefault();
426
+ break;
427
+ case "ArrowUp":
428
+ this.#l(-1), o.preventDefault();
429
+ break;
430
+ case "Home":
431
+ this.#s(this.#e().findIndex((r) => !this.#o(r))), o.preventDefault();
432
+ break;
433
+ case "End": {
434
+ const r = this.#e();
435
+ for (let e = r.length - 1; e >= 0; e--)
436
+ if (!this.#o(r[e])) {
437
+ this.#s(e);
438
+ break;
439
+ }
440
+ o.preventDefault();
441
+ break;
442
+ }
443
+ case "Enter":
444
+ case " ": {
445
+ const r = o.composedPath()[0];
446
+ if (!(r instanceof HTMLElement)) return;
447
+ const e = r.closest(".dropdown-item");
448
+ if (!e || e.closest("mp-dropdown-menu") !== this || this.#o(e)) return;
449
+ const t = this.#n(e);
450
+ if (o.key === "Enter" ? t instanceof HTMLButtonElement || t instanceof HTMLAnchorElement && t.hasAttribute("href") : t instanceof HTMLButtonElement) return;
451
+ o.preventDefault(), t.click();
452
+ break;
453
+ }
454
+ }
455
+ }, this.#a = (o) => {
456
+ const r = o.composedPath().find(
457
+ (e) => e instanceof HTMLElement && e.classList.contains("dropdown-item")
458
+ );
459
+ !r || this.#o(r) || r.closest("mp-dropdown-menu") !== this || this.dispatchEvent(
460
+ new CustomEvent("select", {
461
+ detail: { item: r, value: this.#b(r) },
462
+ bubbles: !0,
463
+ composed: !0
464
+ })
465
+ );
466
+ };
467
+ }
414
468
  static {
415
- this.styles = [w];
469
+ this.styles = [h];
416
470
  }
417
471
  static get observedAttributes() {
418
- return [...super.observedAttributes ?? [], "mode", "max-height", "label-id"];
419
- }
420
- /** Index (into the item list) holding the roving tabindex in menu mode. */
421
- #r = 0;
422
- // `mode`/`labelId` reflect to attributes (the layout/roles read the attribute).
472
+ return [
473
+ ...super.observedAttributes ?? [],
474
+ "mode",
475
+ "max-height",
476
+ // Copied to the role-bearing <ul> in render(); label-id is DELETED, not
477
+ // aliased: it wrote aria-labelledby on a node inside the shadow root
478
+ // pointing at a document id — an IDREF cannot cross that boundary, so it
479
+ // never conveyed anything. Use aria-label / input-label, or aria-labelledby
480
+ // on the HOST, which is resolved into element references.
481
+ "aria-label",
482
+ "input-label",
483
+ "aria-labelledby",
484
+ "aria-describedby"
485
+ ];
486
+ }
487
+ #r;
488
+ // `mode` reflects to its attribute (the layout/roles read the attribute).
423
489
  // Setters matter for `@lit/react`'s createComponent, which sets matching props.
424
490
  get mode() {
425
491
  return this.getAttribute("mode") === "listbox" ? "listbox" : "menu";
@@ -427,23 +493,36 @@ class m extends c {
427
493
  set mode(o) {
428
494
  o ? this.setAttribute("mode", o) : this.removeAttribute("mode");
429
495
  }
430
- get labelId() {
431
- return this.getAttribute("label-id");
496
+ /**
497
+ * Optional accessible name for the menu list. A menu has no intrinsic text of
498
+ * its own, so unlike the form toggles this is genuinely useful — but a host
499
+ * aria-label wins, and aria-labelledby on the host (tier 2) beats both.
500
+ */
501
+ get inputLabel() {
502
+ return this._inputLabel;
432
503
  }
433
- set labelId(o) {
434
- o ? this.setAttribute("label-id", o) : this.removeAttribute("label-id");
504
+ set inputLabel(o) {
505
+ const r = o ?? null;
506
+ this._inputLabel !== r && (this._inputLabel = r, this.requestUpdate());
435
507
  }
508
+ #d;
436
509
  connectedCallback() {
437
510
  super.connectedCallback(), this.addEventListener("click", this.#a), this.addEventListener("keydown", this.#i);
438
511
  }
439
512
  disconnectedCallback() {
440
513
  super.disconnectedCallback(), this.removeEventListener("click", this.#a), this.removeEventListener("keydown", this.#i);
441
514
  }
442
- attributeChangedCallback(o, r, d) {
443
- super.attributeChangedCallback(o, r, d), o === "max-height" ? d ? this.style.setProperty("--mp-dropdown-max-height", `${d}px`) : this.style.removeProperty("--mp-dropdown-max-height") : (o === "mode" || o === "label-id") && (this.requestUpdate(), this.#e());
515
+ attributeChangedCallback(o, r, e) {
516
+ super.attributeChangedCallback(o, r, e), o === "max-height" ? e ? this.style.setProperty("--mp-dropdown-max-height", `${e}px`) : this.style.removeProperty("--mp-dropdown-max-height") : o === "aria-labelledby" || o === "aria-describedby" ? this.#d.syncReferences() : o === "input-label" ? (this._inputLabel = e, this.requestUpdate()) : (o === "mode" || o === "aria-label") && (this.requestUpdate(), this.#t());
444
517
  }
445
518
  firstUpdated() {
446
- this.#e();
519
+ this.#t();
520
+ }
521
+ // After every render: a reference attribute set in the HTML fires
522
+ // attributeChangedCallback before the <ul> exists, so the assignment there
523
+ // finds no target — this pass is what actually lands it.
524
+ updated() {
525
+ this.#d.syncReferences();
447
526
  }
448
527
  // --- item bookkeeping ------------------------------------------------------
449
528
  /**
@@ -453,7 +532,7 @@ class m extends c {
453
532
  * element). Items belonging to a nested `<mp-dropdown-menu>` (navbar submenus)
454
533
  * are excluded so this menu only manages its own.
455
534
  */
456
- #d() {
535
+ #e() {
457
536
  return Array.from(this.querySelectorAll(".dropdown-item")).filter(
458
537
  (o) => o.closest("mp-dropdown-menu") === this
459
538
  );
@@ -465,98 +544,64 @@ class m extends c {
465
544
  #o(o) {
466
545
  return o.classList.contains("disabled") || o.getAttribute("aria-disabled") === "true";
467
546
  }
468
- #p(o) {
547
+ #b(o) {
469
548
  const r = o.value;
470
- return r !== void 0 ? r : o.dataset.value;
549
+ return o instanceof HTMLLIElement && !o.hasAttribute("value") ? o.dataset.value ?? (r !== 0 ? r : void 0) : r !== void 0 ? r : o.dataset.value;
471
550
  }
472
- #l = () => {
473
- this.#e();
474
- };
551
+ #p;
475
552
  /** Assign roles, aria, and the roving tabindex across the current items. */
476
- #e() {
477
- const o = this.#d();
478
- if (o.length === 0) return;
479
- if (!o[this.#r] || this.#o(o[this.#r])) {
480
- const d = o.findIndex((t) => !this.#o(t));
481
- this.#r = d >= 0 ? d : 0;
553
+ #t() {
554
+ const o = (t) => [...this.querySelectorAll(t)].filter(
555
+ (d) => d.closest("mp-dropdown-menu") === this && !d.hasAttribute("role")
556
+ );
557
+ o(".dropdown-header").forEach((t) => t.setAttribute("role", "presentation")), o(".dropdown-divider").forEach((t) => t.setAttribute("role", "separator"));
558
+ const r = this.#e();
559
+ if (r.length === 0) return;
560
+ if (!r[this.#r] || this.#o(r[this.#r])) {
561
+ const t = r.findIndex((d) => !this.#o(d));
562
+ this.#r = t >= 0 ? t : 0;
482
563
  }
483
- const r = this.mode === "listbox";
484
- o.forEach((d, t) => {
485
- const e = this.#n(d);
486
- e !== d && d.setAttribute("role", "presentation"), e.setAttribute("role", r ? "option" : "menuitem");
487
- const n = this.#o(d);
488
- r ? e.setAttribute("aria-selected", d.classList.contains("active") ? "true" : "false") : e.removeAttribute("aria-selected"), n ? e.setAttribute("aria-disabled", "true") : e.removeAttribute("aria-disabled");
489
- const s = !r && t === this.#r && !n;
490
- e.setAttribute("tabindex", s ? "0" : "-1");
564
+ const e = this.mode === "listbox";
565
+ r.forEach((t, d) => {
566
+ const n = this.#n(t);
567
+ n !== t && t.setAttribute("role", "presentation"), n.setAttribute("role", e ? "option" : "menuitem");
568
+ const i = this.#o(t);
569
+ e ? n.setAttribute("aria-selected", t.classList.contains("active") ? "true" : "false") : n.removeAttribute("aria-selected"), i ? n.setAttribute("aria-disabled", "true") : n.removeAttribute("aria-disabled");
570
+ const a = !e && d === this.#r && !i;
571
+ n.setAttribute("tabindex", a ? "0" : "-1");
491
572
  });
492
573
  }
493
- // --- keyboard (menu mode) --------------------------------------------------
494
- #i = (o) => {
495
- if (this.mode === "menu")
496
- switch (o.key) {
497
- case "ArrowDown":
498
- this.#s(1), o.preventDefault();
499
- break;
500
- case "ArrowUp":
501
- this.#s(-1), o.preventDefault();
502
- break;
503
- case "Home":
504
- this.#t(this.#d().findIndex((r) => !this.#o(r))), o.preventDefault();
505
- break;
506
- case "End": {
507
- const r = this.#d();
508
- for (let d = r.length - 1; d >= 0; d--)
509
- if (!this.#o(r[d])) {
510
- this.#t(d);
511
- break;
512
- }
513
- o.preventDefault();
514
- break;
515
- }
516
- }
517
- };
518
- #s(o) {
519
- const r = this.#d(), d = r.length;
520
- if (d === 0) return;
574
+ #i;
575
+ #l(o) {
576
+ const r = this.#e(), e = r.length;
577
+ if (e === 0) return;
521
578
  let t = this.#r;
522
- for (let e = 0; e < d; e++)
523
- if (t = (t + o + d) % d, !this.#o(r[t])) {
524
- this.#t(t);
579
+ for (let d = 0; d < e; d++)
580
+ if (t = (t + o + e) % e, !this.#o(r[t])) {
581
+ this.#s(t);
525
582
  return;
526
583
  }
527
584
  }
528
- #t(o) {
529
- const r = this.#d();
530
- o < 0 || o >= r.length || (this.#r = o, this.#e(), this.#n(r[o]).focus());
585
+ #s(o) {
586
+ const r = this.#e();
587
+ o < 0 || o >= r.length || (this.#r = o, this.#t(), this.#n(r[o]).focus());
531
588
  }
532
- // --- activation ------------------------------------------------------------
533
- #a = (o) => {
534
- const r = o.composedPath().find(
535
- (d) => d instanceof HTMLElement && d.classList.contains("dropdown-item")
536
- );
537
- !r || this.#o(r) || r.closest("mp-dropdown-menu") !== this || this.dispatchEvent(
538
- new CustomEvent("select", {
539
- detail: { item: r, value: this.#p(r) },
540
- bubbles: !0,
541
- composed: !0
542
- })
543
- );
544
- };
589
+ #a;
545
590
  render() {
546
- return b`
591
+ return c`
547
592
  <ul
548
593
  class="dropdown-menu show"
549
594
  role=${this.mode}
550
595
  part="menu"
551
- aria-labelledby=${this.labelId ?? l}
596
+ aria-label=${this.getAttribute("aria-label") ?? this._inputLabel ?? b}
552
597
  >
553
- <slot @slotchange=${this.#l}></slot>
598
+ <slot @slotchange=${this.#p}></slot>
554
599
  </ul>
555
600
  `;
556
601
  }
557
602
  }
558
- customElements.get("mp-dropdown-menu") || customElements.define("mp-dropdown-menu", m);
603
+ customElements.get("mp-dropdown-menu") || customElements.define("mp-dropdown-menu", u);
559
604
  export {
560
- m as MpDropdownMenu,
561
- w as dropdownMenuStyles
605
+ u as MpDropdownMenu,
606
+ h as dropdownMenuStyles
562
607
  };
@@ -24,7 +24,9 @@ import { DropdownMode } from '../types';
24
24
  * Attributes:
25
25
  * - `mode` — `menu` (default) | `listbox`.
26
26
  * - `max-height` — px cap; maps to `--mp-dropdown-max-height` (scrolls beyond).
27
- * - `label-id` — id of an external label, set as `aria-labelledby` on the list.
27
+ * - naming: `aria-label` / `input-label`, or `aria-labelledby` on the host
28
+ * (resolved into cross-root element references). The old `label-id` is gone —
29
+ * it copied an IDREF into the shadow root, where it resolved to nothing.
28
30
  *
29
31
  * An item is disabled via the `.disabled` class (or `aria-disabled="true"`), and
30
32
  * carries an opaque `value` via a `value` JS property or a `data-value` attribute.
@@ -36,11 +38,18 @@ export declare class MpDropdownMenu extends MpDropdownElement {
36
38
  static get observedAttributes(): string[];
37
39
  get mode(): DropdownMode;
38
40
  set mode(v: DropdownMode);
39
- get labelId(): string | null;
40
- set labelId(v: string | null);
41
+ private _inputLabel;
42
+ /**
43
+ * Optional accessible name for the menu list. A menu has no intrinsic text of
44
+ * its own, so unlike the form toggles this is genuinely useful — but a host
45
+ * aria-label wins, and aria-labelledby on the host (tier 2) beats both.
46
+ */
47
+ get inputLabel(): string | null;
48
+ set inputLabel(v: string | null);
41
49
  connectedCallback(): void;
42
50
  disconnectedCallback(): void;
43
51
  attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
44
52
  protected firstUpdated(): void;
53
+ protected updated(): void;
45
54
  render(): import('lit-html').TemplateResult<1>;
46
55
  }