@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
@@ -37,6 +37,7 @@ export declare class MpCarousel extends LitElement {
37
37
  connectedCallback(): void;
38
38
  disconnectedCallback(): void;
39
39
  protected firstUpdated(): void;
40
+ protected updated(): void;
40
41
  attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
41
42
  /** Committed slide index. Setting it jumps without animation. */
42
43
  get index(): number;
@@ -1,4 +1,4 @@
1
- import { M as p } from "../chunks/mp-checkbox-BokLL7BS.mjs";
1
+ import { M as p } from "../chunks/mp-checkbox-Ph2mMRGz.mjs";
2
2
  export {
3
3
  p as MpCheckbox
4
4
  };
@@ -6,6 +6,7 @@ export interface CheckboxChangeEventDetail {
6
6
  indeterminate: boolean;
7
7
  value: string | null;
8
8
  }
9
+ declare const MpCheckbox_base: typeof LitElement & (new (...args: any[]) => import('@mintplayer/web-components/a11y').FormAssociatedElement);
9
10
  /**
10
11
  * `<mp-checkbox>` — a Bootstrap-styled checkbox with three visual variants
11
12
  * via the `type` attribute:
@@ -25,7 +26,14 @@ export interface CheckboxChangeEventDetail {
25
26
  *
26
27
  * Emits `change` with `detail: { checked, indeterminate, value }`.
27
28
  */
28
- export declare class MpCheckbox extends LitElement {
29
+ /**
30
+ * Form association (Phase F, decision D5): the mixin owns the internals
31
+ * plumbing; this class supplies the checkbox value shape. This is what makes
32
+ * the previously-dead `name` attribute actually submit, and what lets a
33
+ * `<fieldset disabled>` disable the control without a defeatable attribute
34
+ * (spike 0.3a).
35
+ */
36
+ export declare class MpCheckbox extends MpCheckbox_base {
29
37
  static styles: import('lit').CSSResult[];
30
38
  static shadowRootOptions: {
31
39
  delegatesFocus: boolean;
@@ -43,8 +51,52 @@ export declare class MpCheckbox extends LitElement {
43
51
  private _name;
44
52
  private _value;
45
53
  private _color;
54
+ private _inputLabel;
55
+ private _errorText;
56
+ /**
57
+ * Tier-2 naming. No `role` is passed: the inner <input> is the real control and
58
+ * already carries one, so a role on the host would announce the checkbox twice.
59
+ * References therefore target that <input> rather than the host's internals.
60
+ */
61
+ private readonly hostAria;
46
62
  private readonly _inputId;
63
+ private readonly _errorId;
47
64
  private readonly _inputRef;
65
+ /**
66
+ * Optional override for the inner `<input>`'s accessible name, as
67
+ * `inputLabel` / `input-label`. Standardised on this name across the library
68
+ * rather than `label`, because the value lands on the control *inside* the shadow
69
+ * root.
70
+ *
71
+ * **Usually unnecessary — do not reach for it by default.** The shadow `<label>`
72
+ * wraps the `<input>` and contains the `<slot>`, and accessible-name computation
73
+ * walks the *flat* tree, so slotted light-DOM text already names the control:
74
+ * `<mp-checkbox>Accept terms</mp-checkbox>` computes the name "Accept terms" with
75
+ * nothing else passed. Verified against Chromium's real accessibility tree in
76
+ * the slotted-label spike (verdict in docs/prd/screen-reader-accessibility-plan.md) — an earlier version of this comment claimed the
77
+ * opposite, on the assumption that the slot boundary broke the association. It
78
+ * does not.
79
+ *
80
+ * So this exists for the two cases that genuinely need it: a checkbox with **no**
81
+ * visible text, and a name that must differ from the visible text. When both are
82
+ * present this wins, which is the right precedence for an override.
83
+ */
84
+ get inputLabel(): string | null;
85
+ set inputLabel(value: string | null);
86
+ /**
87
+ * Validation message, as `errorText` / `error-text`. Rendered as a
88
+ * `.invalid-feedback` node inside the shadow root and referenced from the inner
89
+ * `<input>` by `aria-errormessage` **and** `aria-describedby` — but only while
90
+ * `invalid` is set, because `aria-errormessage` means nothing on a control that
91
+ * is not `aria-invalid`.
92
+ *
93
+ * Text rather than a node because the alternative does not work: a consumer's
94
+ * own `<small id="…">` lives outside this shadow root, and an IDREF from the
95
+ * inner input cannot reach it. On the Angular side `BsControlValidityDirective`
96
+ * fills this in from `NgControl.errors`.
97
+ */
98
+ get errorText(): string | null;
99
+ set errorText(value: string | null);
48
100
  get type(): MpCheckboxType;
49
101
  set type(value: MpCheckboxType);
50
102
  get checked(): boolean;
@@ -63,7 +115,13 @@ export declare class MpCheckbox extends LitElement {
63
115
  render(): TemplateResult;
64
116
  protected updated(): void;
65
117
  private renderCheckOrSwitch;
118
+ private errorFeedback;
66
119
  private renderToggleButton;
67
120
  private reflectBoolean;
121
+ formValue(): string | null;
122
+ formReset(): void;
123
+ formRestore(state: string | FormData | File | null): void;
124
+ formValidityAnchor(): HTMLElement | null;
68
125
  private onInputChange;
69
126
  }
127
+ export {};
@@ -0,0 +1,94 @@
1
+ function c(a = document) {
2
+ let t = a.activeElement;
3
+ for (; t?.shadowRoot?.activeElement; )
4
+ t = t.shadowRoot.activeElement;
5
+ return t;
6
+ }
7
+ class h {
8
+ constructor(t, e) {
9
+ this.root = t, this.options = e, this.snapshot = null, this.retried = !1;
10
+ }
11
+ /** Snapshot the focused item's key and index. No-op unless focus is inside the root. */
12
+ capture() {
13
+ this.snapshot = null, this.retried = !1;
14
+ const t = this.root();
15
+ if (!t) return;
16
+ const e = this.activeInsideRoot(t);
17
+ if (!e) return;
18
+ const s = e.shadowRoot ? c(e.shadowRoot) : e;
19
+ if (!s || s.assignedSlot) return;
20
+ const o = this.candidates(), i = this.resolveKey(s);
21
+ if (i === null) return;
22
+ const n = o.indexOf(s);
23
+ this.snapshot = { key: i, index: n < 0 ? 0 : n };
24
+ }
25
+ /** Re-focus after the rebuild. Safe to call with nothing captured. */
26
+ restore() {
27
+ const t = this.snapshot;
28
+ if (!t) return "unchanged";
29
+ const e = this.root();
30
+ if (!e)
31
+ return this.snapshot = null, "none";
32
+ const s = this.candidates(), o = { preventScroll: this.options.preventScroll ?? !0 }, i = s.find((r) => this.resolveKey(r) === t.key);
33
+ if (i)
34
+ return !this.tryFocus(i, o) && !this.retried ? (this.retried = !0, queueMicrotask(() => this.restore()), "same") : (this.snapshot = null, "same");
35
+ if (s.length > 0) {
36
+ const r = s[Math.min(t.index, s.length - 1)];
37
+ return this.tryFocus(r, o), this.options.announce?.(`${this.options.nameOf?.(r) ?? "Item"} focused.`), this.snapshot = null, "neighbour";
38
+ }
39
+ const n = this.options.container?.() ?? e.firstElementChild;
40
+ return n ? (n.hasAttribute("tabindex") || n.setAttribute("tabindex", "-1"), this.tryFocus(n, o), this.options.announce?.("Nothing left to focus."), this.snapshot = null, "container") : (this.snapshot = null, "none");
41
+ }
42
+ /** `capture()` → `rebuild()` → `restore()`. The shape most call sites want. */
43
+ around(t) {
44
+ this.capture();
45
+ try {
46
+ return t();
47
+ } finally {
48
+ this.restore();
49
+ }
50
+ }
51
+ candidates() {
52
+ const t = this.root();
53
+ return t ? Array.from(t.querySelectorAll(this.options.selector)) : [];
54
+ }
55
+ resolveKey(t) {
56
+ return this.options.keyOf ? this.options.keyOf(t) : t.id || t.dataset.focusKey || null;
57
+ }
58
+ /**
59
+ * The focused element within `root`, or null when focus is elsewhere.
60
+ *
61
+ * For a ShadowRoot this is exactly `activeElement`, which is null unless
62
+ * focus is inside that root — both the cheap check and the correctness
63
+ * guarantee. A plain element root has no such property, so fall back to a
64
+ * containment test against the deep active element.
65
+ */
66
+ activeInsideRoot(t) {
67
+ if (t instanceof HTMLElement) {
68
+ const e = c();
69
+ return e && t.contains(e) ? e : null;
70
+ }
71
+ return t.activeElement;
72
+ }
73
+ tryFocus(t, e) {
74
+ t.focus(e);
75
+ const s = c();
76
+ return s === t || s !== null && t.contains(s);
77
+ }
78
+ }
79
+ class u {
80
+ constructor(t, e) {
81
+ this.inner = e, t.addController(this);
82
+ }
83
+ hostUpdate() {
84
+ this.inner.capture();
85
+ }
86
+ hostUpdated() {
87
+ this.inner.restore();
88
+ }
89
+ }
90
+ export {
91
+ h as F,
92
+ u as a,
93
+ c as d
94
+ };
@@ -0,0 +1,121 @@
1
+ import { d as l } from "./focus-restore-DxuP1Oe2.mjs";
2
+ const s = [];
3
+ function b(n = "dismiss-frame") {
4
+ const t = Symbol(n);
5
+ return s.push(t), t;
6
+ }
7
+ function g(n) {
8
+ const t = s.lastIndexOf(n);
9
+ t >= 0 && s.splice(t, 1);
10
+ }
11
+ function m(n) {
12
+ return s.length > 0 && s[s.length - 1] === n;
13
+ }
14
+ function v() {
15
+ return s.length > 0 ? s[s.length - 1] : null;
16
+ }
17
+ function y() {
18
+ return s.length;
19
+ }
20
+ function S() {
21
+ s.length = 0;
22
+ }
23
+ const x = { push: b, release: g, isTop: m, peek: v, depth: y, resetForTesting: S };
24
+ class D {
25
+ constructor(t, e = {}) {
26
+ this.region = t, this.active = !1, this.restoreTo = null, this.onKeyDown = (i) => {
27
+ if (i.key !== "Tab" || !this.active || this.options.enabled && !this.options.enabled()) return;
28
+ const o = this.region();
29
+ if (!o || !o.isConnected) return;
30
+ const r = h(o);
31
+ if (r.length === 0) {
32
+ i.preventDefault();
33
+ return;
34
+ }
35
+ const f = r[0], u = r[r.length - 1], c = l();
36
+ if (!(c !== null && (o === c || T(o, c)))) {
37
+ i.preventDefault(), (i.shiftKey ? u : f).focus({ preventScroll: !0 });
38
+ return;
39
+ }
40
+ i.shiftKey && c === f ? (i.preventDefault(), u.focus({ preventScroll: !0 })) : !i.shiftKey && c === u && (i.preventDefault(), f.focus({ preventScroll: !0 }));
41
+ }, this.options = e;
42
+ }
43
+ get isActive() {
44
+ return this.active;
45
+ }
46
+ activate() {
47
+ if (this.active) return;
48
+ const t = this.region();
49
+ if (!t) return;
50
+ const e = l();
51
+ this.restoreTo = e instanceof HTMLElement ? e : null, this.active = !0, t.ownerDocument.addEventListener("keydown", this.onKeyDown, !0);
52
+ let i = this.options.initialFocus ?? "first";
53
+ if (typeof i == "function" && (i = i() ?? "first"), i instanceof HTMLElement)
54
+ i.focus({ preventScroll: !0 });
55
+ else if (i === "self")
56
+ t.hasAttribute("tabindex") || t.setAttribute("tabindex", "-1"), t.focus({ preventScroll: !0 });
57
+ else if (i === "first") {
58
+ const o = h(t)[0];
59
+ o ? o.focus({ preventScroll: !0 }) : (t.hasAttribute("tabindex") || t.setAttribute("tabindex", "-1"), t.focus({ preventScroll: !0 }));
60
+ }
61
+ }
62
+ deactivate() {
63
+ if (!this.active) return;
64
+ this.active = !1, (this.region()?.ownerDocument ?? document).removeEventListener("keydown", this.onKeyDown, !0), (this.options.returnFocus ?? !0) && this.restoreTo?.isConnected && this.restoreTo.focus({ preventScroll: !0 }), this.restoreTo = null;
65
+ }
66
+ }
67
+ function T(n, t) {
68
+ let e = t;
69
+ for (; e; ) {
70
+ if (e === n) return !0;
71
+ if (e instanceof Element && e.assignedSlot) {
72
+ e = e.assignedSlot;
73
+ continue;
74
+ }
75
+ const i = e.parentNode;
76
+ e = i instanceof ShadowRoot ? i.host : i;
77
+ }
78
+ return !1;
79
+ }
80
+ const E = [
81
+ "a[href]",
82
+ "button",
83
+ "input",
84
+ "select",
85
+ "textarea",
86
+ "summary",
87
+ "audio[controls]",
88
+ "video[controls]",
89
+ '[contenteditable]:not([contenteditable="false"])',
90
+ "[tabindex]"
91
+ ].join(",");
92
+ function h(n) {
93
+ const t = [];
94
+ return a(n, t), t;
95
+ }
96
+ function a(n, t) {
97
+ for (const e of Array.from(n.children))
98
+ if (e instanceof HTMLElement && !p(e)) {
99
+ if (e instanceof HTMLSlotElement) {
100
+ const i = e.assignedElements({ flatten: !0 }), o = i.length > 0 ? i : Array.from(e.children);
101
+ for (const r of o)
102
+ !(r instanceof HTMLElement) || p(r) || (d(r) && t.push(r), a(r, t));
103
+ continue;
104
+ }
105
+ d(e) && t.push(e), e.shadowRoot && a(e.shadowRoot, t), a(e, t);
106
+ }
107
+ }
108
+ function d(n) {
109
+ return n.tabIndex < 0 || n.hasAttribute("inert") || n.closest("[inert]") || n.matches(":disabled") || n.getAttribute("aria-hidden") === "true" ? !1 : n.matches(E);
110
+ }
111
+ function p(n) {
112
+ if (n.hidden) return !0;
113
+ const t = n.style.display, e = n.style.visibility;
114
+ return t === "none" || e === "hidden";
115
+ }
116
+ export {
117
+ D as F,
118
+ T as a,
119
+ h as c,
120
+ x as d
121
+ };
@@ -0,0 +1,58 @@
1
+ import { nothing as o, html as m } from "lit";
2
+ import { s as d } from "./host-aria-WSGs7SPQ.mjs";
3
+ const n = "invalid-feedback", u = { id: o, node: o };
4
+ function b(e, s, i) {
5
+ const t = s?.trim();
6
+ return !t || !i ? u : {
7
+ id: e,
8
+ node: m`<small class=${n} id=${e}>${t}</small>`
9
+ };
10
+ }
11
+ function F(e) {
12
+ const s = e?.querySelector(`.${n}`);
13
+ return s ? [s] : [];
14
+ }
15
+ function y(e) {
16
+ class s extends e {
17
+ static {
18
+ this.formAssociated = !0;
19
+ }
20
+ /** Effective disabled per the platform, as last reported by the UA. */
21
+ #e = !1;
22
+ get internals() {
23
+ return d(this);
24
+ }
25
+ get effectiveDisabled() {
26
+ return this.#e || this.hasAttribute("disabled");
27
+ }
28
+ #t() {
29
+ return this;
30
+ }
31
+ /** Push the host's current value into the form. Call on every change. */
32
+ syncFormValue() {
33
+ const t = this.internals;
34
+ !t || typeof t.setFormValue != "function" || t.setFormValue(this.#t().formValue());
35
+ }
36
+ setFormValidity(t, a) {
37
+ const r = this.internals;
38
+ if (!r || typeof r.setValidity != "function") return;
39
+ const l = this.#t().formValidityAnchor?.() ?? void 0, c = Object.values(t).some(Boolean);
40
+ r.setValidity(t, c ? a : void 0, l);
41
+ }
42
+ formDisabledCallback(t) {
43
+ this.#e = t, this.requestUpdate?.();
44
+ }
45
+ formResetCallback() {
46
+ this.#t().formReset(), this.syncFormValue();
47
+ }
48
+ formStateRestoreCallback(t) {
49
+ this.#t().formRestore?.(t), this.syncFormValue();
50
+ }
51
+ }
52
+ return s;
53
+ }
54
+ export {
55
+ y as F,
56
+ F as a,
57
+ b as e
58
+ };
@@ -0,0 +1,152 @@
1
+ const c = /* @__PURE__ */ new WeakMap();
2
+ function y(i) {
3
+ if (c.has(i)) return c.get(i) ?? null;
4
+ let t = null;
5
+ const e = i.attachInternals;
6
+ if (typeof e == "function")
7
+ try {
8
+ t = e.call(i);
9
+ } catch {
10
+ t = null;
11
+ }
12
+ return c.set(i, t), t;
13
+ }
14
+ function E() {
15
+ return typeof ElementInternals < "u" && "ariaLabelledByElements" in ElementInternals.prototype && typeof Element < "u" && "ariaLabelledByElements" in Element.prototype;
16
+ }
17
+ const m = ["aria-labelledby", "aria-describedby"];
18
+ let f = !1;
19
+ class A {
20
+ constructor(t, e = {}) {
21
+ this.host = t, this.options = e, this.internals = y(t), this.referenceAttributes = e.referenceAttributes ?? m, e.role && this.internals ? this.internals.role = e.role : e.role && !t.hasAttribute("role") && t.setAttribute("role", e.role);
22
+ }
23
+ /** True when the role and state are going through `ElementInternals`. */
24
+ get usesInternals() {
25
+ return this.internals !== null;
26
+ }
27
+ /**
28
+ * Reflect ARIA state onto the host.
29
+ *
30
+ * Call from `render()` or `updated()` — from wherever the visual state is
31
+ * derived — never as a side effect of an event handler. State written only on
32
+ * an event is stale for every other path that changes it (programmatic
33
+ * setters, server-rendered markup, a sibling closing this one), which is the
34
+ * defect class behind the frozen `aria-expanded` and write-only-when-true
35
+ * `aria-pressed` findings.
36
+ */
37
+ setState(t) {
38
+ for (const [e, a] of Object.entries(t)) {
39
+ const r = v[e];
40
+ if (r) {
41
+ if (a == null) {
42
+ this.clear(e, r);
43
+ continue;
44
+ }
45
+ this.write(e, r, String(a));
46
+ }
47
+ }
48
+ }
49
+ /**
50
+ * Resolve the host's IDREF attributes into cross-root element references.
51
+ *
52
+ * Call from `connectedCallback` and whenever a reference attribute changes.
53
+ * Returns the attributes it could not honour, so a caller can warn.
54
+ */
55
+ syncReferences() {
56
+ const e = this.options.referenceTarget?.() ?? null ?? this.internals;
57
+ if (!e || !E()) {
58
+ const n = this.referenceAttributes.filter((l) => this.host.hasAttribute(l));
59
+ return n.length > 0 && !f && (f = !0, console.warn(
60
+ `[a11y] This browser cannot assign ARIA element references, so ${n.join(", ")} on <${this.host.localName}> cannot cross its shadow boundary. Use the component's label property instead.`
61
+ )), n;
62
+ }
63
+ const a = [], r = this.host.getRootNode();
64
+ for (const n of this.referenceAttributes) {
65
+ const l = R[n];
66
+ if (!l) continue;
67
+ const s = n === "aria-describedby" ? this.options.describedByExtras?.() ?? [] : [], u = this.host.getAttribute(n);
68
+ if (u === null) {
69
+ this.assignReferences(e, l, s.length > 0 ? s : null);
70
+ continue;
71
+ }
72
+ const d = u.split(/\s+/).filter(Boolean), h = d.map((o) => r.getElementById?.(o) ?? null).filter((o) => o instanceof HTMLElement);
73
+ h.length !== d.length && a.push(n);
74
+ const b = [...h, ...s];
75
+ this.assignReferences(e, l, b.length > 0 ? b : null);
76
+ }
77
+ return a;
78
+ }
79
+ assignReferences(t, e, a) {
80
+ try {
81
+ t[e] = a;
82
+ } catch {
83
+ }
84
+ }
85
+ write(t, e, a) {
86
+ if (this.internals) {
87
+ const r = p[t];
88
+ if (r && r in this.internals) {
89
+ this.internals[r] = a;
90
+ return;
91
+ }
92
+ }
93
+ this.host.setAttribute(e, a);
94
+ }
95
+ clear(t, e) {
96
+ if (this.internals) {
97
+ const a = p[t];
98
+ if (a && a in this.internals) {
99
+ this.internals[a] = null;
100
+ return;
101
+ }
102
+ }
103
+ this.host.removeAttribute(e);
104
+ }
105
+ }
106
+ const v = {
107
+ expanded: "aria-expanded",
108
+ selected: "aria-selected",
109
+ checked: "aria-checked",
110
+ pressed: "aria-pressed",
111
+ disabled: "aria-disabled",
112
+ invalid: "aria-invalid",
113
+ required: "aria-required",
114
+ readOnly: "aria-readonly",
115
+ current: "aria-current",
116
+ hasPopup: "aria-haspopup",
117
+ level: "aria-level",
118
+ orientation: "aria-orientation",
119
+ multiSelectable: "aria-multiselectable",
120
+ valueNow: "aria-valuenow",
121
+ valueMin: "aria-valuemin",
122
+ valueMax: "aria-valuemax",
123
+ valueText: "aria-valuetext",
124
+ label: "aria-label"
125
+ }, p = {
126
+ expanded: "ariaExpanded",
127
+ selected: "ariaSelected",
128
+ checked: "ariaChecked",
129
+ pressed: "ariaPressed",
130
+ disabled: "ariaDisabled",
131
+ invalid: "ariaInvalid",
132
+ required: "ariaRequired",
133
+ readOnly: "ariaReadOnly",
134
+ current: "ariaCurrent",
135
+ hasPopup: "ariaHasPopup",
136
+ level: "ariaLevel",
137
+ orientation: "ariaOrientation",
138
+ multiSelectable: "ariaMultiSelectable",
139
+ valueNow: "ariaValueNow",
140
+ valueMin: "ariaValueMin",
141
+ valueMax: "ariaValueMax",
142
+ valueText: "ariaValueText",
143
+ label: "ariaLabel"
144
+ }, R = {
145
+ "aria-labelledby": "ariaLabelledByElements",
146
+ "aria-describedby": "ariaDescribedByElements"
147
+ };
148
+ export {
149
+ A as H,
150
+ E as a,
151
+ y as s
152
+ };
@@ -0,0 +1,48 @@
1
+ import { d as f } from "./focus-restore-DxuP1Oe2.mjs";
2
+ function l() {
3
+ const o = /* @__PURE__ */ new Set();
4
+ let r = [], n = 0;
5
+ const s = (e) => {
6
+ const t = f();
7
+ if (t && (e === t || e.contains(t))) {
8
+ const c = d(e);
9
+ c ? c.focus({ preventScroll: !0 }) : t instanceof HTMLElement && t.blur();
10
+ }
11
+ e.setAttribute("inert", ""), e.setAttribute("aria-hidden", "true"), o.add(e);
12
+ }, a = (e) => {
13
+ e.removeAttribute("inert"), e.removeAttribute("aria-hidden");
14
+ }, i = () => {
15
+ const e = n > 0 ? /* @__PURE__ */ new Set() : new Set(r);
16
+ for (const t of o)
17
+ e.has(t) || (a(t), o.delete(t));
18
+ for (const t of e)
19
+ o.has(t) || s(t);
20
+ };
21
+ return {
22
+ setHidden(e) {
23
+ r = Array.from(e), i();
24
+ },
25
+ suspend() {
26
+ n += 1, n === 1 && i();
27
+ },
28
+ resume() {
29
+ n !== 0 && (n -= 1, n === 0 && i());
30
+ },
31
+ dispose() {
32
+ for (const e of o) a(e);
33
+ o.clear(), r = [], n = 0;
34
+ }
35
+ };
36
+ }
37
+ function d(o) {
38
+ let r = o.parentElement;
39
+ for (; r; ) {
40
+ if (r.tabIndex >= 0) return r;
41
+ r = r.parentElement;
42
+ }
43
+ const n = o.getRootNode(), s = n instanceof ShadowRoot ? n.host : null;
44
+ return s instanceof HTMLElement && s.tabIndex >= 0 ? s : null;
45
+ }
46
+ export {
47
+ l as i
48
+ };
@@ -0,0 +1,11 @@
1
+ import { unsafeCSS as i } from "lit";
2
+ const a = i(`.invalid-feedback {
3
+ display: block;
4
+ width: 100%;
5
+ margin-top: 0.25rem;
6
+ font-size: 0.875em;
7
+ color: var(--bs-form-invalid-color, #dc3545);
8
+ }`);
9
+ export {
10
+ a as i
11
+ };
@@ -1,9 +1,9 @@
1
- import { html as r } from "lit";
2
- import { createRef as s, ref as n } from "lit/directives/ref.js";
3
- const l = "position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;";
4
- class c {
1
+ import { nothing as s, html as r } from "lit";
2
+ import { createRef as n, ref as l } from "lit/directives/ref.js";
3
+ const o = "position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;";
4
+ class u {
5
5
  constructor(e, t = {}) {
6
- this.clearTimer = null, this.pendingMessage = null, this.regionRef = s(), this.host = e, this.politeness = t.politeness ?? "polite", this.clearAfterMs = t.clearAfterMs ?? 1500, e.addController(this);
6
+ this.clearTimer = null, this.pendingMessage = null, this.regionRef = n(), this.host = e, this.politeness = t.politeness ?? "polite", this.clearAfterMs = t.clearAfterMs ?? 1500, this.omitRole = t.omitRole ?? !1, e.addController(this);
7
7
  }
8
8
  hostUpdated() {
9
9
  if (this.pendingMessage !== null && this.regionRef.value) {
@@ -24,13 +24,13 @@ class c {
24
24
  }
25
25
  /** Returns the live-region template fragment. Call once inside the host's render(). */
26
26
  template() {
27
- const e = this.politeness === "assertive" ? "alert" : "status";
27
+ const e = this.omitRole ? s : this.politeness === "assertive" ? "alert" : "status";
28
28
  return r`<div
29
- ${n(this.regionRef)}
29
+ ${l(this.regionRef)}
30
30
  role=${e}
31
31
  aria-live=${this.politeness}
32
32
  aria-atomic="true"
33
- style=${l}
33
+ style=${o}
34
34
  ></div>`;
35
35
  }
36
36
  writeMessage(e) {
@@ -54,5 +54,5 @@ class c {
54
54
  }
55
55
  }
56
56
  export {
57
- c as L
57
+ u as L
58
58
  };