@editora/ui-core 0.1.19 → 0.1.20
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/{ElementBase-1b301e7f.js → ElementBase-EV6mVBUV.js} +1 -1
- package/dist/{ElementBase-909688f3.mjs → ElementBase-YlTLMsGk.mjs} +3 -3
- package/dist/accordion.cjs.js +3 -3
- package/dist/accordion.esm.js +39 -62
- package/dist/alert-dialog.cjs.js +19 -19
- package/dist/alert-dialog.esm.js +69 -87
- package/dist/alert.cjs.js +1 -1
- package/dist/alert.esm.js +4 -7
- package/dist/anchor.cjs.js +2 -2
- package/dist/anchor.esm.js +3 -3
- package/dist/animated-beam.cjs.js +83 -83
- package/dist/animated-beam.esm.js +250 -277
- package/dist/animated-list.cjs.js +4 -4
- package/dist/animated-list.esm.js +47 -61
- package/dist/animated-text.cjs.js +2 -2
- package/dist/animated-text.esm.js +13 -24
- package/dist/app-header.cjs.js +3 -3
- package/dist/app-header.esm.js +11 -13
- package/dist/aspect-ratio.cjs.js +1 -1
- package/dist/aspect-ratio.esm.js +4 -7
- package/dist/avatar.cjs.js +1 -1
- package/dist/avatar.esm.js +7 -13
- package/dist/badge.cjs.js +1 -1
- package/dist/badge.esm.js +4 -7
- package/dist/block-controls.cjs.js +2 -2
- package/dist/block-controls.esm.js +19 -35
- package/dist/box.cjs.js +1 -1
- package/dist/box.esm.js +8 -15
- package/dist/breadcrumb.cjs.js +2 -2
- package/dist/breadcrumb.esm.js +20 -37
- package/dist/button.cjs.js +1 -521
- package/dist/button.esm.js +2 -671
- package/dist/{calendar-2c11b824.mjs → calendar-DLY4acgn.mjs} +293 -342
- package/dist/{calendar-a8735e40.js → calendar-Dkof-FTK.js} +25 -25
- package/dist/calendar.cjs.js +1 -1
- package/dist/calendar.esm.js +8 -9
- package/dist/card.cjs.js +4 -4
- package/dist/card.esm.js +13 -19
- package/dist/chart.cjs.js +64 -64
- package/dist/chart.esm.js +223 -254
- package/dist/checkbox.cjs.js +1 -1
- package/dist/checkbox.esm.js +2 -3
- package/dist/collapsible.cjs.js +1 -1
- package/dist/collapsible.esm.js +5 -9
- package/dist/{collection-a1aac0c6.mjs → collection-C7URGjEI.mjs} +8 -14
- package/dist/collection.cjs.js +1 -1
- package/dist/collection.esm.js +4 -7
- package/dist/color-picker.cjs.js +9 -9
- package/dist/color-picker.esm.js +189 -252
- package/dist/combobox.cjs.js +13 -13
- package/dist/combobox.esm.js +93 -126
- package/dist/command-palette.cjs.js +3 -3
- package/dist/command-palette.esm.js +19 -30
- package/dist/command.cjs.js +4 -4
- package/dist/command.esm.js +41 -53
- package/dist/components/ui-orbiter.d.ts.map +1 -1
- package/dist/components/ui-skeleton.d.ts.map +1 -1
- package/dist/components/ui-split-button.d.ts +1 -0
- package/dist/components/ui-split-button.d.ts.map +1 -1
- package/dist/components/ui-time-picker.d.ts.map +1 -1
- package/dist/container.cjs.js +2 -2
- package/dist/container.esm.js +2 -3
- package/dist/context-menu.cjs.js +8 -8
- package/dist/context-menu.esm.js +157 -219
- package/dist/control-group.cjs.js +1 -1
- package/dist/control-group.esm.js +2 -3
- package/dist/data-table.cjs.js +4 -4
- package/dist/data-table.esm.js +299 -381
- package/dist/date-field.cjs.js +3 -3
- package/dist/date-field.esm.js +68 -80
- package/dist/date-picker.cjs.js +9 -9
- package/dist/date-picker.esm.js +69 -97
- package/dist/date-range-picker.cjs.js +3 -3
- package/dist/date-range-picker.esm.js +32 -56
- package/dist/date-range-time-picker.cjs.js +9 -9
- package/dist/date-range-time-picker.esm.js +111 -140
- package/dist/date-time-picker.cjs.js +4 -4
- package/dist/date-time-picker.esm.js +112 -144
- package/dist/date-time-utils-Dmost5Ee.js +1 -0
- package/dist/date-time-utils-y1N2gvG2.mjs +268 -0
- package/dist/description.cjs.js +1 -1
- package/dist/description.esm.js +3 -5
- package/dist/dialog.cjs.js +12 -12
- package/dist/dialog.esm.js +44 -63
- package/dist/direction-provider.cjs.js +1 -1
- package/dist/direction-provider.esm.js +2 -3
- package/dist/{dismissable-layer-9c7e6b58.mjs → dismissable-layer-BmPIoK80.mjs} +29 -33
- package/dist/dismissable-layer-DNfrKA20.js +1 -0
- package/dist/dismissable-layer.cjs.js +2 -2
- package/dist/dismissable-layer.esm.js +4 -6
- package/dist/dock.cjs.js +5 -5
- package/dist/dock.esm.js +134 -155
- package/dist/drawer.cjs.js +2 -2
- package/dist/drawer.esm.js +18 -35
- package/dist/dropdown.cjs.js +2 -2
- package/dist/dropdown.esm.js +119 -149
- package/dist/dropzone.cjs.js +1 -1
- package/dist/dropzone.esm.js +0 -1
- package/dist/empty-state.cjs.js +1 -1
- package/dist/empty-state.esm.js +1 -1
- package/dist/field-error.cjs.js +1 -1
- package/dist/field-error.esm.js +3 -5
- package/dist/field.cjs.js +5 -5
- package/dist/field.esm.js +27 -34
- package/dist/fieldset.cjs.js +4 -4
- package/dist/fieldset.esm.js +19 -24
- package/dist/file-upload.cjs.js +4 -4
- package/dist/file-upload.esm.js +69 -93
- package/dist/flex.cjs.js +1 -1
- package/dist/flex.esm.js +5 -9
- package/dist/floating-toolbar.cjs.js +4 -4
- package/dist/floating-toolbar.esm.js +60 -85
- package/dist/focus-scope-Bwug2gDv.js +1 -0
- package/dist/{focus-scope-103833ee.mjs → focus-scope-CmEsG5UZ.mjs} +39 -48
- package/dist/focus-scope.cjs.js +2 -2
- package/dist/focus-scope.esm.js +15 -20
- package/dist/form.cjs.js +2 -2
- package/dist/form.esm.js +26 -53
- package/dist/gantt.cjs.js +43 -43
- package/dist/gantt.esm.js +295 -322
- package/dist/grid.cjs.js +1 -1
- package/dist/grid.esm.js +5 -9
- package/dist/hover-card.cjs.js +4 -4
- package/dist/hover-card.esm.js +22 -28
- package/dist/icon-cloud.cjs.js +7 -7
- package/dist/icon-cloud.esm.js +48 -62
- package/dist/icon.cjs.js +1 -1
- package/dist/icon.esm.js +2 -4
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +378 -390
- package/dist/inline-edit.cjs.js +11 -11
- package/dist/inline-edit.esm.js +32 -36
- package/dist/input.cjs.js +17 -17
- package/dist/input.esm.js +50 -63
- package/dist/label.cjs.js +2 -2
- package/dist/label.esm.js +8 -17
- package/dist/layout.cjs.js +2 -2
- package/dist/layout.esm.js +20 -26
- package/dist/listbox-B6QgECax.js +46 -0
- package/dist/listbox-DJamVeFj.mjs +200 -0
- package/dist/listbox.cjs.js +1 -1
- package/dist/listbox.esm.js +2 -4
- package/dist/marquee.cjs.js +5 -5
- package/dist/marquee.esm.js +33 -50
- package/dist/masonry-grid.cjs.js +1 -1
- package/dist/masonry-grid.esm.js +5 -9
- package/dist/menu.cjs.js +3 -3
- package/dist/menu.esm.js +106 -126
- package/dist/menubar.cjs.js +5 -5
- package/dist/menubar.esm.js +118 -164
- package/dist/meter.cjs.js +2 -2
- package/dist/meter.esm.js +4 -4
- package/dist/multi-select.cjs.js +4 -4
- package/dist/multi-select.esm.js +120 -140
- package/dist/navigation-menu.cjs.js +4 -4
- package/dist/navigation-menu.esm.js +44 -55
- package/dist/number-field.cjs.js +2 -2
- package/dist/number-field.esm.js +73 -98
- package/dist/number-ticker.cjs.js +3 -3
- package/dist/number-ticker.esm.js +22 -43
- package/dist/odometer.cjs.js +1 -1
- package/dist/odometer.esm.js +5 -9
- package/dist/orbiter.cjs.js +13 -13
- package/dist/orbiter.esm.js +79 -90
- package/dist/{overlayManager-5bbd4dc3.mjs → overlayManager-BJjU1VA8.mjs} +4 -5
- package/dist/{overlayManager-0eda4e08.js → overlayManager-CSy3fJmJ.js} +1 -1
- package/dist/pagination.cjs.js +2 -2
- package/dist/pagination.esm.js +14 -18
- package/dist/{panel-group-a376cc5e.mjs → panel-group-8sVNnGxg.mjs} +24 -46
- package/dist/panel-group-CaD0_KQf.js +36 -0
- package/dist/panel-group.cjs.js +1 -1
- package/dist/panel-group.esm.js +2 -5
- package/dist/panel.cjs.js +4 -4
- package/dist/panel.esm.js +8 -10
- package/dist/password-field.cjs.js +9 -9
- package/dist/password-field.esm.js +62 -82
- package/dist/pin-input.cjs.js +3 -3
- package/dist/pin-input.esm.js +33 -39
- package/dist/placement-grid.cjs.js +4 -4
- package/dist/placement-grid.esm.js +108 -131
- package/dist/plugin-panel.cjs.js +7 -7
- package/dist/plugin-panel.esm.js +13 -15
- package/dist/popover.cjs.js +2 -2
- package/dist/popover.esm.js +21 -31
- package/dist/portal-DgpQ3Jo1.js +1 -0
- package/dist/{portal-fe73e5cc.mjs → portal-bR42gHvG.mjs} +43 -48
- package/dist/portal.cjs.js +2 -2
- package/dist/portal.esm.js +10 -19
- package/dist/{positioner-e9770c66.mjs → positioner-D0VGxtYU.mjs} +189 -209
- package/dist/positioner-D_fqyx_j.js +1 -0
- package/dist/positioner.cjs.js +2 -2
- package/dist/positioner.esm.js +11 -18
- package/dist/presence.cjs.js +1 -1
- package/dist/presence.esm.js +7 -13
- package/dist/progress.cjs.js +1 -1
- package/dist/progress.esm.js +5 -9
- package/dist/quick-actions.cjs.js +6 -6
- package/dist/quick-actions.esm.js +52 -62
- package/dist/radio-group.cjs.js +13 -13
- package/dist/radio-group.esm.js +39 -51
- package/dist/radio.cjs.js +1 -1
- package/dist/radio.esm.js +5 -9
- package/dist/rating.cjs.js +1 -1
- package/dist/rating.esm.js +12 -23
- package/dist/{roving-focus-group-4350c9a7.mjs → roving-focus-group-Dbm1Jko_.mjs} +3 -6
- package/dist/roving-focus-group.cjs.js +1 -1
- package/dist/roving-focus-group.esm.js +3 -5
- package/dist/runtime-CTaOSmBj.js +1 -0
- package/dist/{runtime-161f68a2.mjs → runtime-D1gFh1fS.mjs} +338 -366
- package/dist/runtime.cjs.js +1 -1
- package/dist/runtime.esm.js +6 -6
- package/dist/scroll-area.cjs.js +3 -3
- package/dist/scroll-area.esm.js +38 -46
- package/dist/{scroll-lock-31da444f.mjs → scroll-lock-LfqXXqsu.mjs} +5 -9
- package/dist/section.cjs.js +1 -1
- package/dist/section.esm.js +1 -1
- package/dist/select.cjs.js +7 -7
- package/dist/select.esm.js +67 -97
- package/dist/selection-popup.cjs.js +1 -1
- package/dist/selection-popup.esm.js +8 -15
- package/dist/separator.cjs.js +1 -1
- package/dist/separator.esm.js +1 -1
- package/dist/sidebar.cjs.js +18 -18
- package/dist/sidebar.esm.js +117 -139
- package/dist/skeleton.cjs.js +11 -11
- package/dist/skeleton.esm.js +27 -24
- package/dist/slider.cjs.js +1 -1
- package/dist/slider.esm.js +6 -11
- package/dist/slot.cjs.js +4 -4
- package/dist/slot.esm.js +16 -19
- package/dist/sortable.cjs.js +45 -45
- package/dist/sortable.esm.js +421 -524
- package/dist/spinning-text.cjs.js +12 -12
- package/dist/spinning-text.esm.js +80 -92
- package/dist/split-button.cjs.js +4 -4
- package/dist/split-button.esm.js +77 -62
- package/dist/splitter.cjs.js +1 -1
- package/dist/splitter.esm.js +1 -1
- package/dist/stepper.cjs.js +8 -8
- package/dist/stepper.esm.js +32 -52
- package/dist/switch.cjs.js +7 -7
- package/dist/switch.esm.js +23 -31
- package/dist/table.cjs.js +2 -2
- package/dist/table.esm.js +46 -56
- package/dist/tabs.cjs.js +3 -3
- package/dist/tabs.esm.js +35 -55
- package/dist/tags-input.cjs.js +4 -4
- package/dist/tags-input.esm.js +45 -62
- package/dist/textarea.cjs.js +6 -6
- package/dist/textarea.esm.js +32 -41
- package/dist/time-field.cjs.js +4 -4
- package/dist/time-field.esm.js +70 -84
- package/dist/time-picker.cjs.js +22 -22
- package/dist/time-picker.esm.js +88 -110
- package/dist/timeline.cjs.js +1 -1
- package/dist/timeline.esm.js +3 -5
- package/dist/toast.cjs.js +2 -2
- package/dist/toast.esm.js +33 -47
- package/dist/toggle-group.cjs.js +6 -6
- package/dist/toggle-group.esm.js +85 -105
- package/dist/toggle.cjs.js +1 -1
- package/dist/toggle.esm.js +3 -5
- package/dist/toolbar.cjs.js +1 -1
- package/dist/toolbar.esm.js +13 -24
- package/dist/tooltip.cjs.js +2 -2
- package/dist/tooltip.esm.js +31 -42
- package/dist/transfer-list.cjs.js +19 -19
- package/dist/transfer-list.esm.js +98 -111
- package/dist/{tree-dcd74a4a.mjs → tree-B3kE8ESs.mjs} +55 -62
- package/dist/tree-Dx_kv_ih.js +39 -0
- package/dist/tree-item.cjs.js +2 -2
- package/dist/tree-item.esm.js +2 -3
- package/dist/tree.cjs.js +1 -1
- package/dist/tree.esm.js +2 -5
- package/dist/ui-button-Q0GNNWKC.mjs +665 -0
- package/dist/ui-button-rXQOS9QJ.js +521 -0
- package/dist/{icon-9e9da03b.js → ui-icon-BzVNC_lr.js} +4 -4
- package/dist/{icon-e2a85cc1.mjs → ui-icon-YI6lyuqU.mjs} +58 -65
- package/dist/visually-hidden.cjs.js +1 -1
- package/dist/visually-hidden.esm.js +1 -1
- package/dist/wizard.cjs.js +14 -14
- package/dist/wizard.esm.js +85 -105
- package/package.json +2 -2
- package/dist/date-time-utils-66480de4.js +0 -1
- package/dist/date-time-utils-a2c7af25.mjs +0 -307
- package/dist/dismissable-layer-193e3bed.js +0 -1
- package/dist/focus-scope-2b12b4e7.js +0 -1
- package/dist/listbox-308789a0.mjs +0 -210
- package/dist/listbox-ef2f708e.js +0 -46
- package/dist/panel-group-40254cdd.js +0 -36
- package/dist/portal-c69756c0.js +0 -1
- package/dist/positioner-33529bb8.js +0 -1
- package/dist/runtime-3f13807b.js +0 -1
- package/dist/tree-0a7a8d05.js +0 -39
- /package/dist/{collection-a2969ad2.js → collection-qv8A8rq4.js} +0 -0
- /package/dist/{menu-item-styles-27fdbac4.mjs → menu-item-styles-CZiPwPwl.mjs} +0 -0
- /package/dist/{menu-item-styles-83ad1e22.js → menu-item-styles-CbNUEwP2.js} +0 -0
- /package/dist/{roving-focus-group-5c059bf9.js → roving-focus-group-BdJ_4Njm.js} +0 -0
- /package/dist/{scroll-lock-d7b0df21.js → scroll-lock-BX6e3Ced.js} +0 -0
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { E as tt } from "./ElementBase-
|
|
2
|
-
import { c as et } from "./dismissable-layer-
|
|
3
|
-
import { r as it } from "./calendar-
|
|
4
|
-
import { r as rt, e as st, i as C, s as nt, b as at, j as D, k as A, f as ot, m as I, o as P, l as lt, c as dt, q as k, g as ut, h as ct } from "./date-time-utils-
|
|
5
|
-
import "./scroll-lock-31da444f.mjs";
|
|
6
|
-
import "./positioner-e9770c66.mjs";
|
|
1
|
+
import { E as tt } from "./ElementBase-YlTLMsGk.mjs";
|
|
2
|
+
import { c as et } from "./dismissable-layer-BmPIoK80.mjs";
|
|
3
|
+
import { r as it } from "./calendar-DLY4acgn.mjs";
|
|
4
|
+
import { r as rt, e as st, i as C, s as nt, b as at, j as D, k as A, f as ot, m as I, o as P, l as lt, c as dt, q as k, g as ut, h as ct } from "./date-time-utils-y1N2gvG2.mjs";
|
|
7
5
|
let pt = 0;
|
|
8
6
|
const ht = `
|
|
9
7
|
<svg viewBox="0 0 20 20" class="icon-svg" aria-hidden="true" focusable="false">
|
|
@@ -527,10 +525,9 @@ const ht = `
|
|
|
527
525
|
}
|
|
528
526
|
`;
|
|
529
527
|
function Q(h) {
|
|
530
|
-
if (!h)
|
|
531
|
-
return { start: null, end: null };
|
|
528
|
+
if (!h) return { start: null, end: null };
|
|
532
529
|
try {
|
|
533
|
-
const t = JSON.parse(h), e = typeof
|
|
530
|
+
const t = JSON.parse(h), e = typeof t?.start == "string" ? t.start : null, i = typeof t?.end == "string" ? t.end : null;
|
|
534
531
|
return { start: e, end: i };
|
|
535
532
|
} catch {
|
|
536
533
|
return { start: null, end: null };
|
|
@@ -542,25 +539,24 @@ function X(h) {
|
|
|
542
539
|
...h.end ? { end: h.end } : {}
|
|
543
540
|
});
|
|
544
541
|
}
|
|
545
|
-
function
|
|
542
|
+
function w(h) {
|
|
546
543
|
return String(h).padStart(2, "0");
|
|
547
544
|
}
|
|
548
545
|
function c(h) {
|
|
549
546
|
return h.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
550
547
|
}
|
|
551
|
-
function
|
|
552
|
-
|
|
553
|
-
const t = /* @__PURE__ */ new Date(), e = `${S(t.getHours())}:${S(t.getMinutes())}`, i = `${S((t.getHours() + 1) % 24)}:${S(t.getMinutes())}`, r = A(h.start || null), o = A(h.end || null);
|
|
548
|
+
function x(h) {
|
|
549
|
+
const t = /* @__PURE__ */ new Date(), e = `${w(t.getHours())}:${w(t.getMinutes())}`, i = `${w((t.getHours() + 1) % 24)}:${w(t.getMinutes())}`, r = A(h.start || null), l = A(h.end || null);
|
|
554
550
|
return {
|
|
555
|
-
startDate:
|
|
556
|
-
endDate:
|
|
557
|
-
startTime:
|
|
558
|
-
endTime:
|
|
551
|
+
startDate: r?.date || null,
|
|
552
|
+
endDate: l?.date || null,
|
|
553
|
+
startTime: r?.time?.slice(0, 5) || e,
|
|
554
|
+
endTime: l?.time?.slice(0, 5) || i
|
|
559
555
|
};
|
|
560
556
|
}
|
|
561
557
|
class _t extends tt {
|
|
562
558
|
constructor() {
|
|
563
|
-
super(...arguments), this._value = { start: null, end: null }, this._pending =
|
|
559
|
+
super(...arguments), this._value = { start: null, end: null }, this._pending = x({ start: null, end: null }), this._display = "", 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-drtp-${++pt}`, 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 = rt(() => this._positionOverlay()), this._onRootClickBound = (t) => this._onRootClick(t), this._onRootChangeBound = (t) => this._onRootChange(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) => {
|
|
564
560
|
st(t, [this._overlay]) || this._schedulePosition.run();
|
|
565
561
|
};
|
|
566
562
|
}
|
|
@@ -599,7 +595,7 @@ class _t extends tt {
|
|
|
599
595
|
connectedCallback() {
|
|
600
596
|
if (super.connectedCallback(), this.root.addEventListener("click", this._onRootClickBound), this.root.addEventListener("change", this._onRootChangeBound), this.root.addEventListener("keydown", this._onRootKeyDownBound), !this._isInitialized) {
|
|
601
597
|
const t = Q(this.getAttribute("value") || this.getAttribute("default-value"));
|
|
602
|
-
this._value = t, this._pending =
|
|
598
|
+
this._value = t, this._pending = x(t), this._display = this._formatDisplay(), this._open = this.hasAttribute("open") || C(this.getAttribute("default-open")), this._isInitialized = !0;
|
|
603
599
|
}
|
|
604
600
|
this._open && !this._isInlineMode() && this._ensureOverlay();
|
|
605
601
|
}
|
|
@@ -607,7 +603,7 @@ class _t extends tt {
|
|
|
607
603
|
this.root.removeEventListener("click", this._onRootClickBound), this.root.removeEventListener("change", this._onRootChangeBound), this.root.removeEventListener("keydown", this._onRootKeyDownBound), this._destroyOverlay(), super.disconnectedCallback();
|
|
608
604
|
}
|
|
609
605
|
attributeChangedCallback(t, e, i) {
|
|
610
|
-
if (e !== i && (t === "value" && !this._syncing && (this._value = Q(i), this._pending =
|
|
606
|
+
if (e !== i && (t === "value" && !this._syncing && (this._value = Q(i), this._pending = x(this._value), this._display = this._formatDisplay(), this._inlineError = ""), t === "open" && !this._syncing && (this._open = this.hasAttribute("open"), this._syncOverlay("attribute")), t === "mode" && this._syncOverlay("attribute"), t === "disabled" && this.hasAttribute("disabled") && this._setOpen(!1, "outside"), t === "state" && this._state() === "loading" && this._setOpen(!1, "outside"), !!this.isConnected)) {
|
|
611
607
|
if (!this._hasView) {
|
|
612
608
|
this.requestRender();
|
|
613
609
|
return;
|
|
@@ -720,30 +716,28 @@ class _t extends tt {
|
|
|
720
716
|
return !t && !e ? "" : t && e ? `${this._formatDateTimeDisplay(t)} — ${this._formatDateTimeDisplay(e)}` : this._formatDateTimeDisplay(t || e);
|
|
721
717
|
}
|
|
722
718
|
_normalizePendingState(t) {
|
|
723
|
-
var p, m;
|
|
724
719
|
let e = D(t.startDate, t.startTime), i = D(t.endDate, t.endTime);
|
|
725
720
|
if (e && i && I(e, i) > 0 && this._autoNormalize()) {
|
|
726
|
-
const
|
|
727
|
-
e = i, i =
|
|
721
|
+
const p = e;
|
|
722
|
+
e = i, i = p;
|
|
728
723
|
}
|
|
729
|
-
const r = P(this.getAttribute("min")),
|
|
730
|
-
let n = r ? `${r.date}T${r.time}` : null, s =
|
|
724
|
+
const r = P(this.getAttribute("min")), l = P(this.getAttribute("max"));
|
|
725
|
+
let n = r ? `${r.date}T${r.time}` : null, s = l ? `${l.date}T${l.time}` : null;
|
|
731
726
|
if (n && s && I(n, s) > 0) {
|
|
732
|
-
const
|
|
733
|
-
n = s, s =
|
|
727
|
+
const p = n;
|
|
728
|
+
n = s, s = p;
|
|
734
729
|
}
|
|
735
730
|
e && n && I(e, n) < 0 && (e = n), e && s && I(e, s) > 0 && (e = s), i && n && I(i, n) < 0 && (i = n), i && s && I(i, s) > 0 && (i = s);
|
|
736
|
-
const a = A(e || ""),
|
|
731
|
+
const a = A(e || ""), u = A(i || "");
|
|
737
732
|
return {
|
|
738
|
-
startDate:
|
|
739
|
-
endDate:
|
|
740
|
-
startTime:
|
|
741
|
-
endTime:
|
|
733
|
+
startDate: a?.date || null,
|
|
734
|
+
endDate: u?.date || null,
|
|
735
|
+
startTime: a?.time?.slice(0, 5) || t.startTime,
|
|
736
|
+
endTime: u?.time?.slice(0, 5) || t.endTime
|
|
742
737
|
};
|
|
743
738
|
}
|
|
744
739
|
_commit(t, e) {
|
|
745
|
-
if (this._isInteractionBlocked() || this._isReadonly())
|
|
746
|
-
return;
|
|
740
|
+
if (this._isInteractionBlocked() || this._isReadonly()) return;
|
|
747
741
|
const i = this._normalizePendingState(t), r = {
|
|
748
742
|
start: D(i.startDate, i.startTime),
|
|
749
743
|
end: D(i.endDate, i.endTime)
|
|
@@ -779,25 +773,20 @@ class _t extends tt {
|
|
|
779
773
|
}
|
|
780
774
|
}
|
|
781
775
|
_ensureOverlay() {
|
|
782
|
-
if (this._overlay || typeof document > "u")
|
|
783
|
-
return;
|
|
776
|
+
if (this._overlay || typeof document > "u") return;
|
|
784
777
|
const t = document.createElement("div");
|
|
785
778
|
t.className = "ui-date-range-time-picker-overlay-host", 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), 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 = lt());
|
|
786
779
|
}
|
|
787
780
|
_syncOverlayHostZIndex() {
|
|
788
|
-
if (!this._overlay || typeof window > "u")
|
|
789
|
-
return;
|
|
781
|
+
if (!this._overlay || typeof window > "u") return;
|
|
790
782
|
const t = window.getComputedStyle(this).getPropertyValue("--ui-drtp-z").trim();
|
|
791
783
|
this._overlay.style.zIndex = t || "1600";
|
|
792
784
|
}
|
|
793
785
|
_destroyOverlay() {
|
|
794
|
-
|
|
795
|
-
(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.parentElement && this._overlay.parentElement.removeChild(this._overlay), this._overlay = null, this._overlayKey = null, this._releaseScrollLock && (this._releaseScrollLock(), this._releaseScrollLock = null));
|
|
786
|
+
this._dismissableLayer?.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.parentElement && this._overlay.parentElement.removeChild(this._overlay), this._overlay = null, this._overlayKey = null, this._releaseScrollLock && (this._releaseScrollLock(), this._releaseScrollLock = null));
|
|
796
787
|
}
|
|
797
788
|
_syncDismissableLayer() {
|
|
798
|
-
|
|
799
|
-
if ((i = this._dismissableLayer) == null || i.destroy(), this._dismissableLayer = null, !this._open || !this._overlay)
|
|
800
|
-
return;
|
|
789
|
+
if (this._dismissableLayer?.destroy(), this._dismissableLayer = null, !this._open || !this._overlay) return;
|
|
801
790
|
const t = this._overlay.querySelector(".panel, .sheet"), e = this.root.querySelector(".field");
|
|
802
791
|
t && (this._dismissableLayer = et({
|
|
803
792
|
node: t,
|
|
@@ -805,15 +794,13 @@ class _t extends tt {
|
|
|
805
794
|
closeOnEscape: !0,
|
|
806
795
|
closeOnPointerOutside: !0,
|
|
807
796
|
closeOnFocusOutside: !1,
|
|
808
|
-
onBeforeDismiss: (
|
|
797
|
+
onBeforeDismiss: (i) => i === "escape-key" ? (this._setOpen(!1, "escape"), !1) : (i === "outside-pointer" && this._setOpen(!1, "outside"), !1)
|
|
809
798
|
}));
|
|
810
799
|
}
|
|
811
800
|
_positionOverlay() {
|
|
812
|
-
if (!this._overlay || !this._open || this._isMobileSheet())
|
|
813
|
-
return;
|
|
801
|
+
if (!this._overlay || !this._open || this._isMobileSheet()) return;
|
|
814
802
|
const t = this.root.querySelector(".field"), e = this._overlay.querySelector(".panel");
|
|
815
|
-
if (!t || !e)
|
|
816
|
-
return;
|
|
803
|
+
if (!t || !e) return;
|
|
817
804
|
const i = e.getAttribute("data-placement"), r = dt(
|
|
818
805
|
t.getBoundingClientRect(),
|
|
819
806
|
e.getBoundingClientRect(),
|
|
@@ -824,14 +811,14 @@ class _t extends tt {
|
|
|
824
811
|
e.style.position = "absolute", e.style.top = `${Math.round(r.top)}px`, e.style.left = `${Math.round(r.left)}px`, e.setAttribute("data-placement", r.placement);
|
|
825
812
|
}
|
|
826
813
|
_timeOptions(t) {
|
|
827
|
-
const e = k(t
|
|
814
|
+
const e = k(t) || { hours: 0, minutes: 0 }, i = this._step(), r = Array.from({ length: 24 }, (n, s) => `<option value="${s}" ${s === e.hours ? "selected" : ""}>${w(s)}</option>`).join(""), l = Array.from({ length: Math.ceil(60 / i) }, (n, s) => {
|
|
828
815
|
const a = Math.min(59, s * i);
|
|
829
|
-
return `<option value="${a}" ${a === e.minutes ? "selected" : ""}>${
|
|
816
|
+
return `<option value="${a}" ${a === e.minutes ? "selected" : ""}>${w(a)}</option>`;
|
|
830
817
|
}).join("");
|
|
831
|
-
return { hours: r, minutes:
|
|
818
|
+
return { hours: r, minutes: l };
|
|
832
819
|
}
|
|
833
820
|
_renderSurfaceInner(t, e = !1) {
|
|
834
|
-
const i = this._translations(), r = this._timeOptions(this._pending.startTime),
|
|
821
|
+
const i = this._translations(), r = this._timeOptions(this._pending.startTime), l = this._timeOptions(this._pending.endTime), n = (this.getAttribute("label") || "").trim(), s = c(n), a = c(n || i.selectDateRange), u = this._valueFromPending(), p = u.start && u.end ? `${this._formatDateTimeDisplay(u.start)} — ${this._formatDateTimeDisplay(u.end)}` : i.selectDateRange, g = c(`${i.startTime} ${i.hour}`), S = c(`${i.startTime} ${i.minute}`), y = c(`${i.endTime} ${i.hour}`), o = c(`${i.endTime} ${i.minute}`), b = `
|
|
835
822
|
<header class="head">
|
|
836
823
|
<div>
|
|
837
824
|
<p class="head-title" ${n ? "" : "hidden"}>${s}</p>
|
|
@@ -851,13 +838,13 @@ class _t extends tt {
|
|
|
851
838
|
</div>
|
|
852
839
|
<div class="time-row">
|
|
853
840
|
<p class="time-row-label"><span class="icon-inline">${B}</span>${c(i.startTime)}</p>
|
|
854
|
-
<select data-time="start" data-segment="hours" aria-label="${
|
|
855
|
-
<select data-time="start" data-segment="minutes" aria-label="${
|
|
841
|
+
<select data-time="start" data-segment="hours" aria-label="${g}">${r.hours}</select>
|
|
842
|
+
<select data-time="start" data-segment="minutes" aria-label="${S}">${r.minutes}</select>
|
|
856
843
|
</div>
|
|
857
844
|
<div class="time-row">
|
|
858
845
|
<p class="time-row-label"><span class="icon-inline">${B}</span>${c(i.endTime)}</p>
|
|
859
|
-
<select data-time="end" data-segment="hours" aria-label="${
|
|
860
|
-
<select data-time="end" data-segment="minutes" aria-label="${
|
|
846
|
+
<select data-time="end" data-segment="hours" aria-label="${y}">${l.hours}</select>
|
|
847
|
+
<select data-time="end" data-segment="minutes" aria-label="${o}">${l.minutes}</select>
|
|
861
848
|
</div>
|
|
862
849
|
</div>
|
|
863
850
|
</div>
|
|
@@ -874,28 +861,28 @@ class _t extends tt {
|
|
|
874
861
|
<button type="button" class="action" data-action="apply" data-tone="primary">${c(i.apply)}</button>
|
|
875
862
|
</footer>
|
|
876
863
|
`;
|
|
877
|
-
return e ?
|
|
864
|
+
return e ? b : `
|
|
878
865
|
<style>${gt}</style>
|
|
879
866
|
${t ? '<div class="sheet-backdrop" data-action="backdrop"></div>' : ""}
|
|
880
|
-
<section class="${t ? "sheet" : "panel"}" id="${this._panelId}" role="dialog" aria-modal="${t ? "true" : "false"}" aria-label="${a}" part="${t ? "sheet" : "popover"}">${
|
|
867
|
+
<section class="${t ? "sheet" : "panel"}" id="${this._panelId}" role="dialog" aria-modal="${t ? "true" : "false"}" aria-label="${a}" part="${t ? "sheet" : "popover"}">${b}</section>
|
|
881
868
|
`;
|
|
882
869
|
}
|
|
883
870
|
_syncCalendar(t) {
|
|
884
|
-
const e = (
|
|
871
|
+
const e = (u, p) => {
|
|
885
872
|
if (p == null || p === "") {
|
|
886
|
-
t.hasAttribute(
|
|
873
|
+
t.hasAttribute(u) && t.removeAttribute(u);
|
|
887
874
|
return;
|
|
888
875
|
}
|
|
889
|
-
t.getAttribute(
|
|
890
|
-
}, i = (
|
|
891
|
-
p ? e(
|
|
876
|
+
t.getAttribute(u) !== p && t.setAttribute(u, p);
|
|
877
|
+
}, i = (u, p) => {
|
|
878
|
+
p ? e(u, "") : e(u, null);
|
|
892
879
|
};
|
|
893
880
|
e("selection", "range"), e("value", JSON.stringify({
|
|
894
881
|
...this._pending.startDate ? { start: this._pending.startDate } : {},
|
|
895
882
|
...this._pending.endDate ? { end: this._pending.endDate } : {}
|
|
896
883
|
}));
|
|
897
|
-
const r = P(this.getAttribute("min")),
|
|
898
|
-
e("min",
|
|
884
|
+
const r = P(this.getAttribute("min")), l = P(this.getAttribute("max"));
|
|
885
|
+
e("min", r?.date || null), e("max", l?.date || null), e("locale", this.getAttribute("locale")), e("translations", this.getAttribute("translations")), e("week-start", this.getAttribute("week-start"));
|
|
899
886
|
const s = this.getAttribute("size") || "sm", a = t.classList.contains("drtp-calendar-inline");
|
|
900
887
|
e("size", s === "lg" ? "md" : "sm"), e("variant", this.getAttribute("variant")), i("readonly", this._isReadonly()), i("disabled", this._isInteractionBlocked()), i("bare", this._isBare()), e("tabindex", "-1"), s === "lg" ? (t.style.setProperty("--ui-calendar-day-height", "1.95em"), t.style.setProperty("--ui-calendar-day-padding-block", "0.2em"), t.style.setProperty("--ui-calendar-day-padding-inline", "0.26em"), t.style.setProperty("--ui-calendar-gap", "0.42em"), t.style.setProperty("--ui-calendar-day-font-size", "0.78em"), t.style.setProperty("--ui-calendar-weekday-font-size", "0.7em"), t.style.setProperty("--ui-calendar-title-font-size", "0.88em")) : (t.style.setProperty("--ui-calendar-day-height", "2.4em"), t.style.setProperty("--ui-calendar-day-padding-block", "0.14em"), t.style.setProperty("--ui-calendar-day-padding-inline", "0.22em"), t.style.setProperty("--ui-calendar-gap", "0.34em"), t.style.setProperty("--ui-calendar-day-font-size", "0.72em"), t.style.setProperty("--ui-calendar-weekday-font-size", "0.64em"), t.style.setProperty("--ui-calendar-title-font-size", "0.8em")), a ? (t.style.setProperty("--ui-calendar-frame-padding", "0.32em"), t.style.setProperty("--ui-calendar-week-gap", "0.18em"), t.style.setProperty("--ui-calendar-control-height", "1.72em"), t.style.setProperty("--ui-calendar-gap", "0.24em")) : (t.style.removeProperty("--ui-calendar-frame-padding"), t.style.removeProperty("--ui-calendar-week-gap"), t.style.removeProperty("--ui-calendar-control-height")), e("aria-label", this.getAttribute("label") || this._translations().selectDateRange);
|
|
901
888
|
}
|
|
@@ -909,62 +896,56 @@ class _t extends tt {
|
|
|
909
896
|
].join(":");
|
|
910
897
|
}
|
|
911
898
|
_ensureOverlayContent(t) {
|
|
912
|
-
if (!this._overlay)
|
|
913
|
-
return;
|
|
899
|
+
if (!this._overlay) return;
|
|
914
900
|
const e = this._overlaySignature(t);
|
|
915
901
|
this._overlayKey === e && this._overlay.querySelector(".drtp-calendar") || (this._overlayKey = e, this._overlay.innerHTML = t ? `<div class="sheet-wrap">${this._renderSurfaceInner(!0)}</div>` : `<div class="overlay">${this._renderSurfaceInner(!1)}</div>`);
|
|
916
902
|
}
|
|
917
903
|
_setClosestOptionValue(t, e) {
|
|
918
904
|
const i = Array.from(t.options).map((n) => Number(n.value)).filter((n) => Number.isFinite(n));
|
|
919
|
-
if (!i.length)
|
|
920
|
-
|
|
921
|
-
let r = i[0], o = Math.abs(r - e);
|
|
905
|
+
if (!i.length) return;
|
|
906
|
+
let r = i[0], l = Math.abs(r - e);
|
|
922
907
|
for (let n = 1; n < i.length; n += 1) {
|
|
923
908
|
const s = i[n], a = Math.abs(s - e);
|
|
924
|
-
a <
|
|
909
|
+
a < l && (r = s, l = a);
|
|
925
910
|
}
|
|
926
911
|
t.value = String(r);
|
|
927
912
|
}
|
|
928
913
|
_syncOverlayState() {
|
|
929
|
-
if (!this._overlay)
|
|
930
|
-
return;
|
|
914
|
+
if (!this._overlay) return;
|
|
931
915
|
this._syncOverlayHostZIndex();
|
|
932
916
|
const t = this._isMobileSheet();
|
|
933
917
|
this._ensureOverlayContent(t), this._syncDismissableLayer();
|
|
934
|
-
const e = this._translations(), i = this._overlay.querySelector(".panel, .sheet"), r = this._overlay.querySelector(".presets"),
|
|
918
|
+
const e = this._translations(), i = this._overlay.querySelector(".panel, .sheet"), r = this._overlay.querySelector(".presets"), l = this._overlay.querySelector(".footer");
|
|
935
919
|
i && (i.dataset.bare = this._isBare() ? "true" : "false");
|
|
936
920
|
const n = this._showFooter();
|
|
937
|
-
r && (r.hidden = !n),
|
|
921
|
+
r && (r.hidden = !n), l && (l.hidden = !n);
|
|
938
922
|
const s = this._overlay.querySelector(".head-title");
|
|
939
923
|
if (s) {
|
|
940
|
-
const
|
|
941
|
-
s.textContent =
|
|
924
|
+
const m = (this.getAttribute("label") || "").trim();
|
|
925
|
+
s.textContent = m, s.hidden = !m;
|
|
942
926
|
}
|
|
943
|
-
const a = this._overlay.querySelector(".head-meta"),
|
|
944
|
-
a && (a.textContent =
|
|
927
|
+
const a = this._overlay.querySelector(".head-meta"), u = this._valueFromPending();
|
|
928
|
+
a && (a.textContent = u.start && u.end ? `${this._formatDateTimeDisplay(u.start)} — ${this._formatDateTimeDisplay(u.end)}` : e.selectDateRange);
|
|
945
929
|
const p = this._overlay.querySelector(".drtp-calendar");
|
|
946
930
|
p && this._syncCalendar(p);
|
|
947
|
-
const
|
|
948
|
-
|
|
949
|
-
const
|
|
950
|
-
[
|
|
951
|
-
|
|
952
|
-
}), this._overlay.querySelectorAll(".action, .preset").forEach((
|
|
953
|
-
|
|
931
|
+
const g = k(this._pending.startTime) || { hours: 0, minutes: 0 }, S = k(this._pending.endTime) || { hours: 0, minutes: 0 }, y = this._overlay.querySelector('select[data-time="start"][data-segment="hours"]'), o = this._overlay.querySelector('select[data-time="start"][data-segment="minutes"]'), b = this._overlay.querySelector('select[data-time="end"][data-segment="hours"]'), f = this._overlay.querySelector('select[data-time="end"][data-segment="minutes"]');
|
|
932
|
+
y && this._setClosestOptionValue(y, g.hours), o && this._setClosestOptionValue(o, g.minutes), b && this._setClosestOptionValue(b, S.hours), f && this._setClosestOptionValue(f, S.minutes);
|
|
933
|
+
const _ = this._isInteractionBlocked() || this._isReadonly();
|
|
934
|
+
[y, o, b, f].forEach((m) => {
|
|
935
|
+
m && (m.disabled = _);
|
|
936
|
+
}), this._overlay.querySelectorAll(".action, .preset").forEach((m) => {
|
|
937
|
+
m.disabled = _;
|
|
954
938
|
}), t || this._schedulePosition.run();
|
|
955
939
|
}
|
|
956
940
|
_renderOverlay() {
|
|
957
941
|
this._syncOverlayState();
|
|
958
942
|
}
|
|
959
943
|
_applyTimeFromOverlay(t) {
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
const
|
|
965
|
-
if (!Number.isFinite(o) || !Number.isFinite(n))
|
|
966
|
-
return;
|
|
967
|
-
const s = `${S(o)}:${S(n)}`;
|
|
944
|
+
const e = t.getAttribute("data-time"), i = this._overlay?.querySelector(`select[data-time="${e}"][data-segment="hours"]`), r = this._overlay?.querySelector(`select[data-time="${e}"][data-segment="minutes"]`);
|
|
945
|
+
if (!e || !i || !r) return;
|
|
946
|
+
const l = Number(i.value), n = Number(r.value);
|
|
947
|
+
if (!Number.isFinite(l) || !Number.isFinite(n)) return;
|
|
948
|
+
const s = `${w(l)}:${w(n)}`;
|
|
968
949
|
e === "start" && (this._pending.startTime = s), e === "end" && (this._pending.endTime = s), this._pending = this._normalizePendingState(this._pending), this._emitInput("time");
|
|
969
950
|
}
|
|
970
951
|
_todayIso() {
|
|
@@ -986,18 +967,16 @@ class _t extends tt {
|
|
|
986
967
|
this._pending.startDate = i.start, this._pending.endDate = i.end, this._pending = this._normalizePendingState(this._pending), this._emitInput("preset-month");
|
|
987
968
|
}
|
|
988
969
|
_onRootClick(t) {
|
|
989
|
-
var r;
|
|
990
970
|
const e = t.target;
|
|
991
|
-
if (!e)
|
|
992
|
-
|
|
993
|
-
const i = (r = e.closest("[data-action]")) == null ? void 0 : r.getAttribute("data-action");
|
|
971
|
+
if (!e) return;
|
|
972
|
+
const i = e.closest("[data-action]")?.getAttribute("data-action");
|
|
994
973
|
if (i && !this._isInteractionBlocked() && !(this._isReadonly() && i !== "toggle")) {
|
|
995
974
|
if (i === "toggle") {
|
|
996
975
|
this._restoreFocusEl = e, this._setOpen(!this._open, "toggle");
|
|
997
976
|
return;
|
|
998
977
|
}
|
|
999
978
|
if (i === "clear") {
|
|
1000
|
-
this._isInlineMode() ? (this._pending =
|
|
979
|
+
this._isInlineMode() ? (this._pending = x({ start: null, end: null }), this._emitInput("clear"), this._updateHostState()) : (this._pending = x({ start: null, end: null }), this._commit(this._pending, "clear"));
|
|
1001
980
|
return;
|
|
1002
981
|
}
|
|
1003
982
|
if (this._isInlineMode() && (i === "preset-today" || i === "preset-last7" || i === "preset-month")) {
|
|
@@ -1005,15 +984,14 @@ class _t extends tt {
|
|
|
1005
984
|
return;
|
|
1006
985
|
}
|
|
1007
986
|
if (this._isInlineMode() && i === "cancel") {
|
|
1008
|
-
this._pending =
|
|
987
|
+
this._pending = x(this._value), this._updateHostState();
|
|
1009
988
|
return;
|
|
1010
989
|
}
|
|
1011
990
|
this._isInlineMode() && i === "apply" && this._commit(this._pending, "apply");
|
|
1012
991
|
}
|
|
1013
992
|
}
|
|
1014
993
|
_onRootChange(t) {
|
|
1015
|
-
if (!this._isInlineMode())
|
|
1016
|
-
return;
|
|
994
|
+
if (!this._isInlineMode()) return;
|
|
1017
995
|
const e = t.target;
|
|
1018
996
|
if (e) {
|
|
1019
997
|
if (e.tagName.toLowerCase() === "ui-calendar") {
|
|
@@ -1021,8 +999,7 @@ class _t extends tt {
|
|
|
1021
999
|
return;
|
|
1022
1000
|
}
|
|
1023
1001
|
if (e instanceof HTMLSelectElement && e.closest(".inline-panel")) {
|
|
1024
|
-
if (!e.matches("select[data-time][data-segment]") || this._isInteractionBlocked() || this._isReadonly())
|
|
1025
|
-
return;
|
|
1002
|
+
if (!e.matches("select[data-time][data-segment]") || this._isInteractionBlocked() || this._isReadonly()) return;
|
|
1026
1003
|
if (this._applyTimeFromOverlay(e), this._shouldAutoCommit()) {
|
|
1027
1004
|
const i = this._valueFromPending();
|
|
1028
1005
|
if (i.start && i.end) {
|
|
@@ -1045,22 +1022,20 @@ class _t extends tt {
|
|
|
1045
1022
|
}
|
|
1046
1023
|
}
|
|
1047
1024
|
_onOverlayClick(t) {
|
|
1048
|
-
var r;
|
|
1049
1025
|
const e = t.target;
|
|
1050
|
-
if (!e)
|
|
1051
|
-
|
|
1052
|
-
const i = (r = e.closest("[data-action]")) == null ? void 0 : r.getAttribute("data-action");
|
|
1026
|
+
if (!e) return;
|
|
1027
|
+
const i = e.closest("[data-action]")?.getAttribute("data-action");
|
|
1053
1028
|
if (i && !(this._isInteractionBlocked() || this._isReadonly())) {
|
|
1054
1029
|
if (i === "backdrop") {
|
|
1055
1030
|
this._setOpen(!1, "outside");
|
|
1056
1031
|
return;
|
|
1057
1032
|
}
|
|
1058
1033
|
if (i === "cancel") {
|
|
1059
|
-
this._pending =
|
|
1034
|
+
this._pending = x(this._value), this._setOpen(!1, "cancel");
|
|
1060
1035
|
return;
|
|
1061
1036
|
}
|
|
1062
1037
|
if (i === "clear") {
|
|
1063
|
-
this._pending =
|
|
1038
|
+
this._pending = x({ start: null, end: null }), this._emitInput("clear"), this._renderOverlay();
|
|
1064
1039
|
return;
|
|
1065
1040
|
}
|
|
1066
1041
|
if (i === "preset-today" || i === "preset-last7" || i === "preset-month") {
|
|
@@ -1078,11 +1053,9 @@ class _t extends tt {
|
|
|
1078
1053
|
}
|
|
1079
1054
|
}
|
|
1080
1055
|
_onOverlayCalendar(t) {
|
|
1081
|
-
if (this._isInteractionBlocked() || this._isReadonly())
|
|
1082
|
-
return;
|
|
1056
|
+
if (this._isInteractionBlocked() || this._isReadonly()) return;
|
|
1083
1057
|
const e = t.target;
|
|
1084
|
-
if (!e || e.tagName.toLowerCase() !== "ui-calendar")
|
|
1085
|
-
return;
|
|
1058
|
+
if (!e || e.tagName.toLowerCase() !== "ui-calendar") return;
|
|
1086
1059
|
const i = t.detail;
|
|
1087
1060
|
if (!(!i || i.mode !== "range")) {
|
|
1088
1061
|
if (this._pending.startDate = i.start || null, this._pending.endDate = i.end || null, this._pending = this._normalizePendingState(this._pending), this._emitInput("calendar"), this._shouldAutoCommit() && this._pending.startDate && this._pending.endDate) {
|
|
@@ -1093,8 +1066,7 @@ class _t extends tt {
|
|
|
1093
1066
|
}
|
|
1094
1067
|
}
|
|
1095
1068
|
_onDocumentPointerDown(t) {
|
|
1096
|
-
if (!this._open || !this._overlay)
|
|
1097
|
-
return;
|
|
1069
|
+
if (!this._open || !this._overlay) return;
|
|
1098
1070
|
const e = t.composedPath();
|
|
1099
1071
|
e.includes(this) || e.includes(this._overlay) || this._setOpen(!1, "outside");
|
|
1100
1072
|
}
|
|
@@ -1102,45 +1074,44 @@ class _t extends tt {
|
|
|
1102
1074
|
this._open && t.key === "Escape" && (t.preventDefault(), this._setOpen(!1, "escape"));
|
|
1103
1075
|
}
|
|
1104
1076
|
_updateHostState() {
|
|
1105
|
-
if (!this._hasView)
|
|
1106
|
-
|
|
1107
|
-
const t = this.getAttribute("label") || "", e = this.getAttribute("hint") || "", i = this.getAttribute("error") || "", r = this._inlineError || i, o = !!(this._value.start || this._value.end), n = this.getAttribute("name") || "", s = this._isInlineMode(), a = this._translations(), l = r ? "error" : this._state(), p = this._formatDisplay();
|
|
1077
|
+
if (!this._hasView) return;
|
|
1078
|
+
const t = this.getAttribute("label") || "", e = this.getAttribute("hint") || "", i = this.getAttribute("error") || "", r = this._inlineError || i, l = !!(this._value.start || this._value.end), n = this.getAttribute("name") || "", s = this._isInlineMode(), a = this._translations(), u = r ? "error" : this._state(), p = this._formatDisplay();
|
|
1108
1079
|
this._display = p, this._state() === "loading" ? this.setAttribute("aria-busy", "true") : this.removeAttribute("aria-busy");
|
|
1109
|
-
const
|
|
1110
|
-
if (
|
|
1111
|
-
const
|
|
1112
|
-
e &&
|
|
1080
|
+
const g = this.root.querySelector(".label"), S = this.root.querySelector(".label-text"), y = this.root.querySelector(".required"), o = this.root.querySelector(".input"), b = this.root.querySelector('.btn[data-action="clear"]'), f = this.root.querySelector('.btn[data-action="toggle"]'), _ = this.root.querySelector(".hint"), m = this.root.querySelector(".error"), $ = this.root.querySelector(".hidden-input");
|
|
1081
|
+
if (g && (g.hidden = !t, g.id = this._labelId, g.setAttribute("for", this._inputId)), S && (S.textContent = t), y && (y.hidden = !this.hasAttribute("required")), o && (o.value !== p && (o.value = p), o.id = this._inputId, o.placeholder = a.dateRangeTimePlaceholder, o.readOnly = !0, o.disabled = this._isInteractionBlocked(), o.required = this.hasAttribute("required"), o.autocomplete = "off", o.setAttribute("role", "combobox"), o.setAttribute("aria-haspopup", "dialog"), o.setAttribute("aria-expanded", s ? "false" : String(this._open)), o.setAttribute("aria-controls", this._panelId), o.setAttribute("aria-invalid", r ? "true" : "false"), t ? o.setAttribute("aria-labelledby", this._labelId) : o.removeAttribute("aria-labelledby")), b && (b.hidden = !(this._clearable() && l), b.setAttribute("aria-label", a.clearDateRange), b.disabled = this._isInteractionBlocked()), f && (f.hidden = s, f.setAttribute("aria-label", a.toggleCalendar), f.setAttribute("aria-expanded", s ? "false" : String(this._open)), f.setAttribute("aria-controls", this._panelId), f.disabled = this._isInteractionBlocked()), _ && (_.id = this._hintId, _.hidden = !e, _.textContent = e), m && (m.id = this._errorId, m.hidden = !r, m.textContent = r), o) {
|
|
1082
|
+
const v = [];
|
|
1083
|
+
e && _ && !_.hidden && v.push(this._hintId), r && v.push(this._errorId), v.length ? o.setAttribute("aria-describedby", v.join(" ")) : o.removeAttribute("aria-describedby");
|
|
1113
1084
|
}
|
|
1114
1085
|
$ && ($.disabled = !n, $.name = n, $.value = X(this._value) || "");
|
|
1115
1086
|
const O = this.root.querySelector(".field");
|
|
1116
|
-
O && (O.dataset.open = this._open && !s ? "true" : "false", O.dataset.invalid = r ? "true" : "false", O.dataset.state =
|
|
1117
|
-
const
|
|
1118
|
-
if (
|
|
1119
|
-
|
|
1120
|
-
const
|
|
1121
|
-
|
|
1122
|
-
const R =
|
|
1087
|
+
O && (O.dataset.open = this._open && !s ? "true" : "false", O.dataset.invalid = r ? "true" : "false", O.dataset.state = u);
|
|
1088
|
+
const d = this.root.querySelector(".inline-panel");
|
|
1089
|
+
if (d) {
|
|
1090
|
+
d.hidden = !s, d.id = this._panelId, d.dataset.bare = this._isBare() ? "true" : "false", d.setAttribute("role", "dialog"), d.setAttribute("aria-modal", "false"), d.setAttribute("aria-label", t || a.selectDateRange);
|
|
1091
|
+
const v = d.querySelector(".panel-title");
|
|
1092
|
+
v && (v.textContent = t, v.hidden = !t);
|
|
1093
|
+
const R = d.querySelector(".head-title");
|
|
1123
1094
|
R && (R.textContent = t, R.hidden = !t);
|
|
1124
|
-
const H =
|
|
1095
|
+
const H = d.querySelector(".head-meta"), z = this._valueFromPending();
|
|
1125
1096
|
H && (H.textContent = z.start && z.end ? `${this._formatDateTimeDisplay(z.start)} — ${this._formatDateTimeDisplay(z.end)}` : a.selectDateRange);
|
|
1126
|
-
const V =
|
|
1097
|
+
const V = d.querySelector(".drtp-calendar-inline");
|
|
1127
1098
|
V && this._syncCalendar(V);
|
|
1128
|
-
const L =
|
|
1099
|
+
const L = d.querySelector('select[data-time="start"][data-segment="hours"]'), q = d.querySelector('select[data-time="start"][data-segment="minutes"]'), E = d.querySelector('select[data-time="end"][data-segment="hours"]'), M = d.querySelector('select[data-time="end"][data-segment="minutes"]'), F = k(this._pending.startTime) || { hours: 0, minutes: 0 }, N = k(this._pending.endTime) || { hours: 0, minutes: 0 };
|
|
1129
1100
|
L && this._setClosestOptionValue(L, F.hours), q && this._setClosestOptionValue(q, F.minutes), E && this._setClosestOptionValue(E, N.hours), M && this._setClosestOptionValue(M, N.minutes), [L, q, E, M].forEach((T) => {
|
|
1130
1101
|
T && (T.disabled = this._isInteractionBlocked() || this._isReadonly());
|
|
1131
1102
|
});
|
|
1132
|
-
const K =
|
|
1103
|
+
const K = d.querySelector('[data-action="preset-today"]');
|
|
1133
1104
|
K && (K.textContent = a.today);
|
|
1134
|
-
const U =
|
|
1105
|
+
const U = d.querySelector('[data-action="preset-last7"]');
|
|
1135
1106
|
U && (U.textContent = a.last7Days);
|
|
1136
|
-
const Z =
|
|
1107
|
+
const Z = d.querySelector('[data-action="preset-month"]');
|
|
1137
1108
|
Z && (Z.textContent = a.thisMonth);
|
|
1138
|
-
const j =
|
|
1109
|
+
const j = d.querySelector('[data-action="clear"]');
|
|
1139
1110
|
j && (j.textContent = a.clear);
|
|
1140
|
-
const W =
|
|
1111
|
+
const W = d.querySelector('[data-action="apply"]');
|
|
1141
1112
|
W && (W.textContent = a.apply);
|
|
1142
|
-
const J =
|
|
1143
|
-
J && (J.hidden = !G), Y && (Y.hidden = !G),
|
|
1113
|
+
const J = d.querySelector(".presets"), Y = d.querySelector(".footer"), G = this._showFooter();
|
|
1114
|
+
J && (J.hidden = !G), Y && (Y.hidden = !G), d.querySelectorAll(".action, .preset").forEach((T) => {
|
|
1144
1115
|
T.disabled = this._isInteractionBlocked() || this._isReadonly();
|
|
1145
1116
|
});
|
|
1146
1117
|
}
|