@mintplayer/web-components 1.0.0 → 1.1.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 +2 -56
- package/calendar/index.mjs +2 -363
- package/checkbox/index.mjs +4 -0
- package/checkbox/src/components/index.d.ts +2 -0
- package/checkbox/src/components/mp-checkbox.d.ts +69 -0
- package/checkbox/src/index.d.ts +2 -0
- package/chunks/color-C4VT0EL7.mjs +847 -0
- package/chunks/form-check.styles-jBlHetYX.mjs +151 -0
- package/chunks/live-announcer-CZDTKulf.mjs +58 -0
- package/chunks/mp-calendar.element-UC68iDbi.mjs +365 -0
- package/chunks/mp-checkbox-BokLL7BS.mjs +211 -0
- package/chunks/mp-datatable-CpAu8JJD.mjs +750 -0
- package/chunks/mp-pagination-BGxsawFL.mjs +326 -0
- package/chunks/mp-select-BDS1-YGn.mjs +254 -0
- package/chunks/mp-splitter-C8cGCmac.mjs +633 -0
- package/chunks/mp-tab-page-D1b4x-y2.mjs +414 -0
- package/chunks/mp-timepicker.element-BwEiwX92.mjs +428 -0
- package/chunks/mp-toggle-button-dLZNDUVz.mjs +534 -0
- package/chunks/mp-treeview-Bfq4_IVW.mjs +474 -0
- package/code-snippet/index.mjs +16 -13
- package/datatable/index.mjs +7 -0
- package/datatable/src/components/index.d.ts +2 -0
- package/datatable/src/components/mp-datatable.d.ts +156 -0
- package/datatable/src/index.d.ts +6 -0
- package/datatable/src/sort/compute-next-sort.d.ts +18 -0
- package/datatable/src/sort/index.d.ts +3 -0
- package/datatable/src/sort/sort-rows.d.ts +6 -0
- package/datatable/src/styles/datatable.styles.d.ts +2 -0
- package/datatable/src/styles/index.d.ts +1 -0
- package/datatable/src/types/column-def.d.ts +30 -0
- package/datatable/src/types/index.d.ts +1 -0
- package/datepicker/index.mjs +240 -0
- package/datepicker/src/index.d.ts +1 -0
- package/datepicker/src/mp-datepicker.element.d.ts +94 -0
- package/datepicker/src/mp-datepicker.element.template.d.ts +2 -0
- package/datetime-picker/index.mjs +427 -0
- package/datetime-picker/src/index.d.ts +1 -0
- package/datetime-picker/src/mp-datetime-picker.element.d.ts +174 -0
- package/datetime-picker/src/mp-datetime-picker.element.template.d.ts +2 -0
- package/dock/index.mjs +2402 -0
- package/dock/src/components/index.d.ts +1 -0
- package/dock/src/components/mint-dock-manager.element.d.ts +313 -0
- package/dock/src/components/mint-dock-manager.element.template.d.ts +2 -0
- package/dock/src/index.d.ts +2 -0
- package/dock/src/types/dock-layout.d.ts +65 -0
- package/dock/src/types/index.d.ts +1 -0
- package/file-manager/index.mjs +1263 -0
- package/file-manager/src/components/index.d.ts +2 -0
- package/file-manager/src/components/mp-file-manager.d.ts +320 -0
- package/file-manager/src/index.d.ts +5 -0
- package/file-manager/src/styles/file-manager.styles.d.ts +2 -0
- package/file-manager/src/styles/index.d.ts +1 -0
- package/file-manager/src/types/file-system-node.d.ts +24 -0
- package/file-manager/src/types/index.d.ts +3 -0
- package/file-manager/src/types/messages.d.ts +43 -0
- package/multi-range/index.mjs +407 -0
- package/multi-range/src/index.d.ts +2 -0
- package/multi-range/src/mint-multi-range.element.d.ts +124 -0
- package/multi-range/src/mint-multi-range.element.template.d.ts +2 -0
- package/multi-range/src/types/multi-range-orientation.d.ts +1 -0
- package/otp-input/index.mjs +362 -0
- package/otp-input/src/index.d.ts +4 -0
- package/otp-input/src/mint-otp-input.element.d.ts +134 -0
- package/otp-input/src/mint-otp-input.element.template.d.ts +2 -0
- package/otp-input/src/types/otp-input-case.d.ts +1 -0
- package/otp-input/src/types/otp-input-size.d.ts +1 -0
- package/otp-input/src/types/otp-input-type.d.ts +1 -0
- package/overlay/index.mjs +260 -0
- package/overlay/src/index.d.ts +2 -0
- package/overlay/src/overlay-controller.d.ts +205 -0
- package/package.json +1 -1
- package/pagination/index.mjs +5 -0
- package/pagination/src/components/index.d.ts +2 -0
- package/pagination/src/components/mp-pagination.d.ts +95 -0
- package/pagination/src/index.d.ts +2 -0
- package/pagination/src/styles/index.d.ts +1 -0
- package/pagination/src/styles/pagination.styles.d.ts +2 -0
- package/query-builder/index.mjs +3720 -0
- package/query-builder/src/context.d.ts +14 -0
- package/query-builder/src/dnd/drag-controller.d.ts +69 -0
- package/query-builder/src/index.d.ts +23 -0
- package/query-builder/src/model/default-tree.d.ts +7 -0
- package/query-builder/src/model/editor.d.ts +15 -0
- package/query-builder/src/model/errors.d.ts +6 -0
- package/query-builder/src/model/expression.d.ts +22 -0
- package/query-builder/src/model/field-def.d.ts +17 -0
- package/query-builder/src/model/messages.d.ts +17 -0
- package/query-builder/src/model/operator-overrides.d.ts +21 -0
- package/query-builder/src/model/operators.d.ts +8 -0
- package/query-builder/src/model/saved-query.d.ts +6 -0
- package/query-builder/src/model/sort.d.ts +9 -0
- package/query-builder/src/model/tree-ops.d.ts +56 -0
- package/query-builder/src/mp-query-builder.element.d.ts +158 -0
- package/query-builder/src/mp-query-builder.element.template.d.ts +2 -0
- package/query-builder/src/mp-query-condition.element.d.ts +44 -0
- package/query-builder/src/mp-query-condition.element.template.d.ts +2 -0
- package/query-builder/src/mp-query-group.element.d.ts +52 -0
- package/query-builder/src/mp-query-group.element.template.d.ts +2 -0
- package/query-builder/src/mp-query-subquery.element.d.ts +37 -0
- package/query-builder/src/mp-query-subquery.element.template.d.ts +2 -0
- package/query-builder/src/preview/render-expression.d.ts +23 -0
- package/query-builder/src/value-editors/builtin-editors.d.ts +6 -0
- package/query-builder/src/visitor/visit-tree.d.ts +29 -0
- package/query-builder/src/visitor/visitor-types.d.ts +15 -0
- package/radio/index.mjs +162 -0
- package/radio/src/components/index.d.ts +2 -0
- package/radio/src/components/mp-radio.d.ts +63 -0
- package/radio/src/index.d.ts +2 -0
- package/ribbon/index.mjs +3151 -0
- package/ribbon/src/index.d.ts +10 -0
- package/ribbon/src/items/index.d.ts +15 -0
- package/ribbon/src/items/mp-ribbon-button.element.d.ts +10 -0
- package/ribbon/src/items/mp-ribbon-checkbox.element.d.ts +11 -0
- package/ribbon/src/items/mp-ribbon-color-picker.element.d.ts +12 -0
- package/ribbon/src/items/mp-ribbon-combobox.element.d.ts +19 -0
- package/ribbon/src/items/mp-ribbon-dropdown-button.element.d.ts +16 -0
- package/ribbon/src/items/mp-ribbon-gallery-item.element.d.ts +15 -0
- package/ribbon/src/items/mp-ribbon-gallery.element.d.ts +11 -0
- package/ribbon/src/items/mp-ribbon-group-button.element.d.ts +18 -0
- package/ribbon/src/items/mp-ribbon-item-base.d.ts +68 -0
- package/ribbon/src/items/mp-ribbon-menu-item.element.d.ts +13 -0
- package/ribbon/src/items/mp-ribbon-menu-separator.element.d.ts +6 -0
- package/ribbon/src/items/mp-ribbon-split-button.element.d.ts +23 -0
- package/ribbon/src/items/mp-ribbon-template-item.element.d.ts +12 -0
- package/ribbon/src/items/mp-ribbon-toggle-button.element.d.ts +12 -0
- package/ribbon/src/mp-quick-access-toolbar.element.d.ts +35 -0
- package/ribbon/src/mp-ribbon-contextual-tab-set.element.d.ts +18 -0
- package/ribbon/src/mp-ribbon-group.element.d.ts +59 -0
- package/ribbon/src/mp-ribbon-tab.element.d.ts +72 -0
- package/ribbon/src/mp-ribbon.element.d.ts +211 -0
- package/ribbon/src/types/ribbon.types.d.ts +4 -0
- package/scheduler/index.mjs +3567 -0
- package/scheduler/src/components/mp-scheduler.d.ts +238 -0
- package/scheduler/src/drag/drag-manager.d.ts +90 -0
- package/scheduler/src/drag/drag-preview.d.ts +42 -0
- package/scheduler/src/drag/drag-state-machine.d.ts +102 -0
- package/scheduler/src/drag/drag-types.d.ts +104 -0
- package/scheduler/src/drag/index.d.ts +4 -0
- package/scheduler/src/events/event-types.d.ts +58 -0
- package/scheduler/src/events/index.d.ts +2 -0
- package/scheduler/src/events/scheduler-event-emitter.d.ts +52 -0
- package/scheduler/src/index.d.ts +6 -0
- package/scheduler/src/input/index.d.ts +2 -0
- package/scheduler/src/input/input-handler.d.ts +105 -0
- package/scheduler/src/input/pointer-event.d.ts +39 -0
- package/scheduler/src/state/scheduler-state.d.ts +189 -0
- package/scheduler/src/styles/scheduler.styles.d.ts +2 -0
- package/scheduler/src/views/base-view.d.ts +87 -0
- package/scheduler/src/views/day-view.d.ts +25 -0
- package/scheduler/src/views/index.d.ts +6 -0
- package/scheduler/src/views/month-view.d.ts +27 -0
- package/scheduler/src/views/timeline-view.d.ts +23 -0
- package/scheduler/src/views/week-view.d.ts +28 -0
- package/scheduler/src/views/year-view.d.ts +25 -0
- package/scheduler-core/index.mjs +174 -0
- package/scheduler-core/src/index.d.ts +3 -0
- package/scheduler-core/src/models/drag-state.d.ts +43 -0
- package/scheduler-core/src/models/event.d.ts +111 -0
- package/scheduler-core/src/models/events.d.ts +108 -0
- package/scheduler-core/src/models/index.d.ts +7 -0
- package/scheduler-core/src/models/options.d.ts +88 -0
- package/scheduler-core/src/models/resource.d.ts +58 -0
- package/scheduler-core/src/models/time-slot.d.ts +31 -0
- package/scheduler-core/src/models/types.d.ts +20 -0
- package/scheduler-core/src/services/date.service.d.ts +140 -0
- package/scheduler-core/src/services/index.d.ts +4 -0
- package/scheduler-core/src/services/position.service.d.ts +35 -0
- package/scheduler-core/src/services/resource.service.d.ts +83 -0
- package/scheduler-core/src/services/timeline.service.d.ts +103 -0
- package/scheduler-core/src/utils/color.d.ts +24 -0
- package/scheduler-core/src/utils/dom.d.ts +54 -0
- package/scheduler-core/src/utils/id.d.ts +16 -0
- package/scheduler-core/src/utils/index.d.ts +3 -0
- package/select/index.mjs +4 -0
- package/select/src/components/index.d.ts +2 -0
- package/select/src/components/mp-select.d.ts +82 -0
- package/select/src/index.d.ts +2 -0
- package/splitter/index.mjs +10 -0
- package/splitter/src/components/index.d.ts +2 -0
- package/splitter/src/components/mp-splitter.d.ts +109 -0
- package/splitter/src/index.d.ts +11 -0
- package/splitter/src/input/index.d.ts +4 -0
- package/splitter/src/input/input-handler.d.ts +36 -0
- package/splitter/src/input/pointer-event.d.ts +9 -0
- package/splitter/src/managers/index.d.ts +2 -0
- package/splitter/src/managers/resize-manager.d.ts +13 -0
- package/splitter/src/state/index.d.ts +2 -0
- package/splitter/src/state/splitter-state.d.ts +24 -0
- package/splitter/src/styles/index.d.ts +1 -0
- package/splitter/src/styles/splitter.styles.d.ts +2 -0
- package/splitter/src/types/direction.d.ts +1 -0
- package/splitter/src/types/index.d.ts +5 -0
- package/splitter/src/types/panel-info.d.ts +6 -0
- package/splitter/src/types/point.d.ts +4 -0
- package/splitter/src/types/resize-operation.d.ts +13 -0
- package/tab-control/index.mjs +6 -0
- package/tab-control/src/components/index.d.ts +3 -0
- package/tab-control/src/components/mp-tab-control.d.ts +50 -0
- package/tab-control/src/components/mp-tab-page.d.ts +35 -0
- package/tab-control/src/index.d.ts +4 -0
- package/tab-control/src/styles/index.d.ts +1 -0
- package/tab-control/src/styles/tab-control.styles.d.ts +2 -0
- package/tab-control/src/types/index.d.ts +1 -0
- package/tab-control/src/types/tabs-position.d.ts +1 -0
- package/tile-manager/index.mjs +867 -0
- package/tile-manager/src/components/index.d.ts +2 -0
- package/tile-manager/src/components/mint-tile-manager.element.d.ts +204 -0
- package/tile-manager/src/components/mint-tile-manager.element.template.d.ts +2 -0
- package/tile-manager/src/index.d.ts +4 -0
- package/tile-manager/src/types/grid-rect.d.ts +12 -0
- package/tile-manager/src/types/index.d.ts +3 -0
- package/tile-manager/src/types/tile-layout-snapshot.d.ts +15 -0
- package/tile-manager/src/types/tile-position.d.ts +10 -0
- package/tile-manager/src/utils/index.d.ts +1 -0
- package/tile-manager/src/utils/pack.d.ts +24 -0
- package/timepicker/index.mjs +5 -0
- package/timepicker/src/index.d.ts +2 -0
- package/timepicker/src/mp-time-list.element.d.ts +76 -0
- package/timepicker/src/mp-time-list.element.template.d.ts +2 -0
- package/timepicker/src/mp-timepicker.element.d.ts +87 -0
- package/timepicker/src/mp-timepicker.element.template.d.ts +2 -0
- package/toggle-button/index.mjs +5 -0
- package/toggle-button/src/components/index.d.ts +2 -0
- package/toggle-button/src/components/mp-toggle-button.d.ts +50 -0
- package/toggle-button/src/index.d.ts +3 -0
- package/toggle-button/src/styles/index.d.ts +1 -0
- package/toggle-button/src/styles/toggle-button.styles.d.ts +2 -0
- package/treeview/index.mjs +5 -0
- package/treeview/src/components/index.d.ts +2 -0
- package/treeview/src/components/mp-treeview.d.ts +113 -0
- package/treeview/src/index.d.ts +4 -0
- package/treeview/src/styles/index.d.ts +1 -0
- package/treeview/src/styles/treeview.styles.d.ts +2 -0
- package/treeview/src/types/index.d.ts +1 -0
- package/treeview/src/types/tree-node.d.ts +14 -0
- package/custom-elements.json +0 -1774
|
@@ -0,0 +1,428 @@
|
|
|
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
|
|
5
|
+
so the codegen-wc target emits a \`styles\` export from the sibling .scss;
|
|
6
|
+
the \`template\` export is intentionally unused. -->`;
|
|
7
|
+
const y = b(`:host {
|
|
8
|
+
display: block;
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
max-height: 250px;
|
|
11
|
+
overflow-y: auto;
|
|
12
|
+
background: var(--bs-body-bg);
|
|
13
|
+
color: var(--bs-body-color);
|
|
14
|
+
border: 1px solid var(--bs-border-color);
|
|
15
|
+
border-radius: var(--bs-border-radius, 0.375rem);
|
|
16
|
+
font-family: inherit;
|
|
17
|
+
font-size: 1rem;
|
|
18
|
+
scrollbar-width: thin;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
ul {
|
|
22
|
+
list-style: none;
|
|
23
|
+
margin: 0;
|
|
24
|
+
padding: 0;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.slot {
|
|
28
|
+
display: block;
|
|
29
|
+
width: 100%;
|
|
30
|
+
padding: 0.375rem 0.75rem;
|
|
31
|
+
background: transparent;
|
|
32
|
+
border: 0;
|
|
33
|
+
text-align: left;
|
|
34
|
+
cursor: pointer;
|
|
35
|
+
color: inherit;
|
|
36
|
+
font: inherit;
|
|
37
|
+
}
|
|
38
|
+
.slot:hover, .slot:focus-visible {
|
|
39
|
+
background-color: var(--bs-secondary-bg, #e9ecef);
|
|
40
|
+
outline: none;
|
|
41
|
+
}
|
|
42
|
+
.slot[aria-selected=true] {
|
|
43
|
+
background-color: var(--bs-primary);
|
|
44
|
+
color: #fff;
|
|
45
|
+
}
|
|
46
|
+
.slot[aria-disabled=true] {
|
|
47
|
+
color: var(--bs-secondary-color);
|
|
48
|
+
cursor: not-allowed;
|
|
49
|
+
pointer-events: none;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@media (pointer: coarse) {
|
|
53
|
+
.slot {
|
|
54
|
+
min-height: 44px;
|
|
55
|
+
}
|
|
56
|
+
}`);
|
|
57
|
+
let v = 0;
|
|
58
|
+
class w extends f {
|
|
59
|
+
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;
|
|
68
|
+
}
|
|
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;
|
|
90
|
+
}
|
|
91
|
+
this._focusedMinutes = n, this.pendingFocusMove = !0, this.requestUpdate();
|
|
92
|
+
}, this.onHostFocus = () => {
|
|
93
|
+
this._focusedMinutes === null && (this._focusedMinutes = this.focusableMinutes(), this.requestUpdate());
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
static {
|
|
97
|
+
this.styles = [y];
|
|
98
|
+
}
|
|
99
|
+
static {
|
|
100
|
+
this.properties = {
|
|
101
|
+
selectedTime: { attribute: !1 },
|
|
102
|
+
step: { attribute: "step", type: Number, reflect: !0 },
|
|
103
|
+
min: { attribute: !1 },
|
|
104
|
+
max: { attribute: !1 },
|
|
105
|
+
hour12: { attribute: "hour12" },
|
|
106
|
+
locale: { attribute: "locale", type: String, reflect: !0 },
|
|
107
|
+
_focusedMinutes: { state: !0 }
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
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);
|
|
112
|
+
}
|
|
113
|
+
disconnectedCallback() {
|
|
114
|
+
super.disconnectedCallback(), this.removeEventListener("keydown", this.onHostKeyDown), this.removeEventListener("focus", this.onHostFocus);
|
|
115
|
+
}
|
|
116
|
+
updated() {
|
|
117
|
+
this.pendingFocusMove && (this.pendingFocusMove = !1, this.scrollFocusedIntoView());
|
|
118
|
+
}
|
|
119
|
+
/** All slots between 00:00 and 24:00 - step, in step-minute increments. */
|
|
120
|
+
slots() {
|
|
121
|
+
const e = /* @__PURE__ */ new Date();
|
|
122
|
+
e.setHours(0, 0, 0, 0);
|
|
123
|
+
const t = Math.floor(1440 / this.step), r = [];
|
|
124
|
+
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) });
|
|
127
|
+
}
|
|
128
|
+
return r;
|
|
129
|
+
}
|
|
130
|
+
formatTime(e) {
|
|
131
|
+
const t = this.resolvedHour12();
|
|
132
|
+
return e.toLocaleTimeString(this.locale ?? void 0, {
|
|
133
|
+
hour: "2-digit",
|
|
134
|
+
minute: "2-digit",
|
|
135
|
+
hour12: t
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
/** Resolves `hour12 === 'auto'` against the active locale; explicit wins. */
|
|
139
|
+
resolvedHour12() {
|
|
140
|
+
if (this.hour12 === !0) return !0;
|
|
141
|
+
if (this.hour12 === !1) return !1;
|
|
142
|
+
}
|
|
143
|
+
/** Time-only minute slot for a Date, ignoring its date portion. */
|
|
144
|
+
timeMinutes(e) {
|
|
145
|
+
return e.getHours() * 60 + e.getMinutes();
|
|
146
|
+
}
|
|
147
|
+
isDisabledMinutes(e) {
|
|
148
|
+
return !!(this.min && e < this.timeMinutes(this.min) || this.max && e > this.timeMinutes(this.max));
|
|
149
|
+
}
|
|
150
|
+
isSelected(e) {
|
|
151
|
+
return this.selectedTime ? this.timeMinutes(this.selectedTime) === e : !1;
|
|
152
|
+
}
|
|
153
|
+
focusableMinutes() {
|
|
154
|
+
if (this._focusedMinutes !== null) return this._focusedMinutes;
|
|
155
|
+
if (this.selectedTime) {
|
|
156
|
+
const e = this.timeMinutes(this.selectedTime);
|
|
157
|
+
return Math.floor(e / this.step) * this.step;
|
|
158
|
+
}
|
|
159
|
+
return 0;
|
|
160
|
+
}
|
|
161
|
+
slotId(e) {
|
|
162
|
+
return `${this.instanceId}-slot-${e}`;
|
|
163
|
+
}
|
|
164
|
+
/* ---- Public API ---- */
|
|
165
|
+
/** Selects a slot programmatically; emits event. No-op if disabled or out-of-range. */
|
|
166
|
+
selectMinutes(e) {
|
|
167
|
+
if (this.isDisabledMinutes(e)) return;
|
|
168
|
+
const t = /* @__PURE__ */ new Date();
|
|
169
|
+
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(
|
|
172
|
+
new CustomEvent("selected-time-change", {
|
|
173
|
+
detail: new Date(r.getTime()),
|
|
174
|
+
bubbles: !0,
|
|
175
|
+
composed: !0
|
|
176
|
+
})
|
|
177
|
+
);
|
|
178
|
+
}
|
|
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
|
+
/* ---- Render ---- */
|
|
186
|
+
render() {
|
|
187
|
+
const e = this.slots(), t = this.focusableMinutes();
|
|
188
|
+
return this.setAttribute("aria-activedescendant", this.slotId(t)), l`
|
|
189
|
+
<ul role="presentation">
|
|
190
|
+
${e.map((r) => this.renderSlot(r, t))}
|
|
191
|
+
</ul>
|
|
192
|
+
`;
|
|
193
|
+
}
|
|
194
|
+
renderSlot(e, t) {
|
|
195
|
+
const r = this.isSelected(e.minutes), i = this.isDisabledMinutes(e.minutes);
|
|
196
|
+
return l`<li role="presentation">
|
|
197
|
+
<button
|
|
198
|
+
type="button"
|
|
199
|
+
class="slot"
|
|
200
|
+
role="option"
|
|
201
|
+
id="${this.slotId(e.minutes)}"
|
|
202
|
+
aria-selected="${r ? "true" : "false"}"
|
|
203
|
+
aria-disabled="${i ? "true" : h}"
|
|
204
|
+
?disabled="${i}"
|
|
205
|
+
data-focused="${e.minutes === t ? "true" : h}"
|
|
206
|
+
@click="${() => this.selectMinutes(e.minutes)}"
|
|
207
|
+
>${e.label}</button>
|
|
208
|
+
</li>`;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
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
|
|
213
|
+
target emits a \`styles\` export from the sibling .scss. -->`;
|
|
214
|
+
const x = b(`:host {
|
|
215
|
+
display: inline-block;
|
|
216
|
+
position: relative;
|
|
217
|
+
box-sizing: border-box;
|
|
218
|
+
font-family: inherit;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.input-group {
|
|
222
|
+
display: inline-flex;
|
|
223
|
+
position: relative;
|
|
224
|
+
width: 100%;
|
|
225
|
+
align-items: stretch;
|
|
226
|
+
border-radius: var(--bs-border-radius, 0.375rem);
|
|
227
|
+
}
|
|
228
|
+
.input-group:focus-within {
|
|
229
|
+
box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25);
|
|
230
|
+
}
|
|
231
|
+
.input-group:focus-within input.form-control,
|
|
232
|
+
.input-group:focus-within button.trigger {
|
|
233
|
+
border-color: var(--bs-primary);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
input.form-control {
|
|
237
|
+
flex: 1 1 auto;
|
|
238
|
+
min-width: 0;
|
|
239
|
+
padding: 0.375rem 0.75rem;
|
|
240
|
+
font-size: 1rem;
|
|
241
|
+
line-height: 1.5;
|
|
242
|
+
color: var(--bs-body-color);
|
|
243
|
+
background-color: var(--bs-body-bg);
|
|
244
|
+
border: 1px solid var(--bs-border-color);
|
|
245
|
+
border-radius: var(--bs-border-radius, 0.375rem) 0 0 var(--bs-border-radius, 0.375rem);
|
|
246
|
+
outline: 0;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
input.form-control:disabled {
|
|
250
|
+
background-color: var(--bs-secondary-bg);
|
|
251
|
+
opacity: 1;
|
|
252
|
+
cursor: not-allowed;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
button.trigger {
|
|
256
|
+
flex: 0 0 auto;
|
|
257
|
+
padding: 0.375rem 0.75rem;
|
|
258
|
+
font-size: 1rem;
|
|
259
|
+
line-height: 1.5;
|
|
260
|
+
color: #fff;
|
|
261
|
+
background-color: var(--bs-secondary);
|
|
262
|
+
border: 1px solid var(--bs-secondary);
|
|
263
|
+
border-radius: 0 var(--bs-border-radius, 0.375rem) var(--bs-border-radius, 0.375rem) 0;
|
|
264
|
+
cursor: pointer;
|
|
265
|
+
}
|
|
266
|
+
button.trigger:hover:not(:disabled) {
|
|
267
|
+
filter: brightness(0.95);
|
|
268
|
+
}
|
|
269
|
+
button.trigger:focus-visible {
|
|
270
|
+
outline: 2px solid var(--bs-primary);
|
|
271
|
+
outline-offset: 2px;
|
|
272
|
+
}
|
|
273
|
+
button.trigger:disabled {
|
|
274
|
+
opacity: 0.65;
|
|
275
|
+
cursor: not-allowed;
|
|
276
|
+
}
|
|
277
|
+
button.trigger svg {
|
|
278
|
+
width: 1em;
|
|
279
|
+
height: 1em;
|
|
280
|
+
vertical-align: -0.125em;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
.popup {
|
|
284
|
+
position: fixed;
|
|
285
|
+
z-index: 1050;
|
|
286
|
+
display: none;
|
|
287
|
+
padding: 0;
|
|
288
|
+
background-color: transparent;
|
|
289
|
+
border: 0;
|
|
290
|
+
box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
|
|
291
|
+
max-width: min(240px, 100vw - 16px);
|
|
292
|
+
border-radius: var(--bs-border-radius, 0.375rem);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
:host([data-menu-open]) .popup {
|
|
296
|
+
display: block;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
@media (prefers-reduced-motion: reduce) {
|
|
300
|
+
.popup {
|
|
301
|
+
transition: none !important;
|
|
302
|
+
}
|
|
303
|
+
}`);
|
|
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;
|
|
308
|
+
};
|
|
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 {
|
|
312
|
+
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, {
|
|
314
|
+
anchor: () => this.inputGroupEl ?? this.triggerEl ?? null,
|
|
315
|
+
trigger: () => this.triggerEl ?? null,
|
|
316
|
+
panel: () => this.popupEl ?? null,
|
|
317
|
+
panelWidth: "anchor-min",
|
|
318
|
+
onOpen: () => this.dispatchEvent(new CustomEvent("opened", { bubbles: !0, composed: !0 })),
|
|
319
|
+
onClose: () => this.dispatchEvent(new CustomEvent("closed", { bubbles: !0, composed: !0 }))
|
|
320
|
+
}), this.onTriggerClick = async () => {
|
|
321
|
+
this.disabled || await this.overlay.toggle();
|
|
322
|
+
}, this.onTriggerKeyDown = async (e) => {
|
|
323
|
+
this.disabled || (e.key === "ArrowDown" || e.key === "Enter" || e.key === " ") && (e.preventDefault(), this.overlay.isOpen || await this.overlay.open());
|
|
324
|
+
}, this.onSelectedTimeChange = (e) => {
|
|
325
|
+
const t = e.detail;
|
|
326
|
+
t instanceof Date && (this.selectedTime = t, this.requestUpdate(), this.dispatchEvent(
|
|
327
|
+
new CustomEvent("selected-time-change", {
|
|
328
|
+
detail: new Date(t.getTime()),
|
|
329
|
+
bubbles: !0,
|
|
330
|
+
composed: !0
|
|
331
|
+
})
|
|
332
|
+
), this.overlay.close());
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
static {
|
|
336
|
+
this.styles = [x];
|
|
337
|
+
}
|
|
338
|
+
static {
|
|
339
|
+
this.properties = {
|
|
340
|
+
selectedTime: { attribute: !1 },
|
|
341
|
+
step: { attribute: "step", type: Number, reflect: !0 },
|
|
342
|
+
min: { attribute: !1 },
|
|
343
|
+
max: { attribute: !1 },
|
|
344
|
+
hour12: { attribute: "hour12" },
|
|
345
|
+
locale: { attribute: "locale", type: String, reflect: !0 },
|
|
346
|
+
disabled: { attribute: "disabled", type: Boolean, reflect: !0 },
|
|
347
|
+
placeholder: { attribute: "placeholder", type: String, reflect: !0 },
|
|
348
|
+
triggerLabel: { attribute: "trigger-label", type: String, reflect: !0 }
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
async open() {
|
|
352
|
+
this.disabled || await this.overlay.open();
|
|
353
|
+
}
|
|
354
|
+
close(e = !0) {
|
|
355
|
+
this.overlay.close(e);
|
|
356
|
+
}
|
|
357
|
+
get isOpen() {
|
|
358
|
+
return this.overlay.isOpen;
|
|
359
|
+
}
|
|
360
|
+
resolvedHour12() {
|
|
361
|
+
if (this.hour12 === !0) return !0;
|
|
362
|
+
if (this.hour12 === !1) return !1;
|
|
363
|
+
}
|
|
364
|
+
formatDisplay() {
|
|
365
|
+
return this.selectedTime ? this.selectedTime.toLocaleTimeString(this.locale ?? void 0, {
|
|
366
|
+
hour: "2-digit",
|
|
367
|
+
minute: "2-digit",
|
|
368
|
+
hour12: this.resolvedHour12()
|
|
369
|
+
}) : "";
|
|
370
|
+
}
|
|
371
|
+
render() {
|
|
372
|
+
const e = this.formatDisplay();
|
|
373
|
+
return l`
|
|
374
|
+
<div class="input-group">
|
|
375
|
+
<input
|
|
376
|
+
class="form-control"
|
|
377
|
+
type="text"
|
|
378
|
+
readonly
|
|
379
|
+
aria-readonly="true"
|
|
380
|
+
.value="${e}"
|
|
381
|
+
placeholder="${this.placeholder || h}"
|
|
382
|
+
?disabled="${this.disabled}"
|
|
383
|
+
/>
|
|
384
|
+
<button
|
|
385
|
+
class="trigger"
|
|
386
|
+
type="button"
|
|
387
|
+
aria-haspopup="listbox"
|
|
388
|
+
aria-expanded="${this.overlay.isOpen ? "true" : "false"}"
|
|
389
|
+
aria-controls="${this.popupId}"
|
|
390
|
+
aria-label="${this.triggerLabel}"
|
|
391
|
+
?disabled="${this.disabled}"
|
|
392
|
+
@click="${this.onTriggerClick}"
|
|
393
|
+
@keydown="${this.onTriggerKeyDown}"
|
|
394
|
+
.innerHTML="${k}"
|
|
395
|
+
></button>
|
|
396
|
+
</div>
|
|
397
|
+
<div class="popup" id="${this.popupId}">
|
|
398
|
+
<slot name="time-list"
|
|
399
|
+
@selected-time-change="${this.onSelectedTimeChange}"
|
|
400
|
+
>
|
|
401
|
+
<mp-time-list
|
|
402
|
+
.selectedTime="${this.selectedTime}"
|
|
403
|
+
.step="${this.step}"
|
|
404
|
+
.min="${this.min}"
|
|
405
|
+
.max="${this.max}"
|
|
406
|
+
.hour12="${this.hour12}"
|
|
407
|
+
.locale="${this.locale}"
|
|
408
|
+
@selected-time-change="${this.onSelectedTimeChange}"
|
|
409
|
+
></mp-time-list>
|
|
410
|
+
</slot>
|
|
411
|
+
</div>
|
|
412
|
+
`;
|
|
413
|
+
}
|
|
414
|
+
}
|
|
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);
|
|
425
|
+
export {
|
|
426
|
+
w as M,
|
|
427
|
+
u as a
|
|
428
|
+
};
|