monobill-mintui 0.6.738 → 0.6.739
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/dist/components/alert/browser.js +4 -4
- package/dist/components/alert/index.cjs +1 -1
- package/dist/components/alert/index.js +4 -4
- package/dist/components/back-button/browser.js +1 -1
- package/dist/components/back-button/index.cjs +1 -1
- package/dist/components/back-button/index.js +1 -1
- package/dist/components/bottom-navigation/browser.js +2 -2
- package/dist/components/bottom-navigation/index.cjs +1 -1
- package/dist/components/bottom-navigation/index.js +2 -2
- package/dist/components/button/browser.js +1 -1
- package/dist/components/button/index.cjs +1 -1
- package/dist/components/button/index.js +1 -1
- package/dist/components/checkbox/browser.js +1 -1
- package/dist/components/checkbox/index.cjs +1 -1
- package/dist/components/checkbox/index.js +1 -1
- package/dist/components/chip/browser.js +1 -1
- package/dist/components/chip/index.cjs +1 -1
- package/dist/components/chip/index.js +1 -1
- package/dist/components/chunks/ScrollFade-58GqgRLY.js +1 -0
- package/dist/components/chunks/ScrollFade-kpfpO4Zb.js +160 -0
- package/dist/components/chunks/{back-button-C_aLMNZE.js → back-button-CQ3ZKGa1.js} +1 -1
- package/dist/components/chunks/{back-button-CMZR-p_D.js → back-button-DpPfWpAh.js} +2 -2
- package/dist/components/chunks/{button-THsh4Svz.js → button-CIuVIyLf.js} +2 -2
- package/dist/components/chunks/{button-CELyLLtj.js → button-CgymemwA.js} +1 -1
- package/dist/components/chunks/{caret-down-DUfiCBEs.js → caret-down-CikQdiAu.js} +1 -1
- package/dist/components/chunks/caret-down-DZinO2Vg.js +1 -0
- package/dist/components/chunks/caret-right-CMZIcNYV.js +1 -0
- package/dist/components/chunks/{caret-right-CppgjbLX.js → caret-right-ZvpF7jIK.js} +1 -1
- package/dist/components/chunks/{checkbox-d5UlscqI.js → checkbox-98ctQydC.js} +1 -1
- package/dist/components/chunks/{checkbox-CZViKLNo.js → checkbox-B8VzPrhn.js} +2 -2
- package/dist/components/chunks/{chip-G6SRCgLq.js → chip-Cqm_NPF5.js} +3 -3
- package/dist/components/chunks/{chip-DJ_kZURn.js → chip-dVw8BZP7.js} +1 -1
- package/dist/components/chunks/{close-ChHICicN.js → close-DtRLefjU.js} +1 -1
- package/dist/components/chunks/close-DuS1TdUB.js +1 -0
- package/dist/components/chunks/{confirm-action-BSHfjDfA.js → confirm-action-8Yx0K5j1.js} +1 -1
- package/dist/components/chunks/{confirm-action-CRZMTjpd.js → confirm-action-C0XX_TyJ.js} +2 -2
- package/dist/components/chunks/{date-picker-R8J7EzuF.js → date-picker-BJ_82oRR.js} +1 -1
- package/dist/components/chunks/{date-picker-STjYRdxE.js → date-picker-BuJJ8gvT.js} +5 -5
- package/dist/components/chunks/icon-Cmx9FTmb.js +1 -0
- package/dist/components/chunks/{icon-1cs-hcBy.js → icon-CuRTWM4k.js} +67 -57
- package/dist/components/chunks/icon-pgeP1zxb.js +51 -0
- package/dist/components/chunks/icon-rdeLRs-R.js +1 -0
- package/dist/components/chunks/{input-Bu4xPosP.js → input-BpcFd35m.js} +3 -3
- package/dist/components/chunks/{input-Zqw53jts.js → input-DJaqPjMg.js} +1 -1
- package/dist/components/chunks/{modal-CL5EStu0.js → modal-BJtuPK1b.js} +1 -1
- package/dist/components/chunks/{modal-ss_OTDJJ.js → modal-BzRle8yT.js} +2 -2
- package/dist/components/chunks/{popover-7-PJT1-5.js → popover-BcN2LEbO.js} +1 -1
- package/dist/components/chunks/{popover-CD0v0njp.js → popover-N3cKN8iW.js} +1 -1
- package/dist/components/chunks/search-DA6dk5kF.js +1 -0
- package/dist/components/chunks/{search-qSlGRuMR.js → search-Dw9cb1wC.js} +1 -1
- package/dist/components/chunks/{select-oEt5Dm4P.js → select-Ctps8gPL.js} +1 -1
- package/dist/components/chunks/{select-hL6gV7mL.js → select-DPERiupq.js} +3 -3
- package/dist/components/chunks/sortable-Bj0VTUqS.js +1 -0
- package/dist/components/chunks/{sortable-CQtdBuGw.js → sortable-DWfdFpgA.js} +59 -22
- package/dist/components/chunks/{table-D82Gvcva.js → table-C4xUMQw6.js} +1 -1
- package/dist/components/chunks/{table-BZ73d2Yb.js → table-k97RfsAA.js} +1 -1
- package/dist/components/chunks/{time-picker-B7oXBU8q.js → time-picker-Bl8KsaJj.js} +3 -3
- package/dist/components/chunks/{time-picker-QzH9kywR.js → time-picker-D74vZTpL.js} +1 -1
- package/dist/components/chunks/{warning-gkij2FhS.js → warning-B1-z7ww9.js} +1 -1
- package/dist/components/chunks/{warning-Cf8ePVsQ.js → warning-CfJwI6nV.js} +1 -1
- package/dist/components/confirm-action/browser.js +1 -1
- package/dist/components/confirm-action/index.cjs +1 -1
- package/dist/components/confirm-action/index.js +1 -1
- package/dist/components/date-picker/browser.js +1 -1
- package/dist/components/date-picker/index.cjs +1 -1
- package/dist/components/date-picker/index.js +1 -1
- package/dist/components/datetime-picker/browser.js +3 -3
- package/dist/components/datetime-picker/index.cjs +1 -1
- package/dist/components/datetime-picker/index.js +3 -3
- package/dist/components/dropzone/browser.js +4 -4
- package/dist/components/dropzone/index.cjs +1 -1
- package/dist/components/dropzone/index.js +4 -4
- package/dist/components/editor/Editor.d.ts.map +1 -1
- package/dist/components/editor/browser.js +76 -73
- package/dist/components/editor/index.cjs +2 -2
- package/dist/components/editor/index.d.ts +1 -0
- package/dist/components/editor/index.d.ts.map +1 -1
- package/dist/components/editor/index.js +76 -73
- package/dist/components/form/Form.d.ts +5 -1
- package/dist/components/form/Form.d.ts.map +1 -1
- package/dist/components/form/browser.js +52 -40
- package/dist/components/form/index.cjs +1 -1
- package/dist/components/form/index.js +52 -40
- package/dist/components/icon/browser.js +1 -1
- package/dist/components/icon/icons/index.d.ts +1 -0
- package/dist/components/icon/icons/index.d.ts.map +1 -1
- package/dist/components/icon/icons/play.d.ts +3 -0
- package/dist/components/icon/icons/play.d.ts.map +1 -0
- package/dist/components/icon/index.cjs +1 -1
- package/dist/components/icon/index.js +1 -1
- package/dist/components/input/browser.js +1 -1
- package/dist/components/input/index.cjs +1 -1
- package/dist/components/input/index.js +1 -1
- package/dist/components/modal/browser.js +1 -1
- package/dist/components/modal/index.cjs +1 -1
- package/dist/components/modal/index.js +1 -1
- package/dist/components/navigation/browser.js +3 -3
- package/dist/components/navigation/index.cjs +1 -1
- package/dist/components/navigation/index.js +3 -3
- package/dist/components/off-canvas/browser.js +2 -2
- package/dist/components/off-canvas/index.cjs +1 -1
- package/dist/components/off-canvas/index.js +2 -2
- package/dist/components/page/browser.js +4 -4
- package/dist/components/page/index.cjs +1 -1
- package/dist/components/page/index.js +4 -4
- package/dist/components/popover/browser.js +1 -1
- package/dist/components/popover/index.cjs +1 -1
- package/dist/components/popover/index.js +1 -1
- package/dist/components/resource-table/browser.js +11 -11
- package/dist/components/resource-table/index.cjs +1 -1
- package/dist/components/resource-table/index.js +11 -11
- package/dist/components/scroll-fade/ScrollFade.d.ts.map +1 -1
- package/dist/components/scroll-fade/browser.js +1 -1
- package/dist/components/scroll-fade/index.cjs +1 -1
- package/dist/components/scroll-fade/index.js +1 -1
- package/dist/components/search/browser.js +7 -7
- package/dist/components/search/index.cjs +1 -1
- package/dist/components/search/index.js +7 -7
- package/dist/components/select/browser.js +1 -1
- package/dist/components/select/index.cjs +1 -1
- package/dist/components/select/index.js +1 -1
- package/dist/components/side-navigation/browser.js +6 -6
- package/dist/components/side-navigation/index.cjs +1 -1
- package/dist/components/side-navigation/index.js +6 -6
- package/dist/components/sortable/Sortable.d.ts +8 -0
- package/dist/components/sortable/Sortable.d.ts.map +1 -1
- package/dist/components/sortable/browser.js +1 -1
- package/dist/components/sortable/index.cjs +1 -1
- package/dist/components/sortable/index.js +1 -1
- package/dist/components/switch/browser.js +2 -2
- package/dist/components/switch/index.cjs +1 -1
- package/dist/components/switch/index.js +2 -2
- package/dist/components/table/browser.js +1 -1
- package/dist/components/table/index.cjs +1 -1
- package/dist/components/table/index.js +1 -1
- package/dist/components/tabs/browser.js +1 -1
- package/dist/components/tabs/index.cjs +1 -1
- package/dist/components/tabs/index.js +1 -1
- package/dist/components/tags/Tags.d.ts.map +1 -1
- package/dist/components/tags/browser.js +8 -17
- package/dist/components/tags/index.cjs +1 -1
- package/dist/components/tags/index.js +8 -17
- package/dist/components/time-picker/browser.js +1 -1
- package/dist/components/time-picker/index.cjs +1 -1
- package/dist/components/time-picker/index.js +1 -1
- package/dist/components/tree/browser.js +5 -5
- package/dist/components/tree/index.cjs +1 -1
- package/dist/components/tree/index.js +5 -5
- package/dist/editor.css +1 -1
- package/dist/icons/play.svg +3 -0
- package/dist/index.cjs +14 -14
- package/dist/index.css +3 -3
- package/dist/index.js +611 -484
- package/dist/navigation-search.json +8 -1
- package/dist/scroll-fade.css +1 -1
- package/dist/tags.css +1 -1
- package/package.json +1 -1
- package/dist/components/chunks/ScrollFade-DOnPtfC2.js +0 -85
- package/dist/components/chunks/ScrollFade-FBvsnQ1i.js +0 -1
- package/dist/components/chunks/caret-down-BiAVkpX7.js +0 -1
- package/dist/components/chunks/caret-right-8n-rhz51.js +0 -1
- package/dist/components/chunks/close-CuYimzX0.js +0 -1
- package/dist/components/chunks/icon-Bv1J3LwC.js +0 -51
- package/dist/components/chunks/icon-C-6HOPtI.js +0 -1
- package/dist/components/chunks/icon-aNwWb0hA.js +0 -1
- package/dist/components/chunks/search-C3uTkxhf.js +0 -1
- package/dist/components/chunks/sortable-Brecvk9d.js +0 -1
|
@@ -10,6 +10,7 @@ var t = "mint-sortable-placeholder", n = "mint-sortable-dragging", r = class e e
|
|
|
10
10
|
"scroll-max-height",
|
|
11
11
|
"disabled",
|
|
12
12
|
"handle-selector",
|
|
13
|
+
"drag-threshold",
|
|
13
14
|
"scroll-sensitivity",
|
|
14
15
|
"scroll-speed",
|
|
15
16
|
"animation-duration",
|
|
@@ -18,9 +19,15 @@ var t = "mint-sortable-placeholder", n = "mint-sortable-dragging", r = class e e
|
|
|
18
19
|
];
|
|
19
20
|
}
|
|
20
21
|
constructor() {
|
|
21
|
-
super(), this._pointerId = null, this._dragEl = null, this._dragOriginalStyle = "", this._placeholder = null, this._listRoot = this, this._startIndex = 0, this._pointerStartX = 0, this._pointerStartY = 0, this._pendingPointerEvent = null, this._moveRaf = null, this._gridSlots = [], this._scrollRaf = null, this._previewResizeRaf = null, this._childObserver = null, this._pointerBoundRoot = null, this._restoreAfter = null, this._originListRoot = null, this._originNextSibling = null, this._dropList = null, this._dropAtEnd = !1, this._dropRejected = !1, this._sortStatus = null, this._flipCleanupTimers = /* @__PURE__ */ new WeakMap(), this._lastPreviewRoot = null, this._lastPreviewIndex = -1, this._keyboardKeydownHandler = (e) => this._onKeyboardReorder(e), this.
|
|
22
|
+
super(), this._pointerId = null, this._dragEl = null, this._dragOriginalStyle = "", this._placeholder = null, this._listRoot = this, this._startIndex = 0, this._pointerStartX = 0, this._pointerStartY = 0, this._pendingDragStart = null, this._pendingPointerEvent = null, this._moveRaf = null, this._gridSlots = [], this._scrollRaf = null, this._scrollRoot = null, this._lastDragPointer = null, this._previewResizeRaf = null, this._childObserver = null, this._pointerBoundRoot = null, this._restoreAfter = null, this._originListRoot = null, this._originNextSibling = null, this._dropList = null, this._dropAtEnd = !1, this._dropRejected = !1, this._sortStatus = null, this._flipCleanupTimers = /* @__PURE__ */ new WeakMap(), this._lastPreviewRoot = null, this._lastPreviewIndex = -1, this._keyboardKeydownHandler = (e) => this._onKeyboardReorder(e), this._onPendingPointerMove = (e) => {
|
|
23
|
+
let t = e, n = this._pendingDragStart;
|
|
24
|
+
!n || t.pointerId !== n.pointerId || Math.hypot(t.clientX - n.clientX, t.clientY - n.clientY) < this._getDragThreshold() || (this._clearPendingDragStart(), t.preventDefault(), this._startDrag(t, n.item));
|
|
25
|
+
}, this._onPendingPointerEnd = (e) => {
|
|
22
26
|
let t = e;
|
|
23
|
-
|
|
27
|
+
this._pendingDragStart?.pointerId === t.pointerId && this._clearPendingDragStart();
|
|
28
|
+
}, this._onListPointerDown = (e) => {
|
|
29
|
+
let t = e;
|
|
30
|
+
if (this._isDisabled() || this._pointerId !== null || this._pendingDragStart || t.button !== 0) return;
|
|
24
31
|
let n = t.target;
|
|
25
32
|
if (!n || !this.contains(n)) return;
|
|
26
33
|
let r = (n instanceof Element ? n : n.parentElement)?.closest("mint-sortable");
|
|
@@ -32,7 +39,24 @@ var t = "mint-sortable-placeholder", n = "mint-sortable-dragging", r = class e e
|
|
|
32
39
|
let e = t.target.closest(a);
|
|
33
40
|
if (!e || !i.contains(e)) return;
|
|
34
41
|
}
|
|
42
|
+
if (this._getDragThreshold() > 0) {
|
|
43
|
+
this._pendingDragStart = {
|
|
44
|
+
pointerId: t.pointerId,
|
|
45
|
+
item: i,
|
|
46
|
+
clientX: t.clientX,
|
|
47
|
+
clientY: t.clientY
|
|
48
|
+
}, window.addEventListener("pointermove", this._onPendingPointerMove, { passive: !1 }), window.addEventListener("pointerup", this._onPendingPointerEnd), window.addEventListener("pointercancel", this._onPendingPointerEnd);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
35
51
|
t.preventDefault(), this._startDrag(t, i);
|
|
52
|
+
}, this._runAutoScrollFrame = () => {
|
|
53
|
+
this._scrollRaf = null;
|
|
54
|
+
let e = this._scrollRoot, t = this._lastDragPointer;
|
|
55
|
+
if (!e || !t || !this._dragEl || !this._placeholder) return;
|
|
56
|
+
let n = this.getDirection(), r = getComputedStyle(e), i = /(auto|scroll)/.test(r.overflowX) && e.scrollWidth > e.clientWidth, a = /(auto|scroll)/.test(r.overflowY) && e.scrollHeight > e.clientHeight, o = e.getBoundingClientRect(), s = this._getScrollSensitivity(), c = this._getScrollSpeed(), l = 0, u = 0;
|
|
57
|
+
if ((n === "horizontal" || n === "grid") && i && (t.clientX < o.left + s && e.scrollLeft > 0 ? l = -c : t.clientX > o.right - s && e.scrollLeft + e.clientWidth < e.scrollWidth && (l = c)), (n === "vertical" || n === "grid") && a && (t.clientY < o.top + s && e.scrollTop > 0 ? u = -c : t.clientY > o.bottom - s && e.scrollTop + e.clientHeight < e.scrollHeight && (u = c)), l === 0 && u === 0) return;
|
|
58
|
+
let d = e.scrollLeft, f = e.scrollTop;
|
|
59
|
+
e.scrollLeft += l, e.scrollTop += u, (e.scrollLeft !== d || e.scrollTop !== f) && (this._maybeMovePlaceholder(t), this._scrollRaf = requestAnimationFrame(this._runAutoScrollFrame));
|
|
36
60
|
}, this._boundPointerMove = this._onPointerMove.bind(this), this._boundPointerUp = this._onPointerUp.bind(this), this._boundPointerCancel = this._onPointerCancel.bind(this);
|
|
37
61
|
}
|
|
38
62
|
connectedCallback() {
|
|
@@ -161,6 +185,13 @@ var t = "mint-sortable-placeholder", n = "mint-sortable-dragging", r = class e e
|
|
|
161
185
|
let e = this.getAttribute("handle-selector");
|
|
162
186
|
return e && e.trim() ? e.trim() : null;
|
|
163
187
|
}
|
|
188
|
+
_getDragThreshold() {
|
|
189
|
+
let e = parseFloat(this.getAttribute("drag-threshold") || "0");
|
|
190
|
+
return Number.isFinite(e) ? Math.max(0, e) : 0;
|
|
191
|
+
}
|
|
192
|
+
_clearPendingDragStart() {
|
|
193
|
+
this._pendingDragStart &&= (window.removeEventListener("pointermove", this._onPendingPointerMove), window.removeEventListener("pointerup", this._onPendingPointerEnd), window.removeEventListener("pointercancel", this._onPendingPointerEnd), null);
|
|
194
|
+
}
|
|
164
195
|
_getScrollSensitivity() {
|
|
165
196
|
let e = parseFloat(this.getAttribute("scroll-sensitivity") || "48");
|
|
166
197
|
return Number.isFinite(e) ? e : 48;
|
|
@@ -196,7 +227,10 @@ var t = "mint-sortable-placeholder", n = "mint-sortable-dragging", r = class e e
|
|
|
196
227
|
index: t
|
|
197
228
|
})) : [];
|
|
198
229
|
let i = r.getBoundingClientRect();
|
|
199
|
-
this._pointerStartX = e.clientX, this._pointerStartY = e.clientY
|
|
230
|
+
this._pointerStartX = e.clientX, this._pointerStartY = e.clientY, this._lastDragPointer = {
|
|
231
|
+
clientX: e.clientX,
|
|
232
|
+
clientY: e.clientY
|
|
233
|
+
};
|
|
200
234
|
let a = document.createElement("div");
|
|
201
235
|
if (a.className = t, this.getDirection() !== "grid") a.style.minHeight = `${i.height}px`, a.style.minWidth = `${i.width}px`;
|
|
202
236
|
else {
|
|
@@ -205,7 +239,7 @@ var t = "mint-sortable-placeholder", n = "mint-sortable-dragging", r = class e e
|
|
|
205
239
|
}
|
|
206
240
|
a.setAttribute("aria-hidden", "true"), this._placeholder = a, this._listRoot.insertBefore(a, r), r.classList.add(n), r.style.position = "fixed";
|
|
207
241
|
let o = this.getDirection() === "grid";
|
|
208
|
-
r.style.left = `${o ? e.clientX : i.left}px`, r.style.top = `${o ? e.clientY : i.top}px`, r.style.width = `${i.width}px`, r.style.height = `${i.height}px`, r.style.margin = "0", r.style.zIndex = "10000", r.style.boxSizing = "border-box", r.style.pointerEvents = "none", r.style.touchAction = "none", r.style.transform = o ? "translate3d(0, 0, 0) translate(-50%, -50%) scale(1.015)" : "translate3d(0, 0, 0) scale(1.015)", r.style.transformOrigin = o ? "center center" : "top left", r.style.willChange = "transform", r.setPointerCapture(e.pointerId);
|
|
242
|
+
r.style.left = `${o ? e.clientX : i.left}px`, r.style.top = `${o ? e.clientY : i.top}px`, r.style.width = `${i.width}px`, r.style.height = `${i.height}px`, r.style.margin = "0", r.style.zIndex = "10000", r.style.boxSizing = "border-box", r.style.pointerEvents = "none", r.style.touchAction = "none", r.style.transform = o ? "translate3d(0, 0, 0) translate(-50%, -50%) scale(1.015)" : "translate3d(0, 0, 0) scale(1.015)", r.style.transformOrigin = o ? "center center" : "top left", r.style.willChange = "transform", document.body.appendChild(r), r.setPointerCapture(e.pointerId);
|
|
209
243
|
let s = this._collectOrderedKeys(), c = {
|
|
210
244
|
index: this._startIndex,
|
|
211
245
|
itemId: r.getAttribute(this._getItemKeyAttribute()) || "",
|
|
@@ -277,19 +311,21 @@ var t = "mint-sortable-placeholder", n = "mint-sortable-dragging", r = class e e
|
|
|
277
311
|
return this.dispatchEvent(f), this._dropRejected = !d || f.defaultPrevented, this._dropRejected ? this : s;
|
|
278
312
|
}
|
|
279
313
|
_autoScroll(e) {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
314
|
+
this._lastDragPointer = {
|
|
315
|
+
clientX: e.clientX,
|
|
316
|
+
clientY: e.clientY
|
|
317
|
+
};
|
|
318
|
+
let t = this.getDirection(), n = this;
|
|
319
|
+
for (; n && n !== document.body;) {
|
|
320
|
+
let e = getComputedStyle(n), r = /(auto|scroll)/.test(e.overflowX) && n.scrollWidth > n.clientWidth, i = /(auto|scroll)/.test(e.overflowY) && n.scrollHeight > n.clientHeight;
|
|
321
|
+
if (t === "horizontal" && r || t === "vertical" && i || t === "grid" && (r || i)) break;
|
|
322
|
+
n = n.parentElement;
|
|
285
323
|
}
|
|
286
|
-
if (!
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
e.clientY < i.top + n ? a = -r : e.clientY > i.bottom - n && (a = r), a !== 0 && (t.scrollTop += a, this._maybeMovePlaceholder(e));
|
|
292
|
-
});
|
|
324
|
+
if (!n || n === document.body) {
|
|
325
|
+
this._scrollRoot = null, this._scrollRaf !== null && cancelAnimationFrame(this._scrollRaf), this._scrollRaf = null;
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
this._scrollRoot = n, this._scrollRaf === null && (this._scrollRaf = requestAnimationFrame(this._runAutoScrollFrame));
|
|
293
329
|
}
|
|
294
330
|
_maybeMovePlaceholder(e) {
|
|
295
331
|
let t = this._placeholder, n = this._dragEl;
|
|
@@ -422,14 +458,14 @@ var t = "mint-sortable-placeholder", n = "mint-sortable-dragging", r = class e e
|
|
|
422
458
|
this._teardownDrag();
|
|
423
459
|
return;
|
|
424
460
|
}
|
|
425
|
-
this._previewResizeRaf !== null && (cancelAnimationFrame(this._previewResizeRaf), this._previewResizeRaf = null), this._moveRaf !== null && (cancelAnimationFrame(this._moveRaf), this._moveRaf = null), this._pendingPointerEvent = null;
|
|
461
|
+
this._previewResizeRaf !== null && (cancelAnimationFrame(this._previewResizeRaf), this._previewResizeRaf = null), this._scrollRaf !== null && (cancelAnimationFrame(this._scrollRaf), this._scrollRaf = null), this._moveRaf !== null && (cancelAnimationFrame(this._moveRaf), this._moveRaf = null), this._pendingPointerEvent = null;
|
|
426
462
|
try {
|
|
427
463
|
t.releasePointerCapture(this._pointerId);
|
|
428
464
|
} catch {}
|
|
429
465
|
window.removeEventListener("pointermove", this._boundPointerMove), window.removeEventListener("pointerup", this._boundPointerUp), window.removeEventListener("pointercancel", this._boundPointerCancel);
|
|
430
466
|
let i = this._dropList ?? this, a = i._resolveListRoot();
|
|
431
467
|
!e && !this._dropRejected && this._dropAtEnd && i !== this && r?.parentNode === a && a.appendChild(r);
|
|
432
|
-
let o = this.getAttribute("data-tree-parent-id") || null, s = i.getAttribute("data-tree-parent-id") || null, c = this.
|
|
468
|
+
let o = this.getAttribute("data-tree-parent-id") || null, s = i.getAttribute("data-tree-parent-id") || null, c = this._startIndex, l = r?.parentNode === a ? Array.from(a.children).filter((e) => e.nodeType === Node.ELEMENT_NODE && e !== t && !e.hasAttribute("data-mint-sortable-status")).indexOf(r) : c, u = new CustomEvent("mint-sortable-before-drop", {
|
|
433
469
|
bubbles: !0,
|
|
434
470
|
composed: !0,
|
|
435
471
|
cancelable: !0,
|
|
@@ -451,7 +487,7 @@ var t = "mint-sortable-placeholder", n = "mint-sortable-dragging", r = class e e
|
|
|
451
487
|
} else r?.parentNode && r.parentNode.insertBefore(t, r);
|
|
452
488
|
r?.remove(), this._placeholder = null, t.classList.remove(n), t.style.cssText = this._dragOriginalStyle, this._dragOriginalStyle = "";
|
|
453
489
|
let f = d ? c : i._indexOfItem(t);
|
|
454
|
-
this._pointerId = null, this._dragEl = null, this._restoreAfter = null, this._originListRoot = null, this._originNextSibling = null, this._dropList = null, this._dropAtEnd = !1, this._dropRejected = !1, this._lastPreviewRoot = null, this._lastPreviewIndex = -1, this._gridSlots = [];
|
|
490
|
+
this._pointerId = null, this._scrollRoot = null, this._lastDragPointer = null, this._dragEl = null, this._restoreAfter = null, this._originListRoot = null, this._originNextSibling = null, this._dropList = null, this._dropAtEnd = !1, this._dropRejected = !1, this._lastPreviewRoot = null, this._lastPreviewIndex = -1, this._gridSlots = [];
|
|
455
491
|
let p = this._collectOrderedKeys(), m = i._collectOrderedKeys(), h = !d && (!d && o !== s || f !== c), g = t.getAttribute(this._getItemKeyAttribute()) || "", _ = {
|
|
456
492
|
oldIndex: c,
|
|
457
493
|
newIndex: f,
|
|
@@ -491,13 +527,14 @@ var t = "mint-sortable-placeholder", n = "mint-sortable-dragging", r = class e e
|
|
|
491
527
|
})));
|
|
492
528
|
}
|
|
493
529
|
_teardownDrag() {
|
|
494
|
-
if (this._previewResizeRaf !== null && (cancelAnimationFrame(this._previewResizeRaf), this._previewResizeRaf = null), this._scrollRaf !== null && (cancelAnimationFrame(this._scrollRaf), this._scrollRaf = null), this._moveRaf !== null && (cancelAnimationFrame(this._moveRaf), this._moveRaf = null), this._pendingPointerEvent = null, window.removeEventListener("pointermove", this._boundPointerMove), window.removeEventListener("pointerup", this._boundPointerUp), window.removeEventListener("pointercancel", this._boundPointerCancel), this._dragEl) {
|
|
530
|
+
if (this._clearPendingDragStart(), this._previewResizeRaf !== null && (cancelAnimationFrame(this._previewResizeRaf), this._previewResizeRaf = null), this._scrollRaf !== null && (cancelAnimationFrame(this._scrollRaf), this._scrollRaf = null), this._moveRaf !== null && (cancelAnimationFrame(this._moveRaf), this._moveRaf = null), this._pendingPointerEvent = null, window.removeEventListener("pointermove", this._boundPointerMove), window.removeEventListener("pointerup", this._boundPointerUp), window.removeEventListener("pointercancel", this._boundPointerCancel), this._dragEl) {
|
|
495
531
|
try {
|
|
496
532
|
this._pointerId !== null && this._dragEl.releasePointerCapture(this._pointerId);
|
|
497
533
|
} catch {}
|
|
498
|
-
this.
|
|
534
|
+
let e = this._originListRoot ?? this._listRoot, t = this._originNextSibling ?? this._restoreAfter;
|
|
535
|
+
this._dragEl.parentElement !== e && (t && t.parentNode === e ? e.insertBefore(this._dragEl, t) : e.appendChild(this._dragEl)), this._dragEl.classList.remove(n), this._dragEl.style.cssText = this._dragOriginalStyle, this._dragOriginalStyle = "";
|
|
499
536
|
}
|
|
500
|
-
this._placeholder?.remove(), this._placeholder = null, this._dragEl = null, this._pointerId = null, this._restoreAfter = null, this._originListRoot = null, this._originNextSibling = null, this._dropList = null, this._dropRejected = !1, this._lastPreviewRoot = null, this._lastPreviewIndex = -1, this._gridSlots = [];
|
|
537
|
+
this._placeholder?.remove(), this._placeholder = null, this._scrollRoot = null, this._lastDragPointer = null, this._dragEl = null, this._pointerId = null, this._restoreAfter = null, this._originListRoot = null, this._originNextSibling = null, this._dropList = null, this._dropRejected = !1, this._lastPreviewRoot = null, this._lastPreviewIndex = -1, this._gridSlots = [];
|
|
501
538
|
}
|
|
502
539
|
};
|
|
503
540
|
customElements.get("mint-sortable") || e("mint-sortable", r);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./register-element-tCL_F1YI.js`),t=require(`./ScrollFade-
|
|
1
|
+
const e=require(`./register-element-tCL_F1YI.js`),t=require(`./ScrollFade-58GqgRLY.js`);var n=class extends HTMLElement{constructor(...e){super(...e),this._observer=null,this._disposeScrollFade=null}connectedCallback(){this.classList.add(`mint-table-host`);let e=this.closest(`[data-mint-rt-horizontal-scroll]`);this._disposeScrollFade=e?t.n(e,`horizontal`):t.n(this,`both`),this._observeChanges(),this._applyStyles(),requestAnimationFrame(()=>{this._applyStyles(),setTimeout(()=>this._applyStyles(),0)})}disconnectedCallback(){this._observer?.disconnect(),this._observer=null,this._disposeScrollFade?.(),this._disposeScrollFade=null}_observeChanges(){this._observer=new MutationObserver(()=>this._applyStyles()),this._observer.observe(this,{childList:!0,subtree:!0,attributes:!1})}_applyStyles(){this._observer?.disconnect();let e=Array.from(this.querySelectorAll(`table`));if(e.length===0){this._observer&&this._observeChanges();return}e.forEach(e=>{let t=!!e.closest(`[id^="mint-rt-vscroll-"]`)||!!e.closest(`mint-resource-table[data-mint-rt-fixed-header]`);e.classList.add(`mint-table-native`),e.classList.toggle(`mint-table-pinned-layout`,t)});let t=e.find(e=>e.querySelector(`thead`))??e[0],n=e.find(e=>e.querySelector(`tbody`))??e[0],r=t.querySelector(`thead`);r&&r.querySelectorAll(`th`).forEach(e=>{let t=e.querySelector(`mint-icon`),n=t?.getAttribute(`name`)||``,r=e.hasAttribute(`data-mint-rt-sortable`)||t!==null&&n!==`ellipsis`;e.classList.toggle(`mint-table-sortable`,r);let i=e.closest(`table`),a=i?.closest(`mint-resource-table`),o=!!i?.closest(`[id^="mint-rt-vscroll-"]`)||!!a?.hasAttribute(`data-mint-rt-fixed-header`);e.classList.toggle(`mint-table-pinned-header`,o)});let i=n.querySelector(`tbody`);if(i){let e=Array.from(i.querySelectorAll(`tr`)),t=!!n.closest(`[id^="mint-rt-vscroll-"]`)||!!n.closest(`mint-resource-table`)?.hasAttribute(`data-mint-rt-fixed-header`),r=e.findIndex(e=>e.getAttribute(`data-mint-rt-spacer`)===`bottom`);e.forEach((n,i)=>{let a=n.hasAttribute(`data-mint-rt-spacer`),o=n.hasAttribute(`data-row-clickable`);n.classList.toggle(`mint-table-spacer`,a),n.classList.toggle(`mint-table-clickable`,o&&!a),n.classList.toggle(`mint-table-row-bordered`,!a&&!t&&i!==e.length-1),Array.from(n.querySelectorAll(`td`)).forEach(o=>{let s=n.hasAttribute(`data-mint-rt-last-row`),c=r===-1&&i===e.length-1;o.classList.toggle(`mint-table-cell-bordered`,t&&!a&&!s&&!c),this._restoreCell(o)})})}n.querySelectorAll(`tfoot td`).forEach(e=>this._restoreCell(e)),this._observer&&this._observeChanges()}_restoreCell(e){if(e.dataset.mtProcessed!==`true`)return;let t={};Array.from(e.attributes).forEach(e=>{e.name.startsWith(`data-`)&&e.name!==`data-original`&&e.name!==`data-mt-processed`&&(t[e.name]=e.value)});let n=e.getAttribute(`data-original`)||``;e.dataset.mtProcessed=``,e.innerHTML=n,Object.entries(t).forEach(([t,n])=>e.setAttribute(t,n))}};customElements.get(`mint-table`)||e.t(`mint-table`,n),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return n}});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import "./icon-
|
|
1
|
+
import "./icon-CuRTWM4k.js";
|
|
2
2
|
import { t as e } from "./register-element-BFYmIynH.js";
|
|
3
3
|
import "./text-C-6UCBp-.js";
|
|
4
|
-
import "./input-
|
|
5
|
-
import "./popover-
|
|
4
|
+
import "./input-BpcFd35m.js";
|
|
5
|
+
import "./popover-BcN2LEbO.js";
|
|
6
6
|
//#region src/components/time-picker/TimePicker.ts
|
|
7
7
|
var t = class extends HTMLElement {
|
|
8
8
|
constructor(...e) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`./icon-Bv1J3LwC.js`);const e=require(`./register-element-tCL_F1YI.js`);require(`./text-CfvRRKGZ.js`),require(`./input-Zqw53jts.js`),require(`./popover-CD0v0njp.js`);var t=class extends HTMLElement{constructor(...e){super(...e),this._triggerId=`mint-time-picker-trigger-${Math.random().toString(36).slice(2,10)}`,this._popover=null,this._popoverObserver=null,this._triggerClickObserver=null,this._inputEl=null,this._hiddenInput=null,this._prependSlotNodes=[],this._appendSlotNodes=[],this._slotObserver=null,this._single={hour:9,minute:0,second:0,meridiem:`AM`},this._rangeStart={hour:9,minute:0,second:0,meridiem:`AM`},this._rangeEnd={hour:5,minute:0,second:0,meridiem:`PM`},this._invalidFromInput=!1}static get observedAttributes(){return[`value`,`inline`,`label`,`info`,`disabled`,`id`,`name`,`required`,`readonly`,`range`,`hours`,`minutes`,`seconds`,`error`,`error-message`]}connectedCallback(){this.classList.add(`mint-time-picker-host`),this._parseAndApplyValue(this.getAttribute(`value`)||``),this.render(),this._slotObserver=new MutationObserver(e=>{e.some(e=>e.type===`attributes`&&e.target.hasAttribute(`slot`)||e.type===`childList`&&e.target===this&&Array.from(e.addedNodes).some(e=>e instanceof HTMLElement&&(e.slot===`prepend`||e.slot===`append`)))&&this.render()}),this._slotObserver.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`slot`]})}disconnectedCallback(){this._slotObserver?.disconnect(),this._slotObserver=null,this._popoverObserver&&=(this._popoverObserver.disconnect(),null),this._triggerClickObserver&&=(document.removeEventListener(`click`,this._triggerClickObserver,!0),null)}attributeChangedCallback(e,t,n){if(t!==n){if(e===`value`){this._parseAndApplyValue(n||``),this._syncHiddenInput(),this._syncInputValue();{let e=(this._popover||this).querySelector(`[data-mint-time-picker-body="true"]`);e&&this._buildPopoverContent(e)}return}e!==`error`&&e!==`error-message`&&(this._invalidFromInput=!1),this.render()}}get value(){return this.getValue()}set value(e){this.setValue(e||``)}getValue(){return this.getAttribute(`value`)||``}setValue(e){e?this.setAttribute(`value`,e):this.removeAttribute(`value`),this._parseAndApplyValue(e||``),this._syncHiddenInput(),this._syncInputValue()}isRange(){return this.getAttribute(`range`)===`true`}isHoursEnabled(){let e=this.getAttribute(`hours`);return e===null?!0:e!==`false`}isMinutesEnabled(){let e=this.getAttribute(`minutes`);return e===null?!0:e!==`false`}isSecondsEnabled(){let e=this.getAttribute(`seconds`);return e===null?!1:e!==`false`}isDisabled(){return this.getAttribute(`disabled`)===`true`}isReadonly(){return this.getAttribute(`readonly`)===`true`}isRequired(){return this.getAttribute(`required`)===`true`}hasExternalError(){return this.getAttribute(`error`)===`true`}getExternalErrorMessage(){return this.getAttribute(`error-message`)||``}getLabel(){return this.getAttribute(`label`)||``}getInfo(){return this.getAttribute(`info`)||``}getName(){return this.getAttribute(`name`)||``}_getEffectiveError(){return{hasError:this.hasExternalError(),message:this.getExternalErrorMessage()}}_formatParts(e){let t=this.isHoursEnabled(),n=this.isMinutesEnabled(),r=this.isSecondsEnabled(),i=[];return t&&i.push(e.hour.toString()),n&&i.push(e.minute.toString().padStart(2,`0`)),r&&i.push(e.second.toString().padStart(2,`0`)),t?`${i.join(`:`)} ${e.meridiem.toLowerCase()}`:i.join(`:`)}_to24Hour(e){let t=e.hour%12;return e.meridiem===`PM`&&(t+=12),{hour:t,minute:e.minute,second:e.second}}_formatParts24(e){let t=this.isHoursEnabled(),n=this.isMinutesEnabled(),r=this.isSecondsEnabled(),i=this._to24Hour(e),a=[];return t&&a.push(i.hour.toString().padStart(2,`0`)),n&&a.push(i.minute.toString().padStart(2,`0`)),r&&a.push(i.second.toString().padStart(2,`0`)),a.join(`:`)}_getDisplayValue(){return this.isRange()?`${this._formatParts(this._rangeStart)} - ${this._formatParts(this._rangeEnd)}`:this._formatParts(this._single)}_getOutputValue(){return this.isRange()?`${this._formatParts24(this._rangeStart)} - ${this._formatParts24(this._rangeEnd)}`:this._formatParts24(this._single)}_getExpectedFormat(){let e=this.isHoursEnabled(),t=this.isMinutesEnabled(),n=this.isSecondsEnabled(),r=[];e&&r.push(`h`),t&&r.push(`mm`),n&&r.push(`ss`);let i=e?`${r.join(`:`)} am/pm`:r.join(`:`);return this.isRange()?`${i} - ${i}`:i}_syncHiddenInput(){this._hiddenInput&&(this._hiddenInput.value=this.getValue()||this._getOutputValue())}_syncInputValue(){this._inputEl&&(this._inputEl.value=this._getDisplayValue(),typeof this._inputEl.render==`function`&&this._inputEl.render())}_emitChangeFromPicker(){let e=this._getOutputValue();this._invalidFromInput=!1,this.setAttribute(`value`,e),this._syncHiddenInput(),this._syncInputValue(),this.dispatchEvent(new Event(`input`,{bubbles:!0,composed:!0})),this.dispatchEvent(new Event(`change`,{bubbles:!0}))}_parseSingle(e){let t=this.isHoursEnabled(),n=this.isMinutesEnabled(),r=this.isSecondsEnabled(),i=e.trim();if(t){let e=i.match(/^(\d{1,2})(?::(\d{2}))?(?::(\d{2}))?\s*(am|pm)$/i);if(!e)return null;let t=Number(e[1]),a=Number(e[2]??0),o=Number(e[3]??0),s=e[4].toUpperCase();return t<1||t>12||n&&(a<0||a>59)||r&&(o<0||o>59)?null:{hour:t,minute:a,second:o,meridiem:s}}let a=i.match(/^(\d{2})(?::(\d{2}))?$/);if(!a)return null;let o=Number(a[1]),s=Number(a[2]??0);return n&&(o<0||o>59)||r&&(s<0||s>59)?null:{hour:12,minute:o,second:s,meridiem:`AM`}}_parseSingleOutput24(e){let t=this.isHoursEnabled(),n=this.isMinutesEnabled(),r=this.isSecondsEnabled(),i=e.trim();if(t){let e=i.match(/^(\d{2})(?::(\d{2}))?(?::(\d{2}))?$/);if(!e)return null;let t=Number(e[1]),a=Number(e[2]??0),o=Number(e[3]??0);if(t<0||t>23||n&&(a<0||a>59)||r&&(o<0||o>59))return null;let s=t>=12?`PM`:`AM`;return{hour:t%12==0?12:t%12,minute:a,second:o,meridiem:s}}let a=i.match(/^(\d{2})(?::(\d{2}))?$/);if(!a)return null;let o=Number(a[1]),s=Number(a[2]??0);return n&&(o<0||o>59)||r&&(s<0||s>59)?null:{hour:12,minute:o,second:s,meridiem:`AM`}}_parseAndApplyValue(e){if(!e)return!1;if(this.isRange()){let[t,n]=e.split(`-`).map(e=>e.trim()),r=this._parseSingleOutput24(t||``),i=this._parseSingleOutput24(n||``);return!r||!i?!1:(this._rangeStart=r,this._rangeEnd=i,!0)}let t=this._parseSingleOutput24(e);return t?(this._single=t,!0):!1}_parseAndApplyDisplayValue(e){if(!e)return!1;if(this.isRange()){let[t,n]=e.split(`-`).map(e=>e.trim()),r=this._parseSingle(t||``),i=this._parseSingle(n||``);return!r||!i?!1:(this._rangeStart=r,this._rangeEnd=i,!0)}let t=this._parseSingle(e);return t?(this._single=t,!0):!1}_handleTypedValue(e){let t=e.trim();if(!t){this._invalidFromInput=!1,this.removeAttribute(`value`),this._syncHiddenInput(),this._syncInputValue();return}if(!this._parseAndApplyDisplayValue(t)){this._invalidFromInput=!0,this.removeAttribute(`value`),this._inputEl&&(this._inputEl.value=``),this._syncHiddenInput(),this.render(),this.dispatchEvent(new Event(`input`,{bubbles:!0,composed:!0})),this.dispatchEvent(new Event(`change`,{bubbles:!0}));return}this._invalidFromInput=!1;let n=this._getOutputValue();this.setAttribute(`value`,n),this._syncHiddenInput(),this._syncInputValue(),this.dispatchEvent(new Event(`input`,{bubbles:!0,composed:!0})),this.dispatchEvent(new Event(`change`,{bubbles:!0}))}_buildColumn(e,t,n,r=!0,i=`standard`,a=`Time`){let o=document.createElement(`div`);return o.className=`mint-time-picker-column mint-time-picker-column-${i}${r?` mint-time-picker-column-divider`:``}`,o.setAttribute(`role`,`group`),o.setAttribute(`aria-label`,a),e.forEach(e=>{let r=document.createElement(`button`);r.type=`button`;let i=e===t;r.className=`mint-time-picker-option${i?` is-selected`:``}`,r.dataset.selected=i?`true`:`false`,r.setAttribute(`aria-pressed`,String(i)),r.setAttribute(`aria-label`,`${a}: ${e}`),r.textContent=e,r.addEventListener(`click`,()=>n(e)),o.appendChild(r)}),o}_centerSelectedInColumn(e){let t=e.querySelector(`button[data-selected="true"]`);if(!t)return;let n=t.offsetTop-e.offsetTop-(e.clientHeight/2-t.offsetHeight/2),r=Math.max(0,Math.min(e.scrollHeight-e.clientHeight,n));e.scrollTo({top:r,behavior:`instant`})}_centerAllColumnsInPopoverBody(){let e=(this._popover||this).querySelector(`[data-mint-time-picker-body="true"]`);e&&Array.from(e.querySelectorAll(`.mint-time-picker-column`)).forEach(e=>this._centerSelectedInColumn(e))}_setupPopoverOpenObserver(){this._popover&&(this._popoverObserver&&=(this._popoverObserver.disconnect(),null),this._popoverObserver=new MutationObserver(()=>{this._popover?.getAttribute(`open`)===`true`&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{this._centerAllColumnsInPopoverBody()})})}),this._popoverObserver.observe(this._popover,{attributes:!0,attributeFilter:[`open`]}))}_buildPickerSet(e,t,n){let r=this.isHoursEnabled(),i=this.isMinutesEnabled(),a=this.isSecondsEnabled(),o=document.createElement(`div`),s=(r?1:0)+(i?1:0)+(a?1:0)+(r?1:0);o.className=`mint-time-picker-wheel`,o.style.gridTemplateColumns=`repeat(${Math.max(s,1)}, minmax(0, 1fr))`;let c=Array.from({length:12},(e,t)=>(t+1).toString().padStart(2,`0`)),l=Array.from({length:60},(e,t)=>t.toString().padStart(2,`0`)),u=Array.from({length:60},(e,t)=>t.toString().padStart(2,`0`)),d=[`AM`,`PM`],f=[];r&&f.push(this._buildColumn(c,t.hour.toString().padStart(2,`0`),e=>{n({...t,hour:Number(e)})},!0,`tall`,`Hour`)),i&&f.push(this._buildColumn(l,t.minute.toString().padStart(2,`0`),e=>{n({...t,minute:Number(e)})},!0,`tall`,`Minute`)),a&&f.push(this._buildColumn(u,t.second.toString().padStart(2,`0`),e=>{n({...t,second:Number(e)})},!0,`tall`,`Second`)),r&&f.push(this._buildColumn(d,t.meridiem,e=>{n({...t,meridiem:e})},!0,`tall`,`Meridiem`)),f.forEach((e,t)=>{t===f.length-1&&e.classList.remove(`mint-time-picker-column-divider`),o.appendChild(e)}),e.appendChild(o)}_buildPopoverContent(e){if(e.innerHTML=``,!this.isRange()){this._buildPickerSet(e,this._single,t=>{this._single=t,this._emitChangeFromPicker(),this._buildPopoverContent(e)}),requestAnimationFrame(()=>this._centerAllColumnsInPopoverBody());return}let t=document.createElement(`div`);t.className=`mint-time-picker-range`;let n=document.createElement(`div`),r=document.createElement(`mint-text`);r.setAttribute(`variant`,`muted`),r.className=`mint-time-picker-range-label`,r.textContent=`Start`,n.appendChild(r),this._buildPickerSet(n,this._rangeStart,t=>{this._rangeStart=t,this._emitChangeFromPicker(),this._buildPopoverContent(e)});let i=document.createElement(`div`),a=document.createElement(`mint-text`);a.setAttribute(`variant`,`muted`),a.className=`mint-time-picker-range-label`,a.textContent=`End`,i.appendChild(a),this._buildPickerSet(i,this._rangeEnd,t=>{this._rangeEnd=t,this._emitChangeFromPicker(),this._buildPopoverContent(e)}),t.appendChild(n),t.appendChild(i),e.appendChild(t),requestAnimationFrame(()=>{this._centerAllColumnsInPopoverBody()})}render(){let e=this.isDisabled(),t=this.isReadonly(),n=this._getEffectiveError();this._collectAdornmentNodes(),this._triggerClickObserver&&=(document.removeEventListener(`click`,this._triggerClickObserver,!0),null),this.innerHTML=``;let r=document.createElement(`div`);r.className=`mint-time-picker-control`;let i=this.getAttribute(`inline`)===`true`;i||(this._inputEl=document.createElement(`mint-input`),this._inputEl.id=this._triggerId,this._inputEl.classList.add(`mint-time-picker-trigger`),this._inputEl.setAttribute(`type`,`text`),this._inputEl.setAttribute(`icon`,`clock`),this._inputEl.setAttribute(`placeholder`,this._getExpectedFormat()),this._inputEl.setAttribute(`label`,this.getLabel()),this._inputEl.setAttribute(`info`,this.getInfo()),this._inputEl.setAttribute(`value`,this._getDisplayValue()),this._inputEl.setAttribute(`error`,n.hasError?`true`:`false`),this._inputEl.setAttribute(`error-message`,n.message||``),this._prependSlotNodes.forEach(e=>this._inputEl.appendChild(e)),this._appendSlotNodes.forEach(e=>this._inputEl.appendChild(e)),e&&this._inputEl.setAttribute(`disabled`,`true`),t&&this._inputEl.setAttribute(`readonly`,`true`),this._inputEl.addEventListener(`change`,n=>{if(e||t)return;let r=n.target;this._handleTypedValue((r?.value||``).toString())}),this._inputEl.addEventListener(`blur`,n=>{if(e||t)return;let r=n.target;this._handleTypedValue((r?.value||``).toString())},!0),r.appendChild(this._inputEl)),this._hiddenInput=document.createElement(`input`),this._hiddenInput.type=`hidden`,this._hiddenInput.name=this.getName(),this._hiddenInput.required=this.isRequired(),r.appendChild(this._hiddenInput),this._syncHiddenInput();let a=document.createElement(`div`);if(a.setAttribute(`data-mint-time-picker-body`,`true`),a.className=`mint-time-picker-popover`,this._buildPopoverContent(a),i?(this._popover=null,r.appendChild(a),requestAnimationFrame(()=>this._centerAllColumnsInPopoverBody())):(this._popover=document.createElement(`mint-popover`),this._popover.setAttribute(`trigger-id`,this._triggerId),this._popover.setAttribute(`direction`,`down`),this._popover.setAttribute(`padding`,`0`),this._popover.setAttribute(`distance`,`6px`),(e||t)&&this._popover.setAttribute(`open`,`false`),this._popover.appendChild(a),r.appendChild(this._popover),this._setupPopoverOpenObserver()),this.appendChild(r),!i&&this._inputEl){let e=this._inputEl;this._triggerClickObserver=t=>{t.composedPath().includes(e)&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{this._popover?.getAttribute(`open`)===`true`&&this._centerAllColumnsInPopoverBody()})})},document.addEventListener(`click`,this._triggerClickObserver,!0)}}_collectAdornmentNodes(){let e=[...this._prependSlotNodes,...this._appendSlotNodes,...Array.from(this.querySelectorAll(`[slot="prepend"], [slot="append"]`))];this._prependSlotNodes=e.filter(e=>e.getAttribute(`slot`)===`prepend`),this._appendSlotNodes=e.filter(e=>e.getAttribute(`slot`)===`append`)}};customElements.get(`mint-time-picker`)||e.t(`mint-time-picker`,t),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return t}});
|
|
1
|
+
require(`./icon-pgeP1zxb.js`);const e=require(`./register-element-tCL_F1YI.js`);require(`./text-CfvRRKGZ.js`),require(`./input-DJaqPjMg.js`),require(`./popover-N3cKN8iW.js`);var t=class extends HTMLElement{constructor(...e){super(...e),this._triggerId=`mint-time-picker-trigger-${Math.random().toString(36).slice(2,10)}`,this._popover=null,this._popoverObserver=null,this._triggerClickObserver=null,this._inputEl=null,this._hiddenInput=null,this._prependSlotNodes=[],this._appendSlotNodes=[],this._slotObserver=null,this._single={hour:9,minute:0,second:0,meridiem:`AM`},this._rangeStart={hour:9,minute:0,second:0,meridiem:`AM`},this._rangeEnd={hour:5,minute:0,second:0,meridiem:`PM`},this._invalidFromInput=!1}static get observedAttributes(){return[`value`,`inline`,`label`,`info`,`disabled`,`id`,`name`,`required`,`readonly`,`range`,`hours`,`minutes`,`seconds`,`error`,`error-message`]}connectedCallback(){this.classList.add(`mint-time-picker-host`),this._parseAndApplyValue(this.getAttribute(`value`)||``),this.render(),this._slotObserver=new MutationObserver(e=>{e.some(e=>e.type===`attributes`&&e.target.hasAttribute(`slot`)||e.type===`childList`&&e.target===this&&Array.from(e.addedNodes).some(e=>e instanceof HTMLElement&&(e.slot===`prepend`||e.slot===`append`)))&&this.render()}),this._slotObserver.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`slot`]})}disconnectedCallback(){this._slotObserver?.disconnect(),this._slotObserver=null,this._popoverObserver&&=(this._popoverObserver.disconnect(),null),this._triggerClickObserver&&=(document.removeEventListener(`click`,this._triggerClickObserver,!0),null)}attributeChangedCallback(e,t,n){if(t!==n){if(e===`value`){this._parseAndApplyValue(n||``),this._syncHiddenInput(),this._syncInputValue();{let e=(this._popover||this).querySelector(`[data-mint-time-picker-body="true"]`);e&&this._buildPopoverContent(e)}return}e!==`error`&&e!==`error-message`&&(this._invalidFromInput=!1),this.render()}}get value(){return this.getValue()}set value(e){this.setValue(e||``)}getValue(){return this.getAttribute(`value`)||``}setValue(e){e?this.setAttribute(`value`,e):this.removeAttribute(`value`),this._parseAndApplyValue(e||``),this._syncHiddenInput(),this._syncInputValue()}isRange(){return this.getAttribute(`range`)===`true`}isHoursEnabled(){let e=this.getAttribute(`hours`);return e===null?!0:e!==`false`}isMinutesEnabled(){let e=this.getAttribute(`minutes`);return e===null?!0:e!==`false`}isSecondsEnabled(){let e=this.getAttribute(`seconds`);return e===null?!1:e!==`false`}isDisabled(){return this.getAttribute(`disabled`)===`true`}isReadonly(){return this.getAttribute(`readonly`)===`true`}isRequired(){return this.getAttribute(`required`)===`true`}hasExternalError(){return this.getAttribute(`error`)===`true`}getExternalErrorMessage(){return this.getAttribute(`error-message`)||``}getLabel(){return this.getAttribute(`label`)||``}getInfo(){return this.getAttribute(`info`)||``}getName(){return this.getAttribute(`name`)||``}_getEffectiveError(){return{hasError:this.hasExternalError(),message:this.getExternalErrorMessage()}}_formatParts(e){let t=this.isHoursEnabled(),n=this.isMinutesEnabled(),r=this.isSecondsEnabled(),i=[];return t&&i.push(e.hour.toString()),n&&i.push(e.minute.toString().padStart(2,`0`)),r&&i.push(e.second.toString().padStart(2,`0`)),t?`${i.join(`:`)} ${e.meridiem.toLowerCase()}`:i.join(`:`)}_to24Hour(e){let t=e.hour%12;return e.meridiem===`PM`&&(t+=12),{hour:t,minute:e.minute,second:e.second}}_formatParts24(e){let t=this.isHoursEnabled(),n=this.isMinutesEnabled(),r=this.isSecondsEnabled(),i=this._to24Hour(e),a=[];return t&&a.push(i.hour.toString().padStart(2,`0`)),n&&a.push(i.minute.toString().padStart(2,`0`)),r&&a.push(i.second.toString().padStart(2,`0`)),a.join(`:`)}_getDisplayValue(){return this.isRange()?`${this._formatParts(this._rangeStart)} - ${this._formatParts(this._rangeEnd)}`:this._formatParts(this._single)}_getOutputValue(){return this.isRange()?`${this._formatParts24(this._rangeStart)} - ${this._formatParts24(this._rangeEnd)}`:this._formatParts24(this._single)}_getExpectedFormat(){let e=this.isHoursEnabled(),t=this.isMinutesEnabled(),n=this.isSecondsEnabled(),r=[];e&&r.push(`h`),t&&r.push(`mm`),n&&r.push(`ss`);let i=e?`${r.join(`:`)} am/pm`:r.join(`:`);return this.isRange()?`${i} - ${i}`:i}_syncHiddenInput(){this._hiddenInput&&(this._hiddenInput.value=this.getValue()||this._getOutputValue())}_syncInputValue(){this._inputEl&&(this._inputEl.value=this._getDisplayValue(),typeof this._inputEl.render==`function`&&this._inputEl.render())}_emitChangeFromPicker(){let e=this._getOutputValue();this._invalidFromInput=!1,this.setAttribute(`value`,e),this._syncHiddenInput(),this._syncInputValue(),this.dispatchEvent(new Event(`input`,{bubbles:!0,composed:!0})),this.dispatchEvent(new Event(`change`,{bubbles:!0}))}_parseSingle(e){let t=this.isHoursEnabled(),n=this.isMinutesEnabled(),r=this.isSecondsEnabled(),i=e.trim();if(t){let e=i.match(/^(\d{1,2})(?::(\d{2}))?(?::(\d{2}))?\s*(am|pm)$/i);if(!e)return null;let t=Number(e[1]),a=Number(e[2]??0),o=Number(e[3]??0),s=e[4].toUpperCase();return t<1||t>12||n&&(a<0||a>59)||r&&(o<0||o>59)?null:{hour:t,minute:a,second:o,meridiem:s}}let a=i.match(/^(\d{2})(?::(\d{2}))?$/);if(!a)return null;let o=Number(a[1]),s=Number(a[2]??0);return n&&(o<0||o>59)||r&&(s<0||s>59)?null:{hour:12,minute:o,second:s,meridiem:`AM`}}_parseSingleOutput24(e){let t=this.isHoursEnabled(),n=this.isMinutesEnabled(),r=this.isSecondsEnabled(),i=e.trim();if(t){let e=i.match(/^(\d{2})(?::(\d{2}))?(?::(\d{2}))?$/);if(!e)return null;let t=Number(e[1]),a=Number(e[2]??0),o=Number(e[3]??0);if(t<0||t>23||n&&(a<0||a>59)||r&&(o<0||o>59))return null;let s=t>=12?`PM`:`AM`;return{hour:t%12==0?12:t%12,minute:a,second:o,meridiem:s}}let a=i.match(/^(\d{2})(?::(\d{2}))?$/);if(!a)return null;let o=Number(a[1]),s=Number(a[2]??0);return n&&(o<0||o>59)||r&&(s<0||s>59)?null:{hour:12,minute:o,second:s,meridiem:`AM`}}_parseAndApplyValue(e){if(!e)return!1;if(this.isRange()){let[t,n]=e.split(`-`).map(e=>e.trim()),r=this._parseSingleOutput24(t||``),i=this._parseSingleOutput24(n||``);return!r||!i?!1:(this._rangeStart=r,this._rangeEnd=i,!0)}let t=this._parseSingleOutput24(e);return t?(this._single=t,!0):!1}_parseAndApplyDisplayValue(e){if(!e)return!1;if(this.isRange()){let[t,n]=e.split(`-`).map(e=>e.trim()),r=this._parseSingle(t||``),i=this._parseSingle(n||``);return!r||!i?!1:(this._rangeStart=r,this._rangeEnd=i,!0)}let t=this._parseSingle(e);return t?(this._single=t,!0):!1}_handleTypedValue(e){let t=e.trim();if(!t){this._invalidFromInput=!1,this.removeAttribute(`value`),this._syncHiddenInput(),this._syncInputValue();return}if(!this._parseAndApplyDisplayValue(t)){this._invalidFromInput=!0,this.removeAttribute(`value`),this._inputEl&&(this._inputEl.value=``),this._syncHiddenInput(),this.render(),this.dispatchEvent(new Event(`input`,{bubbles:!0,composed:!0})),this.dispatchEvent(new Event(`change`,{bubbles:!0}));return}this._invalidFromInput=!1;let n=this._getOutputValue();this.setAttribute(`value`,n),this._syncHiddenInput(),this._syncInputValue(),this.dispatchEvent(new Event(`input`,{bubbles:!0,composed:!0})),this.dispatchEvent(new Event(`change`,{bubbles:!0}))}_buildColumn(e,t,n,r=!0,i=`standard`,a=`Time`){let o=document.createElement(`div`);return o.className=`mint-time-picker-column mint-time-picker-column-${i}${r?` mint-time-picker-column-divider`:``}`,o.setAttribute(`role`,`group`),o.setAttribute(`aria-label`,a),e.forEach(e=>{let r=document.createElement(`button`);r.type=`button`;let i=e===t;r.className=`mint-time-picker-option${i?` is-selected`:``}`,r.dataset.selected=i?`true`:`false`,r.setAttribute(`aria-pressed`,String(i)),r.setAttribute(`aria-label`,`${a}: ${e}`),r.textContent=e,r.addEventListener(`click`,()=>n(e)),o.appendChild(r)}),o}_centerSelectedInColumn(e){let t=e.querySelector(`button[data-selected="true"]`);if(!t)return;let n=t.offsetTop-e.offsetTop-(e.clientHeight/2-t.offsetHeight/2),r=Math.max(0,Math.min(e.scrollHeight-e.clientHeight,n));e.scrollTo({top:r,behavior:`instant`})}_centerAllColumnsInPopoverBody(){let e=(this._popover||this).querySelector(`[data-mint-time-picker-body="true"]`);e&&Array.from(e.querySelectorAll(`.mint-time-picker-column`)).forEach(e=>this._centerSelectedInColumn(e))}_setupPopoverOpenObserver(){this._popover&&(this._popoverObserver&&=(this._popoverObserver.disconnect(),null),this._popoverObserver=new MutationObserver(()=>{this._popover?.getAttribute(`open`)===`true`&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{this._centerAllColumnsInPopoverBody()})})}),this._popoverObserver.observe(this._popover,{attributes:!0,attributeFilter:[`open`]}))}_buildPickerSet(e,t,n){let r=this.isHoursEnabled(),i=this.isMinutesEnabled(),a=this.isSecondsEnabled(),o=document.createElement(`div`),s=(r?1:0)+(i?1:0)+(a?1:0)+(r?1:0);o.className=`mint-time-picker-wheel`,o.style.gridTemplateColumns=`repeat(${Math.max(s,1)}, minmax(0, 1fr))`;let c=Array.from({length:12},(e,t)=>(t+1).toString().padStart(2,`0`)),l=Array.from({length:60},(e,t)=>t.toString().padStart(2,`0`)),u=Array.from({length:60},(e,t)=>t.toString().padStart(2,`0`)),d=[`AM`,`PM`],f=[];r&&f.push(this._buildColumn(c,t.hour.toString().padStart(2,`0`),e=>{n({...t,hour:Number(e)})},!0,`tall`,`Hour`)),i&&f.push(this._buildColumn(l,t.minute.toString().padStart(2,`0`),e=>{n({...t,minute:Number(e)})},!0,`tall`,`Minute`)),a&&f.push(this._buildColumn(u,t.second.toString().padStart(2,`0`),e=>{n({...t,second:Number(e)})},!0,`tall`,`Second`)),r&&f.push(this._buildColumn(d,t.meridiem,e=>{n({...t,meridiem:e})},!0,`tall`,`Meridiem`)),f.forEach((e,t)=>{t===f.length-1&&e.classList.remove(`mint-time-picker-column-divider`),o.appendChild(e)}),e.appendChild(o)}_buildPopoverContent(e){if(e.innerHTML=``,!this.isRange()){this._buildPickerSet(e,this._single,t=>{this._single=t,this._emitChangeFromPicker(),this._buildPopoverContent(e)}),requestAnimationFrame(()=>this._centerAllColumnsInPopoverBody());return}let t=document.createElement(`div`);t.className=`mint-time-picker-range`;let n=document.createElement(`div`),r=document.createElement(`mint-text`);r.setAttribute(`variant`,`muted`),r.className=`mint-time-picker-range-label`,r.textContent=`Start`,n.appendChild(r),this._buildPickerSet(n,this._rangeStart,t=>{this._rangeStart=t,this._emitChangeFromPicker(),this._buildPopoverContent(e)});let i=document.createElement(`div`),a=document.createElement(`mint-text`);a.setAttribute(`variant`,`muted`),a.className=`mint-time-picker-range-label`,a.textContent=`End`,i.appendChild(a),this._buildPickerSet(i,this._rangeEnd,t=>{this._rangeEnd=t,this._emitChangeFromPicker(),this._buildPopoverContent(e)}),t.appendChild(n),t.appendChild(i),e.appendChild(t),requestAnimationFrame(()=>{this._centerAllColumnsInPopoverBody()})}render(){let e=this.isDisabled(),t=this.isReadonly(),n=this._getEffectiveError();this._collectAdornmentNodes(),this._triggerClickObserver&&=(document.removeEventListener(`click`,this._triggerClickObserver,!0),null),this.innerHTML=``;let r=document.createElement(`div`);r.className=`mint-time-picker-control`;let i=this.getAttribute(`inline`)===`true`;i||(this._inputEl=document.createElement(`mint-input`),this._inputEl.id=this._triggerId,this._inputEl.classList.add(`mint-time-picker-trigger`),this._inputEl.setAttribute(`type`,`text`),this._inputEl.setAttribute(`icon`,`clock`),this._inputEl.setAttribute(`placeholder`,this._getExpectedFormat()),this._inputEl.setAttribute(`label`,this.getLabel()),this._inputEl.setAttribute(`info`,this.getInfo()),this._inputEl.setAttribute(`value`,this._getDisplayValue()),this._inputEl.setAttribute(`error`,n.hasError?`true`:`false`),this._inputEl.setAttribute(`error-message`,n.message||``),this._prependSlotNodes.forEach(e=>this._inputEl.appendChild(e)),this._appendSlotNodes.forEach(e=>this._inputEl.appendChild(e)),e&&this._inputEl.setAttribute(`disabled`,`true`),t&&this._inputEl.setAttribute(`readonly`,`true`),this._inputEl.addEventListener(`change`,n=>{if(e||t)return;let r=n.target;this._handleTypedValue((r?.value||``).toString())}),this._inputEl.addEventListener(`blur`,n=>{if(e||t)return;let r=n.target;this._handleTypedValue((r?.value||``).toString())},!0),r.appendChild(this._inputEl)),this._hiddenInput=document.createElement(`input`),this._hiddenInput.type=`hidden`,this._hiddenInput.name=this.getName(),this._hiddenInput.required=this.isRequired(),r.appendChild(this._hiddenInput),this._syncHiddenInput();let a=document.createElement(`div`);if(a.setAttribute(`data-mint-time-picker-body`,`true`),a.className=`mint-time-picker-popover`,this._buildPopoverContent(a),i?(this._popover=null,r.appendChild(a),requestAnimationFrame(()=>this._centerAllColumnsInPopoverBody())):(this._popover=document.createElement(`mint-popover`),this._popover.setAttribute(`trigger-id`,this._triggerId),this._popover.setAttribute(`direction`,`down`),this._popover.setAttribute(`padding`,`0`),this._popover.setAttribute(`distance`,`6px`),(e||t)&&this._popover.setAttribute(`open`,`false`),this._popover.appendChild(a),r.appendChild(this._popover),this._setupPopoverOpenObserver()),this.appendChild(r),!i&&this._inputEl){let e=this._inputEl;this._triggerClickObserver=t=>{t.composedPath().includes(e)&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{this._popover?.getAttribute(`open`)===`true`&&this._centerAllColumnsInPopoverBody()})})},document.addEventListener(`click`,this._triggerClickObserver,!0)}}_collectAdornmentNodes(){let e=[...this._prependSlotNodes,...this._appendSlotNodes,...Array.from(this.querySelectorAll(`[slot="prepend"], [slot="append"]`))];this._prependSlotNodes=e.filter(e=>e.getAttribute(`slot`)===`prepend`),this._appendSlotNodes=e.filter(e=>e.getAttribute(`slot`)===`append`)}};customElements.get(`mint-time-picker`)||e.t(`mint-time-picker`,t),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return t}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`./icon-
|
|
1
|
+
require(`./icon-pgeP1zxb.js`).a({name:`warning`,viewBox:`0 0 24 24`,path:`M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z`,strokeLinecap:`round`,strokeLinejoin:`round`});
|
|
@@ -18,5 +18,5 @@ __mintLoadStyle('icon', '../../icon.css')
|
|
|
18
18
|
__mintLoadStyle('text', '../../text.css')
|
|
19
19
|
__mintLoadStyle('stack', '../../stack.css')
|
|
20
20
|
__mintLoadStyle('confirm-action', '../../confirm-action.css')
|
|
21
|
-
import { n as e, t } from "../chunks/confirm-action-
|
|
21
|
+
import { n as e, t } from "../chunks/confirm-action-C0XX_TyJ.js";
|
|
22
22
|
export { t as confirm, e as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require(`../chunks/confirm-action-
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require(`../chunks/confirm-action-8Yx0K5j1.js`);exports.confirm=e.t,exports.default=e.n;
|
|
@@ -6,5 +6,5 @@ import '../../icon.css'
|
|
|
6
6
|
import '../../text.css'
|
|
7
7
|
import '../../stack.css'
|
|
8
8
|
import '../../confirm-action.css'
|
|
9
|
-
import { n as e, t } from "../chunks/confirm-action-
|
|
9
|
+
import { n as e, t } from "../chunks/confirm-action-C0XX_TyJ.js";
|
|
10
10
|
export { t as confirm, e as default };
|
|
@@ -16,5 +16,5 @@ __mintLoadStyle('icon', '../../icon.css')
|
|
|
16
16
|
__mintLoadStyle('popover', '../../popover.css')
|
|
17
17
|
__mintLoadStyle('stack', '../../stack.css')
|
|
18
18
|
__mintLoadStyle('date-picker', '../../date-picker.css')
|
|
19
|
-
import { t as e } from "../chunks/date-picker-
|
|
19
|
+
import { t as e } from "../chunks/date-picker-BuJJ8gvT.js";
|
|
20
20
|
export { e as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../chunks/date-picker-
|
|
1
|
+
const e=require(`../chunks/date-picker-BJ_82oRR.js`);module.exports=e.t;
|
|
@@ -19,11 +19,11 @@ __mintLoadStyle('stack', '../../stack.css')
|
|
|
19
19
|
__mintLoadStyle('time-picker', '../../time-picker.css')
|
|
20
20
|
__mintLoadStyle('text', '../../text.css')
|
|
21
21
|
__mintLoadStyle('datetime-picker', '../../datetime-picker.css')
|
|
22
|
-
import "../chunks/icon-
|
|
22
|
+
import "../chunks/icon-CuRTWM4k.js";
|
|
23
23
|
import { t as e } from "../chunks/register-element-BFYmIynH.js";
|
|
24
24
|
import "../chunks/text-C-6UCBp-.js";
|
|
25
|
-
import "../chunks/date-picker-
|
|
26
|
-
import "../chunks/time-picker-
|
|
25
|
+
import "../chunks/date-picker-BuJJ8gvT.js";
|
|
26
|
+
import "../chunks/time-picker-Bl8KsaJj.js";
|
|
27
27
|
//#region src/components/datetime-picker/DateTimePicker.ts
|
|
28
28
|
var t = class extends HTMLElement {
|
|
29
29
|
constructor(...e) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../chunks/icon-Bv1J3LwC.js`);const e=require(`../chunks/register-element-tCL_F1YI.js`);require(`../chunks/text-CfvRRKGZ.js`),require(`../chunks/date-picker-R8J7EzuF.js`),require(`../chunks/time-picker-QzH9kywR.js`);var t=class extends HTMLElement{constructor(...e){super(...e),this._datePicker=null,this._timePicker=null,this._content=null,this._popoverContent=null,this._popoverObserver=null,this._hiddenInput=null,this._dateValue=``,this._timeValue=``,this._dateStageComplete=!1,this._ready=!1,this._writingValue=!1,this._displayControlBound=!1,this._prependSlotNodes=[],this._appendSlotNodes=[],this._slotObserver=null}static get observedAttributes(){return[`value`,`label`,`info`,`name`,`required`,`disabled`,`readonly`,`format`,`display-format`,`min`,`max`,`shortcuts`,`hours`,`minutes`,`seconds`,`error`,`error-message`]}connectedCallback(){this.classList.add(`mint-datetime-picker`),this._readValue(this.getAttribute(`value`)||``),this.render(),this._ready=!0,this._slotObserver=new MutationObserver(e=>{e.some(e=>e.type===`attributes`&&e.target.hasAttribute(`slot`)||e.type===`childList`&&e.target===this&&Array.from(e.addedNodes).some(e=>e instanceof HTMLElement&&(e.slot===`prepend`||e.slot===`append`)))&&this.render()}),this._slotObserver.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`slot`]})}attributeChangedCallback(e,t,n){if(!(t===n||!this._ready||e===`value`&&this._writingValue)){if(e===`value`){this._readValue(n||``),this.render();return}if(e===`error`||e===`error-message`){this._syncState();return}this.render()}}get value(){return this.getAttribute(`value`)||``}set value(e){this.setValue(e||``)}getValue(){return this.getAttribute(`value`)||``}setValue(e){this._readValue(e),this._writingValue=!0,e?this.setAttribute(`value`,e):this.removeAttribute(`value`),this._writingValue=!1,this.render(),this._syncState()}_parseDate(e,t){let n=e.match(/^(\d{4})-(\d{2})-(\d{2})/);if(n)return new Date(Number(n[1]),Number(n[2])-1,Number(n[3]));let r={yyyy:`(\\d{4})`,yy:`(\\d{2})`,Y:`(\\d{4})`,y:`(\\d{2})`,mm:`(\\d{1,2})`,m:`(\\d{1,2})`,n:`(\\d{1,2})`,dd:`(\\d{1,2})`,d:`(\\d{1,2})`,j:`(\\d{1,2})`,M:`([A-Za-z]+)`,F:`([A-Za-z]+)`},i=Object.keys(r).sort((e,t)=>t.length-e.length),a=[],o=`^`;for(let e=0;e<t.length;){let n=i.find(n=>t.startsWith(n,e));n?(o+=r[n],a.push(n),e+=n.length):(o+=t[e].replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),e++)}let s=e.match(RegExp(`${o}$`,`i`));if(!s)return null;let c=2e3,l=1,u=1;a.forEach((e,t)=>{let n=s[t+1];if(e===`Y`||e===`yyyy`)c=Number(n);else if(e===`y`||e===`yy`)c=Number(n)+2e3;else if(e===`m`||e===`mm`||e===`n`)l=Number(n);else if(e===`d`||e===`dd`||e===`j`)u=Number(n);else if(e===`M`||e===`F`){let e=new Date(`${n} 1, 2000`).getMonth();Number.isNaN(e)||(l=e+1)}});let d=new Date(c,l-1,u);return d.getFullYear()===c&&d.getMonth()===l-1&&d.getDate()===u?d:null}_formatDate(e,t){let n=e=>String(e).padStart(2,`0`),r={Y:String(e.getFullYear()),yyyy:String(e.getFullYear()),yy:String(e.getFullYear()).slice(-2),y:String(e.getFullYear()).slice(-2),mm:n(e.getMonth()+1),m:n(e.getMonth()+1),n:String(e.getMonth()+1),dd:n(e.getDate()),d:n(e.getDate()),j:String(e.getDate()),M:e.toLocaleString(void 0,{month:`short`}),F:e.toLocaleString(void 0,{month:`long`})};return t.replace(/yyyy|yy|mm|dd|Y|y|m|n|d|j|M|F/g,e=>r[e])}_readValue(e){let[t=``,n=``]=e.split(/[T ]/),r=this._parseDate(t,this.getAttribute(`format`)||`mm/dd/yyyy`);this._dateValue=r?this._formatDate(r,this.getAttribute(`format`)||`mm/dd/yyyy`):``,this._timeValue=n||``,this._dateStageComplete=!!r}_toISODate(){let e=this._parseDate(this._dateValue,this.getAttribute(`format`)||`mm/dd/yyyy`);return e?`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`:``}_syncValue(e=!1){let t=this._toISODate(),n=this._timeValue,r=t&&n?`${t}T${n}`:``;this._writingValue=!0,r?this.setAttribute(`value`,r):this.removeAttribute(`value`),this._writingValue=!1,this._hiddenInput&&(this._hiddenInput.value=r),e&&r&&(this.dispatchEvent(new Event(`input`,{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`change`,{detail:{value:r},bubbles:!0,composed:!0})))}_syncState(){this._datePicker&&(this._datePicker.setAttribute(`value`,this._dateValue),this._datePicker.setAttribute(`error`,this.getAttribute(`error`)||`false`),this._datePicker.setAttribute(`error-message`,this.getAttribute(`error-message`)||``),this._timePicker?.setAttribute(`error`,this.getAttribute(`error`)||`false`),this._timePicker?.setAttribute(`error-message`,this.getAttribute(`error-message`)||``),this._hiddenInput&&(this._hiddenInput.value=this.getValue()),this._syncCombinedDisplay())}render(){let e=this.getAttribute(`label`)||``,t=this.getAttribute(`info`)||``,n=this.getAttribute(`format`)||`mm/dd/yyyy`,r=this.getAttribute(`disabled`)===`true`,i=this.getAttribute(`readonly`)===`true`;this._collectAdornmentNodes(),this._displayControlBound=!1;let a=document.createElement(`mint-date-picker`);a.setAttribute(`class`,`mint-datetime-picker-date`),a.setAttribute(`keep-open-on-select`,`true`),a.setAttribute(`format`,n),a.setAttribute(`value`,this._dateValue),a.setAttribute(`label`,e),a.setAttribute(`info`,t),a.setAttribute(`display-format`,this.getAttribute(`display-format`)||`F j, Y`);for(let e of[`min`,`max`,`shortcuts`])this.hasAttribute(e)&&a.setAttribute(e,this.getAttribute(e)||``);r&&a.setAttribute(`disabled`,`true`),i&&a.setAttribute(`readonly`,`true`),this.hasAttribute(`required`)&&a.setAttribute(`required`,this.getAttribute(`required`)||`true`),this.hasAttribute(`error`)&&a.setAttribute(`error`,this.getAttribute(`error`)||`false`),this.hasAttribute(`error-message`)&&a.setAttribute(`error-message`,this.getAttribute(`error-message`)||``),this._prependSlotNodes.forEach(e=>a.appendChild(e)),this._appendSlotNodes.forEach(e=>a.appendChild(e)),a.addEventListener(`change`,e=>{e.stopPropagation();let t=e.detail?.value||a.value||``;this._parseDate(t,n)&&(this._dateValue=t,this._dateStageComplete=!0,this._syncValue(!1),this._syncCombinedDisplay(),this._openTimeStage())}),this._datePicker=a,this._bindCombinedDisplayControl();let o=document.createElement(`div`);o.className=`mint-datetime-picker-content`,this._content=o,this.innerHTML=``,this.appendChild(o),o.appendChild(a),this._hiddenInput=document.createElement(`input`),this._hiddenInput.type=`hidden`,this._hiddenInput.name=this.getAttribute(`name`)||``,this._hiddenInput.value=this.getValue(),this.appendChild(this._hiddenInput),this._waitForPopover()}_collectAdornmentNodes(){let e=[...this._prependSlotNodes,...this._appendSlotNodes,...Array.from(this.querySelectorAll(`[slot="prepend"], [slot="append"]`))];this._prependSlotNodes=e.filter(e=>e.getAttribute(`slot`)===`prepend`),this._appendSlotNodes=e.filter(e=>e.getAttribute(`slot`)===`append`)}_getPopover(){let e=this._datePicker,t=e?.getPopoverElement?.()||e?._popover;if(t)return t;let n=e?.querySelector?.(`.mint-date-picker-icon-button`)?.id;return n?document.querySelector(`mint-popover[trigger-id="${CSS.escape(n)}"]`):null}_getPopoverContent(e){return e.querySelector(`.popover-content`)||e}_waitForPopover(e=0){let t=this._getPopover();if(!t){e<120&&requestAnimationFrame(()=>this._waitForPopover(e+1));return}if(this._popoverContent=this._datePicker?.getPopoverContentElement?.()||this._getPopoverContent(t),this._bindCombinedDisplayControl(),this._syncCombinedDisplay(),this._popoverObserver?.disconnect(),this._popoverObserver=new MutationObserver(()=>{if(t.getAttribute(`open`)===`true`){let e=this._datePicker;typeof e?.refreshCalendar==`function`?e.refreshCalendar():e?._buildCalendar?.()}}),this._popoverObserver.observe(t,{attributes:!0,attributeFilter:[`open`]}),t.getAttribute(`open`)===`true`){let e=this._datePicker;typeof e?.refreshCalendar==`function`?e.refreshCalendar():e?._buildCalendar?.()}}_bindCombinedDisplayControl(){if(this._displayControlBound||!this._datePicker)return;this._displayControlBound=!0;let e=e=>{if(!e.target?.closest(`.mint-date-picker-field`)||this.getAttribute(`disabled`)===`true`||this.getAttribute(`readonly`)===`true`||e instanceof KeyboardEvent&&e.key!==`Enter`&&e.key!==` `)return;e.preventDefault(),e.stopImmediatePropagation();let t=this._getPopover();t?.open?t.open():t?.setAttribute(`open`,`true`)};this._datePicker.addEventListener(`click`,e,!0),this._datePicker.addEventListener(`keydown`,e,!0)}_openTimeStage(){queueMicrotask(()=>{let e=this._getPopover();if(e?.getAttribute(`open`)!==`true`){typeof e?.open==`function`?e.open():e?.setAttribute(`open`,`true`),requestAnimationFrame(()=>this._renderTimeStage());return}this._renderTimeStage()})}_renderTimeStage(){if(!this._popoverContent||!this._dateStageComplete)return;let e=document.createElement(`div`);e.className=`mint-datetime-picker-panel`;let t=document.createElement(`button`);t.type=`button`,t.className=`mint-datetime-picker-time-heading`,t.setAttribute(`aria-label`,`Change date, ${this._dateValue}`),t.textContent=this._getFormattedDate(),t.addEventListener(`click`,()=>{let e=this._datePicker;typeof e?.refreshCalendar==`function`?e.refreshCalendar():e?._buildCalendar?.()});let n=document.createElement(`mint-time-picker`),r=this.getAttribute(`disabled`)===`true`,i=this.getAttribute(`readonly`)===`true`;n.setAttribute(`inline`,`true`),n.setAttribute(`value`,this._timeValue||`09:00`),n.setAttribute(`label`,``);for(let e of[`hours`,`minutes`,`seconds`])this.hasAttribute(e)&&n.setAttribute(e,this.getAttribute(e)||``);r&&n.setAttribute(`disabled`,`true`),i&&n.setAttribute(`readonly`,`true`),n.addEventListener(`change`,()=>{this._timeValue=n.getValue?.()||n.getAttribute(`value`)||``,this._syncValue(!0),this._syncCombinedDisplay()}),n.addEventListener(`change`,e=>e.stopPropagation()),n.addEventListener(`input`,e=>e.stopPropagation()),this._timePicker=n,e.appendChild(t),e.appendChild(n),this._popoverContent.replaceChildren(e)}_syncCombinedDisplay(){let e=this._datePicker?.getDisplayElement?.()||this._datePicker?.querySelector(`.mint-date-picker-display`);if(!e||!this._dateValue)return;let t=this._getFormattedDate();e.textContent=this._timeValue?`${t} · ${this._formatTime(this._timeValue)}`:t,e.setAttribute(`aria-label`,`${this.getAttribute(`label`)||`Date and time`}: ${e.textContent}`)}_getFormattedDate(){let e=this._parseDate(this._dateValue,this.getAttribute(`format`)||`mm/dd/yyyy`);return e?this._formatDate(e,this.getAttribute(`display-format`)||`F j, Y`):this._dateValue}_formatTime(e){let[t=`00`,n=`00`,r]=e.split(`:`),i=Number(t),a=this.getAttribute(`hours`)!==`false`,o=this.getAttribute(`minutes`)!==`false`,s=this.getAttribute(`seconds`)===`true`;if(!a)return[o?n:``,s?r||`00`:``].filter(Boolean).join(`:`);let c=i%12||12;return`${[String(c),o?n:``,s?r||`00`:``].filter(Boolean).join(`:`)} ${i>=12?`pm`:`am`}`}};customElements.get(`mint-datetime-picker`)||e.t(`mint-datetime-picker`,t),module.exports=t;
|
|
1
|
+
require(`../chunks/icon-pgeP1zxb.js`);const e=require(`../chunks/register-element-tCL_F1YI.js`);require(`../chunks/text-CfvRRKGZ.js`),require(`../chunks/date-picker-BJ_82oRR.js`),require(`../chunks/time-picker-D74vZTpL.js`);var t=class extends HTMLElement{constructor(...e){super(...e),this._datePicker=null,this._timePicker=null,this._content=null,this._popoverContent=null,this._popoverObserver=null,this._hiddenInput=null,this._dateValue=``,this._timeValue=``,this._dateStageComplete=!1,this._ready=!1,this._writingValue=!1,this._displayControlBound=!1,this._prependSlotNodes=[],this._appendSlotNodes=[],this._slotObserver=null}static get observedAttributes(){return[`value`,`label`,`info`,`name`,`required`,`disabled`,`readonly`,`format`,`display-format`,`min`,`max`,`shortcuts`,`hours`,`minutes`,`seconds`,`error`,`error-message`]}connectedCallback(){this.classList.add(`mint-datetime-picker`),this._readValue(this.getAttribute(`value`)||``),this.render(),this._ready=!0,this._slotObserver=new MutationObserver(e=>{e.some(e=>e.type===`attributes`&&e.target.hasAttribute(`slot`)||e.type===`childList`&&e.target===this&&Array.from(e.addedNodes).some(e=>e instanceof HTMLElement&&(e.slot===`prepend`||e.slot===`append`)))&&this.render()}),this._slotObserver.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`slot`]})}attributeChangedCallback(e,t,n){if(!(t===n||!this._ready||e===`value`&&this._writingValue)){if(e===`value`){this._readValue(n||``),this.render();return}if(e===`error`||e===`error-message`){this._syncState();return}this.render()}}get value(){return this.getAttribute(`value`)||``}set value(e){this.setValue(e||``)}getValue(){return this.getAttribute(`value`)||``}setValue(e){this._readValue(e),this._writingValue=!0,e?this.setAttribute(`value`,e):this.removeAttribute(`value`),this._writingValue=!1,this.render(),this._syncState()}_parseDate(e,t){let n=e.match(/^(\d{4})-(\d{2})-(\d{2})/);if(n)return new Date(Number(n[1]),Number(n[2])-1,Number(n[3]));let r={yyyy:`(\\d{4})`,yy:`(\\d{2})`,Y:`(\\d{4})`,y:`(\\d{2})`,mm:`(\\d{1,2})`,m:`(\\d{1,2})`,n:`(\\d{1,2})`,dd:`(\\d{1,2})`,d:`(\\d{1,2})`,j:`(\\d{1,2})`,M:`([A-Za-z]+)`,F:`([A-Za-z]+)`},i=Object.keys(r).sort((e,t)=>t.length-e.length),a=[],o=`^`;for(let e=0;e<t.length;){let n=i.find(n=>t.startsWith(n,e));n?(o+=r[n],a.push(n),e+=n.length):(o+=t[e].replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),e++)}let s=e.match(RegExp(`${o}$`,`i`));if(!s)return null;let c=2e3,l=1,u=1;a.forEach((e,t)=>{let n=s[t+1];if(e===`Y`||e===`yyyy`)c=Number(n);else if(e===`y`||e===`yy`)c=Number(n)+2e3;else if(e===`m`||e===`mm`||e===`n`)l=Number(n);else if(e===`d`||e===`dd`||e===`j`)u=Number(n);else if(e===`M`||e===`F`){let e=new Date(`${n} 1, 2000`).getMonth();Number.isNaN(e)||(l=e+1)}});let d=new Date(c,l-1,u);return d.getFullYear()===c&&d.getMonth()===l-1&&d.getDate()===u?d:null}_formatDate(e,t){let n=e=>String(e).padStart(2,`0`),r={Y:String(e.getFullYear()),yyyy:String(e.getFullYear()),yy:String(e.getFullYear()).slice(-2),y:String(e.getFullYear()).slice(-2),mm:n(e.getMonth()+1),m:n(e.getMonth()+1),n:String(e.getMonth()+1),dd:n(e.getDate()),d:n(e.getDate()),j:String(e.getDate()),M:e.toLocaleString(void 0,{month:`short`}),F:e.toLocaleString(void 0,{month:`long`})};return t.replace(/yyyy|yy|mm|dd|Y|y|m|n|d|j|M|F/g,e=>r[e])}_readValue(e){let[t=``,n=``]=e.split(/[T ]/),r=this._parseDate(t,this.getAttribute(`format`)||`mm/dd/yyyy`);this._dateValue=r?this._formatDate(r,this.getAttribute(`format`)||`mm/dd/yyyy`):``,this._timeValue=n||``,this._dateStageComplete=!!r}_toISODate(){let e=this._parseDate(this._dateValue,this.getAttribute(`format`)||`mm/dd/yyyy`);return e?`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`:``}_syncValue(e=!1){let t=this._toISODate(),n=this._timeValue,r=t&&n?`${t}T${n}`:``;this._writingValue=!0,r?this.setAttribute(`value`,r):this.removeAttribute(`value`),this._writingValue=!1,this._hiddenInput&&(this._hiddenInput.value=r),e&&r&&(this.dispatchEvent(new Event(`input`,{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`change`,{detail:{value:r},bubbles:!0,composed:!0})))}_syncState(){this._datePicker&&(this._datePicker.setAttribute(`value`,this._dateValue),this._datePicker.setAttribute(`error`,this.getAttribute(`error`)||`false`),this._datePicker.setAttribute(`error-message`,this.getAttribute(`error-message`)||``),this._timePicker?.setAttribute(`error`,this.getAttribute(`error`)||`false`),this._timePicker?.setAttribute(`error-message`,this.getAttribute(`error-message`)||``),this._hiddenInput&&(this._hiddenInput.value=this.getValue()),this._syncCombinedDisplay())}render(){let e=this.getAttribute(`label`)||``,t=this.getAttribute(`info`)||``,n=this.getAttribute(`format`)||`mm/dd/yyyy`,r=this.getAttribute(`disabled`)===`true`,i=this.getAttribute(`readonly`)===`true`;this._collectAdornmentNodes(),this._displayControlBound=!1;let a=document.createElement(`mint-date-picker`);a.setAttribute(`class`,`mint-datetime-picker-date`),a.setAttribute(`keep-open-on-select`,`true`),a.setAttribute(`format`,n),a.setAttribute(`value`,this._dateValue),a.setAttribute(`label`,e),a.setAttribute(`info`,t),a.setAttribute(`display-format`,this.getAttribute(`display-format`)||`F j, Y`);for(let e of[`min`,`max`,`shortcuts`])this.hasAttribute(e)&&a.setAttribute(e,this.getAttribute(e)||``);r&&a.setAttribute(`disabled`,`true`),i&&a.setAttribute(`readonly`,`true`),this.hasAttribute(`required`)&&a.setAttribute(`required`,this.getAttribute(`required`)||`true`),this.hasAttribute(`error`)&&a.setAttribute(`error`,this.getAttribute(`error`)||`false`),this.hasAttribute(`error-message`)&&a.setAttribute(`error-message`,this.getAttribute(`error-message`)||``),this._prependSlotNodes.forEach(e=>a.appendChild(e)),this._appendSlotNodes.forEach(e=>a.appendChild(e)),a.addEventListener(`change`,e=>{e.stopPropagation();let t=e.detail?.value||a.value||``;this._parseDate(t,n)&&(this._dateValue=t,this._dateStageComplete=!0,this._syncValue(!1),this._syncCombinedDisplay(),this._openTimeStage())}),this._datePicker=a,this._bindCombinedDisplayControl();let o=document.createElement(`div`);o.className=`mint-datetime-picker-content`,this._content=o,this.innerHTML=``,this.appendChild(o),o.appendChild(a),this._hiddenInput=document.createElement(`input`),this._hiddenInput.type=`hidden`,this._hiddenInput.name=this.getAttribute(`name`)||``,this._hiddenInput.value=this.getValue(),this.appendChild(this._hiddenInput),this._waitForPopover()}_collectAdornmentNodes(){let e=[...this._prependSlotNodes,...this._appendSlotNodes,...Array.from(this.querySelectorAll(`[slot="prepend"], [slot="append"]`))];this._prependSlotNodes=e.filter(e=>e.getAttribute(`slot`)===`prepend`),this._appendSlotNodes=e.filter(e=>e.getAttribute(`slot`)===`append`)}_getPopover(){let e=this._datePicker,t=e?.getPopoverElement?.()||e?._popover;if(t)return t;let n=e?.querySelector?.(`.mint-date-picker-icon-button`)?.id;return n?document.querySelector(`mint-popover[trigger-id="${CSS.escape(n)}"]`):null}_getPopoverContent(e){return e.querySelector(`.popover-content`)||e}_waitForPopover(e=0){let t=this._getPopover();if(!t){e<120&&requestAnimationFrame(()=>this._waitForPopover(e+1));return}if(this._popoverContent=this._datePicker?.getPopoverContentElement?.()||this._getPopoverContent(t),this._bindCombinedDisplayControl(),this._syncCombinedDisplay(),this._popoverObserver?.disconnect(),this._popoverObserver=new MutationObserver(()=>{if(t.getAttribute(`open`)===`true`){let e=this._datePicker;typeof e?.refreshCalendar==`function`?e.refreshCalendar():e?._buildCalendar?.()}}),this._popoverObserver.observe(t,{attributes:!0,attributeFilter:[`open`]}),t.getAttribute(`open`)===`true`){let e=this._datePicker;typeof e?.refreshCalendar==`function`?e.refreshCalendar():e?._buildCalendar?.()}}_bindCombinedDisplayControl(){if(this._displayControlBound||!this._datePicker)return;this._displayControlBound=!0;let e=e=>{if(!e.target?.closest(`.mint-date-picker-field`)||this.getAttribute(`disabled`)===`true`||this.getAttribute(`readonly`)===`true`||e instanceof KeyboardEvent&&e.key!==`Enter`&&e.key!==` `)return;e.preventDefault(),e.stopImmediatePropagation();let t=this._getPopover();t?.open?t.open():t?.setAttribute(`open`,`true`)};this._datePicker.addEventListener(`click`,e,!0),this._datePicker.addEventListener(`keydown`,e,!0)}_openTimeStage(){queueMicrotask(()=>{let e=this._getPopover();if(e?.getAttribute(`open`)!==`true`){typeof e?.open==`function`?e.open():e?.setAttribute(`open`,`true`),requestAnimationFrame(()=>this._renderTimeStage());return}this._renderTimeStage()})}_renderTimeStage(){if(!this._popoverContent||!this._dateStageComplete)return;let e=document.createElement(`div`);e.className=`mint-datetime-picker-panel`;let t=document.createElement(`button`);t.type=`button`,t.className=`mint-datetime-picker-time-heading`,t.setAttribute(`aria-label`,`Change date, ${this._dateValue}`),t.textContent=this._getFormattedDate(),t.addEventListener(`click`,()=>{let e=this._datePicker;typeof e?.refreshCalendar==`function`?e.refreshCalendar():e?._buildCalendar?.()});let n=document.createElement(`mint-time-picker`),r=this.getAttribute(`disabled`)===`true`,i=this.getAttribute(`readonly`)===`true`;n.setAttribute(`inline`,`true`),n.setAttribute(`value`,this._timeValue||`09:00`),n.setAttribute(`label`,``);for(let e of[`hours`,`minutes`,`seconds`])this.hasAttribute(e)&&n.setAttribute(e,this.getAttribute(e)||``);r&&n.setAttribute(`disabled`,`true`),i&&n.setAttribute(`readonly`,`true`),n.addEventListener(`change`,()=>{this._timeValue=n.getValue?.()||n.getAttribute(`value`)||``,this._syncValue(!0),this._syncCombinedDisplay()}),n.addEventListener(`change`,e=>e.stopPropagation()),n.addEventListener(`input`,e=>e.stopPropagation()),this._timePicker=n,e.appendChild(t),e.appendChild(n),this._popoverContent.replaceChildren(e)}_syncCombinedDisplay(){let e=this._datePicker?.getDisplayElement?.()||this._datePicker?.querySelector(`.mint-date-picker-display`);if(!e||!this._dateValue)return;let t=this._getFormattedDate();e.textContent=this._timeValue?`${t} · ${this._formatTime(this._timeValue)}`:t,e.setAttribute(`aria-label`,`${this.getAttribute(`label`)||`Date and time`}: ${e.textContent}`)}_getFormattedDate(){let e=this._parseDate(this._dateValue,this.getAttribute(`format`)||`mm/dd/yyyy`);return e?this._formatDate(e,this.getAttribute(`display-format`)||`F j, Y`):this._dateValue}_formatTime(e){let[t=`00`,n=`00`,r]=e.split(`:`),i=Number(t),a=this.getAttribute(`hours`)!==`false`,o=this.getAttribute(`minutes`)!==`false`,s=this.getAttribute(`seconds`)===`true`;if(!a)return[o?n:``,s?r||`00`:``].filter(Boolean).join(`:`);let c=i%12||12;return`${[String(c),o?n:``,s?r||`00`:``].filter(Boolean).join(`:`)} ${i>=12?`pm`:`am`}`}};customElements.get(`mint-datetime-picker`)||e.t(`mint-datetime-picker`,t),module.exports=t;
|
|
@@ -7,11 +7,11 @@ import '../../stack.css'
|
|
|
7
7
|
import '../../time-picker.css'
|
|
8
8
|
import '../../text.css'
|
|
9
9
|
import '../../datetime-picker.css'
|
|
10
|
-
import "../chunks/icon-
|
|
10
|
+
import "../chunks/icon-CuRTWM4k.js";
|
|
11
11
|
import { t as e } from "../chunks/register-element-BFYmIynH.js";
|
|
12
12
|
import "../chunks/text-C-6UCBp-.js";
|
|
13
|
-
import "../chunks/date-picker-
|
|
14
|
-
import "../chunks/time-picker-
|
|
13
|
+
import "../chunks/date-picker-BuJJ8gvT.js";
|
|
14
|
+
import "../chunks/time-picker-Bl8KsaJj.js";
|
|
15
15
|
//#region src/components/datetime-picker/DateTimePicker.ts
|
|
16
16
|
var t = class extends HTMLElement {
|
|
17
17
|
constructor(...e) {
|
|
@@ -13,11 +13,11 @@ const __mintLoadStyle = (key, url) => {
|
|
|
13
13
|
__mintLoadStyle('theme', '../../theme.css')
|
|
14
14
|
__mintLoadStyle('icon', '../../icon.css')
|
|
15
15
|
__mintLoadStyle('dropzone', '../../dropzone.css')
|
|
16
|
-
import { a as e } from "../chunks/icon-
|
|
16
|
+
import { a as e } from "../chunks/icon-CuRTWM4k.js";
|
|
17
17
|
import { t } from "../chunks/register-element-BFYmIynH.js";
|
|
18
|
-
import "../chunks/icon-
|
|
19
|
-
import "../chunks/warning-
|
|
20
|
-
import "../chunks/close-
|
|
18
|
+
import "../chunks/icon-Cmx9FTmb.js";
|
|
19
|
+
import "../chunks/warning-CfJwI6nV.js";
|
|
20
|
+
import "../chunks/close-DtRLefjU.js";
|
|
21
21
|
e({
|
|
22
22
|
name: "upload",
|
|
23
23
|
viewBox: "0 0 24 24",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../chunks/icon-Bv1J3LwC.js`),t=require(`../chunks/register-element-tCL_F1YI.js`);require(`../chunks/icon-C-6HOPtI.js`),require(`../chunks/warning-gkij2FhS.js`),require(`../chunks/close-CuYimzX0.js`),e.a({name:`upload`,viewBox:`0 0 24 24`,path:`M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12`,strokeLinecap:`round`,strokeLinejoin:`round`}),e.a({name:`attach`,viewBox:`0 0 24 24`,path:`M15.172 7l-6.586 6.586a2 2 0 102.828 2.828l6.414-6.586a4 4 0 00-5.656-5.656l-6.415 6.585a6 6 0 108.486 8.486L20.5 13`,strokeLinecap:`round`,strokeLinejoin:`round`});var n=class extends HTMLElement{static get observedAttributes(){return[`label`,`accept`,`multiple`,`width`,`height`,`disabled`,`name`,`error`,`error-message`,`loading`,`aria-label`,`aria-describedby`]}constructor(){super(),this._dropzone=null,this._fileInput=null,this._previewContainer=null,this._isDragging=!1,this._wasDragging=!1,this._isUpdatingFiles=!1,this._listenersInitialized=!1,this._selectedFiles=[],this._previewUrls=[],this._fileStates=new Map,this._emptyState=null,this._iconContainer=null,this._labelElement=null,this._transitionTimer=null,this._resizeObserver=null,this._showFileList=!1,this._resetHandler=null,this._a11yId=`mint-dropzone-${Math.random().toString(36).slice(2,10)}`}connectedCallback(){this.classList.add(`mint-dropzone`),this.render(),this._attachFormResetListener()}disconnectedCallback(){if(this.removeEventListeners(),this._cleanupPreviewUrls(),this._resizeObserver?.disconnect(),this._transitionTimer&&clearTimeout(this._transitionTimer),this._resetHandler){let e=this.closest(`form`);e&&e.removeEventListener(`reset`,this._resetHandler),this._resetHandler=null}}attributeChangedCallback(e,t,n){if(t!==n){if(e===`error`||e===`error-message`){this._updateDragStateClass(),this._renderErrorState(this.hasError(),this.getErrorMessage());return}if(e===`loading`){this.render();return}this.render()}}getLabel(){return this.getAttribute(`label`)||``}getAccept(){return this.getAttribute(`accept`)||``}isMultiple(){return this.getAttribute(`multiple`)===`true`}getWidth(){return this.getAttribute(`width`)||`200px`}getHeight(){return this.getAttribute(`height`)||`200px`}_renderSkeleton(e){let t=this.querySelector(`.mint-dropzone-skeleton-container`),n=this._dropzone;if(e){this.classList.add(`is-loading`),t||(t=document.createElement(`div`),t.className=`mint-dropzone-skeleton-container`,n?(n.classList.add(`is-positioned`),n.appendChild(t)):this.appendChild(t));let e=t.querySelector(`.mint-dropzone-skeleton`);e||(e=document.createElement(`div`),e.className=`mint-dropzone-skeleton`,t.appendChild(e)),t.classList.add(`is-visible`),n?.classList.add(`is-loading`)}else this.classList.remove(`is-loading`),t&&t.classList.remove(`is-visible`),n?.classList.remove(`is-loading`)}getName(){return this.getAttribute(`name`)||``}hasError(){return this.getAttribute(`error`)===`true`}getErrorMessage(){return this.getAttribute(`error-message`)||``}isDisabled(){return this.getAttribute(`disabled`)===`true`}isLoading(){return this.getAttribute(`loading`)===`true`}render(){let e=this.isLoading(),t=this.getLabel(),n=this.getAccept(),r=this.isMultiple(),i=this.isDisabled(),a=this.getWidth(),o=this.getHeight(),s=this.getName(),c=this.hasError(),l=this.getErrorMessage();if(this._dropzone||(this._dropzone=document.createElement(`div`),this.appendChild(this._dropzone)),this._updateDragStateClass(),this._dropzone.setAttribute(`aria-invalid`,c?`true`:`false`),i)this._dropzone.setAttribute(`tabindex`,`-1`),this._dropzone.removeAttribute(`role`);else{this._dropzone.setAttribute(`tabindex`,`0`),this._dropzone.setAttribute(`role`,`button`),this._dropzone.setAttribute(`aria-label`,this.getAttribute(`aria-label`)||t||`File upload dropzone`);let e=(this.getAttribute(`aria-describedby`)||``).split(/\s+/).filter(Boolean),n=this.querySelector(`.mint-dropzone-error`);n&&(n.id=`${this.id||this._a11yId}-error`,e.push(n.id)),e.length?this._dropzone.setAttribute(`aria-describedby`,Array.from(new Set(e)).join(` `)):this._dropzone.removeAttribute(`aria-describedby`)}if(this._dropzone.style.width=a,this._dropzone.style.height=o,this._dropzone.style.minWidth=`0`,this._dropzone.style.minHeight=`0`,this._dropzone.style.maxWidth=`100%`,this._fileInput||(this._fileInput=document.createElement(`input`),this._fileInput.type=`file`,this._fileInput.className=`mint-dropzone-file-input`,this._fileInput.setAttribute(`tabindex`,`-1`),this._fileInput.setAttribute(`aria-hidden`,`true`),this._dropzone.appendChild(this._fileInput)),this._fileInput.accept=n,this._fileInput.multiple=r,this._fileInput.disabled=i,s?this._fileInput.name=s:this._fileInput.removeAttribute(`name`),this._fileInput.setAttribute(`aria-invalid`,c?`true`:`false`),!this._emptyState){this._emptyState=document.createElement(`div`),this._emptyState.className=`mint-dropzone-empty-state`,this._iconContainer=document.createElement(`div`),this._iconContainer.className=`mint-dropzone-icon`;let e=document.createElement(`mint-icon`);e.setAttribute(`name`,`upload`),e.className=`mint-dropzone-upload-icon`,this._iconContainer.appendChild(e),this._emptyState.appendChild(this._iconContainer),this._labelElement=document.createElement(`div`),this._labelElement.className=`mint-dropzone-label`,this._emptyState.appendChild(this._labelElement),this._dropzone.appendChild(this._emptyState)}this._labelElement&&(this._labelElement.textContent=t,this._labelElement.hidden=!t),this._dropzone.classList.toggle(`has-files`,this._selectedFiles.length>0),this._emptyState.classList.toggle(`is-hidden`,this._selectedFiles.length>0),this._emptyState.classList.remove(`is-showing`),!this._resizeObserver&&typeof ResizeObserver<`u`&&(this._resizeObserver=new ResizeObserver(([e])=>{let{width:t,height:n}=e.contentRect;this._dropzone?.classList.toggle(`is-wide`,t>=520&&t>=n)}),this._resizeObserver.observe(this._dropzone)),this.setupEventListeners(),this._renderErrorState(c,l),this._renderPreviews(),this._renderSkeleton(e)}_updateDragState(){this._dropzone&&this._updateDragStateClass()}_renderErrorState(e,t){let n=this.querySelector(`.mint-dropzone-error`);if(e&&t?(n||(n=document.createElement(`div`),n.className=`mint-dropzone-error`,this.appendChild(n)),n.textContent=t):n&&n.remove(),this._dropzone){this._dropzone.setAttribute(`aria-invalid`,String(e)),n&&(n.id=`${this.id||this._a11yId}-error`);let t=(this.getAttribute(`aria-describedby`)||``).split(/\s+/).filter(Boolean);n&&t.push(n.id),t.length?this._dropzone.setAttribute(`aria-describedby`,Array.from(new Set(t)).join(` `)):this._dropzone.removeAttribute(`aria-describedby`)}}_updateDragStateClass(){if(!this._dropzone)return;let e=this.isDisabled(),t=this.hasError();this._dropzone.className=`mint-dropzone-target`,this._dropzone.classList.toggle(`has-files`,this._selectedFiles.length>0),this._dropzone.classList.toggle(`is-dragging`,this._isDragging),this._dropzone.classList.toggle(`has-error`,t),this._dropzone.classList.toggle(`is-disabled`,e)}setupEventListeners(){this._listenersInitialized||(this._listenersInitialized=!0,this.removeEventListeners(),!(!this._dropzone||!this._fileInput||this.isDisabled())&&(this._onDropzoneClick||=e=>{if(!(this.isDisabled()||!this._fileInput)&&e.target!==this._fileInput&&(e.stopPropagation(),e.preventDefault(),e.isTrusted))try{this._fileInput.click()}catch(e){console.debug(`File chooser blocked:`,e)}},this._onDragOver||=e=>{e.preventDefault(),e.stopPropagation(),this.isDisabled()||this._isDragging||(this._isDragging=!0,this._wasDragging=!0,this._updateDragState())},this._onDragLeave||=e=>{e.preventDefault(),e.stopPropagation();let t=this._dropzone?.getBoundingClientRect();t&&(e.clientX<t.left||e.clientX>t.right||e.clientY<t.top||e.clientY>t.bottom)&&this._isDragging&&(this._isDragging=!1,this._wasDragging=!1,this._updateDragState())},this._onDrop||=e=>{if(e.preventDefault(),e.stopPropagation(),this._isDragging&&(this._isDragging=!1,this._wasDragging=!1,this._updateDragState()),this.isDisabled())return;let t=e.dataTransfer?.files;t&&t.length>0&&this._handleFiles(t)},this._onFileInputInput||=e=>{e.stopImmediatePropagation(),e.stopPropagation()},this._onKeyDown||=e=>{if(!(this.isDisabled()||!this._fileInput)&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),e.isTrusted))try{this._fileInput.click()}catch(e){console.debug(`File chooser blocked:`,e)}},this._onFocus||=e=>{this._dropzone&&!this.isDisabled()&&this._dropzone.classList.add(`is-focused`)},this._onBlur||=e=>{this._dropzone},this._onFileInputChange||=e=>{if(e.stopImmediatePropagation(),e.stopPropagation(),this._isUpdatingFiles)return;let t=e.target.files;if(t&&t.length>0){let e=this.getAccept(),n=this.isMultiple(),r=[],i=[];for(let n=0;n<t.length;n++){let a=t[n];this._isFileAccepted(a,e)?r.push(a):i.push(a)}if(!n&&r.length>1&&(i.push(...r.slice(1)),r.splice(1)),i.length>0){let e=new CustomEvent(`dropRejected`,{detail:{files:i,reason:`File type not accepted or multiple files not allowed`},bubbles:!0,cancelable:!0});this.dispatchEvent(e)}r.length>0&&this._applyValidFiles(r)}},this._dropzone.addEventListener(`click`,this._onDropzoneClick),this._dropzone.addEventListener(`dragover`,this._onDragOver),this._dropzone.addEventListener(`dragleave`,this._onDragLeave),this._dropzone.addEventListener(`drop`,this._onDrop),this._dropzone.addEventListener(`keydown`,this._onKeyDown),this._dropzone.addEventListener(`focus`,this._onFocus),this._dropzone.addEventListener(`blur`,this._onBlur),this._fileInput.addEventListener(`change`,this._onFileInputChange),this._fileInput.addEventListener(`input`,this._onFileInputInput,!0)))}removeEventListeners(){this._dropzone&&(this._onDropzoneClick&&this._dropzone.removeEventListener(`click`,this._onDropzoneClick),this._onDragOver&&this._dropzone.removeEventListener(`dragover`,this._onDragOver),this._onDragLeave&&this._dropzone.removeEventListener(`dragleave`,this._onDragLeave),this._onDrop&&this._dropzone.removeEventListener(`drop`,this._onDrop),this._onKeyDown&&this._dropzone.removeEventListener(`keydown`,this._onKeyDown),this._onFocus&&this._dropzone.removeEventListener(`focus`,this._onFocus),this._onBlur&&this._dropzone.removeEventListener(`blur`,this._onBlur)),this._fileInput&&(this._onFileInputChange&&this._fileInput.removeEventListener(`change`,this._onFileInputChange),this._onFileInputInput&&this._fileInput.removeEventListener(`input`,this._onFileInputInput,!0)),this._isDragging=!1,this._listenersInitialized=!1}_handleFiles(e){let t=this.getAccept(),n=this.isMultiple(),r=[],i=[];for(let n=0;n<e.length;n++){let a=e[n];this._isFileAccepted(a,t)?r.push(a):i.push(a)}if(!n&&r.length>1&&(i.push(...r.slice(1)),r.splice(1)),i.length>0){let e=new CustomEvent(`dropRejected`,{detail:{files:i,reason:`File type not accepted or multiple files not allowed`},bubbles:!0,cancelable:!0});this.dispatchEvent(e)}r.length>0&&this._applyValidFiles(r)}_isFileAccepted(e,t){if(!t)return!0;let n=t.split(`,`).map(e=>e.trim().toLowerCase());for(let t of n)if(t.startsWith(`.`)){if(`.`+e.name.split(`.`).pop()?.toLowerCase()===t)return!0}else if(t.includes(`/*`)){if(t.split(`/`)[0]===e.type.split(`/`)[0])return!0}else if(e.type===t)return!0;return!1}_dispatchEvent(e,t){let n=t.target,r=new CustomEvent(e,{detail:{files:n.files?Array.from(n.files):[],value:n.value||``},bubbles:!0,cancelable:!0});this.dispatchEvent(r)}_dispatchSelectionEvents(){let e={files:[...this._selectedFiles],value:``};this.dispatchEvent(new CustomEvent(`input`,{detail:e,bubbles:!0,cancelable:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`change`,{detail:e,bubbles:!0,cancelable:!0,composed:!0}))}_syncFileInputFromSelected(){if(!this._fileInput)return;let e=new DataTransfer;this._selectedFiles.forEach(t=>{try{e.items.add(t)}catch(e){console.warn(`Failed to add file to DataTransfer:`,e)}}),this._isUpdatingFiles=!0;try{this._fileInput.files=e.files}catch(e){console.warn(`Failed to set files on input:`,e)}setTimeout(()=>{this._isUpdatingFiles=!1},0)}get files(){return this._syncFileInputFromSelected(),this._fileInput?.files||null}getFiles(){return[...this._selectedFiles]}getFileEntries(){return this._selectedFiles.map(e=>({file:e,...this._fileStates.get(e)||{progress:null,error:``,uploaded:!1}}))}removeFile(e){let t=typeof e==`number`?e:this._selectedFiles.findIndex(t=>typeof e==`string`?t.name===e:t===e);return t<0||t>=this._selectedFiles.length?!1:(this._removeFileAt(t),!0)}setFileProgress(e,t){if(!this._selectedFiles.includes(e))return;let n=this._fileStates.get(e)||{progress:null,error:``,uploaded:!1};n.progress=t===null?null:Math.max(0,Math.min(100,t)),n.uploaded=!1,this._fileStates.set(e,n),this._renderPreviews(),this.dispatchEvent(new CustomEvent(`fileprogress`,{detail:{file:e,progress:n.progress},bubbles:!0,composed:!0}))}setFileError(e,t){this._selectedFiles.includes(e)&&(this._fileStates.set(e,{progress:null,error:t,uploaded:!1}),this._renderPreviews(),this.dispatchEvent(new CustomEvent(`fileerror`,{detail:{file:e,message:t},bubbles:!0,composed:!0})))}setFileUploaded(e){this._selectedFiles.includes(e)&&(this._fileStates.set(e,{progress:null,error:``,uploaded:!0}),this._renderPreviews(),this.dispatchEvent(new CustomEvent(`fileuploaded`,{detail:{file:e},bubbles:!0,composed:!0})))}syncFiles(){this._syncFileInputFromSelected()}_renderPreviews(){if(!this._dropzone)return;if(this._previewContainer&&(this._cleanupPreviewUrls(),this._previewContainer.remove()),this._selectedFiles.length===0){this._previewContainer=null,this._updateDragStateClass();return}let e=document.createElement(`div`);e.className=`mint-dropzone-previews-wrapper`,e.classList.toggle(`has-error`,this.hasError()),e.classList.toggle(`is-dragging`,this._isDragging);let t=document.createElement(`div`);t.className=`mint-dropzone-previews`,this._selectedFiles.forEach((e,n)=>{let r=this._fileStates.get(e)||{progress:null,error:``,uploaded:!1},i=document.createElement(`div`);if(i.className=`mint-dropzone-file`,i.classList.toggle(`has-upload-error`,!!r.error),e.type.startsWith(`image/`)){let t=document.createElement(`img`);t.className=`mint-dropzone-file-image`;let n=URL.createObjectURL(e);this._previewUrls.push(n),t.src=n,i.appendChild(t)}else{let e=document.createElement(`mint-icon`);e.setAttribute(`name`,`attach`),e.className=`mint-dropzone-file-icon`,i.appendChild(e)}let a=document.createElement(`div`);if(a.className=`mint-dropzone-file-name`,a.textContent=e.name,i.appendChild(a),r.uploaded){let t=document.createElement(`span`);t.className=`mint-dropzone-file-uploaded`,t.setAttribute(`role`,`img`),t.setAttribute(`aria-label`,`${e.name} uploaded successfully`);let n=document.createElement(`mint-icon`);n.setAttribute(`name`,`check`),t.appendChild(n),i.appendChild(t)}else if(r.progress!==null&&!r.error){let t=document.createElement(`progress`);t.className=`mint-dropzone-file-progress`,t.max=100,t.value=r.progress,t.setAttribute(`aria-label`,`Uploading ${e.name}: ${r.progress}%`),i.appendChild(t)}if(r.error){let t=document.createElement(`button`);t.type=`button`,t.className=`mint-dropzone-file-error`,t.setAttribute(`aria-label`,`Upload failed for ${e.name}`),t.setAttribute(`aria-expanded`,`false`);let n=document.createElement(`mint-icon`);n.setAttribute(`name`,`warning`),t.appendChild(n);let a=document.createElement(`span`);a.className=`mint-dropzone-file-error-message`,a.setAttribute(`role`,`tooltip`),a.textContent=r.error,t.appendChild(a),t.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation();let n=t.classList.toggle(`is-open`);t.setAttribute(`aria-expanded`,String(n))}),i.appendChild(t)}let o=document.createElement(`button`);o.type=`button`,o.className=`mint-dropzone-file-remove`;let s=document.createElement(`mint-icon`);s.setAttribute(`name`,`close`),s.className=`mint-dropzone-file-remove-icon`,o.appendChild(s),o.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation(),this._removeFileAt(n)}),i.appendChild(o),t.appendChild(i)});let n=document.createElement(`div`);n.className=`mint-dropzone-preview-fade is-top`,e.appendChild(n);let r=document.createElement(`div`);r.className=`mint-dropzone-preview-fade is-bottom is-visible`,e.appendChild(r);let i=()=>{let e=t.scrollTop,i=t.scrollHeight,a=t.clientHeight;e>0?n.classList.add(`is-visible`):n.classList.remove(`is-visible`),e+a<i-1?r.classList.add(`is-visible`):r.classList.remove(`is-visible`)};i(),t.addEventListener(`scroll`,i),e.appendChild(t),this._previewContainer=e,e.classList.toggle(`is-visible`,this._showFileList),this._dropzone.appendChild(e),this._updateDragStateClass()}_removeFileAt(e){if(e<0||e>=this._selectedFiles.length)return;let[t]=this._selectedFiles.splice(e,1);t&&(this._cleanupPreviewUrls(),this._fileStates.delete(t)),this._syncFileInputFromSelected(),this._selectedFiles.length===0?this._animateListIn():this._renderPreviews(),this._dispatchSelectionEvents()}_cleanupPreviewUrls(){this._previewUrls.forEach(e=>URL.revokeObjectURL(e)),this._previewUrls=[]}_attachFormResetListener(){let e=this.closest(`form`);!e||this._resetHandler||(this._resetHandler=()=>{this._selectedFiles=[],this._fileStates.clear(),this._syncFileInputFromSelected(),this._animateListIn(),this._cleanupPreviewUrls()},e.addEventListener(`reset`,this._resetHandler))}_applyValidFiles(e){if(this.isMultiple()){let t=e.filter(e=>!this._isDuplicateFile(e));this._selectedFiles.push(...t),t.forEach(e=>this._fileStates.set(e,{progress:null,error:``,uploaded:!1}))}else this._selectedFiles=[e[0]],this._fileStates.clear(),this._fileStates.set(e[0],{progress:null,error:``,uploaded:!1});this._syncFileInputFromSelected(),this._selectedFiles.length>0&&(this.removeAttribute(`error`),this.removeAttribute(`error-message`),this._fileInput&&this._fileInput.removeAttribute(`aria-invalid`)),this._renderPreviews(),this._animateListIn(),this._dispatchSelectionEvents()}_animateListIn(){if(this._transitionTimer&&clearTimeout(this._transitionTimer),!this._selectedFiles.length){this._showFileList=!1,this._dropzone?.classList.remove(`has-files`),this._emptyState?.classList.remove(`is-hidden`,`is-hiding`),this._emptyState?.classList.add(`is-showing`),this._transitionTimer=setTimeout(()=>this._emptyState?.classList.remove(`is-showing`),220),this._renderPreviews();return}this._showFileList=!1,this._dropzone?.classList.add(`has-files`,`is-upload-transition`),this._emptyState?.classList.remove(`is-hidden`,`is-showing`),this._emptyState?.classList.add(`is-hiding`),this._transitionTimer=setTimeout(()=>{this._showFileList=!0,this._emptyState?.classList.remove(`is-hiding`),this._emptyState?.classList.add(`is-hidden`),this._dropzone?.classList.remove(`is-upload-transition`),this._renderPreviews()},580)}_isDuplicateFile(e){return this._selectedFiles.some(t=>t.name===e.name&&t.size===e.size&&t.lastModified===e.lastModified)}};customElements.get(`mint-dropzone`)||t.t(`mint-dropzone`,n),module.exports=n;
|
|
1
|
+
const e=require(`../chunks/icon-pgeP1zxb.js`),t=require(`../chunks/register-element-tCL_F1YI.js`);require(`../chunks/icon-rdeLRs-R.js`),require(`../chunks/warning-B1-z7ww9.js`),require(`../chunks/close-DuS1TdUB.js`),e.a({name:`upload`,viewBox:`0 0 24 24`,path:`M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12`,strokeLinecap:`round`,strokeLinejoin:`round`}),e.a({name:`attach`,viewBox:`0 0 24 24`,path:`M15.172 7l-6.586 6.586a2 2 0 102.828 2.828l6.414-6.586a4 4 0 00-5.656-5.656l-6.415 6.585a6 6 0 108.486 8.486L20.5 13`,strokeLinecap:`round`,strokeLinejoin:`round`});var n=class extends HTMLElement{static get observedAttributes(){return[`label`,`accept`,`multiple`,`width`,`height`,`disabled`,`name`,`error`,`error-message`,`loading`,`aria-label`,`aria-describedby`]}constructor(){super(),this._dropzone=null,this._fileInput=null,this._previewContainer=null,this._isDragging=!1,this._wasDragging=!1,this._isUpdatingFiles=!1,this._listenersInitialized=!1,this._selectedFiles=[],this._previewUrls=[],this._fileStates=new Map,this._emptyState=null,this._iconContainer=null,this._labelElement=null,this._transitionTimer=null,this._resizeObserver=null,this._showFileList=!1,this._resetHandler=null,this._a11yId=`mint-dropzone-${Math.random().toString(36).slice(2,10)}`}connectedCallback(){this.classList.add(`mint-dropzone`),this.render(),this._attachFormResetListener()}disconnectedCallback(){if(this.removeEventListeners(),this._cleanupPreviewUrls(),this._resizeObserver?.disconnect(),this._transitionTimer&&clearTimeout(this._transitionTimer),this._resetHandler){let e=this.closest(`form`);e&&e.removeEventListener(`reset`,this._resetHandler),this._resetHandler=null}}attributeChangedCallback(e,t,n){if(t!==n){if(e===`error`||e===`error-message`){this._updateDragStateClass(),this._renderErrorState(this.hasError(),this.getErrorMessage());return}if(e===`loading`){this.render();return}this.render()}}getLabel(){return this.getAttribute(`label`)||``}getAccept(){return this.getAttribute(`accept`)||``}isMultiple(){return this.getAttribute(`multiple`)===`true`}getWidth(){return this.getAttribute(`width`)||`200px`}getHeight(){return this.getAttribute(`height`)||`200px`}_renderSkeleton(e){let t=this.querySelector(`.mint-dropzone-skeleton-container`),n=this._dropzone;if(e){this.classList.add(`is-loading`),t||(t=document.createElement(`div`),t.className=`mint-dropzone-skeleton-container`,n?(n.classList.add(`is-positioned`),n.appendChild(t)):this.appendChild(t));let e=t.querySelector(`.mint-dropzone-skeleton`);e||(e=document.createElement(`div`),e.className=`mint-dropzone-skeleton`,t.appendChild(e)),t.classList.add(`is-visible`),n?.classList.add(`is-loading`)}else this.classList.remove(`is-loading`),t&&t.classList.remove(`is-visible`),n?.classList.remove(`is-loading`)}getName(){return this.getAttribute(`name`)||``}hasError(){return this.getAttribute(`error`)===`true`}getErrorMessage(){return this.getAttribute(`error-message`)||``}isDisabled(){return this.getAttribute(`disabled`)===`true`}isLoading(){return this.getAttribute(`loading`)===`true`}render(){let e=this.isLoading(),t=this.getLabel(),n=this.getAccept(),r=this.isMultiple(),i=this.isDisabled(),a=this.getWidth(),o=this.getHeight(),s=this.getName(),c=this.hasError(),l=this.getErrorMessage();if(this._dropzone||(this._dropzone=document.createElement(`div`),this.appendChild(this._dropzone)),this._updateDragStateClass(),this._dropzone.setAttribute(`aria-invalid`,c?`true`:`false`),i)this._dropzone.setAttribute(`tabindex`,`-1`),this._dropzone.removeAttribute(`role`);else{this._dropzone.setAttribute(`tabindex`,`0`),this._dropzone.setAttribute(`role`,`button`),this._dropzone.setAttribute(`aria-label`,this.getAttribute(`aria-label`)||t||`File upload dropzone`);let e=(this.getAttribute(`aria-describedby`)||``).split(/\s+/).filter(Boolean),n=this.querySelector(`.mint-dropzone-error`);n&&(n.id=`${this.id||this._a11yId}-error`,e.push(n.id)),e.length?this._dropzone.setAttribute(`aria-describedby`,Array.from(new Set(e)).join(` `)):this._dropzone.removeAttribute(`aria-describedby`)}if(this._dropzone.style.width=a,this._dropzone.style.height=o,this._dropzone.style.minWidth=`0`,this._dropzone.style.minHeight=`0`,this._dropzone.style.maxWidth=`100%`,this._fileInput||(this._fileInput=document.createElement(`input`),this._fileInput.type=`file`,this._fileInput.className=`mint-dropzone-file-input`,this._fileInput.setAttribute(`tabindex`,`-1`),this._fileInput.setAttribute(`aria-hidden`,`true`),this._dropzone.appendChild(this._fileInput)),this._fileInput.accept=n,this._fileInput.multiple=r,this._fileInput.disabled=i,s?this._fileInput.name=s:this._fileInput.removeAttribute(`name`),this._fileInput.setAttribute(`aria-invalid`,c?`true`:`false`),!this._emptyState){this._emptyState=document.createElement(`div`),this._emptyState.className=`mint-dropzone-empty-state`,this._iconContainer=document.createElement(`div`),this._iconContainer.className=`mint-dropzone-icon`;let e=document.createElement(`mint-icon`);e.setAttribute(`name`,`upload`),e.className=`mint-dropzone-upload-icon`,this._iconContainer.appendChild(e),this._emptyState.appendChild(this._iconContainer),this._labelElement=document.createElement(`div`),this._labelElement.className=`mint-dropzone-label`,this._emptyState.appendChild(this._labelElement),this._dropzone.appendChild(this._emptyState)}this._labelElement&&(this._labelElement.textContent=t,this._labelElement.hidden=!t),this._dropzone.classList.toggle(`has-files`,this._selectedFiles.length>0),this._emptyState.classList.toggle(`is-hidden`,this._selectedFiles.length>0),this._emptyState.classList.remove(`is-showing`),!this._resizeObserver&&typeof ResizeObserver<`u`&&(this._resizeObserver=new ResizeObserver(([e])=>{let{width:t,height:n}=e.contentRect;this._dropzone?.classList.toggle(`is-wide`,t>=520&&t>=n)}),this._resizeObserver.observe(this._dropzone)),this.setupEventListeners(),this._renderErrorState(c,l),this._renderPreviews(),this._renderSkeleton(e)}_updateDragState(){this._dropzone&&this._updateDragStateClass()}_renderErrorState(e,t){let n=this.querySelector(`.mint-dropzone-error`);if(e&&t?(n||(n=document.createElement(`div`),n.className=`mint-dropzone-error`,this.appendChild(n)),n.textContent=t):n&&n.remove(),this._dropzone){this._dropzone.setAttribute(`aria-invalid`,String(e)),n&&(n.id=`${this.id||this._a11yId}-error`);let t=(this.getAttribute(`aria-describedby`)||``).split(/\s+/).filter(Boolean);n&&t.push(n.id),t.length?this._dropzone.setAttribute(`aria-describedby`,Array.from(new Set(t)).join(` `)):this._dropzone.removeAttribute(`aria-describedby`)}}_updateDragStateClass(){if(!this._dropzone)return;let e=this.isDisabled(),t=this.hasError();this._dropzone.className=`mint-dropzone-target`,this._dropzone.classList.toggle(`has-files`,this._selectedFiles.length>0),this._dropzone.classList.toggle(`is-dragging`,this._isDragging),this._dropzone.classList.toggle(`has-error`,t),this._dropzone.classList.toggle(`is-disabled`,e)}setupEventListeners(){this._listenersInitialized||(this._listenersInitialized=!0,this.removeEventListeners(),!(!this._dropzone||!this._fileInput||this.isDisabled())&&(this._onDropzoneClick||=e=>{if(!(this.isDisabled()||!this._fileInput)&&e.target!==this._fileInput&&(e.stopPropagation(),e.preventDefault(),e.isTrusted))try{this._fileInput.click()}catch(e){console.debug(`File chooser blocked:`,e)}},this._onDragOver||=e=>{e.preventDefault(),e.stopPropagation(),this.isDisabled()||this._isDragging||(this._isDragging=!0,this._wasDragging=!0,this._updateDragState())},this._onDragLeave||=e=>{e.preventDefault(),e.stopPropagation();let t=this._dropzone?.getBoundingClientRect();t&&(e.clientX<t.left||e.clientX>t.right||e.clientY<t.top||e.clientY>t.bottom)&&this._isDragging&&(this._isDragging=!1,this._wasDragging=!1,this._updateDragState())},this._onDrop||=e=>{if(e.preventDefault(),e.stopPropagation(),this._isDragging&&(this._isDragging=!1,this._wasDragging=!1,this._updateDragState()),this.isDisabled())return;let t=e.dataTransfer?.files;t&&t.length>0&&this._handleFiles(t)},this._onFileInputInput||=e=>{e.stopImmediatePropagation(),e.stopPropagation()},this._onKeyDown||=e=>{if(!(this.isDisabled()||!this._fileInput)&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),e.isTrusted))try{this._fileInput.click()}catch(e){console.debug(`File chooser blocked:`,e)}},this._onFocus||=e=>{this._dropzone&&!this.isDisabled()&&this._dropzone.classList.add(`is-focused`)},this._onBlur||=e=>{this._dropzone},this._onFileInputChange||=e=>{if(e.stopImmediatePropagation(),e.stopPropagation(),this._isUpdatingFiles)return;let t=e.target.files;if(t&&t.length>0){let e=this.getAccept(),n=this.isMultiple(),r=[],i=[];for(let n=0;n<t.length;n++){let a=t[n];this._isFileAccepted(a,e)?r.push(a):i.push(a)}if(!n&&r.length>1&&(i.push(...r.slice(1)),r.splice(1)),i.length>0){let e=new CustomEvent(`dropRejected`,{detail:{files:i,reason:`File type not accepted or multiple files not allowed`},bubbles:!0,cancelable:!0});this.dispatchEvent(e)}r.length>0&&this._applyValidFiles(r)}},this._dropzone.addEventListener(`click`,this._onDropzoneClick),this._dropzone.addEventListener(`dragover`,this._onDragOver),this._dropzone.addEventListener(`dragleave`,this._onDragLeave),this._dropzone.addEventListener(`drop`,this._onDrop),this._dropzone.addEventListener(`keydown`,this._onKeyDown),this._dropzone.addEventListener(`focus`,this._onFocus),this._dropzone.addEventListener(`blur`,this._onBlur),this._fileInput.addEventListener(`change`,this._onFileInputChange),this._fileInput.addEventListener(`input`,this._onFileInputInput,!0)))}removeEventListeners(){this._dropzone&&(this._onDropzoneClick&&this._dropzone.removeEventListener(`click`,this._onDropzoneClick),this._onDragOver&&this._dropzone.removeEventListener(`dragover`,this._onDragOver),this._onDragLeave&&this._dropzone.removeEventListener(`dragleave`,this._onDragLeave),this._onDrop&&this._dropzone.removeEventListener(`drop`,this._onDrop),this._onKeyDown&&this._dropzone.removeEventListener(`keydown`,this._onKeyDown),this._onFocus&&this._dropzone.removeEventListener(`focus`,this._onFocus),this._onBlur&&this._dropzone.removeEventListener(`blur`,this._onBlur)),this._fileInput&&(this._onFileInputChange&&this._fileInput.removeEventListener(`change`,this._onFileInputChange),this._onFileInputInput&&this._fileInput.removeEventListener(`input`,this._onFileInputInput,!0)),this._isDragging=!1,this._listenersInitialized=!1}_handleFiles(e){let t=this.getAccept(),n=this.isMultiple(),r=[],i=[];for(let n=0;n<e.length;n++){let a=e[n];this._isFileAccepted(a,t)?r.push(a):i.push(a)}if(!n&&r.length>1&&(i.push(...r.slice(1)),r.splice(1)),i.length>0){let e=new CustomEvent(`dropRejected`,{detail:{files:i,reason:`File type not accepted or multiple files not allowed`},bubbles:!0,cancelable:!0});this.dispatchEvent(e)}r.length>0&&this._applyValidFiles(r)}_isFileAccepted(e,t){if(!t)return!0;let n=t.split(`,`).map(e=>e.trim().toLowerCase());for(let t of n)if(t.startsWith(`.`)){if(`.`+e.name.split(`.`).pop()?.toLowerCase()===t)return!0}else if(t.includes(`/*`)){if(t.split(`/`)[0]===e.type.split(`/`)[0])return!0}else if(e.type===t)return!0;return!1}_dispatchEvent(e,t){let n=t.target,r=new CustomEvent(e,{detail:{files:n.files?Array.from(n.files):[],value:n.value||``},bubbles:!0,cancelable:!0});this.dispatchEvent(r)}_dispatchSelectionEvents(){let e={files:[...this._selectedFiles],value:``};this.dispatchEvent(new CustomEvent(`input`,{detail:e,bubbles:!0,cancelable:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`change`,{detail:e,bubbles:!0,cancelable:!0,composed:!0}))}_syncFileInputFromSelected(){if(!this._fileInput)return;let e=new DataTransfer;this._selectedFiles.forEach(t=>{try{e.items.add(t)}catch(e){console.warn(`Failed to add file to DataTransfer:`,e)}}),this._isUpdatingFiles=!0;try{this._fileInput.files=e.files}catch(e){console.warn(`Failed to set files on input:`,e)}setTimeout(()=>{this._isUpdatingFiles=!1},0)}get files(){return this._syncFileInputFromSelected(),this._fileInput?.files||null}getFiles(){return[...this._selectedFiles]}getFileEntries(){return this._selectedFiles.map(e=>({file:e,...this._fileStates.get(e)||{progress:null,error:``,uploaded:!1}}))}removeFile(e){let t=typeof e==`number`?e:this._selectedFiles.findIndex(t=>typeof e==`string`?t.name===e:t===e);return t<0||t>=this._selectedFiles.length?!1:(this._removeFileAt(t),!0)}setFileProgress(e,t){if(!this._selectedFiles.includes(e))return;let n=this._fileStates.get(e)||{progress:null,error:``,uploaded:!1};n.progress=t===null?null:Math.max(0,Math.min(100,t)),n.uploaded=!1,this._fileStates.set(e,n),this._renderPreviews(),this.dispatchEvent(new CustomEvent(`fileprogress`,{detail:{file:e,progress:n.progress},bubbles:!0,composed:!0}))}setFileError(e,t){this._selectedFiles.includes(e)&&(this._fileStates.set(e,{progress:null,error:t,uploaded:!1}),this._renderPreviews(),this.dispatchEvent(new CustomEvent(`fileerror`,{detail:{file:e,message:t},bubbles:!0,composed:!0})))}setFileUploaded(e){this._selectedFiles.includes(e)&&(this._fileStates.set(e,{progress:null,error:``,uploaded:!0}),this._renderPreviews(),this.dispatchEvent(new CustomEvent(`fileuploaded`,{detail:{file:e},bubbles:!0,composed:!0})))}syncFiles(){this._syncFileInputFromSelected()}_renderPreviews(){if(!this._dropzone)return;if(this._previewContainer&&(this._cleanupPreviewUrls(),this._previewContainer.remove()),this._selectedFiles.length===0){this._previewContainer=null,this._updateDragStateClass();return}let e=document.createElement(`div`);e.className=`mint-dropzone-previews-wrapper`,e.classList.toggle(`has-error`,this.hasError()),e.classList.toggle(`is-dragging`,this._isDragging);let t=document.createElement(`div`);t.className=`mint-dropzone-previews`,this._selectedFiles.forEach((e,n)=>{let r=this._fileStates.get(e)||{progress:null,error:``,uploaded:!1},i=document.createElement(`div`);if(i.className=`mint-dropzone-file`,i.classList.toggle(`has-upload-error`,!!r.error),e.type.startsWith(`image/`)){let t=document.createElement(`img`);t.className=`mint-dropzone-file-image`;let n=URL.createObjectURL(e);this._previewUrls.push(n),t.src=n,i.appendChild(t)}else{let e=document.createElement(`mint-icon`);e.setAttribute(`name`,`attach`),e.className=`mint-dropzone-file-icon`,i.appendChild(e)}let a=document.createElement(`div`);if(a.className=`mint-dropzone-file-name`,a.textContent=e.name,i.appendChild(a),r.uploaded){let t=document.createElement(`span`);t.className=`mint-dropzone-file-uploaded`,t.setAttribute(`role`,`img`),t.setAttribute(`aria-label`,`${e.name} uploaded successfully`);let n=document.createElement(`mint-icon`);n.setAttribute(`name`,`check`),t.appendChild(n),i.appendChild(t)}else if(r.progress!==null&&!r.error){let t=document.createElement(`progress`);t.className=`mint-dropzone-file-progress`,t.max=100,t.value=r.progress,t.setAttribute(`aria-label`,`Uploading ${e.name}: ${r.progress}%`),i.appendChild(t)}if(r.error){let t=document.createElement(`button`);t.type=`button`,t.className=`mint-dropzone-file-error`,t.setAttribute(`aria-label`,`Upload failed for ${e.name}`),t.setAttribute(`aria-expanded`,`false`);let n=document.createElement(`mint-icon`);n.setAttribute(`name`,`warning`),t.appendChild(n);let a=document.createElement(`span`);a.className=`mint-dropzone-file-error-message`,a.setAttribute(`role`,`tooltip`),a.textContent=r.error,t.appendChild(a),t.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation();let n=t.classList.toggle(`is-open`);t.setAttribute(`aria-expanded`,String(n))}),i.appendChild(t)}let o=document.createElement(`button`);o.type=`button`,o.className=`mint-dropzone-file-remove`;let s=document.createElement(`mint-icon`);s.setAttribute(`name`,`close`),s.className=`mint-dropzone-file-remove-icon`,o.appendChild(s),o.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation(),this._removeFileAt(n)}),i.appendChild(o),t.appendChild(i)});let n=document.createElement(`div`);n.className=`mint-dropzone-preview-fade is-top`,e.appendChild(n);let r=document.createElement(`div`);r.className=`mint-dropzone-preview-fade is-bottom is-visible`,e.appendChild(r);let i=()=>{let e=t.scrollTop,i=t.scrollHeight,a=t.clientHeight;e>0?n.classList.add(`is-visible`):n.classList.remove(`is-visible`),e+a<i-1?r.classList.add(`is-visible`):r.classList.remove(`is-visible`)};i(),t.addEventListener(`scroll`,i),e.appendChild(t),this._previewContainer=e,e.classList.toggle(`is-visible`,this._showFileList),this._dropzone.appendChild(e),this._updateDragStateClass()}_removeFileAt(e){if(e<0||e>=this._selectedFiles.length)return;let[t]=this._selectedFiles.splice(e,1);t&&(this._cleanupPreviewUrls(),this._fileStates.delete(t)),this._syncFileInputFromSelected(),this._selectedFiles.length===0?this._animateListIn():this._renderPreviews(),this._dispatchSelectionEvents()}_cleanupPreviewUrls(){this._previewUrls.forEach(e=>URL.revokeObjectURL(e)),this._previewUrls=[]}_attachFormResetListener(){let e=this.closest(`form`);!e||this._resetHandler||(this._resetHandler=()=>{this._selectedFiles=[],this._fileStates.clear(),this._syncFileInputFromSelected(),this._animateListIn(),this._cleanupPreviewUrls()},e.addEventListener(`reset`,this._resetHandler))}_applyValidFiles(e){if(this.isMultiple()){let t=e.filter(e=>!this._isDuplicateFile(e));this._selectedFiles.push(...t),t.forEach(e=>this._fileStates.set(e,{progress:null,error:``,uploaded:!1}))}else this._selectedFiles=[e[0]],this._fileStates.clear(),this._fileStates.set(e[0],{progress:null,error:``,uploaded:!1});this._syncFileInputFromSelected(),this._selectedFiles.length>0&&(this.removeAttribute(`error`),this.removeAttribute(`error-message`),this._fileInput&&this._fileInput.removeAttribute(`aria-invalid`)),this._renderPreviews(),this._animateListIn(),this._dispatchSelectionEvents()}_animateListIn(){if(this._transitionTimer&&clearTimeout(this._transitionTimer),!this._selectedFiles.length){this._showFileList=!1,this._dropzone?.classList.remove(`has-files`),this._emptyState?.classList.remove(`is-hidden`,`is-hiding`),this._emptyState?.classList.add(`is-showing`),this._transitionTimer=setTimeout(()=>this._emptyState?.classList.remove(`is-showing`),220),this._renderPreviews();return}this._showFileList=!1,this._dropzone?.classList.add(`has-files`,`is-upload-transition`),this._emptyState?.classList.remove(`is-hidden`,`is-showing`),this._emptyState?.classList.add(`is-hiding`),this._transitionTimer=setTimeout(()=>{this._showFileList=!0,this._emptyState?.classList.remove(`is-hiding`),this._emptyState?.classList.add(`is-hidden`),this._dropzone?.classList.remove(`is-upload-transition`),this._renderPreviews()},580)}_isDuplicateFile(e){return this._selectedFiles.some(t=>t.name===e.name&&t.size===e.size&&t.lastModified===e.lastModified)}};customElements.get(`mint-dropzone`)||t.t(`mint-dropzone`,n),module.exports=n;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import '../../theme.css'
|
|
2
2
|
import '../../icon.css'
|
|
3
3
|
import '../../dropzone.css'
|
|
4
|
-
import { a as e } from "../chunks/icon-
|
|
4
|
+
import { a as e } from "../chunks/icon-CuRTWM4k.js";
|
|
5
5
|
import { t } from "../chunks/register-element-BFYmIynH.js";
|
|
6
|
-
import "../chunks/icon-
|
|
7
|
-
import "../chunks/warning-
|
|
8
|
-
import "../chunks/close-
|
|
6
|
+
import "../chunks/icon-Cmx9FTmb.js";
|
|
7
|
+
import "../chunks/warning-CfJwI6nV.js";
|
|
8
|
+
import "../chunks/close-DtRLefjU.js";
|
|
9
9
|
e({
|
|
10
10
|
name: "upload",
|
|
11
11
|
viewBox: "0 0 24 24",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Editor.d.ts","sourceRoot":"","sources":["../../../src/components/editor/Editor.ts"],"names":[],"mappings":"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
|
|
1
|
+
{"version":3,"file":"Editor.d.ts","sourceRoot":"","sources":["../../../src/components/editor/Editor.ts"],"names":[],"mappings":"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"}
|