@mintplayer/web-components 2.1.1 → 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 (128) 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.d.ts +1 -0
  15. package/accordion/index.mjs +549 -0
  16. package/accordion/src/components/index.d.ts +3 -0
  17. package/accordion/src/components/mp-accordion-tab.d.ts +30 -0
  18. package/accordion/src/components/mp-accordion.d.ts +66 -0
  19. package/accordion/src/index.d.ts +3 -0
  20. package/accordion/src/styles/index.d.ts +1 -0
  21. package/calendar/index.mjs +1 -1
  22. package/calendar/src/mp-calendar.element.d.ts +2 -0
  23. package/carousel/index.d.ts +1 -0
  24. package/carousel/index.mjs +994 -0
  25. package/carousel/src/components/index.d.ts +1 -0
  26. package/carousel/src/components/mp-carousel.d.ts +58 -0
  27. package/carousel/src/index.d.ts +3 -0
  28. package/carousel/src/styles/index.d.ts +1 -0
  29. package/carousel/src/types/carousel.d.ts +10 -0
  30. package/carousel/src/types/index.d.ts +1 -0
  31. package/checkbox/index.mjs +1 -1
  32. package/checkbox/src/components/mp-checkbox.d.ts +59 -1
  33. package/chunks/focus-restore-DxuP1Oe2.mjs +94 -0
  34. package/chunks/focus-trap-DTOLJ5bb.mjs +121 -0
  35. package/chunks/form-associated-axmc5sY0.mjs +58 -0
  36. package/chunks/host-aria-WSGs7SPQ.mjs +152 -0
  37. package/chunks/inert-regions-DXCnn1LN.mjs +48 -0
  38. package/chunks/invalid-feedback.styles-he0JYrJm.mjs +11 -0
  39. package/chunks/{live-announcer-CZDTKulf.mjs → live-announcer-Bi0orG4n.mjs} +9 -9
  40. package/chunks/{mp-calendar.element-UC68iDbi.mjs → mp-calendar.element-u6uS31_j.mjs} +136 -105
  41. package/chunks/mp-checkbox-Ph2mMRGz.mjs +312 -0
  42. package/chunks/{mp-datatable-Bfw0KGkV.mjs → mp-datatable-BwTlh9A_.mjs} +265 -103
  43. package/chunks/{mp-pagination-BGxsawFL.mjs → mp-pagination-Dea75mD4.mjs} +25 -22
  44. package/chunks/mp-radio-BjW1HNSc.mjs +300 -0
  45. package/chunks/{mp-select-BDS1-YGn.mjs → mp-select-Ctu-v1-p.mjs} +163 -40
  46. package/chunks/{mp-splitter-C8cGCmac.mjs → mp-splitter-LszuRDbR.mjs} +53 -46
  47. package/chunks/{mp-tab-page-D1b4x-y2.mjs → mp-tab-page-CaCzX1ym.mjs} +46 -45
  48. package/chunks/{mp-timepicker.element-BwEiwX92.mjs → mp-timepicker.element-Bz393NDQ.mjs} +93 -86
  49. package/chunks/{mp-toggle-button-dLZNDUVz.mjs → mp-toggle-button-Kz6sIgBJ.mjs} +131 -37
  50. package/chunks/{mp-treeview-C48F63xb.mjs → mp-treeview-tkWu28iF.mjs} +67 -43
  51. package/chunks/overlay-controller-DPt13i8p.mjs +314 -0
  52. package/chunks/roving-focus-CrL9982a.mjs +129 -0
  53. package/code-snippet/index.mjs +21 -13
  54. package/code-snippet/src/mp-code-snippet.element.d.ts +6 -0
  55. package/datatable/index.mjs +1 -1
  56. package/datatable/src/components/mp-datatable.d.ts +50 -0
  57. package/datatable/src/types/index.d.ts +2 -0
  58. package/datatable/src/types/labels.d.ts +30 -0
  59. package/datepicker/index.mjs +45 -22
  60. package/datepicker/src/mp-datepicker.element.d.ts +30 -0
  61. package/datetime-picker/index.mjs +15 -9
  62. package/dock/index.mjs +365 -209
  63. package/dock/src/components/mint-dock-manager.element.d.ts +63 -3
  64. package/dropdown-menu/index.mjs +135 -90
  65. package/dropdown-menu/src/components/mp-dropdown-menu.d.ts +12 -3
  66. package/file-manager/index.mjs +279 -214
  67. package/file-manager/src/components/mp-file-manager.d.ts +22 -0
  68. package/file-manager/src/types/messages.d.ts +9 -0
  69. package/multi-range/index.mjs +26 -10
  70. package/multi-range/src/mint-multi-range.element.d.ts +7 -0
  71. package/navbar/index.mjs +53 -39
  72. package/navbar/src/components/mp-navbar.d.ts +1 -0
  73. package/otp-input/index.mjs +82 -48
  74. package/otp-input/src/mint-otp-input.element.d.ts +31 -3
  75. package/overlay/index.mjs +2 -258
  76. package/overlay/src/overlay-controller.d.ts +64 -4
  77. package/package.json +21 -1
  78. package/pagination/index.mjs +1 -1
  79. package/query-builder/index.mjs +117 -87
  80. package/query-builder/src/model/messages.d.ts +9 -0
  81. package/radio/index.mjs +2 -160
  82. package/radio/src/components/mp-radio.d.ts +58 -3
  83. package/radio-group/index.d.ts +1 -0
  84. package/radio-group/index.mjs +145 -0
  85. package/radio-group/src/components/mp-radio-group.d.ts +52 -0
  86. package/radio-group/src/index.d.ts +1 -0
  87. package/radio-group/src/styles/radio-group.styles.d.ts +2 -0
  88. package/ribbon/index.mjs +316 -304
  89. package/ribbon/src/mp-ribbon.element.d.ts +16 -0
  90. package/scheduler/index.mjs +219 -132
  91. package/scheduler/src/components/mp-scheduler.d.ts +3 -0
  92. package/scheduler/src/views/base-view.d.ts +23 -0
  93. package/select/index.mjs +1 -1
  94. package/select/src/components/mp-select.d.ts +60 -3
  95. package/shell/index.mjs +142 -31
  96. package/shell/src/components/mp-shell.d.ts +1 -0
  97. package/signature-pad/index.d.ts +1 -0
  98. package/signature-pad/index.mjs +230 -0
  99. package/signature-pad/src/index.d.ts +2 -0
  100. package/signature-pad/src/mp-signature-pad.element.d.ts +143 -0
  101. package/signature-pad/src/mp-signature-pad.element.template.d.ts +2 -0
  102. package/signature-pad/src/types/signature.d.ts +12 -0
  103. package/splitter/index.mjs +1 -1
  104. package/splitter/src/components/mp-splitter.d.ts +7 -0
  105. package/splitter/src/index.d.ts +1 -1
  106. package/swiper-core/index.d.ts +1 -0
  107. package/swiper-core/index.mjs +184 -0
  108. package/swiper-core/src/index-machine.d.ts +59 -0
  109. package/swiper-core/src/index.d.ts +4 -0
  110. package/swiper-core/src/keymap.d.ts +2 -0
  111. package/swiper-core/src/models/index.d.ts +1 -0
  112. package/swiper-core/src/models/types.d.ts +99 -0
  113. package/swiper-core/src/pointer-arbiter.d.ts +45 -0
  114. package/tab-control/index.mjs +1 -1
  115. package/tile-manager/index.mjs +110 -93
  116. package/timeline/index.mjs +138 -54
  117. package/timeline/src/components/mp-timeline.d.ts +15 -0
  118. package/timepicker/index.mjs +1 -1
  119. package/timepicker/src/mp-time-list.element.d.ts +13 -4
  120. package/timepicker/src/mp-timepicker.element.d.ts +29 -0
  121. package/toggle-button/index.mjs +1 -1
  122. package/toggle-button/src/components/mp-toggle-button.d.ts +32 -1
  123. package/tree-select/index.mjs +233 -121
  124. package/tree-select/src/components/mp-tree-select.d.ts +37 -0
  125. package/treeview/index.mjs +1 -1
  126. package/treeview/src/components/mp-treeview.d.ts +10 -1
  127. package/chunks/mp-checkbox-BokLL7BS.mjs +0 -211
  128. package/dropdown/src/styles/dropdown.styles.d.ts +0 -2
