@editora/ui-core 0.1.18 → 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 -669
- 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-button.d.ts +1 -0
- package/dist/components/ui-button.d.ts.map +1 -1
- package/dist/components/ui-date-picker.d.ts.map +1 -1
- package/dist/components/ui-date-range-picker.d.ts.map +1 -1
- package/dist/components/ui-date-range-time-picker.d.ts +1 -0
- package/dist/components/ui-date-range-time-picker.d.ts.map +1 -1
- package/dist/components/ui-date-time-picker.d.ts +1 -0
- package/dist/components/ui-date-time-picker.d.ts.map +1 -1
- 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 +30 -9
- package/dist/date-picker.esm.js +90 -97
- package/dist/date-range-picker.cjs.js +22 -3
- package/dist/date-range-picker.esm.js +103 -108
- package/dist/date-range-time-picker.cjs.js +28 -12
- package/dist/date-range-time-picker.esm.js +137 -150
- package/dist/date-time-picker.cjs.js +25 -9
- package/dist/date-time-picker.esm.js +139 -155
- 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 +29 -21
- package/dist/time-picker.esm.js +96 -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 +3 -3
- 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 W } from "./ElementBase-
|
|
2
|
-
import { c as Y } from "./dismissable-layer-
|
|
3
|
-
import { r as J } from "./calendar-
|
|
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
|
|
5
|
-
import "./scroll-lock-31da444f.mjs";
|
|
6
|
-
import "./positioner-e9770c66.mjs";
|
|
1
|
+
import { E as W } from "./ElementBase-YlTLMsGk.mjs";
|
|
2
|
+
import { c as Y } from "./dismissable-layer-BmPIoK80.mjs";
|
|
3
|
+
import { r as J } from "./calendar-DLY4acgn.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 E, d as rt, p as F, o as N, a as st, m as R, j as Z, k as j, q as y, l as nt, c as at } from "./date-time-utils-y1N2gvG2.mjs";
|
|
7
5
|
let ot = 0;
|
|
8
6
|
const lt = `
|
|
9
7
|
<svg viewBox="0 0 20 20" class="icon-svg" aria-hidden="true" focusable="false">
|
|
@@ -288,6 +286,22 @@ const lt = `
|
|
|
288
286
|
}
|
|
289
287
|
}
|
|
290
288
|
`, pt = `
|
|
289
|
+
.ui-date-time-picker-overlay-host {
|
|
290
|
+
--ui-dtp-bg: color-mix(in srgb, var(--ui-color-surface, #ffffff) 96%, transparent);
|
|
291
|
+
--ui-dtp-surface: linear-gradient(
|
|
292
|
+
180deg,
|
|
293
|
+
color-mix(in srgb, var(--ui-color-surface, #ffffff) 98%, transparent),
|
|
294
|
+
color-mix(in srgb, var(--ui-color-surface, #ffffff) 90%, var(--ui-color-surface-alt, #f8fafc))
|
|
295
|
+
);
|
|
296
|
+
--ui-dtp-border: color-mix(in srgb, var(--ui-color-border, #cbd5e1) 78%, transparent);
|
|
297
|
+
--ui-dp-text: var(--ui-color-text, #0f172a);
|
|
298
|
+
--ui-dp-muted: var(--ui-color-muted, #64748b);
|
|
299
|
+
--ui-dtp-accent: var(--ui-color-primary, #2563eb);
|
|
300
|
+
--ui-dtp-panel-radius: 14px;
|
|
301
|
+
--ui-dtp-shadow: none;
|
|
302
|
+
--ui-dtp-duration: 160ms;
|
|
303
|
+
--ui-dtp-ease: cubic-bezier(0.2, 0.9, 0.24, 1);
|
|
304
|
+
}
|
|
291
305
|
.overlay { position: fixed; z-index: var(--ui-dtp-z, 1600); pointer-events: none; }
|
|
292
306
|
.panel {
|
|
293
307
|
pointer-events: auto;
|
|
@@ -571,8 +585,7 @@ class ht extends W {
|
|
|
571
585
|
return !Number.isFinite(t) || t < 1 ? 5 : Math.min(60, Math.trunc(t));
|
|
572
586
|
}
|
|
573
587
|
_formatDisplay(t) {
|
|
574
|
-
if (!t.date || !t.time)
|
|
575
|
-
return "";
|
|
588
|
+
if (!t.date || !t.time) return "";
|
|
576
589
|
const e = et(t.date, this._locale(), "locale", null);
|
|
577
590
|
return this._is12h() ? `${e} ${it(t.time, this._locale())}` : `${e} ${t.time}`;
|
|
578
591
|
}
|
|
@@ -580,17 +593,14 @@ class ht extends W {
|
|
|
580
593
|
return (this.getAttribute("format") || "24h") === "12h";
|
|
581
594
|
}
|
|
582
595
|
_parseDateInput(t) {
|
|
583
|
-
const e =
|
|
584
|
-
if (e)
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
const
|
|
590
|
-
|
|
591
|
-
return null;
|
|
592
|
-
const a = s.getFullYear(), o = String(s.getMonth() + 1).padStart(2, "0"), n = String(s.getDate()).padStart(2, "0");
|
|
593
|
-
return `${a}-${o}-${n}`;
|
|
596
|
+
const e = E(t);
|
|
597
|
+
if (e) return e;
|
|
598
|
+
const i = rt(t, this._locale());
|
|
599
|
+
if (i) return i;
|
|
600
|
+
const r = new Date(t);
|
|
601
|
+
if (!Number.isFinite(r.getTime())) return null;
|
|
602
|
+
const o = r.getFullYear(), a = String(r.getMonth() + 1).padStart(2, "0"), s = String(r.getDate()).padStart(2, "0");
|
|
603
|
+
return `${o}-${a}-${s}`;
|
|
594
604
|
}
|
|
595
605
|
_syncOpenAttribute(t) {
|
|
596
606
|
this._syncing = !0;
|
|
@@ -647,35 +657,33 @@ class ht extends W {
|
|
|
647
657
|
return t ? `${t.date}T${t.time}` : null;
|
|
648
658
|
}
|
|
649
659
|
_clampState(t) {
|
|
650
|
-
if (!t.date)
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
o = n, n = b;
|
|
660
|
+
if (!t.date) return { date: null, time: t.time };
|
|
661
|
+
const e = this._minDate(), i = this._maxDate(), r = st(t.date, e, i), o = t.time || "00:00";
|
|
662
|
+
let a = this._minDateTime(), s = this._maxDateTime();
|
|
663
|
+
if (a && s && R(a, s) > 0) {
|
|
664
|
+
const f = a;
|
|
665
|
+
a = s, s = f;
|
|
657
666
|
}
|
|
658
|
-
let
|
|
659
|
-
|
|
660
|
-
const d = j(
|
|
661
|
-
return d ? { date: d.date, time: d.time } : { date:
|
|
667
|
+
let n = Z(r, o) || `${r}T00:00`;
|
|
668
|
+
a && R(n, a) < 0 && (n = a), s && R(n, s) > 0 && (n = s);
|
|
669
|
+
const d = j(n);
|
|
670
|
+
return d ? { date: d.date, time: d.time } : { date: r, time: o };
|
|
662
671
|
}
|
|
663
672
|
_commit(t, e) {
|
|
664
|
-
if (this._isInteractionBlocked() || this._isReadonly())
|
|
665
|
-
return;
|
|
673
|
+
if (this._isInteractionBlocked() || this._isReadonly()) return;
|
|
666
674
|
if (!t.date && !t.time) {
|
|
667
675
|
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();
|
|
668
676
|
return;
|
|
669
677
|
}
|
|
670
|
-
const i = y(t.time || ""
|
|
671
|
-
date:
|
|
678
|
+
const i = y(t.time || ""), r = this._clampState({
|
|
679
|
+
date: E(t.date),
|
|
672
680
|
time: i ? `${p(i.hours)}:${p(i.minutes)}` : null
|
|
673
681
|
});
|
|
674
|
-
if (!
|
|
682
|
+
if (!r.date || !r.time) {
|
|
675
683
|
this._inlineError = this.getAttribute("error") || this._translations().invalidDateTime, this._emitInvalid(JSON.stringify(t), "parse"), this._updateHostState();
|
|
676
684
|
return;
|
|
677
685
|
}
|
|
678
|
-
this._value =
|
|
686
|
+
this._value = r, this._pending = { ...r }, this._draft = this._formatDisplay(r), this._inlineError = "", this._syncValueAttribute(this._value), this._emitInput(e), this._emitChange(e), this._updateHostState();
|
|
679
687
|
}
|
|
680
688
|
_setOpen(t, e) {
|
|
681
689
|
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 })));
|
|
@@ -698,25 +706,20 @@ class ht extends W {
|
|
|
698
706
|
}
|
|
699
707
|
}
|
|
700
708
|
_ensureOverlay() {
|
|
701
|
-
if (this._overlay || typeof document > "u")
|
|
702
|
-
return;
|
|
709
|
+
if (this._overlay || typeof document > "u") return;
|
|
703
710
|
const t = document.createElement("div");
|
|
704
|
-
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 =
|
|
711
|
+
t.className = "ui-date-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), 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 = nt());
|
|
705
712
|
}
|
|
706
713
|
_syncOverlayHostZIndex() {
|
|
707
|
-
if (!this._overlay || typeof window > "u")
|
|
708
|
-
return;
|
|
714
|
+
if (!this._overlay || typeof window > "u") return;
|
|
709
715
|
const t = window.getComputedStyle(this).getPropertyValue("--ui-dtp-z").trim();
|
|
710
716
|
this._overlay.style.zIndex = t || "1600";
|
|
711
717
|
}
|
|
712
718
|
_destroyOverlay() {
|
|
713
|
-
|
|
714
|
-
(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));
|
|
719
|
+
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.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));
|
|
715
720
|
}
|
|
716
721
|
_syncDismissableLayer() {
|
|
717
|
-
|
|
718
|
-
if ((i = this._dismissableLayer) == null || i.destroy(), this._dismissableLayer = null, !this._open || !this._overlay)
|
|
719
|
-
return;
|
|
722
|
+
if (this._dismissableLayer?.destroy(), this._dismissableLayer = null, !this._open || !this._overlay) return;
|
|
720
723
|
const t = this._overlay.querySelector(".panel, .sheet"), e = this.root.querySelector(".field");
|
|
721
724
|
t && (this._dismissableLayer = Y({
|
|
722
725
|
node: t,
|
|
@@ -724,40 +727,38 @@ class ht extends W {
|
|
|
724
727
|
closeOnEscape: !0,
|
|
725
728
|
closeOnPointerOutside: !0,
|
|
726
729
|
closeOnFocusOutside: !1,
|
|
727
|
-
onBeforeDismiss: (
|
|
730
|
+
onBeforeDismiss: (i) => i === "escape-key" ? (this._setOpen(!1, "escape"), !1) : (i === "outside-pointer" && this._setOpen(!1, "outside"), !1)
|
|
728
731
|
}));
|
|
729
732
|
}
|
|
730
733
|
_positionOverlay() {
|
|
731
|
-
if (!this._overlay || !this._open || this._isMobileSheet())
|
|
732
|
-
return;
|
|
734
|
+
if (!this._overlay || !this._open || this._isMobileSheet()) return;
|
|
733
735
|
const t = this.root.querySelector(".field"), e = this._overlay.querySelector(".panel");
|
|
734
|
-
if (!t || !e)
|
|
735
|
-
|
|
736
|
-
const i = e.getAttribute("data-placement"), s = at(
|
|
736
|
+
if (!t || !e) return;
|
|
737
|
+
const i = e.getAttribute("data-placement"), r = at(
|
|
737
738
|
t.getBoundingClientRect(),
|
|
738
739
|
e.getBoundingClientRect(),
|
|
739
740
|
8,
|
|
740
741
|
8,
|
|
741
742
|
i === "top" ? "top" : i === "bottom" ? "bottom" : null
|
|
742
743
|
);
|
|
743
|
-
e.style.position = "absolute", e.style.top = `${Math.round(
|
|
744
|
+
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);
|
|
744
745
|
}
|
|
745
746
|
_timeOptions() {
|
|
746
|
-
const t = y(this._pending.time || "00:00"
|
|
747
|
-
const
|
|
748
|
-
return `<option value="${
|
|
749
|
-
}).join("") : Array.from({ length: 24 }, (
|
|
750
|
-
const
|
|
751
|
-
return `<option value="${
|
|
752
|
-
}).join(""),
|
|
753
|
-
return { hours: i, minutes:
|
|
747
|
+
const t = y(this._pending.time || "00:00") || { hours: 0, minutes: 0 }, e = this._minuteStep(), i = this._is12h() ? Array.from({ length: 12 }, (a, s) => {
|
|
748
|
+
const n = s + 1, d = t.hours % 12 || 12;
|
|
749
|
+
return `<option value="${n}" ${n === d ? "selected" : ""}>${p(n)}</option>`;
|
|
750
|
+
}).join("") : Array.from({ length: 24 }, (a, s) => `<option value="${s}" ${s === t.hours ? "selected" : ""}>${p(s)}</option>`).join(""), r = Array.from({ length: Math.ceil(60 / e) }, (a, s) => {
|
|
751
|
+
const n = Math.min(59, s * e);
|
|
752
|
+
return `<option value="${n}" ${n === t.minutes ? "selected" : ""}>${p(n)}</option>`;
|
|
753
|
+
}).join(""), o = t.hours >= 12 ? "pm" : "am";
|
|
754
|
+
return { hours: i, minutes: r, meridiem: o };
|
|
754
755
|
}
|
|
755
756
|
_renderSurfaceInner(t, e = !1) {
|
|
756
|
-
const i = this._translations(),
|
|
757
|
+
const i = this._translations(), r = this._timeOptions(), o = (this.getAttribute("label") || "").trim(), a = c(o), s = c(o || i.selectDate), n = this._pending.date && this._pending.time ? this._formatDisplay(this._pending) : "", d = `
|
|
757
758
|
<header class="head">
|
|
758
759
|
<div>
|
|
759
|
-
<p class="head-title" ${
|
|
760
|
-
<p class="head-meta">${c(
|
|
760
|
+
<p class="head-title" ${o ? "" : "hidden"}>${a}</p>
|
|
761
|
+
<p class="head-meta">${c(n || i.selectDate)}</p>
|
|
761
762
|
</div>
|
|
762
763
|
</header>
|
|
763
764
|
<div class="content">
|
|
@@ -765,9 +766,9 @@ class ht extends W {
|
|
|
765
766
|
<section class="time-panel" part="time">
|
|
766
767
|
<span class="icon" aria-hidden="true">${K}</span>
|
|
767
768
|
<div class="time-grid" data-meridiem="${this._is12h() ? "true" : "false"}">
|
|
768
|
-
<div><label>${c(i.hour)}</label><select data-segment="hours">${
|
|
769
|
-
<div><label>${c(i.minute)}</label><select data-segment="minutes">${
|
|
770
|
-
${this._is12h() ? `<div><label>${c(i.meridiem)}</label><select data-segment="meridiem"><option value="am" ${
|
|
769
|
+
<div><label>${c(i.hour)}</label><select data-segment="hours">${r.hours}</select></div>
|
|
770
|
+
<div><label>${c(i.minute)}</label><select data-segment="minutes">${r.minutes}</select></div>
|
|
771
|
+
${this._is12h() ? `<div><label>${c(i.meridiem)}</label><select data-segment="meridiem"><option value="am" ${r.meridiem === "am" ? "selected" : ""}>${c(i.am)}</option><option value="pm" ${r.meridiem === "pm" ? "selected" : ""}>${c(i.pm)}</option></select></div>` : ""}
|
|
771
772
|
</div>
|
|
772
773
|
</section>
|
|
773
774
|
</div>
|
|
@@ -781,22 +782,22 @@ class ht extends W {
|
|
|
781
782
|
return e ? d : `
|
|
782
783
|
<style>${pt}</style>
|
|
783
784
|
${t ? '<div class="sheet-backdrop" data-action="backdrop"></div>' : ""}
|
|
784
|
-
<section class="${t ? "sheet" : "panel"}" id="${this._panelId}" role="dialog" aria-modal="${t ? "true" : "false"}" aria-label="${
|
|
785
|
+
<section class="${t ? "sheet" : "panel"}" id="${this._panelId}" role="dialog" aria-modal="${t ? "true" : "false"}" aria-label="${s}" part="${t ? "sheet" : "popover"}">${d}</section>
|
|
785
786
|
`;
|
|
786
787
|
}
|
|
787
788
|
_syncCalendar(t) {
|
|
788
|
-
const e = (
|
|
789
|
-
if (
|
|
790
|
-
t.hasAttribute(
|
|
789
|
+
const e = (s, n) => {
|
|
790
|
+
if (n == null || n === "") {
|
|
791
|
+
t.hasAttribute(s) && t.removeAttribute(s);
|
|
791
792
|
return;
|
|
792
793
|
}
|
|
793
|
-
t.getAttribute(
|
|
794
|
-
}, i = (
|
|
795
|
-
|
|
794
|
+
t.getAttribute(s) !== n && t.setAttribute(s, n);
|
|
795
|
+
}, i = (s, n) => {
|
|
796
|
+
n ? e(s, "") : e(s, null);
|
|
796
797
|
};
|
|
797
798
|
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"));
|
|
798
|
-
const
|
|
799
|
-
e("size",
|
|
799
|
+
const o = this.getAttribute("size") || "sm", a = t.classList.contains("dt-calendar-inline");
|
|
800
|
+
e("size", o === "lg" ? "md" : "sm"), e("variant", this.getAttribute("variant")), i("readonly", this._isReadonly()), i("disabled", this._isInteractionBlocked()), i("bare", this._isBare()), e("tabindex", "-1"), o === "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().selectDate);
|
|
800
801
|
}
|
|
801
802
|
_overlaySignature(t) {
|
|
802
803
|
return [
|
|
@@ -808,45 +809,42 @@ class ht extends W {
|
|
|
808
809
|
].join(":");
|
|
809
810
|
}
|
|
810
811
|
_ensureOverlayContent(t) {
|
|
811
|
-
if (!this._overlay)
|
|
812
|
-
return;
|
|
812
|
+
if (!this._overlay) return;
|
|
813
813
|
const e = this._overlaySignature(t);
|
|
814
814
|
this._overlayKey === e && this._overlay.querySelector(".dt-calendar") || (this._overlayKey = e, this._overlay.innerHTML = t ? `<div class="sheet-wrap">${this._renderSurfaceInner(!0)}</div>` : `<div class="overlay">${this._renderSurfaceInner(!1)}</div>`);
|
|
815
815
|
}
|
|
816
816
|
_setClosestOptionValue(t, e) {
|
|
817
|
-
const i = Array.from(t.options).map((
|
|
818
|
-
if (!i.length)
|
|
819
|
-
|
|
820
|
-
let
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
r < a && (s = n, a = r);
|
|
817
|
+
const i = Array.from(t.options).map((a) => Number(a.value)).filter((a) => Number.isFinite(a));
|
|
818
|
+
if (!i.length) return;
|
|
819
|
+
let r = i[0], o = Math.abs(r - e);
|
|
820
|
+
for (let a = 1; a < i.length; a += 1) {
|
|
821
|
+
const s = i[a], n = Math.abs(s - e);
|
|
822
|
+
n < o && (r = s, o = n);
|
|
824
823
|
}
|
|
825
|
-
t.value = String(
|
|
824
|
+
t.value = String(r);
|
|
826
825
|
}
|
|
827
826
|
_syncOverlayState() {
|
|
828
|
-
if (!this._overlay)
|
|
829
|
-
return;
|
|
827
|
+
if (!this._overlay) return;
|
|
830
828
|
this._syncOverlayHostZIndex();
|
|
831
829
|
const t = this._isMobileSheet();
|
|
832
830
|
this._ensureOverlayContent(t), this._syncDismissableLayer();
|
|
833
|
-
const e = this._translations(), i = this._overlay.querySelector(".panel, .sheet"),
|
|
834
|
-
i && (i.dataset.bare = this._isBare() ? "true" : "false"),
|
|
835
|
-
const
|
|
836
|
-
if (
|
|
831
|
+
const e = this._translations(), i = this._overlay.querySelector(".panel, .sheet"), r = this._overlay.querySelector(".footer");
|
|
832
|
+
i && (i.dataset.bare = this._isBare() ? "true" : "false"), r && (r.hidden = !this._showFooter());
|
|
833
|
+
const o = this._overlay.querySelector(".head-title");
|
|
834
|
+
if (o) {
|
|
837
835
|
const l = (this.getAttribute("label") || "").trim();
|
|
838
|
-
|
|
836
|
+
o.textContent = l, o.hidden = !l;
|
|
839
837
|
}
|
|
840
|
-
const
|
|
841
|
-
|
|
842
|
-
const
|
|
843
|
-
|
|
844
|
-
const
|
|
838
|
+
const a = this._overlay.querySelector(".head-meta");
|
|
839
|
+
a && (a.textContent = this._pending.date && this._pending.time ? this._formatDisplay(this._pending) : e.selectDate);
|
|
840
|
+
const s = this._overlay.querySelector(".dt-calendar");
|
|
841
|
+
s && this._syncCalendar(s);
|
|
842
|
+
const n = y(this._pending.time || "00:00") || { hours: 0, minutes: 0 }, d = this._overlay.querySelector('select[data-segment="hours"]'), f = this._overlay.querySelector('select[data-segment="minutes"]'), m = this._overlay.querySelector('select[data-segment="meridiem"]');
|
|
845
843
|
if (d) {
|
|
846
|
-
const l = this._is12h() ?
|
|
844
|
+
const l = this._is12h() ? n.hours % 12 || 12 : n.hours;
|
|
847
845
|
this._setClosestOptionValue(d, l), d.disabled = this._isInteractionBlocked() || this._isReadonly();
|
|
848
846
|
}
|
|
849
|
-
|
|
847
|
+
f && (this._setClosestOptionValue(f, n.minutes), f.disabled = this._isInteractionBlocked() || this._isReadonly()), m && (m.value = n.hours >= 12 ? "pm" : "am", m.disabled = this._isInteractionBlocked() || this._isReadonly());
|
|
850
848
|
const S = this._isInteractionBlocked() || this._isReadonly();
|
|
851
849
|
this._overlay.querySelectorAll(".action").forEach((l) => {
|
|
852
850
|
l.disabled = S;
|
|
@@ -856,28 +854,24 @@ class ht extends W {
|
|
|
856
854
|
this._syncOverlayState();
|
|
857
855
|
}
|
|
858
856
|
_applyTimeFromSurface(t) {
|
|
859
|
-
const e = t.querySelector('select[data-segment="hours"]'), i = t.querySelector('select[data-segment="minutes"]'),
|
|
860
|
-
if (!e || !i)
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
return;
|
|
865
|
-
let n = a;
|
|
857
|
+
const e = t.querySelector('select[data-segment="hours"]'), i = t.querySelector('select[data-segment="minutes"]'), r = t.querySelector('select[data-segment="meridiem"]');
|
|
858
|
+
if (!e || !i) return;
|
|
859
|
+
const o = Number(e.value), a = Number(i.value);
|
|
860
|
+
if (!Number.isFinite(o) || !Number.isFinite(a)) return;
|
|
861
|
+
let s = o;
|
|
866
862
|
if (this._is12h()) {
|
|
867
|
-
const
|
|
868
|
-
|
|
863
|
+
const n = r?.value === "pm" ? "pm" : "am";
|
|
864
|
+
n === "pm" && s < 12 && (s += 12), n === "am" && s === 12 && (s = 0);
|
|
869
865
|
}
|
|
870
866
|
this._pending = this._clampState({
|
|
871
867
|
date: this._pending.date,
|
|
872
|
-
time: `${p(
|
|
868
|
+
time: `${p(s)}:${p(a)}`
|
|
873
869
|
}), this._emitInput("time");
|
|
874
870
|
}
|
|
875
871
|
_onRootClick(t) {
|
|
876
|
-
var s;
|
|
877
872
|
const e = t.target;
|
|
878
|
-
if (!e)
|
|
879
|
-
|
|
880
|
-
const i = (s = e.closest("[data-action]")) == null ? void 0 : s.getAttribute("data-action");
|
|
873
|
+
if (!e) return;
|
|
874
|
+
const i = e.closest("[data-action]")?.getAttribute("data-action");
|
|
881
875
|
if (i && !(this._isInteractionBlocked() || this._isReadonly())) {
|
|
882
876
|
if (i === "toggle") {
|
|
883
877
|
this._restoreFocusEl = e, this._setOpen(!this._open, "toggle");
|
|
@@ -888,8 +882,8 @@ class ht extends W {
|
|
|
888
882
|
return;
|
|
889
883
|
}
|
|
890
884
|
if (this._isInlineMode() && i === "now") {
|
|
891
|
-
const
|
|
892
|
-
this._pending = this._clampState({ date:
|
|
885
|
+
const r = /* @__PURE__ */ new Date(), o = String(r.getMonth() + 1).padStart(2, "0"), a = String(r.getDate()).padStart(2, "0"), s = `${r.getFullYear()}-${o}-${a}`, n = `${p(r.getHours())}:${p(r.getMinutes())}`;
|
|
886
|
+
this._pending = this._clampState({ date: s, time: n }), this._emitInput("now"), this._updateHostState();
|
|
893
887
|
return;
|
|
894
888
|
}
|
|
895
889
|
if (this._isInlineMode() && i === "cancel") {
|
|
@@ -900,8 +894,7 @@ class ht extends W {
|
|
|
900
894
|
}
|
|
901
895
|
}
|
|
902
896
|
_onRootChange(t) {
|
|
903
|
-
if (!this._isInlineMode())
|
|
904
|
-
return;
|
|
897
|
+
if (!this._isInlineMode()) return;
|
|
905
898
|
const e = t.target;
|
|
906
899
|
if (e) {
|
|
907
900
|
if (e.tagName.toLowerCase() === "ui-calendar") {
|
|
@@ -909,11 +902,9 @@ class ht extends W {
|
|
|
909
902
|
return;
|
|
910
903
|
}
|
|
911
904
|
if (e instanceof HTMLSelectElement && e.closest(".inline-panel")) {
|
|
912
|
-
if (!e.matches("select[data-segment]") || this._isInteractionBlocked() || this._isReadonly())
|
|
913
|
-
return;
|
|
905
|
+
if (!e.matches("select[data-segment]") || this._isInteractionBlocked() || this._isReadonly()) return;
|
|
914
906
|
const i = this.root.querySelector(".inline-panel");
|
|
915
|
-
if (!i)
|
|
916
|
-
return;
|
|
907
|
+
if (!i) return;
|
|
917
908
|
if (this._applyTimeFromSurface(i), this._shouldAutoCommit() && this._pending.date && this._pending.time) {
|
|
918
909
|
this._commit(this._pending, "time");
|
|
919
910
|
return;
|
|
@@ -928,24 +919,23 @@ class ht extends W {
|
|
|
928
919
|
}
|
|
929
920
|
_onRootBlur(t) {
|
|
930
921
|
const e = t.target;
|
|
931
|
-
if (!(e instanceof HTMLInputElement) || !e.classList.contains("input") || !this._allowInput() || this._isInteractionBlocked())
|
|
932
|
-
return;
|
|
922
|
+
if (!(e instanceof HTMLInputElement) || !e.classList.contains("input") || !this._allowInput() || this._isInteractionBlocked()) return;
|
|
933
923
|
const i = this._draft.trim();
|
|
934
924
|
if (!i) {
|
|
935
925
|
this._commit({ date: null, time: null }, "blur");
|
|
936
926
|
return;
|
|
937
927
|
}
|
|
938
|
-
const
|
|
939
|
-
if (!
|
|
928
|
+
const r = /^(.+)\s+(\d{1,2}:\d{2}(?::\d{2})?(?:\s?[ap]m)?)$/i.exec(i);
|
|
929
|
+
if (!r) {
|
|
940
930
|
this._inlineError = this.getAttribute("error") || this._translations().invalidDateTime, this._emitInvalid(i, "parse"), this._updateHostState();
|
|
941
931
|
return;
|
|
942
932
|
}
|
|
943
|
-
const
|
|
944
|
-
if (!
|
|
933
|
+
const o = this._parseDateInput(r[1]), a = y(r[2]) ? r[2] : null;
|
|
934
|
+
if (!o || !a) {
|
|
945
935
|
this._inlineError = this.getAttribute("error") || this._translations().invalidDateTime, this._emitInvalid(i, "parse"), this._updateHostState();
|
|
946
936
|
return;
|
|
947
937
|
}
|
|
948
|
-
this._commit({ date:
|
|
938
|
+
this._commit({ date: o, time: a }, "blur");
|
|
949
939
|
}
|
|
950
940
|
_onRootKeyDown(t) {
|
|
951
941
|
const e = t;
|
|
@@ -958,11 +948,9 @@ class ht extends W {
|
|
|
958
948
|
}
|
|
959
949
|
}
|
|
960
950
|
_onOverlayClick(t) {
|
|
961
|
-
var s;
|
|
962
951
|
const e = t.target;
|
|
963
|
-
if (!e)
|
|
964
|
-
|
|
965
|
-
const i = (s = e.closest("[data-action]")) == null ? void 0 : s.getAttribute("data-action");
|
|
952
|
+
if (!e) return;
|
|
953
|
+
const i = e.closest("[data-action]")?.getAttribute("data-action");
|
|
966
954
|
if (i && !this._isInteractionBlocked() && !(this._isReadonly() && i !== "toggle")) {
|
|
967
955
|
if (i === "backdrop") {
|
|
968
956
|
this._setOpen(!1, "outside");
|
|
@@ -977,8 +965,8 @@ class ht extends W {
|
|
|
977
965
|
return;
|
|
978
966
|
}
|
|
979
967
|
if (i === "now") {
|
|
980
|
-
const
|
|
981
|
-
this._pending = this._clampState({ date:
|
|
968
|
+
const r = /* @__PURE__ */ new Date(), o = String(r.getMonth() + 1).padStart(2, "0"), a = String(r.getDate()).padStart(2, "0"), s = `${r.getFullYear()}-${o}-${a}`, n = `${p(r.getHours())}:${p(r.getMinutes())}`;
|
|
969
|
+
this._pending = this._clampState({ date: s, time: n }), this._emitInput("now"), this._renderOverlay();
|
|
982
970
|
return;
|
|
983
971
|
}
|
|
984
972
|
i === "apply" && (this._commit(this._pending, "apply"), this._setOpen(!1, "apply"));
|
|
@@ -989,14 +977,12 @@ class ht extends W {
|
|
|
989
977
|
e instanceof HTMLSelectElement && e.matches("select[data-segment]") && (this._isInteractionBlocked() || this._overlay && (this._applyTimeFromSurface(this._overlay), this._shouldAutoCommit() && this._pending.date && this._pending.time && (this._commit(this._pending, "time"), this._setOpen(!1, "time"))));
|
|
990
978
|
}
|
|
991
979
|
_onOverlayCalendar(t) {
|
|
992
|
-
if (this._isInteractionBlocked() || this._isReadonly())
|
|
993
|
-
return;
|
|
980
|
+
if (this._isInteractionBlocked() || this._isReadonly()) return;
|
|
994
981
|
const e = t.target;
|
|
995
|
-
if (!e || e.tagName.toLowerCase() !== "ui-calendar")
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
if (this._pending = this._clampState({ date: a, time: this._pending.time || "09:00" }), this._emitInput("calendar"), this._shouldAutoCommit() && this._pending.time) {
|
|
982
|
+
if (!e || e.tagName.toLowerCase() !== "ui-calendar") return;
|
|
983
|
+
const i = t.type, r = t.detail, o = E(i === "select" ? r?.value || null : r?.value);
|
|
984
|
+
if (o) {
|
|
985
|
+
if (this._pending = this._clampState({ date: o, time: this._pending.time || "09:00" }), this._emitInput("calendar"), this._shouldAutoCommit() && this._pending.time) {
|
|
1000
986
|
this._commit(this._pending, "calendar"), this._setOpen(!1, "calendar");
|
|
1001
987
|
return;
|
|
1002
988
|
}
|
|
@@ -1004,8 +990,7 @@ class ht extends W {
|
|
|
1004
990
|
}
|
|
1005
991
|
}
|
|
1006
992
|
_onDocumentPointerDown(t) {
|
|
1007
|
-
if (!this._open || !this._overlay)
|
|
1008
|
-
return;
|
|
993
|
+
if (!this._open || !this._overlay) return;
|
|
1009
994
|
const e = t.composedPath();
|
|
1010
995
|
e.includes(this) || e.includes(this._overlay) || this._setOpen(!1, "outside");
|
|
1011
996
|
}
|
|
@@ -1013,21 +998,20 @@ class ht extends W {
|
|
|
1013
998
|
this._open && t.key === "Escape" && (t.preventDefault(), this._setOpen(!1, "escape"));
|
|
1014
999
|
}
|
|
1015
1000
|
_updateHostState() {
|
|
1016
|
-
if (!this._hasView)
|
|
1017
|
-
|
|
1018
|
-
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();
|
|
1001
|
+
if (!this._hasView) return;
|
|
1002
|
+
const t = this.getAttribute("label") || "", e = this.getAttribute("hint") || "", i = this.getAttribute("error") || "", r = this._inlineError || i, o = !!x(this._value), a = this.getAttribute("name") || "", s = this._allowInput() ? this._draft : this._formatDisplay(this._value), n = this._isInlineMode(), d = this._translations(), f = r ? "error" : this._state();
|
|
1019
1003
|
this._state() === "loading" ? this.setAttribute("aria-busy", "true") : this.removeAttribute("aria-busy");
|
|
1020
|
-
const m = this.root.querySelector(".label"), S = this.root.querySelector(".label-text"), D = this.root.querySelector(".required"), l = this.root.querySelector(".input"),
|
|
1021
|
-
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 !==
|
|
1004
|
+
const m = this.root.querySelector(".label"), S = this.root.querySelector(".label-text"), D = this.root.querySelector(".required"), l = this.root.querySelector(".input"), w = this.root.querySelector('.btn[data-action="clear"]'), b = this.root.querySelector('.btn[data-action="toggle"]'), g = this.root.querySelector(".hint"), I = this.root.querySelector(".error"), k = this.root.querySelector(".hidden-input");
|
|
1005
|
+
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 !== s && (l.value = s), 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", n ? "false" : String(this._open)), l.setAttribute("aria-controls", this._panelId), l.setAttribute("aria-invalid", r ? "true" : "false"), t ? l.setAttribute("aria-labelledby", this._labelId) : l.removeAttribute("aria-labelledby")), w && (w.hidden = !(this._clearable() && o), w.setAttribute("aria-label", d.clear), w.disabled = this._isInteractionBlocked()), b && (b.hidden = n, b.setAttribute("aria-label", d.toggleCalendar), b.setAttribute("aria-expanded", n ? "false" : String(this._open)), b.setAttribute("aria-controls", this._panelId), b.disabled = this._isInteractionBlocked()), g && (g.id = this._hintId, g.hidden = !e, g.textContent = e), I && (I.id = this._errorId, I.hidden = !r, I.textContent = r), l) {
|
|
1022
1006
|
const _ = [];
|
|
1023
|
-
e && g && !g.hidden && _.push(this._hintId),
|
|
1007
|
+
e && g && !g.hidden && _.push(this._hintId), r && _.push(this._errorId), _.length ? l.setAttribute("aria-describedby", _.join(" ")) : l.removeAttribute("aria-describedby");
|
|
1024
1008
|
}
|
|
1025
|
-
k && (k.disabled = !
|
|
1009
|
+
k && (k.disabled = !a, k.name = a, k.value = x(this._value) || "");
|
|
1026
1010
|
const A = this.root.querySelector(".field");
|
|
1027
|
-
A && (A.dataset.open = this._open && !
|
|
1011
|
+
A && (A.dataset.open = this._open && !n ? "true" : "false", A.dataset.invalid = r ? "true" : "false", A.dataset.state = f);
|
|
1028
1012
|
const u = this.root.querySelector(".inline-panel");
|
|
1029
1013
|
if (u) {
|
|
1030
|
-
u.hidden = !
|
|
1014
|
+
u.hidden = !n, 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);
|
|
1031
1015
|
const _ = u.querySelector(".panel-title");
|
|
1032
1016
|
_ && (_.textContent = t, _.hidden = !t);
|
|
1033
1017
|
const $ = u.querySelector(".head-title");
|
|
@@ -1044,7 +1028,7 @@ class ht extends W {
|
|
|
1044
1028
|
H && (H.hidden = !this._showFooter());
|
|
1045
1029
|
const V = u.querySelector(".dt-calendar-inline");
|
|
1046
1030
|
V && this._syncCalendar(V);
|
|
1047
|
-
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"
|
|
1031
|
+
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") || { hours: 0, minutes: 0 };
|
|
1048
1032
|
if (O) {
|
|
1049
1033
|
const L = this._is12h() ? C.hours % 12 || 12 : C.hours;
|
|
1050
1034
|
this._setClosestOptionValue(O, L), O.disabled = this._isInteractionBlocked() || this._isReadonly();
|
|
@@ -1053,7 +1037,7 @@ class ht extends W {
|
|
|
1053
1037
|
L.disabled = this._isInteractionBlocked() || this._isReadonly();
|
|
1054
1038
|
});
|
|
1055
1039
|
}
|
|
1056
|
-
!
|
|
1040
|
+
!n && this._open && this._syncOverlayState(), n && this._destroyOverlay();
|
|
1057
1041
|
}
|
|
1058
1042
|
render() {
|
|
1059
1043
|
if (!this._hasView) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const l=require("./calendar-Dkof-FTK.js"),C=require("./scroll-lock-BX6e3Ced.js"),I=require("./positioner-D_fqyx_j.js"),w=new Map,v=24;function y(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 N(t){return t.replace(/[.\-]/g,"/").replace(/\s+/g," ").trim()}function O(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 L(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 U(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 F(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 P(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 g(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=d(e[2]);if(!r)return null;const o=e[2].split(":").length===3;return{date:n,time:M(r,o)}}function z(t,e){if(!t||!e)return null;const n=m(t),r=d(e);return!n||!r?null:`${n}T${M(r,e.split(":").length>=3)}`}function A(t){if(!t)return null;const e=m(t);return e||g(t)?.date||null}function Y(t){if(!t)return null;const e=g(t);if(e)return e;const n=m(t);return n?{date:n,time:"00:00"}:null}function k(t,e,n){const r=l.parseISO(t);if(!r)return t;const o=`${e}::${JSON.stringify({})}`;let i=w.get(o);return i||(i=new Intl.DateTimeFormat(e,{year:"numeric",month:"short",day:"2-digit",timeZone:"UTC"}),w.set(o,i)),i.format(new Date(Date.UTC(r.y,r.m-1,r.d)))}function q(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=O(e),s=L(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 k(t,e)}function B(t,e){const n=m(t.trim());if(n)return n;const r=N(t);if(!r)return null;const o=m(r);if(o)return o;const i=r.split("/").map($=>$.trim()).filter(Boolean);if(i.length!==3)return null;const s=b(i[0]),a=b(i[1]),h=b(i[2]);if(s==null||a==null||h==null)return null;let f=h;f<100&&(f+=f>=70?1900:2e3);const p=e.toLowerCase().startsWith("en-us"),c=p?s:a,D=p?a:s;if(f<1e3||c<1||c>12||D<1||D>31)return null;const T=`${f}-${u(c)}-${u(D)}`;return m(T)}function d(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)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(y(t.hours,0,23)),r=u(y(t.minutes,0,59));if(!e)return`${n}:${r}`;const o=u(y(t.seconds,0,59));return`${n}:${r}:${o}`}function x(t,e){const n=d(t);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=d(t),r=d(e);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 H(t,e,n){const r=d(t);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 E(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 W(t,e){const n=g(t),r=g(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 Z(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 _(t,e){const n=y(e,1,366);return{start:l.addDaysISO(t,-(n-1)),end:t}}function R(t,e,n=8,r=8,o=null){const s=(typeof window<"u"?window.innerHeight:800)-t.bottom-r-n,a=t.top-r-n,h=s>=e.height,f=a>=e.height,p=o==="top"?"top":"bottom";let c;if(h&&!f)c="bottom";else if(f&&!h)c="top";else if(f&&h)c=p;else{const T=p==="bottom"?s:a,$=p==="bottom"?a:s;T>0&&$<=T+v?c=p:c=s>=a?"bottom":"top"}const D=I.computePositionState(t,e,{placement:`${c}-start`,strategy:"fixed",offset:r,shift:!1,flip:!1,boundaryPadding:n});return{top:Math.round(D.y),left:Math.round(D.x),placement:c}}function G(t){let e=0;return{run:()=>{e||(e=requestAnimationFrame(()=>{e=0,t()}))},cancel:()=>{e&&(cancelAnimationFrame(e),e=0)}}}function J(t){return(t||"popover")==="inline"||typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(max-width: 639px)").matches}function K(){return C.acquireBodyScrollLock()}exports.clampDateIso=E;exports.clampTime=H;exports.combineDateTime=z;exports.compareDateTimes=W;exports.compareTimes=S;exports.computeLastDaysRange=_;exports.computeMonthRange=Z;exports.computePopoverPosition=R;exports.eventOriginatesWithin=F;exports.formatDateForDisplay=q;exports.formatTime=M;exports.isTruthyAttr=U;exports.lockBodyScroll=K;exports.normalizeDateIso=m;exports.normalizeLocale=P;exports.parseConstraintDate=A;exports.parseConstraintDateTime=Y;exports.parseTimeInput=d;exports.parseUserDateInput=B;exports.rafThrottle=G;exports.shouldUseMobileSheet=J;exports.splitDateTime=g;exports.to12hDisplay=x;
|