@lmvz-ds/components 0.35.2 → 0.36.1
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/CHANGELOG.md +18 -0
- package/assets/icons/calendar.svg +7 -0
- package/cjs/{aria-validation-controller-BC0Eaiv4.js → aria-validation-controller-Do0uEK4t.js} +1 -1
- package/cjs/aria.constants-DPK5mQEL.js +65 -0
- package/cjs/{directional-focus-controller-DBat-oF7.js → directional-focus-controller-8Xd_7MHT.js} +3 -1
- package/cjs/{element-activation-controller-BHqCUgQv.js → element-activation-controller-DzTUocEO.js} +1 -1
- package/cjs/{element.util-CRS_YJ59.js → element.util-BlhcwmfR.js} +8 -54
- package/cjs/{index-TGsVZNDP.js → index-BgvZ4y-3.js} +12 -0
- package/cjs/lmvz-action-list.cjs.entry.js +5 -4
- package/cjs/lmvz-action.cjs.entry.js +1 -1
- package/cjs/lmvz-button-group.cjs.entry.js +3 -2
- package/cjs/lmvz-button_2.cjs.entry.js +6 -5
- package/cjs/lmvz-card.cjs.entry.js +1 -1
- package/cjs/lmvz-checkbox.cjs.entry.js +40 -6
- package/cjs/lmvz-chip.cjs.entry.js +2 -2
- package/cjs/lmvz-components.cjs.js +2 -2
- package/cjs/lmvz-datepicker.cjs.entry.js +2771 -0
- package/cjs/lmvz-header_2.cjs.entry.js +7 -6
- package/cjs/lmvz-input.cjs.entry.js +71 -15
- package/cjs/lmvz-link.cjs.entry.js +2 -2
- package/cjs/lmvz-menuitem.cjs.entry.js +6 -5
- package/cjs/lmvz-message.cjs.entry.js +2 -2
- package/cjs/lmvz-modal.cjs.entry.js +5 -4
- package/cjs/lmvz-popover.cjs.entry.js +25 -10
- package/cjs/lmvz-radio.cjs.entry.js +63 -5
- package/cjs/lmvz-select.cjs.entry.js +425 -18
- package/cjs/lmvz-snackbar.cjs.entry.js +2 -2
- package/cjs/lmvz-spinner.cjs.entry.js +2 -2
- package/cjs/lmvz-tab.cjs.entry.js +2 -2
- package/cjs/lmvz-tabs.cjs.entry.js +5 -4
- package/cjs/lmvz-toggle.cjs.entry.js +7 -4
- package/cjs/loader.cjs.js +2 -2
- package/collection/assets/icons/calendar.svg +7 -0
- package/collection/collection-manifest.json +1 -0
- package/collection/components/lmvz-checkbox/lmvz-checkbox.css +4 -2
- package/collection/components/lmvz-checkbox/lmvz-checkbox.js +68 -8
- package/collection/components/lmvz-datepicker/lmvz-datepicker.css +161 -0
- package/collection/components/lmvz-datepicker/lmvz-datepicker.js +1002 -0
- package/collection/components/lmvz-datepicker/lmvz-datepicker.utils.js +189 -0
- package/collection/components/lmvz-datepicker/test/lmvz-datepicker.utils.unit.js +300 -0
- package/collection/components/lmvz-header/lmvz-header.js +1 -1
- package/collection/components/lmvz-icon/lmvz-icon.js +1 -1
- package/collection/components/lmvz-input/lmvz-input.css +1 -1
- package/collection/components/lmvz-input/lmvz-input.js +85 -12
- package/collection/components/lmvz-link/lmvz-link.js +1 -1
- package/collection/components/lmvz-menuitem/lmvz-menuitem.js +1 -1
- package/collection/components/lmvz-message/lmvz-message.js +1 -1
- package/collection/components/lmvz-modal/lmvz-modal.js +1 -1
- package/collection/components/lmvz-popover/lmvz-popover.css +1 -1
- package/collection/components/lmvz-popover/lmvz-popover.js +50 -6
- package/collection/components/lmvz-radio/lmvz-radio.js +77 -9
- package/collection/components/lmvz-select/lmvz-select.css +96 -34
- package/collection/components/lmvz-select/lmvz-select.js +412 -21
- package/collection/components/lmvz-snackbar/lmvz-snackbar.js +1 -1
- package/collection/components/lmvz-spinner/lmvz-spinner.js +1 -1
- package/collection/components/lmvz-tab/lmvz-tab.js +1 -1
- package/collection/components/lmvz-tabs/lmvz-tabs.js +1 -1
- package/collection/components/lmvz-toggle/lmvz-toggle.js +21 -1
- package/collection/integration/header-integration/header-integration.js +1 -1
- package/collection/styles/fragments/_focus-within.css +2 -2
- package/collection/utils/aria/aria.constants.js +7 -0
- package/collection/utils/aria/directional-focus-controller.js +3 -1
- package/collection/utils/aria/listbox-controller.js +154 -0
- package/collection/utils/element/element.util.js +5 -0
- package/collection/utils/radio/radio-group-controller.js +17 -0
- package/components/index.d.ts +2 -0
- package/components/index.d.ts.bak +2 -0
- package/components/index.js +1 -1
- package/components/lmvz-action-list.js +1 -1
- package/components/lmvz-action.js +1 -1
- package/components/lmvz-button-group.js +1 -1
- package/components/lmvz-button.js +1 -1
- package/components/lmvz-card.js +1 -1
- package/components/lmvz-checkbox.js +1 -1
- package/components/lmvz-chip.js +1 -1
- package/components/lmvz-datepicker.d.ts +11 -0
- package/components/lmvz-datepicker.d.ts.bak +11 -0
- package/components/lmvz-datepicker.js +1 -0
- package/components/lmvz-header.js +1 -1
- package/components/lmvz-icon.js +1 -1
- package/components/lmvz-input.js +1 -1
- package/components/lmvz-link.js +1 -1
- package/components/lmvz-menuitem.js +1 -1
- package/components/lmvz-message.js +1 -1
- package/components/lmvz-modal.js +1 -1
- package/components/lmvz-popover.js +1 -1
- package/components/lmvz-radio.js +1 -1
- package/components/lmvz-select.js +1 -1
- package/components/lmvz-snackbar.js +1 -1
- package/components/lmvz-spinner.js +1 -1
- package/components/lmvz-tab.js +1 -1
- package/components/lmvz-tabs.js +1 -1
- package/components/lmvz-toggle.js +1 -1
- package/components/{p-Chj7BuUZ.js → p--FDdvoIg.js} +1 -1
- package/components/{p-CFTmV4XZ.js → p-BAj4FkUt.js} +1 -1
- package/components/p-BApwCp0R.js +1 -0
- package/components/{p-CxLd309t.js → p-BLMXiDE0.js} +1 -1
- package/components/{p-DGg7OzDl.js → p-BPYBmylI.js} +1 -1
- package/components/p-BhALzK62.js +1 -0
- package/components/{p-B_rnXUwq.js → p-Bnri3fEI.js} +1 -1
- package/components/p-C-pRMuMh.js +1 -0
- package/components/p-C5gRiLRR.js +1 -0
- package/components/{p-D5FL8n1q.js → p-CrQCHVKL.js} +1 -1
- package/components/p-DqdrUt_G.js +1 -0
- package/components/{p-CgK6-SEe.js → p-diOze8wI.js} +1 -1
- package/esm/{aria-validation-controller-BvOU1BO8.js → aria-validation-controller-Cp6pofER.js} +1 -1
- package/esm/aria.constants-DIyiticz.js +62 -0
- package/esm/{directional-focus-controller-DgAdCZrG.js → directional-focus-controller-QukTTWBE.js} +3 -1
- package/esm/{element-activation-controller-7PNSl6io.js → element-activation-controller-dxJZKMag.js} +1 -1
- package/esm/{element.util-BFcYfHYq.js → element.util-3ydVsxUW.js} +7 -54
- package/esm/{index-BPeerEwm.js → index-BOXP1Vx0.js} +12 -1
- package/esm/lmvz-action-list.entry.js +5 -4
- package/esm/lmvz-action.entry.js +1 -1
- package/esm/lmvz-button-group.entry.js +3 -2
- package/esm/lmvz-button_2.entry.js +6 -5
- package/esm/lmvz-card.entry.js +1 -1
- package/esm/lmvz-checkbox.entry.js +40 -6
- package/esm/lmvz-chip.entry.js +2 -2
- package/esm/lmvz-components.js +3 -3
- package/esm/lmvz-datepicker.entry.js +2769 -0
- package/esm/lmvz-header_2.entry.js +7 -6
- package/esm/lmvz-input.entry.js +71 -15
- package/esm/lmvz-link.entry.js +2 -2
- package/esm/lmvz-menuitem.entry.js +6 -5
- package/esm/lmvz-message.entry.js +2 -2
- package/esm/lmvz-modal.entry.js +5 -4
- package/esm/lmvz-popover.entry.js +25 -10
- package/esm/lmvz-radio.entry.js +63 -5
- package/esm/lmvz-select.entry.js +425 -18
- package/esm/lmvz-snackbar.entry.js +2 -2
- package/esm/lmvz-spinner.entry.js +2 -2
- package/esm/lmvz-tab.entry.js +2 -2
- package/esm/lmvz-tabs.entry.js +5 -4
- package/esm/lmvz-toggle.entry.js +7 -4
- package/esm/loader.js +3 -3
- package/hydrate/index.js +3474 -75
- package/hydrate/index.mjs +3474 -75
- package/lmvz-components/lmvz-components.esm.js +1 -1
- package/lmvz-components/{p-eb62d4af.entry.js → p-0af0211a.entry.js} +1 -1
- package/lmvz-components/{p-5bbbcfc0.entry.js → p-0f65d001.entry.js} +1 -1
- package/lmvz-components/p-137b1fe1.entry.js +1 -0
- package/lmvz-components/p-26dd9684.entry.js +1 -0
- package/lmvz-components/p-36f44108.entry.js +1 -0
- package/lmvz-components/p-398b5cf4.entry.js +1 -0
- package/lmvz-components/p-3a396fc8.entry.js +1 -0
- package/lmvz-components/{p-0c05f24b.entry.js → p-3d5867df.entry.js} +1 -1
- package/lmvz-components/p-40716828.entry.js +1 -0
- package/lmvz-components/{p-a887018d.entry.js → p-492adf21.entry.js} +1 -1
- package/lmvz-components/{p-24d13be6.entry.js → p-4fa6e72f.entry.js} +1 -1
- package/lmvz-components/p-70f1e31a.entry.js +1 -0
- package/lmvz-components/p-71d06d1d.entry.js +1 -0
- package/lmvz-components/{p-d45164a8.entry.js → p-7a7aa922.entry.js} +1 -1
- package/lmvz-components/p-88661c50.entry.js +1 -0
- package/lmvz-components/p-91eb71bb.entry.js +1 -0
- package/lmvz-components/p-BA3wizqg.js +1 -0
- package/lmvz-components/{p-BPeerEwm.js → p-BOXP1Vx0.js} +2 -2
- package/lmvz-components/{p-D9PQIBzA.js → p-BeY96W7m.js} +1 -1
- package/lmvz-components/p-CHxiS3ja.js +1 -0
- package/lmvz-components/{p-wlMjNjuv.js → p-CPSyM_e-.js} +1 -1
- package/lmvz-components/p-DIyiticz.js +1 -0
- package/lmvz-components/p-a680a7b2.entry.js +1 -0
- package/lmvz-components/{p-c2544495.entry.js → p-a6fe9b61.entry.js} +1 -1
- package/lmvz-components/{p-ecbd9e93.entry.js → p-a99acb02.entry.js} +1 -1
- package/lmvz-components/p-f16a19fc.entry.js +1 -0
- package/lmvz-components/p-f3f0ed49.entry.js +1 -0
- package/lmvz-components/p-f516a949.entry.js +1 -0
- package/manifest.json +1305 -188
- package/package.json +5 -1
- package/types/api/ds.constants.d.ts +0 -1
- package/types/api/ds.types.d.ts +9 -0
- package/types/components/lmvz-action/lmvz-action.d.ts +0 -1
- package/types/components/lmvz-action-list/lmvz-action-list.d.ts +0 -1
- package/types/components/lmvz-button/lmvz-button.d.ts +0 -1
- package/types/components/lmvz-button-group/lmvz-button-group.d.ts +0 -1
- package/types/components/lmvz-card/lmvz-card.d.ts +0 -1
- package/types/components/lmvz-checkbox/lmvz-checkbox.d.ts +9 -2
- package/types/components/lmvz-chip/lmvz-chip.d.ts +0 -1
- package/types/components/lmvz-datepicker/lmvz-datepicker.d.ts +77 -0
- package/types/components/lmvz-datepicker/lmvz-datepicker.utils.d.ts +22 -0
- package/types/components/lmvz-datepicker/test/lmvz-datepicker.utils.unit.d.ts +1 -0
- package/types/components/lmvz-header/lmvz-header.d.ts +0 -1
- package/types/components/lmvz-icon/lmvz-icon.d.ts +0 -1
- package/types/components/lmvz-input/lmvz-input.d.ts +8 -1
- package/types/components/lmvz-link/lmvz-link.d.ts +0 -1
- package/types/components/lmvz-menuitem/lmvz-menuitem.d.ts +0 -1
- package/types/components/lmvz-message/lmvz-message.d.ts +0 -1
- package/types/components/lmvz-message/public.d.ts +0 -1
- package/types/components/lmvz-modal/lmvz-modal.d.ts +0 -1
- package/types/components/lmvz-modal/test/testing.d.ts +0 -1
- package/types/components/lmvz-popover/lmvz-popover.d.ts +2 -1
- package/types/components/lmvz-radio/lmvz-radio.d.ts +12 -3
- package/types/components/lmvz-select/lmvz-select.d.ts +53 -5
- package/types/components/lmvz-snackbar/lmvz-snackbar.d.ts +0 -1
- package/types/components/lmvz-snackbar/public.d.ts +0 -1
- package/types/components/lmvz-snackbar/snackbar-controller.d.ts +0 -1
- package/types/components/lmvz-spinner/lmvz-spinner.d.ts +0 -1
- package/types/components/lmvz-tab/lmvz-tab.d.ts +0 -1
- package/types/components/lmvz-tabs/lmvz-tabs.d.ts +0 -1
- package/types/components/lmvz-toggle/lmvz-toggle.d.ts +1 -1
- package/types/components.d.ts +312 -12
- package/types/index.d.ts +0 -1
- package/types/utils/aria/aria-validation-controller.d.ts +0 -1
- package/types/utils/aria/aria.constants.d.ts +1 -1
- package/types/utils/aria/directional-focus-controller.d.ts +0 -1
- package/types/utils/aria/element-activation-controller.d.ts +0 -1
- package/types/utils/aria/listbox-controller.d.ts +42 -0
- package/types/utils/async/async.util.d.ts +1 -2
- package/types/utils/data/event.util.d.ts +0 -1
- package/types/utils/data/number.util.d.ts +0 -1
- package/types/utils/data/object.util.d.ts +0 -1
- package/types/utils/data/time.util.d.ts +0 -1
- package/types/utils/element/element.util.d.ts +1 -1
- package/types/utils/environment.d.ts +0 -1
- package/types/utils/icons/icons-registry.d.ts +0 -1
- package/types/utils/icons/icons.d.ts +0 -1
- package/types/utils/icons/icons.unit.d.ts +0 -1
- package/types/utils/icons/public.d.ts +0 -1
- package/types/utils/public.d.ts +0 -1
- package/types/utils/radio/radio-group-controller.d.ts +3 -1
- package/types/utils/stencil/assets.d.ts +0 -1
- package/types/utils/stencil/reactive-controller-host.d.ts +0 -1
- package/types/utils/stencil/stencil.util.d.ts +0 -1
- package/components/p-DLUsBYJH.js +0 -1
- package/components/p-zMWemcoB.js +0 -1
- package/lmvz-components/p-194a3af5.entry.js +0 -1
- package/lmvz-components/p-46edf36f.entry.js +0 -1
- package/lmvz-components/p-5ff55ba9.entry.js +0 -1
- package/lmvz-components/p-888e04d7.entry.js +0 -1
- package/lmvz-components/p-9dc420e2.entry.js +0 -1
- package/lmvz-components/p-BFcYfHYq.js +0 -1
- package/lmvz-components/p-BuEA0MWd.js +0 -1
- package/lmvz-components/p-aaa7691c.entry.js +0 -1
- package/lmvz-components/p-b6dd045b.entry.js +0 -1
- package/lmvz-components/p-c3e62aba.entry.js +0 -1
- package/lmvz-components/p-d4154a65.entry.js +0 -1
- package/lmvz-components/p-e4ce63b3.entry.js +0 -1
- package/lmvz-components/p-eb4c5a6f.entry.js +0 -1
- package/lmvz-components/p-f42b16e6.entry.js +0 -1
- package/lmvz-components/p-fbf066d9.entry.js +0 -1
|
@@ -0,0 +1,1002 @@
|
|
|
1
|
+
import { Host, forceUpdate, h } from "@stencil/core";
|
|
2
|
+
import * as CalendarFns from "temporal-polyfill/fns/Calendar";
|
|
3
|
+
import * as NowFns from "temporal-polyfill/fns/Now";
|
|
4
|
+
import * as PDate from "temporal-polyfill/fns/PlainDate";
|
|
5
|
+
import * as PYM from "temporal-polyfill/fns/PlainYearMonth";
|
|
6
|
+
import chevronLeft from "@lmvz-ds/icons/assets/chevron-left.svg";
|
|
7
|
+
import chevronRight from "@lmvz-ds/icons/assets/chevron-right.svg";
|
|
8
|
+
import { parseIsoDateSafely, toIsoDateString, toIsoYearMonthString } from "@lmvz-ds/lib-ts/date/temporal.js";
|
|
9
|
+
import { toValidSvgStringWithFallback } from "@lmvz-ds/lib-ts/validation/svg.js";
|
|
10
|
+
import calendar from "../../assets/icons/calendar.svg";
|
|
11
|
+
import { buildCalendarGrid, derivePatternFromLocale, firstSelectableDayOfMonth, formatToDisplay, getNavLabels, getValidationLabels, isDisabled, isSelected, lastSelectableDayOfMonth, parseFromDisplay, } from "./lmvz-datepicker.utils";
|
|
12
|
+
const CHEVRON_LEFT = toValidSvgStringWithFallback(chevronLeft);
|
|
13
|
+
const CHEVRON_RIGHT = toValidSvgStringWithFallback(chevronRight);
|
|
14
|
+
const CALENDAR_ICON = toValidSvgStringWithFallback(calendar);
|
|
15
|
+
export class LmvzDatepicker {
|
|
16
|
+
el;
|
|
17
|
+
monthLabelId = `lmvz-dp-month-${Math.random().toString(36).slice(2, 9)}`;
|
|
18
|
+
internals;
|
|
19
|
+
visibleDays;
|
|
20
|
+
inputEl;
|
|
21
|
+
focusedButtonRef;
|
|
22
|
+
initialValue;
|
|
23
|
+
pendingGridFocus = false;
|
|
24
|
+
syncOrigin = null;
|
|
25
|
+
focusedDate;
|
|
26
|
+
setFocusedDate(val) {
|
|
27
|
+
if (this.focusedDate === val || (this.focusedDate && val && PDate.compare(this.focusedDate, val) === 0))
|
|
28
|
+
return;
|
|
29
|
+
this.focusedDate = val;
|
|
30
|
+
}
|
|
31
|
+
valueDate;
|
|
32
|
+
get value() {
|
|
33
|
+
return this.valueDate ? toIsoDateString(this.valueDate) : undefined;
|
|
34
|
+
}
|
|
35
|
+
set value(value) {
|
|
36
|
+
this.valueDate = value ? parseIsoDateSafely(value) : undefined;
|
|
37
|
+
this.visibleMonthDate = this.valueDate ? PDate.toPlainYearMonth(this.valueDate) : this.effectiveVisibleMonth;
|
|
38
|
+
this.setFocusedDate(this.valueDate);
|
|
39
|
+
this.syncInputTextFromValue();
|
|
40
|
+
this.updateFormState();
|
|
41
|
+
}
|
|
42
|
+
visibleMonthDate;
|
|
43
|
+
get visibleMonth() {
|
|
44
|
+
return this.visibleMonthDate ? toIsoYearMonthString(this.visibleMonthDate) : undefined;
|
|
45
|
+
}
|
|
46
|
+
set visibleMonth(value) {
|
|
47
|
+
this.visibleMonthDate = value ? PYM.fromString(value, CalendarFns.getBasic) : undefined;
|
|
48
|
+
this.initFocusedDate();
|
|
49
|
+
}
|
|
50
|
+
min;
|
|
51
|
+
max;
|
|
52
|
+
locale = 'de-CH';
|
|
53
|
+
firstDayOfWeek = 1;
|
|
54
|
+
disabled = false;
|
|
55
|
+
readonly = false;
|
|
56
|
+
required = false;
|
|
57
|
+
name;
|
|
58
|
+
label;
|
|
59
|
+
placeholder;
|
|
60
|
+
helperText;
|
|
61
|
+
errorMessage;
|
|
62
|
+
open = false;
|
|
63
|
+
displayFormat;
|
|
64
|
+
lmvzChange;
|
|
65
|
+
lmvzMonthChange;
|
|
66
|
+
lmvzOpen;
|
|
67
|
+
lmvzClose;
|
|
68
|
+
componentWillLoad() {
|
|
69
|
+
if (!this.label) {
|
|
70
|
+
console.warn('[lmvz-datepicker] no `label` provided; the text field will have no accessible name.');
|
|
71
|
+
}
|
|
72
|
+
this.initialValue = this.value;
|
|
73
|
+
this.syncInputTextFromValue();
|
|
74
|
+
this.updateFormState();
|
|
75
|
+
}
|
|
76
|
+
formAssociatedCallback(form) {
|
|
77
|
+
if (!form)
|
|
78
|
+
return;
|
|
79
|
+
this.updateFormState();
|
|
80
|
+
}
|
|
81
|
+
formResetCallback() {
|
|
82
|
+
this.internals.setValidity?.({});
|
|
83
|
+
this.value = this.initialValue;
|
|
84
|
+
}
|
|
85
|
+
formStateRestoreCallback(state) {
|
|
86
|
+
if (typeof state !== 'string')
|
|
87
|
+
return;
|
|
88
|
+
this.value = (state || undefined);
|
|
89
|
+
}
|
|
90
|
+
async checkValidity() {
|
|
91
|
+
return this.internals.checkValidity?.() ?? true;
|
|
92
|
+
}
|
|
93
|
+
async reportValidity() {
|
|
94
|
+
return this.internals.reportValidity?.() ?? true;
|
|
95
|
+
}
|
|
96
|
+
handleValidityRelevantPropChange() {
|
|
97
|
+
this.updateFormState();
|
|
98
|
+
}
|
|
99
|
+
handleDisplayFormatChange() {
|
|
100
|
+
this.syncInputTextFromValue();
|
|
101
|
+
}
|
|
102
|
+
handleDisabledChange(disabled) {
|
|
103
|
+
if (disabled)
|
|
104
|
+
this.open = false;
|
|
105
|
+
}
|
|
106
|
+
handleKeydown(ev) {
|
|
107
|
+
if (this.disabled)
|
|
108
|
+
return;
|
|
109
|
+
const path = ev.composedPath();
|
|
110
|
+
if (!path.some((el) => el?.getAttribute?.('role') === 'grid'))
|
|
111
|
+
return;
|
|
112
|
+
const focused = this.focusedDate;
|
|
113
|
+
if (!focused) {
|
|
114
|
+
console.warn('[lmvz-datepicker] any date should be focused but none is.');
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const minDate = parseIsoDateSafely(this.min);
|
|
118
|
+
const maxDate = parseIsoDateSafely(this.max);
|
|
119
|
+
const swallowEvent = () => {
|
|
120
|
+
ev.preventDefault();
|
|
121
|
+
ev.stopPropagation();
|
|
122
|
+
};
|
|
123
|
+
switch (ev.key) {
|
|
124
|
+
case 'ArrowRight': {
|
|
125
|
+
swallowEvent();
|
|
126
|
+
this.moveFocus(PDate.addDays(focused, 1));
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
case 'ArrowLeft': {
|
|
130
|
+
swallowEvent();
|
|
131
|
+
this.moveFocus(PDate.addDays(focused, -1));
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
case 'ArrowDown': {
|
|
135
|
+
swallowEvent();
|
|
136
|
+
this.moveFocus(PDate.addDays(focused, 7));
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
case 'ArrowUp': {
|
|
140
|
+
swallowEvent();
|
|
141
|
+
this.moveFocus(PDate.addDays(focused, -7));
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
case 'Home': {
|
|
145
|
+
swallowEvent();
|
|
146
|
+
this.moveFocus(firstSelectableDayOfMonth(this.effectiveVisibleMonth, minDate, maxDate));
|
|
147
|
+
break;
|
|
148
|
+
}
|
|
149
|
+
case 'End': {
|
|
150
|
+
swallowEvent();
|
|
151
|
+
this.moveFocus(lastSelectableDayOfMonth(this.effectiveVisibleMonth, minDate, maxDate));
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
case 'PageUp':
|
|
155
|
+
swallowEvent();
|
|
156
|
+
this.moveFocus(ev.shiftKey ? PDate.addYears(focused, -1) : PDate.addMonths(focused, -1));
|
|
157
|
+
break;
|
|
158
|
+
case 'PageDown':
|
|
159
|
+
swallowEvent();
|
|
160
|
+
this.moveFocus(ev.shiftKey ? PDate.addYears(focused, 1) : PDate.addMonths(focused, 1));
|
|
161
|
+
break;
|
|
162
|
+
case 'Enter':
|
|
163
|
+
case ' ':
|
|
164
|
+
ev.preventDefault();
|
|
165
|
+
if (!this.readonly && !isDisabled(focused, minDate, maxDate)) {
|
|
166
|
+
this.selectDate(focused, { origin: 'calendar', closePopover: true });
|
|
167
|
+
}
|
|
168
|
+
break;
|
|
169
|
+
case 'Escape':
|
|
170
|
+
break;
|
|
171
|
+
default:
|
|
172
|
+
break;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
initFocusedDate() {
|
|
176
|
+
const vm = this.effectiveVisibleMonth;
|
|
177
|
+
if (this.focusedDate && PYM.compare(PDate.toPlainYearMonth(this.focusedDate), vm) === 0) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
const selectedDate = this.valueDate;
|
|
181
|
+
if (selectedDate && PYM.compare(PDate.toPlainYearMonth(selectedDate), vm) === 0) {
|
|
182
|
+
this.setFocusedDate(selectedDate);
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
const todayDate = NowFns.plainDateISO();
|
|
186
|
+
if (PYM.compare(PDate.toPlainYearMonth(todayDate), vm) === 0) {
|
|
187
|
+
this.setFocusedDate(todayDate);
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
this.setFocusedDate(PYM.toPlainDate(vm, { day: 1 }));
|
|
191
|
+
}
|
|
192
|
+
get effectiveVisibleMonth() {
|
|
193
|
+
return this.visibleMonthDate ? this.visibleMonthDate : PDate.toPlainYearMonth(NowFns.plainDateISO());
|
|
194
|
+
}
|
|
195
|
+
navigateMonth(delta, byMonthNav = false) {
|
|
196
|
+
if (delta === 0)
|
|
197
|
+
return;
|
|
198
|
+
const newMonth = PYM.addMonths(this.effectiveVisibleMonth, delta);
|
|
199
|
+
this.visibleMonthDate = newMonth;
|
|
200
|
+
this.lmvzMonthChange.emit({ visibleMonth: toIsoYearMonthString(newMonth) });
|
|
201
|
+
if (byMonthNav) {
|
|
202
|
+
this.setFocusedDate(PYM.toPlainDate(newMonth, { day: 1 }));
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
selectDate(date, opts = { origin: 'calendar' }) {
|
|
206
|
+
this.syncOrigin = opts.origin;
|
|
207
|
+
this.valueDate = date;
|
|
208
|
+
this.setFocusedDate(date);
|
|
209
|
+
this.lmvzChange.emit({ value: toIsoDateString(date) });
|
|
210
|
+
this.navigateMonth(PYM.compare(PDate.toPlainYearMonth(date), this.effectiveVisibleMonth));
|
|
211
|
+
if (opts.origin === 'input') {
|
|
212
|
+
this.inputText = formatToDisplay(this.value, this.locale, this.displayFormat);
|
|
213
|
+
this.hasUnparseableInput = false;
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
this.syncInputTextFromValue();
|
|
217
|
+
}
|
|
218
|
+
this.updateFormState();
|
|
219
|
+
if (opts.closePopover)
|
|
220
|
+
this.open = false;
|
|
221
|
+
this.syncOrigin = null;
|
|
222
|
+
}
|
|
223
|
+
moveFocus(date) {
|
|
224
|
+
if (!date)
|
|
225
|
+
return;
|
|
226
|
+
this.setFocusedDate(date);
|
|
227
|
+
if (!this.visibleDays?.length)
|
|
228
|
+
return;
|
|
229
|
+
let day = this.visibleDays.at(0);
|
|
230
|
+
if (day && PDate.compare(date, day) < 0) {
|
|
231
|
+
return this.navigateMonth(-1);
|
|
232
|
+
}
|
|
233
|
+
day = this.visibleDays.at(-1);
|
|
234
|
+
if (day && PDate.compare(date, day) > 0) {
|
|
235
|
+
return this.navigateMonth(1);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
syncInputTextFromValue() {
|
|
239
|
+
if (this.syncOrigin === 'input')
|
|
240
|
+
return;
|
|
241
|
+
this.inputText = formatToDisplay(this.value, this.locale, this.displayFormat);
|
|
242
|
+
this.hasUnparseableInput = false;
|
|
243
|
+
}
|
|
244
|
+
inputText = '';
|
|
245
|
+
hasUnparseableInput = false;
|
|
246
|
+
handleInputTextChange = (ev) => {
|
|
247
|
+
const text = ev.detail;
|
|
248
|
+
this.inputText = text;
|
|
249
|
+
if (!text.trim()) {
|
|
250
|
+
this.hasUnparseableInput = false;
|
|
251
|
+
if (this.valueDate) {
|
|
252
|
+
this.syncOrigin = 'input';
|
|
253
|
+
this.valueDate = undefined;
|
|
254
|
+
this.lmvzChange.emit({ value: undefined });
|
|
255
|
+
this.syncOrigin = null;
|
|
256
|
+
}
|
|
257
|
+
this.updateFormState();
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
const parsed = parseFromDisplay(text, this.locale, this.displayFormat);
|
|
261
|
+
if (!parsed) {
|
|
262
|
+
this.hasUnparseableInput = true;
|
|
263
|
+
this.updateFormState();
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
this.hasUnparseableInput = false;
|
|
267
|
+
const parsedDate = parseIsoDateSafely(parsed);
|
|
268
|
+
if (!parsedDate)
|
|
269
|
+
return;
|
|
270
|
+
if (this.valueDate && PDate.compare(this.valueDate, parsedDate) === 0)
|
|
271
|
+
return;
|
|
272
|
+
this.selectDate(parsedDate, { origin: 'input' });
|
|
273
|
+
};
|
|
274
|
+
handleInputFocus(ev) {
|
|
275
|
+
if (this.disabled || this.readonly)
|
|
276
|
+
return;
|
|
277
|
+
const originalTarget = ev.composedPath()[0];
|
|
278
|
+
if (originalTarget !== this.inputEl && !this.inputEl?.contains(originalTarget ?? null))
|
|
279
|
+
return;
|
|
280
|
+
this.initFocusedDate();
|
|
281
|
+
this.open = true;
|
|
282
|
+
}
|
|
283
|
+
handleInputKeydown = (ev) => {
|
|
284
|
+
if (this.disabled || this.readonly)
|
|
285
|
+
return;
|
|
286
|
+
if (!['ArrowDown', 'ArrowUp', ' '].includes(ev.key))
|
|
287
|
+
return;
|
|
288
|
+
ev.preventDefault();
|
|
289
|
+
if (!this.open) {
|
|
290
|
+
this.pendingGridFocus = true;
|
|
291
|
+
this.initFocusedDate();
|
|
292
|
+
this.open = true;
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
this.focusGrid();
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
focusGrid() {
|
|
299
|
+
requestAnimationFrame(() => this.focusedButtonRef?.focus());
|
|
300
|
+
}
|
|
301
|
+
handlePopoverOpen = (ev) => {
|
|
302
|
+
ev.stopPropagation();
|
|
303
|
+
console.log('emitting open event');
|
|
304
|
+
this.lmvzOpen.emit();
|
|
305
|
+
if (this.pendingGridFocus) {
|
|
306
|
+
this.pendingGridFocus = false;
|
|
307
|
+
this.focusGrid();
|
|
308
|
+
}
|
|
309
|
+
};
|
|
310
|
+
handlePopoverClose = (ev) => {
|
|
311
|
+
console.log('handlePopoverClose', ev);
|
|
312
|
+
ev.stopPropagation();
|
|
313
|
+
this.open = false;
|
|
314
|
+
this.lmvzClose.emit();
|
|
315
|
+
};
|
|
316
|
+
updateFormState() {
|
|
317
|
+
const isoValue = this.value;
|
|
318
|
+
this.internals.setFormValue?.(isoValue ?? null);
|
|
319
|
+
const flags = {};
|
|
320
|
+
if (this.required && !this.valueDate) {
|
|
321
|
+
flags.valueMissing = true;
|
|
322
|
+
}
|
|
323
|
+
if (this.hasUnparseableInput) {
|
|
324
|
+
flags.badInput = true;
|
|
325
|
+
}
|
|
326
|
+
if (this.valueDate) {
|
|
327
|
+
const minDate = parseIsoDateSafely(this.min);
|
|
328
|
+
const maxDate = parseIsoDateSafely(this.max);
|
|
329
|
+
if (minDate && PDate.compare(this.valueDate, minDate) < 0)
|
|
330
|
+
flags.rangeUnderflow = true;
|
|
331
|
+
if (maxDate && PDate.compare(this.valueDate, maxDate) > 0)
|
|
332
|
+
flags.rangeOverflow = true;
|
|
333
|
+
}
|
|
334
|
+
const isInvalid = Object.values(flags).some(Boolean);
|
|
335
|
+
this.isInvalid = isInvalid;
|
|
336
|
+
if (!isInvalid) {
|
|
337
|
+
this.nativeError = false;
|
|
338
|
+
}
|
|
339
|
+
const validationLabels = getValidationLabels(this.locale);
|
|
340
|
+
this.internals.setValidity?.(flags, isInvalid ? this.errorMessage || validationLabels.invalidDateMessage : undefined, isInvalid ? this.el : undefined);
|
|
341
|
+
}
|
|
342
|
+
handleInvalid() {
|
|
343
|
+
this.nativeError = true;
|
|
344
|
+
}
|
|
345
|
+
isInvalid = false;
|
|
346
|
+
nativeError = false;
|
|
347
|
+
get effectivePlaceholder() {
|
|
348
|
+
return this.placeholder ?? derivePatternFromLocale(this.locale).toLowerCase();
|
|
349
|
+
}
|
|
350
|
+
renderHeader() {
|
|
351
|
+
const { locale } = this;
|
|
352
|
+
const vm = this.effectiveVisibleMonth;
|
|
353
|
+
const navLabels = getNavLabels(locale);
|
|
354
|
+
const monthYearLabel = PDate.toLocaleString(PYM.toPlainDate(vm, { day: 1 }), locale, { month: 'long', year: 'numeric' });
|
|
355
|
+
const prevMonth = PYM.addMonths(vm, -1);
|
|
356
|
+
const nextMonth = PYM.addMonths(vm, 1);
|
|
357
|
+
const minYM = this.min ? PYM.fromString(this.min.slice(0, 7), CalendarFns.getBasic) : undefined;
|
|
358
|
+
const maxYM = this.max ? PYM.fromString(this.max.slice(0, 7), CalendarFns.getBasic) : undefined;
|
|
359
|
+
const isPrevDisabled = this.disabled || (minYM !== undefined && PYM.compare(prevMonth, minYM) < 0);
|
|
360
|
+
const isNextDisabled = this.disabled || (maxYM !== undefined && PYM.compare(nextMonth, maxYM) > 0);
|
|
361
|
+
return (h("div", { part: "header", class: "datepicker-header" }, h("lmvz-button", { part: "nav-prev", variant: "tertiary", scale: "small", "aria-label": navLabels.prev, disabled: isPrevDisabled, onLmvzActivation: () => this.navigateMonth(-1, true) }, h("lmvz-icon", { icon: CHEVRON_LEFT, "aria-hidden": "true" })), h("span", { id: this.monthLabelId, part: "month-label", class: "datepicker-month-label" }, monthYearLabel), h("lmvz-button", { part: "nav-next", variant: "tertiary", scale: "small", "aria-label": navLabels.next, disabled: isNextDisabled, onLmvzActivation: () => this.navigateMonth(1, true) }, h("lmvz-icon", { icon: CHEVRON_RIGHT, "aria-hidden": "true" }))));
|
|
362
|
+
}
|
|
363
|
+
renderWeekdayRow() {
|
|
364
|
+
const { locale } = this;
|
|
365
|
+
const mondayFirstDows = [1, 2, 3, 4, 5, 6, 7];
|
|
366
|
+
const refMonday = PDate.fromFields({ year: 2024, month: 1, day: 1 });
|
|
367
|
+
return (h("div", { part: "weekday-row", role: "row", class: "datepicker-weekday-row" }, mondayFirstDows.map((dow) => {
|
|
368
|
+
const refDate = PDate.addDays(refMonday, dow - 1);
|
|
369
|
+
const shortName = PDate.toLocaleString(refDate, locale, { weekday: 'short' });
|
|
370
|
+
const longName = PDate.toLocaleString(refDate, locale, { weekday: 'long' });
|
|
371
|
+
return (h("span", { part: "weekday", role: "columnheader", "aria-label": longName, class: "datepicker-weekday", key: dow }, h("abbr", { title: longName }, shortName)));
|
|
372
|
+
})));
|
|
373
|
+
}
|
|
374
|
+
renderGrid() {
|
|
375
|
+
const { locale, focusedDate } = this;
|
|
376
|
+
const vm = this.effectiveVisibleMonth;
|
|
377
|
+
const selectedDate = this.valueDate;
|
|
378
|
+
const minDate = parseIsoDateSafely(this.min);
|
|
379
|
+
const maxDate = parseIsoDateSafely(this.max);
|
|
380
|
+
const grid = (this.visibleDays = buildCalendarGrid(vm));
|
|
381
|
+
const weekdayAriaLabelFormatter = {
|
|
382
|
+
weekday: 'long',
|
|
383
|
+
day: 'numeric',
|
|
384
|
+
month: 'long',
|
|
385
|
+
year: 'numeric',
|
|
386
|
+
};
|
|
387
|
+
const weeks = [];
|
|
388
|
+
for (let w = 0; w < 6; w++) {
|
|
389
|
+
if (!grid.at(w * 7))
|
|
390
|
+
break;
|
|
391
|
+
weeks.push(grid.slice(w * 7, w * 7 + 7));
|
|
392
|
+
}
|
|
393
|
+
return (h("div", { part: "grid", role: "grid", "aria-labelledby": this.monthLabelId, class: "datepicker-grid" }, this.renderWeekdayRow(), weeks.map((week, wi) => (h("div", { part: "week-row", role: "row", class: "datepicker-week-row", key: wi }, week.map((date) => {
|
|
394
|
+
const iso = toIsoDateString(date);
|
|
395
|
+
const isTodayDate = PDate.compare(date, NowFns.plainDateISO()) === 0;
|
|
396
|
+
const isSelectedDate = isSelected(date, selectedDate);
|
|
397
|
+
const isOutOfMonth = PYM.compare(PDate.toPlainYearMonth(date), vm) !== 0;
|
|
398
|
+
const isDisabledDate = this.readonly || isDisabled(date, minDate, maxDate);
|
|
399
|
+
const isFocused = focusedDate !== undefined && PDate.compare(date, focusedDate) === 0;
|
|
400
|
+
const partMarkers = ['day'];
|
|
401
|
+
if (isTodayDate)
|
|
402
|
+
partMarkers.push('day--today');
|
|
403
|
+
if (isSelectedDate)
|
|
404
|
+
partMarkers.push('day--selected');
|
|
405
|
+
if (isOutOfMonth)
|
|
406
|
+
partMarkers.push('day--out-of-month');
|
|
407
|
+
if (isDisabledDate)
|
|
408
|
+
partMarkers.push('day--disabled');
|
|
409
|
+
const ariaLabel = PDate.toLocaleString(date, locale, weekdayAriaLabelFormatter);
|
|
410
|
+
let fromRender = false;
|
|
411
|
+
let buttonRef;
|
|
412
|
+
if (isFocused) {
|
|
413
|
+
requestAnimationFrame(() => {
|
|
414
|
+
const activeEl = this.el.shadowRoot?.activeElement;
|
|
415
|
+
if (!(activeEl instanceof HTMLButtonElement) || activeEl.getAttribute('role') !== 'gridcell')
|
|
416
|
+
return;
|
|
417
|
+
fromRender = true;
|
|
418
|
+
buttonRef?.focus();
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
return (h("button", { "data-debug-id": iso, role: "gridcell", type: "button", part: partMarkers.join(' '), tabIndex: isFocused ? 0 : -1, "aria-label": ariaLabel, "aria-selected": isSelectedDate ? 'true' : undefined, "aria-current": isTodayDate ? 'date' : undefined, "aria-disabled": isDisabledDate ? 'true' : undefined, onClick: () => {
|
|
422
|
+
if (isDisabledDate || this.disabled)
|
|
423
|
+
return;
|
|
424
|
+
this.selectDate(date, { origin: 'calendar', closePopover: true });
|
|
425
|
+
}, ref: (e) => {
|
|
426
|
+
buttonRef = e;
|
|
427
|
+
if (isFocused)
|
|
428
|
+
this.focusedButtonRef = e;
|
|
429
|
+
}, onFocus: (e) => {
|
|
430
|
+
console.log('focus event on grid cell', iso, e.target);
|
|
431
|
+
if (!this.el.shadowRoot?.contains(e.target))
|
|
432
|
+
return;
|
|
433
|
+
if (fromRender) {
|
|
434
|
+
fromRender = false;
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
this.setFocusedDate(date);
|
|
438
|
+
}, key: iso }, date.day));
|
|
439
|
+
}))))));
|
|
440
|
+
}
|
|
441
|
+
render() {
|
|
442
|
+
const validationLabels = getValidationLabels(this.locale);
|
|
443
|
+
const popoverLabel = this.label ? `${this.label} ${validationLabels.popoverSuffix}` : undefined;
|
|
444
|
+
return (h(Host, { key: 'af9d7f075bf97d7eb58c6557f43cf8a245d5f712' }, h("lmvz-input", { key: 'eef4be58281b8356d443c65c5cf6451192e70f75', ref: (el) => {
|
|
445
|
+
const wasUnset = !this.inputEl;
|
|
446
|
+
this.inputEl = el;
|
|
447
|
+
if (wasUnset && this.inputEl) {
|
|
448
|
+
forceUpdate(this);
|
|
449
|
+
}
|
|
450
|
+
}, label: this.label ?? '', placeholder: this.effectivePlaceholder, helperText: this.helperText, errorMessage: this.errorMessage, error: this.nativeError, disabled: this.disabled, readonly: this.readonly, required: this.required, value: this.inputText, autocomplete: "off", onLmvzInput: this.handleInputTextChange, onKeyDown: this.handleInputKeydown }, h("lmvz-icon", { key: 'fc39ef14720522a8089d33321b918e5577a36cc2', slot: "after-input", icon: CALENDAR_ICON, "aria-hidden": "true" })), h("lmvz-popover", { key: '0076c57da02c7c9d0fcb53584f9dc4127317d6a5', anchor: this.inputEl, open: this.open && !this.disabled, autoFocus: false, size: "md", label: popoverLabel, onLmvzOpen: this.handlePopoverOpen, onLmvzClose: this.handlePopoverClose }, h("div", { key: '4c1e716e52a5d9ed75155dded3c2c39649e1e844', part: "panel", class: "datepicker-panel" }, this.renderHeader(), this.renderGrid()))));
|
|
451
|
+
}
|
|
452
|
+
static get is() { return "lmvz-datepicker"; }
|
|
453
|
+
static get encapsulation() { return "shadow"; }
|
|
454
|
+
static get delegatesFocus() { return true; }
|
|
455
|
+
static get formAssociated() { return true; }
|
|
456
|
+
static get originalStyleUrls() {
|
|
457
|
+
return {
|
|
458
|
+
"$": ["./lmvz-datepicker.css"]
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
static get styleUrls() {
|
|
462
|
+
return {
|
|
463
|
+
"$": ["lmvz-datepicker.css"]
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
static get properties() {
|
|
467
|
+
return {
|
|
468
|
+
"value": {
|
|
469
|
+
"type": "string",
|
|
470
|
+
"mutable": false,
|
|
471
|
+
"complexType": {
|
|
472
|
+
"original": "`${number}-${number}-${number}` | undefined",
|
|
473
|
+
"resolved": "`${number}-${number}-${number}` | undefined",
|
|
474
|
+
"references": {}
|
|
475
|
+
},
|
|
476
|
+
"required": false,
|
|
477
|
+
"optional": false,
|
|
478
|
+
"docs": {
|
|
479
|
+
"tags": [],
|
|
480
|
+
"text": "The selected date in ISO `YYYY-MM-DD` format."
|
|
481
|
+
},
|
|
482
|
+
"getter": true,
|
|
483
|
+
"setter": true,
|
|
484
|
+
"reflect": false,
|
|
485
|
+
"attribute": "value"
|
|
486
|
+
},
|
|
487
|
+
"visibleMonth": {
|
|
488
|
+
"type": "string",
|
|
489
|
+
"mutable": false,
|
|
490
|
+
"complexType": {
|
|
491
|
+
"original": "IsoYearMonthString | undefined",
|
|
492
|
+
"resolved": "`${number}-${number}` | undefined",
|
|
493
|
+
"references": {
|
|
494
|
+
"IsoYearMonthString": {
|
|
495
|
+
"location": "import",
|
|
496
|
+
"path": "@lmvz-ds/lib-ts/date/IsoDateString.js",
|
|
497
|
+
"id": "../../lib/ts/src/date/IsoDateString.d.ts::IsoYearMonthString",
|
|
498
|
+
"referenceLocation": "IsoYearMonthString"
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
},
|
|
502
|
+
"required": false,
|
|
503
|
+
"optional": false,
|
|
504
|
+
"docs": {
|
|
505
|
+
"tags": [],
|
|
506
|
+
"text": "ISO year-month string (`YYYY-MM`) whose month is currently displayed.\nDefaults to the current month when unset."
|
|
507
|
+
},
|
|
508
|
+
"getter": true,
|
|
509
|
+
"setter": true,
|
|
510
|
+
"reflect": false,
|
|
511
|
+
"attribute": "visible-month"
|
|
512
|
+
},
|
|
513
|
+
"min": {
|
|
514
|
+
"type": "string",
|
|
515
|
+
"mutable": false,
|
|
516
|
+
"complexType": {
|
|
517
|
+
"original": "IsoDateString | undefined",
|
|
518
|
+
"resolved": "`${number}-${number}-${number}` | undefined",
|
|
519
|
+
"references": {
|
|
520
|
+
"IsoDateString": {
|
|
521
|
+
"location": "import",
|
|
522
|
+
"path": "@lmvz-ds/lib-ts/date/IsoDateString.js",
|
|
523
|
+
"id": "../../lib/ts/src/date/IsoDateString.d.ts::IsoDateString",
|
|
524
|
+
"referenceLocation": "IsoDateString"
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
},
|
|
528
|
+
"required": false,
|
|
529
|
+
"optional": false,
|
|
530
|
+
"docs": {
|
|
531
|
+
"tags": [],
|
|
532
|
+
"text": "Minimum selectable date in ISO `YYYY-MM-DD` format.\nDays before this date are disabled."
|
|
533
|
+
},
|
|
534
|
+
"getter": false,
|
|
535
|
+
"setter": false,
|
|
536
|
+
"reflect": false,
|
|
537
|
+
"attribute": "min"
|
|
538
|
+
},
|
|
539
|
+
"max": {
|
|
540
|
+
"type": "string",
|
|
541
|
+
"mutable": false,
|
|
542
|
+
"complexType": {
|
|
543
|
+
"original": "IsoDateString | undefined",
|
|
544
|
+
"resolved": "`${number}-${number}-${number}` | undefined",
|
|
545
|
+
"references": {
|
|
546
|
+
"IsoDateString": {
|
|
547
|
+
"location": "import",
|
|
548
|
+
"path": "@lmvz-ds/lib-ts/date/IsoDateString.js",
|
|
549
|
+
"id": "../../lib/ts/src/date/IsoDateString.d.ts::IsoDateString",
|
|
550
|
+
"referenceLocation": "IsoDateString"
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
},
|
|
554
|
+
"required": false,
|
|
555
|
+
"optional": false,
|
|
556
|
+
"docs": {
|
|
557
|
+
"tags": [],
|
|
558
|
+
"text": "Maximum selectable date in ISO `YYYY-MM-DD` format.\nDays after this date are disabled."
|
|
559
|
+
},
|
|
560
|
+
"getter": false,
|
|
561
|
+
"setter": false,
|
|
562
|
+
"reflect": false,
|
|
563
|
+
"attribute": "max"
|
|
564
|
+
},
|
|
565
|
+
"locale": {
|
|
566
|
+
"type": "string",
|
|
567
|
+
"mutable": false,
|
|
568
|
+
"complexType": {
|
|
569
|
+
"original": "string",
|
|
570
|
+
"resolved": "string",
|
|
571
|
+
"references": {}
|
|
572
|
+
},
|
|
573
|
+
"required": false,
|
|
574
|
+
"optional": false,
|
|
575
|
+
"docs": {
|
|
576
|
+
"tags": [{
|
|
577
|
+
"name": "default",
|
|
578
|
+
"text": "'de-CH'"
|
|
579
|
+
}],
|
|
580
|
+
"text": "BCP 47 locale tag used for weekday/month names, ARIA labels, and the default display format."
|
|
581
|
+
},
|
|
582
|
+
"getter": false,
|
|
583
|
+
"setter": false,
|
|
584
|
+
"reflect": false,
|
|
585
|
+
"attribute": "locale",
|
|
586
|
+
"defaultValue": "'de-CH'"
|
|
587
|
+
},
|
|
588
|
+
"firstDayOfWeek": {
|
|
589
|
+
"type": "number",
|
|
590
|
+
"mutable": false,
|
|
591
|
+
"complexType": {
|
|
592
|
+
"original": "0 | 1",
|
|
593
|
+
"resolved": "0 | 1",
|
|
594
|
+
"references": {}
|
|
595
|
+
},
|
|
596
|
+
"required": false,
|
|
597
|
+
"optional": false,
|
|
598
|
+
"docs": {
|
|
599
|
+
"tags": [{
|
|
600
|
+
"name": "default",
|
|
601
|
+
"text": "1"
|
|
602
|
+
}],
|
|
603
|
+
"text": "First day of the week: `0` = Sunday, `1` = Monday.\nMonday-first is hardcoded for v1; this prop is reserved for future runtime support."
|
|
604
|
+
},
|
|
605
|
+
"getter": false,
|
|
606
|
+
"setter": false,
|
|
607
|
+
"reflect": false,
|
|
608
|
+
"attribute": "first-day-of-week",
|
|
609
|
+
"defaultValue": "1"
|
|
610
|
+
},
|
|
611
|
+
"disabled": {
|
|
612
|
+
"type": "boolean",
|
|
613
|
+
"mutable": false,
|
|
614
|
+
"complexType": {
|
|
615
|
+
"original": "boolean",
|
|
616
|
+
"resolved": "boolean",
|
|
617
|
+
"references": {}
|
|
618
|
+
},
|
|
619
|
+
"required": false,
|
|
620
|
+
"optional": false,
|
|
621
|
+
"docs": {
|
|
622
|
+
"tags": [{
|
|
623
|
+
"name": "default",
|
|
624
|
+
"text": "false"
|
|
625
|
+
}],
|
|
626
|
+
"text": "Whether the entire datepicker (input + panel) is disabled."
|
|
627
|
+
},
|
|
628
|
+
"getter": false,
|
|
629
|
+
"setter": false,
|
|
630
|
+
"reflect": true,
|
|
631
|
+
"attribute": "disabled",
|
|
632
|
+
"defaultValue": "false"
|
|
633
|
+
},
|
|
634
|
+
"readonly": {
|
|
635
|
+
"type": "boolean",
|
|
636
|
+
"mutable": false,
|
|
637
|
+
"complexType": {
|
|
638
|
+
"original": "boolean",
|
|
639
|
+
"resolved": "boolean",
|
|
640
|
+
"references": {}
|
|
641
|
+
},
|
|
642
|
+
"required": false,
|
|
643
|
+
"optional": false,
|
|
644
|
+
"docs": {
|
|
645
|
+
"tags": [{
|
|
646
|
+
"name": "default",
|
|
647
|
+
"text": "false"
|
|
648
|
+
}],
|
|
649
|
+
"text": "Whether the datepicker is readonly. The text field cannot be typed into and the calendar cannot change the value,\nbut the value is still submitted with the form."
|
|
650
|
+
},
|
|
651
|
+
"getter": false,
|
|
652
|
+
"setter": false,
|
|
653
|
+
"reflect": true,
|
|
654
|
+
"attribute": "readonly",
|
|
655
|
+
"defaultValue": "false"
|
|
656
|
+
},
|
|
657
|
+
"required": {
|
|
658
|
+
"type": "boolean",
|
|
659
|
+
"mutable": false,
|
|
660
|
+
"complexType": {
|
|
661
|
+
"original": "boolean",
|
|
662
|
+
"resolved": "boolean",
|
|
663
|
+
"references": {}
|
|
664
|
+
},
|
|
665
|
+
"required": false,
|
|
666
|
+
"optional": false,
|
|
667
|
+
"docs": {
|
|
668
|
+
"tags": [{
|
|
669
|
+
"name": "default",
|
|
670
|
+
"text": "false"
|
|
671
|
+
}],
|
|
672
|
+
"text": "Whether a value is required for the form to be valid."
|
|
673
|
+
},
|
|
674
|
+
"getter": false,
|
|
675
|
+
"setter": false,
|
|
676
|
+
"reflect": true,
|
|
677
|
+
"attribute": "required",
|
|
678
|
+
"defaultValue": "false"
|
|
679
|
+
},
|
|
680
|
+
"name": {
|
|
681
|
+
"type": "string",
|
|
682
|
+
"mutable": false,
|
|
683
|
+
"complexType": {
|
|
684
|
+
"original": "string",
|
|
685
|
+
"resolved": "string | undefined",
|
|
686
|
+
"references": {}
|
|
687
|
+
},
|
|
688
|
+
"required": false,
|
|
689
|
+
"optional": true,
|
|
690
|
+
"docs": {
|
|
691
|
+
"tags": [],
|
|
692
|
+
"text": "Name submitted with the form."
|
|
693
|
+
},
|
|
694
|
+
"getter": false,
|
|
695
|
+
"setter": false,
|
|
696
|
+
"reflect": true,
|
|
697
|
+
"attribute": "name"
|
|
698
|
+
},
|
|
699
|
+
"label": {
|
|
700
|
+
"type": "string",
|
|
701
|
+
"mutable": false,
|
|
702
|
+
"complexType": {
|
|
703
|
+
"original": "string",
|
|
704
|
+
"resolved": "string | undefined",
|
|
705
|
+
"references": {}
|
|
706
|
+
},
|
|
707
|
+
"required": false,
|
|
708
|
+
"optional": true,
|
|
709
|
+
"docs": {
|
|
710
|
+
"tags": [],
|
|
711
|
+
"text": "Label for the composed text field."
|
|
712
|
+
},
|
|
713
|
+
"getter": false,
|
|
714
|
+
"setter": false,
|
|
715
|
+
"reflect": false,
|
|
716
|
+
"attribute": "label"
|
|
717
|
+
},
|
|
718
|
+
"placeholder": {
|
|
719
|
+
"type": "string",
|
|
720
|
+
"mutable": false,
|
|
721
|
+
"complexType": {
|
|
722
|
+
"original": "string",
|
|
723
|
+
"resolved": "string | undefined",
|
|
724
|
+
"references": {}
|
|
725
|
+
},
|
|
726
|
+
"required": false,
|
|
727
|
+
"optional": true,
|
|
728
|
+
"docs": {
|
|
729
|
+
"tags": [],
|
|
730
|
+
"text": "Placeholder for the composed text field. Defaults to the locale-derived display pattern (e.g. `dd.MM.yyyy`)."
|
|
731
|
+
},
|
|
732
|
+
"getter": false,
|
|
733
|
+
"setter": false,
|
|
734
|
+
"reflect": false,
|
|
735
|
+
"attribute": "placeholder"
|
|
736
|
+
},
|
|
737
|
+
"helperText": {
|
|
738
|
+
"type": "string",
|
|
739
|
+
"mutable": false,
|
|
740
|
+
"complexType": {
|
|
741
|
+
"original": "string",
|
|
742
|
+
"resolved": "string | undefined",
|
|
743
|
+
"references": {}
|
|
744
|
+
},
|
|
745
|
+
"required": false,
|
|
746
|
+
"optional": true,
|
|
747
|
+
"docs": {
|
|
748
|
+
"tags": [],
|
|
749
|
+
"text": "Helper text displayed below the text field."
|
|
750
|
+
},
|
|
751
|
+
"getter": false,
|
|
752
|
+
"setter": false,
|
|
753
|
+
"reflect": false,
|
|
754
|
+
"attribute": "helper-text"
|
|
755
|
+
},
|
|
756
|
+
"errorMessage": {
|
|
757
|
+
"type": "string",
|
|
758
|
+
"mutable": false,
|
|
759
|
+
"complexType": {
|
|
760
|
+
"original": "string",
|
|
761
|
+
"resolved": "string | undefined",
|
|
762
|
+
"references": {}
|
|
763
|
+
},
|
|
764
|
+
"required": false,
|
|
765
|
+
"optional": true,
|
|
766
|
+
"docs": {
|
|
767
|
+
"tags": [],
|
|
768
|
+
"text": "Error message displayed below the text field when the value is invalid."
|
|
769
|
+
},
|
|
770
|
+
"getter": false,
|
|
771
|
+
"setter": false,
|
|
772
|
+
"reflect": false,
|
|
773
|
+
"attribute": "error-message"
|
|
774
|
+
},
|
|
775
|
+
"open": {
|
|
776
|
+
"type": "boolean",
|
|
777
|
+
"mutable": true,
|
|
778
|
+
"complexType": {
|
|
779
|
+
"original": "boolean",
|
|
780
|
+
"resolved": "boolean",
|
|
781
|
+
"references": {}
|
|
782
|
+
},
|
|
783
|
+
"required": false,
|
|
784
|
+
"optional": false,
|
|
785
|
+
"docs": {
|
|
786
|
+
"tags": [{
|
|
787
|
+
"name": "default",
|
|
788
|
+
"text": "false"
|
|
789
|
+
}],
|
|
790
|
+
"text": "Whether the calendar popover is open. Reflects the actual open state \u2014 it is kept\nin sync with focus/keyboard interactions and with light-dismiss/Escape closing."
|
|
791
|
+
},
|
|
792
|
+
"getter": false,
|
|
793
|
+
"setter": false,
|
|
794
|
+
"reflect": true,
|
|
795
|
+
"attribute": "open",
|
|
796
|
+
"defaultValue": "false"
|
|
797
|
+
},
|
|
798
|
+
"displayFormat": {
|
|
799
|
+
"type": "string",
|
|
800
|
+
"mutable": false,
|
|
801
|
+
"complexType": {
|
|
802
|
+
"original": "Datepicker.DisplayFormat",
|
|
803
|
+
"resolved": "string | undefined",
|
|
804
|
+
"references": {
|
|
805
|
+
"Datepicker": {
|
|
806
|
+
"location": "import",
|
|
807
|
+
"path": "../../api",
|
|
808
|
+
"id": "src/api/index.d.ts::Datepicker",
|
|
809
|
+
"referenceLocation": "Datepicker"
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
},
|
|
813
|
+
"required": false,
|
|
814
|
+
"optional": true,
|
|
815
|
+
"docs": {
|
|
816
|
+
"tags": [],
|
|
817
|
+
"text": "Custom display-format pattern for the text field, using the tokens `yyyy`, `MM`, `dd`\n(e.g. `'dd.MM.yyyy'`). Defaults to a pattern derived from `locale`."
|
|
818
|
+
},
|
|
819
|
+
"getter": false,
|
|
820
|
+
"setter": false,
|
|
821
|
+
"reflect": false,
|
|
822
|
+
"attribute": "display-format"
|
|
823
|
+
}
|
|
824
|
+
};
|
|
825
|
+
}
|
|
826
|
+
static get states() {
|
|
827
|
+
return {
|
|
828
|
+
"focusedDate": {},
|
|
829
|
+
"valueDate": {},
|
|
830
|
+
"visibleMonthDate": {},
|
|
831
|
+
"inputText": {},
|
|
832
|
+
"hasUnparseableInput": {},
|
|
833
|
+
"isInvalid": {},
|
|
834
|
+
"nativeError": {}
|
|
835
|
+
};
|
|
836
|
+
}
|
|
837
|
+
static get events() {
|
|
838
|
+
return [{
|
|
839
|
+
"method": "lmvzChange",
|
|
840
|
+
"name": "lmvzChange",
|
|
841
|
+
"bubbles": true,
|
|
842
|
+
"cancelable": true,
|
|
843
|
+
"composed": true,
|
|
844
|
+
"docs": {
|
|
845
|
+
"tags": [],
|
|
846
|
+
"text": "Emitted when the user selects a date (via the calendar grid or by typing a complete valid date).\nThe `value` field carries an IsoDateString representing the selected date."
|
|
847
|
+
},
|
|
848
|
+
"complexType": {
|
|
849
|
+
"original": "{ value: IsoDateString | undefined }",
|
|
850
|
+
"resolved": "{ value: `${number}-${number}-${number}` | undefined; }",
|
|
851
|
+
"references": {
|
|
852
|
+
"IsoDateString": {
|
|
853
|
+
"location": "import",
|
|
854
|
+
"path": "@lmvz-ds/lib-ts/date/IsoDateString.js",
|
|
855
|
+
"id": "../../lib/ts/src/date/IsoDateString.d.ts::IsoDateString",
|
|
856
|
+
"referenceLocation": "IsoDateString"
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
}, {
|
|
861
|
+
"method": "lmvzMonthChange",
|
|
862
|
+
"name": "lmvzMonthChange",
|
|
863
|
+
"bubbles": true,
|
|
864
|
+
"cancelable": true,
|
|
865
|
+
"composed": true,
|
|
866
|
+
"docs": {
|
|
867
|
+
"tags": [],
|
|
868
|
+
"text": "Emitted when the displayed month changes via prev/next navigation.\nThe `visibleMonth` field carries an IsoYearMonthString representing the new month."
|
|
869
|
+
},
|
|
870
|
+
"complexType": {
|
|
871
|
+
"original": "{ visibleMonth: IsoYearMonthString }",
|
|
872
|
+
"resolved": "{ visibleMonth: `${number}-${number}`; }",
|
|
873
|
+
"references": {
|
|
874
|
+
"IsoYearMonthString": {
|
|
875
|
+
"location": "import",
|
|
876
|
+
"path": "@lmvz-ds/lib-ts/date/IsoDateString.js",
|
|
877
|
+
"id": "../../lib/ts/src/date/IsoDateString.d.ts::IsoYearMonthString",
|
|
878
|
+
"referenceLocation": "IsoYearMonthString"
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
}, {
|
|
883
|
+
"method": "lmvzOpen",
|
|
884
|
+
"name": "lmvzOpen",
|
|
885
|
+
"bubbles": true,
|
|
886
|
+
"cancelable": true,
|
|
887
|
+
"composed": true,
|
|
888
|
+
"docs": {
|
|
889
|
+
"tags": [],
|
|
890
|
+
"text": "Forwarded from the internal popover: fired after the calendar panel opens."
|
|
891
|
+
},
|
|
892
|
+
"complexType": {
|
|
893
|
+
"original": "void",
|
|
894
|
+
"resolved": "void",
|
|
895
|
+
"references": {}
|
|
896
|
+
}
|
|
897
|
+
}, {
|
|
898
|
+
"method": "lmvzClose",
|
|
899
|
+
"name": "lmvzClose",
|
|
900
|
+
"bubbles": true,
|
|
901
|
+
"cancelable": true,
|
|
902
|
+
"composed": true,
|
|
903
|
+
"docs": {
|
|
904
|
+
"tags": [],
|
|
905
|
+
"text": "Forwarded from the internal popover: fired after the calendar panel closes."
|
|
906
|
+
},
|
|
907
|
+
"complexType": {
|
|
908
|
+
"original": "void",
|
|
909
|
+
"resolved": "void",
|
|
910
|
+
"references": {}
|
|
911
|
+
}
|
|
912
|
+
}];
|
|
913
|
+
}
|
|
914
|
+
static get methods() {
|
|
915
|
+
return {
|
|
916
|
+
"checkValidity": {
|
|
917
|
+
"complexType": {
|
|
918
|
+
"signature": "() => Promise<boolean>",
|
|
919
|
+
"parameters": [],
|
|
920
|
+
"references": {
|
|
921
|
+
"Promise": {
|
|
922
|
+
"location": "global",
|
|
923
|
+
"id": "global::Promise"
|
|
924
|
+
}
|
|
925
|
+
},
|
|
926
|
+
"return": "Promise<boolean>"
|
|
927
|
+
},
|
|
928
|
+
"docs": {
|
|
929
|
+
"text": "Returns whether the current value satisfies `required`/`min`/`max` and is a parseable date.\nUnlike a native `<input>`, form-associated custom elements do not forward `ElementInternals`'\nconstraint-validation API to the element automatically \u2014 this delegates to it explicitly.",
|
|
930
|
+
"tags": []
|
|
931
|
+
}
|
|
932
|
+
},
|
|
933
|
+
"reportValidity": {
|
|
934
|
+
"complexType": {
|
|
935
|
+
"signature": "() => Promise<boolean>",
|
|
936
|
+
"parameters": [],
|
|
937
|
+
"references": {
|
|
938
|
+
"Promise": {
|
|
939
|
+
"location": "global",
|
|
940
|
+
"id": "global::Promise"
|
|
941
|
+
}
|
|
942
|
+
},
|
|
943
|
+
"return": "Promise<boolean>"
|
|
944
|
+
},
|
|
945
|
+
"docs": {
|
|
946
|
+
"text": "Reports validation errors to the user (e.g. shows the browser's native validation bubble)\nand returns whether the current value is valid.",
|
|
947
|
+
"tags": []
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
};
|
|
951
|
+
}
|
|
952
|
+
static get elementRef() { return "el"; }
|
|
953
|
+
static get watchers() {
|
|
954
|
+
return [{
|
|
955
|
+
"propName": "required",
|
|
956
|
+
"methodName": "handleValidityRelevantPropChange"
|
|
957
|
+
}, {
|
|
958
|
+
"propName": "min",
|
|
959
|
+
"methodName": "handleValidityRelevantPropChange"
|
|
960
|
+
}, {
|
|
961
|
+
"propName": "max",
|
|
962
|
+
"methodName": "handleValidityRelevantPropChange"
|
|
963
|
+
}, {
|
|
964
|
+
"propName": "locale",
|
|
965
|
+
"methodName": "handleDisplayFormatChange"
|
|
966
|
+
}, {
|
|
967
|
+
"propName": "displayFormat",
|
|
968
|
+
"methodName": "handleDisplayFormatChange"
|
|
969
|
+
}, {
|
|
970
|
+
"propName": "disabled",
|
|
971
|
+
"methodName": "handleDisabledChange"
|
|
972
|
+
}];
|
|
973
|
+
}
|
|
974
|
+
static get listeners() {
|
|
975
|
+
return [{
|
|
976
|
+
"name": "keydown",
|
|
977
|
+
"method": "handleKeydown",
|
|
978
|
+
"target": undefined,
|
|
979
|
+
"capture": false,
|
|
980
|
+
"passive": false
|
|
981
|
+
}, {
|
|
982
|
+
"name": "focusin",
|
|
983
|
+
"method": "handleInputFocus",
|
|
984
|
+
"target": undefined,
|
|
985
|
+
"capture": false,
|
|
986
|
+
"passive": false
|
|
987
|
+
}, {
|
|
988
|
+
"name": "click",
|
|
989
|
+
"method": "handleInputFocus",
|
|
990
|
+
"target": undefined,
|
|
991
|
+
"capture": false,
|
|
992
|
+
"passive": false
|
|
993
|
+
}, {
|
|
994
|
+
"name": "invalid",
|
|
995
|
+
"method": "handleInvalid",
|
|
996
|
+
"target": undefined,
|
|
997
|
+
"capture": false,
|
|
998
|
+
"passive": false
|
|
999
|
+
}];
|
|
1000
|
+
}
|
|
1001
|
+
static get attachInternalsMemberName() { return "internals"; }
|
|
1002
|
+
}
|