@editora/ui-core 0.1.10 → 0.1.13
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/README.md +5 -5
- package/dist/alert-dialog.cjs.js +18 -18
- package/dist/alert-dialog.esm.js +130 -117
- package/dist/app-header.cjs.js +22 -2
- package/dist/app-header.esm.js +22 -2
- package/dist/badge.cjs.js +5 -5
- package/dist/badge.esm.js +9 -8
- package/dist/color-picker.cjs.js +4 -4
- package/dist/color-picker.esm.js +39 -31
- package/dist/combobox.cjs.js +21 -21
- package/dist/combobox.esm.js +79 -40
- package/dist/command-palette.cjs.js +1 -1
- package/dist/command-palette.esm.js +2 -2
- package/dist/components/date-time-utils.d.ts +2 -1
- package/dist/components/date-time-utils.d.ts.map +1 -1
- package/dist/components/ui-alert-dialog.d.ts +2 -0
- package/dist/components/ui-alert-dialog.d.ts.map +1 -1
- package/dist/components/ui-app-header.d.ts.map +1 -1
- package/dist/components/ui-badge.d.ts.map +1 -1
- package/dist/components/ui-color-picker.d.ts.map +1 -1
- package/dist/components/ui-combobox.d.ts +4 -1
- package/dist/components/ui-combobox.d.ts.map +1 -1
- package/dist/components/ui-date-picker.d.ts +3 -0
- package/dist/components/ui-date-picker.d.ts.map +1 -1
- package/dist/components/ui-date-range-picker.d.ts +3 -0
- package/dist/components/ui-date-range-picker.d.ts.map +1 -1
- package/dist/components/ui-date-range-time-picker.d.ts +3 -0
- package/dist/components/ui-date-range-time-picker.d.ts.map +1 -1
- package/dist/components/ui-date-time-picker.d.ts +3 -0
- package/dist/components/ui-date-time-picker.d.ts.map +1 -1
- package/dist/components/ui-dialog.d.ts +3 -0
- package/dist/components/ui-dialog.d.ts.map +1 -1
- package/dist/components/ui-drawer.d.ts +14 -0
- package/dist/components/ui-drawer.d.ts.map +1 -1
- package/dist/components/ui-floating-toolbar.d.ts.map +1 -1
- package/dist/components/ui-icon.d.ts.map +1 -1
- package/dist/components/ui-menu.d.ts +1 -0
- package/dist/components/ui-menu.d.ts.map +1 -1
- package/dist/components/ui-menubar.d.ts +1 -0
- package/dist/components/ui-menubar.d.ts.map +1 -1
- package/dist/components/ui-quick-actions.d.ts.map +1 -1
- package/dist/components/ui-radio.d.ts +47 -0
- package/dist/components/ui-radio.d.ts.map +1 -0
- package/dist/components/ui-select.d.ts +8 -0
- package/dist/components/ui-select.d.ts.map +1 -1
- package/dist/components/ui-selection-popup.d.ts.map +1 -1
- package/dist/components/ui-split-button.d.ts +2 -0
- package/dist/components/ui-split-button.d.ts.map +1 -1
- package/dist/components/ui-stepper.d.ts.map +1 -1
- package/dist/components/ui-time-picker.d.ts +3 -0
- package/dist/components/ui-time-picker.d.ts.map +1 -1
- package/dist/context-menu.cjs.js +2 -2
- package/dist/context-menu.esm.js +2 -2
- package/dist/date-field.cjs.js +1 -1
- package/dist/date-field.esm.js +2 -2
- package/dist/date-picker.cjs.js +13 -13
- package/dist/date-picker.esm.js +100 -67
- package/dist/date-range-picker.cjs.js +14 -14
- package/dist/date-range-picker.esm.js +98 -65
- package/dist/date-range-time-picker.cjs.js +13 -13
- package/dist/date-range-time-picker.esm.js +76 -45
- package/dist/date-time-picker.cjs.js +13 -13
- package/dist/date-time-picker.esm.js +132 -101
- package/dist/date-time-utils-378ecc21.js +1 -0
- package/dist/{date-time-utils-bdceb7af.mjs → date-time-utils-a8b17ea7.mjs} +128 -102
- package/dist/dialog.cjs.js +29 -20
- package/dist/dialog.esm.js +90 -70
- package/dist/drawer.cjs.js +16 -16
- package/dist/drawer.esm.js +216 -98
- package/dist/floating-toolbar.cjs.js +3 -13
- package/dist/floating-toolbar.esm.js +17 -27
- package/dist/hover-card.cjs.js +1 -1
- package/dist/hover-card.esm.js +1 -1
- package/dist/{icon-eaa486b3.js → icon-9e9da03b.js} +4 -4
- package/dist/{icon-9ed13093.mjs → icon-e2a85cc1.mjs} +22 -18
- package/dist/icon.cjs.js +1 -1
- package/dist/icon.esm.js +1 -1
- package/dist/icons.d.ts +1 -1
- package/dist/icons.d.ts.map +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +246 -244
- package/dist/menu.cjs.js +2 -2
- package/dist/menu.esm.js +118 -110
- package/dist/menubar.cjs.js +5 -5
- package/dist/menubar.esm.js +83 -78
- package/dist/{overlayManager-ece06517.js → overlayManager-0eda4e08.js} +1 -1
- package/dist/{overlayManager-86454af7.mjs → overlayManager-5bbd4dc3.mjs} +1 -1
- package/dist/popover.cjs.js +1 -1
- package/dist/popover.esm.js +2 -2
- package/dist/{portal-1cf392ca.mjs → portal-9060f7a6.mjs} +7 -7
- package/dist/portal-d9bae456.js +1 -0
- package/dist/{positioner-fbd61bf1.mjs → positioner-16f3cca1.mjs} +16 -16
- package/dist/positioner-43b1c75a.js +1 -0
- package/dist/positioner.cjs.js +1 -1
- package/dist/positioner.esm.js +1 -1
- package/dist/quick-actions.cjs.js +10 -4
- package/dist/quick-actions.esm.js +27 -21
- package/dist/radio.cjs.js +259 -0
- package/dist/radio.esm.js +455 -0
- package/dist/{runtime-5f282bc8.js → runtime-668914fe.js} +1 -1
- package/dist/{runtime-4ac0107b.mjs → runtime-864efe2f.mjs} +1 -1
- package/dist/runtime.cjs.js +1 -1
- package/dist/runtime.esm.js +2 -2
- package/dist/scroll-lock-31da444f.mjs +56 -0
- package/dist/scroll-lock-d7b0df21.js +1 -0
- package/dist/scroll-lock.d.ts.map +1 -1
- package/dist/select.cjs.js +14 -15
- package/dist/select.esm.js +117 -97
- package/dist/selection-popup.cjs.js +4 -7
- package/dist/selection-popup.esm.js +8 -11
- package/dist/split-button.cjs.js +137 -62
- package/dist/split-button.esm.js +235 -145
- package/dist/standalone/radio.d.ts +2 -0
- package/dist/standalone/radio.d.ts.map +1 -0
- package/dist/stepper.cjs.js +19 -50
- package/dist/stepper.esm.js +17 -48
- package/dist/time-field.cjs.js +1 -1
- package/dist/time-field.esm.js +14 -14
- package/dist/time-picker.cjs.js +15 -15
- package/dist/time-picker.esm.js +99 -68
- package/dist/tooltip.cjs.js +1 -1
- package/dist/tooltip.esm.js +1 -1
- package/package.json +2 -2
- package/dist/date-time-utils-5cf58cd0.js +0 -1
- package/dist/portal-d8d7fbca.js +0 -1
- package/dist/positioner-accc6e5f.js +0 -1
- package/dist/scroll-lock-48793569.js +0 -1
- package/dist/scroll-lock-9de6d328.mjs +0 -53
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { E as
|
|
2
|
-
import {
|
|
3
|
-
import { r as J
|
|
4
|
-
import "./
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { E as W } from "./ElementBase-909688f3.mjs";
|
|
2
|
+
import { c as Y } from "./dismissable-layer-9c7e6b58.mjs";
|
|
3
|
+
import { r as J } from "./calendar-2c11b824.mjs";
|
|
4
|
+
import { r as G, e as Q, i as v, s as X, b as tt, f as et, t as it, n as R, d as st, p as F, o as N, a as nt, m as E, j as Z, k as j, q as y, l as rt, c as at } from "./date-time-utils-a8b17ea7.mjs";
|
|
5
|
+
import "./scroll-lock-31da444f.mjs";
|
|
6
|
+
let ot = 0;
|
|
7
|
+
const lt = `
|
|
7
8
|
<svg viewBox="0 0 20 20" class="icon-svg" aria-hidden="true" focusable="false">
|
|
8
9
|
<path d="M6 2a1 1 0 0 1 1 1v1h6V3a1 1 0 1 1 2 0v1h.5A2.5 2.5 0 0 1 18 6.5v9A2.5 2.5 0 0 1 15.5 18h-11A2.5 2.5 0 0 1 2 15.5v-9A2.5 2.5 0 0 1 4.5 4H5V3a1 1 0 0 1 1-1Zm10 7H4v6.5c0 .276.224.5.5.5h11a.5.5 0 0 0 .5-.5V9ZM4.5 6a.5.5 0 0 0-.5.5V7h12v-.5a.5.5 0 0 0-.5-.5h-11Z" fill="currentColor"/>
|
|
9
10
|
</svg>
|
|
10
|
-
`,
|
|
11
|
+
`, dt = `
|
|
11
12
|
<svg viewBox="0 0 20 20" class="icon-svg" aria-hidden="true" focusable="false">
|
|
12
13
|
<path d="M5.23 7.21a.75.75 0 0 1 1.06.02L10 11.12l3.71-3.9a.75.75 0 1 1 1.08 1.04l-4.25 4.47a.75.75 0 0 1-1.08 0L5.2 8.27a.75.75 0 0 1 .02-1.06Z" fill="currentColor"/>
|
|
13
14
|
</svg>
|
|
14
|
-
`,
|
|
15
|
+
`, ut = `
|
|
15
16
|
<svg viewBox="0 0 20 20" class="icon-svg" aria-hidden="true" focusable="false">
|
|
16
17
|
<path d="M5.22 5.22a.75.75 0 0 1 1.06 0L10 8.94l3.72-3.72a.75.75 0 1 1 1.06 1.06L11.06 10l3.72 3.72a.75.75 0 1 1-1.06 1.06L10 11.06l-3.72 3.72a.75.75 0 1 1-1.06-1.06L8.94 10 5.22 6.28a.75.75 0 0 1 0-1.06Z" fill="currentColor"/>
|
|
17
18
|
</svg>
|
|
@@ -19,7 +20,7 @@ const at = `
|
|
|
19
20
|
<svg viewBox="0 0 20 20" class="icon-svg" aria-hidden="true" focusable="false">
|
|
20
21
|
<path d="M10 2a8 8 0 1 1 0 16 8 8 0 0 1 0-16Zm0 1.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13Zm.75 2.75a.75.75 0 0 0-1.5 0v3.88c0 .2.08.4.22.54l2.5 2.5a.75.75 0 1 0 1.06-1.06l-2.28-2.28V6.25Z" fill="currentColor"/>
|
|
21
22
|
</svg>
|
|
22
|
-
`,
|
|
23
|
+
`, ct = `
|
|
23
24
|
:host {
|
|
24
25
|
--ui-dtp-bg: color-mix(in srgb, var(--ui-color-surface, #ffffff) 96%, transparent);
|
|
25
26
|
--ui-dtp-surface: linear-gradient(
|
|
@@ -285,7 +286,7 @@ const at = `
|
|
|
285
286
|
outline-color: Highlight;
|
|
286
287
|
}
|
|
287
288
|
}
|
|
288
|
-
`,
|
|
289
|
+
`, pt = `
|
|
289
290
|
.overlay { position: fixed; z-index: var(--ui-dtp-z, 1600); pointer-events: none; }
|
|
290
291
|
.panel {
|
|
291
292
|
pointer-events: auto;
|
|
@@ -455,15 +456,17 @@ function c(h) {
|
|
|
455
456
|
return h.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
456
457
|
}
|
|
457
458
|
function U(h) {
|
|
458
|
-
const t =
|
|
459
|
+
const t = j(h);
|
|
459
460
|
return t ? { date: t.date, time: t.time } : { date: null, time: null };
|
|
460
461
|
}
|
|
461
462
|
function x(h) {
|
|
462
|
-
return
|
|
463
|
+
return Z(h.date, h.time);
|
|
463
464
|
}
|
|
464
|
-
class
|
|
465
|
+
class ht extends W {
|
|
465
466
|
constructor() {
|
|
466
|
-
super(...arguments), this._value = { date: null, time: null }, this._pending = { date: null, time: null }, this._draft = "", this._inlineError = "", this._open = !1, this._syncing = !1, this._overlay = null, this._releaseScrollLock = null, this._isInitialized = !1, this._hasView = !1, this._restoreFocusEl = null, this._overlayKey = null, this._uid = `ui-dtp-${++
|
|
467
|
+
super(...arguments), this._value = { date: null, time: null }, this._pending = { date: null, time: null }, this._draft = "", this._inlineError = "", this._open = !1, this._syncing = !1, this._overlay = null, this._dismissableLayer = null, this._releaseScrollLock = null, this._isInitialized = !1, this._hasView = !1, this._restoreFocusEl = null, this._overlayKey = null, this._uid = `ui-dtp-${++ot}`, this._inputId = `${this._uid}-input`, this._labelId = `${this._uid}-label`, this._hintId = `${this._uid}-hint`, this._errorId = `${this._uid}-error`, this._panelId = `${this._uid}-panel`, this._schedulePosition = G(() => this._positionOverlay()), this._onRootClickBound = (t) => this._onRootClick(t), this._onRootInputBound = (t) => this._onRootInput(t), this._onRootChangeBound = (t) => this._onRootChange(t), this._onRootBlurBound = (t) => this._onRootBlur(t), this._onRootKeyDownBound = (t) => this._onRootKeyDown(t), this._onOverlayClickBound = (t) => this._onOverlayClick(t), this._onOverlayChangeBound = (t) => this._onOverlayChange(t), this._onOverlayCalendarBound = (t) => this._onOverlayCalendar(t), this._onDocumentPointerDownBound = (t) => this._onDocumentPointerDown(t), this._onDocumentKeyDownBound = (t) => this._onDocumentKeyDown(t), this._onWindowResizeBound = () => this._schedulePosition.run(), this._onWindowScrollBound = (t) => {
|
|
468
|
+
Q(t, [this._overlay]) || this._schedulePosition.run();
|
|
469
|
+
};
|
|
467
470
|
}
|
|
468
471
|
static get observedAttributes() {
|
|
469
472
|
return [
|
|
@@ -520,7 +523,7 @@ class ct extends Y {
|
|
|
520
523
|
return (this.getAttribute("mode") || "popover") === "inline";
|
|
521
524
|
}
|
|
522
525
|
_isMobileSheet() {
|
|
523
|
-
return
|
|
526
|
+
return X(this.getAttribute("mode"));
|
|
524
527
|
}
|
|
525
528
|
_isDisabled() {
|
|
526
529
|
return this.hasAttribute("disabled");
|
|
@@ -554,10 +557,10 @@ class ct extends Y {
|
|
|
554
557
|
return v(this.getAttribute("bare"), !1);
|
|
555
558
|
}
|
|
556
559
|
_locale() {
|
|
557
|
-
return
|
|
560
|
+
return tt(this.getAttribute("locale"));
|
|
558
561
|
}
|
|
559
562
|
_translations() {
|
|
560
|
-
return
|
|
563
|
+
return J(
|
|
561
564
|
this.getAttribute("locale"),
|
|
562
565
|
this.getAttribute("translations")
|
|
563
566
|
);
|
|
@@ -569,24 +572,24 @@ class ct extends Y {
|
|
|
569
572
|
_formatDisplay(t) {
|
|
570
573
|
if (!t.date || !t.time)
|
|
571
574
|
return "";
|
|
572
|
-
const e =
|
|
573
|
-
return this._is12h() ? `${e} ${
|
|
575
|
+
const e = et(t.date, this._locale(), "locale", null);
|
|
576
|
+
return this._is12h() ? `${e} ${it(t.time, this._locale())}` : `${e} ${t.time}`;
|
|
574
577
|
}
|
|
575
578
|
_is12h() {
|
|
576
579
|
return (this.getAttribute("format") || "24h") === "12h";
|
|
577
580
|
}
|
|
578
581
|
_parseDateInput(t) {
|
|
579
|
-
const e =
|
|
582
|
+
const e = R(t);
|
|
580
583
|
if (e)
|
|
581
584
|
return e;
|
|
582
|
-
const i =
|
|
585
|
+
const i = st(t, this._locale());
|
|
583
586
|
if (i)
|
|
584
587
|
return i;
|
|
585
|
-
const
|
|
586
|
-
if (!Number.isFinite(
|
|
588
|
+
const s = new Date(t);
|
|
589
|
+
if (!Number.isFinite(s.getTime()))
|
|
587
590
|
return null;
|
|
588
|
-
const a =
|
|
589
|
-
return `${a}-${o}-${
|
|
591
|
+
const a = s.getFullYear(), o = String(s.getMonth() + 1).padStart(2, "0"), n = String(s.getDate()).padStart(2, "0");
|
|
592
|
+
return `${a}-${o}-${n}`;
|
|
590
593
|
}
|
|
591
594
|
_syncOpenAttribute(t) {
|
|
592
595
|
this._syncing = !0;
|
|
@@ -645,16 +648,16 @@ class ct extends Y {
|
|
|
645
648
|
_clampState(t) {
|
|
646
649
|
if (!t.date)
|
|
647
650
|
return { date: null, time: t.time };
|
|
648
|
-
const e = this._minDate(), i = this._maxDate(),
|
|
649
|
-
let o = this._minDateTime(),
|
|
650
|
-
if (o &&
|
|
651
|
+
const e = this._minDate(), i = this._maxDate(), s = nt(t.date, e, i), a = t.time || "00:00";
|
|
652
|
+
let o = this._minDateTime(), n = this._maxDateTime();
|
|
653
|
+
if (o && n && E(o, n) > 0) {
|
|
651
654
|
const b = o;
|
|
652
|
-
o =
|
|
655
|
+
o = n, n = b;
|
|
653
656
|
}
|
|
654
|
-
let r =
|
|
655
|
-
o &&
|
|
656
|
-
const d =
|
|
657
|
-
return d ? { date: d.date, time: d.time } : { date:
|
|
657
|
+
let r = Z(s, a) || `${s}T00:00`;
|
|
658
|
+
o && E(r, o) < 0 && (r = o), n && E(r, n) > 0 && (r = n);
|
|
659
|
+
const d = j(r);
|
|
660
|
+
return d ? { date: d.date, time: d.time } : { date: s, time: a };
|
|
658
661
|
}
|
|
659
662
|
_commit(t, e) {
|
|
660
663
|
if (this._isInteractionBlocked() || this._isReadonly())
|
|
@@ -663,15 +666,15 @@ class ct extends Y {
|
|
|
663
666
|
this._value = { date: null, time: null }, this._pending = { date: null, time: null }, this._draft = "", this._inlineError = "", this._syncValueAttribute(this._value), this._emitInput(e), this._emitChange(e), this._updateHostState();
|
|
664
667
|
return;
|
|
665
668
|
}
|
|
666
|
-
const i = y(t.time || "", !0),
|
|
667
|
-
date:
|
|
669
|
+
const i = y(t.time || "", !0), s = this._clampState({
|
|
670
|
+
date: R(t.date),
|
|
668
671
|
time: i ? `${p(i.hours)}:${p(i.minutes)}` : null
|
|
669
672
|
});
|
|
670
|
-
if (!
|
|
673
|
+
if (!s.date || !s.time) {
|
|
671
674
|
this._inlineError = this.getAttribute("error") || this._translations().invalidDateTime, this._emitInvalid(JSON.stringify(t), "parse"), this._updateHostState();
|
|
672
675
|
return;
|
|
673
676
|
}
|
|
674
|
-
this._value =
|
|
677
|
+
this._value = s, this._pending = { ...s }, this._draft = this._formatDisplay(s), this._inlineError = "", this._syncValueAttribute(this._value), this._emitInput(e), this._emitChange(e), this._updateHostState();
|
|
675
678
|
}
|
|
676
679
|
_setOpen(t, e) {
|
|
677
680
|
t && this._isInteractionBlocked() || this._open !== t && (this._open = t, this._syncOpenAttribute(t), this._syncOverlay(e), this._updateHostState(), this.dispatchEvent(new CustomEvent(t ? "open" : "close", { bubbles: !0, composed: !0 })));
|
|
@@ -697,10 +700,31 @@ class ct extends Y {
|
|
|
697
700
|
if (this._overlay || typeof document > "u")
|
|
698
701
|
return;
|
|
699
702
|
const t = document.createElement("div");
|
|
700
|
-
t.style.position = "fixed", t.style.left = "0", t.style.top = "0", t.style.
|
|
703
|
+
t.style.position = "fixed", t.style.left = "0", t.style.top = "0", t.style.pointerEvents = "none", t.addEventListener("click", this._onOverlayClickBound), t.addEventListener("change", this._onOverlayChangeBound), t.addEventListener("change", this._onOverlayCalendarBound), t.addEventListener("select", this._onOverlayCalendarBound), document.body.appendChild(t), this._overlay = t, this._syncOverlayHostZIndex(), document.addEventListener("pointerdown", this._onDocumentPointerDownBound, !0), document.addEventListener("keydown", this._onDocumentKeyDownBound), window.addEventListener("resize", this._onWindowResizeBound), window.addEventListener("scroll", this._onWindowScrollBound, { passive: !0, capture: !0 }), this._isMobileSheet() && (this._releaseScrollLock = rt());
|
|
704
|
+
}
|
|
705
|
+
_syncOverlayHostZIndex() {
|
|
706
|
+
if (!this._overlay || typeof window > "u")
|
|
707
|
+
return;
|
|
708
|
+
const t = window.getComputedStyle(this).getPropertyValue("--ui-dtp-z").trim();
|
|
709
|
+
this._overlay.style.zIndex = t || "1600";
|
|
701
710
|
}
|
|
702
711
|
_destroyOverlay() {
|
|
703
|
-
|
|
712
|
+
var t;
|
|
713
|
+
(t = this._dismissableLayer) == null || t.destroy(), this._dismissableLayer = null, this._overlay && (this._schedulePosition.cancel(), document.removeEventListener("pointerdown", this._onDocumentPointerDownBound, !0), document.removeEventListener("keydown", this._onDocumentKeyDownBound), window.removeEventListener("resize", this._onWindowResizeBound), window.removeEventListener("scroll", this._onWindowScrollBound, !0), this._overlay.removeEventListener("click", this._onOverlayClickBound), this._overlay.removeEventListener("change", this._onOverlayChangeBound), this._overlay.removeEventListener("change", this._onOverlayCalendarBound), this._overlay.removeEventListener("select", this._onOverlayCalendarBound), this._overlay.parentElement && this._overlay.parentElement.removeChild(this._overlay), this._overlay = null, this._overlayKey = null, this._releaseScrollLock && (this._releaseScrollLock(), this._releaseScrollLock = null));
|
|
714
|
+
}
|
|
715
|
+
_syncDismissableLayer() {
|
|
716
|
+
var i;
|
|
717
|
+
if ((i = this._dismissableLayer) == null || i.destroy(), this._dismissableLayer = null, !this._open || !this._overlay)
|
|
718
|
+
return;
|
|
719
|
+
const t = this._overlay.querySelector(".panel, .sheet"), e = this.root.querySelector(".field");
|
|
720
|
+
t && (this._dismissableLayer = Y({
|
|
721
|
+
node: t,
|
|
722
|
+
trigger: e,
|
|
723
|
+
closeOnEscape: !0,
|
|
724
|
+
closeOnPointerOutside: !0,
|
|
725
|
+
closeOnFocusOutside: !1,
|
|
726
|
+
onBeforeDismiss: (s) => s === "escape-key" ? (this._setOpen(!1, "escape"), !1) : (s === "outside-pointer" && this._setOpen(!1, "outside"), !1)
|
|
727
|
+
}));
|
|
704
728
|
}
|
|
705
729
|
_positionOverlay() {
|
|
706
730
|
if (!this._overlay || !this._open || this._isMobileSheet())
|
|
@@ -708,21 +732,27 @@ class ct extends Y {
|
|
|
708
732
|
const t = this.root.querySelector(".field"), e = this._overlay.querySelector(".panel");
|
|
709
733
|
if (!t || !e)
|
|
710
734
|
return;
|
|
711
|
-
const i =
|
|
712
|
-
|
|
735
|
+
const i = e.getAttribute("data-placement"), s = at(
|
|
736
|
+
t.getBoundingClientRect(),
|
|
737
|
+
e.getBoundingClientRect(),
|
|
738
|
+
8,
|
|
739
|
+
8,
|
|
740
|
+
i === "top" ? "top" : i === "bottom" ? "bottom" : null
|
|
741
|
+
);
|
|
742
|
+
e.style.position = "absolute", e.style.top = `${Math.round(s.top)}px`, e.style.left = `${Math.round(s.left)}px`, e.setAttribute("data-placement", s.placement);
|
|
713
743
|
}
|
|
714
744
|
_timeOptions() {
|
|
715
|
-
const t = y(this._pending.time || "00:00", !0) || { hours: 0, minutes: 0, seconds: 0 }, e = this._minuteStep(), i = this._is12h() ? Array.from({ length: 12 }, (o,
|
|
716
|
-
const r =
|
|
745
|
+
const t = y(this._pending.time || "00:00", !0) || { hours: 0, minutes: 0, seconds: 0 }, e = this._minuteStep(), i = this._is12h() ? Array.from({ length: 12 }, (o, n) => {
|
|
746
|
+
const r = n + 1, d = t.hours % 12 || 12;
|
|
717
747
|
return `<option value="${r}" ${r === d ? "selected" : ""}>${p(r)}</option>`;
|
|
718
|
-
}).join("") : Array.from({ length: 24 }, (o,
|
|
719
|
-
const r = Math.min(59,
|
|
748
|
+
}).join("") : Array.from({ length: 24 }, (o, n) => `<option value="${n}" ${n === t.hours ? "selected" : ""}>${p(n)}</option>`).join(""), s = Array.from({ length: Math.ceil(60 / e) }, (o, n) => {
|
|
749
|
+
const r = Math.min(59, n * e);
|
|
720
750
|
return `<option value="${r}" ${r === t.minutes ? "selected" : ""}>${p(r)}</option>`;
|
|
721
751
|
}).join(""), a = t.hours >= 12 ? "pm" : "am";
|
|
722
|
-
return { hours: i, minutes:
|
|
752
|
+
return { hours: i, minutes: s, meridiem: a };
|
|
723
753
|
}
|
|
724
754
|
_renderSurfaceInner(t, e = !1) {
|
|
725
|
-
const i = this._translations(),
|
|
755
|
+
const i = this._translations(), s = this._timeOptions(), a = (this.getAttribute("label") || "").trim(), o = c(a), n = c(a || i.selectDate), r = this._pending.date && this._pending.time ? this._formatDisplay(this._pending) : "", d = `
|
|
726
756
|
<header class="head">
|
|
727
757
|
<div>
|
|
728
758
|
<p class="head-title" ${a ? "" : "hidden"}>${o}</p>
|
|
@@ -734,9 +764,9 @@ class ct extends Y {
|
|
|
734
764
|
<section class="time-panel" part="time">
|
|
735
765
|
<span class="icon" aria-hidden="true">${K}</span>
|
|
736
766
|
<div class="time-grid" data-meridiem="${this._is12h() ? "true" : "false"}">
|
|
737
|
-
<div><label>${c(i.hour)}</label><select data-segment="hours">${
|
|
738
|
-
<div><label>${c(i.minute)}</label><select data-segment="minutes">${
|
|
739
|
-
${this._is12h() ? `<div><label>${c(i.meridiem)}</label><select data-segment="meridiem"><option value="am" ${
|
|
767
|
+
<div><label>${c(i.hour)}</label><select data-segment="hours">${s.hours}</select></div>
|
|
768
|
+
<div><label>${c(i.minute)}</label><select data-segment="minutes">${s.minutes}</select></div>
|
|
769
|
+
${this._is12h() ? `<div><label>${c(i.meridiem)}</label><select data-segment="meridiem"><option value="am" ${s.meridiem === "am" ? "selected" : ""}>${c(i.am)}</option><option value="pm" ${s.meridiem === "pm" ? "selected" : ""}>${c(i.pm)}</option></select></div>` : ""}
|
|
740
770
|
</div>
|
|
741
771
|
</section>
|
|
742
772
|
</div>
|
|
@@ -748,20 +778,20 @@ class ct extends Y {
|
|
|
748
778
|
</footer>
|
|
749
779
|
`;
|
|
750
780
|
return e ? d : `
|
|
751
|
-
<style>${
|
|
781
|
+
<style>${pt}</style>
|
|
752
782
|
${t ? '<div class="sheet-backdrop" data-action="backdrop"></div>' : ""}
|
|
753
|
-
<section class="${t ? "sheet" : "panel"}" id="${this._panelId}" role="dialog" aria-modal="${t ? "true" : "false"}" aria-label="${
|
|
783
|
+
<section class="${t ? "sheet" : "panel"}" id="${this._panelId}" role="dialog" aria-modal="${t ? "true" : "false"}" aria-label="${n}" part="${t ? "sheet" : "popover"}">${d}</section>
|
|
754
784
|
`;
|
|
755
785
|
}
|
|
756
786
|
_syncCalendar(t) {
|
|
757
|
-
const e = (
|
|
787
|
+
const e = (n, r) => {
|
|
758
788
|
if (r == null || r === "") {
|
|
759
|
-
t.hasAttribute(
|
|
789
|
+
t.hasAttribute(n) && t.removeAttribute(n);
|
|
760
790
|
return;
|
|
761
791
|
}
|
|
762
|
-
t.getAttribute(
|
|
763
|
-
}, i = (
|
|
764
|
-
r ? e(
|
|
792
|
+
t.getAttribute(n) !== r && t.setAttribute(n, r);
|
|
793
|
+
}, i = (n, r) => {
|
|
794
|
+
r ? e(n, "") : e(n, null);
|
|
765
795
|
};
|
|
766
796
|
e("selection", "single"), e("value", this._pending.date), e("min", this.getAttribute("min")), e("max", this.getAttribute("max")), e("locale", this.getAttribute("locale")), e("translations", this.getAttribute("translations")), e("week-start", this.getAttribute("week-start"));
|
|
767
797
|
const a = this.getAttribute("size") || "sm", o = t.classList.contains("dt-calendar-inline");
|
|
@@ -786,20 +816,21 @@ class ct extends Y {
|
|
|
786
816
|
const i = Array.from(t.options).map((o) => Number(o.value)).filter((o) => Number.isFinite(o));
|
|
787
817
|
if (!i.length)
|
|
788
818
|
return;
|
|
789
|
-
let
|
|
819
|
+
let s = i[0], a = Math.abs(s - e);
|
|
790
820
|
for (let o = 1; o < i.length; o += 1) {
|
|
791
|
-
const
|
|
792
|
-
r < a && (
|
|
821
|
+
const n = i[o], r = Math.abs(n - e);
|
|
822
|
+
r < a && (s = n, a = r);
|
|
793
823
|
}
|
|
794
|
-
t.value = String(
|
|
824
|
+
t.value = String(s);
|
|
795
825
|
}
|
|
796
826
|
_syncOverlayState() {
|
|
797
827
|
if (!this._overlay)
|
|
798
828
|
return;
|
|
829
|
+
this._syncOverlayHostZIndex();
|
|
799
830
|
const t = this._isMobileSheet();
|
|
800
|
-
this._ensureOverlayContent(t);
|
|
801
|
-
const e = this._translations(), i = this._overlay.querySelector(".panel, .sheet"),
|
|
802
|
-
i && (i.dataset.bare = this._isBare() ? "true" : "false"),
|
|
831
|
+
this._ensureOverlayContent(t), this._syncDismissableLayer();
|
|
832
|
+
const e = this._translations(), i = this._overlay.querySelector(".panel, .sheet"), s = this._overlay.querySelector(".footer");
|
|
833
|
+
i && (i.dataset.bare = this._isBare() ? "true" : "false"), s && (s.hidden = !this._showFooter());
|
|
803
834
|
const a = this._overlay.querySelector(".head-title");
|
|
804
835
|
if (a) {
|
|
805
836
|
const l = (this.getAttribute("label") || "").trim();
|
|
@@ -807,8 +838,8 @@ class ct extends Y {
|
|
|
807
838
|
}
|
|
808
839
|
const o = this._overlay.querySelector(".head-meta");
|
|
809
840
|
o && (o.textContent = this._pending.date && this._pending.time ? this._formatDisplay(this._pending) : e.selectDate);
|
|
810
|
-
const
|
|
811
|
-
|
|
841
|
+
const n = this._overlay.querySelector(".dt-calendar");
|
|
842
|
+
n && this._syncCalendar(n);
|
|
812
843
|
const r = y(this._pending.time || "00:00", !0) || { hours: 0, minutes: 0, seconds: 0 }, d = this._overlay.querySelector('select[data-segment="hours"]'), b = this._overlay.querySelector('select[data-segment="minutes"]'), m = this._overlay.querySelector('select[data-segment="meridiem"]');
|
|
813
844
|
if (d) {
|
|
814
845
|
const l = this._is12h() ? r.hours % 12 || 12 : r.hours;
|
|
@@ -824,28 +855,28 @@ class ct extends Y {
|
|
|
824
855
|
this._syncOverlayState();
|
|
825
856
|
}
|
|
826
857
|
_applyTimeFromSurface(t) {
|
|
827
|
-
const e = t.querySelector('select[data-segment="hours"]'), i = t.querySelector('select[data-segment="minutes"]'),
|
|
858
|
+
const e = t.querySelector('select[data-segment="hours"]'), i = t.querySelector('select[data-segment="minutes"]'), s = t.querySelector('select[data-segment="meridiem"]');
|
|
828
859
|
if (!e || !i)
|
|
829
860
|
return;
|
|
830
861
|
const a = Number(e.value), o = Number(i.value);
|
|
831
862
|
if (!Number.isFinite(a) || !Number.isFinite(o))
|
|
832
863
|
return;
|
|
833
|
-
let
|
|
864
|
+
let n = a;
|
|
834
865
|
if (this._is12h()) {
|
|
835
|
-
const r = (
|
|
836
|
-
r === "pm" &&
|
|
866
|
+
const r = (s == null ? void 0 : s.value) === "pm" ? "pm" : "am";
|
|
867
|
+
r === "pm" && n < 12 && (n += 12), r === "am" && n === 12 && (n = 0);
|
|
837
868
|
}
|
|
838
869
|
this._pending = this._clampState({
|
|
839
870
|
date: this._pending.date,
|
|
840
|
-
time: `${p(
|
|
871
|
+
time: `${p(n)}:${p(o)}`
|
|
841
872
|
}), this._emitInput("time");
|
|
842
873
|
}
|
|
843
874
|
_onRootClick(t) {
|
|
844
|
-
var
|
|
875
|
+
var s;
|
|
845
876
|
const e = t.target;
|
|
846
877
|
if (!e)
|
|
847
878
|
return;
|
|
848
|
-
const i = (
|
|
879
|
+
const i = (s = e.closest("[data-action]")) == null ? void 0 : s.getAttribute("data-action");
|
|
849
880
|
if (i && !(this._isInteractionBlocked() || this._isReadonly())) {
|
|
850
881
|
if (i === "toggle") {
|
|
851
882
|
this._restoreFocusEl = e, this._setOpen(!this._open, "toggle");
|
|
@@ -856,7 +887,7 @@ class ct extends Y {
|
|
|
856
887
|
return;
|
|
857
888
|
}
|
|
858
889
|
if (this._isInlineMode() && i === "now") {
|
|
859
|
-
const a = /* @__PURE__ */ new Date(), o = String(a.getMonth() + 1).padStart(2, "0"),
|
|
890
|
+
const a = /* @__PURE__ */ new Date(), o = String(a.getMonth() + 1).padStart(2, "0"), n = String(a.getDate()).padStart(2, "0"), r = `${a.getFullYear()}-${o}-${n}`, d = `${p(a.getHours())}:${p(a.getMinutes())}`;
|
|
860
891
|
this._pending = this._clampState({ date: r, time: d }), this._emitInput("now"), this._updateHostState();
|
|
861
892
|
return;
|
|
862
893
|
}
|
|
@@ -903,12 +934,12 @@ class ct extends Y {
|
|
|
903
934
|
this._commit({ date: null, time: null }, "blur");
|
|
904
935
|
return;
|
|
905
936
|
}
|
|
906
|
-
const
|
|
907
|
-
if (!
|
|
937
|
+
const s = /^(.+)\s+(\d{1,2}:\d{2}(?::\d{2})?(?:\s?[ap]m)?)$/i.exec(i);
|
|
938
|
+
if (!s) {
|
|
908
939
|
this._inlineError = this.getAttribute("error") || this._translations().invalidDateTime, this._emitInvalid(i, "parse"), this._updateHostState();
|
|
909
940
|
return;
|
|
910
941
|
}
|
|
911
|
-
const a = this._parseDateInput(
|
|
942
|
+
const a = this._parseDateInput(s[1]), o = y(s[2], !0) ? s[2] : null;
|
|
912
943
|
if (!a || !o) {
|
|
913
944
|
this._inlineError = this.getAttribute("error") || this._translations().invalidDateTime, this._emitInvalid(i, "parse"), this._updateHostState();
|
|
914
945
|
return;
|
|
@@ -926,11 +957,11 @@ class ct extends Y {
|
|
|
926
957
|
}
|
|
927
958
|
}
|
|
928
959
|
_onOverlayClick(t) {
|
|
929
|
-
var
|
|
960
|
+
var s;
|
|
930
961
|
const e = t.target;
|
|
931
962
|
if (!e)
|
|
932
963
|
return;
|
|
933
|
-
const i = (
|
|
964
|
+
const i = (s = e.closest("[data-action]")) == null ? void 0 : s.getAttribute("data-action");
|
|
934
965
|
if (i && !this._isInteractionBlocked() && !(this._isReadonly() && i !== "toggle")) {
|
|
935
966
|
if (i === "backdrop") {
|
|
936
967
|
this._setOpen(!1, "outside");
|
|
@@ -945,7 +976,7 @@ class ct extends Y {
|
|
|
945
976
|
return;
|
|
946
977
|
}
|
|
947
978
|
if (i === "now") {
|
|
948
|
-
const a = /* @__PURE__ */ new Date(), o = String(a.getMonth() + 1).padStart(2, "0"),
|
|
979
|
+
const a = /* @__PURE__ */ new Date(), o = String(a.getMonth() + 1).padStart(2, "0"), n = String(a.getDate()).padStart(2, "0"), r = `${a.getFullYear()}-${o}-${n}`, d = `${p(a.getHours())}:${p(a.getMinutes())}`;
|
|
949
980
|
this._pending = this._clampState({ date: r, time: d }), this._emitInput("now"), this._renderOverlay();
|
|
950
981
|
return;
|
|
951
982
|
}
|
|
@@ -962,7 +993,7 @@ class ct extends Y {
|
|
|
962
993
|
const e = t.target;
|
|
963
994
|
if (!e || e.tagName.toLowerCase() !== "ui-calendar")
|
|
964
995
|
return;
|
|
965
|
-
const i = t.type,
|
|
996
|
+
const i = t.type, s = t.detail, a = R(i === "select" ? (s == null ? void 0 : s.value) || null : s == null ? void 0 : s.value);
|
|
966
997
|
if (a) {
|
|
967
998
|
if (this._pending = this._clampState({ date: a, time: this._pending.time || "09:00" }), this._emitInput("calendar"), this._shouldAutoCommit() && this._pending.time) {
|
|
968
999
|
this._commit(this._pending, "calendar"), this._setOpen(!1, "calendar");
|
|
@@ -983,23 +1014,23 @@ class ct extends Y {
|
|
|
983
1014
|
_updateHostState() {
|
|
984
1015
|
if (!this._hasView)
|
|
985
1016
|
return;
|
|
986
|
-
const t = this.getAttribute("label") || "", e = this.getAttribute("hint") || "", i = this.getAttribute("error") || "",
|
|
1017
|
+
const t = this.getAttribute("label") || "", e = this.getAttribute("hint") || "", i = this.getAttribute("error") || "", s = this._inlineError || i, a = !!x(this._value), o = this.getAttribute("name") || "", n = this._allowInput() ? this._draft : this._formatDisplay(this._value), r = this._isInlineMode(), d = this._translations(), b = s ? "error" : this._state();
|
|
987
1018
|
this._state() === "loading" ? this.setAttribute("aria-busy", "true") : this.removeAttribute("aria-busy");
|
|
988
|
-
const m = this.root.querySelector(".label"), S = this.root.querySelector(".label-text"),
|
|
989
|
-
if (m && (m.hidden = !t), m && (m.id = this._labelId, m.setAttribute("for", this._inputId)), S && (S.textContent = t),
|
|
1019
|
+
const m = this.root.querySelector(".label"), S = this.root.querySelector(".label-text"), D = this.root.querySelector(".required"), l = this.root.querySelector(".input"), I = this.root.querySelector('.btn[data-action="clear"]'), f = this.root.querySelector('.btn[data-action="toggle"]'), g = this.root.querySelector(".hint"), w = this.root.querySelector(".error"), k = this.root.querySelector(".hidden-input");
|
|
1020
|
+
if (m && (m.hidden = !t), m && (m.id = this._labelId, m.setAttribute("for", this._inputId)), S && (S.textContent = t), D && (D.hidden = !this.hasAttribute("required")), l && (l.value !== n && (l.value = n), l.id = this._inputId, l.placeholder = d.dateTimePlaceholder, l.readOnly = !this._allowInput() || this._isReadonly(), l.disabled = this._isInteractionBlocked(), l.required = this.hasAttribute("required"), l.autocomplete = "off", l.setAttribute("role", "combobox"), l.setAttribute("aria-haspopup", "dialog"), l.setAttribute("aria-expanded", r ? "false" : String(this._open)), l.setAttribute("aria-controls", this._panelId), l.setAttribute("aria-invalid", s ? "true" : "false"), t ? l.setAttribute("aria-labelledby", this._labelId) : l.removeAttribute("aria-labelledby")), I && (I.hidden = !(this._clearable() && a), I.setAttribute("aria-label", d.clear), I.disabled = this._isInteractionBlocked()), f && (f.hidden = r, f.setAttribute("aria-label", d.toggleCalendar), f.setAttribute("aria-expanded", r ? "false" : String(this._open)), f.setAttribute("aria-controls", this._panelId), f.disabled = this._isInteractionBlocked()), g && (g.id = this._hintId, g.hidden = !e, g.textContent = e), w && (w.id = this._errorId, w.hidden = !s, w.textContent = s), l) {
|
|
990
1021
|
const _ = [];
|
|
991
|
-
e && g && !g.hidden && _.push(this._hintId),
|
|
1022
|
+
e && g && !g.hidden && _.push(this._hintId), s && _.push(this._errorId), _.length ? l.setAttribute("aria-describedby", _.join(" ")) : l.removeAttribute("aria-describedby");
|
|
992
1023
|
}
|
|
993
1024
|
k && (k.disabled = !o, k.name = o, k.value = x(this._value) || "");
|
|
994
|
-
const
|
|
995
|
-
|
|
1025
|
+
const A = this.root.querySelector(".field");
|
|
1026
|
+
A && (A.dataset.open = this._open && !r ? "true" : "false", A.dataset.invalid = s ? "true" : "false", A.dataset.state = b);
|
|
996
1027
|
const u = this.root.querySelector(".inline-panel");
|
|
997
1028
|
if (u) {
|
|
998
1029
|
u.hidden = !r, u.id = this._panelId, u.dataset.bare = this._isBare() ? "true" : "false", u.setAttribute("role", "dialog"), u.setAttribute("aria-modal", "false"), u.setAttribute("aria-label", t || d.selectDate);
|
|
999
1030
|
const _ = u.querySelector(".panel-title");
|
|
1000
1031
|
_ && (_.textContent = t, _.hidden = !t);
|
|
1001
|
-
const
|
|
1002
|
-
|
|
1032
|
+
const $ = u.querySelector(".head-title");
|
|
1033
|
+
$ && ($.textContent = t, $.hidden = !t);
|
|
1003
1034
|
const q = u.querySelector(".head-meta");
|
|
1004
1035
|
q && (q.textContent = this._pending.date && this._pending.time ? this._formatDisplay(this._pending) : d.selectDate);
|
|
1005
1036
|
const T = u.querySelector('[data-action="now"]');
|
|
@@ -1012,13 +1043,13 @@ class ct extends Y {
|
|
|
1012
1043
|
H && (H.hidden = !this._showFooter());
|
|
1013
1044
|
const V = u.querySelector(".dt-calendar-inline");
|
|
1014
1045
|
V && this._syncCalendar(V);
|
|
1015
|
-
const
|
|
1016
|
-
if (
|
|
1017
|
-
const
|
|
1018
|
-
this._setClosestOptionValue(
|
|
1046
|
+
const O = u.querySelector('select[data-segment="hours"]'), B = u.querySelector('select[data-segment="minutes"]'), z = u.querySelector('select[data-segment="meridiem"]'), C = y(this._pending.time || "00:00", !0) || { hours: 0, minutes: 0, seconds: 0 };
|
|
1047
|
+
if (O) {
|
|
1048
|
+
const L = this._is12h() ? C.hours % 12 || 12 : C.hours;
|
|
1049
|
+
this._setClosestOptionValue(O, L), O.disabled = this._isInteractionBlocked() || this._isReadonly();
|
|
1019
1050
|
}
|
|
1020
|
-
|
|
1021
|
-
|
|
1051
|
+
B && (this._setClosestOptionValue(B, C.minutes), B.disabled = this._isInteractionBlocked() || this._isReadonly()), z && (z.value = C.hours >= 12 ? "pm" : "am", z.disabled = this._isInteractionBlocked() || this._isReadonly()), u.querySelectorAll(".action").forEach((L) => {
|
|
1052
|
+
L.disabled = this._isInteractionBlocked() || this._isReadonly();
|
|
1022
1053
|
});
|
|
1023
1054
|
}
|
|
1024
1055
|
!r && this._open && this._syncOverlayState(), r && this._destroyOverlay();
|
|
@@ -1027,18 +1058,18 @@ class ct extends Y {
|
|
|
1027
1058
|
if (!this._hasView) {
|
|
1028
1059
|
const t = this._translations();
|
|
1029
1060
|
this.setContent(`
|
|
1030
|
-
<style>${
|
|
1061
|
+
<style>${ct}</style>
|
|
1031
1062
|
<div class="root">
|
|
1032
1063
|
<label class="label" part="label" id="${this._labelId}">
|
|
1033
1064
|
<span class="label-text"></span>
|
|
1034
1065
|
<span class="required">*</span>
|
|
1035
1066
|
</label>
|
|
1036
1067
|
<div class="field" part="field input">
|
|
1037
|
-
<span class="icon" part="icon">${
|
|
1068
|
+
<span class="icon" part="icon">${lt}</span>
|
|
1038
1069
|
<input class="input" id="${this._inputId}" part="input" />
|
|
1039
1070
|
<span class="icon" part="icon">${K}</span>
|
|
1040
|
-
<button type="button" class="btn" part="clear" data-action="clear">${
|
|
1041
|
-
<button type="button" class="btn" part="toggle" data-action="toggle">${
|
|
1071
|
+
<button type="button" class="btn" part="clear" data-action="clear">${ut}</button>
|
|
1072
|
+
<button type="button" class="btn" part="toggle" data-action="toggle">${dt}</button>
|
|
1042
1073
|
</div>
|
|
1043
1074
|
<div class="hint" id="${this._hintId}" part="hint"></div>
|
|
1044
1075
|
<div class="error" id="${this._errorId}" part="error" role="alert"></div>
|
|
@@ -1056,7 +1087,7 @@ class ct extends Y {
|
|
|
1056
1087
|
return !1;
|
|
1057
1088
|
}
|
|
1058
1089
|
}
|
|
1059
|
-
typeof customElements < "u" && !customElements.get("ui-date-time-picker") && customElements.define("ui-date-time-picker",
|
|
1090
|
+
typeof customElements < "u" && !customElements.get("ui-date-time-picker") && customElements.define("ui-date-time-picker", ht);
|
|
1060
1091
|
export {
|
|
1061
|
-
|
|
1092
|
+
ht as UIDateTimePicker
|
|
1062
1093
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const l=require("./calendar-a8735e40.js"),U=require("./scroll-lock-d7b0df21.js"),C=new Map,F=24;function w(t,e,n){return Math.max(e,Math.min(n,t))}function u(t){return String(t).padStart(2,"0")}function b(t){if(!/^-?\d+$/.test(t))return null;const e=Number(t);return Number.isFinite(e)?Math.trunc(e):null}function z(t){return t.replace(/[.\-]/g,"/").replace(/\s+/g," ").trim()}function A(t){const e=[];for(let n=0;n<12;n+=1)e.push(new Intl.DateTimeFormat(t,{month:"short",timeZone:"UTC"}).format(new Date(Date.UTC(2024,n,1))));return e}function P(t){const e=[];for(let n=0;n<12;n+=1)e.push(new Intl.DateTimeFormat(t,{month:"long",timeZone:"UTC"}).format(new Date(Date.UTC(2024,n,1))));return e}function Y(t,e=!1){if(t==null)return e;const n=t.trim().toLowerCase();return n?n!=="false"&&n!=="0"&&n!=="off"&&n!=="no":!0}function k(t,e){const n=typeof t.composedPath=="function"?t.composedPath():[];for(const o of e)if(o&&n.includes(o))return!0;const r=t.target;if(!(r instanceof Node))return!1;for(const o of e)if(o instanceof Node&&o.contains(r))return!0;return!1}function B(t){const e=(t||"").trim();return e||(typeof navigator<"u"&&navigator.language?navigator.language:"en-US")}function m(t){if(!t)return null;const e=l.parseISO(t);return e?`${e.y}-${u(e.m)}-${u(e.d)}`:null}function y(t){if(!t)return null;const e=/^(\d{4}-\d{2}-\d{2})[T ](\d{1,2}:\d{2}(?::\d{2})?)$/.exec(t.trim());if(!e)return null;const n=m(e[1]);if(!n)return null;const r=T(e[2],!0);if(!r)return null;const o=e[2].split(":").length===3;return{date:n,time:M(r,o)}}function W(t,e){if(!t||!e)return null;const n=m(t),r=T(e,!0);return!n||!r?null:`${n}T${M(r,e.split(":").length>=3)}`}function q(t){if(!t)return null;const e=m(t);if(e)return e;const n=y(t);return(n==null?void 0:n.date)||null}function x(t){if(!t)return null;const e=y(t);if(e)return e;const n=m(t);return n?{date:n,time:"00:00"}:null}function E(t,e,n){const r=l.parseISO(t);if(!r)return t;const o=`${e}::${JSON.stringify(n||{})}`;let i=C.get(o);return i||(i=new Intl.DateTimeFormat(e,{year:"numeric",month:"short",day:"2-digit",timeZone:"UTC",...n||{}}),C.set(o,i)),i.format(new Date(Date.UTC(r.y,r.m-1,r.d)))}function H(t,e,n,r){if(!t)return"";if(n==="iso")return t;if(n==="custom"&&r){const o=l.parseISO(t);if(!o)return t;const i=A(e),s=P(e);return r.replace(/YYYY/g,String(o.y)).replace(/MMM/g,i[o.m-1]||"").replace(/MMMM/g,s[o.m-1]||"").replace(/MM/g,u(o.m)).replace(/DD/g,u(o.d))}return E(t,e)}function Z(t,e){const n=m(t.trim());if(n)return n;const r=z(t);if(!r)return null;const o=m(r);if(o)return o;const i=r.split("/").map(f=>f.trim()).filter(Boolean);if(i.length!==3)return null;const s=b(i[0]),a=b(i[1]),p=b(i[2]);if(s==null||a==null||p==null)return null;let c=p;c<100&&(c+=c>=70?1900:2e3);const d=e.toLowerCase().startsWith("en-us"),h=d?s:a,D=d?a:s;if(c<1e3||h<1||h>12||D<1||D>31)return null;const g=`${c}-${u(h)}-${u(D)}`;return m(g)}function T(t,e){const n=t.trim().toLowerCase();if(!n)return null;const r=/^(\d{1,2})(?::|\.|h)?(\d{1,2})?(?::|\.|m)?(\d{1,2})?\s*(am|pm)?$/.exec(n);if(!r)return null;let o=Number(r[1]);const i=Number(r[2]??"0"),s=Number(r[3]??"0");if(!Number.isFinite(o)||!Number.isFinite(i)||!Number.isFinite(s)||i<0||i>59||s<0||s>59||!e&&s!==0)return null;const a=r[4];if(a){if(o<1||o>12)return null;a==="pm"&&o<12&&(o+=12),a==="am"&&o===12&&(o=0)}return o<0||o>23?null:{hours:o,minutes:i,seconds:s}}function M(t,e=!1){if(!t)return"";const n=u(w(t.hours,0,23)),r=u(w(t.minutes,0,59));if(!e)return`${n}:${r}`;const o=u(w(t.seconds,0,59));return`${n}:${r}:${o}`}function _(t,e){const n=T(t,!0);if(!n)return t;const r=new Date;return r.setHours(n.hours,n.minutes,n.seconds,0),new Intl.DateTimeFormat(e,{hour:"numeric",minute:"2-digit",second:t.split(":").length>2?"2-digit":void 0,hour12:!0}).format(r)}function S(t,e){const n=T(t,!0),r=T(e,!0);if(!n||!r)return t.localeCompare(e);const o=n.hours*3600+n.minutes*60+n.seconds,i=r.hours*3600+r.minutes*60+r.seconds;return o-i}function X(t,e,n){const r=T(t,!0);if(!r)return t;let o=M(r,t.split(":").length>=3);return e&&S(o,e)<0&&(o=e),n&&S(o,n)>0&&(o=n),o}function G(t,e,n){let r=t;return e&&l.compareISO(r,e)<0&&(r=e),n&&l.compareISO(r,n)>0&&(r=n),r}function J(t,e){const n=y(t),r=y(e);if(!n||!r)return t.localeCompare(e);const o=l.compareISO(n.date,r.date);return o!==0?o:S(n.time,r.time)}function K(t){const e=l.parseISO(t);if(!e)return{start:t,end:t};const n=l.startOfMonth(e.y,e.m),r=l.endOfMonth(e.y,e.m);return{start:`${n.y}-${u(n.m)}-${u(n.d)}`,end:`${r.y}-${u(r.m)}-${u(r.d)}`}}function V(t,e){const n=w(e,1,366);return{start:l.addDaysISO(t,-(n-1)),end:t}}function j(t,e,n=8,r=8,o=null){const i=typeof window<"u"?window.innerWidth:1200,s=typeof window<"u"?window.innerHeight:800,a=typeof window<"u"&&window.scrollY||0,p=typeof window<"u"&&window.scrollX||0,c=s-t.bottom-r-n,d=t.top-r-n,h=c>=e.height,D=d>=e.height,g=o==="top"?"top":"bottom";let f;if(h&&!D)f="bottom";else if(D&&!h)f="top";else if(D&&h)f=g;else{const $=g==="bottom"?c:d,O=g==="bottom"?d:c;$>0&&O<=$+F?f=g:f=c>=d?"bottom":"top"}const I=f==="bottom"?t.bottom+r+a:t.top-e.height-r+a,v=t.left+p,N=p+i-e.width-n,L=w(v,p+n,Math.max(p+n,N));return{top:I,left:L,placement:f}}function Q(t){let e=0;return{run:()=>{e||(e=requestAnimationFrame(()=>{e=0,t()}))},cancel:()=>{e&&(cancelAnimationFrame(e),e=0)}}}function R(t){return(t||"popover")==="inline"||typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(max-width: 639px)").matches}function tt(){return U.acquireBodyScrollLock()}exports.clampDateIso=G;exports.clampTime=X;exports.combineDateTime=W;exports.compareDateTimes=J;exports.compareTimes=S;exports.computeLastDaysRange=V;exports.computeMonthRange=K;exports.computePopoverPosition=j;exports.eventOriginatesWithin=k;exports.formatDateForDisplay=H;exports.formatTime=M;exports.isTruthyAttr=Y;exports.lockBodyScroll=tt;exports.normalizeDateIso=m;exports.normalizeLocale=B;exports.parseConstraintDate=q;exports.parseConstraintDateTime=x;exports.parseTimeInput=T;exports.parseUserDateInput=Z;exports.rafThrottle=Q;exports.shouldUseMobileSheet=R;exports.splitDateTime=y;exports.to12hDisplay=_;
|