@editora/ui-core 0.1.18 → 0.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ElementBase-1b301e7f.js → ElementBase-EV6mVBUV.js} +1 -1
- package/dist/{ElementBase-909688f3.mjs → ElementBase-YlTLMsGk.mjs} +3 -3
- package/dist/accordion.cjs.js +3 -3
- package/dist/accordion.esm.js +39 -62
- package/dist/alert-dialog.cjs.js +19 -19
- package/dist/alert-dialog.esm.js +69 -87
- package/dist/alert.cjs.js +1 -1
- package/dist/alert.esm.js +4 -7
- package/dist/anchor.cjs.js +2 -2
- package/dist/anchor.esm.js +3 -3
- package/dist/animated-beam.cjs.js +83 -83
- package/dist/animated-beam.esm.js +250 -277
- package/dist/animated-list.cjs.js +4 -4
- package/dist/animated-list.esm.js +47 -61
- package/dist/animated-text.cjs.js +2 -2
- package/dist/animated-text.esm.js +13 -24
- package/dist/app-header.cjs.js +3 -3
- package/dist/app-header.esm.js +11 -13
- package/dist/aspect-ratio.cjs.js +1 -1
- package/dist/aspect-ratio.esm.js +4 -7
- package/dist/avatar.cjs.js +1 -1
- package/dist/avatar.esm.js +7 -13
- package/dist/badge.cjs.js +1 -1
- package/dist/badge.esm.js +4 -7
- package/dist/block-controls.cjs.js +2 -2
- package/dist/block-controls.esm.js +19 -35
- package/dist/box.cjs.js +1 -1
- package/dist/box.esm.js +8 -15
- package/dist/breadcrumb.cjs.js +2 -2
- package/dist/breadcrumb.esm.js +20 -37
- package/dist/button.cjs.js +1 -521
- package/dist/button.esm.js +2 -669
- package/dist/{calendar-2c11b824.mjs → calendar-DLY4acgn.mjs} +293 -342
- package/dist/{calendar-a8735e40.js → calendar-Dkof-FTK.js} +25 -25
- package/dist/calendar.cjs.js +1 -1
- package/dist/calendar.esm.js +8 -9
- package/dist/card.cjs.js +4 -4
- package/dist/card.esm.js +13 -19
- package/dist/chart.cjs.js +64 -64
- package/dist/chart.esm.js +223 -254
- package/dist/checkbox.cjs.js +1 -1
- package/dist/checkbox.esm.js +2 -3
- package/dist/collapsible.cjs.js +1 -1
- package/dist/collapsible.esm.js +5 -9
- package/dist/{collection-a1aac0c6.mjs → collection-C7URGjEI.mjs} +8 -14
- package/dist/collection.cjs.js +1 -1
- package/dist/collection.esm.js +4 -7
- package/dist/color-picker.cjs.js +9 -9
- package/dist/color-picker.esm.js +189 -252
- package/dist/combobox.cjs.js +13 -13
- package/dist/combobox.esm.js +93 -126
- package/dist/command-palette.cjs.js +3 -3
- package/dist/command-palette.esm.js +19 -30
- package/dist/command.cjs.js +4 -4
- package/dist/command.esm.js +41 -53
- package/dist/components/ui-button.d.ts +1 -0
- package/dist/components/ui-button.d.ts.map +1 -1
- package/dist/components/ui-date-picker.d.ts.map +1 -1
- package/dist/components/ui-date-range-picker.d.ts.map +1 -1
- package/dist/components/ui-date-range-time-picker.d.ts +1 -0
- package/dist/components/ui-date-range-time-picker.d.ts.map +1 -1
- package/dist/components/ui-date-time-picker.d.ts +1 -0
- package/dist/components/ui-date-time-picker.d.ts.map +1 -1
- package/dist/components/ui-orbiter.d.ts.map +1 -1
- package/dist/components/ui-skeleton.d.ts.map +1 -1
- package/dist/components/ui-split-button.d.ts +1 -0
- package/dist/components/ui-split-button.d.ts.map +1 -1
- package/dist/components/ui-time-picker.d.ts.map +1 -1
- package/dist/container.cjs.js +2 -2
- package/dist/container.esm.js +2 -3
- package/dist/context-menu.cjs.js +8 -8
- package/dist/context-menu.esm.js +157 -219
- package/dist/control-group.cjs.js +1 -1
- package/dist/control-group.esm.js +2 -3
- package/dist/data-table.cjs.js +4 -4
- package/dist/data-table.esm.js +299 -381
- package/dist/date-field.cjs.js +3 -3
- package/dist/date-field.esm.js +68 -80
- package/dist/date-picker.cjs.js +30 -9
- package/dist/date-picker.esm.js +90 -97
- package/dist/date-range-picker.cjs.js +22 -3
- package/dist/date-range-picker.esm.js +103 -108
- package/dist/date-range-time-picker.cjs.js +28 -12
- package/dist/date-range-time-picker.esm.js +137 -150
- package/dist/date-time-picker.cjs.js +25 -9
- package/dist/date-time-picker.esm.js +139 -155
- package/dist/date-time-utils-Dmost5Ee.js +1 -0
- package/dist/date-time-utils-y1N2gvG2.mjs +268 -0
- package/dist/description.cjs.js +1 -1
- package/dist/description.esm.js +3 -5
- package/dist/dialog.cjs.js +12 -12
- package/dist/dialog.esm.js +44 -63
- package/dist/direction-provider.cjs.js +1 -1
- package/dist/direction-provider.esm.js +2 -3
- package/dist/{dismissable-layer-9c7e6b58.mjs → dismissable-layer-BmPIoK80.mjs} +29 -33
- package/dist/dismissable-layer-DNfrKA20.js +1 -0
- package/dist/dismissable-layer.cjs.js +2 -2
- package/dist/dismissable-layer.esm.js +4 -6
- package/dist/dock.cjs.js +5 -5
- package/dist/dock.esm.js +134 -155
- package/dist/drawer.cjs.js +2 -2
- package/dist/drawer.esm.js +18 -35
- package/dist/dropdown.cjs.js +2 -2
- package/dist/dropdown.esm.js +119 -149
- package/dist/dropzone.cjs.js +1 -1
- package/dist/dropzone.esm.js +0 -1
- package/dist/empty-state.cjs.js +1 -1
- package/dist/empty-state.esm.js +1 -1
- package/dist/field-error.cjs.js +1 -1
- package/dist/field-error.esm.js +3 -5
- package/dist/field.cjs.js +5 -5
- package/dist/field.esm.js +27 -34
- package/dist/fieldset.cjs.js +4 -4
- package/dist/fieldset.esm.js +19 -24
- package/dist/file-upload.cjs.js +4 -4
- package/dist/file-upload.esm.js +69 -93
- package/dist/flex.cjs.js +1 -1
- package/dist/flex.esm.js +5 -9
- package/dist/floating-toolbar.cjs.js +4 -4
- package/dist/floating-toolbar.esm.js +60 -85
- package/dist/focus-scope-Bwug2gDv.js +1 -0
- package/dist/{focus-scope-103833ee.mjs → focus-scope-CmEsG5UZ.mjs} +39 -48
- package/dist/focus-scope.cjs.js +2 -2
- package/dist/focus-scope.esm.js +15 -20
- package/dist/form.cjs.js +2 -2
- package/dist/form.esm.js +26 -53
- package/dist/gantt.cjs.js +43 -43
- package/dist/gantt.esm.js +295 -322
- package/dist/grid.cjs.js +1 -1
- package/dist/grid.esm.js +5 -9
- package/dist/hover-card.cjs.js +4 -4
- package/dist/hover-card.esm.js +22 -28
- package/dist/icon-cloud.cjs.js +7 -7
- package/dist/icon-cloud.esm.js +48 -62
- package/dist/icon.cjs.js +1 -1
- package/dist/icon.esm.js +2 -4
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +378 -390
- package/dist/inline-edit.cjs.js +11 -11
- package/dist/inline-edit.esm.js +32 -36
- package/dist/input.cjs.js +17 -17
- package/dist/input.esm.js +50 -63
- package/dist/label.cjs.js +2 -2
- package/dist/label.esm.js +8 -17
- package/dist/layout.cjs.js +2 -2
- package/dist/layout.esm.js +20 -26
- package/dist/listbox-B6QgECax.js +46 -0
- package/dist/listbox-DJamVeFj.mjs +200 -0
- package/dist/listbox.cjs.js +1 -1
- package/dist/listbox.esm.js +2 -4
- package/dist/marquee.cjs.js +5 -5
- package/dist/marquee.esm.js +33 -50
- package/dist/masonry-grid.cjs.js +1 -1
- package/dist/masonry-grid.esm.js +5 -9
- package/dist/menu.cjs.js +3 -3
- package/dist/menu.esm.js +106 -126
- package/dist/menubar.cjs.js +5 -5
- package/dist/menubar.esm.js +118 -164
- package/dist/meter.cjs.js +2 -2
- package/dist/meter.esm.js +4 -4
- package/dist/multi-select.cjs.js +4 -4
- package/dist/multi-select.esm.js +120 -140
- package/dist/navigation-menu.cjs.js +4 -4
- package/dist/navigation-menu.esm.js +44 -55
- package/dist/number-field.cjs.js +2 -2
- package/dist/number-field.esm.js +73 -98
- package/dist/number-ticker.cjs.js +3 -3
- package/dist/number-ticker.esm.js +22 -43
- package/dist/odometer.cjs.js +1 -1
- package/dist/odometer.esm.js +5 -9
- package/dist/orbiter.cjs.js +13 -13
- package/dist/orbiter.esm.js +79 -90
- package/dist/{overlayManager-5bbd4dc3.mjs → overlayManager-BJjU1VA8.mjs} +4 -5
- package/dist/{overlayManager-0eda4e08.js → overlayManager-CSy3fJmJ.js} +1 -1
- package/dist/pagination.cjs.js +2 -2
- package/dist/pagination.esm.js +14 -18
- package/dist/{panel-group-a376cc5e.mjs → panel-group-8sVNnGxg.mjs} +24 -46
- package/dist/panel-group-CaD0_KQf.js +36 -0
- package/dist/panel-group.cjs.js +1 -1
- package/dist/panel-group.esm.js +2 -5
- package/dist/panel.cjs.js +4 -4
- package/dist/panel.esm.js +8 -10
- package/dist/password-field.cjs.js +9 -9
- package/dist/password-field.esm.js +62 -82
- package/dist/pin-input.cjs.js +3 -3
- package/dist/pin-input.esm.js +33 -39
- package/dist/placement-grid.cjs.js +4 -4
- package/dist/placement-grid.esm.js +108 -131
- package/dist/plugin-panel.cjs.js +7 -7
- package/dist/plugin-panel.esm.js +13 -15
- package/dist/popover.cjs.js +2 -2
- package/dist/popover.esm.js +21 -31
- package/dist/portal-DgpQ3Jo1.js +1 -0
- package/dist/{portal-fe73e5cc.mjs → portal-bR42gHvG.mjs} +43 -48
- package/dist/portal.cjs.js +2 -2
- package/dist/portal.esm.js +10 -19
- package/dist/{positioner-e9770c66.mjs → positioner-D0VGxtYU.mjs} +189 -209
- package/dist/positioner-D_fqyx_j.js +1 -0
- package/dist/positioner.cjs.js +2 -2
- package/dist/positioner.esm.js +11 -18
- package/dist/presence.cjs.js +1 -1
- package/dist/presence.esm.js +7 -13
- package/dist/progress.cjs.js +1 -1
- package/dist/progress.esm.js +5 -9
- package/dist/quick-actions.cjs.js +6 -6
- package/dist/quick-actions.esm.js +52 -62
- package/dist/radio-group.cjs.js +13 -13
- package/dist/radio-group.esm.js +39 -51
- package/dist/radio.cjs.js +1 -1
- package/dist/radio.esm.js +5 -9
- package/dist/rating.cjs.js +1 -1
- package/dist/rating.esm.js +12 -23
- package/dist/{roving-focus-group-4350c9a7.mjs → roving-focus-group-Dbm1Jko_.mjs} +3 -6
- package/dist/roving-focus-group.cjs.js +1 -1
- package/dist/roving-focus-group.esm.js +3 -5
- package/dist/runtime-CTaOSmBj.js +1 -0
- package/dist/{runtime-161f68a2.mjs → runtime-D1gFh1fS.mjs} +338 -366
- package/dist/runtime.cjs.js +1 -1
- package/dist/runtime.esm.js +6 -6
- package/dist/scroll-area.cjs.js +3 -3
- package/dist/scroll-area.esm.js +38 -46
- package/dist/{scroll-lock-31da444f.mjs → scroll-lock-LfqXXqsu.mjs} +5 -9
- package/dist/section.cjs.js +1 -1
- package/dist/section.esm.js +1 -1
- package/dist/select.cjs.js +7 -7
- package/dist/select.esm.js +67 -97
- package/dist/selection-popup.cjs.js +1 -1
- package/dist/selection-popup.esm.js +8 -15
- package/dist/separator.cjs.js +1 -1
- package/dist/separator.esm.js +1 -1
- package/dist/sidebar.cjs.js +18 -18
- package/dist/sidebar.esm.js +117 -139
- package/dist/skeleton.cjs.js +11 -11
- package/dist/skeleton.esm.js +27 -24
- package/dist/slider.cjs.js +1 -1
- package/dist/slider.esm.js +6 -11
- package/dist/slot.cjs.js +4 -4
- package/dist/slot.esm.js +16 -19
- package/dist/sortable.cjs.js +45 -45
- package/dist/sortable.esm.js +421 -524
- package/dist/spinning-text.cjs.js +12 -12
- package/dist/spinning-text.esm.js +80 -92
- package/dist/split-button.cjs.js +4 -4
- package/dist/split-button.esm.js +77 -62
- package/dist/splitter.cjs.js +1 -1
- package/dist/splitter.esm.js +1 -1
- package/dist/stepper.cjs.js +8 -8
- package/dist/stepper.esm.js +32 -52
- package/dist/switch.cjs.js +7 -7
- package/dist/switch.esm.js +23 -31
- package/dist/table.cjs.js +2 -2
- package/dist/table.esm.js +46 -56
- package/dist/tabs.cjs.js +3 -3
- package/dist/tabs.esm.js +35 -55
- package/dist/tags-input.cjs.js +4 -4
- package/dist/tags-input.esm.js +45 -62
- package/dist/textarea.cjs.js +6 -6
- package/dist/textarea.esm.js +32 -41
- package/dist/time-field.cjs.js +4 -4
- package/dist/time-field.esm.js +70 -84
- package/dist/time-picker.cjs.js +29 -21
- package/dist/time-picker.esm.js +96 -110
- package/dist/timeline.cjs.js +1 -1
- package/dist/timeline.esm.js +3 -5
- package/dist/toast.cjs.js +2 -2
- package/dist/toast.esm.js +33 -47
- package/dist/toggle-group.cjs.js +6 -6
- package/dist/toggle-group.esm.js +85 -105
- package/dist/toggle.cjs.js +1 -1
- package/dist/toggle.esm.js +3 -5
- package/dist/toolbar.cjs.js +1 -1
- package/dist/toolbar.esm.js +13 -24
- package/dist/tooltip.cjs.js +2 -2
- package/dist/tooltip.esm.js +31 -42
- package/dist/transfer-list.cjs.js +19 -19
- package/dist/transfer-list.esm.js +98 -111
- package/dist/{tree-dcd74a4a.mjs → tree-B3kE8ESs.mjs} +55 -62
- package/dist/tree-Dx_kv_ih.js +39 -0
- package/dist/tree-item.cjs.js +2 -2
- package/dist/tree-item.esm.js +2 -3
- package/dist/tree.cjs.js +1 -1
- package/dist/tree.esm.js +2 -5
- package/dist/ui-button-Q0GNNWKC.mjs +665 -0
- package/dist/ui-button-rXQOS9QJ.js +521 -0
- package/dist/{icon-9e9da03b.js → ui-icon-BzVNC_lr.js} +4 -4
- package/dist/{icon-e2a85cc1.mjs → ui-icon-YI6lyuqU.mjs} +58 -65
- package/dist/visually-hidden.cjs.js +1 -1
- package/dist/visually-hidden.esm.js +1 -1
- package/dist/wizard.cjs.js +14 -14
- package/dist/wizard.esm.js +85 -105
- package/package.json +3 -3
- package/dist/date-time-utils-66480de4.js +0 -1
- package/dist/date-time-utils-a2c7af25.mjs +0 -307
- package/dist/dismissable-layer-193e3bed.js +0 -1
- package/dist/focus-scope-2b12b4e7.js +0 -1
- package/dist/listbox-308789a0.mjs +0 -210
- package/dist/listbox-ef2f708e.js +0 -46
- package/dist/panel-group-40254cdd.js +0 -36
- package/dist/portal-c69756c0.js +0 -1
- package/dist/positioner-33529bb8.js +0 -1
- package/dist/runtime-3f13807b.js +0 -1
- package/dist/tree-0a7a8d05.js +0 -39
- /package/dist/{collection-a2969ad2.js → collection-qv8A8rq4.js} +0 -0
- /package/dist/{menu-item-styles-27fdbac4.mjs → menu-item-styles-CZiPwPwl.mjs} +0 -0
- /package/dist/{menu-item-styles-83ad1e22.js → menu-item-styles-CbNUEwP2.js} +0 -0
- /package/dist/{roving-focus-group-5c059bf9.js → roving-focus-group-BdJ_4Njm.js} +0 -0
- /package/dist/{scroll-lock-d7b0df21.js → scroll-lock-BX6e3Ced.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as Ae } from "./ElementBase-
|
|
1
|
+
import { E as Ae } from "./ElementBase-YlTLMsGk.mjs";
|
|
2
2
|
const Te = {
|
|
3
3
|
calendarLabel: "Calendar",
|
|
4
4
|
today: "Today",
|
|
@@ -137,45 +137,41 @@ const Te = {
|
|
|
137
137
|
timePlaceholderSeconds: "HH:mm:ss",
|
|
138
138
|
dateTimePlaceholder: "YYYY-MM-DD HH:mm",
|
|
139
139
|
dateRangeTimePlaceholder: "Debut — Fin"
|
|
140
|
-
},
|
|
140
|
+
}, Ee = {
|
|
141
141
|
en: Te,
|
|
142
142
|
zh: Re,
|
|
143
143
|
fr: ze
|
|
144
|
-
},
|
|
145
|
-
function
|
|
144
|
+
}, se = /* @__PURE__ */ new Map();
|
|
145
|
+
function $e(r) {
|
|
146
146
|
return r.trim().toLowerCase().replace(/_/g, "-");
|
|
147
147
|
}
|
|
148
|
-
function
|
|
149
|
-
const e = r || (typeof navigator < "u" && navigator.language ? navigator.language : "en"), t =
|
|
148
|
+
function Oe(r) {
|
|
149
|
+
const e = r || (typeof navigator < "u" && navigator.language ? navigator.language : "en"), t = $e(e || "");
|
|
150
150
|
return t === "zh" || t.startsWith("zh-") || t === "cn" || t === "chinese" || t === "zh-cn" || t === "zh-hans" || t === "zh-hant" ? "zh" : t === "fr" || t.startsWith("fr-") || t === "french" ? "fr" : "en";
|
|
151
151
|
}
|
|
152
|
-
function
|
|
153
|
-
if (!r || typeof r != "object" || Array.isArray(r))
|
|
154
|
-
return {};
|
|
152
|
+
function oe(r) {
|
|
153
|
+
if (!r || typeof r != "object" || Array.isArray(r)) return {};
|
|
155
154
|
const e = {};
|
|
156
|
-
return Object.entries(r).forEach(([t,
|
|
157
|
-
typeof
|
|
155
|
+
return Object.entries(r).forEach(([t, n]) => {
|
|
156
|
+
typeof n == "string" && (e[t] = n);
|
|
158
157
|
}), e;
|
|
159
158
|
}
|
|
160
|
-
function
|
|
161
|
-
if (!r)
|
|
162
|
-
return {};
|
|
159
|
+
function Pe(r, e) {
|
|
160
|
+
if (!r) return {};
|
|
163
161
|
try {
|
|
164
162
|
const t = JSON.parse(r);
|
|
165
|
-
if (!t || typeof t != "object" || Array.isArray(t))
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
return { ...a, ...n };
|
|
163
|
+
if (!t || typeof t != "object" || Array.isArray(t)) return {};
|
|
164
|
+
const n = oe(t), a = oe(t[e]);
|
|
165
|
+
return { ...n, ...a };
|
|
169
166
|
} catch {
|
|
170
167
|
return {};
|
|
171
168
|
}
|
|
172
169
|
}
|
|
173
170
|
function Le(r, e) {
|
|
174
|
-
const t =
|
|
175
|
-
if (
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
return oe.set(a, o), o;
|
|
171
|
+
const t = Oe(r), n = `${t}::${e || ""}`, a = se.get(n);
|
|
172
|
+
if (a) return a;
|
|
173
|
+
const i = Ee[t], s = Pe(e, t), l = { ...i, ...s };
|
|
174
|
+
return se.set(n, l), l;
|
|
179
175
|
}
|
|
180
176
|
const Be = `
|
|
181
177
|
:host {
|
|
@@ -819,7 +815,7 @@ const Be = `
|
|
|
819
815
|
from { background-position: 120% 0; }
|
|
820
816
|
to { background-position: -120% 0; }
|
|
821
817
|
}
|
|
822
|
-
`,
|
|
818
|
+
`, V = {
|
|
823
819
|
default: "var(--ui-color-primary, #2563eb)",
|
|
824
820
|
info: "var(--ui-color-info, #0891b2)",
|
|
825
821
|
success: "var(--ui-color-success, #16a34a)",
|
|
@@ -829,29 +825,27 @@ const Be = `
|
|
|
829
825
|
function O(r, e, t) {
|
|
830
826
|
return Math.max(e, Math.min(t, r));
|
|
831
827
|
}
|
|
832
|
-
function
|
|
828
|
+
function L(r) {
|
|
833
829
|
return String(r).padStart(2, "0");
|
|
834
830
|
}
|
|
835
831
|
function v(r) {
|
|
836
|
-
return `${r.y}-${
|
|
832
|
+
return `${r.y}-${L(r.m)}-${L(r.d)}`;
|
|
837
833
|
}
|
|
838
834
|
function c(r) {
|
|
839
835
|
const e = /^(\d{4})-(\d{2})-(\d{2})$/.exec((r || "").trim());
|
|
840
|
-
if (!e)
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
const i = H(t, a);
|
|
846
|
-
return n < 1 || n > i ? null : { y: t, m: a, d: n };
|
|
836
|
+
if (!e) return null;
|
|
837
|
+
const t = Number(e[1]), n = Number(e[2]), a = Number(e[3]);
|
|
838
|
+
if (!Number.isInteger(t) || !Number.isInteger(n) || !Number.isInteger(a) || n < 1 || n > 12) return null;
|
|
839
|
+
const i = F(t, n);
|
|
840
|
+
return a < 1 || a > i ? null : { y: t, m: n, d: a };
|
|
847
841
|
}
|
|
848
|
-
function
|
|
842
|
+
function F(r, e) {
|
|
849
843
|
return new Date(Date.UTC(r, e, 0)).getUTCDate();
|
|
850
844
|
}
|
|
851
|
-
function
|
|
845
|
+
function B(r) {
|
|
852
846
|
return new Date(Date.UTC(r.y, r.m - 1, r.d));
|
|
853
847
|
}
|
|
854
|
-
function
|
|
848
|
+
function fe(r) {
|
|
855
849
|
return {
|
|
856
850
|
y: r.getUTCFullYear(),
|
|
857
851
|
m: r.getUTCMonth() + 1,
|
|
@@ -859,72 +853,65 @@ function ge(r) {
|
|
|
859
853
|
};
|
|
860
854
|
}
|
|
861
855
|
function w(r, e) {
|
|
862
|
-
const t = c(r),
|
|
863
|
-
return !t || !
|
|
856
|
+
const t = c(r), n = c(e);
|
|
857
|
+
return !t || !n ? r.localeCompare(e) : t.y !== n.y ? t.y - n.y : t.m !== n.m ? t.m - n.m : t.d - n.d;
|
|
864
858
|
}
|
|
865
859
|
function Fe(r, e) {
|
|
866
860
|
const t = c(r);
|
|
867
|
-
if (!t)
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
return a.setUTCDate(a.getUTCDate() + e), v(ge(a));
|
|
861
|
+
if (!t) return r;
|
|
862
|
+
const n = B(t);
|
|
863
|
+
return n.setUTCDate(n.getUTCDate() + e), v(fe(n));
|
|
871
864
|
}
|
|
872
|
-
function
|
|
865
|
+
function P(r, e) {
|
|
873
866
|
const t = new Date(Date.UTC(r.y, r.m - 1, 1));
|
|
874
867
|
t.setUTCMonth(t.getUTCMonth() + e);
|
|
875
|
-
const
|
|
876
|
-
return { y:
|
|
868
|
+
const n = t.getUTCFullYear(), a = t.getUTCMonth() + 1, i = O(r.d, 1, F(n, a));
|
|
869
|
+
return { y: n, m: a, d: i };
|
|
877
870
|
}
|
|
878
871
|
function He(r, e) {
|
|
879
872
|
const t = c(r);
|
|
880
|
-
return t ? v(
|
|
873
|
+
return t ? v(P(t, e)) : r;
|
|
881
874
|
}
|
|
882
875
|
function le(r, e) {
|
|
883
876
|
return { y: r, m: e, d: 1 };
|
|
884
877
|
}
|
|
885
878
|
function Ue(r, e) {
|
|
886
|
-
return { y: r, m: e, d:
|
|
879
|
+
return { y: r, m: e, d: F(r, e) };
|
|
887
880
|
}
|
|
888
|
-
function
|
|
881
|
+
function de(r) {
|
|
889
882
|
const e = c(r);
|
|
890
|
-
return e ?
|
|
883
|
+
return e ? B(e).getUTCDay() : 0;
|
|
891
884
|
}
|
|
892
|
-
function
|
|
893
|
-
if (r == null || r === "")
|
|
894
|
-
return e;
|
|
885
|
+
function K(r, e) {
|
|
886
|
+
if (r == null || r === "") return e;
|
|
895
887
|
const t = Number(r);
|
|
896
888
|
return Number.isFinite(t) ? Math.trunc(t) : e;
|
|
897
889
|
}
|
|
898
|
-
function
|
|
899
|
-
const t =
|
|
890
|
+
function ce(r, e) {
|
|
891
|
+
const t = K(r, e);
|
|
900
892
|
return t < 1 ? e : t;
|
|
901
893
|
}
|
|
902
894
|
function Ne(r, e) {
|
|
903
|
-
if (r == null)
|
|
904
|
-
return e;
|
|
895
|
+
if (r == null) return e;
|
|
905
896
|
const t = String(r).toLowerCase();
|
|
906
897
|
return t !== "false" && t !== "0" && t !== "off";
|
|
907
898
|
}
|
|
908
899
|
function m(r) {
|
|
909
900
|
return r.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
910
901
|
}
|
|
911
|
-
function
|
|
902
|
+
function q(r, e, t) {
|
|
912
903
|
return w(r, e) >= 0 && w(r, t) <= 0;
|
|
913
904
|
}
|
|
914
905
|
function E(r, e) {
|
|
915
906
|
return w(r, e) <= 0 ? { start: r, end: e } : { start: e, end: r };
|
|
916
907
|
}
|
|
917
|
-
function
|
|
918
|
-
var a;
|
|
908
|
+
function ue(r, e) {
|
|
919
909
|
const t = Number(r);
|
|
920
|
-
if (t === 0 || t === 1 || t === 6)
|
|
921
|
-
return t;
|
|
910
|
+
if (t === 0 || t === 1 || t === 6) return t;
|
|
922
911
|
try {
|
|
923
|
-
const
|
|
924
|
-
if (
|
|
925
|
-
|
|
926
|
-
if (i === 1 || i === 6)
|
|
927
|
-
return i;
|
|
912
|
+
const a = new Intl.Locale(e || void 0)?.weekInfo?.firstDay;
|
|
913
|
+
if (a === 7) return 0;
|
|
914
|
+
if (a === 1 || a === 6) return a;
|
|
928
915
|
} catch {
|
|
929
916
|
}
|
|
930
917
|
return 0;
|
|
@@ -944,23 +931,22 @@ function qe(r) {
|
|
|
944
931
|
function Ke(r) {
|
|
945
932
|
return r === "neutral" || r === "info" || r === "success" || r === "warning" || r === "danger" ? r : null;
|
|
946
933
|
}
|
|
947
|
-
function
|
|
934
|
+
function he(r) {
|
|
948
935
|
return r === "loading" || r === "error" || r === "success" ? r : "idle";
|
|
949
936
|
}
|
|
950
|
-
function
|
|
937
|
+
function pe(r) {
|
|
951
938
|
const e = [], t = /* @__PURE__ */ new Set();
|
|
952
|
-
return r.forEach((
|
|
953
|
-
const
|
|
954
|
-
if (!
|
|
955
|
-
|
|
956
|
-
const i = v(n);
|
|
939
|
+
return r.forEach((n) => {
|
|
940
|
+
const a = c(n);
|
|
941
|
+
if (!a) return;
|
|
942
|
+
const i = v(a);
|
|
957
943
|
t.has(i) || (t.add(i), e.push(i));
|
|
958
944
|
}), e.sort(w), e;
|
|
959
945
|
}
|
|
960
|
-
function
|
|
946
|
+
function $(r) {
|
|
961
947
|
return r.mode === "single" ? { mode: "single", value: r.value } : r.mode === "range" ? { mode: "range", start: r.start, end: r.end } : { mode: "multiple", values: [...r.values] };
|
|
962
948
|
}
|
|
963
|
-
class
|
|
949
|
+
class We extends Ae {
|
|
964
950
|
constructor() {
|
|
965
951
|
super(), this._eventsRawCache = null, this._eventsParsedCache = [], this._eventsByDateCache = /* @__PURE__ */ new Map(), this._valueRawCache = null, this._valueModeCache = null, this._valueParsedCache = { mode: "single", value: null }, this._focusedIso = "", this._hoverIso = null, this._pickerOpen = !1, this._syncingValueAttribute = !1, this._rangeKeyboardAnchor = null, this._shouldRefocus = !1, this._docPointerDownBound = (e) => this._onDocumentPointerDown(e), this._onClick = this._onClick.bind(this), this._onKeyDown = this._onKeyDown.bind(this), this._onPointerOver = this._onPointerOver.bind(this), this._onMouseLeave = this._onMouseLeave.bind(this), this._onFocusIn = this._onFocusIn.bind(this);
|
|
966
952
|
}
|
|
@@ -999,33 +985,32 @@ class Je extends Ae {
|
|
|
999
985
|
disconnectedCallback() {
|
|
1000
986
|
this.root.removeEventListener("click", this._onClick), this.root.removeEventListener("keydown", this._onKeyDown), this.root.removeEventListener("pointerover", this._onPointerOver), this.root.removeEventListener("mouseleave", this._onMouseLeave), this.root.removeEventListener("focusin", this._onFocusIn), typeof document < "u" && document.removeEventListener("pointerdown", this._docPointerDownBound, !0), super.disconnectedCallback();
|
|
1001
987
|
}
|
|
1002
|
-
attributeChangedCallback(e, t,
|
|
1003
|
-
t !==
|
|
988
|
+
attributeChangedCallback(e, t, n) {
|
|
989
|
+
t !== n && (e === "events" && (this._eventsRawCache = null), e === "value" && !this._syncingValueAttribute && (this._rangeKeyboardAnchor = null, this._valueRawCache = null), e === "selection" && (this._rangeKeyboardAnchor = null, this._valueModeCache = null), e === "disabled" && this.hasAttribute("disabled") && (this._pickerOpen = !1, this._hoverIso = null), e === "state" && he(n) === "loading" && (this._pickerOpen = !1, this._hoverIso = null), this.isConnected && (this._syncDocumentListener(), this.requestRender()));
|
|
1004
990
|
}
|
|
1005
991
|
focusDate(e) {
|
|
1006
992
|
const t = c(e);
|
|
1007
993
|
t && (this.goToMonth(t.y, t.m), this._focusedIso = v(t), this._shouldRefocus = !0, this.requestRender());
|
|
1008
994
|
}
|
|
1009
|
-
goToMonth(e, t,
|
|
1010
|
-
if (!Number.isFinite(e) || !Number.isFinite(t))
|
|
1011
|
-
|
|
1012
|
-
let n = Math.trunc(e), i = Math.trunc(t);
|
|
995
|
+
goToMonth(e, t, n = "api") {
|
|
996
|
+
if (!Number.isFinite(e) || !Number.isFinite(t)) return;
|
|
997
|
+
let a = Math.trunc(e), i = Math.trunc(t);
|
|
1013
998
|
for (; i < 1; )
|
|
1014
|
-
i += 12,
|
|
999
|
+
i += 12, a -= 1;
|
|
1015
1000
|
for (; i > 12; )
|
|
1016
|
-
i -= 12,
|
|
1001
|
+
i -= 12, a += 1;
|
|
1017
1002
|
let s = !1;
|
|
1018
|
-
if (String(
|
|
1019
|
-
const
|
|
1003
|
+
if (String(a) !== (this.getAttribute("year") || "") && (this.setAttribute("year", String(a)), s = !0), String(i) !== (this.getAttribute("month") || "") && (this.setAttribute("month", String(i)), s = !0), s) {
|
|
1004
|
+
const l = { year: a, month: i, source: n };
|
|
1020
1005
|
this.dispatchEvent(
|
|
1021
1006
|
new CustomEvent("month-change", {
|
|
1022
|
-
detail:
|
|
1007
|
+
detail: l,
|
|
1023
1008
|
bubbles: !0,
|
|
1024
1009
|
composed: !0
|
|
1025
1010
|
})
|
|
1026
1011
|
), this.dispatchEvent(
|
|
1027
1012
|
new CustomEvent("ui-month-change", {
|
|
1028
|
-
detail:
|
|
1013
|
+
detail: l,
|
|
1029
1014
|
bubbles: !0,
|
|
1030
1015
|
composed: !0
|
|
1031
1016
|
})
|
|
@@ -1034,10 +1019,9 @@ class Je extends Ae {
|
|
|
1034
1019
|
}
|
|
1035
1020
|
selectDate(e) {
|
|
1036
1021
|
const t = c(e);
|
|
1037
|
-
if (!t)
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
this._shouldRefocus = !0, this._applySelection(a, !1, "api");
|
|
1022
|
+
if (!t) return;
|
|
1023
|
+
const n = v(t);
|
|
1024
|
+
this._shouldRefocus = !0, this._applySelection(n, !1, "api");
|
|
1041
1025
|
}
|
|
1042
1026
|
_syncDocumentListener() {
|
|
1043
1027
|
typeof document > "u" || (document.removeEventListener("pointerdown", this._docPointerDownBound, !0), this._pickerOpen && document.addEventListener("pointerdown", this._docPointerDownBound, !0));
|
|
@@ -1049,15 +1033,15 @@ class Je extends Ae {
|
|
|
1049
1033
|
return (this.getAttribute("locale") || "").trim() || (typeof navigator < "u" ? navigator.language : "en-US");
|
|
1050
1034
|
}
|
|
1051
1035
|
_resolvedView() {
|
|
1052
|
-
const e = /* @__PURE__ */ new Date(), t =
|
|
1036
|
+
const e = /* @__PURE__ */ new Date(), t = K(this.getAttribute("year"), e.getFullYear()), n = K(this.getAttribute("month"), e.getMonth() + 1);
|
|
1053
1037
|
return {
|
|
1054
1038
|
year: t,
|
|
1055
|
-
month: O(
|
|
1039
|
+
month: O(n, 1, 12)
|
|
1056
1040
|
};
|
|
1057
1041
|
}
|
|
1058
1042
|
_todayIso() {
|
|
1059
1043
|
const e = /* @__PURE__ */ new Date();
|
|
1060
|
-
return `${e.getFullYear()}-${
|
|
1044
|
+
return `${e.getFullYear()}-${L(e.getMonth() + 1)}-${L(e.getDate())}`;
|
|
1061
1045
|
}
|
|
1062
1046
|
_resolveMinIso() {
|
|
1063
1047
|
const e = c(this.getAttribute("min") || "");
|
|
@@ -1067,9 +1051,9 @@ class Je extends Ae {
|
|
|
1067
1051
|
const e = c(this.getAttribute("max") || "");
|
|
1068
1052
|
return e ? v(e) : null;
|
|
1069
1053
|
}
|
|
1070
|
-
_monthHasAllowedDay(e, t,
|
|
1054
|
+
_monthHasAllowedDay(e, t, n, a) {
|
|
1071
1055
|
const i = v(le(e, t)), s = v(Ue(e, t));
|
|
1072
|
-
return !(
|
|
1056
|
+
return !(n && w(s, n) < 0 || a && w(i, a) > 0);
|
|
1073
1057
|
}
|
|
1074
1058
|
_resolveSelectionMode() {
|
|
1075
1059
|
return Ye(this.getAttribute("selection"));
|
|
@@ -1087,7 +1071,7 @@ class Je extends Ae {
|
|
|
1087
1071
|
return Ke(this.getAttribute("tone"));
|
|
1088
1072
|
}
|
|
1089
1073
|
_resolveState() {
|
|
1090
|
-
return
|
|
1074
|
+
return he(this.getAttribute("state"));
|
|
1091
1075
|
}
|
|
1092
1076
|
_resolveLabel() {
|
|
1093
1077
|
const e = (this.getAttribute("aria-label") || "").trim();
|
|
@@ -1102,23 +1086,22 @@ class Je extends Ae {
|
|
|
1102
1086
|
_resolveBounds() {
|
|
1103
1087
|
let e = this._resolveMinIso(), t = this._resolveMaxIso();
|
|
1104
1088
|
if (e && t && w(e, t) > 0) {
|
|
1105
|
-
const
|
|
1106
|
-
e = t, t =
|
|
1089
|
+
const n = e;
|
|
1090
|
+
e = t, t = n;
|
|
1107
1091
|
}
|
|
1108
1092
|
return { minIso: e, maxIso: t };
|
|
1109
1093
|
}
|
|
1110
1094
|
_direction() {
|
|
1111
1095
|
const e = this.getAttribute("dir");
|
|
1112
|
-
if (e === "rtl" || e === "ltr")
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
return a === "rtl" || a === "ltr" ? a : getComputedStyle(this).direction === "rtl" ? "rtl" : "ltr";
|
|
1096
|
+
if (e === "rtl" || e === "ltr") return e;
|
|
1097
|
+
const n = this.closest("[dir]")?.getAttribute("dir");
|
|
1098
|
+
return n === "rtl" || n === "ltr" ? n : getComputedStyle(this).direction === "rtl" ? "rtl" : "ltr";
|
|
1116
1099
|
}
|
|
1117
1100
|
_maxSelections() {
|
|
1118
|
-
return
|
|
1101
|
+
return ce(this.getAttribute("max-selections"), Number.MAX_SAFE_INTEGER);
|
|
1119
1102
|
}
|
|
1120
1103
|
_eventsMax() {
|
|
1121
|
-
return O(
|
|
1104
|
+
return O(ce(this.getAttribute("events-max"), 3), 1, 9);
|
|
1122
1105
|
}
|
|
1123
1106
|
_showTodayButton() {
|
|
1124
1107
|
return this.hasAttribute("hide-today") ? !1 : Ne(this.getAttribute("show-today"), !0);
|
|
@@ -1132,46 +1115,46 @@ class Je extends Ae {
|
|
|
1132
1115
|
_isInteractionDisabled() {
|
|
1133
1116
|
return this._isDisabled() || this._resolveState() === "loading";
|
|
1134
1117
|
}
|
|
1135
|
-
_isDateOutOfBounds(e, t,
|
|
1136
|
-
return !!(t && w(e, t) < 0 ||
|
|
1118
|
+
_isDateOutOfBounds(e, t, n) {
|
|
1119
|
+
return !!(t && w(e, t) < 0 || n && w(e, n) > 0);
|
|
1137
1120
|
}
|
|
1138
|
-
_isDateBlocked(e, t,
|
|
1139
|
-
return !!(this._isInteractionDisabled() || this._isDateOutOfBounds(e,
|
|
1121
|
+
_isDateBlocked(e, t, n, a) {
|
|
1122
|
+
return !!(this._isInteractionDisabled() || this._isDateOutOfBounds(e, n, a) || t && this._resolveOutsideClickMode() === "none");
|
|
1140
1123
|
}
|
|
1141
1124
|
_normalizeValueForMode(e) {
|
|
1142
1125
|
const t = this.getAttribute("value") || "";
|
|
1143
1126
|
if (this._valueRawCache === t && this._valueModeCache === e)
|
|
1144
|
-
return
|
|
1145
|
-
let
|
|
1127
|
+
return $(this._valueParsedCache);
|
|
1128
|
+
let n;
|
|
1146
1129
|
if (e === "multiple") {
|
|
1147
1130
|
try {
|
|
1148
1131
|
const i = JSON.parse(t);
|
|
1149
1132
|
if (!Array.isArray(i))
|
|
1150
|
-
|
|
1133
|
+
n = { mode: e, values: [] };
|
|
1151
1134
|
else {
|
|
1152
|
-
const s =
|
|
1153
|
-
|
|
1135
|
+
const s = pe(i.map((l) => String(l || "")));
|
|
1136
|
+
n = { mode: e, values: s };
|
|
1154
1137
|
}
|
|
1155
1138
|
} catch {
|
|
1156
|
-
|
|
1139
|
+
n = { mode: e, values: [] };
|
|
1157
1140
|
}
|
|
1158
|
-
return this._valueRawCache = t, this._valueModeCache = e, this._valueParsedCache =
|
|
1141
|
+
return this._valueRawCache = t, this._valueModeCache = e, this._valueParsedCache = $(n), n;
|
|
1159
1142
|
}
|
|
1160
1143
|
if (e === "range") {
|
|
1161
1144
|
try {
|
|
1162
|
-
const i = JSON.parse(t), s = i && typeof i == "object" ? String(i.start || "") : "",
|
|
1163
|
-
if (h &&
|
|
1164
|
-
const f = E(h,
|
|
1165
|
-
|
|
1145
|
+
const i = JSON.parse(t), s = i && typeof i == "object" ? String(i.start || "") : "", l = i && typeof i == "object" ? String(i.end || "") : "", o = c(s), p = c(l), h = o ? v(o) : null, u = p ? v(p) : null;
|
|
1146
|
+
if (h && u) {
|
|
1147
|
+
const f = E(h, u);
|
|
1148
|
+
n = { mode: e, start: f.start, end: f.end };
|
|
1166
1149
|
} else
|
|
1167
|
-
|
|
1150
|
+
n = { mode: e, start: h, end: null };
|
|
1168
1151
|
} catch {
|
|
1169
|
-
|
|
1152
|
+
n = { mode: e, start: null, end: null };
|
|
1170
1153
|
}
|
|
1171
|
-
return this._valueRawCache = t, this._valueModeCache = e, this._valueParsedCache =
|
|
1154
|
+
return this._valueRawCache = t, this._valueModeCache = e, this._valueParsedCache = $(n), n;
|
|
1172
1155
|
}
|
|
1173
|
-
const
|
|
1174
|
-
return
|
|
1156
|
+
const a = c(t);
|
|
1157
|
+
return n = { mode: e, value: a ? v(a) : null }, this._valueRawCache = t, this._valueModeCache = e, this._valueParsedCache = $(n), n;
|
|
1175
1158
|
}
|
|
1176
1159
|
_serializeSelection(e) {
|
|
1177
1160
|
if (e.mode === "single")
|
|
@@ -1181,30 +1164,30 @@ class Je extends Ae {
|
|
|
1181
1164
|
const t = {};
|
|
1182
1165
|
return e.start && (t.start = e.start), e.end && (t.end = e.end), !t.start && !t.end ? null : JSON.stringify(t);
|
|
1183
1166
|
}
|
|
1184
|
-
_emitSelectionEvents(e, t,
|
|
1167
|
+
_emitSelectionEvents(e, t, n) {
|
|
1185
1168
|
e.mode === "single" && t && (this.dispatchEvent(
|
|
1186
1169
|
new CustomEvent("select", {
|
|
1187
|
-
detail: { value: t, source:
|
|
1170
|
+
detail: { value: t, source: n },
|
|
1188
1171
|
bubbles: !0,
|
|
1189
1172
|
composed: !0
|
|
1190
1173
|
})
|
|
1191
1174
|
), this.dispatchEvent(
|
|
1192
1175
|
new CustomEvent("ui-select", {
|
|
1193
|
-
detail: { value: t, source:
|
|
1176
|
+
detail: { value: t, source: n },
|
|
1194
1177
|
bubbles: !0,
|
|
1195
1178
|
composed: !0
|
|
1196
1179
|
})
|
|
1197
1180
|
));
|
|
1198
|
-
const
|
|
1199
|
-
e.mode === "single" ?
|
|
1181
|
+
const a = { mode: e.mode, source: n };
|
|
1182
|
+
e.mode === "single" ? a.value = e.value : e.mode === "range" ? (a.value = e.start && e.end ? { start: e.start, end: e.end } : null, a.start = e.start, a.end = e.end) : (a.value = [...e.values], a.values = [...e.values]), this.dispatchEvent(
|
|
1200
1183
|
new CustomEvent("change", {
|
|
1201
|
-
detail:
|
|
1184
|
+
detail: a,
|
|
1202
1185
|
bubbles: !0,
|
|
1203
1186
|
composed: !0
|
|
1204
1187
|
})
|
|
1205
1188
|
), this.dispatchEvent(
|
|
1206
1189
|
new CustomEvent("ui-change", {
|
|
1207
|
-
detail:
|
|
1190
|
+
detail: a,
|
|
1208
1191
|
bubbles: !0,
|
|
1209
1192
|
composed: !0
|
|
1210
1193
|
})
|
|
@@ -1218,44 +1201,41 @@ class Je extends Ae {
|
|
|
1218
1201
|
this._syncingValueAttribute = !1;
|
|
1219
1202
|
}
|
|
1220
1203
|
}
|
|
1221
|
-
_applySelection(e, t,
|
|
1222
|
-
if (!c(e))
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
if (
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
else if (n === "multiple") {
|
|
1234
|
-
const p = this._normalizeValueForMode("multiple"), f = new Set(p.values);
|
|
1235
|
-
f.has(e) ? f.delete(e) : f.size < this._maxSelections() && f.add(e), d = { mode: n, values: fe(Array.from(f)) };
|
|
1204
|
+
_applySelection(e, t, n) {
|
|
1205
|
+
if (!c(e)) return;
|
|
1206
|
+
const a = this._resolveSelectionMode(), { minIso: i, maxIso: s } = this._resolveBounds();
|
|
1207
|
+
if (this._isDateOutOfBounds(e, i, s)) return;
|
|
1208
|
+
const l = this._isReadonly();
|
|
1209
|
+
if (this._isInteractionDisabled() || l) return;
|
|
1210
|
+
let o = this._normalizeValueForMode(a);
|
|
1211
|
+
if (a === "single")
|
|
1212
|
+
o = { mode: a, value: e };
|
|
1213
|
+
else if (a === "multiple") {
|
|
1214
|
+
const u = this._normalizeValueForMode("multiple"), f = new Set(u.values);
|
|
1215
|
+
f.has(e) ? f.delete(e) : f.size < this._maxSelections() && f.add(e), o = { mode: a, values: pe(Array.from(f)) };
|
|
1236
1216
|
} else {
|
|
1237
|
-
const
|
|
1217
|
+
const u = this._normalizeValueForMode("range"), f = u.start, _ = u.end;
|
|
1238
1218
|
if (t) {
|
|
1239
|
-
const
|
|
1240
|
-
if (!c(
|
|
1241
|
-
this._rangeKeyboardAnchor = e,
|
|
1219
|
+
const d = this._rangeKeyboardAnchor || f || this._focusedIso || e;
|
|
1220
|
+
if (!c(d))
|
|
1221
|
+
this._rangeKeyboardAnchor = e, o = { mode: a, start: e, end: null };
|
|
1242
1222
|
else {
|
|
1243
|
-
const b = E(
|
|
1244
|
-
|
|
1223
|
+
const b = E(d, e);
|
|
1224
|
+
o = { mode: a, start: b.start, end: b.end };
|
|
1245
1225
|
}
|
|
1246
1226
|
} else if (!f || f && _)
|
|
1247
|
-
this._rangeKeyboardAnchor = e,
|
|
1227
|
+
this._rangeKeyboardAnchor = e, o = { mode: a, start: e, end: null };
|
|
1248
1228
|
else if (f && !_) {
|
|
1249
|
-
const
|
|
1250
|
-
|
|
1229
|
+
const d = E(f, e);
|
|
1230
|
+
o = { mode: a, start: d.start, end: d.end };
|
|
1251
1231
|
}
|
|
1252
1232
|
}
|
|
1253
|
-
const
|
|
1254
|
-
|
|
1233
|
+
const p = this.getAttribute("value"), h = this._serializeSelection(o);
|
|
1234
|
+
p !== h ? (this._setValueAttribute(h), this._emitSelectionEvents(o, a === "single" ? e : null, n)) : a === "single" && this._emitSelectionEvents(o, e, n), this._focusedIso = e, this._hoverIso = null, this._shouldRefocus = !0, n !== "api" && this.requestRender();
|
|
1255
1235
|
}
|
|
1256
|
-
_monthLabel(e, t,
|
|
1236
|
+
_monthLabel(e, t, n) {
|
|
1257
1237
|
try {
|
|
1258
|
-
return new Intl.DateTimeFormat(
|
|
1238
|
+
return new Intl.DateTimeFormat(n, {
|
|
1259
1239
|
month: "long",
|
|
1260
1240
|
year: "numeric",
|
|
1261
1241
|
timeZone: "UTC"
|
|
@@ -1270,23 +1250,22 @@ class Je extends Ae {
|
|
|
1270
1250
|
month: "short",
|
|
1271
1251
|
timeZone: "UTC"
|
|
1272
1252
|
});
|
|
1273
|
-
return Array.from({ length: 12 }, (
|
|
1253
|
+
return Array.from({ length: 12 }, (n, a) => t.format(new Date(Date.UTC(2024, a, 1))));
|
|
1274
1254
|
} catch {
|
|
1275
1255
|
return ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
1276
1256
|
}
|
|
1277
1257
|
}
|
|
1278
1258
|
_weekdayLabels(e, t) {
|
|
1279
|
-
const
|
|
1259
|
+
const n = [], a = new Intl.DateTimeFormat(e, { weekday: "short", timeZone: "UTC" });
|
|
1280
1260
|
for (let i = 0; i < 7; i += 1) {
|
|
1281
|
-
const s = (t + i) % 7,
|
|
1282
|
-
|
|
1261
|
+
const s = (t + i) % 7, l = new Date(Date.UTC(2024, 0, 7 + s));
|
|
1262
|
+
n.push(a.format(l));
|
|
1283
1263
|
}
|
|
1284
|
-
return
|
|
1264
|
+
return n;
|
|
1285
1265
|
}
|
|
1286
1266
|
_dayAriaLabel(e, t) {
|
|
1287
|
-
const
|
|
1288
|
-
if (!
|
|
1289
|
-
return e;
|
|
1267
|
+
const n = c(e);
|
|
1268
|
+
if (!n) return e;
|
|
1290
1269
|
try {
|
|
1291
1270
|
return new Intl.DateTimeFormat(t, {
|
|
1292
1271
|
weekday: "long",
|
|
@@ -1294,7 +1273,7 @@ class Je extends Ae {
|
|
|
1294
1273
|
month: "long",
|
|
1295
1274
|
day: "numeric",
|
|
1296
1275
|
timeZone: "UTC"
|
|
1297
|
-
}).format(
|
|
1276
|
+
}).format(B(n));
|
|
1298
1277
|
} catch {
|
|
1299
1278
|
return e;
|
|
1300
1279
|
}
|
|
@@ -1304,36 +1283,32 @@ class Je extends Ae {
|
|
|
1304
1283
|
if (e !== this._eventsRawCache && (this._eventsRawCache = e, this._eventsParsedCache = [], this._eventsByDateCache = /* @__PURE__ */ new Map(), !!e))
|
|
1305
1284
|
try {
|
|
1306
1285
|
const t = JSON.parse(e);
|
|
1307
|
-
if (!Array.isArray(t))
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
const
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
a.push({ date: o, title: h, tone: u });
|
|
1318
|
-
}), this._eventsParsedCache = a, a.forEach((n) => {
|
|
1319
|
-
this._eventsByDateCache.has(n.date) || this._eventsByDateCache.set(n.date, []), this._eventsByDateCache.get(n.date).push(n);
|
|
1286
|
+
if (!Array.isArray(t)) return;
|
|
1287
|
+
const n = [];
|
|
1288
|
+
t.forEach((a) => {
|
|
1289
|
+
if (!a || typeof a != "object") return;
|
|
1290
|
+
const i = String(a.date || "").trim(), s = c(i), l = s ? v(s) : "";
|
|
1291
|
+
if (!l) return;
|
|
1292
|
+
const o = String(a.tone || "default"), p = o === "success" || o === "warning" || o === "danger" || o === "info" ? o : "default", h = a.title != null ? String(a.title) : void 0;
|
|
1293
|
+
n.push({ date: l, title: h, tone: p });
|
|
1294
|
+
}), this._eventsParsedCache = n, n.forEach((a) => {
|
|
1295
|
+
this._eventsByDateCache.has(a.date) || this._eventsByDateCache.set(a.date, []), this._eventsByDateCache.get(a.date).push(a);
|
|
1320
1296
|
});
|
|
1321
1297
|
} catch {
|
|
1322
1298
|
}
|
|
1323
1299
|
}
|
|
1324
|
-
_buildCells(e, t,
|
|
1325
|
-
const
|
|
1326
|
-
if (!h)
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
p.setUTCDate(p.getUTCDate() - u);
|
|
1300
|
+
_buildCells(e, t, n, a, i, s) {
|
|
1301
|
+
const l = v(le(e, t)), p = (de(l) - n + 7) % 7, h = c(l);
|
|
1302
|
+
if (!h) return [];
|
|
1303
|
+
const u = B(h);
|
|
1304
|
+
u.setUTCDate(u.getUTCDate() - p);
|
|
1330
1305
|
const f = [];
|
|
1331
1306
|
for (let _ = 0; _ < 42; _ += 1) {
|
|
1332
|
-
_ > 0 &&
|
|
1333
|
-
const
|
|
1307
|
+
_ > 0 && u.setUTCDate(u.getUTCDate() + 1);
|
|
1308
|
+
const d = fe(u), b = v(d), D = d.y !== e || d.m !== t, y = this._isDateBlocked(b, D, a, i);
|
|
1334
1309
|
f.push({
|
|
1335
1310
|
iso: b,
|
|
1336
|
-
parts:
|
|
1311
|
+
parts: d,
|
|
1337
1312
|
outside: D,
|
|
1338
1313
|
disabled: y,
|
|
1339
1314
|
today: b === s
|
|
@@ -1341,74 +1316,62 @@ class Je extends Ae {
|
|
|
1341
1316
|
}
|
|
1342
1317
|
return f;
|
|
1343
1318
|
}
|
|
1344
|
-
_resolveFocusIso(e, t,
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
const h = n.get(u);
|
|
1352
|
-
return !h || h.disabled ? null : u;
|
|
1319
|
+
_resolveFocusIso(e, t, n) {
|
|
1320
|
+
const a = /* @__PURE__ */ new Map();
|
|
1321
|
+
e.forEach((o) => a.set(o.iso, o));
|
|
1322
|
+
const i = (o) => {
|
|
1323
|
+
if (!o) return null;
|
|
1324
|
+
const p = a.get(o);
|
|
1325
|
+
return !p || p.disabled ? null : o;
|
|
1353
1326
|
};
|
|
1354
1327
|
let s = i(this._focusedIso);
|
|
1355
|
-
if (s || (t.mode === "single" && (s = i(t.value)), !s && t.mode === "range" && (s = i(t.end || t.start)), !s && t.mode === "multiple" && (s = i(t.values[0])), s || (s = i(
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
return o ? o.iso : ((d = e[0]) == null ? void 0 : d.iso) || "";
|
|
1328
|
+
if (s || (t.mode === "single" && (s = i(t.value)), !s && t.mode === "range" && (s = i(t.end || t.start)), !s && t.mode === "multiple" && (s = i(t.values[0])), s || (s = i(n)), s)) return s;
|
|
1329
|
+
const l = e.find((o) => !o.disabled);
|
|
1330
|
+
return l ? l.iso : e[0]?.iso || "";
|
|
1359
1331
|
}
|
|
1360
1332
|
_focusDateButton(e) {
|
|
1361
|
-
if (!e)
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
if ((t == null ? void 0 : t.getAttribute("data-date")) === e)
|
|
1365
|
-
return;
|
|
1366
|
-
const a = `.day[data-date="${e}"]`, n = this.root.querySelector(a);
|
|
1367
|
-
if (n)
|
|
1333
|
+
if (!e || this.root.activeElement?.getAttribute("data-date") === e) return;
|
|
1334
|
+
const n = `.day[data-date="${e}"]`, a = this.root.querySelector(n);
|
|
1335
|
+
if (a)
|
|
1368
1336
|
try {
|
|
1369
|
-
|
|
1337
|
+
a.focus({ preventScroll: !0 });
|
|
1370
1338
|
} catch {
|
|
1371
|
-
|
|
1339
|
+
a.focus();
|
|
1372
1340
|
}
|
|
1373
1341
|
}
|
|
1374
|
-
_moveFocusByDays(e, t,
|
|
1375
|
-
const
|
|
1376
|
-
i && (this.goToMonth(i.y, i.m, "keyboard"), this._focusedIso =
|
|
1342
|
+
_moveFocusByDays(e, t, n) {
|
|
1343
|
+
const a = Fe(e, t), i = c(a);
|
|
1344
|
+
i && (this.goToMonth(i.y, i.m, "keyboard"), this._focusedIso = a, this._shouldRefocus = !0, n && this._resolveSelectionMode() === "range" && !this._isReadonly() && !this._isInteractionDisabled() ? this._applySelection(a, !0, "keyboard") : this.requestRender());
|
|
1377
1345
|
}
|
|
1378
1346
|
_moveFocusByMonths(e, t) {
|
|
1379
|
-
const
|
|
1380
|
-
|
|
1347
|
+
const n = He(e, t), a = c(n);
|
|
1348
|
+
a && (this.goToMonth(a.y, a.m, "keyboard"), this._focusedIso = n, this._shouldRefocus = !0, this.requestRender());
|
|
1381
1349
|
}
|
|
1382
|
-
_focusWeekBoundary(e, t,
|
|
1383
|
-
const i = (
|
|
1350
|
+
_focusWeekBoundary(e, t, n) {
|
|
1351
|
+
const i = (de(e) - n + 7) % 7, s = t === "start" ? -i : 6 - i;
|
|
1384
1352
|
this._moveFocusByDays(e, s, !1);
|
|
1385
1353
|
}
|
|
1386
1354
|
_onPointerOver(e) {
|
|
1387
|
-
if (this._resolveSelectionMode() !== "range")
|
|
1388
|
-
return;
|
|
1355
|
+
if (this._resolveSelectionMode() !== "range") return;
|
|
1389
1356
|
const t = this._normalizeValueForMode("range");
|
|
1390
|
-
if (!t.start || t.end)
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
const
|
|
1396
|
-
|
|
1397
|
-
return;
|
|
1398
|
-
const s = n.getAttribute("data-outside") === "true", { minIso: o, maxIso: d } = this._resolveBounds();
|
|
1399
|
-
this._isDateBlocked(i, s, o, d) || this._hoverIso !== i && (this._hoverIso = i, this.requestRender());
|
|
1357
|
+
if (!t.start || t.end) return;
|
|
1358
|
+
const a = e.target?.closest(".day");
|
|
1359
|
+
if (!a) return;
|
|
1360
|
+
const i = a.getAttribute("data-date") || "";
|
|
1361
|
+
if (!c(i)) return;
|
|
1362
|
+
const s = a.getAttribute("data-outside") === "true", { minIso: l, maxIso: o } = this._resolveBounds();
|
|
1363
|
+
this._isDateBlocked(i, s, l, o) || this._hoverIso !== i && (this._hoverIso = i, this.requestRender());
|
|
1400
1364
|
}
|
|
1401
1365
|
_onMouseLeave() {
|
|
1402
1366
|
this._hoverIso != null && (this._hoverIso = null, this.requestRender());
|
|
1403
1367
|
}
|
|
1404
1368
|
_onFocusIn(e) {
|
|
1405
|
-
const
|
|
1406
|
-
if (!
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
if (c(n) && (this._focusedIso = n, this._resolveSelectionMode() === "range")) {
|
|
1369
|
+
const n = e.target?.closest(".day");
|
|
1370
|
+
if (!n) return;
|
|
1371
|
+
const a = n.getAttribute("data-date") || "";
|
|
1372
|
+
if (c(a) && (this._focusedIso = a, this._resolveSelectionMode() === "range")) {
|
|
1410
1373
|
const i = this._normalizeValueForMode("range");
|
|
1411
|
-
i.start && !i.end && (this._hoverIso =
|
|
1374
|
+
i.start && !i.end && (this._hoverIso = a, this.requestRender());
|
|
1412
1375
|
}
|
|
1413
1376
|
}
|
|
1414
1377
|
_toggleMonthYearPicker(e) {
|
|
@@ -1416,55 +1379,46 @@ class Je extends Ae {
|
|
|
1416
1379
|
}
|
|
1417
1380
|
_onClick(e) {
|
|
1418
1381
|
const t = e.target;
|
|
1419
|
-
if (!t)
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
const l = n === "prev-month" ? -1 : 1, D = (this._focusedIso ? c(this._focusedIso) : null) || { y: i, m: s, d: 1 }, y = L(D, l);
|
|
1426
|
-
this.goToMonth(y.y, y.m, "pointer"), this._focusedIso = v({ y: y.y, m: y.m, d: O(D.d, 1, H(y.y, y.m)) }), this._shouldRefocus = !0, this.requestRender();
|
|
1382
|
+
if (!t) return;
|
|
1383
|
+
const n = t.closest("[data-action]"), a = n?.getAttribute("data-action") || "", { year: i, month: s } = this._resolvedView(), l = this._todayIso(), o = c(l);
|
|
1384
|
+
if (a === "prev-month" || a === "next-month") {
|
|
1385
|
+
if (this._isInteractionDisabled()) return;
|
|
1386
|
+
const d = a === "prev-month" ? -1 : 1, D = (this._focusedIso ? c(this._focusedIso) : null) || { y: i, m: s, d: 1 }, y = P(D, d);
|
|
1387
|
+
this.goToMonth(y.y, y.m, "pointer"), this._focusedIso = v({ y: y.y, m: y.m, d: O(D.d, 1, F(y.y, y.m)) }), this._shouldRefocus = !0, this.requestRender();
|
|
1427
1388
|
return;
|
|
1428
1389
|
}
|
|
1429
|
-
if (
|
|
1430
|
-
if (this._isInteractionDisabled())
|
|
1431
|
-
|
|
1432
|
-
this.goToMonth(d.y, d.m, "pointer"), this._focusedIso = o, this._shouldRefocus = !0, this._isReadonly() ? this.requestRender() : this._applySelection(o, !1, "pointer");
|
|
1390
|
+
if (a === "today") {
|
|
1391
|
+
if (this._isInteractionDisabled()) return;
|
|
1392
|
+
this.goToMonth(o.y, o.m, "pointer"), this._focusedIso = l, this._shouldRefocus = !0, this._isReadonly() ? this.requestRender() : this._applySelection(l, !1, "pointer");
|
|
1433
1393
|
return;
|
|
1434
1394
|
}
|
|
1435
|
-
if (
|
|
1395
|
+
if (a === "toggle-monthyear") {
|
|
1436
1396
|
this._toggleMonthYearPicker();
|
|
1437
1397
|
return;
|
|
1438
1398
|
}
|
|
1439
|
-
if (
|
|
1440
|
-
if (this._isInteractionDisabled())
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
this.goToMonth(i + l, s, "pointer"), this._pickerOpen = !0, this._shouldRefocus = !0, this.requestRender();
|
|
1399
|
+
if (a === "picker-prev-year" || a === "picker-next-year") {
|
|
1400
|
+
if (this._isInteractionDisabled()) return;
|
|
1401
|
+
const d = a === "picker-prev-year" ? -1 : 1;
|
|
1402
|
+
this.goToMonth(i + d, s, "pointer"), this._pickerOpen = !0, this._shouldRefocus = !0, this.requestRender();
|
|
1444
1403
|
return;
|
|
1445
1404
|
}
|
|
1446
|
-
if (
|
|
1447
|
-
if (this._isInteractionDisabled())
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
return;
|
|
1452
|
-
this.goToMonth(i, l, "pointer"), this._pickerOpen = !1, this._shouldRefocus = !0, this.requestRender();
|
|
1405
|
+
if (a === "pick-month") {
|
|
1406
|
+
if (this._isInteractionDisabled()) return;
|
|
1407
|
+
const d = Number(n?.getAttribute("data-month") || "");
|
|
1408
|
+
if (!Number.isInteger(d) || d < 1 || d > 12) return;
|
|
1409
|
+
this.goToMonth(i, d, "pointer"), this._pickerOpen = !1, this._shouldRefocus = !0, this.requestRender();
|
|
1453
1410
|
return;
|
|
1454
1411
|
}
|
|
1455
|
-
const
|
|
1456
|
-
if (!
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
if (l === "none")
|
|
1466
|
-
return;
|
|
1467
|
-
if (l === "navigate") {
|
|
1412
|
+
const p = t.closest(".day");
|
|
1413
|
+
if (!p) return;
|
|
1414
|
+
const h = p.getAttribute("data-date") || "";
|
|
1415
|
+
if (!c(h)) return;
|
|
1416
|
+
const u = p.getAttribute("data-outside") === "true", { minIso: f, maxIso: _ } = this._resolveBounds();
|
|
1417
|
+
if (!this._isDateBlocked(h, u, f, _)) {
|
|
1418
|
+
if (u) {
|
|
1419
|
+
const d = this._resolveOutsideClickMode();
|
|
1420
|
+
if (d === "none") return;
|
|
1421
|
+
if (d === "navigate") {
|
|
1468
1422
|
const b = c(h);
|
|
1469
1423
|
this.goToMonth(b.y, b.m, "pointer");
|
|
1470
1424
|
}
|
|
@@ -1481,101 +1435,98 @@ class Je extends Ae {
|
|
|
1481
1435
|
e.preventDefault(), this._toggleMonthYearPicker(!1);
|
|
1482
1436
|
return;
|
|
1483
1437
|
}
|
|
1484
|
-
const
|
|
1485
|
-
if (!
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
return;
|
|
1490
|
-
const i = he(this.getAttribute("week-start"), this._resolveLocale()), s = this._direction() === "rtl", o = e.shiftKey;
|
|
1438
|
+
const n = e.target?.closest(".day");
|
|
1439
|
+
if (!n) return;
|
|
1440
|
+
const a = n.getAttribute("data-date") || "";
|
|
1441
|
+
if (!c(a)) return;
|
|
1442
|
+
const i = ue(this.getAttribute("week-start"), this._resolveLocale()), s = this._direction() === "rtl", l = e.shiftKey;
|
|
1491
1443
|
if (e.key === "ArrowRight") {
|
|
1492
|
-
e.preventDefault(), this._moveFocusByDays(
|
|
1444
|
+
e.preventDefault(), this._moveFocusByDays(a, s ? -1 : 1, l);
|
|
1493
1445
|
return;
|
|
1494
1446
|
}
|
|
1495
1447
|
if (e.key === "ArrowLeft") {
|
|
1496
|
-
e.preventDefault(), this._moveFocusByDays(
|
|
1448
|
+
e.preventDefault(), this._moveFocusByDays(a, s ? 1 : -1, l);
|
|
1497
1449
|
return;
|
|
1498
1450
|
}
|
|
1499
1451
|
if (e.key === "ArrowDown") {
|
|
1500
|
-
e.preventDefault(), this._moveFocusByDays(
|
|
1452
|
+
e.preventDefault(), this._moveFocusByDays(a, 7, l);
|
|
1501
1453
|
return;
|
|
1502
1454
|
}
|
|
1503
1455
|
if (e.key === "ArrowUp") {
|
|
1504
|
-
e.preventDefault(), this._moveFocusByDays(
|
|
1456
|
+
e.preventDefault(), this._moveFocusByDays(a, -7, l);
|
|
1505
1457
|
return;
|
|
1506
1458
|
}
|
|
1507
1459
|
if (e.key === "Home") {
|
|
1508
|
-
e.preventDefault(), this._focusWeekBoundary(
|
|
1460
|
+
e.preventDefault(), this._focusWeekBoundary(a, "start", i);
|
|
1509
1461
|
return;
|
|
1510
1462
|
}
|
|
1511
1463
|
if (e.key === "End") {
|
|
1512
|
-
e.preventDefault(), this._focusWeekBoundary(
|
|
1464
|
+
e.preventDefault(), this._focusWeekBoundary(a, "end", i);
|
|
1513
1465
|
return;
|
|
1514
1466
|
}
|
|
1515
1467
|
if (e.key === "PageUp") {
|
|
1516
|
-
e.preventDefault(), this._moveFocusByMonths(
|
|
1468
|
+
e.preventDefault(), this._moveFocusByMonths(a, e.shiftKey ? -12 : -1);
|
|
1517
1469
|
return;
|
|
1518
1470
|
}
|
|
1519
1471
|
if (e.key === "PageDown") {
|
|
1520
|
-
e.preventDefault(), this._moveFocusByMonths(
|
|
1472
|
+
e.preventDefault(), this._moveFocusByMonths(a, e.shiftKey ? 12 : 1);
|
|
1521
1473
|
return;
|
|
1522
1474
|
}
|
|
1523
1475
|
if (e.key === "Enter" || e.key === " ") {
|
|
1524
1476
|
e.preventDefault();
|
|
1525
|
-
const
|
|
1526
|
-
if (this._isDateBlocked(
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
this.goToMonth(p.y, p.m, "keyboard");
|
|
1477
|
+
const o = n.getAttribute("data-outside") === "true", { minIso: p, maxIso: h } = this._resolveBounds();
|
|
1478
|
+
if (this._isDateBlocked(a, o, p, h)) return;
|
|
1479
|
+
if (o && this._resolveOutsideClickMode() === "navigate") {
|
|
1480
|
+
const u = c(a);
|
|
1481
|
+
this.goToMonth(u.y, u.m, "keyboard");
|
|
1531
1482
|
}
|
|
1532
|
-
this._isReadonly() || this._applySelection(
|
|
1483
|
+
this._isReadonly() || this._applySelection(a, !1, "keyboard");
|
|
1533
1484
|
}
|
|
1534
1485
|
}
|
|
1535
1486
|
render() {
|
|
1536
|
-
const e = this._resolveLocale(), t = this._translations(),
|
|
1537
|
-
_ ? this.setAttribute("tone", _) : this.removeAttribute("tone"),
|
|
1538
|
-
const y = this._normalizeValueForMode(s),
|
|
1539
|
-
this._focusedIso = this._resolveFocusIso(
|
|
1540
|
-
const
|
|
1541
|
-
let
|
|
1487
|
+
const e = this._resolveLocale(), t = this._translations(), n = ue(this.getAttribute("week-start"), e), { year: a, month: i } = this._resolvedView(), s = this._resolveSelectionMode(), { minIso: l, maxIso: o } = this._resolveBounds(), p = this._todayIso(), h = this._resolveEventsDisplay(), u = this._eventsMax(), f = this._resolveCalendarSize(), _ = this._resolveTone(), d = this._resolveState(), b = this._isInteractionDisabled(), D = this._resolveLabel();
|
|
1488
|
+
_ ? this.setAttribute("tone", _) : this.removeAttribute("tone"), d !== "idle" ? this.setAttribute("state", d) : this.removeAttribute("state"), d === "loading" ? this.setAttribute("aria-busy", "true") : this.removeAttribute("aria-busy"), this._ensureEventsCache();
|
|
1489
|
+
const y = this._normalizeValueForMode(s), W = this._buildCells(a, i, n, l, o, p);
|
|
1490
|
+
this._focusedIso = this._resolveFocusIso(W, y, p);
|
|
1491
|
+
const J = this._monthLabel(a, i, e), Z = P({ y: a, m: i, d: 1 }, -1), X = P({ y: a, m: i, d: 1 }, 1), ge = this._monthHasAllowedDay(Z.y, Z.m, l, o), be = this._monthHasAllowedDay(X.y, X.m, l, o), ve = this._weekdayLabels(e, n), G = s === "range" ? y : null, S = G?.start || null, M = G?.end || null, me = s === "multiple" ? new Set(y.values) : null;
|
|
1492
|
+
let H = null, U = null;
|
|
1542
1493
|
if (s === "range" && S && !M && this._hoverIso && c(this._hoverIso)) {
|
|
1543
1494
|
const x = E(S, this._hoverIso);
|
|
1544
|
-
|
|
1495
|
+
H = x.start, U = x.end;
|
|
1545
1496
|
}
|
|
1546
|
-
const
|
|
1497
|
+
const Q = [];
|
|
1547
1498
|
for (let x = 0; x < 6; x += 1) {
|
|
1548
|
-
const
|
|
1499
|
+
const I = W.slice(x * 7, x * 7 + 7).map((g) => {
|
|
1549
1500
|
const k = this._eventsByDateCache.get(g.iso) || [], De = this._dayAriaLabel(g.iso, e);
|
|
1550
|
-
let
|
|
1551
|
-
s === "single" ?
|
|
1552
|
-
const
|
|
1553
|
-
let
|
|
1554
|
-
k.length > 0 && (h === "count" ?
|
|
1555
|
-
const
|
|
1556
|
-
return `<span class="event-badge" part="event-dot" style="--event-tone:${
|
|
1557
|
-
}).join("") :
|
|
1558
|
-
const
|
|
1501
|
+
let A = !1;
|
|
1502
|
+
s === "single" ? A = y.value === g.iso : s === "multiple" ? A = me?.has(g.iso) || !1 : S && M && (A = q(g.iso, S, M));
|
|
1503
|
+
const T = !!(S && M && q(g.iso, S, M)), N = !!(S && g.iso === S), Y = !!(M && g.iso === M), Se = !!(H && U && q(g.iso, H, U)), Me = !g.disabled && g.iso === this._focusedIso ? 0 : -1;
|
|
1504
|
+
let C = "";
|
|
1505
|
+
k.length > 0 && (h === "count" ? C = `<span class="event-count" part="event-more" style="--event-tone:${V[k[0].tone || "default"]}">${k.length}</span>` : h === "badges" ? C = k.slice(0, u).map((z) => {
|
|
1506
|
+
const j = m(z.title || t.event);
|
|
1507
|
+
return `<span class="event-badge" part="event-dot" style="--event-tone:${V[z.tone || "default"]}" title="${j}">${j}</span>`;
|
|
1508
|
+
}).join("") : C = k.slice(0, u).map((z) => `<span class="event-dot" part="event-dot" style="--event-tone:${V[z.tone || "default"]}"></span>`).join(""), k.length > u && h !== "count" && (C += `<span class="event-more" part="event-more">+${k.length - u}</span>`));
|
|
1509
|
+
const ae = `ui-calendar-tip-${g.iso}`, ne = k.length ? k.map((R) => m(R.title || t.event)).join("<br/>") : "", re = ne.length > 0, Ce = C ? `<span class="events" part="events">${C}</span>` : "", Ie = re ? `<span class="tooltip" part="tooltip" id="${ae}">${ne}</span>` : "", ie = A || T || N || Y;
|
|
1559
1510
|
return `
|
|
1560
1511
|
<button
|
|
1561
1512
|
type="button"
|
|
1562
1513
|
class="day"
|
|
1563
|
-
part="${
|
|
1514
|
+
part="${T || N || Y ? "day range" : "day"}"
|
|
1564
1515
|
role="gridcell"
|
|
1565
1516
|
data-date="${g.iso}"
|
|
1566
1517
|
data-outside="${g.outside ? "true" : "false"}"
|
|
1567
1518
|
data-disabled="${g.disabled ? "true" : "false"}"
|
|
1568
1519
|
data-today="${g.today ? "true" : "false"}"
|
|
1569
|
-
data-selected="${
|
|
1570
|
-
data-range="${
|
|
1571
|
-
data-range-start="${
|
|
1572
|
-
data-range-end="${
|
|
1573
|
-
data-range-preview="${!
|
|
1574
|
-
aria-selected="${
|
|
1520
|
+
data-selected="${ie ? "true" : "false"}"
|
|
1521
|
+
data-range="${T ? "true" : "false"}"
|
|
1522
|
+
data-range-start="${N ? "true" : "false"}"
|
|
1523
|
+
data-range-end="${Y ? "true" : "false"}"
|
|
1524
|
+
data-range-preview="${!T && Se ? "true" : "false"}"
|
|
1525
|
+
aria-selected="${ie ? "true" : "false"}"
|
|
1575
1526
|
aria-disabled="${g.disabled ? "true" : "false"}"
|
|
1576
1527
|
${g.today ? 'aria-current="date"' : ""}
|
|
1577
1528
|
aria-label="${m(De)}"
|
|
1578
|
-
${
|
|
1529
|
+
${re ? `aria-describedby="${ae}"` : ""}
|
|
1579
1530
|
tabindex="${Me}"
|
|
1580
1531
|
>
|
|
1581
1532
|
<span class="day-number" part="day-number">${g.parts.d}</span>
|
|
@@ -1584,42 +1535,42 @@ class Je extends Ae {
|
|
|
1584
1535
|
</button>
|
|
1585
1536
|
`;
|
|
1586
1537
|
}).join("");
|
|
1587
|
-
|
|
1538
|
+
Q.push(`<div class="week" role="row">${I}</div>`);
|
|
1588
1539
|
}
|
|
1589
|
-
const ye = this._monthPickerLabels(e).map((x,
|
|
1590
|
-
const
|
|
1540
|
+
const ye = this._monthPickerLabels(e).map((x, te) => {
|
|
1541
|
+
const I = te + 1;
|
|
1591
1542
|
return `
|
|
1592
1543
|
<button
|
|
1593
1544
|
type="button"
|
|
1594
1545
|
class="picker-month"
|
|
1595
1546
|
part="monthyear"
|
|
1596
1547
|
data-action="pick-month"
|
|
1597
|
-
data-month="${
|
|
1598
|
-
data-active="${
|
|
1548
|
+
data-month="${I}"
|
|
1549
|
+
data-active="${I === i ? "true" : "false"}"
|
|
1599
1550
|
${b ? "disabled" : ""}
|
|
1600
1551
|
>
|
|
1601
1552
|
${x}
|
|
1602
1553
|
</button>
|
|
1603
1554
|
`;
|
|
1604
|
-
}).join(""), _e =
|
|
1555
|
+
}).join(""), _e = ve.map((x) => `<span class="weekday" part="weekday" role="columnheader">${m(x)}</span>`).join(""), xe = this._showTodayButton() ? `<button type="button" class="today-btn" part="today" data-action="today" ${b ? "disabled" : ""}>${m(t.today)}</button>` : "", ee = d === "loading" ? t.syncingSchedule : d === "error" ? t.unableToSyncEvents : d === "success" ? t.scheduleSynced : "";
|
|
1605
1556
|
this.setContent(`
|
|
1606
1557
|
<style>${Be}</style>
|
|
1607
1558
|
<section
|
|
1608
1559
|
class="frame"
|
|
1609
1560
|
part="frame"
|
|
1610
1561
|
data-size="${f}"
|
|
1611
|
-
data-state="${
|
|
1562
|
+
data-state="${d}"
|
|
1612
1563
|
aria-disabled="${b ? "true" : "false"}"
|
|
1613
1564
|
aria-label="${m(D)}"
|
|
1614
1565
|
>
|
|
1615
|
-
<div class="live-region" aria-live="polite" aria-atomic="true">${m(
|
|
1566
|
+
<div class="live-region" aria-live="polite" aria-atomic="true">${m(J)}</div>
|
|
1616
1567
|
|
|
1617
1568
|
<header class="header" part="header">
|
|
1618
1569
|
<div class="nav" part="nav">
|
|
1619
|
-
<button type="button" class="nav-btn" part="prev" data-action="prev-month" ${!
|
|
1570
|
+
<button type="button" class="nav-btn" part="prev" data-action="prev-month" ${!ge || b ? "disabled" : ""} aria-label="${m(t.previousMonth)}">
|
|
1620
1571
|
<svg viewBox="0 0 24 24" width="14" height="14" aria-hidden="true" focusable="false"><path d="M14.7 6.3a1 1 0 0 1 0 1.4L10.41 12l4.29 4.3a1 1 0 1 1-1.42 1.4l-5-5a1 1 0 0 1 0-1.4l5-5a1 1 0 0 1 1.42 0Z" fill="currentColor"/></svg>
|
|
1621
1572
|
</button>
|
|
1622
|
-
<button type="button" class="nav-btn" part="next" data-action="next-month" ${!
|
|
1573
|
+
<button type="button" class="nav-btn" part="next" data-action="next-month" ${!be || b ? "disabled" : ""} aria-label="${m(t.nextMonth)}">
|
|
1623
1574
|
<svg viewBox="0 0 24 24" width="14" height="14" aria-hidden="true" focusable="false"><path d="M9.3 17.7a1 1 0 0 1 0-1.4L13.59 12 9.3 7.7a1 1 0 0 1 1.4-1.4l5 5a1 1 0 0 1 0 1.4l-5 5a1 1 0 0 1-1.4 0Z" fill="currentColor"/></svg>
|
|
1624
1575
|
</button>
|
|
1625
1576
|
</div>
|
|
@@ -1634,13 +1585,13 @@ class Je extends Ae {
|
|
|
1634
1585
|
aria-expanded="${this._pickerOpen ? "true" : "false"}"
|
|
1635
1586
|
aria-label="${m(t.chooseMonthYear)}"
|
|
1636
1587
|
>
|
|
1637
|
-
<span>${m(
|
|
1588
|
+
<span>${m(J)}</span>
|
|
1638
1589
|
<svg viewBox="0 0 24 24" width="14" height="14" aria-hidden="true" focusable="false"><path d="M6.7 9.7a1 1 0 0 1 1.4 0L12 13.59l3.9-3.9a1 1 0 1 1 1.4 1.42l-4.6 4.6a1 1 0 0 1-1.4 0l-4.6-4.6a1 1 0 0 1 0-1.42Z" fill="currentColor"/></svg>
|
|
1639
1590
|
</button>
|
|
1640
1591
|
<section class="monthyear-pop" part="monthyear" ${this._pickerOpen ? "" : "hidden"}>
|
|
1641
1592
|
<div class="picker-header">
|
|
1642
1593
|
<button type="button" class="picker-year-btn" part="prev" data-action="picker-prev-year" ${b ? "disabled" : ""} aria-label="${m(t.previousYear)}">-</button>
|
|
1643
|
-
<span class="picker-year">${
|
|
1594
|
+
<span class="picker-year">${a}</span>
|
|
1644
1595
|
<button type="button" class="picker-year-btn" part="next" data-action="picker-next-year" ${b ? "disabled" : ""} aria-label="${m(t.nextYear)}">+</button>
|
|
1645
1596
|
</div>
|
|
1646
1597
|
<div class="picker-months">${ye}</div>
|
|
@@ -1652,14 +1603,14 @@ class Je extends Ae {
|
|
|
1652
1603
|
</div>
|
|
1653
1604
|
</header>
|
|
1654
1605
|
|
|
1655
|
-
<div class="status" part="status" ${
|
|
1606
|
+
<div class="status" part="status" ${ee ? "" : "hidden"}>
|
|
1656
1607
|
<span class="status-dot" aria-hidden="true"></span>
|
|
1657
|
-
<span>${m(
|
|
1608
|
+
<span>${m(ee)}</span>
|
|
1658
1609
|
</div>
|
|
1659
1610
|
|
|
1660
1611
|
<section class="grid-wrap" part="grid" role="grid" aria-label="${m(D)}">
|
|
1661
1612
|
<div class="weekdays" role="row">${_e}</div>
|
|
1662
|
-
${
|
|
1613
|
+
${Q.join("")}
|
|
1663
1614
|
</section>
|
|
1664
1615
|
</section>
|
|
1665
1616
|
`);
|
|
@@ -1668,13 +1619,13 @@ class Je extends Ae {
|
|
|
1668
1619
|
this.isConnected && this._focusDateButton(ke);
|
|
1669
1620
|
});
|
|
1670
1621
|
}
|
|
1671
|
-
shouldRenderOnAttributeChange(e, t,
|
|
1622
|
+
shouldRenderOnAttributeChange(e, t, n) {
|
|
1672
1623
|
return !1;
|
|
1673
1624
|
}
|
|
1674
1625
|
}
|
|
1675
|
-
typeof customElements < "u" && !customElements.get("ui-calendar") && customElements.define("ui-calendar",
|
|
1626
|
+
typeof customElements < "u" && !customElements.get("ui-calendar") && customElements.define("ui-calendar", We);
|
|
1676
1627
|
export {
|
|
1677
|
-
|
|
1628
|
+
We as U,
|
|
1678
1629
|
Fe as a,
|
|
1679
1630
|
He as b,
|
|
1680
1631
|
w as c,
|