@editora/ui-core 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ElementBase-DxbvhLJs.js → ElementBase-CbUsP3D6.js} +1 -1
- package/dist/{ElementBase-BeZT54Hj.mjs → ElementBase-D5QsC5Vw.mjs} +10 -1
- package/dist/ElementBase.d.ts +7 -0
- package/dist/ElementBase.d.ts.map +1 -1
- package/dist/accordion.cjs.js +1 -1
- package/dist/accordion.esm.js +1 -1
- package/dist/add-icons-CVeHOsWl.js +1 -0
- package/dist/add-icons-DBUZJ0g7.mjs +14 -0
- package/dist/add-icons.cjs.js +1 -0
- package/dist/add-icons.d.ts +16 -0
- package/dist/add-icons.d.ts.map +1 -0
- package/dist/add-icons.esm.js +4 -0
- package/dist/alert-dialog.cjs.js +24 -24
- package/dist/alert-dialog.esm.js +112 -107
- package/dist/alert.cjs.js +8 -8
- package/dist/alert.esm.js +22 -22
- package/dist/animated-beam.cjs.js +1 -1
- package/dist/animated-beam.esm.js +1 -1
- package/dist/animated-list.cjs.js +1 -1
- package/dist/animated-list.esm.js +1 -1
- package/dist/animated-text.cjs.js +1 -1
- package/dist/animated-text.esm.js +1 -1
- package/dist/app-header.cjs.js +15 -3
- package/dist/app-header.esm.js +31 -4
- package/dist/aspect-ratio.cjs.js +1 -1
- package/dist/aspect-ratio.esm.js +1 -1
- package/dist/avatar.cjs.js +1 -1
- package/dist/avatar.esm.js +1 -1
- package/dist/badge.cjs.js +1 -1
- package/dist/badge.esm.js +1 -1
- package/dist/block-controls.cjs.js +1 -1
- package/dist/block-controls.esm.js +1 -1
- package/dist/box.cjs.js +1 -1
- package/dist/box.esm.js +1 -1
- package/dist/breadcrumb.cjs.js +4 -4
- package/dist/breadcrumb.esm.js +93 -84
- package/dist/button.cjs.js +520 -1
- package/dist/button.esm.js +682 -2
- package/dist/{calendar-CzpWDxLc.js → calendar-BsVqtpjM.js} +6 -6
- package/dist/{calendar-DkSDFg33.mjs → calendar-CFafqZVA.mjs} +6 -6
- package/dist/calendar.cjs.js +1 -1
- package/dist/calendar.esm.js +1 -1
- package/dist/card.cjs.js +6 -5
- package/dist/card.esm.js +52 -39
- package/dist/chart.cjs.js +2 -2
- package/dist/chart.esm.js +2 -2
- package/dist/checkbox.cjs.js +4 -4
- package/dist/checkbox.esm.js +36 -15
- package/dist/clone-source-BxK2pEVw.mjs +11 -0
- package/dist/clone-source-C7E_ri5f.js +1 -0
- package/dist/collapsible.cjs.js +1 -1
- package/dist/collapsible.esm.js +1 -1
- package/dist/color-picker.cjs.js +2 -2
- package/dist/color-picker.esm.js +3 -3
- package/dist/combobox.cjs.js +4 -4
- package/dist/combobox.esm.js +22 -19
- package/dist/command-palette.cjs.js +1 -1
- package/dist/command-palette.esm.js +1 -1
- package/dist/command.cjs.js +1 -1
- package/dist/command.esm.js +1 -1
- package/dist/components/ui-alert-dialog.d.ts.map +1 -1
- package/dist/components/ui-alert.d.ts.map +1 -1
- package/dist/components/ui-app-header.d.ts +1 -0
- package/dist/components/ui-app-header.d.ts.map +1 -1
- package/dist/components/ui-breadcrumb.d.ts.map +1 -1
- package/dist/components/ui-card.d.ts +7 -0
- package/dist/components/ui-card.d.ts.map +1 -1
- package/dist/components/ui-checkbox.d.ts +6 -0
- package/dist/components/ui-checkbox.d.ts.map +1 -1
- package/dist/components/ui-combobox.d.ts.map +1 -1
- package/dist/components/ui-date-time-picker.d.ts.map +1 -1
- package/dist/components/ui-dialog.d.ts +1 -0
- package/dist/components/ui-dialog.d.ts.map +1 -1
- package/dist/components/ui-drawer.d.ts.map +1 -1
- package/dist/components/ui-dropdown.d.ts.map +1 -1
- package/dist/components/ui-empty-state.d.ts.map +1 -1
- package/dist/components/ui-hover-card.d.ts.map +1 -1
- package/dist/components/ui-icon.d.ts +1 -0
- package/dist/components/ui-icon.d.ts.map +1 -1
- package/dist/components/ui-input.d.ts +16 -0
- package/dist/components/ui-input.d.ts.map +1 -1
- package/dist/components/ui-layout.d.ts +20 -0
- package/dist/components/ui-layout.d.ts.map +1 -1
- package/dist/components/ui-menu.d.ts +1 -0
- package/dist/components/ui-menu.d.ts.map +1 -1
- package/dist/components/ui-menubar.d.ts.map +1 -1
- package/dist/components/ui-multi-select.d.ts +6 -0
- package/dist/components/ui-multi-select.d.ts.map +1 -1
- package/dist/components/ui-number-field.d.ts +6 -0
- package/dist/components/ui-number-field.d.ts.map +1 -1
- package/dist/components/ui-pagination.d.ts.map +1 -1
- package/dist/components/ui-password-field.d.ts +11 -0
- package/dist/components/ui-password-field.d.ts.map +1 -1
- package/dist/components/ui-popover.d.ts.map +1 -1
- package/dist/components/ui-positioner.d.ts.map +1 -1
- package/dist/components/ui-radio-group.d.ts +6 -0
- package/dist/components/ui-radio-group.d.ts.map +1 -1
- package/dist/components/ui-rating.d.ts +1 -0
- package/dist/components/ui-rating.d.ts.map +1 -1
- package/dist/components/ui-select.d.ts +7 -0
- package/dist/components/ui-select.d.ts.map +1 -1
- package/dist/components/ui-sidebar.d.ts +1 -0
- package/dist/components/ui-sidebar.d.ts.map +1 -1
- package/dist/components/ui-slider.d.ts +6 -0
- package/dist/components/ui-slider.d.ts.map +1 -1
- package/dist/components/ui-sortable.d.ts +1 -0
- package/dist/components/ui-sortable.d.ts.map +1 -1
- package/dist/components/ui-switch.d.ts +6 -0
- package/dist/components/ui-switch.d.ts.map +1 -1
- package/dist/components/ui-tabs.d.ts +2 -0
- package/dist/components/ui-tabs.d.ts.map +1 -1
- package/dist/components/ui-textarea.d.ts +6 -0
- package/dist/components/ui-textarea.d.ts.map +1 -1
- package/dist/components/ui-toast.d.ts.map +1 -1
- package/dist/components/ui-tooltip.d.ts.map +1 -1
- package/dist/container.cjs.js +1 -1
- package/dist/container.esm.js +1 -1
- package/dist/context-menu.cjs.js +2 -2
- package/dist/context-menu.esm.js +2 -2
- package/dist/control-group.cjs.js +1 -1
- package/dist/control-group.esm.js +1 -1
- package/dist/data-table.cjs.js +5 -5
- package/dist/data-table.esm.js +7 -7
- package/dist/date-field.cjs.js +1 -1
- package/dist/date-field.esm.js +3 -3
- package/dist/date-picker.cjs.js +2 -2
- package/dist/date-picker.esm.js +17 -17
- package/dist/date-range-picker.cjs.js +2 -2
- package/dist/date-range-picker.esm.js +4 -4
- package/dist/date-range-time-picker.cjs.js +3 -3
- package/dist/date-range-time-picker.esm.js +16 -16
- package/dist/date-time-picker.cjs.js +26 -23
- package/dist/date-time-picker.esm.js +49 -46
- package/dist/{date-time-utils-zAx4ghvC.mjs → date-time-utils-CJUksWj3.mjs} +1 -1
- package/dist/{date-time-utils-C-4eHTyy.js → date-time-utils-D3hQQ5Om.js} +1 -1
- package/dist/description.cjs.js +1 -1
- package/dist/description.esm.js +1 -1
- package/dist/dialog.cjs.js +7 -7
- package/dist/dialog.esm.js +51 -47
- package/dist/direction-provider.cjs.js +1 -1
- package/dist/direction-provider.esm.js +1 -1
- package/dist/dismissable-layer.cjs.js +1 -1
- package/dist/dismissable-layer.esm.js +1 -1
- package/dist/dock.cjs.js +1 -1
- package/dist/dock.esm.js +1 -1
- package/dist/drawer.cjs.js +5 -5
- package/dist/drawer.esm.js +18 -17
- package/dist/dropdown.cjs.js +7 -7
- package/dist/dropdown.esm.js +39 -38
- package/dist/empty-state.cjs.js +12 -2
- package/dist/empty-state.esm.js +17 -7
- package/dist/field-error.cjs.js +1 -1
- package/dist/field-error.esm.js +1 -1
- package/dist/field.cjs.js +2 -2
- package/dist/field.esm.js +2 -2
- package/dist/fieldset.cjs.js +1 -1
- package/dist/fieldset.esm.js +1 -1
- package/dist/file-upload.cjs.js +1 -1
- package/dist/file-upload.esm.js +1 -1
- package/dist/flex.cjs.js +1 -1
- package/dist/flex.esm.js +1 -1
- package/dist/floating-toolbar.cjs.js +2 -2
- package/dist/floating-toolbar.esm.js +2 -2
- package/dist/focus-scope-Dl0qk5GP.mjs +177 -0
- package/dist/focus-scope-Doz0bnE1.js +1 -0
- package/dist/focus-scope.cjs.js +1 -1
- package/dist/focus-scope.esm.js +2 -2
- package/dist/form-control-B90_3kYN.js +1 -0
- package/dist/form-control-D9wWUMBl.mjs +86 -0
- package/dist/form.cjs.js +2 -2
- package/dist/form.esm.js +2 -2
- package/dist/gantt.cjs.js +2 -2
- package/dist/gantt.esm.js +2 -2
- package/dist/grid.cjs.js +1 -1
- package/dist/grid.esm.js +1 -1
- package/dist/hover-card.cjs.js +5 -5
- package/dist/hover-card.esm.js +19 -18
- package/dist/icon-cloud.cjs.js +1 -1
- package/dist/icon-cloud.esm.js +1 -1
- package/dist/icon.cjs.js +207 -1
- package/dist/icon.esm.js +294 -2
- package/dist/icons-CpCpPXV5.js +1 -0
- package/dist/icons-DWYbbhb0.mjs +115 -0
- package/dist/icons.d.ts +11 -1
- package/dist/icons.d.ts.map +1 -1
- package/dist/implicit-submit-B6M5Uc56.js +1 -0
- package/dist/implicit-submit-Lr0-q2LR.mjs +44 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +309 -299
- package/dist/inline-edit.cjs.js +1 -1
- package/dist/inline-edit.esm.js +1 -1
- package/dist/input.cjs.js +62 -20
- package/dist/input.esm.js +164 -58
- package/dist/label.cjs.js +1 -1
- package/dist/label.esm.js +1 -1
- package/dist/layout.cjs.js +145 -4
- package/dist/layout.esm.js +278 -40
- package/dist/marquee.cjs.js +1 -1
- package/dist/marquee.esm.js +1 -1
- package/dist/masonry-grid.cjs.js +1 -1
- package/dist/masonry-grid.esm.js +1 -1
- package/dist/menu.cjs.js +8 -8
- package/dist/menu.esm.js +51 -47
- package/dist/menubar.cjs.js +9 -9
- package/dist/menubar.esm.js +41 -40
- package/dist/meter.cjs.js +1 -1
- package/dist/meter.esm.js +1 -1
- package/dist/multi-select.cjs.js +7 -7
- package/dist/multi-select.esm.js +55 -34
- package/dist/navigate-CXebafwF.mjs +18 -0
- package/dist/navigate-ChJVIIuS.js +1 -0
- package/dist/navigation-menu.cjs.js +1 -1
- package/dist/navigation-menu.esm.js +1 -1
- package/dist/number-attribute-BAF07JrU.mjs +8 -0
- package/dist/number-attribute-C4Rrl7d3.js +1 -0
- package/dist/number-field.cjs.js +8 -8
- package/dist/number-field.esm.js +90 -69
- package/dist/number-ticker.cjs.js +1 -1
- package/dist/number-ticker.esm.js +1 -1
- package/dist/odometer.cjs.js +1 -1
- package/dist/odometer.esm.js +1 -1
- package/dist/orbiter.cjs.js +1 -1
- package/dist/orbiter.esm.js +1 -1
- package/dist/pagination.cjs.js +24 -23
- package/dist/pagination.esm.js +61 -46
- package/dist/{panel-group-BVHJEdfx.js → panel-group-BIzzpQ5i.js} +1 -1
- package/dist/{panel-group-BxO_eNW6.mjs → panel-group-CFLjzRWI.mjs} +1 -1
- package/dist/panel-group.cjs.js +1 -1
- package/dist/panel-group.esm.js +1 -1
- package/dist/panel.cjs.js +1 -1
- package/dist/panel.esm.js +1 -1
- package/dist/password-field.cjs.js +36 -16
- package/dist/password-field.esm.js +113 -44
- package/dist/pin-input.cjs.js +1 -1
- package/dist/pin-input.esm.js +1 -1
- package/dist/placement-grid.cjs.js +1 -1
- package/dist/placement-grid.esm.js +1 -1
- package/dist/plugin-panel.cjs.js +1 -1
- package/dist/plugin-panel.esm.js +1 -1
- package/dist/popover.cjs.js +2 -2
- package/dist/popover.esm.js +28 -26
- package/dist/portal.cjs.js +1 -1
- package/dist/portal.esm.js +1 -1
- package/dist/positioner.cjs.js +2 -2
- package/dist/positioner.esm.js +35 -38
- package/dist/preload.cjs.js +221 -0
- package/dist/preload.css +220 -0
- package/dist/preload.d.ts +17 -0
- package/dist/preload.d.ts.map +1 -0
- package/dist/preload.esm.js +224 -0
- package/dist/presence.cjs.js +1 -1
- package/dist/presence.esm.js +1 -1
- package/dist/primitives/clone-source.d.ts +3 -0
- package/dist/primitives/clone-source.d.ts.map +1 -0
- package/dist/primitives/focus-scope.d.ts +6 -0
- package/dist/primitives/focus-scope.d.ts.map +1 -1
- package/dist/primitives/form-control.d.ts +68 -0
- package/dist/primitives/form-control.d.ts.map +1 -0
- package/dist/primitives/implicit-submit.d.ts +17 -0
- package/dist/primitives/implicit-submit.d.ts.map +1 -0
- package/dist/primitives/navigate.d.ts +27 -0
- package/dist/primitives/navigate.d.ts.map +1 -0
- package/dist/primitives/number-attribute.d.ts +7 -0
- package/dist/primitives/number-attribute.d.ts.map +1 -0
- package/dist/primitives/slotted-input.d.ts +19 -0
- package/dist/primitives/slotted-input.d.ts.map +1 -0
- package/dist/progress.cjs.js +3 -3
- package/dist/progress.esm.js +3 -3
- package/dist/quick-actions.cjs.js +5 -5
- package/dist/quick-actions.esm.js +3 -3
- package/dist/radio-group.cjs.js +9 -9
- package/dist/radio-group.esm.js +47 -24
- package/dist/radio.cjs.js +1 -1
- package/dist/radio.esm.js +1 -1
- package/dist/rating.cjs.js +6 -6
- package/dist/rating.esm.js +21 -10
- package/dist/{runtime-BRT7E4A8.mjs → runtime-CORXjP7e.mjs} +379 -357
- package/dist/runtime-uCly3ECd.js +5 -0
- package/dist/runtime.cjs.js +1 -1
- package/dist/runtime.esm.js +1 -1
- package/dist/scroll-area.cjs.js +1 -1
- package/dist/scroll-area.esm.js +1 -1
- package/dist/section.cjs.js +1 -1
- package/dist/section.esm.js +1 -1
- package/dist/select.cjs.js +21 -21
- package/dist/select.esm.js +111 -71
- package/dist/selection-popup.cjs.js +2 -2
- package/dist/selection-popup.esm.js +2 -2
- package/dist/semantic-tokens.d.ts.map +1 -1
- package/dist/separator.cjs.js +1 -1
- package/dist/separator.esm.js +1 -1
- package/dist/sidebar.cjs.js +15 -15
- package/dist/sidebar.esm.js +48 -42
- package/dist/skeleton.cjs.js +1 -1
- package/dist/skeleton.esm.js +1 -1
- package/dist/slider.cjs.js +11 -11
- package/dist/slider.esm.js +40 -23
- package/dist/slot.cjs.js +1 -1
- package/dist/slot.esm.js +1 -1
- package/dist/slotted-input-BVq2QQg2.js +1 -0
- package/dist/slotted-input-atWznLfm.mjs +13 -0
- package/dist/sortable.cjs.js +25 -25
- package/dist/sortable.esm.js +29 -21
- package/dist/spinning-text.cjs.js +1 -1
- package/dist/spinning-text.esm.js +1 -1
- package/dist/split-button.cjs.js +1 -1
- package/dist/split-button.esm.js +1 -1
- package/dist/splitter.cjs.js +1 -1
- package/dist/splitter.esm.js +1 -1
- package/dist/standalone/add-icons.d.ts +2 -0
- package/dist/standalone/add-icons.d.ts.map +1 -0
- package/dist/standalone/preload.d.ts +2 -0
- package/dist/standalone/preload.d.ts.map +1 -0
- package/dist/stepper.cjs.js +3 -3
- package/dist/stepper.esm.js +3 -3
- package/dist/switch.cjs.js +9 -9
- package/dist/switch.esm.js +56 -35
- package/dist/table.cjs.js +1 -1
- package/dist/table.esm.js +1 -1
- package/dist/tabs.cjs.js +14 -14
- package/dist/tabs.esm.js +129 -115
- package/dist/tags-input.cjs.js +1 -1
- package/dist/tags-input.esm.js +1 -1
- package/dist/textarea.cjs.js +33 -11
- package/dist/textarea.esm.js +74 -35
- package/dist/theme.d.ts +6 -0
- package/dist/theme.d.ts.map +1 -1
- package/dist/time-field.cjs.js +1 -1
- package/dist/time-field.esm.js +2 -2
- package/dist/time-picker.cjs.js +1 -1
- package/dist/time-picker.esm.js +3 -3
- package/dist/timeline.cjs.js +2 -2
- package/dist/timeline.esm.js +2 -2
- package/dist/toast.cjs.js +4 -4
- package/dist/toast.esm.js +17 -16
- package/dist/toggle-group.cjs.js +1 -1
- package/dist/toggle-group.esm.js +1 -1
- package/dist/toggle.cjs.js +3 -3
- package/dist/toggle.esm.js +9 -9
- package/dist/toolbar.cjs.js +1 -1
- package/dist/toolbar.esm.js +1 -1
- package/dist/tooltip.cjs.js +2 -2
- package/dist/tooltip.esm.js +12 -14
- package/dist/transfer-list.cjs.js +1 -1
- package/dist/transfer-list.esm.js +1 -1
- package/dist/{tree-33fVNnaf.mjs → tree-CD2k2lIC.mjs} +1 -1
- package/dist/{tree-Dc02MChE.js → tree-ChQfhxya.js} +1 -1
- package/dist/tree-item.cjs.js +1 -1
- package/dist/tree-item.esm.js +1 -1
- package/dist/tree.cjs.js +1 -1
- package/dist/tree.esm.js +1 -1
- package/dist/visually-hidden.cjs.js +1 -1
- package/dist/visually-hidden.esm.js +1 -1
- package/dist/wizard.cjs.js +4 -4
- package/dist/wizard.esm.js +4 -4
- package/package.json +3 -2
- package/dist/focus-scope-Bwug2gDv.js +0 -1
- package/dist/focus-scope-CmEsG5UZ.mjs +0 -138
- package/dist/runtime-CXw4SGV9.js +0 -5
- package/dist/ui-button-C3OmI7Sn.mjs +0 -684
- package/dist/ui-button-CnLwXBnx.js +0 -520
- package/dist/ui-icon-D3avtxX_.js +0 -207
- package/dist/ui-icon-DLhB08Fo.mjs +0 -361
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { E as tt } from "./ElementBase-
|
|
1
|
+
import { E as tt } from "./ElementBase-D5QsC5Vw.mjs";
|
|
2
2
|
import { s as et, a as it } from "./control-name-Bpj7F34X.mjs";
|
|
3
3
|
import { c as rt } from "./dismissable-layer-BmPIoK80.mjs";
|
|
4
|
-
import { r as st } from "./calendar-
|
|
5
|
-
import { r as nt, e as at, i as C, s as ot, b as lt, j as
|
|
4
|
+
import { r as st } from "./calendar-CFafqZVA.mjs";
|
|
5
|
+
import { r as nt, e as at, i as C, s as ot, b as lt, j as D, k as A, f as dt, m as k, o as P, l as ut, c as ct, q as I, g as pt, h as ht } from "./date-time-utils-CJUksWj3.mjs";
|
|
6
6
|
let mt = 0;
|
|
7
7
|
const ft = `
|
|
8
8
|
<svg viewBox="0 0 20 20" class="icon-svg" aria-hidden="true" focusable="false">
|
|
@@ -252,7 +252,7 @@ const ft = `
|
|
|
252
252
|
--ui-drtp-border: #334155;
|
|
253
253
|
--ui-dp-text: #e2e8f0;
|
|
254
254
|
--ui-dp-muted: #94a3b8;
|
|
255
|
-
--ui-drtp-accent: #93c5fd;
|
|
255
|
+
--ui-drtp-accent: var(--ui-color-accent-on-dark, #93c5fd);
|
|
256
256
|
--ui-drtp-surface: linear-gradient(180deg, color-mix(in srgb, #0f172a 84%, #1e293b), #0f172a);
|
|
257
257
|
--ui-drtp-shadow: 0 18px 36px rgba(2, 6, 23, 0.48);
|
|
258
258
|
}
|
|
@@ -714,8 +714,8 @@ class vt extends tt {
|
|
|
714
714
|
}
|
|
715
715
|
_valueFromPending() {
|
|
716
716
|
return {
|
|
717
|
-
start:
|
|
718
|
-
end:
|
|
717
|
+
start: D(this._pending.startDate, this._pending.startTime),
|
|
718
|
+
end: D(this._pending.endDate, this._pending.endTime)
|
|
719
719
|
};
|
|
720
720
|
}
|
|
721
721
|
_formatDateTimeDisplay(t) {
|
|
@@ -727,18 +727,18 @@ class vt extends tt {
|
|
|
727
727
|
return !t && !e ? "" : t && e ? `${this._formatDateTimeDisplay(t)} — ${this._formatDateTimeDisplay(e)}` : this._formatDateTimeDisplay(t || e);
|
|
728
728
|
}
|
|
729
729
|
_normalizePendingState(t) {
|
|
730
|
-
let e =
|
|
731
|
-
if (e && i &&
|
|
730
|
+
let e = D(t.startDate, t.startTime), i = D(t.endDate, t.endTime);
|
|
731
|
+
if (e && i && k(e, i) > 0 && this._autoNormalize()) {
|
|
732
732
|
const p = e;
|
|
733
733
|
e = i, i = p;
|
|
734
734
|
}
|
|
735
735
|
const r = P(this.getAttribute("min")), o = P(this.getAttribute("max"));
|
|
736
736
|
let n = r ? `${r.date}T${r.time}` : null, s = o ? `${o.date}T${o.time}` : null;
|
|
737
|
-
if (n && s &&
|
|
737
|
+
if (n && s && k(n, s) > 0) {
|
|
738
738
|
const p = n;
|
|
739
739
|
n = s, s = p;
|
|
740
740
|
}
|
|
741
|
-
e && n &&
|
|
741
|
+
e && n && k(e, n) < 0 && (e = n), e && s && k(e, s) > 0 && (e = s), i && n && k(i, n) < 0 && (i = n), i && s && k(i, s) > 0 && (i = s);
|
|
742
742
|
const a = A(e || ""), u = A(i || "");
|
|
743
743
|
return {
|
|
744
744
|
startDate: a?.date || null,
|
|
@@ -750,14 +750,14 @@ class vt extends tt {
|
|
|
750
750
|
_commit(t, e) {
|
|
751
751
|
if (this._isInteractionBlocked() || this._isReadonly()) return;
|
|
752
752
|
const i = this._normalizePendingState(t), r = {
|
|
753
|
-
start:
|
|
754
|
-
end:
|
|
753
|
+
start: D(i.startDate, i.startTime),
|
|
754
|
+
end: D(i.endDate, i.endTime)
|
|
755
755
|
};
|
|
756
756
|
if (!this._allowPartial() && (!r.start || !r.end)) {
|
|
757
757
|
this._inlineError = this.getAttribute("error") || this._translations().rangeIncomplete, this._emitInvalid(JSON.stringify(r), "partial"), this._updateHostState();
|
|
758
758
|
return;
|
|
759
759
|
}
|
|
760
|
-
if (r.start && r.end &&
|
|
760
|
+
if (r.start && r.end && k(r.start, r.end) > 0) {
|
|
761
761
|
this._inlineError = this.getAttribute("error") || this._translations().invalidRangeOrder, this._emitInvalid(JSON.stringify(r), "order"), this._updateHostState();
|
|
762
762
|
return;
|
|
763
763
|
}
|
|
@@ -822,7 +822,7 @@ class vt extends tt {
|
|
|
822
822
|
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);
|
|
823
823
|
}
|
|
824
824
|
_timeOptions(t) {
|
|
825
|
-
const e =
|
|
825
|
+
const e = I(t) || { hours: 0, minutes: 0 }, i = this._step(), r = Array.from({ length: 24 }, (n, s) => `<option value="${s}" ${s === e.hours ? "selected" : ""}>${x(s)}</option>`).join(""), o = Array.from({ length: Math.ceil(60 / i) }, (n, s) => {
|
|
826
826
|
const a = Math.min(59, s * i);
|
|
827
827
|
return `<option value="${a}" ${a === e.minutes ? "selected" : ""}>${x(a)}</option>`;
|
|
828
828
|
}).join("");
|
|
@@ -939,7 +939,7 @@ class vt extends tt {
|
|
|
939
939
|
a && (a.textContent = u.start && u.end ? `${this._formatDateTimeDisplay(u.start)} — ${this._formatDateTimeDisplay(u.end)}` : e.selectDateRange);
|
|
940
940
|
const p = this._overlay.querySelector(".drtp-calendar");
|
|
941
941
|
p && this._syncCalendar(p);
|
|
942
|
-
const g =
|
|
942
|
+
const g = I(this._pending.startTime) || { hours: 0, minutes: 0 }, w = I(this._pending.endTime) || { hours: 0, minutes: 0 }, y = this._overlay.querySelector('select[data-time="start"][data-segment="hours"]'), l = this._overlay.querySelector('select[data-time="start"][data-segment="minutes"]'), f = this._overlay.querySelector('select[data-time="end"][data-segment="hours"]'), b = this._overlay.querySelector('select[data-time="end"][data-segment="minutes"]');
|
|
943
943
|
y && this._setClosestOptionValue(y, g.hours), l && this._setClosestOptionValue(l, g.minutes), f && this._setClosestOptionValue(f, w.hours), b && this._setClosestOptionValue(b, w.minutes);
|
|
944
944
|
const _ = this._isInteractionBlocked() || this._isReadonly();
|
|
945
945
|
[y, l, f, b].forEach((m) => {
|
|
@@ -1107,7 +1107,7 @@ class vt extends tt {
|
|
|
1107
1107
|
H && (H.textContent = z.start && z.end ? `${this._formatDateTimeDisplay(z.start)} — ${this._formatDateTimeDisplay(z.end)}` : a.selectDateRange);
|
|
1108
1108
|
const V = d.querySelector(".drtp-calendar-inline");
|
|
1109
1109
|
V && this._syncCalendar(V);
|
|
1110
|
-
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 =
|
|
1110
|
+
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 = I(this._pending.startTime) || { hours: 0, minutes: 0 }, N = I(this._pending.endTime) || { hours: 0, minutes: 0 };
|
|
1111
1111
|
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) => {
|
|
1112
1112
|
T && (T.disabled = this._isInteractionBlocked() || this._isReadonly());
|
|
1113
1113
|
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const K=require("./ElementBase-CbUsP3D6.js"),P=require("./control-name-BmoI1m3a.js"),U=require("./dismissable-layer-DNfrKA20.js"),Z=require("./calendar-BsVqtpjM.js"),l=require("./date-time-utils-D3hQQ5Om.js");let j=0;const W=`
|
|
2
2
|
<svg viewBox="0 0 20 20" class="icon-svg" aria-hidden="true" focusable="false">
|
|
3
3
|
<path d="M6 2a1 1 0 0 1 1 1v1h6V3a1 1 0 1 1 2 0v1h.5A2.5 2.5 0 0 1 18 6.5v9A2.5 2.5 0 0 1 15.5 18h-11A2.5 2.5 0 0 1 2 15.5v-9A2.5 2.5 0 0 1 4.5 4H5V3a1 1 0 0 1 1-1Zm10 7H4v6.5c0 .276.224.5.5.5h11a.5.5 0 0 0 .5-.5V9ZM4.5 6a.5.5 0 0 0-.5.5V7h12v-.5a.5.5 0 0 0-.5-.5h-11Z" fill="currentColor"/>
|
|
4
4
|
</svg>
|
|
5
|
-
`,
|
|
5
|
+
`,Y=`
|
|
6
6
|
<svg viewBox="0 0 20 20" class="icon-svg" aria-hidden="true" focusable="false">
|
|
7
7
|
<path d="M5.23 7.21a.75.75 0 0 1 1.06.02L10 11.12l3.71-3.9a.75.75 0 1 1 1.08 1.04l-4.25 4.47a.75.75 0 0 1-1.08 0L5.2 8.27a.75.75 0 0 1 .02-1.06Z" fill="currentColor"/>
|
|
8
8
|
</svg>
|
|
9
|
-
`,
|
|
9
|
+
`,G=`
|
|
10
10
|
<svg viewBox="0 0 20 20" class="icon-svg" aria-hidden="true" focusable="false">
|
|
11
11
|
<path d="M5.22 5.22a.75.75 0 0 1 1.06 0L10 8.94l3.72-3.72a.75.75 0 1 1 1.06 1.06L11.06 10l3.72 3.72a.75.75 0 1 1-1.06 1.06L10 11.06l-3.72 3.72a.75.75 0 1 1-1.06-1.06L8.94 10 5.22 6.28a.75.75 0 0 1 0-1.06Z" fill="currentColor"/>
|
|
12
12
|
</svg>
|
|
@@ -14,7 +14,21 @@
|
|
|
14
14
|
<svg viewBox="0 0 20 20" class="icon-svg" aria-hidden="true" focusable="false">
|
|
15
15
|
<path d="M10 2a8 8 0 1 1 0 16 8 8 0 0 1 0-16Zm0 1.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13Zm.75 2.75a.75.75 0 0 0-1.5 0v3.88c0 .2.08.4.22.54l2.5 2.5a.75.75 0 1 0 1.06-1.06l-2.28-2.28V6.25Z" fill="currentColor"/>
|
|
16
16
|
</svg>
|
|
17
|
+
`,F=`
|
|
18
|
+
.time-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
|
|
19
|
+
.time-grid[data-meridiem="true"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
|
|
20
|
+
.time-grid label { font-size: 11px; color: var(--ui-dp-muted, #526175); font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
|
|
21
|
+
.time-grid select {
|
|
22
|
+
min-block-size: 34px;
|
|
23
|
+
border: 1px solid color-mix(in srgb, var(--ui-dtp-border, #cbd5e1) 84%, transparent);
|
|
24
|
+
border-radius: 8px;
|
|
25
|
+
padding: 0 8px;
|
|
26
|
+
background: color-mix(in srgb, var(--ui-dtp-bg, #fff) 95%, transparent);
|
|
27
|
+
color: var(--ui-dp-text, #0f172a);
|
|
28
|
+
font: 600 13px/1 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
|
|
29
|
+
}
|
|
17
30
|
`,J=`
|
|
31
|
+
${F}
|
|
18
32
|
:host {
|
|
19
33
|
--ui-dtp-bg: color-mix(in srgb, var(--ui-color-surface, #ffffff) 96%, transparent);
|
|
20
34
|
--ui-dtp-surface: linear-gradient(
|
|
@@ -247,7 +261,7 @@
|
|
|
247
261
|
--ui-dtp-border: #334155;
|
|
248
262
|
--ui-dp-text: #e2e8f0;
|
|
249
263
|
--ui-dp-muted: #94a3b8;
|
|
250
|
-
--ui-dtp-accent: #93c5fd;
|
|
264
|
+
--ui-dtp-accent: var(--ui-color-accent-on-dark, #93c5fd);
|
|
251
265
|
--ui-dtp-surface: linear-gradient(180deg, color-mix(in srgb, #0f172a 84%, #1e293b), #0f172a);
|
|
252
266
|
--ui-dtp-shadow: 0 18px 36px rgba(2, 6, 23, 0.48);
|
|
253
267
|
}
|
|
@@ -287,7 +301,7 @@
|
|
|
287
301
|
outline-color: Highlight;
|
|
288
302
|
}
|
|
289
303
|
}
|
|
290
|
-
`,
|
|
304
|
+
`,Q=`
|
|
291
305
|
.ui-date-time-picker-overlay-host {
|
|
292
306
|
--ui-dtp-bg: color-mix(in srgb, var(--ui-color-surface, #ffffff) 96%, transparent);
|
|
293
307
|
--ui-dtp-surface: linear-gradient(
|
|
@@ -382,18 +396,7 @@
|
|
|
382
396
|
block-size: 16px;
|
|
383
397
|
pointer-events: none;
|
|
384
398
|
}
|
|
385
|
-
|
|
386
|
-
.time-grid[data-meridiem="true"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
|
|
387
|
-
.time-grid label { font-size: 11px; color: var(--ui-dp-muted, #526175); font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
|
|
388
|
-
.time-grid select {
|
|
389
|
-
min-block-size: 34px;
|
|
390
|
-
border: 1px solid color-mix(in srgb, var(--ui-dtp-border, #cbd5e1) 84%, transparent);
|
|
391
|
-
border-radius: 8px;
|
|
392
|
-
padding: 0 8px;
|
|
393
|
-
background: color-mix(in srgb, var(--ui-dtp-bg, #fff) 95%, transparent);
|
|
394
|
-
color: var(--ui-dp-text, #0f172a);
|
|
395
|
-
font: 600 13px/1 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
|
|
396
|
-
}
|
|
399
|
+
${F}
|
|
397
400
|
.footer { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
|
|
398
401
|
.footer[hidden] { display: none !important; }
|
|
399
402
|
.action {
|
|
@@ -465,7 +468,7 @@
|
|
|
465
468
|
from { opacity: 0; transform: translateY(6px) scale(0.985); }
|
|
466
469
|
to { opacity: 1; transform: translateY(0) scale(1); }
|
|
467
470
|
}
|
|
468
|
-
`;function h(m){return String(m).padStart(2,"0")}function p(m){return m.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function V(m){const t=l.splitDateTime(m);return t?{date:t.date,time:t.time}:{date:null,time:null}}function y(m){return l.combineDateTime(m.date,m.time)}class F extends N.ElementBase{constructor(){super(...arguments),this._value={date:null,time:null},this._pending={date:null,time:null},this._draft="",this._inlineError="",this._open=!1,this._syncing=!1,this._overlay=null,this._dismissableLayer=null,this._releaseScrollLock=null,this._isInitialized=!1,this._hasView=!1,this._restoreFocusEl=null,this._overlayKey=null,this._uid=`ui-dtp-${++Z}`,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=l.rafThrottle(()=>this._positionOverlay()),this._onRootClickBound=t=>this._onRootClick(t),this._onRootInputBound=t=>this._onRootInput(t),this._onRootChangeBound=t=>this._onRootChange(t),this._onRootBlurBound=t=>this._onRootBlur(t),this._onRootKeyDownBound=t=>this._onRootKeyDown(t),this._onOverlayClickBound=t=>this._onOverlayClick(t),this._onOverlayChangeBound=t=>this._onOverlayChange(t),this._onOverlayCalendarBound=t=>this._onOverlayCalendar(t),this._onDocumentPointerDownBound=t=>this._onDocumentPointerDown(t),this._onDocumentKeyDownBound=t=>this._onDocumentKeyDown(t),this._onWindowResizeBound=()=>this._schedulePosition.run(),this._onWindowScrollBound=t=>{l.eventOriginatesWithin(t,[this._overlay])||this._schedulePosition.run()}}static get observedAttributes(){return["aria-label","aria-description","aria-describedby","open","default-open","value","default-value","min","max","locale","translations","week-start","size","shape","bare","variant","state","step","format","disabled","readonly","required","name","close-on-select","clearable","allow-input","mode","label","hint","error","show-footer"]}connectedCallback(){if(super.connectedCallback(),this.root.addEventListener("click",this._onRootClickBound),this.root.addEventListener("input",this._onRootInputBound),this.root.addEventListener("change",this._onRootChangeBound),this.root.addEventListener("focusout",this._onRootBlurBound),this.root.addEventListener("keydown",this._onRootKeyDownBound),!this._isInitialized){const t=V(this.getAttribute("value")||this.getAttribute("default-value"));this._value=t,this._pending={...t},this._draft=this._formatDisplay(t),this._open=this.hasAttribute("open")||l.isTruthyAttr(this.getAttribute("default-open")),this._isInitialized=!0}this._open&&!this._isInlineMode()&&this._ensureOverlay()}disconnectedCallback(){this.root.removeEventListener("click",this._onRootClickBound),this.root.removeEventListener("input",this._onRootInputBound),this.root.removeEventListener("change",this._onRootChangeBound),this.root.removeEventListener("focusout",this._onRootBlurBound),this.root.removeEventListener("keydown",this._onRootKeyDownBound),this._destroyOverlay(),super.disconnectedCallback()}attributeChangedCallback(t,e,i){if(e!==i&&(t==="value"&&!this._syncing&&(this._value=V(i),this._pending={...this._value},this._draft=this._formatDisplay(this._value),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)){if(!this._hasView){this.requestRender();return}this._updateHostState()}}_isInlineMode(){return(this.getAttribute("mode")||"popover")==="inline"}_isMobileSheet(){return l.shouldUseMobileSheet(this.getAttribute("mode"))}_isDisabled(){return this.hasAttribute("disabled")}_state(){const t=(this.getAttribute("state")||"").trim().toLowerCase();return t==="loading"||t==="error"||t==="success"?t:"idle"}_isInteractionBlocked(){return this._isDisabled()||this._state()==="loading"}_isReadonly(){return this.hasAttribute("readonly")}_allowInput(){return l.isTruthyAttr(this.getAttribute("allow-input"),!0)}_clearable(){return l.isTruthyAttr(this.getAttribute("clearable"),!0)}_closeOnSelect(){return l.isTruthyAttr(this.getAttribute("close-on-select"),!1)}_shouldAutoCommit(){return this._closeOnSelect()||!this._showFooter()}_showFooter(){return l.isTruthyAttr(this.getAttribute("show-footer"),!0)}_isBare(){return l.isTruthyAttr(this.getAttribute("bare"),!1)}_locale(){return l.normalizeLocale(this.getAttribute("locale"))}_translations(){return U.resolveDateTimeTranslations(this.getAttribute("locale"),this.getAttribute("translations"))}_minuteStep(){const t=Number(this.getAttribute("step")||5);return!Number.isFinite(t)||t<1?5:Math.min(60,Math.trunc(t))}_formatDisplay(t){if(!t.date||!t.time)return"";const e=l.formatDateForDisplay(t.date,this._locale(),"locale",null);return this._is12h()?`${e} ${l.to12hDisplay(t.time,this._locale())}`:`${e} ${t.time}`}_is12h(){return(this.getAttribute("format")||"24h")==="12h"}_parseDateInput(t){const e=l.normalizeDateIso(t);if(e)return e;const i=l.parseUserDateInput(t,this._locale());if(i)return i;const r=new Date(t);if(!Number.isFinite(r.getTime()))return null;const o=r.getFullYear(),a=String(r.getMonth()+1).padStart(2,"0"),n=String(r.getDate()).padStart(2,"0");return`${o}-${a}-${n}`}_syncOpenAttribute(t){this._syncing=!0;try{t?this.hasAttribute("open")||this.setAttribute("open",""):this.hasAttribute("open")&&this.removeAttribute("open")}finally{this._syncing=!1}}_syncValueAttribute(t){const e=y(t);this._syncing=!0;try{e?this.getAttribute("value")!==e&&this.setAttribute("value",e):this.hasAttribute("value")&&this.removeAttribute("value")}finally{this._syncing=!1}}_emitInput(t){const e={mode:"datetime",value:y(this._pending),date:this._pending.date,time:this._pending.time,source:t};this.dispatchEvent(new CustomEvent("input",{detail:e,bubbles:!0,composed:!0}))}_emitChange(t){const e={mode:"datetime",value:y(this._value),date:this._value.date,time:this._value.time,source:t};this.dispatchEvent(new CustomEvent("change",{detail:e,bubbles:!0,composed:!0}))}_emitInvalid(t,e){this.dispatchEvent(new CustomEvent("invalid",{detail:{raw:t,reason:e},bubbles:!0,composed:!0}))}_minDate(){return l.parseConstraintDate(this.getAttribute("min"))}_maxDate(){return l.parseConstraintDate(this.getAttribute("max"))}_minDateTime(){const t=l.parseConstraintDateTime(this.getAttribute("min"));return t?`${t.date}T${t.time}`:null}_maxDateTime(){const t=l.parseConstraintDateTime(this.getAttribute("max"));return t?`${t.date}T${t.time}`:null}_clampState(t){if(!t.date)return{date:null,time:t.time};const e=this._minDate(),i=this._maxDate(),r=l.clampDateIso(t.date,e,i),o=t.time||"00:00";let a=this._minDateTime(),n=this._maxDateTime();if(a&&n&&l.compareDateTimes(a,n)>0){const f=a;a=n,n=f}let s=l.combineDateTime(r,o)||`${r}T00:00`;a&&l.compareDateTimes(s,a)<0&&(s=a),n&&l.compareDateTimes(s,n)>0&&(s=n);const u=l.splitDateTime(s);return u?{date:u.date,time:u.time}:{date:r,time:o}}_commit(t,e){if(this._isInteractionBlocked()||this._isReadonly())return;if(!t.date&&!t.time){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();return}const i=l.parseTimeInput(t.time||""),r=this._clampState({date:l.normalizeDateIso(t.date),time:i?`${h(i.hours)}:${h(i.minutes)}`:null});if(!r.date||!r.time){this._inlineError=this.getAttribute("error")||this._translations().invalidDateTime,this._emitInvalid(JSON.stringify(t),"parse"),this._updateHostState();return}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()}_setOpen(t,e){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})))}_syncOverlay(t){if(this._isInlineMode()){this._destroyOverlay();return}if(this._open){this._ensureOverlay(),this._syncOverlayState();return}this._destroyOverlay();const e=this._restoreFocusEl;if(this._restoreFocusEl=null,e&&e.isConnected)try{e.focus()}catch{}}_ensureOverlay(){if(this._overlay||typeof document>"u")return;const t=document.createElement("div");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=l.lockBodyScroll())}_syncOverlayHostZIndex(){if(!this._overlay||typeof window>"u")return;const t=window.getComputedStyle(this).getPropertyValue("--ui-dtp-z").trim();this._overlay.style.zIndex=t||"1600"}_destroyOverlay(){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))}_syncDismissableLayer(){if(this._dismissableLayer?.destroy(),this._dismissableLayer=null,!this._open||!this._overlay)return;const t=this._overlay.querySelector(".panel, .sheet"),e=this.root.querySelector(".field");t&&(this._dismissableLayer=K.createDismissableLayer({node:t,trigger:e,closeOnEscape:!0,closeOnPointerOutside:!0,closeOnFocusOutside:!1,onBeforeDismiss:i=>i==="escape-key"?(this._setOpen(!1,"escape"),!1):(i==="outside-pointer"&&this._setOpen(!1,"outside"),!1)}))}_positionOverlay(){if(!this._overlay||!this._open||this._isMobileSheet())return;const t=this.root.querySelector(".field"),e=this._overlay.querySelector(".panel");if(!t||!e)return;const i=e.getAttribute("data-placement"),r=l.computePopoverPosition(t.getBoundingClientRect(),e.getBoundingClientRect(),8,8,i==="top"?"top":i==="bottom"?"bottom":null);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)}_timeOptions(){const t=l.parseTimeInput(this._pending.time||"00:00")||{hours:0,minutes:0},e=this._minuteStep(),i=this._is12h()?Array.from({length:12},(a,n)=>{const s=n+1,u=t.hours%12||12;return`<option value="${s}" ${s===u?"selected":""}>${h(s)}</option>`}).join(""):Array.from({length:24},(a,n)=>`<option value="${n}" ${n===t.hours?"selected":""}>${h(n)}</option>`).join(""),r=Array.from({length:Math.ceil(60/e)},(a,n)=>{const s=Math.min(59,n*e);return`<option value="${s}" ${s===t.minutes?"selected":""}>${h(s)}</option>`}).join(""),o=t.hours>=12?"pm":"am";return{hours:i,minutes:r,meridiem:o}}_renderSurfaceInner(t,e=!1){const i=this._translations(),r=this._timeOptions(),o=(this.getAttribute("label")||"").trim(),a=p(o),n=p(o||i.selectDate),s=this._pending.date&&this._pending.time?this._formatDisplay(this._pending):"",u=`
|
|
471
|
+
`;function h(m){return String(m).padStart(2,"0")}function p(m){return m.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function V(m){const t=l.splitDateTime(m);return t?{date:t.date,time:t.time}:{date:null,time:null}}function y(m){return l.combineDateTime(m.date,m.time)}class N extends K.ElementBase{constructor(){super(...arguments),this._value={date:null,time:null},this._pending={date:null,time:null},this._draft="",this._inlineError="",this._open=!1,this._syncing=!1,this._overlay=null,this._dismissableLayer=null,this._releaseScrollLock=null,this._isInitialized=!1,this._hasView=!1,this._restoreFocusEl=null,this._overlayKey=null,this._uid=`ui-dtp-${++j}`,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=l.rafThrottle(()=>this._positionOverlay()),this._onRootClickBound=t=>this._onRootClick(t),this._onRootInputBound=t=>this._onRootInput(t),this._onRootChangeBound=t=>this._onRootChange(t),this._onRootBlurBound=t=>this._onRootBlur(t),this._onRootKeyDownBound=t=>this._onRootKeyDown(t),this._onOverlayClickBound=t=>this._onOverlayClick(t),this._onOverlayChangeBound=t=>this._onOverlayChange(t),this._onOverlayCalendarBound=t=>this._onOverlayCalendar(t),this._onDocumentPointerDownBound=t=>this._onDocumentPointerDown(t),this._onDocumentKeyDownBound=t=>this._onDocumentKeyDown(t),this._onWindowResizeBound=()=>this._schedulePosition.run(),this._onWindowScrollBound=t=>{l.eventOriginatesWithin(t,[this._overlay])||this._schedulePosition.run()}}static get observedAttributes(){return["aria-label","aria-description","aria-describedby","open","default-open","value","default-value","min","max","locale","translations","week-start","size","shape","bare","variant","state","step","format","disabled","readonly","required","name","close-on-select","clearable","allow-input","mode","label","hint","error","show-footer"]}connectedCallback(){if(super.connectedCallback(),this.root.addEventListener("click",this._onRootClickBound),this.root.addEventListener("input",this._onRootInputBound),this.root.addEventListener("change",this._onRootChangeBound),this.root.addEventListener("focusout",this._onRootBlurBound),this.root.addEventListener("keydown",this._onRootKeyDownBound),!this._isInitialized){const t=V(this.getAttribute("value")||this.getAttribute("default-value"));this._value=t,this._pending={...t},this._draft=this._formatDisplay(t),this._open=this.hasAttribute("open")||l.isTruthyAttr(this.getAttribute("default-open")),this._isInitialized=!0}this._open&&!this._isInlineMode()&&this._ensureOverlay()}disconnectedCallback(){this.root.removeEventListener("click",this._onRootClickBound),this.root.removeEventListener("input",this._onRootInputBound),this.root.removeEventListener("change",this._onRootChangeBound),this.root.removeEventListener("focusout",this._onRootBlurBound),this.root.removeEventListener("keydown",this._onRootKeyDownBound),this._destroyOverlay(),super.disconnectedCallback()}attributeChangedCallback(t,e,i){if(e!==i&&(t==="value"&&!this._syncing&&(this._value=V(i),this._pending={...this._value},this._draft=this._formatDisplay(this._value),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)){if(!this._hasView){this.requestRender();return}this._updateHostState()}}_isInlineMode(){return(this.getAttribute("mode")||"popover")==="inline"}_isMobileSheet(){return l.shouldUseMobileSheet(this.getAttribute("mode"))}_isDisabled(){return this.hasAttribute("disabled")}_state(){const t=(this.getAttribute("state")||"").trim().toLowerCase();return t==="loading"||t==="error"||t==="success"?t:"idle"}_isInteractionBlocked(){return this._isDisabled()||this._state()==="loading"}_isReadonly(){return this.hasAttribute("readonly")}_allowInput(){return l.isTruthyAttr(this.getAttribute("allow-input"),!0)}_clearable(){return l.isTruthyAttr(this.getAttribute("clearable"),!0)}_closeOnSelect(){return l.isTruthyAttr(this.getAttribute("close-on-select"),!1)}_shouldAutoCommit(){return this._closeOnSelect()||!this._showFooter()}_showFooter(){return l.isTruthyAttr(this.getAttribute("show-footer"),!0)}_isBare(){return l.isTruthyAttr(this.getAttribute("bare"),!1)}_locale(){return l.normalizeLocale(this.getAttribute("locale"))}_translations(){return Z.resolveDateTimeTranslations(this.getAttribute("locale"),this.getAttribute("translations"))}_minuteStep(){const t=Number(this.getAttribute("step")||5);return!Number.isFinite(t)||t<1?5:Math.min(60,Math.trunc(t))}_formatDisplay(t){if(!t.date||!t.time)return"";const e=l.formatDateForDisplay(t.date,this._locale(),"locale",null);return this._is12h()?`${e} ${l.to12hDisplay(t.time,this._locale())}`:`${e} ${t.time}`}_is12h(){return(this.getAttribute("format")||"24h")==="12h"}_parseDateInput(t){const e=l.normalizeDateIso(t);if(e)return e;const i=l.parseUserDateInput(t,this._locale());if(i)return i;const r=new Date(t);if(!Number.isFinite(r.getTime()))return null;const o=r.getFullYear(),a=String(r.getMonth()+1).padStart(2,"0"),n=String(r.getDate()).padStart(2,"0");return`${o}-${a}-${n}`}_syncOpenAttribute(t){this._syncing=!0;try{t?this.hasAttribute("open")||this.setAttribute("open",""):this.hasAttribute("open")&&this.removeAttribute("open")}finally{this._syncing=!1}}_syncValueAttribute(t){const e=y(t);this._syncing=!0;try{e?this.getAttribute("value")!==e&&this.setAttribute("value",e):this.hasAttribute("value")&&this.removeAttribute("value")}finally{this._syncing=!1}}_emitInput(t){const e={mode:"datetime",value:y(this._pending),date:this._pending.date,time:this._pending.time,source:t};this.dispatchEvent(new CustomEvent("input",{detail:e,bubbles:!0,composed:!0}))}_emitChange(t){const e={mode:"datetime",value:y(this._value),date:this._value.date,time:this._value.time,source:t};this.dispatchEvent(new CustomEvent("change",{detail:e,bubbles:!0,composed:!0}))}_emitInvalid(t,e){this.dispatchEvent(new CustomEvent("invalid",{detail:{raw:t,reason:e},bubbles:!0,composed:!0}))}_minDate(){return l.parseConstraintDate(this.getAttribute("min"))}_maxDate(){return l.parseConstraintDate(this.getAttribute("max"))}_minDateTime(){const t=l.parseConstraintDateTime(this.getAttribute("min"));return t?`${t.date}T${t.time}`:null}_maxDateTime(){const t=l.parseConstraintDateTime(this.getAttribute("max"));return t?`${t.date}T${t.time}`:null}_clampState(t){if(!t.date)return{date:null,time:t.time};const e=this._minDate(),i=this._maxDate(),r=l.clampDateIso(t.date,e,i),o=t.time||"00:00";let a=this._minDateTime(),n=this._maxDateTime();if(a&&n&&l.compareDateTimes(a,n)>0){const f=a;a=n,n=f}let s=l.combineDateTime(r,o)||`${r}T00:00`;a&&l.compareDateTimes(s,a)<0&&(s=a),n&&l.compareDateTimes(s,n)>0&&(s=n);const u=l.splitDateTime(s);return u?{date:u.date,time:u.time}:{date:r,time:o}}_commit(t,e){if(this._isInteractionBlocked()||this._isReadonly())return;if(!t.date&&!t.time){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();return}const i=l.parseTimeInput(t.time||""),r=this._clampState({date:l.normalizeDateIso(t.date),time:i?`${h(i.hours)}:${h(i.minutes)}`:null});if(!r.date||!r.time){this._inlineError=this.getAttribute("error")||this._translations().invalidDateTime,this._emitInvalid(JSON.stringify(t),"parse"),this._updateHostState();return}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()}_setOpen(t,e){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})))}_syncOverlay(t){if(this._isInlineMode()){this._destroyOverlay();return}if(this._open){this._ensureOverlay(),this._syncOverlayState();return}this._destroyOverlay();const e=this._restoreFocusEl;if(this._restoreFocusEl=null,e&&e.isConnected)try{e.focus()}catch{}}_ensureOverlay(){if(this._overlay||typeof document>"u")return;const t=document.createElement("div");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=l.lockBodyScroll())}_syncOverlayHostZIndex(){if(!this._overlay||typeof window>"u")return;const t=window.getComputedStyle(this).getPropertyValue("--ui-dtp-z").trim();this._overlay.style.zIndex=t||"1600"}_destroyOverlay(){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))}_syncDismissableLayer(){if(this._dismissableLayer?.destroy(),this._dismissableLayer=null,!this._open||!this._overlay)return;const t=this._overlay.querySelector(".panel, .sheet"),e=this.root.querySelector(".field");t&&(this._dismissableLayer=U.createDismissableLayer({node:t,trigger:e,closeOnEscape:!0,closeOnPointerOutside:!0,closeOnFocusOutside:!1,onBeforeDismiss:i=>i==="escape-key"?(this._setOpen(!1,"escape"),!1):(i==="outside-pointer"&&this._setOpen(!1,"outside"),!1)}))}_positionOverlay(){if(!this._overlay||!this._open||this._isMobileSheet())return;const t=this.root.querySelector(".field"),e=this._overlay.querySelector(".panel");if(!t||!e)return;const i=e.getAttribute("data-placement"),r=l.computePopoverPosition(t.getBoundingClientRect(),e.getBoundingClientRect(),8,8,i==="top"?"top":i==="bottom"?"bottom":null);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)}_timeOptions(){const t=l.parseTimeInput(this._pending.time||"00:00")||{hours:0,minutes:0},e=this._minuteStep(),i=this._is12h()?Array.from({length:12},(a,n)=>{const s=n+1,u=t.hours%12||12;return`<option value="${s}" ${s===u?"selected":""}>${h(s)}</option>`}).join(""):Array.from({length:24},(a,n)=>`<option value="${n}" ${n===t.hours?"selected":""}>${h(n)}</option>`).join(""),r=Array.from({length:Math.ceil(60/e)},(a,n)=>{const s=Math.min(59,n*e);return`<option value="${s}" ${s===t.minutes?"selected":""}>${h(s)}</option>`}).join(""),o=t.hours>=12?"pm":"am";return{hours:i,minutes:r,meridiem:o}}_renderSurfaceInner(t,e=!1){const i=this._translations(),r=this._timeOptions(),o=(this.getAttribute("label")||"").trim(),a=p(o),n=p(o||i.selectDate),s=this._pending.date&&this._pending.time?this._formatDisplay(this._pending):"",u=`
|
|
469
472
|
<header class="head">
|
|
470
473
|
<div>
|
|
471
474
|
<p class="head-title" ${o?"":"hidden"}>${a}</p>
|
|
@@ -490,7 +493,7 @@
|
|
|
490
493
|
<button type="button" class="action" data-action="apply" data-tone="primary">${p(i.apply)}</button>
|
|
491
494
|
</footer>
|
|
492
495
|
`;return e?u:`
|
|
493
|
-
<style>${
|
|
496
|
+
<style>${Q}</style>
|
|
494
497
|
${t?'<div class="sheet-backdrop" data-action="backdrop"></div>':""}
|
|
495
498
|
<section class="${t?"sheet":"panel"}" id="${this._panelId}" role="dialog" aria-modal="${t?"true":"false"}" aria-label="${n}" part="${t?"sheet":"popover"}">${u}</section>
|
|
496
499
|
`}_syncCalendar(t){const e=(n,s)=>{if(s==null||s===""){t.hasAttribute(n)&&t.removeAttribute(n);return}t.getAttribute(n)!==s&&t.setAttribute(n,s)},i=(n,s)=>{s?e(n,""):e(n,null)};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"));const o=this.getAttribute("size")||"sm",a=t.classList.contains("dt-calendar-inline");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)}_overlaySignature(t){return[t?"sheet":"popover",this._minuteStep(),this._is12h()?"12h":"24h",this.getAttribute("locale")||"",this.getAttribute("translations")||""].join(":")}_ensureOverlayContent(t){if(!this._overlay)return;const e=this._overlaySignature(t);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>`)}_setClosestOptionValue(t,e){const i=Array.from(t.options).map(a=>Number(a.value)).filter(a=>Number.isFinite(a));if(!i.length)return;let r=i[0],o=Math.abs(r-e);for(let a=1;a<i.length;a+=1){const n=i[a],s=Math.abs(n-e);s<o&&(r=n,o=s)}t.value=String(r)}_syncOverlayState(){if(!this._overlay)return;this._syncOverlayHostZIndex();const t=this._isMobileSheet();this._ensureOverlayContent(t),this._syncDismissableLayer();const e=this._translations(),i=this._overlay.querySelector(".panel, .sheet"),r=this._overlay.querySelector(".footer");i&&(i.dataset.bare=this._isBare()?"true":"false"),r&&(r.hidden=!this._showFooter());const o=this._overlay.querySelector(".head-title");if(o){const d=(this.getAttribute("label")||"").trim();o.textContent=d,o.hidden=!d}const a=this._overlay.querySelector(".head-meta");a&&(a.textContent=this._pending.date&&this._pending.time?this._formatDisplay(this._pending):e.selectDate);const n=this._overlay.querySelector(".dt-calendar");n&&this._syncCalendar(n);const s=l.parseTimeInput(this._pending.time||"00:00")||{hours:0,minutes:0},u=this._overlay.querySelector('select[data-segment="hours"]'),f=this._overlay.querySelector('select[data-segment="minutes"]'),_=this._overlay.querySelector('select[data-segment="meridiem"]');if(u){const d=this._is12h()?s.hours%12||12:s.hours;this._setClosestOptionValue(u,d),u.disabled=this._isInteractionBlocked()||this._isReadonly()}f&&(this._setClosestOptionValue(f,s.minutes),f.disabled=this._isInteractionBlocked()||this._isReadonly()),_&&(_.value=s.hours>=12?"pm":"am",_.disabled=this._isInteractionBlocked()||this._isReadonly());const x=this._isInteractionBlocked()||this._isReadonly();this._overlay.querySelectorAll(".action").forEach(d=>{d.disabled=x}),t||this._schedulePosition.run()}_renderOverlay(){this._syncOverlayState()}_applyTimeFromSurface(t){const e=t.querySelector('select[data-segment="hours"]'),i=t.querySelector('select[data-segment="minutes"]'),r=t.querySelector('select[data-segment="meridiem"]');if(!e||!i)return;const o=Number(e.value),a=Number(i.value);if(!Number.isFinite(o)||!Number.isFinite(a))return;let n=o;if(this._is12h()){const s=r?.value==="pm"?"pm":"am";s==="pm"&&n<12&&(n+=12),s==="am"&&n===12&&(n=0)}this._pending=this._clampState({date:this._pending.date,time:`${h(n)}:${h(a)}`}),this._emitInput("time")}_onRootClick(t){const e=t.target;if(!e)return;const i=e.closest("[data-action]")?.getAttribute("data-action");if(i&&!(this._isInteractionBlocked()||this._isReadonly())){if(i==="toggle"){this._restoreFocusEl=e,this._setOpen(!this._open,"toggle");return}if(i==="clear"){this._isInlineMode()?(this._pending={date:null,time:null},this._emitInput("clear"),this._updateHostState()):this._commit({date:null,time:null},"clear");return}if(this._isInlineMode()&&i==="now"){const r=new Date,o=String(r.getMonth()+1).padStart(2,"0"),a=String(r.getDate()).padStart(2,"0"),n=`${r.getFullYear()}-${o}-${a}`,s=`${h(r.getHours())}:${h(r.getMinutes())}`;this._pending=this._clampState({date:n,time:s}),this._emitInput("now"),this._updateHostState();return}if(this._isInlineMode()&&i==="cancel"){this._pending={...this._value},this._updateHostState();return}this._isInlineMode()&&i==="apply"&&this._commit(this._pending,"apply")}}_onRootChange(t){if(!this._isInlineMode())return;const e=t.target;if(e){if(e.tagName.toLowerCase()==="ui-calendar"){this._onOverlayCalendar(t);return}if(e instanceof HTMLSelectElement&&e.closest(".inline-panel")){if(!e.matches("select[data-segment]")||this._isInteractionBlocked()||this._isReadonly())return;const i=this.root.querySelector(".inline-panel");if(!i)return;if(this._applyTimeFromSurface(i),this._shouldAutoCommit()&&this._pending.date&&this._pending.time){this._commit(this._pending,"time");return}this._updateHostState()}}}_onRootInput(t){const e=t.target;e instanceof HTMLInputElement&&e.classList.contains("input")&&this._allowInput()&&(this._isInteractionBlocked()||(this._draft=e.value,this._inlineError="",this._emitInput("typing")))}_onRootBlur(t){const e=t.target;if(!(e instanceof HTMLInputElement)||!e.classList.contains("input")||!this._allowInput()||this._isInteractionBlocked())return;const i=this._draft.trim();if(!i){this._commit({date:null,time:null},"blur");return}const r=/^(.+)\s+(\d{1,2}:\d{2}(?::\d{2})?(?:\s?[ap]m)?)$/i.exec(i);if(!r){this._inlineError=this.getAttribute("error")||this._translations().invalidDateTime,this._emitInvalid(i,"parse"),this._updateHostState();return}const o=this._parseDateInput(r[1]),a=l.parseTimeInput(r[2])?r[2]:null;if(!o||!a){this._inlineError=this.getAttribute("error")||this._translations().invalidDateTime,this._emitInvalid(i,"parse"),this._updateHostState();return}this._commit({date:o,time:a},"blur")}_onRootKeyDown(t){const e=t;if(!this._isInteractionBlocked()){if(e.key==="Escape"&&this._open&&!this._isInlineMode()){e.preventDefault(),this._setOpen(!1,"escape");return}e.key==="ArrowDown"&&!this._open&&!this._isInlineMode()&&(e.preventDefault(),this._setOpen(!0,"keyboard"))}}_onOverlayClick(t){const e=t.target;if(!e)return;const i=e.closest("[data-action]")?.getAttribute("data-action");if(i&&!this._isInteractionBlocked()&&!(this._isReadonly()&&i!=="toggle")){if(i==="backdrop"){this._setOpen(!1,"outside");return}if(i==="cancel"){this._pending={...this._value},this._setOpen(!1,"cancel");return}if(i==="clear"){this._pending={date:null,time:null},this._emitInput("clear"),this._renderOverlay();return}if(i==="now"){const r=new Date,o=String(r.getMonth()+1).padStart(2,"0"),a=String(r.getDate()).padStart(2,"0"),n=`${r.getFullYear()}-${o}-${a}`,s=`${h(r.getHours())}:${h(r.getMinutes())}`;this._pending=this._clampState({date:n,time:s}),this._emitInput("now"),this._renderOverlay();return}i==="apply"&&(this._commit(this._pending,"apply"),this._setOpen(!1,"apply"))}}_onOverlayChange(t){const e=t.target;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"))))}_onOverlayCalendar(t){if(this._isInteractionBlocked()||this._isReadonly())return;const e=t.target;if(!e||e.tagName.toLowerCase()!=="ui-calendar")return;const i=t.type,r=t.detail,o=l.normalizeDateIso(i==="select"?r?.value||null:r?.value);if(o){if(this._pending=this._clampState({date:o,time:this._pending.time||"09:00"}),this._emitInput("calendar"),this._shouldAutoCommit()&&this._pending.time){this._commit(this._pending,"calendar"),this._setOpen(!1,"calendar");return}this._updateHostState()}}_onDocumentPointerDown(t){if(!this._open||!this._overlay)return;const e=t.composedPath();e.includes(this)||e.includes(this._overlay)||this._setOpen(!1,"outside")}_onDocumentKeyDown(t){this._open&&t.key==="Escape"&&(t.preventDefault(),this._setOpen(!1,"escape"))}_updateHostState(){if(!this._hasView)return;const t=this.getAttribute("label")||"",e=this.getAttribute("hint")||"",i=this.getAttribute("error")||"",r=this._inlineError||i,o=!!y(this._value),a=this.getAttribute("name")||"",n=this._allowInput()?this._draft:this._formatDisplay(this._value),s=this._isInlineMode(),u=this._translations(),f=r?"error":this._state();this._state()==="loading"?this.setAttribute("aria-busy","true"):this.removeAttribute("aria-busy");const _=this.root.querySelector(".label"),x=this.root.querySelector(".label-text"),A=this.root.querySelector(".required"),d=this.root.querySelector(".input"),I=this.root.querySelector('.btn[data-action="clear"]'),v=this.root.querySelector('.btn[data-action="toggle"]'),g=this.root.querySelector(".hint"),S=this.root.querySelector(".error"),w=this.root.querySelector(".hidden-input");if(_&&(_.hidden=!t),_&&(_.id=this._labelId,_.setAttribute("for",this._inputId)),x&&(x.textContent=t),A&&(A.hidden=!this.hasAttribute("required")),d&&(d.value!==n&&(d.value=n),d.id=this._inputId,d.placeholder=u.dateTimePlaceholder,d.readOnly=!this._allowInput()||this._isReadonly(),d.disabled=this._isInteractionBlocked(),d.required=this.hasAttribute("required"),d.autocomplete="off",d.setAttribute("role","combobox"),d.setAttribute("aria-haspopup","dialog"),d.setAttribute("aria-expanded",s?"false":String(this._open)),d.setAttribute("aria-controls",this._panelId),d.setAttribute("aria-invalid",r?"true":"false"),P.syncControlName(d,this,t?this._labelId:null,d.placeholder)),I&&(I.hidden=!(this._clearable()&&o),I.setAttribute("aria-label",u.clear),I.disabled=this._isInteractionBlocked()),v&&(v.hidden=s,v.setAttribute("aria-label",u.toggleCalendar),v.setAttribute("aria-expanded",s?"false":String(this._open)),v.setAttribute("aria-controls",this._panelId),v.disabled=this._isInteractionBlocked()),g&&(g.id=this._hintId,g.hidden=!e,g.textContent=e),S&&(S.id=this._errorId,S.hidden=!r,S.textContent=r),d){const b=[];e&&g&&!g.hidden&&b.push(this._hintId),r&&b.push(this._errorId),P.syncControlDescription(d,this,this._uid,b)}w&&(w.disabled=!a,w.name=a,w.value=y(this._value)||"");const C=this.root.querySelector(".field");C&&(C.dataset.open=this._open&&!s?"true":"false",C.dataset.invalid=r?"true":"false",C.dataset.state=f);const c=this.root.querySelector(".inline-panel");if(c){c.hidden=!s,c.id=this._panelId,c.dataset.bare=this._isBare()?"true":"false",c.setAttribute("role","dialog"),c.setAttribute("aria-modal","false"),c.setAttribute("aria-label",t||u.selectDate);const b=c.querySelector(".panel-title");b&&(b.textContent=t,b.hidden=!t);const D=c.querySelector(".head-title");D&&(D.textContent=t,D.hidden=!t);const T=c.querySelector(".head-meta");T&&(T.textContent=this._pending.date&&this._pending.time?this._formatDisplay(this._pending):u.selectDate);const L=c.querySelector('[data-action="now"]');L&&(L.textContent=u.now);const E=c.querySelector('[data-action="clear"]');E&&(E.textContent=u.clear);const R=c.querySelector('[data-action="apply"]');R&&(R.textContent=u.apply);const q=c.querySelector(".footer");q&&(q.hidden=!this._showFooter());const M=c.querySelector(".dt-calendar-inline");M&&this._syncCalendar(M);const $=c.querySelector('select[data-segment="hours"]'),O=c.querySelector('select[data-segment="minutes"]'),B=c.querySelector('select[data-segment="meridiem"]'),k=l.parseTimeInput(this._pending.time||"00:00")||{hours:0,minutes:0};if($){const z=this._is12h()?k.hours%12||12:k.hours;this._setClosestOptionValue($,z),$.disabled=this._isInteractionBlocked()||this._isReadonly()}O&&(this._setClosestOptionValue(O,k.minutes),O.disabled=this._isInteractionBlocked()||this._isReadonly()),B&&(B.value=k.hours>=12?"pm":"am",B.disabled=this._isInteractionBlocked()||this._isReadonly()),c.querySelectorAll(".action").forEach(z=>{z.disabled=this._isInteractionBlocked()||this._isReadonly()})}!s&&this._open&&this._syncOverlayState(),s&&this._destroyOverlay()}render(){if(!this._hasView){const t=this._translations();this.setContent(`
|
|
@@ -501,11 +504,11 @@
|
|
|
501
504
|
<span class="required">*</span>
|
|
502
505
|
</label>
|
|
503
506
|
<div class="field" part="field input">
|
|
504
|
-
<span class="icon" part="icon">${
|
|
507
|
+
<span class="icon" part="icon">${W}</span>
|
|
505
508
|
<input class="input" id="${this._inputId}" part="input" />
|
|
506
509
|
<span class="icon" part="icon">${H}</span>
|
|
507
|
-
<button type="button" class="btn" part="clear" data-action="clear">${
|
|
508
|
-
<button type="button" class="btn" part="toggle" data-action="toggle">${
|
|
510
|
+
<button type="button" class="btn" part="clear" data-action="clear">${G}</button>
|
|
511
|
+
<button type="button" class="btn" part="toggle" data-action="toggle">${Y}</button>
|
|
509
512
|
</div>
|
|
510
513
|
<div class="hint" id="${this._hintId}" part="hint"></div>
|
|
511
514
|
<div class="error" id="${this._errorId}" part="error" role="alert"></div>
|
|
@@ -515,4 +518,4 @@
|
|
|
515
518
|
${this._renderSurfaceInner(!1,!0)}
|
|
516
519
|
</section>
|
|
517
520
|
</div>
|
|
518
|
-
`,{force:!0}),this._hasView=!0}this._updateHostState()}shouldRenderOnAttributeChange(t,e,i){return!1}}typeof customElements<"u"&&!customElements.get("ui-date-time-picker")&&customElements.define("ui-date-time-picker",
|
|
521
|
+
`,{force:!0}),this._hasView=!0}this._updateHostState()}shouldRenderOnAttributeChange(t,e,i){return!1}}typeof customElements<"u"&&!customElements.get("ui-date-time-picker")&&customElements.define("ui-date-time-picker",N);exports.UIDateTimePicker=N;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { E as
|
|
2
|
-
import { s as
|
|
3
|
-
import { c as
|
|
4
|
-
import { r as
|
|
5
|
-
import { r as
|
|
6
|
-
let
|
|
7
|
-
const
|
|
1
|
+
import { E as Y } from "./ElementBase-D5QsC5Vw.mjs";
|
|
2
|
+
import { s as G, a as J } from "./control-name-Bpj7F34X.mjs";
|
|
3
|
+
import { c as Q } from "./dismissable-layer-BmPIoK80.mjs";
|
|
4
|
+
import { r as X } from "./calendar-CFafqZVA.mjs";
|
|
5
|
+
import { r as tt, e as et, i as g, s as it, b as rt, f as st, t as nt, n as E, d as at, p as F, o as N, a as ot, m as R, j as Z, k as j, q as y, l as lt, c as dt } from "./date-time-utils-CJUksWj3.mjs";
|
|
6
|
+
let ut = 0;
|
|
7
|
+
const ct = `
|
|
8
8
|
<svg viewBox="0 0 20 20" class="icon-svg" aria-hidden="true" focusable="false">
|
|
9
9
|
<path d="M6 2a1 1 0 0 1 1 1v1h6V3a1 1 0 1 1 2 0v1h.5A2.5 2.5 0 0 1 18 6.5v9A2.5 2.5 0 0 1 15.5 18h-11A2.5 2.5 0 0 1 2 15.5v-9A2.5 2.5 0 0 1 4.5 4H5V3a1 1 0 0 1 1-1Zm10 7H4v6.5c0 .276.224.5.5.5h11a.5.5 0 0 0 .5-.5V9ZM4.5 6a.5.5 0 0 0-.5.5V7h12v-.5a.5.5 0 0 0-.5-.5h-11Z" fill="currentColor"/>
|
|
10
10
|
</svg>
|
|
11
|
-
`,
|
|
11
|
+
`, pt = `
|
|
12
12
|
<svg viewBox="0 0 20 20" class="icon-svg" aria-hidden="true" focusable="false">
|
|
13
13
|
<path d="M5.23 7.21a.75.75 0 0 1 1.06.02L10 11.12l3.71-3.9a.75.75 0 1 1 1.08 1.04l-4.25 4.47a.75.75 0 0 1-1.08 0L5.2 8.27a.75.75 0 0 1 .02-1.06Z" fill="currentColor"/>
|
|
14
14
|
</svg>
|
|
15
|
-
`,
|
|
15
|
+
`, ht = `
|
|
16
16
|
<svg viewBox="0 0 20 20" class="icon-svg" aria-hidden="true" focusable="false">
|
|
17
17
|
<path d="M5.22 5.22a.75.75 0 0 1 1.06 0L10 8.94l3.72-3.72a.75.75 0 1 1 1.06 1.06L11.06 10l3.72 3.72a.75.75 0 1 1-1.06 1.06L10 11.06l-3.72 3.72a.75.75 0 1 1-1.06-1.06L8.94 10 5.22 6.28a.75.75 0 0 1 0-1.06Z" fill="currentColor"/>
|
|
18
18
|
</svg>
|
|
@@ -20,7 +20,21 @@ const ut = `
|
|
|
20
20
|
<svg viewBox="0 0 20 20" class="icon-svg" aria-hidden="true" focusable="false">
|
|
21
21
|
<path d="M10 2a8 8 0 1 1 0 16 8 8 0 0 1 0-16Zm0 1.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13Zm.75 2.75a.75.75 0 0 0-1.5 0v3.88c0 .2.08.4.22.54l2.5 2.5a.75.75 0 1 0 1.06-1.06l-2.28-2.28V6.25Z" fill="currentColor"/>
|
|
22
22
|
</svg>
|
|
23
|
-
`,
|
|
23
|
+
`, W = `
|
|
24
|
+
.time-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
|
|
25
|
+
.time-grid[data-meridiem="true"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
|
|
26
|
+
.time-grid label { font-size: 11px; color: var(--ui-dp-muted, #526175); font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
|
|
27
|
+
.time-grid select {
|
|
28
|
+
min-block-size: 34px;
|
|
29
|
+
border: 1px solid color-mix(in srgb, var(--ui-dtp-border, #cbd5e1) 84%, transparent);
|
|
30
|
+
border-radius: 8px;
|
|
31
|
+
padding: 0 8px;
|
|
32
|
+
background: color-mix(in srgb, var(--ui-dtp-bg, #fff) 95%, transparent);
|
|
33
|
+
color: var(--ui-dp-text, #0f172a);
|
|
34
|
+
font: 600 13px/1 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
|
|
35
|
+
}
|
|
36
|
+
`, mt = `
|
|
37
|
+
${W}
|
|
24
38
|
:host {
|
|
25
39
|
--ui-dtp-bg: color-mix(in srgb, var(--ui-color-surface, #ffffff) 96%, transparent);
|
|
26
40
|
--ui-dtp-surface: linear-gradient(
|
|
@@ -253,7 +267,7 @@ const ut = `
|
|
|
253
267
|
--ui-dtp-border: #334155;
|
|
254
268
|
--ui-dp-text: #e2e8f0;
|
|
255
269
|
--ui-dp-muted: #94a3b8;
|
|
256
|
-
--ui-dtp-accent: #93c5fd;
|
|
270
|
+
--ui-dtp-accent: var(--ui-color-accent-on-dark, #93c5fd);
|
|
257
271
|
--ui-dtp-surface: linear-gradient(180deg, color-mix(in srgb, #0f172a 84%, #1e293b), #0f172a);
|
|
258
272
|
--ui-dtp-shadow: 0 18px 36px rgba(2, 6, 23, 0.48);
|
|
259
273
|
}
|
|
@@ -293,7 +307,7 @@ const ut = `
|
|
|
293
307
|
outline-color: Highlight;
|
|
294
308
|
}
|
|
295
309
|
}
|
|
296
|
-
`,
|
|
310
|
+
`, _t = `
|
|
297
311
|
.ui-date-time-picker-overlay-host {
|
|
298
312
|
--ui-dtp-bg: color-mix(in srgb, var(--ui-color-surface, #ffffff) 96%, transparent);
|
|
299
313
|
--ui-dtp-surface: linear-gradient(
|
|
@@ -388,18 +402,7 @@ const ut = `
|
|
|
388
402
|
block-size: 16px;
|
|
389
403
|
pointer-events: none;
|
|
390
404
|
}
|
|
391
|
-
|
|
392
|
-
.time-grid[data-meridiem="true"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
|
|
393
|
-
.time-grid label { font-size: 11px; color: var(--ui-dp-muted, #526175); font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
|
|
394
|
-
.time-grid select {
|
|
395
|
-
min-block-size: 34px;
|
|
396
|
-
border: 1px solid color-mix(in srgb, var(--ui-dtp-border, #cbd5e1) 84%, transparent);
|
|
397
|
-
border-radius: 8px;
|
|
398
|
-
padding: 0 8px;
|
|
399
|
-
background: color-mix(in srgb, var(--ui-dtp-bg, #fff) 95%, transparent);
|
|
400
|
-
color: var(--ui-dp-text, #0f172a);
|
|
401
|
-
font: 600 13px/1 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
|
|
402
|
-
}
|
|
405
|
+
${W}
|
|
403
406
|
.footer { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
|
|
404
407
|
.footer[hidden] { display: none !important; }
|
|
405
408
|
.action {
|
|
@@ -485,10 +488,10 @@ function U(h) {
|
|
|
485
488
|
function x(h) {
|
|
486
489
|
return Z(h.date, h.time);
|
|
487
490
|
}
|
|
488
|
-
class
|
|
491
|
+
class ft extends Y {
|
|
489
492
|
constructor() {
|
|
490
|
-
super(...arguments), this._value = { date: null, time: null }, this._pending = { date: null, time: null }, this._draft = "", this._inlineError = "", this._open = !1, this._syncing = !1, this._overlay = null, this._dismissableLayer = null, this._releaseScrollLock = null, this._isInitialized = !1, this._hasView = !1, this._restoreFocusEl = null, this._overlayKey = null, this._uid = `ui-dtp-${++
|
|
491
|
-
|
|
493
|
+
super(...arguments), this._value = { date: null, time: null }, this._pending = { date: null, time: null }, this._draft = "", this._inlineError = "", this._open = !1, this._syncing = !1, this._overlay = null, this._dismissableLayer = null, this._releaseScrollLock = null, this._isInitialized = !1, this._hasView = !1, this._restoreFocusEl = null, this._overlayKey = null, this._uid = `ui-dtp-${++ut}`, 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 = tt(() => this._positionOverlay()), this._onRootClickBound = (t) => this._onRootClick(t), this._onRootInputBound = (t) => this._onRootInput(t), this._onRootChangeBound = (t) => this._onRootChange(t), this._onRootBlurBound = (t) => this._onRootBlur(t), this._onRootKeyDownBound = (t) => this._onRootKeyDown(t), this._onOverlayClickBound = (t) => this._onOverlayClick(t), this._onOverlayChangeBound = (t) => this._onOverlayChange(t), this._onOverlayCalendarBound = (t) => this._onOverlayCalendar(t), this._onDocumentPointerDownBound = (t) => this._onDocumentPointerDown(t), this._onDocumentKeyDownBound = (t) => this._onDocumentKeyDown(t), this._onWindowResizeBound = () => this._schedulePosition.run(), this._onWindowScrollBound = (t) => {
|
|
494
|
+
et(t, [this._overlay]) || this._schedulePosition.run();
|
|
492
495
|
};
|
|
493
496
|
}
|
|
494
497
|
static get observedAttributes() {
|
|
@@ -549,7 +552,7 @@ class _t extends W {
|
|
|
549
552
|
return (this.getAttribute("mode") || "popover") === "inline";
|
|
550
553
|
}
|
|
551
554
|
_isMobileSheet() {
|
|
552
|
-
return
|
|
555
|
+
return it(this.getAttribute("mode"));
|
|
553
556
|
}
|
|
554
557
|
_isDisabled() {
|
|
555
558
|
return this.hasAttribute("disabled");
|
|
@@ -583,10 +586,10 @@ class _t extends W {
|
|
|
583
586
|
return g(this.getAttribute("bare"), !1);
|
|
584
587
|
}
|
|
585
588
|
_locale() {
|
|
586
|
-
return
|
|
589
|
+
return rt(this.getAttribute("locale"));
|
|
587
590
|
}
|
|
588
591
|
_translations() {
|
|
589
|
-
return
|
|
592
|
+
return X(
|
|
590
593
|
this.getAttribute("locale"),
|
|
591
594
|
this.getAttribute("translations")
|
|
592
595
|
);
|
|
@@ -597,8 +600,8 @@ class _t extends W {
|
|
|
597
600
|
}
|
|
598
601
|
_formatDisplay(t) {
|
|
599
602
|
if (!t.date || !t.time) return "";
|
|
600
|
-
const e =
|
|
601
|
-
return this._is12h() ? `${e} ${
|
|
603
|
+
const e = st(t.date, this._locale(), "locale", null);
|
|
604
|
+
return this._is12h() ? `${e} ${nt(t.time, this._locale())}` : `${e} ${t.time}`;
|
|
602
605
|
}
|
|
603
606
|
_is12h() {
|
|
604
607
|
return (this.getAttribute("format") || "24h") === "12h";
|
|
@@ -606,7 +609,7 @@ class _t extends W {
|
|
|
606
609
|
_parseDateInput(t) {
|
|
607
610
|
const e = E(t);
|
|
608
611
|
if (e) return e;
|
|
609
|
-
const i =
|
|
612
|
+
const i = at(t, this._locale());
|
|
610
613
|
if (i) return i;
|
|
611
614
|
const r = new Date(t);
|
|
612
615
|
if (!Number.isFinite(r.getTime())) return null;
|
|
@@ -669,7 +672,7 @@ class _t extends W {
|
|
|
669
672
|
}
|
|
670
673
|
_clampState(t) {
|
|
671
674
|
if (!t.date) return { date: null, time: t.time };
|
|
672
|
-
const e = this._minDate(), i = this._maxDate(), r =
|
|
675
|
+
const e = this._minDate(), i = this._maxDate(), r = ot(t.date, e, i), o = t.time || "00:00";
|
|
673
676
|
let a = this._minDateTime(), s = this._maxDateTime();
|
|
674
677
|
if (a && s && R(a, s) > 0) {
|
|
675
678
|
const _ = a;
|
|
@@ -719,7 +722,7 @@ class _t extends W {
|
|
|
719
722
|
_ensureOverlay() {
|
|
720
723
|
if (this._overlay || typeof document > "u") return;
|
|
721
724
|
const t = document.createElement("div");
|
|
722
|
-
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 =
|
|
725
|
+
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 = lt());
|
|
723
726
|
}
|
|
724
727
|
_syncOverlayHostZIndex() {
|
|
725
728
|
if (!this._overlay || typeof window > "u") return;
|
|
@@ -732,7 +735,7 @@ class _t extends W {
|
|
|
732
735
|
_syncDismissableLayer() {
|
|
733
736
|
if (this._dismissableLayer?.destroy(), this._dismissableLayer = null, !this._open || !this._overlay) return;
|
|
734
737
|
const t = this._overlay.querySelector(".panel, .sheet"), e = this.root.querySelector(".field");
|
|
735
|
-
t && (this._dismissableLayer =
|
|
738
|
+
t && (this._dismissableLayer = Q({
|
|
736
739
|
node: t,
|
|
737
740
|
trigger: e,
|
|
738
741
|
closeOnEscape: !0,
|
|
@@ -745,7 +748,7 @@ class _t extends W {
|
|
|
745
748
|
if (!this._overlay || !this._open || this._isMobileSheet()) return;
|
|
746
749
|
const t = this.root.querySelector(".field"), e = this._overlay.querySelector(".panel");
|
|
747
750
|
if (!t || !e) return;
|
|
748
|
-
const i = e.getAttribute("data-placement"), r =
|
|
751
|
+
const i = e.getAttribute("data-placement"), r = dt(
|
|
749
752
|
t.getBoundingClientRect(),
|
|
750
753
|
e.getBoundingClientRect(),
|
|
751
754
|
8,
|
|
@@ -791,7 +794,7 @@ class _t extends W {
|
|
|
791
794
|
</footer>
|
|
792
795
|
`;
|
|
793
796
|
return e ? d : `
|
|
794
|
-
<style>${
|
|
797
|
+
<style>${_t}</style>
|
|
795
798
|
${t ? '<div class="sheet-backdrop" data-action="backdrop"></div>' : ""}
|
|
796
799
|
<section class="${t ? "sheet" : "panel"}" id="${this._panelId}" role="dialog" aria-modal="${t ? "true" : "false"}" aria-label="${s}" part="${t ? "sheet" : "popover"}">${d}</section>
|
|
797
800
|
`;
|
|
@@ -1012,8 +1015,8 @@ class _t extends W {
|
|
|
1012
1015
|
if (!this._hasView) return;
|
|
1013
1016
|
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(), _ = r ? "error" : this._state();
|
|
1014
1017
|
this._state() === "loading" ? this.setAttribute("aria-busy", "true") : this.removeAttribute("aria-busy");
|
|
1015
|
-
const m = this.root.querySelector(".label"), S = this.root.querySelector(".label-text"), $ = this.root.querySelector(".required"), l = this.root.querySelector(".input"),
|
|
1016
|
-
if (m && (m.hidden = !t), m && (m.id = this._labelId, m.setAttribute("for", this._inputId)), S && (S.textContent = t), $ && ($.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"),
|
|
1018
|
+
const m = this.root.querySelector(".label"), S = this.root.querySelector(".label-text"), $ = this.root.querySelector(".required"), l = this.root.querySelector(".input"), I = this.root.querySelector('.btn[data-action="clear"]'), b = this.root.querySelector('.btn[data-action="toggle"]'), v = this.root.querySelector(".hint"), w = this.root.querySelector(".error"), k = this.root.querySelector(".hidden-input");
|
|
1019
|
+
if (m && (m.hidden = !t), m && (m.id = this._labelId, m.setAttribute("for", this._inputId)), S && (S.textContent = t), $ && ($.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"), G(l, this, t ? this._labelId : null, l.placeholder)), I && (I.hidden = !(this._clearable() && o), I.setAttribute("aria-label", d.clear), I.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()), v && (v.id = this._hintId, v.hidden = !e, v.textContent = e), w && (w.id = this._errorId, w.hidden = !r, w.textContent = r), l) {
|
|
1017
1020
|
const f = [];
|
|
1018
1021
|
e && v && !v.hidden && f.push(this._hintId), r && f.push(this._errorId), J(l, this, this._uid, f);
|
|
1019
1022
|
}
|
|
@@ -1054,18 +1057,18 @@ class _t extends W {
|
|
|
1054
1057
|
if (!this._hasView) {
|
|
1055
1058
|
const t = this._translations();
|
|
1056
1059
|
this.setContent(`
|
|
1057
|
-
<style>${
|
|
1060
|
+
<style>${mt}</style>
|
|
1058
1061
|
<div class="root">
|
|
1059
1062
|
<label class="label" part="label" id="${this._labelId}">
|
|
1060
1063
|
<span class="label-text"></span>
|
|
1061
1064
|
<span class="required">*</span>
|
|
1062
1065
|
</label>
|
|
1063
1066
|
<div class="field" part="field input">
|
|
1064
|
-
<span class="icon" part="icon">${
|
|
1067
|
+
<span class="icon" part="icon">${ct}</span>
|
|
1065
1068
|
<input class="input" id="${this._inputId}" part="input" />
|
|
1066
1069
|
<span class="icon" part="icon">${K}</span>
|
|
1067
|
-
<button type="button" class="btn" part="clear" data-action="clear">${
|
|
1068
|
-
<button type="button" class="btn" part="toggle" data-action="toggle">${
|
|
1070
|
+
<button type="button" class="btn" part="clear" data-action="clear">${ht}</button>
|
|
1071
|
+
<button type="button" class="btn" part="toggle" data-action="toggle">${pt}</button>
|
|
1069
1072
|
</div>
|
|
1070
1073
|
<div class="hint" id="${this._hintId}" part="hint"></div>
|
|
1071
1074
|
<div class="error" id="${this._errorId}" part="error" role="alert"></div>
|
|
@@ -1083,7 +1086,7 @@ class _t extends W {
|
|
|
1083
1086
|
return !1;
|
|
1084
1087
|
}
|
|
1085
1088
|
}
|
|
1086
|
-
typeof customElements < "u" && !customElements.get("ui-date-time-picker") && customElements.define("ui-date-time-picker",
|
|
1089
|
+
typeof customElements < "u" && !customElements.get("ui-date-time-picker") && customElements.define("ui-date-time-picker", ft);
|
|
1087
1090
|
export {
|
|
1088
|
-
|
|
1091
|
+
ft as UIDateTimePicker
|
|
1089
1092
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as T, c as b, a as N, s as F, e as L } from "./calendar-
|
|
1
|
+
import { p as T, c as b, a as N, s as F, e as L } from "./calendar-CFafqZVA.mjs";
|
|
2
2
|
import { a as U } from "./scroll-lock-LfqXXqsu.mjs";
|
|
3
3
|
import { c as I } from "./positioner-BE8Nbho2.mjs";
|
|
4
4
|
const C = /* @__PURE__ */ new Map(), O = 24;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const l=require("./calendar-
|
|
1
|
+
"use strict";const l=require("./calendar-BsVqtpjM.js"),I=require("./scroll-lock-BX6e3Ced.js"),v=require("./positioner-DZ1FW6A9.js"),w=new Map,N=24;function y(t,e,n){return Math.max(e,Math.min(n,t))}function u(t){return String(t).padStart(2,"0")}function $(t){if(!/^-?\d+$/.test(t))return null;const e=Number(t);return Number.isFinite(e)?Math.trunc(e):null}function O(t){return t.replace(/[.\-]/g,"/").replace(/\s+/g," ").trim()}function L(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 U(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 F(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 P(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 C(t){try{return new Intl.DateTimeFormat(t),!0}catch{return!1}}function z(t){const e=(t||"").trim();return e&&C(e)?e:typeof navigator<"u"&&navigator.language&&C(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 D(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 A(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 Y(t){if(!t)return null;const e=m(t);return e||D(t)?.date||null}function k(t){if(!t)return null;const e=D(t);if(e)return e;const n=m(t);return n?{date:n,time:"00:00"}:null}function q(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 B(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=L(e),s=U(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 q(t,e)}function x(t,e){const n=m(t.trim());if(n)return n;const r=O(t);if(!r)return null;const o=m(r);if(o)return o;const i=r.split("/").map(b=>b.trim()).filter(Boolean);if(i.length!==3)return null;const s=$(i[0]),a=$(i[1]),h=$(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,g=p?a:s;if(f<1e3||c<1||c>12||g<1||g>31)return null;const T=`${f}-${u(c)}-${u(g)}`;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 H(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 E(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 W(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 Z(t,e){const n=D(t),r=D(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 _(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 R(t,e){const n=y(e,1,366);return{start:l.addDaysISO(t,-(n-1)),end:t}}function G(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,b=p==="bottom"?a:s;T>0&&b<=T+N?c=p:c=s>=a?"bottom":"top"}const g=v.computePositionState(t,e,{placement:`${c}-start`,strategy:"fixed",offset:r,shift:!1,flip:!1,boundaryPadding:n});return{top:Math.round(g.y),left:Math.round(g.x),placement:c}}function J(t){let e=0;return{run:()=>{e||(e=requestAnimationFrame(()=>{e=0,t()}))},cancel:()=>{e&&(cancelAnimationFrame(e),e=0)}}}function K(t){return(t||"popover")==="inline"||typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(max-width: 639px)").matches}function V(){return I.acquireBodyScrollLock()}exports.clampDateIso=W;exports.clampTime=E;exports.combineDateTime=A;exports.compareDateTimes=Z;exports.compareTimes=S;exports.computeLastDaysRange=R;exports.computeMonthRange=_;exports.computePopoverPosition=G;exports.eventOriginatesWithin=P;exports.formatDateForDisplay=B;exports.formatTime=M;exports.isTruthyAttr=F;exports.lockBodyScroll=V;exports.normalizeDateIso=m;exports.normalizeLocale=z;exports.parseConstraintDate=Y;exports.parseConstraintDateTime=k;exports.parseTimeInput=d;exports.parseUserDateInput=x;exports.rafThrottle=J;exports.shouldUseMobileSheet=K;exports.splitDateTime=D;exports.to12hDisplay=H;
|
package/dist/description.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("./ElementBase-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("./ElementBase-CbUsP3D6.js"),u=`
|
|
2
2
|
:host {
|
|
3
3
|
--ui-description-color: var(--ui-color-muted, var(--ui-muted, #526175));
|
|
4
4
|
--ui-description-size: 12px;
|
package/dist/description.esm.js
CHANGED