@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
@@ -1,5 +1,6 @@
1
1
  import { unsafeCSS as I, LitElement as S, nothing as h, html as b } from "lit";
2
- const j = I(`:host {
2
+ import { repeat as j } from "lit/directives/repeat.js";
3
+ const G = I(`:host {
3
4
  display: block;
4
5
  --mp-pagination-bg: var(--bs-pagination-bg, transparent);
5
6
  --mp-pagination-color: var(--bs-pagination-color, var(--bs-link-color, #0d6efd));
@@ -134,12 +135,12 @@ li:last-child .page-link {
134
135
  white-space: nowrap !important;
135
136
  border: 0 !important;
136
137
  }`);
137
- class G extends S {
138
+ class H extends S {
138
139
  constructor() {
139
140
  super(...arguments), this._pageNumbers = [], this._selectedPageNumber = 1, this._numberOfBoxes = 0, this._showArrows = !0, this._size = "medium", this._ariaLabel = "Pagination";
140
141
  }
141
142
  static {
142
- this.styles = [j];
143
+ this.styles = [G];
143
144
  }
144
145
  static get observedAttributes() {
145
146
  return [
@@ -187,7 +188,7 @@ class G extends S {
187
188
  }
188
189
  attributeChangedCallback(e, r, n) {
189
190
  if (super.attributeChangedCallback(e, r, n), e === "page-numbers" && n) {
190
- const t = n.split(",").map((a) => Number(a.trim())).filter((a) => Number.isFinite(a));
191
+ const t = n.split(",").map((i) => Number(i.trim())).filter((i) => Number.isFinite(i));
191
192
  this.pageNumbers = t;
192
193
  } else if (e === "selected-page-number") {
193
194
  const t = Number(n);
@@ -211,7 +212,7 @@ class G extends S {
211
212
  }
212
213
  /** Build the full layout — arrows + page items. Pure — no DOM access. */
213
214
  computeLayout() {
214
- return H(
215
+ return R(
215
216
  this._pageNumbers,
216
217
  this._selectedPageNumber,
217
218
  this.effectiveBudget(),
@@ -235,7 +236,9 @@ class G extends S {
235
236
  <span class="visually-hidden">Previous</span>
236
237
  </button>
237
238
  </li>` : h}
238
- ${e.items.map(
239
+ ${j(
240
+ e.items,
241
+ (t, i) => t.kind === "gap" ? `gap-${i}` : `page-${t.page}`,
239
242
  (t) => t.kind === "gap" ? b`<li>
240
243
  <span class="ellipsis" aria-hidden="true">&hellip;</span>
241
244
  </li>` : b`<li>
@@ -290,37 +293,37 @@ class G extends S {
290
293
  n != null && this.selectPage(n);
291
294
  }
292
295
  }
293
- function H(g, e, r, n) {
296
+ function R(g, e, r, n) {
294
297
  const t = g.length;
295
298
  if (t === 0) return { showPrev: !1, showNext: !1, items: [] };
296
- const a = R(g.indexOf(e), t), z = Math.max(1, Math.floor(r));
297
- let v = !1, x = !1, p = 0, s = 0, o = 0, l = 0, i = z - 1;
298
- n && i > 0 && (x = !0, i--), n && i > 0 && (v = !0, i--);
299
- const m = () => !(p >= a || p >= t - s || o >= 2 && p >= a - (o - 1)), f = () => !(t - 1 - s <= a || t - 1 - s < p || l >= 2 && t - 1 - s <= a + (l - 1)), _ = () => a === 0 ? !1 : o === 0 ? p + 1 < a : a - o >= p, N = () => a === t - 1 ? !1 : l === 0 ? a + 1 < t - 1 - s : a + l <= t - 1 - s, P = () => a - p - Math.max(0, o - 1), y = () => t - 1 - a - s - Math.max(0, l - 1);
300
- for (i > 0 && m() && (p++, i--), i > 0 && f() && (s++, i--), i > 0 && (_() ? (o++, i--) : P() > 0 && m() && (p++, i--)), i > 0 && (N() ? (l++, i--) : y() > 0 && f() && (s++, i--)); i > 0; ) {
301
- const d = i;
302
- if (_() && (o++, i--), i === 0 || (N() && (l++, i--), i === 0) || (m() && (p++, i--), i === 0) || (f() && (s++, i--), d === i)) break;
299
+ const i = D(g.indexOf(e), t), z = Math.max(1, Math.floor(r));
300
+ let v = !1, x = !1, p = 0, s = 0, o = 0, l = 0, a = z - 1;
301
+ n && a > 0 && (x = !0, a--), n && a > 0 && (v = !0, a--);
302
+ const m = () => !(p >= i || p >= t - s || o >= 2 && p >= i - (o - 1)), f = () => !(t - 1 - s <= i || t - 1 - s < p || l >= 2 && t - 1 - s <= i + (l - 1)), _ = () => i === 0 ? !1 : o === 0 ? p + 1 < i : i - o >= p, N = () => i === t - 1 ? !1 : l === 0 ? i + 1 < t - 1 - s : i + l <= t - 1 - s, P = () => i - p - Math.max(0, o - 1), y = () => t - 1 - i - s - Math.max(0, l - 1);
303
+ for (a > 0 && m() && (p++, a--), a > 0 && f() && (s++, a--), a > 0 && (_() ? (o++, a--) : P() > 0 && m() && (p++, a--)), a > 0 && (N() ? (l++, a--) : y() > 0 && f() && (s++, a--)); a > 0; ) {
304
+ const d = a;
305
+ if (_() && (o++, a--), a === 0 || (N() && (l++, a--), a === 0) || (m() && (p++, a--), a === 0) || (f() && (s++, a--), d === a)) break;
303
306
  }
304
307
  const u = (d) => ({
305
308
  kind: "page",
306
309
  page: g[d],
307
310
  current: g[d] === e
308
- }), A = Array.from({ length: p }, (d, c) => u(c)), O = o >= 2 ? Array.from({ length: o - 1 }, (d, c) => u(a - (o - 1) + c)) : [], B = l >= 2 ? Array.from({ length: l - 1 }, (d, c) => u(a + 1 + c)) : [], $ = Array.from({ length: s }, (d, c) => u(t - s + c)), k = p - 1, L = o >= 2 ? a - (o - 1) : a, C = P(), q = o >= 1 && k + 1 < L ? C === 1 ? [u(k + 1)] : [{ kind: "gap" }] : [], w = l >= 2 ? a + (l - 1) : a, M = t - s, E = y(), F = l >= 1 && w + 1 < M ? E === 1 ? [u(w + 1)] : [{ kind: "gap" }] : [], U = [
311
+ }), A = Array.from({ length: p }, (d, c) => u(c)), $ = o >= 2 ? Array.from({ length: o - 1 }, (d, c) => u(i - (o - 1) + c)) : [], O = l >= 2 ? Array.from({ length: l - 1 }, (d, c) => u(i + 1 + c)) : [], B = Array.from({ length: s }, (d, c) => u(t - s + c)), k = p - 1, L = o >= 2 ? i - (o - 1) : i, C = P(), q = o >= 1 && k + 1 < L ? C === 1 ? [u(k + 1)] : [{ kind: "gap" }] : [], w = l >= 2 ? i + (l - 1) : i, M = t - s, E = y(), F = l >= 1 && w + 1 < M ? E === 1 ? [u(w + 1)] : [{ kind: "gap" }] : [], U = [
309
312
  ...A,
310
313
  ...q,
314
+ ...$,
315
+ u(i),
311
316
  ...O,
312
- u(a),
313
- ...B,
314
317
  ...F,
315
- ...$
318
+ ...B
316
319
  ];
317
320
  return { showPrev: v, showNext: x, items: U };
318
321
  }
319
- function R(g, e) {
322
+ function D(g, e) {
320
323
  return g < 0 ? 0 : g >= e ? e - 1 : g;
321
324
  }
322
- typeof customElements < "u" && !customElements.get("mp-pagination") && customElements.define("mp-pagination", G);
325
+ typeof customElements < "u" && !customElements.get("mp-pagination") && customElements.define("mp-pagination", H);
323
326
  export {
324
- G as M,
325
- H as b
327
+ H as M,
328
+ R as b
326
329
  };
@@ -0,0 +1,300 @@
1
+ import { LitElement as i, nothing as r, html as a } from "lit";
2
+ import { createRef as d, ref as n } from "lit/directives/ref.js";
3
+ import { t as l } from "./mp-toggle-button-Kz6sIgBJ.mjs";
4
+ import { f as c } from "./form-check.styles-jBlHetYX.mjs";
5
+ import { i as p } from "./invalid-feedback.styles-he0JYrJm.mjs";
6
+ import { H as b } from "./host-aria-WSGs7SPQ.mjs";
7
+ import { a as _, e as g } from "./form-associated-axmc5sY0.mjs";
8
+ const o = /* @__PURE__ */ new Set(["radio", "toggle_button"]), h = /* @__PURE__ */ new Set([
9
+ "primary",
10
+ "secondary",
11
+ "success",
12
+ "danger",
13
+ "warning",
14
+ "info",
15
+ "light",
16
+ "dark",
17
+ "outline-primary",
18
+ "outline-secondary",
19
+ "outline-success",
20
+ "outline-danger",
21
+ "outline-warning",
22
+ "outline-info",
23
+ "outline-light",
24
+ "outline-dark"
25
+ ]);
26
+ let u = 0;
27
+ class m extends i {
28
+ constructor() {
29
+ super(...arguments), this._type = "radio", this._checked = !1, this._disabled = !1, this._name = null, this._value = null, this._color = "secondary", this._inputLabel = null, this._errorText = null, this.hostAria = new b(this, {
30
+ referenceTarget: () => this._inputRef.value ?? null,
31
+ describedByExtras: () => _(this.renderRoot)
32
+ }), this._inputId = `mp-radio-${++u}`, this._errorId = `mp-radio-${u}-error`, this._inputRef = d(), this._groupTabIndex = null, this._groupPosInSet = null, this._groupSetSize = null, this.onInputChange = (e) => {
33
+ const t = e.target.checked;
34
+ this._checked = t, this.reflectBoolean("checked", t), this.dispatchEvent(
35
+ new CustomEvent("change", {
36
+ detail: { checked: t, value: this._value },
37
+ bubbles: !0,
38
+ composed: !0
39
+ })
40
+ );
41
+ };
42
+ }
43
+ static {
44
+ this.styles = [c, l, p];
45
+ }
46
+ static {
47
+ this.shadowRootOptions = {
48
+ ...i.shadowRootOptions,
49
+ delegatesFocus: !0
50
+ };
51
+ }
52
+ static get observedAttributes() {
53
+ return [
54
+ ...super.observedAttributes ?? [],
55
+ "invalid",
56
+ "required",
57
+ // Validation message rendered inside the shadow root and referenced by the
58
+ // inner <input>; shown only while `invalid` is also set.
59
+ "error-text",
60
+ "type",
61
+ "checked",
62
+ "disabled",
63
+ "name",
64
+ "value",
65
+ "color",
66
+ // Copied to the inner <input> in render(); the slotted label already names
67
+ // the control (flat-tree label association), so these are overrides.
68
+ "aria-label",
69
+ "input-label",
70
+ // NOT copied inward — resolved into element references against the host's
71
+ // tree by hostAria.syncReferences(); an IDREF string cannot cross the
72
+ // shadow boundary.
73
+ "aria-labelledby",
74
+ "aria-describedby"
75
+ ];
76
+ }
77
+ /**
78
+ * Optional override for the inner <input>'s accessible name. Usually
79
+ * unnecessary: the slotted visible text already names the control through the
80
+ * flat-tree label association (slotted-label spike; verdict in the plan). For a radio
81
+ * with no visible text, or a name that must differ from it, set this.
82
+ */
83
+ get inputLabel() {
84
+ return this._inputLabel;
85
+ }
86
+ set inputLabel(e) {
87
+ const t = e ?? null;
88
+ this._inputLabel !== t && (this._inputLabel = t, this.requestUpdate());
89
+ }
90
+ /**
91
+ * Validation message, as `errorText` / `error-text`. Rendered as a
92
+ * `.invalid-feedback` node inside the shadow root and referenced from the inner
93
+ * `<input>` by `aria-errormessage` **and** `aria-describedby`, but only while
94
+ * `invalid` is set — `aria-errormessage` is meaningless on a control that is not
95
+ * `aria-invalid`.
96
+ *
97
+ * On a radio the message belongs to the whole group, not to one option, so put
98
+ * it on the radio the group's validity is anchored to (or on each, which
99
+ * repeats it). Text rather than a node because a consumer's own element lives
100
+ * outside this shadow root, where an IDREF from the inner input cannot reach it.
101
+ */
102
+ get errorText() {
103
+ return this._errorText;
104
+ }
105
+ set errorText(e) {
106
+ const t = e ?? null;
107
+ this._errorText !== t && (this._errorText = t, this.requestUpdate());
108
+ }
109
+ get type() {
110
+ return this._type;
111
+ }
112
+ set type(e) {
113
+ !o.has(e) || this._type === e || (this._type = e, this.requestUpdate());
114
+ }
115
+ get checked() {
116
+ return this._checked;
117
+ }
118
+ set checked(e) {
119
+ const t = !!e;
120
+ this._checked !== t && (this._checked = t, this.reflectBoolean("checked", t), this.requestUpdate());
121
+ }
122
+ get disabled() {
123
+ return this._disabled;
124
+ }
125
+ set disabled(e) {
126
+ const t = !!e;
127
+ this._disabled !== t && (this._disabled = t, this.reflectBoolean("disabled", t), this.requestUpdate());
128
+ }
129
+ get name() {
130
+ return this._name;
131
+ }
132
+ set name(e) {
133
+ const t = e ?? null;
134
+ this._name !== t && (this._name = t, this.requestUpdate());
135
+ }
136
+ get value() {
137
+ return this._value;
138
+ }
139
+ set value(e) {
140
+ const t = e ?? null;
141
+ this._value !== t && (this._value = t, this.requestUpdate());
142
+ }
143
+ get color() {
144
+ return this._color;
145
+ }
146
+ set color(e) {
147
+ !h.has(e) || this._color === e || (this._color = e, this.requestUpdate());
148
+ }
149
+ /**
150
+ * Roving tab stop, written by an enclosing `<mp-radio-group>`. With
151
+ * delegatesFocus a tabindex on the HOST cannot take the inner input out of
152
+ * the tab order — the input's own tabindex is the only lever, and it lives
153
+ * behind the shadow boundary, hence this property. Coordination state, not
154
+ * author API: property-only, no attribute.
155
+ */
156
+ get groupTabIndex() {
157
+ return this._groupTabIndex;
158
+ }
159
+ set groupTabIndex(e) {
160
+ const t = e ?? null;
161
+ this._groupTabIndex !== t && (this._groupTabIndex = t, this.requestUpdate());
162
+ }
163
+ /**
164
+ * Set-position pair, written by the enclosing group. They belong on the
165
+ * inner `<input>` — the role bearer — because aria-posinset on a role-less
166
+ * host is dropped by AT, and shadow roots keep native name-grouping (the
167
+ * usual "2 of 3" source) from ever forming.
168
+ */
169
+ get groupPosInSet() {
170
+ return this._groupPosInSet;
171
+ }
172
+ set groupPosInSet(e) {
173
+ const t = e ?? null;
174
+ this._groupPosInSet !== t && (this._groupPosInSet = t, this.requestUpdate());
175
+ }
176
+ get groupSetSize() {
177
+ return this._groupSetSize;
178
+ }
179
+ set groupSetSize(e) {
180
+ const t = e ?? null;
181
+ this._groupSetSize !== t && (this._groupSetSize = t, this.requestUpdate());
182
+ }
183
+ attributeChangedCallback(e, t, s) {
184
+ switch (super.attributeChangedCallback(e, t, s), e) {
185
+ // Read from the host in render(), so a change has to ask for one — without
186
+ // this, aria-invalid / aria-required froze at their first-render values and
187
+ // an error message could never appear on a control that started out valid.
188
+ case "invalid":
189
+ case "required":
190
+ this.requestUpdate();
191
+ break;
192
+ case "error-text":
193
+ this._errorText = s, this.requestUpdate();
194
+ break;
195
+ case "type":
196
+ s && o.has(s) && (this._type = s, this.requestUpdate());
197
+ break;
198
+ case "checked":
199
+ this._checked = s !== null, this.requestUpdate();
200
+ break;
201
+ case "disabled":
202
+ this._disabled = s !== null, this.requestUpdate();
203
+ break;
204
+ case "name":
205
+ this._name = s, this.requestUpdate();
206
+ break;
207
+ case "value":
208
+ this._value = s, this.requestUpdate();
209
+ break;
210
+ case "color":
211
+ s && h.has(s) && (this._color = s, this.requestUpdate());
212
+ break;
213
+ case "aria-label":
214
+ this.requestUpdate();
215
+ break;
216
+ case "input-label":
217
+ this._inputLabel = s, this.requestUpdate();
218
+ break;
219
+ case "aria-labelledby":
220
+ case "aria-describedby":
221
+ this.hostAria.syncReferences();
222
+ break;
223
+ }
224
+ }
225
+ // After every render, not once: element references point at a specific node,
226
+ // and switching `type` replaces the <input> outright. See mp-checkbox's aria
227
+ // spec, where the same transition is exercised.
228
+ updated() {
229
+ this.hostAria.syncReferences();
230
+ }
231
+ render() {
232
+ return this._type === "toggle_button" ? this.renderToggleButton() : this.renderRadio();
233
+ }
234
+ renderRadio() {
235
+ const e = this.errorFeedback();
236
+ return a`
237
+ <label class="form-check">
238
+ <input
239
+ ${n(this._inputRef)}
240
+ type="radio"
241
+ class="form-check-input"
242
+ id=${this._inputId}
243
+ .checked=${this._checked}
244
+ ?disabled=${this._disabled}
245
+ aria-invalid=${this.hasAttribute("invalid") ? "true" : r}
246
+ aria-required=${this.hasAttribute("required") ? "true" : r}
247
+ aria-errormessage=${e.id}
248
+ aria-describedby=${e.id}
249
+ name=${this._name ?? r}
250
+ value=${this._value ?? r}
251
+ tabindex=${this._groupTabIndex ?? r}
252
+ aria-posinset=${this._groupPosInSet ?? r}
253
+ aria-setsize=${this._groupSetSize ?? r}
254
+ aria-label=${this.getAttribute("aria-label") ?? this._inputLabel ?? r}
255
+ @change=${this.onInputChange}
256
+ />
257
+ <span class="form-check-label"><slot></slot></span>
258
+ </label>
259
+ ${e.node}
260
+ `;
261
+ }
262
+ errorFeedback() {
263
+ return g(this._errorId, this._errorText, this.hasAttribute("invalid"));
264
+ }
265
+ renderToggleButton() {
266
+ const e = this.errorFeedback();
267
+ return a`
268
+ <input
269
+ ${n(this._inputRef)}
270
+ type="radio"
271
+ class="btn-check"
272
+ id=${this._inputId}
273
+ .checked=${this._checked}
274
+ ?disabled=${this._disabled}
275
+ aria-invalid=${this.hasAttribute("invalid") ? "true" : r}
276
+ aria-required=${this.hasAttribute("required") ? "true" : r}
277
+ aria-errormessage=${e.id}
278
+ aria-describedby=${e.id}
279
+ name=${this._name ?? r}
280
+ value=${this._value ?? r}
281
+ tabindex=${this._groupTabIndex ?? r}
282
+ aria-posinset=${this._groupPosInSet ?? r}
283
+ aria-setsize=${this._groupSetSize ?? r}
284
+ aria-label=${this.getAttribute("aria-label") ?? this._inputLabel ?? r}
285
+ @change=${this.onInputChange}
286
+ />
287
+ <label class="btn btn-${this._color}" for=${this._inputId}>
288
+ <slot></slot>
289
+ </label>
290
+ ${e.node}
291
+ `;
292
+ }
293
+ reflectBoolean(e, t) {
294
+ t ? this.setAttribute(e, "") : this.removeAttribute(e);
295
+ }
296
+ }
297
+ typeof customElements < "u" && !customElements.get("mp-radio") && customElements.define("mp-radio", m);
298
+ export {
299
+ m as M
300
+ };