@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.
- 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.mjs +180 -174
- package/accordion/src/components/mp-accordion.d.ts +18 -13
- package/calendar/index.mjs +1 -1
- package/calendar/src/mp-calendar.element.d.ts +2 -0
- package/carousel/index.mjs +211 -164
- package/carousel/src/components/mp-carousel.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 +9 -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/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/timeline/index.mjs
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { unsafeCSS as
|
|
1
|
+
import { unsafeCSS as g, LitElement as _, nothing as a, html as m, isServer as u } from "lit";
|
|
2
|
+
import "lit/directives/ref.js";
|
|
3
|
+
import { H as x } from "../chunks/host-aria-WSGs7SPQ.mjs";
|
|
2
4
|
import { resolveSides as b } from "../timeline-core/index.mjs";
|
|
3
|
-
const S =
|
|
5
|
+
const S = g(`:host {
|
|
4
6
|
display: block;
|
|
5
7
|
box-sizing: border-box;
|
|
6
8
|
--mp-tl-gap: 1rem;
|
|
@@ -47,7 +49,7 @@ const S = f(`:host {
|
|
|
47
49
|
|
|
48
50
|
:host([orientation=horizontal][reverse]) .timeline {
|
|
49
51
|
flex-direction: row-reverse;
|
|
50
|
-
}`),
|
|
52
|
+
}`), I = g(`:host {
|
|
51
53
|
display: block;
|
|
52
54
|
box-sizing: border-box;
|
|
53
55
|
outline: none;
|
|
@@ -205,12 +207,12 @@ const S = f(`:host {
|
|
|
205
207
|
min-height: 0;
|
|
206
208
|
min-width: var(--mp-tl-gap);
|
|
207
209
|
}`);
|
|
208
|
-
class
|
|
210
|
+
class y extends _ {
|
|
209
211
|
constructor() {
|
|
210
212
|
super(...arguments), this._itemId = null, this._title = null, this._description = null, this._time = null, this._icon = null, this._color = null, this._itemClass = null, this._disabled = !1, this._selected = !1;
|
|
211
213
|
}
|
|
212
214
|
static {
|
|
213
|
-
this.styles = [
|
|
215
|
+
this.styles = [I];
|
|
214
216
|
}
|
|
215
217
|
static get observedAttributes() {
|
|
216
218
|
return [
|
|
@@ -367,24 +369,26 @@ class I extends _ {
|
|
|
367
369
|
`;
|
|
368
370
|
}
|
|
369
371
|
}
|
|
370
|
-
typeof customElements < "u" && !customElements.get("mp-timeline-item") && customElements.define("mp-timeline-item",
|
|
372
|
+
typeof customElements < "u" && !customElements.get("mp-timeline-item") && customElements.define("mp-timeline-item", y);
|
|
371
373
|
const p = /* @__PURE__ */ new Set([
|
|
372
374
|
"start",
|
|
373
375
|
"end",
|
|
374
376
|
"alternate",
|
|
375
377
|
"alternate-reverse"
|
|
376
|
-
]),
|
|
377
|
-
class
|
|
378
|
+
]), f = /* @__PURE__ */ new Set(["none", "single", "multiple"]);
|
|
379
|
+
class k extends _ {
|
|
378
380
|
constructor() {
|
|
379
|
-
super(...arguments), this._items = [], this._selectedSet = /* @__PURE__ */ new Set(), this._orientation = "vertical", this._align = "start", this._reverse = !1, this._selectable = "none", this.
|
|
381
|
+
super(...arguments), this._items = [], this._selectedSet = /* @__PURE__ */ new Set(), this._orientation = "vertical", this._align = "start", this._reverse = !1, this._selectable = "none", this._activatable = !1, this._isServerSide = !1, this._inputLabel = null, this.hostAria = new x(this, {
|
|
382
|
+
referenceTarget: () => this.renderRoot?.querySelector(".timeline") ?? null
|
|
383
|
+
}), this._selectionExplicit = !1, this._selectionSeeded = !1, this._activeIndex = -1, this._anchorIndex = -1, this._observer = null, this.onSlotChange = () => {
|
|
380
384
|
this.seedDeclarativeSelection(), this.enhanceDeclarativeItems();
|
|
381
385
|
}, this.onClick = (t) => {
|
|
382
386
|
const { el: e, index: i } = this.itemFromEvent(t);
|
|
383
387
|
if (!e || i < 0 || e.hasAttribute("disabled")) return;
|
|
384
|
-
const
|
|
388
|
+
const n = this.modelFor(e, i);
|
|
385
389
|
if (this.dispatchEvent(
|
|
386
390
|
new CustomEvent("item-click", {
|
|
387
|
-
detail: { item:
|
|
391
|
+
detail: { item: n, index: i, originalEvent: t },
|
|
388
392
|
bubbles: !0,
|
|
389
393
|
composed: !0
|
|
390
394
|
})
|
|
@@ -393,7 +397,11 @@ class y extends _ {
|
|
|
393
397
|
this.applySelection(i, { toggle: s.ctrlKey || s.metaKey, range: s.shiftKey }), this.setActiveIndex(i);
|
|
394
398
|
}
|
|
395
399
|
}, this.onKeydown = (t) => {
|
|
396
|
-
if (this._selectable === "none")
|
|
400
|
+
if (this._selectable === "none") {
|
|
401
|
+
if (!this._activatable) return;
|
|
402
|
+
this.onActivatableKeydown(t);
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
397
405
|
const e = this.itemElements;
|
|
398
406
|
if (!e.length) return;
|
|
399
407
|
const i = this.itemFromEvent(t).index;
|
|
@@ -438,9 +446,31 @@ class y extends _ {
|
|
|
438
446
|
"align",
|
|
439
447
|
"reverse",
|
|
440
448
|
"selectable",
|
|
441
|
-
|
|
449
|
+
// Opt-in: click-only consumers (no selection) whose items must still be
|
|
450
|
+
// keyboard-reachable. The WC cannot introspect whether anyone listens to
|
|
451
|
+
// item-click, so this cannot default on without adding dead tab stops.
|
|
452
|
+
"activatable",
|
|
453
|
+
"is-server-side",
|
|
454
|
+
// Naming: copied onto the role-bearing .timeline node (list/listbox).
|
|
455
|
+
// Host aria-label wins over input-label, as everywhere.
|
|
456
|
+
"aria-label",
|
|
457
|
+
"input-label",
|
|
458
|
+
"aria-labelledby",
|
|
459
|
+
"aria-describedby"
|
|
442
460
|
];
|
|
443
461
|
}
|
|
462
|
+
/**
|
|
463
|
+
* Optional accessible name for the timeline list. A timeline has no intrinsic
|
|
464
|
+
* text of its own, so the name is the consumer's to give (optional — degrades
|
|
465
|
+
* to an unnamed list rather than an invented name).
|
|
466
|
+
*/
|
|
467
|
+
get inputLabel() {
|
|
468
|
+
return this._inputLabel;
|
|
469
|
+
}
|
|
470
|
+
set inputLabel(t) {
|
|
471
|
+
const e = t ?? null;
|
|
472
|
+
this._inputLabel !== e && (this._inputLabel = e, this.requestUpdate());
|
|
473
|
+
}
|
|
444
474
|
// ----- properties --------------------------------------------------------
|
|
445
475
|
get items() {
|
|
446
476
|
return this._items;
|
|
@@ -479,7 +509,7 @@ class y extends _ {
|
|
|
479
509
|
return this._selectable;
|
|
480
510
|
}
|
|
481
511
|
set selectable(t) {
|
|
482
|
-
const e =
|
|
512
|
+
const e = f.has(t) ? t : "none";
|
|
483
513
|
this._selectable !== e && (this._selectable = e, this.reflectString("selectable", e), this.requestUpdate());
|
|
484
514
|
}
|
|
485
515
|
get isServerSide() {
|
|
@@ -516,17 +546,27 @@ class y extends _ {
|
|
|
516
546
|
this._reverse = i !== null && i !== "false";
|
|
517
547
|
break;
|
|
518
548
|
case "selectable":
|
|
519
|
-
this._selectable = i &&
|
|
549
|
+
this._selectable = i && f.has(i) ? i : "none";
|
|
520
550
|
break;
|
|
521
551
|
case "is-server-side":
|
|
522
552
|
this._isServerSide = i !== null && i !== "false";
|
|
523
553
|
break;
|
|
554
|
+
case "activatable":
|
|
555
|
+
this._activatable = i !== null && i !== "false";
|
|
556
|
+
break;
|
|
557
|
+
case "input-label":
|
|
558
|
+
this._inputLabel = i;
|
|
559
|
+
break;
|
|
560
|
+
case "aria-labelledby":
|
|
561
|
+
case "aria-describedby":
|
|
562
|
+
this.hostAria.syncReferences();
|
|
563
|
+
break;
|
|
524
564
|
}
|
|
525
565
|
this.requestUpdate();
|
|
526
566
|
}
|
|
527
567
|
}
|
|
528
568
|
updated() {
|
|
529
|
-
!u && this._items.length === 0 && this.enhanceDeclarativeItems();
|
|
569
|
+
!u && this._items.length === 0 && this.enhanceDeclarativeItems(), this.hostAria.syncReferences();
|
|
530
570
|
}
|
|
531
571
|
reflectString(t, e) {
|
|
532
572
|
this.getAttribute(t) !== e && this.setAttribute(t, e);
|
|
@@ -546,12 +586,15 @@ class y extends _ {
|
|
|
546
586
|
}
|
|
547
587
|
// ----- render ------------------------------------------------------------
|
|
548
588
|
render() {
|
|
549
|
-
const t = this._selectable !== "none" ? "listbox" : "list";
|
|
589
|
+
const t = this._selectable !== "none" ? "listbox" : this._activatable ? "group" : "list";
|
|
550
590
|
return m`
|
|
551
591
|
<div
|
|
552
592
|
class="timeline"
|
|
553
593
|
role=${t}
|
|
554
|
-
aria-
|
|
594
|
+
aria-label=${this.getAttribute("aria-label") ?? this._inputLabel ?? a}
|
|
595
|
+
aria-orientation=${// Only widgets take aria-orientation — on role=list/group it is an
|
|
596
|
+
// invalid pairing (axe aria-allowed-attr, critical).
|
|
597
|
+
t === "listbox" ? this._orientation : a}
|
|
555
598
|
aria-multiselectable=${this._selectable === "multiple" ? "true" : a}
|
|
556
599
|
@click=${this.onClick}
|
|
557
600
|
@keydown=${this.onKeydown}
|
|
@@ -561,27 +604,27 @@ class y extends _ {
|
|
|
561
604
|
`;
|
|
562
605
|
}
|
|
563
606
|
renderDataItems() {
|
|
564
|
-
const t = this._items, e = this._orientation, i = this._selectable,
|
|
607
|
+
const t = this._items, e = this._orientation, i = this._selectable, n = this._reverse, s = b(t.length, this._align, n), l = this.resolvedActiveIndex(t.length, (r) => !t[r].disabled);
|
|
565
608
|
return m`
|
|
566
|
-
${t.map((r,
|
|
567
|
-
const c = this.idForItem(r,
|
|
609
|
+
${t.map((r, o) => {
|
|
610
|
+
const c = this.idForItem(r, o), h = n ? o === 0 : o === t.length - 1, d = i !== "none" && this.isSelected(c), A = r.time instanceof Date ? r.time.toLocaleDateString() : r.time;
|
|
568
611
|
return m`<mp-timeline-item
|
|
569
612
|
item-id=${r.id ?? a}
|
|
570
613
|
title=${r.title ?? a}
|
|
571
614
|
description=${r.description ?? a}
|
|
572
|
-
time=${
|
|
615
|
+
time=${A ?? a}
|
|
573
616
|
icon=${r.icon ?? a}
|
|
574
617
|
color=${r.color ?? a}
|
|
575
618
|
item-class=${r.cssClass ?? a}
|
|
576
619
|
?disabled=${!!r.disabled}
|
|
577
|
-
side=${s[
|
|
620
|
+
side=${s[o]}
|
|
578
621
|
orientation=${e}
|
|
579
|
-
?last=${
|
|
580
|
-
role=${i !== "none" ? "option" : "listitem"}
|
|
581
|
-
?selected=${
|
|
582
|
-
aria-selected=${i !== "none" ?
|
|
583
|
-
tabindex=${i !== "none" ?
|
|
584
|
-
data-index=${
|
|
622
|
+
?last=${h}
|
|
623
|
+
role=${i !== "none" ? "option" : this._activatable ? "button" : "listitem"}
|
|
624
|
+
?selected=${d}
|
|
625
|
+
aria-selected=${i !== "none" ? d ? "true" : "false" : a}
|
|
626
|
+
tabindex=${i !== "none" || this._activatable ? o === l ? "0" : "-1" : a}
|
|
627
|
+
data-index=${o}
|
|
585
628
|
></mp-timeline-item>`;
|
|
586
629
|
})}
|
|
587
630
|
`;
|
|
@@ -603,22 +646,63 @@ class y extends _ {
|
|
|
603
646
|
enhanceDeclarativeItems() {
|
|
604
647
|
const t = this.declarativeItems;
|
|
605
648
|
if (!t.length) return;
|
|
606
|
-
const e = this._orientation, i = this._selectable,
|
|
607
|
-
t.forEach((
|
|
608
|
-
if (
|
|
609
|
-
const
|
|
610
|
-
|
|
649
|
+
const e = this._orientation, i = this._selectable, n = this._reverse, s = b(t.length, this._align, n), l = n ? 0 : t.length - 1, r = this.resolvedActiveIndex(t.length, (o) => !t[o].hasAttribute("disabled"));
|
|
650
|
+
t.forEach((o, c) => {
|
|
651
|
+
if (o.setAttribute("side", s[c]), o.setAttribute("orientation", e), c === l ? o.setAttribute("last", "") : o.removeAttribute("last"), i !== "none") {
|
|
652
|
+
const h = this.isSelected(this.idForElement(o, c));
|
|
653
|
+
o.setAttribute("role", "option"), h ? o.setAttribute("selected", "") : o.removeAttribute("selected"), o.setAttribute("aria-selected", h ? "true" : "false"), o.setAttribute("tabindex", c === r ? "0" : "-1");
|
|
611
654
|
} else
|
|
612
|
-
|
|
655
|
+
o.setAttribute("role", "listitem"), o.removeAttribute("aria-selected"), o.removeAttribute("tabindex");
|
|
613
656
|
});
|
|
614
657
|
}
|
|
658
|
+
/** The item-click emission shared by pointer and keyboard activation. */
|
|
659
|
+
emitItemClick(t, e) {
|
|
660
|
+
const i = this.itemElements[t];
|
|
661
|
+
if (!i || i.hasAttribute("disabled")) return;
|
|
662
|
+
const n = this.modelFor(i, t);
|
|
663
|
+
this.dispatchEvent(
|
|
664
|
+
new CustomEvent("item-click", {
|
|
665
|
+
detail: { item: n, index: t, originalEvent: e },
|
|
666
|
+
bubbles: !0,
|
|
667
|
+
composed: !0
|
|
668
|
+
})
|
|
669
|
+
);
|
|
670
|
+
}
|
|
671
|
+
/** Arrows rove; Enter/Space emit item-click — activation without selection. */
|
|
672
|
+
onActivatableKeydown(t) {
|
|
673
|
+
const e = this.itemElements;
|
|
674
|
+
if (!e.length) return;
|
|
675
|
+
const i = this.itemFromEvent(t).index;
|
|
676
|
+
switch (t.key) {
|
|
677
|
+
case "ArrowDown":
|
|
678
|
+
case "ArrowRight":
|
|
679
|
+
t.preventDefault(), this.moveFocus(i, 1, e);
|
|
680
|
+
return;
|
|
681
|
+
case "ArrowUp":
|
|
682
|
+
case "ArrowLeft":
|
|
683
|
+
t.preventDefault(), this.moveFocus(i, -1, e);
|
|
684
|
+
return;
|
|
685
|
+
case "Home":
|
|
686
|
+
t.preventDefault(), this.moveFocusTo(this.firstFocusable(e), e);
|
|
687
|
+
return;
|
|
688
|
+
case "End":
|
|
689
|
+
t.preventDefault(), this.moveFocusTo(this.lastFocusable(e), e);
|
|
690
|
+
return;
|
|
691
|
+
case "Enter":
|
|
692
|
+
case " ": {
|
|
693
|
+
if (i < 0) return;
|
|
694
|
+
t.preventDefault(), this.emitItemClick(i, t);
|
|
695
|
+
return;
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
}
|
|
615
699
|
itemFromEvent(t) {
|
|
616
700
|
const i = t.composedPath().find(
|
|
617
701
|
(s) => s instanceof HTMLElement && s.tagName === "MP-TIMELINE-ITEM"
|
|
618
702
|
);
|
|
619
703
|
if (!i) return { el: null, index: -1 };
|
|
620
|
-
const
|
|
621
|
-
return { el: i, index:
|
|
704
|
+
const n = this.itemElements.indexOf(i);
|
|
705
|
+
return { el: i, index: n };
|
|
622
706
|
}
|
|
623
707
|
modelFor(t, e) {
|
|
624
708
|
return this._items.length ? this._items[e] : {
|
|
@@ -633,16 +717,16 @@ class y extends _ {
|
|
|
633
717
|
}
|
|
634
718
|
// ----- selection ---------------------------------------------------------
|
|
635
719
|
applySelection(t, e) {
|
|
636
|
-
const i = this.itemElements,
|
|
637
|
-
if (!
|
|
638
|
-
const s = this.idForId(t,
|
|
720
|
+
const i = this.itemElements, n = i[t];
|
|
721
|
+
if (!n || n.hasAttribute("disabled")) return;
|
|
722
|
+
const s = this.idForId(t, n), l = new Set(this._selectedSet);
|
|
639
723
|
if (this._selectable === "single")
|
|
640
724
|
this._selectedSet = /* @__PURE__ */ new Set([s]);
|
|
641
725
|
else if (e.range && this._anchorIndex >= 0) {
|
|
642
|
-
const [r,
|
|
643
|
-
for (let
|
|
644
|
-
const
|
|
645
|
-
|
|
726
|
+
const [r, o] = [Math.min(this._anchorIndex, t), Math.max(this._anchorIndex, t)], c = new Set(this._selectedSet);
|
|
727
|
+
for (let h = r; h <= o; h++) {
|
|
728
|
+
const d = i[h];
|
|
729
|
+
d && !d.hasAttribute("disabled") && c.add(this.idForId(h, d));
|
|
646
730
|
}
|
|
647
731
|
this._selectedSet = c;
|
|
648
732
|
} else if (e.toggle) {
|
|
@@ -656,15 +740,15 @@ class y extends _ {
|
|
|
656
740
|
return this._items.length ? this.idForItem(this._items[t], t) : this.idForElement(e, t);
|
|
657
741
|
}
|
|
658
742
|
emitSelectionChange(t) {
|
|
659
|
-
const e = this._selectedSet, i = [...e].filter((l) => !t.has(l)),
|
|
660
|
-
if (!i.length && !
|
|
743
|
+
const e = this._selectedSet, i = [...e].filter((l) => !t.has(l)), n = [...t].filter((l) => !e.has(l));
|
|
744
|
+
if (!i.length && !n.length) return;
|
|
661
745
|
const s = (l) => l.map((r) => this.modelById(r)).filter((r) => r !== null);
|
|
662
746
|
this.dispatchEvent(
|
|
663
747
|
new CustomEvent("selection-change", {
|
|
664
748
|
detail: {
|
|
665
749
|
selected: s([...e]),
|
|
666
750
|
added: s(i),
|
|
667
|
-
removed: s(
|
|
751
|
+
removed: s(n)
|
|
668
752
|
},
|
|
669
753
|
bubbles: !0,
|
|
670
754
|
composed: !0
|
|
@@ -673,10 +757,10 @@ class y extends _ {
|
|
|
673
757
|
}
|
|
674
758
|
modelById(t) {
|
|
675
759
|
if (this._items.length) {
|
|
676
|
-
const
|
|
677
|
-
return
|
|
760
|
+
const n = this._items.findIndex((s, l) => this.idForItem(s, l) === t);
|
|
761
|
+
return n >= 0 ? this._items[n] : null;
|
|
678
762
|
}
|
|
679
|
-
const e = this.declarativeItems, i = e.findIndex((
|
|
763
|
+
const e = this.declarativeItems, i = e.findIndex((n, s) => this.idForElement(n, s) === t);
|
|
680
764
|
return i >= 0 ? this.modelFor(e[i], i) : null;
|
|
681
765
|
}
|
|
682
766
|
// ----- roving tabindex ---------------------------------------------------
|
|
@@ -706,11 +790,11 @@ class y extends _ {
|
|
|
706
790
|
return -1;
|
|
707
791
|
}
|
|
708
792
|
}
|
|
709
|
-
typeof customElements < "u" && !customElements.get("mp-timeline") && customElements.define("mp-timeline",
|
|
793
|
+
typeof customElements < "u" && !customElements.get("mp-timeline") && customElements.define("mp-timeline", k);
|
|
710
794
|
export {
|
|
711
|
-
|
|
712
|
-
|
|
795
|
+
k as MpTimeline,
|
|
796
|
+
y as MpTimelineItem,
|
|
713
797
|
b as resolveSides,
|
|
714
|
-
|
|
798
|
+
I as timelineItemStyles,
|
|
715
799
|
S as timelineStyles
|
|
716
800
|
};
|
|
@@ -23,7 +23,18 @@ export declare class MpTimeline extends LitElement {
|
|
|
23
23
|
private _align;
|
|
24
24
|
private _reverse;
|
|
25
25
|
private _selectable;
|
|
26
|
+
private _activatable;
|
|
26
27
|
private _isServerSide;
|
|
28
|
+
private _inputLabel;
|
|
29
|
+
/** Tier-2 naming: references resolve in the host's tree, land on the list node. */
|
|
30
|
+
private readonly hostAria;
|
|
31
|
+
/**
|
|
32
|
+
* Optional accessible name for the timeline list. A timeline has no intrinsic
|
|
33
|
+
* text of its own, so the name is the consumer's to give (optional — degrades
|
|
34
|
+
* to an unnamed list rather than an invented name).
|
|
35
|
+
*/
|
|
36
|
+
get inputLabel(): string | null;
|
|
37
|
+
set inputLabel(value: string | null);
|
|
27
38
|
/** True once a consumer assigns `selectedIds` — suppresses declarative seeding. */
|
|
28
39
|
private _selectionExplicit;
|
|
29
40
|
private _selectionSeeded;
|
|
@@ -64,6 +75,10 @@ export declare class MpTimeline extends LitElement {
|
|
|
64
75
|
private seedDeclarativeSelection;
|
|
65
76
|
private enhanceDeclarativeItems;
|
|
66
77
|
private onClick;
|
|
78
|
+
/** The item-click emission shared by pointer and keyboard activation. */
|
|
79
|
+
private emitItemClick;
|
|
80
|
+
/** Arrows rove; Enter/Space emit item-click — activation without selection. */
|
|
81
|
+
private onActivatableKeydown;
|
|
67
82
|
private onKeydown;
|
|
68
83
|
private itemFromEvent;
|
|
69
84
|
private modelFor;
|
package/timepicker/index.mjs
CHANGED
|
@@ -9,7 +9,15 @@ export type Hour12Mode = boolean | 'auto';
|
|
|
9
9
|
* `role="option"` with `aria-selected` reflecting the currently selected time.
|
|
10
10
|
*
|
|
11
11
|
* Keyboard model (APG Listbox): ArrowUp/Down ±1 slot, Home/End first/last,
|
|
12
|
-
* PageUp/Down ±1 hour, Enter/Space selects.
|
|
12
|
+
* PageUp/Down ±1 hour, Enter/Space selects (native button activation).
|
|
13
|
+
*
|
|
14
|
+
* Navigation moves REAL focus between the option buttons via roving tabindex
|
|
15
|
+
* (the shared RovingFocus primitive). The previous model kept focus on the host
|
|
16
|
+
* and pointed aria-activedescendant at option ids — but the host holds the
|
|
17
|
+
* attribute while the ids live in its shadow root, and an IDREF resolves only
|
|
18
|
+
* in the holder's own tree, so the reference was permanently dangling and every
|
|
19
|
+
* arrow press announced NOTHING. Real focus crosses shadow boundaries; IDREFs
|
|
20
|
+
* cannot. This was the audit's canonical present-but-inert finding.
|
|
13
21
|
*
|
|
14
22
|
* Events:
|
|
15
23
|
* - `selected-time-change` fires on click / Enter / Space (bubbles, composes).
|
|
@@ -50,11 +58,14 @@ export declare class MpTimeListElement extends LitElement {
|
|
|
50
58
|
hour12: Hour12Mode;
|
|
51
59
|
locale: string | undefined;
|
|
52
60
|
private _focusedMinutes;
|
|
53
|
-
private pendingFocusMove;
|
|
54
61
|
private readonly instanceId;
|
|
62
|
+
/** One tab stop for the whole list; arrows move focus AND the tab stop. */
|
|
63
|
+
private readonly roving;
|
|
55
64
|
connectedCallback(): void;
|
|
56
65
|
disconnectedCallback(): void;
|
|
57
66
|
updated(): void;
|
|
67
|
+
/** Focus the list = focus its active option (the popup calls host.focus()). */
|
|
68
|
+
focus(options?: FocusOptions): void;
|
|
58
69
|
/** All slots between 00:00 and 24:00 - step, in step-minute increments. */
|
|
59
70
|
private slots;
|
|
60
71
|
private formatTime;
|
|
@@ -69,8 +80,6 @@ export declare class MpTimeListElement extends LitElement {
|
|
|
69
80
|
/** Selects a slot programmatically; emits event. No-op if disabled or out-of-range. */
|
|
70
81
|
selectMinutes(minutes: number): void;
|
|
71
82
|
private onHostKeyDown;
|
|
72
|
-
private onHostFocus;
|
|
73
|
-
private scrollFocusedIntoView;
|
|
74
83
|
protected render(): TemplateResult;
|
|
75
84
|
private renderSlot;
|
|
76
85
|
}
|
|
@@ -55,6 +55,26 @@ export declare class MpTimepickerElement extends LitElement {
|
|
|
55
55
|
type: StringConstructor;
|
|
56
56
|
reflect: boolean;
|
|
57
57
|
};
|
|
58
|
+
inputLabel: {
|
|
59
|
+
attribute: string;
|
|
60
|
+
type: StringConstructor;
|
|
61
|
+
reflect: boolean;
|
|
62
|
+
};
|
|
63
|
+
ariaLabelForRender: {
|
|
64
|
+
attribute: string;
|
|
65
|
+
type: StringConstructor;
|
|
66
|
+
reflect: boolean;
|
|
67
|
+
};
|
|
68
|
+
ariaLabelledByForSync: {
|
|
69
|
+
attribute: string;
|
|
70
|
+
type: StringConstructor;
|
|
71
|
+
reflect: boolean;
|
|
72
|
+
};
|
|
73
|
+
ariaDescribedByForSync: {
|
|
74
|
+
attribute: string;
|
|
75
|
+
type: StringConstructor;
|
|
76
|
+
reflect: boolean;
|
|
77
|
+
};
|
|
58
78
|
};
|
|
59
79
|
selectedTime: Date | null;
|
|
60
80
|
step: TimeStep;
|
|
@@ -65,8 +85,17 @@ export declare class MpTimepickerElement extends LitElement {
|
|
|
65
85
|
disabled: boolean;
|
|
66
86
|
placeholder: string;
|
|
67
87
|
triggerLabel: string;
|
|
88
|
+
/** Accessible name for the readonly display input — the one node that had none. */
|
|
89
|
+
inputLabel: string;
|
|
90
|
+
ariaLabelForRender: string | null;
|
|
91
|
+
ariaLabelledByForSync: string | null;
|
|
92
|
+
ariaDescribedByForSync: string | null;
|
|
68
93
|
private readonly instanceId;
|
|
69
94
|
private readonly popupId;
|
|
95
|
+
private displayInputEl?;
|
|
96
|
+
/** Tier-2 naming: host aria-labelledby/-describedby resolve to the display input. */
|
|
97
|
+
private readonly hostAria;
|
|
98
|
+
protected updated(): void;
|
|
70
99
|
private triggerEl?;
|
|
71
100
|
private inputGroupEl?;
|
|
72
101
|
private popupEl?;
|
package/toggle-button/index.mjs
CHANGED
|
@@ -5,6 +5,7 @@ export interface ToggleChangeEventDetail {
|
|
|
5
5
|
checked: boolean;
|
|
6
6
|
value: string | null;
|
|
7
7
|
}
|
|
8
|
+
declare const MpToggleButton_base: typeof LitElement & (new (...args: any[]) => import('@mintplayer/web-components/a11y').FormAssociatedElement);
|
|
8
9
|
/**
|
|
9
10
|
* `<mp-toggle-button>` — a single Bootstrap-styled on/off button using the
|
|
10
11
|
* `btn-check` + `label.btn` pattern. Acts as both a usable standalone WC
|
|
@@ -16,7 +17,7 @@ export interface ToggleChangeEventDetail {
|
|
|
16
17
|
* Emits a native-style `change` event with
|
|
17
18
|
* `detail: { checked, value }` when toggled.
|
|
18
19
|
*/
|
|
19
|
-
export declare class MpToggleButton extends
|
|
20
|
+
export declare class MpToggleButton extends MpToggleButton_base {
|
|
20
21
|
static styles: import('lit').CSSResult[];
|
|
21
22
|
static shadowRootOptions: {
|
|
22
23
|
delegatesFocus: boolean;
|
|
@@ -32,7 +33,31 @@ export declare class MpToggleButton extends LitElement {
|
|
|
32
33
|
private _name;
|
|
33
34
|
private _value;
|
|
34
35
|
private _color;
|
|
36
|
+
private _inputLabel;
|
|
37
|
+
private _errorText;
|
|
38
|
+
/** Tier-2 naming; references target the real control inside the shadow root. */
|
|
39
|
+
private readonly hostAria;
|
|
35
40
|
private readonly _inputId;
|
|
41
|
+
private readonly _errorId;
|
|
42
|
+
private readonly _inputRef;
|
|
43
|
+
/**
|
|
44
|
+
* Optional override for the inner <input>'s accessible name. Usually
|
|
45
|
+
* unnecessary — the slotted visible text names the control through the
|
|
46
|
+
* flat-tree label association (slotted-label spike; verdict in the plan). For an icon-only
|
|
47
|
+
* toggle, or a name that must differ from the visible text, set this.
|
|
48
|
+
*/
|
|
49
|
+
get inputLabel(): string | null;
|
|
50
|
+
set inputLabel(value: string | null);
|
|
51
|
+
/**
|
|
52
|
+
* Validation message, as `errorText` / `error-text`. Rendered as a
|
|
53
|
+
* `.invalid-feedback` node inside the shadow root and referenced from the inner
|
|
54
|
+
* `<input>` by `aria-errormessage` **and** `aria-describedby`, but only while
|
|
55
|
+
* `invalid` is set — `aria-errormessage` is meaningless on a control that is not
|
|
56
|
+
* `aria-invalid`. Text rather than a node, because a consumer's own element sits
|
|
57
|
+
* outside this shadow root where an IDREF from the input cannot reach it.
|
|
58
|
+
*/
|
|
59
|
+
get errorText(): string | null;
|
|
60
|
+
set errorText(value: string | null);
|
|
36
61
|
get checked(): boolean;
|
|
37
62
|
set checked(value: boolean);
|
|
38
63
|
get disabled(): boolean;
|
|
@@ -44,7 +69,13 @@ export declare class MpToggleButton extends LitElement {
|
|
|
44
69
|
get color(): ToggleButtonColor;
|
|
45
70
|
set color(value: ToggleButtonColor);
|
|
46
71
|
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
72
|
+
protected updated(): void;
|
|
47
73
|
render(): TemplateResult;
|
|
48
74
|
private reflectBoolean;
|
|
49
75
|
private onInputChange;
|
|
76
|
+
formValue(): string | null;
|
|
77
|
+
formReset(): void;
|
|
78
|
+
formRestore(state: string | FormData | File | null): void;
|
|
79
|
+
formValidityAnchor(): HTMLElement | null;
|
|
50
80
|
}
|
|
81
|
+
export {};
|