@mintplayer/web-components 2.2.0 → 2.4.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 (115) 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/color-CpFtrIoX.mjs +899 -0
  23. package/chunks/focus-restore-DxuP1Oe2.mjs +94 -0
  24. package/chunks/focus-trap-DTOLJ5bb.mjs +121 -0
  25. package/chunks/form-associated-axmc5sY0.mjs +58 -0
  26. package/chunks/host-aria-WSGs7SPQ.mjs +152 -0
  27. package/chunks/inert-regions-DXCnn1LN.mjs +48 -0
  28. package/chunks/invalid-feedback.styles-he0JYrJm.mjs +11 -0
  29. package/chunks/{live-announcer-CZDTKulf.mjs → live-announcer-Bi0orG4n.mjs} +9 -9
  30. package/chunks/{mp-calendar.element-UC68iDbi.mjs → mp-calendar.element-u6uS31_j.mjs} +136 -105
  31. package/chunks/mp-checkbox-Ph2mMRGz.mjs +312 -0
  32. package/chunks/{mp-datatable-Bfw0KGkV.mjs → mp-datatable-BwTlh9A_.mjs} +265 -103
  33. package/chunks/{mp-pagination-BGxsawFL.mjs → mp-pagination-Dea75mD4.mjs} +25 -22
  34. package/chunks/mp-radio-BjW1HNSc.mjs +300 -0
  35. package/chunks/{mp-select-BDS1-YGn.mjs → mp-select-Ctu-v1-p.mjs} +163 -40
  36. package/chunks/{mp-splitter-C8cGCmac.mjs → mp-splitter-LszuRDbR.mjs} +53 -46
  37. package/chunks/{mp-tab-page-D1b4x-y2.mjs → mp-tab-page-CaCzX1ym.mjs} +46 -45
  38. package/chunks/{mp-timepicker.element-BwEiwX92.mjs → mp-timepicker.element-Bz393NDQ.mjs} +93 -86
  39. package/chunks/{mp-toggle-button-dLZNDUVz.mjs → mp-toggle-button-Kz6sIgBJ.mjs} +131 -37
  40. package/chunks/{mp-treeview-C48F63xb.mjs → mp-treeview-tkWu28iF.mjs} +67 -43
  41. package/chunks/overlay-controller-DPt13i8p.mjs +314 -0
  42. package/chunks/roving-focus-CrL9982a.mjs +129 -0
  43. package/code-snippet/index.mjs +21 -13
  44. package/code-snippet/src/mp-code-snippet.element.d.ts +6 -0
  45. package/datatable/index.mjs +1 -1
  46. package/datatable/src/components/mp-datatable.d.ts +50 -0
  47. package/datatable/src/types/index.d.ts +2 -0
  48. package/datatable/src/types/labels.d.ts +30 -0
  49. package/datepicker/index.mjs +45 -22
  50. package/datepicker/src/mp-datepicker.element.d.ts +30 -0
  51. package/datetime-picker/index.mjs +15 -9
  52. package/dock/index.mjs +365 -209
  53. package/dock/src/components/mint-dock-manager.element.d.ts +63 -3
  54. package/dropdown-menu/index.mjs +135 -90
  55. package/dropdown-menu/src/components/mp-dropdown-menu.d.ts +12 -3
  56. package/file-manager/index.mjs +279 -214
  57. package/file-manager/src/components/mp-file-manager.d.ts +22 -0
  58. package/file-manager/src/types/messages.d.ts +9 -0
  59. package/multi-range/index.mjs +26 -10
  60. package/multi-range/src/mint-multi-range.element.d.ts +7 -0
  61. package/navbar/index.mjs +53 -39
  62. package/navbar/src/components/mp-navbar.d.ts +1 -0
  63. package/otp-input/index.mjs +82 -48
  64. package/otp-input/src/mint-otp-input.element.d.ts +31 -3
  65. package/overlay/index.mjs +2 -258
  66. package/overlay/src/overlay-controller.d.ts +64 -4
  67. package/package.json +9 -1
  68. package/pagination/index.mjs +1 -1
  69. package/query-builder/index.mjs +117 -87
  70. package/query-builder/src/model/messages.d.ts +9 -0
  71. package/radio/index.mjs +2 -160
  72. package/radio/src/components/mp-radio.d.ts +58 -3
  73. package/radio-group/index.d.ts +1 -0
  74. package/radio-group/index.mjs +145 -0
  75. package/radio-group/src/components/mp-radio-group.d.ts +52 -0
  76. package/radio-group/src/index.d.ts +1 -0
  77. package/radio-group/src/styles/radio-group.styles.d.ts +2 -0
  78. package/ribbon/index.mjs +316 -304
  79. package/ribbon/src/mp-ribbon.element.d.ts +16 -0
  80. package/scheduler/index.mjs +892 -493
  81. package/scheduler/src/components/mp-scheduler.d.ts +30 -0
  82. package/scheduler/src/input/input-handler.d.ts +2 -0
  83. package/scheduler/src/views/base-view.d.ts +43 -6
  84. package/scheduler/src/views/timeline-view.d.ts +6 -0
  85. package/scheduler-core/index.mjs +73 -70
  86. package/scheduler-core/src/models/index.d.ts +1 -0
  87. package/scheduler-core/src/models/messages.d.ts +69 -0
  88. package/scheduler-core/src/models/options.d.ts +4 -0
  89. package/select/index.mjs +1 -1
  90. package/select/src/components/mp-select.d.ts +60 -3
  91. package/shell/index.mjs +142 -31
  92. package/shell/src/components/mp-shell.d.ts +1 -0
  93. package/signature-pad/index.d.ts +1 -0
  94. package/signature-pad/index.mjs +230 -0
  95. package/signature-pad/src/index.d.ts +2 -0
  96. package/signature-pad/src/mp-signature-pad.element.d.ts +143 -0
  97. package/signature-pad/src/mp-signature-pad.element.template.d.ts +2 -0
  98. package/signature-pad/src/types/signature.d.ts +12 -0
  99. package/splitter/index.mjs +1 -1
  100. package/splitter/src/components/mp-splitter.d.ts +7 -0
  101. package/tab-control/index.mjs +1 -1
  102. package/tile-manager/index.mjs +110 -93
  103. package/timeline/index.mjs +138 -54
  104. package/timeline/src/components/mp-timeline.d.ts +15 -0
  105. package/timepicker/index.mjs +1 -1
  106. package/timepicker/src/mp-time-list.element.d.ts +13 -4
  107. package/timepicker/src/mp-timepicker.element.d.ts +29 -0
  108. package/toggle-button/index.mjs +1 -1
  109. package/toggle-button/src/components/mp-toggle-button.d.ts +32 -1
  110. package/tree-select/index.mjs +233 -121
  111. package/tree-select/src/components/mp-tree-select.d.ts +37 -0
  112. package/treeview/index.mjs +1 -1
  113. package/treeview/src/components/mp-treeview.d.ts +10 -1
  114. package/chunks/color-CyamnJnn.mjs +0 -847
  115. package/chunks/mp-checkbox-BokLL7BS.mjs +0 -211