@@ -1,5 +1,5 @@
1
- import { unsafeCSS as v, LitElement as d, html as i, nothing as n, css as c } from "lit";
2
- const u = v(`.nav {
1
+ import { unsafeCSS as c, LitElement as d, html as i, nothing as n, css as v } from "lit";
2
+ const u = c(`.nav {
3
3
  --bs-nav-link-padding-x: 1rem;
4
4
  --bs-nav-link-padding-y: 0.5rem;
5
5
  --bs-nav-link-font-weight: ;
@@ -237,7 +237,7 @@ class p extends d {
237
237
  connectedCallback() {
238
238
  super.connectedCallback(), this.mutationObserver = new MutationObserver(() => this.refreshTabs()), this.mutationObserver.observe(this, {
239
239
  childList: !0,
240
- subtree: !1,
240
+ subtree: !0,
241
241
  attributes: !0,
242
242
  attributeFilter: ["slot", "data-disabled", "data-hidden"]
243
243
  }), this.refreshTabs();
@@ -245,8 +245,8 @@ class p extends d {
245
245
  disconnectedCallback() {
246
246
  this.mutationObserver?.disconnect(), this.mutationObserver = null, super.disconnectedCallback();
247
247
  }
248
- attributeChangedCallback(t, e, a) {
249
- super.attributeChangedCallback(t, e, a), e !== a && this.requestUpdate();
248
+ attributeChangedCallback(t, e, r) {
249
+ super.attributeChangedCallback(t, e, r), e !== r && this.requestUpdate();
250
250
  }
251
251
  get tabsPosition() {
252
252
  return this.getAttribute("tabs-position") === "bottom" ? "bottom" : "top";
@@ -265,18 +265,18 @@ class p extends d {
265
265
  refreshTabs() {
266
266
  const t = /* @__PURE__ */ new Map();
267
267
  for (const e of Array.from(this.children)) {
268
- const a = e.getAttribute("slot");
269
- if (!a) continue;
270
- const r = a.match(/^(.+)-content$/);
271
- if (!r || h(e)) continue;
272
- const o = r[1], s = e.hasAttribute("data-disabled") && e.getAttribute("data-disabled") !== "false";
268
+ const r = e.getAttribute("slot");
269
+ if (!r) continue;
270
+ const a = r.match(/^(.+)-content$/);
271
+ if (!a || h(e)) continue;
272
+ const o = a[1], s = e.hasAttribute("data-disabled") && e.getAttribute("data-disabled") !== "false";
273
273
  t.has(o) || t.set(o, { tabId: o, disabled: s });
274
274
  }
275
275
  this.tabs = Array.from(t.values()), this.requestUpdate();
276
276
  }
277
277
  resolvedActiveTabId() {
278
278
  const t = this.activeTabId;
279
- return t !== null && this.tabs.some((a) => a.tabId === t && !a.disabled) ? t : this.selectFirstTab ? this.tabs.find((a) => !a.disabled)?.tabId ?? null : null;
279
+ return t !== null && this.tabs.some((r) => r.tabId === t && !r.disabled) ? t : this.selectFirstTab ? this.tabs.find((r) => !r.disabled)?.tabId ?? null : null;
280
280
  }
281
281
  render() {
282
282
  const t = this.resolvedActiveTabId(), e = i`
@@ -288,9 +288,9 @@ class p extends d {
288
288
  ${this.tabs.map((s) => this.renderTabHeader(s, t))}
289
289
  </ul>
290
290
  </div>
291
- `, a = this.border, o = i`
291
+ `, r = this.border, o = i`
292
292
  <div
293
- class="tab-content flex-grow-1 overflow-auto${a === "none" ? "" : a === "top" ? " border-top" : t ? " border" : " border-top"}"
293
+ class="tab-content flex-grow-1 overflow-auto${r === "none" ? "" : r === "top" ? " border-top" : t ? " border" : " border-top"}"
294
294
  role=${t ? "tabpanel" : n}
295
295
  id=${t ? `${t}-panel` : n}
296
296
  aria-labelledby=${t ? `${t}-header-button` : n}
@@ -306,20 +306,20 @@ class p extends d {
306
306
  `;
307
307
  }
308
308
  renderTabHeader(t, e) {
309
- const a = t.tabId === e;
309
+ const r = t.tabId === e;
310
310
  return i`
311
311
  <li class="nav-item" role="presentation">
312
312
  <button
313
313
  type="button"
314
- class="nav-link text-nowrap${a ? " active" : ""}${t.disabled ? " disabled" : ""}"
314
+ class="nav-link text-nowrap${r ? " active" : ""}${t.disabled ? " disabled" : ""}"
315
315
  role="tab"
316
316
  id=${`${t.tabId}-header-button`}
317
317
  aria-controls=${`${t.tabId}-panel`}
318
- aria-selected=${a ? "true" : "false"}
318
+ aria-selected=${r ? "true" : "false"}
319
319
  ?disabled=${t.disabled}
320
- tabindex=${t.disabled ? -1 : a ? 0 : -1}
321
- @click=${(r) => this.activate(t, r)}
322
- @keydown=${(r) => this.handleKeydown(t, r)}
320
+ tabindex=${t.disabled ? -1 : r ? 0 : -1}
321
+ @click=${(a) => this.activate(t, a)}
322
+ @keydown=${(a) => this.handleKeydown(t, a)}
323
323
  >
324
324
  <slot name=${`${t.tabId}-header`}></slot>
325
325
  </button>
@@ -336,30 +336,31 @@ class p extends d {
336
336
  ), this.setAttribute("active-tab", t.tabId));
337
337
  }
338
338
  handleKeydown(t, e) {
339
- switch (e.key) {
340
- case "Enter":
341
- case " ":
342
- this.activate(t, e);
343
- return;
344
- case "Home":
345
- case "End": {
346
- e.preventDefault();
347
- const a = this.tabs.filter((o) => !o.disabled);
348
- if (a.length === 0) return;
349
- const r = e.key === "Home" ? a[0] : a[a.length - 1];
350
- this.moveFocusAndActivate(r, e);
351
- return;
339
+ if (!(e.altKey || e.ctrlKey || e.metaKey))
340
+ switch (e.key) {
341
+ case "Enter":
342
+ case " ":
343
+ this.activate(t, e);
344
+ return;
345
+ case "Home":
346
+ case "End": {
347
+ e.preventDefault();
348
+ const r = this.tabs.filter((o) => !o.disabled);
349
+ if (r.length === 0) return;
350
+ const a = e.key === "Home" ? r[0] : r[r.length - 1];
351
+ this.moveFocusAndActivate(a, e);
352
+ return;
353
+ }
354
+ case "ArrowLeft":
355
+ case "ArrowRight": {
356
+ e.preventDefault();
357
+ const r = e.key === "ArrowRight" ? 1 : -1, a = this.tabs.filter((l) => !l.disabled);
358
+ if (a.length === 0) return;
359
+ const s = (a.findIndex((l) => l.tabId === t.tabId) + r + a.length) % a.length;
360
+ this.moveFocusAndActivate(a[s], e);
361
+ return;
362
+ }
352
363
  }
353
- case "ArrowLeft":
354
- case "ArrowRight": {
355
- e.preventDefault();
356
- const a = e.key === "ArrowRight" ? 1 : -1, r = this.tabs.filter((l) => !l.disabled);
357
- if (r.length === 0) return;
358
- const s = (r.findIndex((l) => l.tabId === t.tabId) + a + r.length) % r.length;
359
- this.moveFocusAndActivate(r[s], e);
360
- return;
361
- }
362
- }
363
364
  }
364
365
  moveFocusAndActivate(t, e) {
365
366
  this.setAttribute("active-tab", t.tabId), this.shadowRoot?.querySelector(
@@ -376,7 +377,7 @@ class p extends d {
376
377
  typeof customElements < "u" && !customElements.get("mp-tab-control") && customElements.define("mp-tab-control", p);
377
378
  class f extends d {
378
379
  static {
379
- this.styles = c`
380
+ this.styles = v`
380
381
  :host {
381
382
  display: block;
382
383
  }
@@ -392,8 +393,8 @@ class f extends d {
392
393
  connectedCallback() {
393
394
  super.connectedCallback(), this.syncSlot(), this.syncDisabled();
394
395
  }
395
- attributeChangedCallback(t, e, a) {
396
- super.attributeChangedCallback(t, e, a), e !== a && (t === "tab-id" && this.syncSlot(), t === "disabled" && this.syncDisabled());
396
+ attributeChangedCallback(t, e, r) {
397
+ super.attributeChangedCallback(t, e, r), e !== r && (t === "tab-id" && this.syncSlot(), t === "disabled" && this.syncDisabled());
397
398
  }
398
399
  syncSlot() {
399
400
  const t = this.getAttribute("tab-id");
@@ -1,10 +1,13 @@
1
- import { html as l, unsafeCSS as b, LitElement as f, nothing as h } from "lit";
2
- import { query as p } from "lit/decorators.js";
3
- import { OverlayController as g } from "../overlay/index.mjs";
4
- l`<!-- Time-slot listbox rendered dynamically by render(). This file exists only
1
+ import { html as n, unsafeCSS as h, LitElement as p, nothing as c } from "lit";
2
+ import { query as u } from "lit/decorators.js";
3
+ import { O as b } from "./overlay-controller-DPt13i8p.mjs";
4
+ import "lit/directives/ref.js";
5
+ import { H as f } from "./host-aria-WSGs7SPQ.mjs";
6
+ import { R as g } from "./roving-focus-CrL9982a.mjs";
7
+ n`<!-- Time-slot listbox rendered dynamically by render(). This file exists only
5
8
  so the codegen-wc target emits a \`styles\` export from the sibling .scss;
6
9
  the \`template\` export is intentionally unused. -->`;
7
- const y = b(`:host {
10
+ const y = h(`:host {
8
11
  display: block;
9
12
  box-sizing: border-box;
10
13
  max-height: 250px;
@@ -55,42 +58,24 @@ ul {
55
58
  }
56
59
  }`);
57
60
  let v = 0;
58
- class w extends f {
61
+ class w extends p {
59
62
  constructor() {
60
- super(...arguments), this.selectedTime = null, this.step = 15, this.min = null, this.max = null, this.hour12 = "auto", this.locale = void 0, this._focusedMinutes = null, this.pendingFocusMove = !1, this.instanceId = `mp-tl-${++v}`, this.onHostKeyDown = (e) => {
61
- const t = e.key, r = t === "ArrowUp" || t === "ArrowDown" || t === "Home" || t === "End" || t === "PageUp" || t === "PageDown", i = t === "Enter" || t === " ";
62
- if (!r && !i) return;
63
- e.preventDefault();
64
- const s = this.focusableMinutes();
65
- if (i) {
66
- this.selectMinutes(s);
67
- return;
63
+ super(...arguments), this.selectedTime = null, this.step = 15, this.min = null, this.max = null, this.hour12 = "auto", this.locale = void 0, this._focusedMinutes = null, this.instanceId = `mp-tl-${++v}`, this.roving = new g({
64
+ items: () => Array.from(this.renderRoot?.querySelectorAll("button.slot") ?? []),
65
+ orientation: "vertical",
66
+ onActiveChange: (e) => {
67
+ const t = Number(e.dataset.minutes);
68
+ Number.isNaN(t) || (this._focusedMinutes = t, this.requestUpdate());
68
69
  }
69
- const o = this.slots(), d = o[0].minutes, c = o[o.length - 1].minutes;
70
- let n = s;
71
- switch (t) {
72
- case "ArrowUp":
73
- n = Math.max(d, s - this.step);
74
- break;
75
- case "ArrowDown":
76
- n = Math.min(c, s + this.step);
77
- break;
78
- case "Home":
79
- n = d;
80
- break;
81
- case "End":
82
- n = c;
83
- break;
84
- case "PageUp":
85
- n = Math.max(d, s - 60);
86
- break;
87
- case "PageDown":
88
- n = Math.min(c, s + 60);
89
- break;
70
+ }), this.onHostKeyDown = (e) => {
71
+ const t = e.key;
72
+ if (t === "PageUp" || t === "PageDown") {
73
+ e.preventDefault();
74
+ const s = this.slots(), i = this.focusableMinutes(), r = t === "PageUp" ? Math.max(s[0].minutes, i - 60) : Math.min(s[s.length - 1].minutes, i + 60), o = s.findIndex((m) => m.minutes === r);
75
+ o >= 0 && this.roving.moveTo(o);
76
+ return;
90
77
  }
91
- this._focusedMinutes = n, this.pendingFocusMove = !0, this.requestUpdate();
92
- }, this.onHostFocus = () => {
93
- this._focusedMinutes === null && (this._focusedMinutes = this.focusableMinutes(), this.requestUpdate());
78
+ this.roving.onKeydown(e) && e.preventDefault();
94
79
  };
95
80
  }
96
81
  static {
@@ -108,24 +93,32 @@ class w extends f {
108
93
  };
109
94
  }
110
95
  connectedCallback() {
111
- super.connectedCallback(), this.hasAttribute("role") || this.setAttribute("role", "listbox"), this.hasAttribute("aria-label") || this.setAttribute("aria-label", "Select time"), this.hasAttribute("tabindex") || this.setAttribute("tabindex", "0"), this.addEventListener("keydown", this.onHostKeyDown), this.addEventListener("focus", this.onHostFocus);
96
+ super.connectedCallback(), this.hasAttribute("role") || this.setAttribute("role", "listbox"), this.hasAttribute("aria-label") || this.setAttribute("aria-label", "Select time"), this.addEventListener("keydown", this.onHostKeyDown);
112
97
  }
113
98
  disconnectedCallback() {
114
- super.disconnectedCallback(), this.removeEventListener("keydown", this.onHostKeyDown), this.removeEventListener("focus", this.onHostFocus);
99
+ super.disconnectedCallback(), this.removeEventListener("keydown", this.onHostKeyDown);
115
100
  }
116
101
  updated() {
117
- this.pendingFocusMove && (this.pendingFocusMove = !1, this.scrollFocusedIntoView());
102
+ const e = this.renderRoot?.querySelector(
103
+ `button.slot[data-minutes="${this.focusableMinutes()}"]:not([disabled])`
104
+ );
105
+ e ? this.roving.setActiveItem(e) : this.roving.sync();
106
+ }
107
+ /** Focus the list = focus its active option (the popup calls host.focus()). */
108
+ focus(e) {
109
+ const t = this.roving.activeItem;
110
+ t ? t.focus(e) : super.focus(e);
118
111
  }
119
112
  /** All slots between 00:00 and 24:00 - step, in step-minute increments. */
120
113
  slots() {
121
114
  const e = /* @__PURE__ */ new Date();
122
115
  e.setHours(0, 0, 0, 0);
123
- const t = Math.floor(1440 / this.step), r = [];
116
+ const t = Math.floor(1440 / this.step), s = [];
124
117
  for (let i = 0; i < t; i++) {
125
- const s = i * this.step, o = new Date(e.getTime() + s * 6e4);
126
- r.push({ minutes: s, date: o, label: this.formatTime(o) });
118
+ const r = i * this.step, o = new Date(e.getTime() + r * 6e4);
119
+ s.push({ minutes: r, date: o, label: this.formatTime(o) });
127
120
  }
128
- return r;
121
+ return s;
129
122
  }
130
123
  formatTime(e) {
131
124
  const t = this.resolvedHour12();
@@ -167,51 +160,46 @@ class w extends f {
167
160
  if (this.isDisabledMinutes(e)) return;
168
161
  const t = /* @__PURE__ */ new Date();
169
162
  t.setHours(0, 0, 0, 0);
170
- const r = new Date(t.getTime() + e * 6e4);
171
- this.selectedTime = r, this._focusedMinutes = e, this.requestUpdate(), this.dispatchEvent(
163
+ const s = new Date(t.getTime() + e * 6e4);
164
+ this.selectedTime = s, this._focusedMinutes = e, this.requestUpdate(), this.dispatchEvent(
172
165
  new CustomEvent("selected-time-change", {
173
- detail: new Date(r.getTime()),
166
+ detail: new Date(s.getTime()),
174
167
  bubbles: !0,
175
168
  composed: !0
176
169
  })
177
170
  );
178
171
  }
179
- scrollFocusedIntoView() {
180
- const e = this._focusedMinutes;
181
- if (e === null) return;
182
- const t = this.renderRoot.querySelector(`[id="${this.slotId(e)}"]`);
183
- t && typeof t.scrollIntoView == "function" && t.scrollIntoView({ block: "nearest" });
184
- }
185
172
  /* ---- Render ---- */
186
173
  render() {
187
174
  const e = this.slots(), t = this.focusableMinutes();
188
- return this.setAttribute("aria-activedescendant", this.slotId(t)), l`
175
+ return n`
189
176
  <ul role="presentation">
190
- ${e.map((r) => this.renderSlot(r, t))}
177
+ ${e.map((s) => this.renderSlot(s, t))}
191
178
  </ul>
192
179
  `;
193
180
  }
194
181
  renderSlot(e, t) {
195
- const r = this.isSelected(e.minutes), i = this.isDisabledMinutes(e.minutes);
196
- return l`<li role="presentation">
182
+ const s = this.isSelected(e.minutes), i = this.isDisabledMinutes(e.minutes);
183
+ return n`<li role="presentation">
197
184
  <button
198
185
  type="button"
199
186
  class="slot"
200
187
  role="option"
201
188
  id="${this.slotId(e.minutes)}"
202
- aria-selected="${r ? "true" : "false"}"
203
- aria-disabled="${i ? "true" : h}"
189
+ data-minutes="${e.minutes}"
190
+ aria-selected="${s ? "true" : "false"}"
191
+ aria-disabled="${i ? "true" : c}"
204
192
  ?disabled="${i}"
205
- data-focused="${e.minutes === t ? "true" : h}"
193
+ data-focused="${e.minutes === t ? "true" : c}"
206
194
  @click="${() => this.selectMinutes(e.minutes)}"
207
195
  >${e.label}</button>
208
196
  </li>`;
209
197
  }
210
198
  }
211
199
  typeof customElements < "u" && !customElements.get("mp-time-list") && customElements.define("mp-time-list", w);
212
- l`<!-- Rendered dynamically by render(). This file exists only so the codegen-wc
200
+ n`<!-- Rendered dynamically by render(). This file exists only so the codegen-wc
213
201
  target emits a \`styles\` export from the sibling .scss. -->`;
214
- const x = b(`:host {
202
+ const x = h(`:host {
215
203
  display: inline-block;
216
204
  position: relative;
217
205
  box-sizing: border-box;
@@ -301,20 +289,25 @@ button.trigger svg {
301
289
  transition: none !important;
302
290
  }
303
291
  }`);
304
- var M = Object.defineProperty, m = (a, e, t, r) => {
305
- for (var i = void 0, s = a.length - 1, o; s >= 0; s--)
306
- (o = a[s]) && (i = o(e, t, i) || i);
307
- return i && M(e, t, i), i;
292
+ var T = Object.defineProperty, d = (a, e, t, s) => {
293
+ for (var i = void 0, r = a.length - 1, o; r >= 0; r--)
294
+ (o = a[r]) && (i = o(e, t, i) || i);
295
+ return i && T(e, t, i), i;
308
296
  };
309
- const k = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M8 3.5a.5.5 0 0 0-1 0V9a.5.5 0 0 0 .252.434l3.5 2a.5.5 0 0 0 .496-.868L8 8.71V3.5z"/><path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm7-8A7 7 0 1 1 1 8a7 7 0 0 1 14 0z"/></svg>';
310
- let T = 0;
311
- class u extends f {
297
+ const $ = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M8 3.5a.5.5 0 0 0-1 0V9a.5.5 0 0 0 .252.434l3.5 2a.5.5 0 0 0 .496-.868L8 8.71V3.5z"/><path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm7-8A7 7 0 1 1 1 8a7 7 0 0 1 14 0z"/></svg>';
298
+ let E = 0;
299
+ class l extends p {
312
300
  constructor() {
313
- super(...arguments), this.selectedTime = null, this.step = 15, this.min = null, this.max = null, this.hour12 = "auto", this.locale = void 0, this.disabled = !1, this.placeholder = "", this.triggerLabel = "Choose time", this.instanceId = `mp-tp-${++T}`, this.popupId = `${this.instanceId}-popup`, this.overlay = new g(this, {
301
+ super(...arguments), this.selectedTime = null, this.step = 15, this.min = null, this.max = null, this.hour12 = "auto", this.locale = void 0, this.disabled = !1, this.placeholder = "", this.triggerLabel = "Choose time", this.inputLabel = "Selected time", this.ariaLabelForRender = null, this.ariaLabelledByForSync = null, this.ariaDescribedByForSync = null, this.instanceId = `mp-tp-${++E}`, this.popupId = `${this.instanceId}-popup`, this.hostAria = new f(this, {
302
+ referenceTarget: () => this.displayInputEl ?? null
303
+ }), this.overlay = new b(this, {
314
304
  anchor: () => this.inputGroupEl ?? this.triggerEl ?? null,
315
305
  trigger: () => this.triggerEl ?? null,
316
306
  panel: () => this.popupEl ?? null,
317
307
  panelWidth: "anchor-min",
308
+ // Opening moves focus onto the time list's active option (its focus()
309
+ // override lands there). A slotted consumer list wins over the default.
310
+ initialFocus: () => this.popupEl?.querySelector('slot[name="time-list"]')?.assignedElements()[0] ?? this.popupEl?.querySelector("mp-time-list") ?? null,
318
311
  onOpen: () => this.dispatchEvent(new CustomEvent("opened", { bubbles: !0, composed: !0 })),
319
312
  onClose: () => this.dispatchEvent(new CustomEvent("closed", { bubbles: !0, composed: !0 }))
320
313
  }), this.onTriggerClick = async () => {
@@ -345,9 +338,19 @@ class u extends f {
345
338
  locale: { attribute: "locale", type: String, reflect: !0 },
346
339
  disabled: { attribute: "disabled", type: Boolean, reflect: !0 },
347
340
  placeholder: { attribute: "placeholder", type: String, reflect: !0 },
348
- triggerLabel: { attribute: "trigger-label", type: String, reflect: !0 }
341
+ triggerLabel: { attribute: "trigger-label", type: String, reflect: !0 },
342
+ inputLabel: { attribute: "input-label", type: String, reflect: !0 },
343
+ // Phantom properties: re-render / re-sync when the host attributes change.
344
+ // The consumer's aria-label wins over inputLabel, as everywhere.
345
+ ariaLabelForRender: { attribute: "aria-label", type: String, reflect: !1 },
346
+ ariaLabelledByForSync: { attribute: "aria-labelledby", type: String, reflect: !1 },
347
+ ariaDescribedByForSync: { attribute: "aria-describedby", type: String, reflect: !1 }
349
348
  };
350
349
  }
350
+ // After every render: the display input does not exist before the first one.
351
+ updated() {
352
+ this.hostAria.syncReferences();
353
+ }
351
354
  async open() {
352
355
  this.disabled || await this.overlay.open();
353
356
  }
@@ -370,15 +373,16 @@ class u extends f {
370
373
  }
371
374
  render() {
372
375
  const e = this.formatDisplay();
373
- return l`
376
+ return n`
374
377
  <div class="input-group">
375
378
  <input
376
379
  class="form-control"
377
380
  type="text"
378
381
  readonly
379
382
  aria-readonly="true"
383
+ aria-label="${this.getAttribute("aria-label") ?? this.inputLabel}"
380
384
  .value="${e}"
381
- placeholder="${this.placeholder || h}"
385
+ placeholder="${this.placeholder || c}"
382
386
  ?disabled="${this.disabled}"
383
387
  />
384
388
  <button
@@ -391,7 +395,7 @@ class u extends f {
391
395
  ?disabled="${this.disabled}"
392
396
  @click="${this.onTriggerClick}"
393
397
  @keydown="${this.onTriggerKeyDown}"
394
- .innerHTML="${k}"
398
+ .innerHTML="${$}"
395
399
  ></button>
396
400
  </div>
397
401
  <div class="popup" id="${this.popupId}">
@@ -412,17 +416,20 @@ class u extends f {
412
416
  `;
413
417
  }
414
418
  }
415
- m([
416
- p("button.trigger")
417
- ], u.prototype, "triggerEl");
418
- m([
419
- p(".input-group")
420
- ], u.prototype, "inputGroupEl");
421
- m([
422
- p(".popup")
423
- ], u.prototype, "popupEl");
424
- typeof customElements < "u" && !customElements.get("mp-timepicker") && customElements.define("mp-timepicker", u);
419
+ d([
420
+ u("input.form-control")
421
+ ], l.prototype, "displayInputEl");
422
+ d([
423
+ u("button.trigger")
424
+ ], l.prototype, "triggerEl");
425
+ d([
426
+ u(".input-group")
427
+ ], l.prototype, "inputGroupEl");
428
+ d([
429
+ u(".popup")
430
+ ], l.prototype, "popupEl");
431
+ typeof customElements < "u" && !customElements.get("mp-timepicker") && customElements.define("mp-timepicker", l);
425
432
  export {
426
433
  w as M,
427
- u as a
434
+ l as a
428
435
  };