@mintplayer/web-components 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/a11y/index.mjs +26 -2
- package/a11y/src/dismiss-stack.d.ts +25 -0
- package/a11y/src/error-text.d.ts +41 -0
- package/a11y/src/focus-restore.d.ts +116 -0
- package/a11y/src/focus-trap.d.ts +69 -0
- package/a11y/src/form-associated.d.ts +48 -0
- package/a11y/src/host-aria.d.ts +154 -0
- package/a11y/src/index.d.ts +16 -0
- package/a11y/src/inert-regions.d.ts +52 -0
- package/a11y/src/live-announcer.d.ts +8 -0
- package/a11y/src/roving-focus.d.ts +118 -0
- package/a11y/src/testing/expect-idref-resolves.d.ts +31 -0
- package/a11y/src/testing/index.d.ts +1 -0
- package/accordion/index.mjs +180 -174
- package/accordion/src/components/mp-accordion.d.ts +18 -13
- package/calendar/index.mjs +1 -1
- package/calendar/src/mp-calendar.element.d.ts +2 -0
- package/carousel/index.mjs +211 -164
- package/carousel/src/components/mp-carousel.d.ts +1 -0
- package/checkbox/index.mjs +1 -1
- package/checkbox/src/components/mp-checkbox.d.ts +59 -1
- package/chunks/focus-restore-DxuP1Oe2.mjs +94 -0
- package/chunks/focus-trap-DTOLJ5bb.mjs +121 -0
- package/chunks/form-associated-axmc5sY0.mjs +58 -0
- package/chunks/host-aria-WSGs7SPQ.mjs +152 -0
- package/chunks/inert-regions-DXCnn1LN.mjs +48 -0
- package/chunks/invalid-feedback.styles-he0JYrJm.mjs +11 -0
- package/chunks/{live-announcer-CZDTKulf.mjs → live-announcer-Bi0orG4n.mjs} +9 -9
- package/chunks/{mp-calendar.element-UC68iDbi.mjs → mp-calendar.element-u6uS31_j.mjs} +136 -105
- package/chunks/mp-checkbox-Ph2mMRGz.mjs +312 -0
- package/chunks/{mp-datatable-Bfw0KGkV.mjs → mp-datatable-BwTlh9A_.mjs} +265 -103
- package/chunks/{mp-pagination-BGxsawFL.mjs → mp-pagination-Dea75mD4.mjs} +25 -22
- package/chunks/mp-radio-BjW1HNSc.mjs +300 -0
- package/chunks/{mp-select-BDS1-YGn.mjs → mp-select-Ctu-v1-p.mjs} +163 -40
- package/chunks/{mp-splitter-C8cGCmac.mjs → mp-splitter-LszuRDbR.mjs} +53 -46
- package/chunks/{mp-tab-page-D1b4x-y2.mjs → mp-tab-page-CaCzX1ym.mjs} +46 -45
- package/chunks/{mp-timepicker.element-BwEiwX92.mjs → mp-timepicker.element-Bz393NDQ.mjs} +93 -86
- package/chunks/{mp-toggle-button-dLZNDUVz.mjs → mp-toggle-button-Kz6sIgBJ.mjs} +131 -37
- package/chunks/{mp-treeview-C48F63xb.mjs → mp-treeview-tkWu28iF.mjs} +67 -43
- package/chunks/overlay-controller-DPt13i8p.mjs +314 -0
- package/chunks/roving-focus-CrL9982a.mjs +129 -0
- package/code-snippet/index.mjs +21 -13
- package/code-snippet/src/mp-code-snippet.element.d.ts +6 -0
- package/datatable/index.mjs +1 -1
- package/datatable/src/components/mp-datatable.d.ts +50 -0
- package/datatable/src/types/index.d.ts +2 -0
- package/datatable/src/types/labels.d.ts +30 -0
- package/datepicker/index.mjs +45 -22
- package/datepicker/src/mp-datepicker.element.d.ts +30 -0
- package/datetime-picker/index.mjs +15 -9
- package/dock/index.mjs +365 -209
- package/dock/src/components/mint-dock-manager.element.d.ts +63 -3
- package/dropdown-menu/index.mjs +135 -90
- package/dropdown-menu/src/components/mp-dropdown-menu.d.ts +12 -3
- package/file-manager/index.mjs +279 -214
- package/file-manager/src/components/mp-file-manager.d.ts +22 -0
- package/file-manager/src/types/messages.d.ts +9 -0
- package/multi-range/index.mjs +26 -10
- package/multi-range/src/mint-multi-range.element.d.ts +7 -0
- package/navbar/index.mjs +53 -39
- package/navbar/src/components/mp-navbar.d.ts +1 -0
- package/otp-input/index.mjs +82 -48
- package/otp-input/src/mint-otp-input.element.d.ts +31 -3
- package/overlay/index.mjs +2 -258
- package/overlay/src/overlay-controller.d.ts +64 -4
- package/package.json +9 -1
- package/pagination/index.mjs +1 -1
- package/query-builder/index.mjs +117 -87
- package/query-builder/src/model/messages.d.ts +9 -0
- package/radio/index.mjs +2 -160
- package/radio/src/components/mp-radio.d.ts +58 -3
- package/radio-group/index.d.ts +1 -0
- package/radio-group/index.mjs +145 -0
- package/radio-group/src/components/mp-radio-group.d.ts +52 -0
- package/radio-group/src/index.d.ts +1 -0
- package/radio-group/src/styles/radio-group.styles.d.ts +2 -0
- package/ribbon/index.mjs +316 -304
- package/ribbon/src/mp-ribbon.element.d.ts +16 -0
- package/scheduler/index.mjs +219 -132
- package/scheduler/src/components/mp-scheduler.d.ts +3 -0
- package/scheduler/src/views/base-view.d.ts +23 -0
- package/select/index.mjs +1 -1
- package/select/src/components/mp-select.d.ts +60 -3
- package/shell/index.mjs +142 -31
- package/shell/src/components/mp-shell.d.ts +1 -0
- package/signature-pad/index.d.ts +1 -0
- package/signature-pad/index.mjs +230 -0
- package/signature-pad/src/index.d.ts +2 -0
- package/signature-pad/src/mp-signature-pad.element.d.ts +143 -0
- package/signature-pad/src/mp-signature-pad.element.template.d.ts +2 -0
- package/signature-pad/src/types/signature.d.ts +12 -0
- package/splitter/index.mjs +1 -1
- package/splitter/src/components/mp-splitter.d.ts +7 -0
- package/tab-control/index.mjs +1 -1
- package/tile-manager/index.mjs +110 -93
- package/timeline/index.mjs +138 -54
- package/timeline/src/components/mp-timeline.d.ts +15 -0
- package/timepicker/index.mjs +1 -1
- package/timepicker/src/mp-time-list.element.d.ts +13 -4
- package/timepicker/src/mp-timepicker.element.d.ts +29 -0
- package/toggle-button/index.mjs +1 -1
- package/toggle-button/src/components/mp-toggle-button.d.ts +32 -1
- package/tree-select/index.mjs +233 -121
- package/tree-select/src/components/mp-tree-select.d.ts +37 -0
- package/treeview/index.mjs +1 -1
- package/treeview/src/components/mp-treeview.d.ts +10 -1
- package/chunks/mp-checkbox-BokLL7BS.mjs +0 -211
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { unsafeCSS as
|
|
2
|
-
const u =
|
|
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: !
|
|
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,
|
|
249
|
-
super.attributeChangedCallback(t, e,
|
|
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
|
|
269
|
-
if (!
|
|
270
|
-
const
|
|
271
|
-
if (!
|
|
272
|
-
const o =
|
|
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((
|
|
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
|
-
`,
|
|
291
|
+
`, r = this.border, o = i`
|
|
292
292
|
<div
|
|
293
|
-
class="tab-content flex-grow-1 overflow-auto${
|
|
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
|
|
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${
|
|
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=${
|
|
318
|
+
aria-selected=${r ? "true" : "false"}
|
|
319
319
|
?disabled=${t.disabled}
|
|
320
|
-
tabindex=${t.disabled ? -1 :
|
|
321
|
-
@click=${(
|
|
322
|
-
@keydown=${(
|
|
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
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
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 =
|
|
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,
|
|
396
|
-
super.attributeChangedCallback(t, e,
|
|
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
|
|
2
|
-
import { query as
|
|
3
|
-
import {
|
|
4
|
-
|
|
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 =
|
|
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
|
|
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.
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
e
|
|
64
|
-
|
|
65
|
-
|
|
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
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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.
|
|
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.
|
|
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)
|
|
99
|
+
super.disconnectedCallback(), this.removeEventListener("keydown", this.onHostKeyDown);
|
|
115
100
|
}
|
|
116
101
|
updated() {
|
|
117
|
-
|
|
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),
|
|
116
|
+
const t = Math.floor(1440 / this.step), s = [];
|
|
124
117
|
for (let i = 0; i < t; i++) {
|
|
125
|
-
const
|
|
126
|
-
|
|
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
|
|
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
|
|
171
|
-
this.selectedTime =
|
|
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(
|
|
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
|
|
175
|
+
return n`
|
|
189
176
|
<ul role="presentation">
|
|
190
|
-
${e.map((
|
|
177
|
+
${e.map((s) => this.renderSlot(s, t))}
|
|
191
178
|
</ul>
|
|
192
179
|
`;
|
|
193
180
|
}
|
|
194
181
|
renderSlot(e, t) {
|
|
195
|
-
const
|
|
196
|
-
return
|
|
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
|
-
|
|
203
|
-
aria-
|
|
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" :
|
|
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
|
-
|
|
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 =
|
|
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
|
|
305
|
-
for (var i = void 0,
|
|
306
|
-
(o = a[
|
|
307
|
-
return 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
|
|
310
|
-
let
|
|
311
|
-
class
|
|
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-${++
|
|
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
|
|
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 ||
|
|
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="${
|
|
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
|
-
|
|
416
|
-
|
|
417
|
-
],
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
],
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
],
|
|
424
|
-
|
|
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
|
-
|
|
434
|
+
l as a
|
|
428
435
|
};
|