@@ -0,0 +1,312 @@
1
+ import { LitElement as a, nothing as s, html as n } from "lit";
2
+ import { ifDefined as h } from "lit/directives/if-defined.js";
3
+ import { createRef as u, ref as c } from "lit/directives/ref.js";
4
+ import { f as b } from "./form-check.styles-jBlHetYX.mjs";
5
+ import { i as p } from "./invalid-feedback.styles-he0JYrJm.mjs";
6
+ import { H as _ } from "./host-aria-WSGs7SPQ.mjs";
7
+ import { F as m, a as f, e as k } from "./form-associated-axmc5sY0.mjs";
8
+ import { t as g } from "./mp-toggle-button-Kz6sIgBJ.mjs";
9
+ const o = /* @__PURE__ */ new Set(["checkbox", "switch", "toggle_button"]), l = /* @__PURE__ */ new Set([
10
+ "primary",
11
+ "secondary",
12
+ "success",
13
+ "danger",
14
+ "warning",
15
+ "info",
16
+ "light",
17
+ "dark",
18
+ "outline-primary",
19
+ "outline-secondary",
20
+ "outline-success",
21
+ "outline-danger",
22
+ "outline-warning",
23
+ "outline-info",
24
+ "outline-light",
25
+ "outline-dark"
26
+ ]);
27
+ let d = 0;
28
+ class y extends m(a) {
29
+ constructor() {
30
+ super(...arguments), this._type = "checkbox", this._checked = !1, this._indeterminate = !1, this._disabled = !1, this._name = null, this._value = null, this._color = "primary", this._inputLabel = null, this._errorText = null, this.hostAria = new _(this, {
31
+ referenceTarget: () => this._inputRef.value ?? null,
32
+ describedByExtras: () => f(this.renderRoot)
33
+ }), this._inputId = `mp-checkbox-${++d}`, this._errorId = `mp-checkbox-${d}-error`, this._inputRef = u(), this.onInputChange = (e) => {
34
+ const t = e.target, i = t.checked, r = t.indeterminate;
35
+ this._checked = i, this._indeterminate = r, this.reflectBoolean("checked", i), this.reflectBoolean("indeterminate", r), this.dispatchEvent(
36
+ new CustomEvent("change", {
37
+ detail: {
38
+ checked: i,
39
+ indeterminate: r,
40
+ value: this._value
41
+ },
42
+ bubbles: !0,
43
+ composed: !0
44
+ })
45
+ );
46
+ };
47
+ }
48
+ static {
49
+ this.styles = [b, g, p];
50
+ }
51
+ static {
52
+ this.shadowRootOptions = {
53
+ ...a.shadowRootOptions,
54
+ delegatesFocus: !0
55
+ };
56
+ }
57
+ static get observedAttributes() {
58
+ return [
59
+ ...super.observedAttributes ?? [],
60
+ "invalid",
61
+ "required",
62
+ // Validation message rendered inside the shadow root and referenced by the
63
+ // inner <input>; shown only while `invalid` is also set.
64
+ "error-text",
65
+ "type",
66
+ "checked",
67
+ "indeterminate",
68
+ "disabled",
69
+ "name",
70
+ "value",
71
+ "color",
72
+ // Copied to the inner <input> in render() so consumers using the WC
73
+ // directly (without the Angular wrapper) can label the control.
74
+ "aria-label",
75
+ "input-label",
76
+ // NOT copied inward — resolved into element references against the host's
77
+ // tree by hostAria.syncReferences(). See renderCheckOrSwitch().
78
+ "aria-labelledby",
79
+ "aria-describedby"
80
+ ];
81
+ }
82
+ /**
83
+ * Optional override for the inner `<input>`'s accessible name, as
84
+ * `inputLabel` / `input-label`. Standardised on this name across the library
85
+ * rather than `label`, because the value lands on the control *inside* the shadow
86
+ * root.
87
+ *
88
+ * **Usually unnecessary — do not reach for it by default.** The shadow `<label>`
89
+ * wraps the `<input>` and contains the `<slot>`, and accessible-name computation
90
+ * walks the *flat* tree, so slotted light-DOM text already names the control:
91
+ * `<mp-checkbox>Accept terms</mp-checkbox>` computes the name "Accept terms" with
92
+ * nothing else passed. Verified against Chromium's real accessibility tree in
93
+ * the slotted-label spike (verdict in docs/prd/screen-reader-accessibility-plan.md) — an earlier version of this comment claimed the
94
+ * opposite, on the assumption that the slot boundary broke the association. It
95
+ * does not.
96
+ *
97
+ * So this exists for the two cases that genuinely need it: a checkbox with **no**
98
+ * visible text, and a name that must differ from the visible text. When both are
99
+ * present this wins, which is the right precedence for an override.
100
+ */
101
+ get inputLabel() {
102
+ return this._inputLabel;
103
+ }
104
+ set inputLabel(e) {
105
+ const t = e ?? null;
106
+ this._inputLabel !== t && (this._inputLabel = t, this.requestUpdate());
107
+ }
108
+ /**
109
+ * Validation message, as `errorText` / `error-text`. Rendered as a
110
+ * `.invalid-feedback` node inside the shadow root and referenced from the inner
111
+ * `<input>` by `aria-errormessage` **and** `aria-describedby` — but only while
112
+ * `invalid` is set, because `aria-errormessage` means nothing on a control that
113
+ * is not `aria-invalid`.
114
+ *
115
+ * Text rather than a node because the alternative does not work: a consumer's
116
+ * own `<small id="…">` lives outside this shadow root, and an IDREF from the
117
+ * inner input cannot reach it. On the Angular side `BsControlValidityDirective`
118
+ * fills this in from `NgControl.errors`.
119
+ */
120
+ get errorText() {
121
+ return this._errorText;
122
+ }
123
+ set errorText(e) {
124
+ const t = e ?? null;
125
+ this._errorText !== t && (this._errorText = t, this.requestUpdate());
126
+ }
127
+ get type() {
128
+ return this._type;
129
+ }
130
+ set type(e) {
131
+ !o.has(e) || this._type === e || (this._type = e, this.requestUpdate());
132
+ }
133
+ get checked() {
134
+ return this._checked;
135
+ }
136
+ set checked(e) {
137
+ const t = !!e;
138
+ this._checked !== t && (this._checked = t, this.reflectBoolean("checked", t), this.requestUpdate());
139
+ }
140
+ get indeterminate() {
141
+ return this._indeterminate;
142
+ }
143
+ set indeterminate(e) {
144
+ const t = !!e;
145
+ this._indeterminate !== t && (this._indeterminate = t, this.reflectBoolean("indeterminate", t), this.requestUpdate());
146
+ }
147
+ get disabled() {
148
+ return this._disabled;
149
+ }
150
+ set disabled(e) {
151
+ const t = !!e;
152
+ this._disabled !== t && (this._disabled = t, this.reflectBoolean("disabled", t), this.requestUpdate());
153
+ }
154
+ get name() {
155
+ return this._name;
156
+ }
157
+ set name(e) {
158
+ const t = e ?? null;
159
+ this._name !== t && (this._name = t, this.requestUpdate());
160
+ }
161
+ get value() {
162
+ return this._value;
163
+ }
164
+ set value(e) {
165
+ const t = e ?? null;
166
+ this._value !== t && (this._value = t, this.requestUpdate());
167
+ }
168
+ get color() {
169
+ return this._color;
170
+ }
171
+ set color(e) {
172
+ !l.has(e) || this._color === e || (this._color = e, this.requestUpdate());
173
+ }
174
+ attributeChangedCallback(e, t, i) {
175
+ switch (super.attributeChangedCallback(e, t, i), e) {
176
+ // Both are read straight from the host in render(), so a change has to ask
177
+ // for one. Without this the aria-invalid / aria-required the audit added
178
+ // were frozen at their first-render values, and the error message could
179
+ // never appear on a control that started out valid — which is every
180
+ // control driven by a form, since validity is mirrored after touch.
181
+ case "invalid":
182
+ case "required":
183
+ this.requestUpdate();
184
+ break;
185
+ case "error-text":
186
+ this._errorText = i, this.requestUpdate();
187
+ break;
188
+ case "type":
189
+ i && o.has(i) && (this._type = i, this.requestUpdate());
190
+ break;
191
+ case "checked":
192
+ this._checked = i !== null, this.requestUpdate();
193
+ break;
194
+ case "indeterminate":
195
+ this._indeterminate = i !== null, this.requestUpdate();
196
+ break;
197
+ case "disabled":
198
+ this._disabled = i !== null, this.requestUpdate();
199
+ break;
200
+ case "name":
201
+ this._name = i, this.requestUpdate();
202
+ break;
203
+ case "value":
204
+ this._value = i, this.requestUpdate();
205
+ break;
206
+ case "color":
207
+ i && l.has(i) && (this._color = i, this.requestUpdate());
208
+ break;
209
+ case "aria-label":
210
+ this.requestUpdate();
211
+ break;
212
+ case "input-label":
213
+ this._inputLabel = i, this.requestUpdate();
214
+ break;
215
+ case "aria-labelledby":
216
+ case "aria-describedby":
217
+ this.hostAria.syncReferences();
218
+ break;
219
+ }
220
+ }
221
+ render() {
222
+ return this._type === "toggle_button" ? this.renderToggleButton() : this.renderCheckOrSwitch();
223
+ }
224
+ // `indeterminate` is a DOM property only (no HTML attribute), so set it
225
+ // after each update from the source-of-truth field. Skipped on the
226
+ // toggle_button variant because btn-check + .active doesn't model a
227
+ // mixed state visually.
228
+ updated() {
229
+ const e = this._inputRef.value;
230
+ e && (e.indeterminate = this._indeterminate && this._type !== "toggle_button"), this.hostAria.syncReferences(), this.syncFormValue(), this.setFormValidity(
231
+ { valueMissing: this.hasAttribute("required") && !this._checked },
232
+ "Please check this box."
233
+ );
234
+ }
235
+ renderCheckOrSwitch() {
236
+ const e = this._type === "switch", t = this.getAttribute("aria-label") ?? this._inputLabel ?? void 0, i = this.errorFeedback();
237
+ return n`
238
+ <label class=${e ? "form-check form-switch" : "form-check"}>
239
+ <input
240
+ ${c(this._inputRef)}
241
+ type="checkbox"
242
+ class="form-check-input"
243
+ id=${this._inputId}
244
+ .checked=${this._checked}
245
+ ?disabled=${this._disabled}
246
+ aria-invalid=${this.hasAttribute("invalid") ? "true" : s}
247
+ aria-required=${this.hasAttribute("required") ? "true" : s}
248
+ aria-errormessage=${i.id}
249
+ aria-describedby=${i.id}
250
+ name=${this._name ?? s}
251
+ value=${this._value ?? s}
252
+ role=${e ? "switch" : s}
253
+ aria-checked=${this._indeterminate ? "mixed" : s}
254
+ aria-label=${h(t)}
255
+ @change=${this.onInputChange}
256
+ />
257
+ <span class="form-check-label"><slot></slot></span>
258
+ </label>
259
+ ${i.node}
260
+ `;
261
+ }
262
+ errorFeedback() {
263
+ return k(this._errorId, this._errorText, this.hasAttribute("invalid"));
264
+ }
265
+ renderToggleButton() {
266
+ const e = this.getAttribute("aria-label") ?? this._inputLabel ?? void 0, t = this.errorFeedback();
267
+ return n`
268
+ <input
269
+ ${c(this._inputRef)}
270
+ type="checkbox"
271
+ class="btn-check"
272
+ id=${this._inputId}
273
+ .checked=${this._checked}
274
+ ?disabled=${this._disabled}
275
+ aria-invalid=${this.hasAttribute("invalid") ? "true" : s}
276
+ aria-required=${this.hasAttribute("required") ? "true" : s}
277
+ aria-errormessage=${t.id}
278
+ aria-describedby=${t.id}
279
+ name=${this._name ?? s}
280
+ value=${this._value ?? s}
281
+ role="button"
282
+ aria-pressed=${this._checked ? "true" : "false"}
283
+ aria-label=${h(e)}
284
+ @change=${this.onInputChange}
285
+ />
286
+ <label class="btn btn-${this._color}" for=${this._inputId}>
287
+ <slot></slot>
288
+ </label>
289
+ ${t.node}
290
+ `;
291
+ }
292
+ reflectBoolean(e, t) {
293
+ t ? this.setAttribute(e, "") : this.removeAttribute(e);
294
+ }
295
+ // ---- form association (FormAssociatedHost) ----
296
+ formValue() {
297
+ return this._checked ? this._value ?? "on" : null;
298
+ }
299
+ formReset() {
300
+ this._checked = !1, this._indeterminate = !1, this.reflectBoolean("checked", !1), this.reflectBoolean("indeterminate", !1), this.requestUpdate();
301
+ }
302
+ formRestore(e) {
303
+ this._checked = e != null, this.reflectBoolean("checked", this._checked), this.requestUpdate();
304
+ }
305
+ formValidityAnchor() {
306
+ return this._inputRef.value ?? null;
307
+ }
308
+ }
309
+ typeof customElements < "u" && !customElements.get("mp-checkbox") && customElements.define("mp-checkbox", y);
310
+ export {
311
+ y as M
312
+ };