@haiilo/catalyst 10.4.0 → 10.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/catalyst/catalyst.css +2 -2
- package/dist/catalyst/catalyst.esm.js +1 -1
- package/dist/catalyst/catalyst.esm.js.map +1 -1
- package/dist/catalyst/index.esm.js +1 -1
- package/dist/catalyst/index.esm.js.map +1 -1
- package/dist/catalyst/p-2c8ac8cf.js +2 -0
- package/dist/catalyst/p-2c8ac8cf.js.map +1 -0
- package/dist/catalyst/p-b2ec6eb3.entry.js +10 -0
- package/dist/catalyst/p-b2ec6eb3.entry.js.map +1 -0
- package/dist/catalyst/scss/_variables.scss +0 -1
- package/dist/catalyst/scss/core/_form.scss +2 -2
- package/dist/cjs/{cat-alert_28.cjs.entry.js → cat-alert_29.cjs.entry.js} +387 -218
- package/dist/cjs/cat-alert_29.cjs.entry.js.map +1 -0
- package/dist/cjs/catalyst.cjs.js +1 -1
- package/dist/cjs/index.cjs.js +4 -1
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{of-45281229.js → of-f2844da8.js} +12 -4
- package/dist/cjs/of-f2844da8.js.map +1 -0
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/cat-button/cat-button.css +12 -2
- package/dist/collection/components/cat-checkbox/cat-checkbox.css +2 -1
- package/dist/collection/components/cat-date/cat-date.css +2 -96
- package/dist/collection/components/cat-date/cat-date.js +77 -245
- package/dist/collection/components/cat-date/cat-date.js.map +1 -1
- package/dist/collection/components/cat-date/cat-date.spec.js +2 -1
- package/dist/collection/components/cat-date/cat-date.spec.js.map +1 -1
- package/dist/collection/components/cat-date-inline/cat-date-inline.css +166 -0
- package/dist/collection/components/cat-date-inline/cat-date-inline.e2e.js +11 -0
- package/dist/collection/components/cat-date-inline/cat-date-inline.e2e.js.map +1 -0
- package/dist/collection/components/cat-date-inline/cat-date-inline.js +505 -0
- package/dist/collection/components/cat-date-inline/cat-date-inline.js.map +1 -0
- package/dist/collection/components/cat-date-inline/cat-date-inline.spec.js +16 -0
- package/dist/collection/components/cat-date-inline/cat-date-inline.spec.js.map +1 -0
- package/dist/collection/components/{cat-date → cat-date-inline}/cat-date-locale.js +22 -1
- package/dist/collection/components/cat-date-inline/cat-date-locale.js.map +1 -0
- package/dist/collection/components/cat-date-inline/cat-date-math.js.map +1 -0
- package/dist/collection/components/cat-datepicker/cat-datepicker.js +2 -2
- package/dist/collection/components/cat-datepicker-inline/cat-datepicker-inline.js +2 -2
- package/dist/collection/components/cat-dropdown/cat-dropdown.js +29 -2
- package/dist/collection/components/cat-dropdown/cat-dropdown.js.map +1 -1
- package/dist/collection/components/cat-form-group/cat-form-group.js +4 -1
- package/dist/collection/components/cat-form-group/cat-form-group.js.map +1 -1
- package/dist/collection/components/cat-i18n/cat-i18n-registry.js +6 -0
- package/dist/collection/components/cat-i18n/cat-i18n-registry.js.map +1 -1
- package/dist/collection/components/cat-icon/cat-icon-registry.js +4 -2
- package/dist/collection/components/cat-icon/cat-icon-registry.js.map +1 -1
- package/dist/collection/components/cat-icon/cat-icon.js +1 -1
- package/dist/collection/components/cat-input/cat-input.js +4 -4
- package/dist/collection/components/cat-notification/cat-notification.js +3 -0
- package/dist/collection/components/cat-notification/cat-notification.js.map +1 -1
- package/dist/collection/components/cat-pagination/cat-pagination.js +2 -2
- package/dist/collection/components/cat-radio/cat-radio.css +1 -1
- package/dist/collection/components/cat-radio/cat-radio.js +1 -1
- package/dist/collection/components/cat-radio-group/cat-radio-group.js +1 -1
- package/dist/collection/components/cat-scrollable/cat-scrollable.js +3 -3
- package/dist/collection/components/cat-select/cat-select.js +5 -5
- package/dist/collection/components/cat-select-demo/cat-select-demo.js +1 -1
- package/dist/collection/components/cat-skeleton/cat-skeleton.js +1 -1
- package/dist/collection/components/cat-spinner/cat-spinner.js +2 -2
- package/dist/collection/components/cat-tab/cat-tab.js +1 -1
- package/dist/collection/components/cat-tabs/cat-tabs.js +1 -1
- package/dist/collection/components/cat-textarea/cat-textarea.js +3 -3
- package/dist/collection/components/cat-time/cat-time-locale.js +3 -0
- package/dist/collection/components/cat-time/cat-time-locale.js.map +1 -1
- package/dist/collection/components/cat-time/cat-time.js +39 -8
- package/dist/collection/components/cat-time/cat-time.js.map +1 -1
- package/dist/collection/components/cat-toggle/cat-toggle.css +1 -1
- package/dist/collection/components/cat-toggle/cat-toggle.js +1 -1
- package/dist/collection/components/cat-tooltip/cat-tooltip.js +7 -2
- package/dist/collection/components/cat-tooltip/cat-tooltip.js.map +1 -1
- package/dist/collection/scss/_variables.scss +0 -1
- package/dist/collection/scss/core/_form.scss +2 -2
- package/dist/components/cat-button2.js +1 -1
- package/dist/components/cat-button2.js.map +1 -1
- package/dist/components/cat-checkbox2.js +1 -1
- package/dist/components/cat-checkbox2.js.map +1 -1
- package/dist/components/cat-date-inline.d.ts +11 -0
- package/dist/components/cat-date-inline.js +8 -0
- package/dist/components/cat-date-inline.js.map +1 -0
- package/dist/components/cat-date-inline2.js +386 -0
- package/dist/components/cat-date-inline2.js.map +1 -0
- package/dist/components/cat-date.js +83 -283
- package/dist/components/cat-date.js.map +1 -1
- package/dist/components/cat-datepicker-inline.js +2 -2
- package/dist/components/cat-datepicker.js +2 -2
- package/dist/components/cat-dropdown2.js +8 -2
- package/dist/components/cat-dropdown2.js.map +1 -1
- package/dist/components/cat-form-group.js +1 -1
- package/dist/components/cat-form-group.js.map +1 -1
- package/dist/components/cat-i18n-registry.js +6 -0
- package/dist/components/cat-i18n-registry.js.map +1 -1
- package/dist/components/cat-icon-registry.js +4 -2
- package/dist/components/cat-icon-registry.js.map +1 -1
- package/dist/components/cat-icon2.js +1 -1
- package/dist/components/cat-input2.js +4 -4
- package/dist/components/cat-pagination.js +2 -2
- package/dist/components/cat-radio-group.js +1 -1
- package/dist/components/cat-radio.js +2 -2
- package/dist/components/cat-radio.js.map +1 -1
- package/dist/components/cat-scrollable2.js +8 -6
- package/dist/components/cat-scrollable2.js.map +1 -1
- package/dist/components/cat-select-demo.js +3 -3
- package/dist/components/cat-select-demo.js.map +1 -1
- package/dist/components/cat-select2.js.map +1 -1
- package/dist/components/cat-skeleton2.js +1 -1
- package/dist/components/cat-spinner2.js +2 -2
- package/dist/components/cat-tab.js +1 -1
- package/dist/components/cat-tabs.js +1 -1
- package/dist/components/cat-textarea.js +3 -3
- package/dist/components/cat-time.js +37 -8
- package/dist/components/cat-time.js.map +1 -1
- package/dist/components/cat-toggle.js +2 -2
- package/dist/components/cat-toggle.js.map +1 -1
- package/dist/components/cat-tooltip.js +2 -2
- package/dist/components/cat-tooltip.js.map +1 -1
- package/dist/components/floating-ui.dom.esm.js +38 -30
- package/dist/components/floating-ui.dom.esm.js.map +1 -1
- package/dist/components/from.js +1 -1
- package/dist/components/from.js.map +1 -1
- package/dist/components/index.js +3 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/of.js.map +1 -1
- package/dist/esm/{cat-alert_28.entry.js → cat-alert_29.entry.js} +387 -219
- package/dist/esm/cat-alert_29.entry.js.map +1 -0
- package/dist/esm/catalyst.js +1 -1
- package/dist/esm/index.js +5 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{of-19888f3b.js → of-53334b95.js} +12 -4
- package/dist/esm/of-53334b95.js.map +1 -0
- package/dist/types/components/cat-date/cat-date.d.ts +11 -31
- package/dist/types/components/cat-date-inline/cat-date-inline.d.ts +81 -0
- package/dist/types/components/{cat-date → cat-date-inline}/cat-date-locale.d.ts +5 -0
- package/dist/types/components/cat-dropdown/cat-dropdown.d.ts +9 -0
- package/dist/types/components/cat-form-group/cat-form-group.d.ts +3 -0
- package/dist/types/components/cat-i18n/cat-i18n-registry.d.ts +6 -0
- package/dist/types/components/cat-icon/cat-icon-registry.d.ts +1 -0
- package/dist/types/components/cat-notification/cat-notification.d.ts +3 -0
- package/dist/types/components/cat-time/cat-time-locale.d.ts +1 -0
- package/dist/types/components/cat-time/cat-time.d.ts +6 -1
- package/dist/types/components/cat-tooltip/cat-tooltip.d.ts +5 -0
- package/dist/types/components.d.ts +209 -5
- package/package.json +2 -2
- package/dist/catalyst/p-81800b65.js +0 -2
- package/dist/catalyst/p-81800b65.js.map +0 -1
- package/dist/catalyst/p-8a1d505d.entry.js +0 -10
- package/dist/catalyst/p-8a1d505d.entry.js.map +0 -1
- package/dist/cjs/cat-alert_28.cjs.entry.js.map +0 -1
- package/dist/cjs/of-45281229.js.map +0 -1
- package/dist/collection/components/cat-date/cat-date-locale.js.map +0 -1
- package/dist/collection/components/cat-date/cat-date-math.js.map +0 -1
- package/dist/esm/cat-alert_28.entry.js.map +0 -1
- package/dist/esm/of-19888f3b.js.map +0 -1
- /package/dist/collection/components/{cat-date → cat-date-inline}/cat-date-math.js +0 -0
- /package/dist/types/components/{cat-date → cat-date-inline}/cat-date-math.d.ts +0 -0
|
@@ -1,93 +1,13 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
import { g as getLocale, c as clampDate, d as defineCustomElement$6 } from './cat-date-inline2.js';
|
|
2
3
|
import { c as catI18nRegistry } from './cat-i18n-registry.js';
|
|
3
|
-
import { d as defineCustomElement$
|
|
4
|
+
import { d as defineCustomElement$7 } from './cat-button2.js';
|
|
4
5
|
import { d as defineCustomElement$5 } from './cat-dropdown2.js';
|
|
5
6
|
import { d as defineCustomElement$4 } from './cat-icon2.js';
|
|
6
7
|
import { d as defineCustomElement$3 } from './cat-input2.js';
|
|
7
8
|
import { d as defineCustomElement$2 } from './cat-spinner2.js';
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
const date = new Date();
|
|
11
|
-
const firstDayOfWeek = (date.getUTCDate() - date.getUTCDay() + 7) % 7;
|
|
12
|
-
const format = new Intl.DateTimeFormat(language, { weekday }).format;
|
|
13
|
-
return [...Array(7).keys()].map(day => format(new Date(date.getTime()).setUTCDate(firstDayOfWeek + day)));
|
|
14
|
-
}
|
|
15
|
-
function getMonths(language, month = 'long') {
|
|
16
|
-
const date = new Date(0);
|
|
17
|
-
const format = new Intl.DateTimeFormat(language, { month }).format;
|
|
18
|
-
return [...Array(12).keys()].map(month => format(new Date(date.getTime()).setUTCMonth(month)));
|
|
19
|
-
}
|
|
20
|
-
function getWeekInfo(language) {
|
|
21
|
-
const locale = new Intl.Locale(language);
|
|
22
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
|
-
const weekInfo = locale.getWeekInfo?.() ?? locale.weekInfo;
|
|
24
|
-
return {
|
|
25
|
-
firstDay: weekInfo?.firstDay ?? 1,
|
|
26
|
-
minDays: weekInfo?.minDays ?? 4,
|
|
27
|
-
weekend: weekInfo?.weekend ?? [6, 7]
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
function getFormat(language) {
|
|
31
|
-
const format = new Intl.DateTimeFormat(language, { year: 'numeric', month: '2-digit', day: '2-digit' })
|
|
32
|
-
.format(new Date(3456, 10, 22))
|
|
33
|
-
.replace('3456', 'YYYY')
|
|
34
|
-
.replace('56', 'YY')
|
|
35
|
-
.replace('11', 'MM')
|
|
36
|
-
.replace('22', 'DD');
|
|
37
|
-
return /^(YYYY|YY|MM|DD)\W(YYYY|YY|MM|DD)\W(YYYY|YY|MM|DD)$/.test(format) ? format : 'DD-MM-YYYY';
|
|
38
|
-
}
|
|
39
|
-
function getLocale(language) {
|
|
40
|
-
return {
|
|
41
|
-
prevYear: catI18nRegistry.t('datepicker.prevYear'),
|
|
42
|
-
nextYear: catI18nRegistry.t('datepicker.nextYear'),
|
|
43
|
-
prevMonth: catI18nRegistry.t('datepicker.prevMonth'),
|
|
44
|
-
nextMonth: catI18nRegistry.t('datepicker.nextMonth'),
|
|
45
|
-
arrowKeys: catI18nRegistry.t('datepicker.arrowKeys'),
|
|
46
|
-
today: catI18nRegistry.t('datepicker.today'),
|
|
47
|
-
change: catI18nRegistry.t('datepicker.change'),
|
|
48
|
-
choose: catI18nRegistry.t('datepicker.choose'),
|
|
49
|
-
formatStr: getFormat(language),
|
|
50
|
-
weekInfo: getWeekInfo(language),
|
|
51
|
-
days: {
|
|
52
|
-
short: getDays(language, 'short'),
|
|
53
|
-
long: getDays(language, 'long')
|
|
54
|
-
},
|
|
55
|
-
months: {
|
|
56
|
-
short: getMonths(language, 'short'),
|
|
57
|
-
long: getMonths(language, 'long')
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function isLeapYear(year) {
|
|
63
|
-
return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
|
|
64
|
-
}
|
|
65
|
-
function addDays(date, n) {
|
|
66
|
-
return new Date(date.getFullYear(), date.getMonth(), date.getDate() + n);
|
|
67
|
-
}
|
|
68
|
-
function addMonth(date, n) {
|
|
69
|
-
const [year, month, day] = [date.getFullYear(), date.getMonth(), date.getDate()];
|
|
70
|
-
const maxDays = [31, isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
71
|
-
const newDate = new Date(date);
|
|
72
|
-
newDate.setDate(1);
|
|
73
|
-
newDate.setMonth(newDate.getMonth() + n);
|
|
74
|
-
newDate.setDate(Math.min(day, maxDays[(month + (n % 12) + 12) % 12]));
|
|
75
|
-
return newDate;
|
|
76
|
-
}
|
|
77
|
-
function isSameYear(date1, date2) {
|
|
78
|
-
return !!date1 && !!date2 && date1.getFullYear() === date2.getFullYear();
|
|
79
|
-
}
|
|
80
|
-
function isSameMonth(date1, date2) {
|
|
81
|
-
return !!date1 && !!date2 && date1.getMonth() === date2.getMonth() && isSameYear(date1, date2);
|
|
82
|
-
}
|
|
83
|
-
function isSameDay(date1, date2) {
|
|
84
|
-
return !!date1 && !!date2 && date1.getDate() === date2.getDate() && isSameMonth(date1, date2);
|
|
85
|
-
}
|
|
86
|
-
function clampDate(min, date, max) {
|
|
87
|
-
return new Date(Math.min(Math.max(date.getTime(), min?.getTime() ?? -Infinity), max?.getTime() ?? Infinity));
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
const catDateCss = ":host{display:block}:host([hidden]){display:none}.label-aria{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.picker{padding:1rem;display:inline-flex;flex-direction:column}.picker-head{display:flex;gap:0.5rem;align-items:center}.picker-head h3{flex:1;text-align:center;margin:0}.picker-grid{display:grid;grid-template-rows:2rem repeat(6, 1fr);grid-template-columns:2rem repeat(7, 1fr);grid-template-areas:\". h h h h h h h\" \"w d d d d d d d\" \"w d d d d d d d\" \"w d d d d d d d\" \"w d d d d d d d\" \"w d d d d d d d\" \"w d d d d d d d\";margin:1rem 0 0.5rem}.picker-grid-head{grid-area:h;display:grid;grid-template-columns:repeat(7, 1fr);place-items:end center;padding-bottom:0.5rem}.picker-grid-weeks{grid-area:w;display:grid;grid-template-rows:repeat(6, 1fr);place-items:center right;padding-right:0.5rem}.picker-grid-days{grid-area:d;display:grid;grid-template-rows:repeat(6, 1fr);grid-template-columns:repeat(7, 1fr)}.picker-grid-head>*,.picker-grid-weeks>*{font-size:0.75rem;line-height:1rem;font-weight:600;color:rgb(var(--cat-font-color-muted, 81, 92, 108)) !important;text-decoration:none}.date-other{opacity:0.5}.date-disabled{opacity:0.25}.picker-foot{display:flex;gap:1rem;align-items:center}.cursor-help{flex:1;margin:0;font-size:0.875rem;line-height:1.125rem;font-weight:var(--cat-font-weight-body, 400);color:rgb(var(--cat-font-color-muted, 81, 92, 108)) !important;text-align:center}.cursor-help.cursor-right{text-align:right}.cursor-aria{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}";
|
|
10
|
+
const catDateCss = ":host{display:block}:host([hidden]){display:none}.label-aria{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}cat-date-inline{margin:1rem}";
|
|
91
11
|
const CatDateStyle0 = catDateCss;
|
|
92
12
|
|
|
93
13
|
const CatDate$1 = /*@__PURE__*/ proxyCustomElement(class CatDate extends HTMLElement {
|
|
@@ -100,13 +20,8 @@ const CatDate$1 = /*@__PURE__*/ proxyCustomElement(class CatDate extends HTMLEle
|
|
|
100
20
|
this.catBlur = createEvent(this, "catBlur", 7);
|
|
101
21
|
this.language = catI18nRegistry.getLocale();
|
|
102
22
|
this.locale = getLocale(this.language);
|
|
103
|
-
this.isOpen = false;
|
|
104
|
-
// additonally store the focus date to ensure correct focus after potential re-render
|
|
105
|
-
this.focusDate = null;
|
|
106
23
|
this.hasSlottedLabel = false;
|
|
107
24
|
this.hasSlottedHint = false;
|
|
108
|
-
this.viewDate = this.now;
|
|
109
|
-
this.selectionDate = null;
|
|
110
25
|
this.requiredMarker = 'optional';
|
|
111
26
|
this.horizontal = false;
|
|
112
27
|
this.autoComplete = undefined;
|
|
@@ -132,29 +47,24 @@ const CatDate$1 = /*@__PURE__*/ proxyCustomElement(class CatDate extends HTMLEle
|
|
|
132
47
|
this.nativeAttributes = undefined;
|
|
133
48
|
this.placement = 'bottom-end';
|
|
134
49
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
get minDate() {
|
|
140
|
-
const [y, m, d] = this.min?.split('-').map(Number) || [];
|
|
141
|
-
return this.min ? new Date(y, m - 1, d) : null;
|
|
142
|
-
}
|
|
143
|
-
get now() {
|
|
144
|
-
const date = new Date();
|
|
145
|
-
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
|
50
|
+
onMinChanged(min, oldMin) {
|
|
51
|
+
if (min !== oldMin) {
|
|
52
|
+
this.reclamp('min', min);
|
|
53
|
+
}
|
|
146
54
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
return all ? new Date(Number(year), Number(month) - 1, Number(day)) : null;
|
|
55
|
+
onMaxChanged(max, oldMax) {
|
|
56
|
+
if (max !== oldMax) {
|
|
57
|
+
this.reclamp('max', max);
|
|
58
|
+
}
|
|
152
59
|
}
|
|
153
|
-
|
|
60
|
+
get inputValue() {
|
|
154
61
|
const [match, year, month, day] = this.value?.match(/^(\d{4})-(\d{2})-(\d{2})/) ?? [];
|
|
155
62
|
if (match) {
|
|
156
|
-
|
|
63
|
+
const date = new Date(Number(year), Number(month) - 1, Number(day));
|
|
64
|
+
const format = new Intl.DateTimeFormat(this.language, { year: 'numeric', month: '2-digit', day: '2-digit' });
|
|
65
|
+
return format.format(date);
|
|
157
66
|
}
|
|
67
|
+
return '';
|
|
158
68
|
}
|
|
159
69
|
componentWillRender() {
|
|
160
70
|
this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
|
|
@@ -171,66 +81,6 @@ const CatDate$1 = /*@__PURE__*/ proxyCustomElement(class CatDate extends HTMLEle
|
|
|
171
81
|
datePattern: [p1, p2, p3]
|
|
172
82
|
});
|
|
173
83
|
}
|
|
174
|
-
componentDidRender() {
|
|
175
|
-
if (this.focusDate) {
|
|
176
|
-
this.hostElement.shadowRoot
|
|
177
|
-
?.querySelector(`[data-date="${this.toLocalISO(this.focusDate)}"]`)
|
|
178
|
-
?.doFocus();
|
|
179
|
-
this.focusDate = null;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
onOpen() {
|
|
183
|
-
this.isOpen = true;
|
|
184
|
-
this.setAriaLive('');
|
|
185
|
-
const viewDate = this.selectionDate
|
|
186
|
-
? new Date(this.selectionDate.getFullYear(), this.selectionDate.getMonth(), 1)
|
|
187
|
-
: this.now;
|
|
188
|
-
this.viewDate = clampDate(this.minDate, viewDate, this.maxDate);
|
|
189
|
-
}
|
|
190
|
-
onClose() {
|
|
191
|
-
this.isOpen = false;
|
|
192
|
-
}
|
|
193
|
-
onKeyDown(e) {
|
|
194
|
-
if (!this.isOpen || !['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown'].includes(e.key)) {
|
|
195
|
-
return;
|
|
196
|
-
}
|
|
197
|
-
const focused = this.focusedDate;
|
|
198
|
-
if (!focused) {
|
|
199
|
-
e.preventDefault();
|
|
200
|
-
this.focus(this.selectionDate || this.now);
|
|
201
|
-
}
|
|
202
|
-
else if (e.key === 'ArrowLeft') {
|
|
203
|
-
e.preventDefault();
|
|
204
|
-
this.focus(e.shiftKey ? addMonth(focused, -1) : addDays(focused, -1));
|
|
205
|
-
}
|
|
206
|
-
else if (e.key === 'ArrowRight') {
|
|
207
|
-
e.preventDefault();
|
|
208
|
-
this.focus(e.shiftKey ? addMonth(focused, 1) : addDays(focused, 1));
|
|
209
|
-
}
|
|
210
|
-
else if (e.key === 'ArrowUp') {
|
|
211
|
-
e.preventDefault();
|
|
212
|
-
this.focus(addDays(focused, -7));
|
|
213
|
-
}
|
|
214
|
-
else if (e.key === 'ArrowDown') {
|
|
215
|
-
e.preventDefault();
|
|
216
|
-
this.focus(addDays(focused, 7));
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
/**
|
|
220
|
-
* Select a date in the picker.
|
|
221
|
-
*
|
|
222
|
-
* @param date The date to select.
|
|
223
|
-
*/
|
|
224
|
-
async select(date) {
|
|
225
|
-
const oldValue = this.value;
|
|
226
|
-
const newDate = clampDate(this.minDate, new Date(date.getFullYear(), date.getMonth(), date.getDate()), this.maxDate);
|
|
227
|
-
this.focus(newDate);
|
|
228
|
-
this.selectionDate = newDate;
|
|
229
|
-
this.value = newDate.toISOString();
|
|
230
|
-
if (oldValue !== this.value) {
|
|
231
|
-
this.catChange.emit(this.value);
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
84
|
/**
|
|
235
85
|
* Programmatically move focus to the input. Use this method instead of
|
|
236
86
|
* `input.focus()`.
|
|
@@ -255,28 +105,54 @@ const CatDate$1 = /*@__PURE__*/ proxyCustomElement(class CatDate extends HTMLEle
|
|
|
255
105
|
this.input?.clear();
|
|
256
106
|
}
|
|
257
107
|
render() {
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
108
|
+
return (h(Host, { key: 'd588c96f031fc8ab9518d13dfaac730a0d424caa' }, h("cat-input", { key: 'f49f0682e2f2fe3dfcd89477bda91fe46ed44dfa', class: "cat-date-input", ref: el => (this.input = el), requiredMarker: this.requiredMarker, horizontal: this.horizontal, autoComplete: this.autoComplete, clearable: this.clearable, disabled: this.disabled, hint: this.hint, icon: this.icon, iconRight: this.iconRight, identifier: this.identifier, labelHidden: this.labelHidden, name: this.name, placeholder: this.placeholder, textPrefix: this.textPrefix, textSuffix: this.textSuffix, readonly: this.readonly, required: this.required, errors: this.errors, errorUpdate: this.errorUpdate, nativeAttributes: this.nativeAttributes, value: this.inputValue, onCatFocus: e => {
|
|
109
|
+
e.stopPropagation();
|
|
110
|
+
this.catFocus.emit(e.detail);
|
|
111
|
+
}, onCatBlur: e => {
|
|
112
|
+
e.stopPropagation();
|
|
113
|
+
this.onInputBlur(e.detail);
|
|
114
|
+
} }, h("span", { key: '68ef0708d25128b9a52d60c5b1a7b34e0ffb2ef1', slot: "label" }, this.label, h("span", { key: 'ac017335567a4e0059631e7535455d52f61f2e43', class: "label-aria" }, " (", this.locale.formatStr, ")")), h("cat-dropdown", { key: '16a6e95f6e4f6a9b0ddd7716f0b713c8fac3fdff', slot: "addon", placement: this.placement, arrowNavigation: "none", noResize: true, onCatOpen: () => this.dateInline?.resetView() }, h("cat-button", { key: 'cf7f2aaa2c5775b23f3e8826e9b0e722c4ce8be6', slot: "trigger", icon: "$cat:datepicker-calendar", iconOnly: true, class: "cat-date-toggle", disabled: this.disabled, a11yLabel: this.getTriggerA11yLabel() }), h("div", { key: 'f90eef976a3102855801df5ffeee770d45e7eaba', slot: "content" }, h("cat-date-inline", { key: '853b3adee0ea8f9c9b2a1276a10fcaa299044b42', ref: el => (this.dateInline = el), min: this.min, max: this.max, value: this.value, noClear: true, onCatChange: this.onDateChange.bind(this) }))))));
|
|
115
|
+
}
|
|
116
|
+
getTriggerA11yLabel() {
|
|
117
|
+
const date = this.locale.fromLocalISO(this.value);
|
|
118
|
+
return date ? `${this.locale.change}, ${this.locale.toLocalStr(date)}` : this.locale.choose;
|
|
119
|
+
}
|
|
120
|
+
onInputBlur(e) {
|
|
121
|
+
if (!this.input) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
const oldValue = this.value;
|
|
125
|
+
const dateParsed = this.parse(this.input.value ?? '');
|
|
126
|
+
const dateMin = this.locale.fromLocalISO(this.min);
|
|
127
|
+
const dateMax = this.locale.fromLocalISO(this.max);
|
|
128
|
+
const date = dateParsed ? clampDate(dateMin, dateParsed, dateMax) : null;
|
|
129
|
+
this.value = date ? this.locale.toLocalISO(date) : undefined;
|
|
130
|
+
if (oldValue !== this.value) {
|
|
131
|
+
if (date) {
|
|
132
|
+
this.dateInline?.select(date);
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
this.dateInline?.clear();
|
|
136
|
+
}
|
|
137
|
+
this.catChange.emit(this.value);
|
|
138
|
+
}
|
|
139
|
+
this.input.value = this.inputValue;
|
|
140
|
+
this.catBlur.emit(e);
|
|
141
|
+
}
|
|
142
|
+
onDateChange(e) {
|
|
143
|
+
e.stopPropagation();
|
|
144
|
+
const oldValue = this.value;
|
|
145
|
+
const date = e.detail ? new Date(e.detail) : null;
|
|
146
|
+
this.value = date ? this.locale.toLocalISO(date) : undefined;
|
|
147
|
+
if (oldValue !== this.value) {
|
|
148
|
+
this.catChange.emit(this.value);
|
|
149
|
+
}
|
|
274
150
|
}
|
|
275
151
|
parse(value) {
|
|
276
152
|
const [, p1, d1, p2, p3] = /(\w+)([^\w]+)(\w+)[^\w]+(\w+)/.exec(this.locale.formatStr) || [];
|
|
277
153
|
const formatParts = [p1, p2, p3];
|
|
278
154
|
const parts = value.split(d1).map(s => Number(s || 'x'));
|
|
279
|
-
let year = parts[formatParts.indexOf('YYYY') || formatParts.indexOf('YY')] || this.now.getFullYear();
|
|
155
|
+
let year = parts[formatParts.indexOf('YYYY') || formatParts.indexOf('YY')] || this.locale.now().getFullYear();
|
|
280
156
|
const month = parts[formatParts.indexOf('MM')];
|
|
281
157
|
const day = parts[formatParts.indexOf('DD')];
|
|
282
158
|
if (!Number.isInteger(month) || !Number.isInteger(day)) {
|
|
@@ -287,106 +163,25 @@ const CatDate$1 = /*@__PURE__*/ proxyCustomElement(class CatDate extends HTMLEle
|
|
|
287
163
|
}
|
|
288
164
|
return new Date(year, month - 1, day);
|
|
289
165
|
}
|
|
290
|
-
|
|
291
|
-
this.focusDate = clampDate(this.minDate, date, this.maxDate);
|
|
292
|
-
this.viewDate = new Date(this.focusDate.getFullYear(), this.focusDate.getMonth());
|
|
293
|
-
this.hostElement.shadowRoot
|
|
294
|
-
?.querySelector(`[data-date="${this.toLocalISO(this.focusDate)}"]`)
|
|
295
|
-
?.doFocus();
|
|
296
|
-
}
|
|
297
|
-
navigate(direction, period) {
|
|
298
|
-
this.viewDate = new Date(direction === 'prev'
|
|
299
|
-
? period === 'year'
|
|
300
|
-
? this.viewDate.setFullYear(this.viewDate.getFullYear() - 1)
|
|
301
|
-
: this.viewDate.setMonth(this.viewDate.getMonth() - 1)
|
|
302
|
-
: period === 'year'
|
|
303
|
-
? this.viewDate.setFullYear(this.viewDate.getFullYear() + 1)
|
|
304
|
-
: this.viewDate.setMonth(this.viewDate.getMonth() + 1));
|
|
305
|
-
// announce the new month and year
|
|
306
|
-
this.setAriaLive(this.getHeadline());
|
|
307
|
-
}
|
|
308
|
-
setAriaLive(text) {
|
|
309
|
-
const node = this.hostElement.shadowRoot?.querySelector('.cursor-aria');
|
|
310
|
-
if (node) {
|
|
311
|
-
node.innerHTML = text;
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
onInputBlur(e) {
|
|
315
|
-
if (!this.input) {
|
|
316
|
-
return;
|
|
317
|
-
}
|
|
166
|
+
reclamp(mode, limit) {
|
|
318
167
|
const oldValue = this.value;
|
|
319
|
-
const
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
this.catChange.emit(this.value);
|
|
324
|
-
}
|
|
325
|
-
this.input.value = this.getInputValue();
|
|
326
|
-
this.catBlur.emit(e);
|
|
327
|
-
}
|
|
328
|
-
dateGrid(year, month) {
|
|
329
|
-
const firstDayOfWeek = new Date(year, month, 1).getDay();
|
|
330
|
-
const daysInMonth = new Date(year, month + 1, 0).getDate();
|
|
331
|
-
const days = [...Array(daysInMonth).keys()];
|
|
332
|
-
const daysBefore = [...Array(firstDayOfWeek).keys()].map(day => new Date(year, month, day - firstDayOfWeek).getDate());
|
|
333
|
-
const daysAfter = [...Array(42 - days.length - daysBefore.length).keys()];
|
|
334
|
-
return [
|
|
335
|
-
...daysBefore.map(day => new Date(year, month - 1, day + 1)),
|
|
336
|
-
...days.map(day => new Date(year, month, day + 1)),
|
|
337
|
-
...daysAfter.map(day => new Date(year, month + 1, day + 1))
|
|
338
|
-
];
|
|
339
|
-
}
|
|
340
|
-
getHeadline() {
|
|
341
|
-
return `${this.locale.months.long[this.viewDate.getMonth()]} ${this.viewDate.getFullYear()}`;
|
|
342
|
-
}
|
|
343
|
-
getInputValue() {
|
|
344
|
-
const format = new Intl.DateTimeFormat(this.language, { year: 'numeric', month: '2-digit', day: '2-digit' });
|
|
345
|
-
return this.selectionDate ? format.format(this.selectionDate) : '';
|
|
346
|
-
}
|
|
347
|
-
getA11yLabelDay(date) {
|
|
348
|
-
const format = new Intl.DateTimeFormat(this.language, {
|
|
349
|
-
year: 'numeric',
|
|
350
|
-
month: 'long',
|
|
351
|
-
day: 'numeric',
|
|
352
|
-
weekday: 'long'
|
|
353
|
-
});
|
|
354
|
-
return format.format(date);
|
|
355
|
-
}
|
|
356
|
-
getWeekNumber(date, iso8601 = true) {
|
|
357
|
-
const currentDate = new Date(date.getTime());
|
|
358
|
-
const dayNum = iso8601 ? currentDate.getDay() || 7 : currentDate.getDay();
|
|
359
|
-
currentDate.setDate(currentDate.getDate() + 4 - dayNum);
|
|
360
|
-
const yearStart = new Date(currentDate.getFullYear(), 0, 1);
|
|
361
|
-
return Math.ceil(((+currentDate - +yearStart) / 86400000 + 1) / 7);
|
|
362
|
-
}
|
|
363
|
-
canFocus(date) {
|
|
364
|
-
const now = this.now;
|
|
365
|
-
const focused = this.focusedDate;
|
|
366
|
-
if (focused && isSameMonth(focused, this.viewDate)) {
|
|
367
|
-
return isSameMonth(focused, date) && isSameDay(focused, date);
|
|
368
|
-
}
|
|
369
|
-
else if (this.selectionDate && isSameMonth(this.selectionDate, this.viewDate)) {
|
|
370
|
-
return isSameMonth(this.selectionDate, date) && isSameDay(this.selectionDate, date);
|
|
168
|
+
const oldDate = this.locale.fromLocalISO(oldValue);
|
|
169
|
+
const limitDate = this.locale.fromLocalISO(limit);
|
|
170
|
+
if (!oldDate || !limitDate) {
|
|
171
|
+
return;
|
|
371
172
|
}
|
|
372
|
-
|
|
373
|
-
|
|
173
|
+
const newDate = clampDate(mode === 'min' ? limitDate : null, oldDate, mode === 'max' ? limitDate : null);
|
|
174
|
+
const newValue = this.locale.toLocalISO(newDate);
|
|
175
|
+
if (oldValue !== newValue) {
|
|
176
|
+
this.value = newValue;
|
|
177
|
+
this.catChange.emit(newValue);
|
|
374
178
|
}
|
|
375
|
-
const minDay = isSameMonth(date, this.minDate) ? this.minDate?.getDate() ?? 1 : 1;
|
|
376
|
-
return isSameMonth(this.viewDate, date) && date.getDate() === minDay;
|
|
377
|
-
}
|
|
378
|
-
canClick(date) {
|
|
379
|
-
const min = this.minDate;
|
|
380
|
-
const max = this.maxDate;
|
|
381
|
-
return (!min || min <= date) && (!max || max >= date);
|
|
382
|
-
}
|
|
383
|
-
toLocalISO(date) {
|
|
384
|
-
const year = date.getFullYear();
|
|
385
|
-
const month = (date.getMonth() + 1).toString().padStart(2, '0');
|
|
386
|
-
const day = date.getDate().toString().padStart(2, '0');
|
|
387
|
-
return `${year}-${month}-${day}`;
|
|
388
179
|
}
|
|
389
180
|
get hostElement() { return this; }
|
|
181
|
+
static get watchers() { return {
|
|
182
|
+
"min": ["onMinChanged"],
|
|
183
|
+
"max": ["onMaxChanged"]
|
|
184
|
+
}; }
|
|
390
185
|
static get style() { return CatDateStyle0; }
|
|
391
186
|
}, [1, "cat-date", {
|
|
392
187
|
"requiredMarker": [1, "required-marker"],
|
|
@@ -415,18 +210,18 @@ const CatDate$1 = /*@__PURE__*/ proxyCustomElement(class CatDate extends HTMLEle
|
|
|
415
210
|
"placement": [1],
|
|
416
211
|
"hasSlottedLabel": [32],
|
|
417
212
|
"hasSlottedHint": [32],
|
|
418
|
-
"viewDate": [32],
|
|
419
|
-
"selectionDate": [32],
|
|
420
|
-
"select": [64],
|
|
421
213
|
"doFocus": [64],
|
|
422
214
|
"doBlur": [64],
|
|
423
215
|
"clear": [64]
|
|
424
|
-
},
|
|
216
|
+
}, undefined, {
|
|
217
|
+
"min": ["onMinChanged"],
|
|
218
|
+
"max": ["onMaxChanged"]
|
|
219
|
+
}]);
|
|
425
220
|
function defineCustomElement$1() {
|
|
426
221
|
if (typeof customElements === "undefined") {
|
|
427
222
|
return;
|
|
428
223
|
}
|
|
429
|
-
const components = ["cat-date", "cat-button", "cat-dropdown", "cat-icon", "cat-input", "cat-spinner"];
|
|
224
|
+
const components = ["cat-date", "cat-button", "cat-date-inline", "cat-dropdown", "cat-icon", "cat-input", "cat-spinner"];
|
|
430
225
|
components.forEach(tagName => { switch (tagName) {
|
|
431
226
|
case "cat-date":
|
|
432
227
|
if (!customElements.get(tagName)) {
|
|
@@ -434,6 +229,11 @@ function defineCustomElement$1() {
|
|
|
434
229
|
}
|
|
435
230
|
break;
|
|
436
231
|
case "cat-button":
|
|
232
|
+
if (!customElements.get(tagName)) {
|
|
233
|
+
defineCustomElement$7();
|
|
234
|
+
}
|
|
235
|
+
break;
|
|
236
|
+
case "cat-date-inline":
|
|
437
237
|
if (!customElements.get(tagName)) {
|
|
438
238
|
defineCustomElement$6();
|
|
439
239
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"cat-date.js","mappings":";;;;;;;;AAEA,SAAS,OAAO,CAAC,QAAgB,EAAE,UAAuC,MAAM;IAC9E,MAAM,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;IACxB,MAAM,cAAc,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,GAAG,IAAI,CAAC,SAAS,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;IACtE,MAAM,MAAM,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC;IACrE,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,MAAM,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,UAAU,CAAC,cAAc,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;AAC5G,CAAC;AAED,SAAS,SAAS,CAAC,QAAgB,EAAE,QAA0B,MAAM;IACnE,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;IACzB,MAAM,MAAM,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;IACnE,OAAO,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,IAAI,MAAM,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACjG,CAAC;AAED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-locale.ts","src/components/cat-date/cat-date-math.ts","src/components/cat-date/cat-date.scss?tag=cat-date&encapsulation=shadow","src/components/cat-date/cat-date.tsx"],"sourcesContent":["import { catI18nRegistry as i18n } from '../cat-i18n/cat-i18n-registry';\n\nfunction getDays(language: string, weekday: 'long' | 'short' | 'narrow' = 'long') {\n const date = new Date();\n const firstDayOfWeek = (date.getUTCDate() - date.getUTCDay() + 7) % 7;\n const format = new Intl.DateTimeFormat(language, { weekday }).format;\n return [...Array(7).keys()].map(day => format(new Date(date.getTime()).setUTCDate(firstDayOfWeek + day)));\n}\n\nfunction getMonths(language: string, month: 'long' | 'short' = 'long') {\n const date = new Date(0);\n const format = new Intl.DateTimeFormat(language, { month }).format;\n return [...Array(12).keys()].map(month => format(new Date(date.getTime()).setUTCMonth(month)));\n}\n\nfunction getWeekInfo(language: string) {\n const locale = new Intl.Locale(language);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const weekInfo = (locale as any).getWeekInfo?.() ?? (locale as any).weekInfo;\n return {\n firstDay: weekInfo?.firstDay ?? 1,\n minDays: weekInfo?.minDays ?? 4,\n weekend: weekInfo?.weekend ?? [6, 7]\n };\n}\n\nfunction getFormat(language: string) {\n const format = new Intl.DateTimeFormat(language, { year: 'numeric', month: '2-digit', day: '2-digit' })\n .format(new Date(3456, 10, 22))\n .replace('3456', 'YYYY')\n .replace('56', 'YY')\n .replace('11', 'MM')\n .replace('22', 'DD');\n return /^(YYYY|YY|MM|DD)\\W(YYYY|YY|MM|DD)\\W(YYYY|YY|MM|DD)$/.test(format) ? format : 'DD-MM-YYYY';\n}\n\nexport function getLocale(language: string) {\n return {\n prevYear: i18n.t('datepicker.prevYear'),\n nextYear: i18n.t('datepicker.nextYear'),\n prevMonth: i18n.t('datepicker.prevMonth'),\n nextMonth: i18n.t('datepicker.nextMonth'),\n arrowKeys: i18n.t('datepicker.arrowKeys'),\n today: i18n.t('datepicker.today'),\n change: i18n.t('datepicker.change'),\n choose: i18n.t('datepicker.choose'),\n formatStr: getFormat(language),\n weekInfo: getWeekInfo(language),\n days: {\n short: getDays(language, 'short'),\n long: getDays(language, 'long')\n },\n months: {\n short: getMonths(language, 'short'),\n long: getMonths(language, 'long')\n }\n };\n}\n","export function isLeapYear(year: number): boolean {\n return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\n}\n\nexport function addDays(date: Date, n: number): Date {\n return new Date(date.getFullYear(), date.getMonth(), date.getDate() + n);\n}\n\nexport function addMonth(date: Date, n: number): Date {\n const [year, month, day] = [date.getFullYear(), date.getMonth(), date.getDate()];\n const maxDays = [31, isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\n const newDate = new Date(date);\n newDate.setDate(1);\n newDate.setMonth(newDate.getMonth() + n);\n newDate.setDate(Math.min(day, maxDays[(month + (n % 12) + 12) % 12]));\n return newDate;\n}\n\nexport function isSameYear(date1: Date | null, date2: Date | null): boolean {\n return !!date1 && !!date2 && date1.getFullYear() === date2.getFullYear();\n}\n\nexport function isSameMonth(date1: Date | null, date2: Date | null): boolean {\n return !!date1 && !!date2 && date1.getMonth() === date2.getMonth() && isSameYear(date1, date2);\n}\n\nexport function isSameDay(date1: Date | null, date2: Date | null): boolean {\n return !!date1 && !!date2 && date1.getDate() === date2.getDate() && isSameMonth(date1, date2);\n}\n\nexport function clampDate(min: Date | null, date: Date, max: Date | null): Date {\n return new Date(Math.min(Math.max(date.getTime(), min?.getTime() ?? -Infinity), max?.getTime() ?? Infinity));\n}\n","@use 'variables' as *;\n@use 'mixins' as *;\n\n:host {\n display: block;\n}\n\n:host([hidden]) {\n display: none;\n}\n\n.label-aria {\n @include cat-visually-hidden;\n}\n\n.picker {\n padding: 1rem;\n display: inline-flex;\n flex-direction: column;\n}\n\n.picker-head {\n display: flex;\n gap: 0.5rem;\n align-items: center;\n\n h3 {\n flex: 1;\n text-align: center;\n margin: 0;\n }\n}\n\n.picker-grid {\n display: grid;\n /* stylelint-disable declaration-block-no-redundant-longhand-properties */\n grid-template-rows: 2rem repeat(6, 1fr);\n grid-template-columns: 2rem repeat(7, 1fr);\n grid-template-areas:\n '. h h h h h h h'\n 'w d d d d d d d'\n 'w d d d d d d d'\n 'w d d d d d d d'\n 'w d d d d d d d'\n 'w d d d d d d d'\n 'w d d d d d d d';\n /* stylelint-enable declaration-block-no-redundant-longhand-properties */\n margin: 1rem 0 0.5rem;\n}\n\n.picker-grid-head {\n grid-area: h;\n display: grid;\n grid-template-columns: repeat(7, 1fr);\n place-items: end center;\n padding-bottom: 0.5rem;\n}\n\n.picker-grid-weeks {\n grid-area: w;\n display: grid;\n grid-template-rows: repeat(6, 1fr);\n place-items: center right;\n padding-right: 0.5rem;\n}\n\n.picker-grid-days {\n grid-area: d;\n display: grid;\n grid-template-rows: repeat(6, 1fr);\n grid-template-columns: repeat(7, 1fr);\n}\n\n.picker-grid-head > *,\n.picker-grid-weeks > * {\n @include cat-body('xs', 600);\n color: cat-token('color.ui.font.muted') !important;\n text-decoration: none;\n}\n\n.date-other {\n opacity: 0.5;\n}\n\n.date-disabled {\n opacity: 0.25;\n}\n\n.picker-foot {\n display: flex;\n gap: 1rem;\n align-items: center;\n}\n\n.cursor-help {\n flex: 1;\n margin: 0;\n @include cat-body('s');\n color: cat-token('color.ui.font.muted') !important;\n text-align: center;\n\n &.cursor-right {\n text-align: right;\n }\n}\n\n.cursor-aria {\n @include cat-visually-hidden;\n}\n","import { Placement } from '@floating-ui/dom';\nimport { Component, Element, Event, EventEmitter, Host, Listen, Method, Prop, State, h } from '@stencil/core';\nimport { ErrorMap } from '../cat-form-hint/cat-form-hint';\nimport { catI18nRegistry as i18n } from '../cat-i18n/cat-i18n-registry';\nimport { getLocale } from './cat-date-locale';\nimport { addDays, addMonth, clampDate, isSameDay, isSameMonth, isSameYear } from './cat-date-math';\n\n@Component({\n tag: 'cat-date',\n styleUrl: 'cat-date.scss',\n shadow: true\n})\nexport class CatDate {\n private readonly language = i18n.getLocale();\n private readonly locale = getLocale(this.language);\n private input?: HTMLCatInputElement;\n private isOpen = false;\n // additonally store the focus date to ensure correct focus after potential re-render\n private focusDate: Date | null = null;\n\n @Element() hostElement!: HTMLElement;\n\n @State() hasSlottedLabel = false;\n\n @State() hasSlottedHint = false;\n\n @State() viewDate: Date = this.now;\n\n @State() selectionDate: Date | null = null;\n\n /**\n * Whether the label need a marker to shown if the input is required or optional.\n */\n @Prop() requiredMarker?: 'none' | 'required' | 'optional' | 'none!' | 'optional!' | 'required!' = 'optional';\n\n /**\n * Whether the label is on top or left.\n */\n @Prop() horizontal = false;\n\n /**\n * Hint for form autofill feature.\n */\n @Prop() autoComplete?: string;\n\n /**\n * Whether the input should show a clear button.\n */\n @Prop() clearable = false;\n\n /**\n * Whether the input is disabled.\n */\n @Prop() disabled = false;\n\n /**\n * Optional hint text(s) to be displayed with the input.\n */\n @Prop() hint?: string | string[];\n\n /**\n * The name of an icon to be displayed in the input.\n */\n @Prop() icon?: string;\n\n /**\n * Display the icon on the right.\n */\n @Prop() iconRight = false;\n\n /**\n * A unique identifier for the input.\n */\n @Prop() identifier?: string;\n\n /**\n * The label for the input.\n */\n @Prop() label = '';\n\n /**\n * Visually hide the label, but still show it to assistive technologies like screen readers.\n */\n @Prop() labelHidden = false;\n\n /**\n * A maximum value for the date, given in local ISO 8601 date format YYYY-MM-DD.\n */\n @Prop() max?: string;\n\n get maxDate() {\n const [y, m, d] = this.max?.split('-').map(Number) || [];\n return this.max ? new Date(y, m - 1, d) : null;\n }\n\n /**\n * A minimum value for the date, given in local ISO 8601 date format YYYY-MM-DD.\n */\n @Prop() min?: string;\n\n get minDate() {\n const [y, m, d] = this.min?.split('-').map(Number) || [];\n return this.min ? new Date(y, m - 1, d) : null;\n }\n\n /**\n * The name of the form control. Submitted with the form as part of a name/value pair.\n */\n @Prop() name?: string;\n\n /**\n * The placeholder text to display within the input.\n */\n @Prop() placeholder?: string;\n\n /**\n * A textual prefix to be displayed in the input.\n */\n @Prop() textPrefix?: string;\n\n /**\n * A textual suffix to be displayed in the input.\n */\n @Prop() textSuffix?: string;\n\n /**\n * The value is not editable.\n */\n @Prop() readonly = false;\n\n /**\n * A value is required or must be check for the form to be submittable.\n */\n @Prop() required = false;\n\n /**\n * The value of the control, given in local ISO 8601 date format YYYY-MM-DD.\n */\n @Prop({ mutable: true }) value?: string;\n\n /**\n * The validation errors for this input. Will render a hint under the input\n * with the translated error message(s) `error.${key}`. If an object is\n * passed, the keys will be used as error keys and the values translation\n * parameters.\n * If the value is `true`, the input will be marked as invalid without any\n * hints under the input.\n */\n @Prop() errors?: boolean | string[] | ErrorMap;\n\n /**\n * Fine-grained control over when the errors are shown. Can be `false` to\n * never show errors, `true` to show errors on blur, or a number to show\n * errors on change with the given delay in milliseconds.\n */\n @Prop() errorUpdate: boolean | number = 0;\n\n /**\n * Attributes that will be added to the native HTML input element.\n */\n @Prop() nativeAttributes?: { [key: string]: string };\n\n /**\n * The placement of the dropdown.\n */\n @Prop() placement: Placement = 'bottom-end';\n\n /**\n * Emitted when the value is changed.\n */\n @Event() catChange!: EventEmitter<string>;\n\n /**\n * Emitted when the input received focus.\n */\n @Event() catFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the input loses focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n private get now() {\n const date = new Date();\n return new Date(date.getFullYear(), date.getMonth(), date.getDate());\n }\n\n private get focusedDate() {\n const [all, year, month, day] =\n this.hostElement.shadowRoot\n ?.querySelector<HTMLCatButtonElement>(`[data-date]:focus`)\n ?.dataset.date?.match(/^(\\d{4})-(\\d{2})-(\\d{2})/) ?? [];\n return all ? new Date(Number(year), Number(month) - 1, Number(day)) : null;\n }\n\n componentWillLoad() {\n const [match, year, month, day] = this.value?.match(/^(\\d{4})-(\\d{2})-(\\d{2})/) ?? [];\n if (match) {\n this.select(new Date(Number(year), Number(month) - 1, Number(day)));\n }\n }\n\n componentWillRender(): void {\n this.hasSlottedLabel = !!this.hostElement.querySelector('[slot=\"label\"]');\n this.hasSlottedHint = !!this.hostElement.querySelector('[slot=\"hint\"]');\n }\n\n componentDidLoad() {\n const format = this.locale.formatStr.replace('YYYY', 'Y').replace('YY', 'y').replace('MM', 'm').replace('DD', 'd');\n const [, p1, d1, p2, p3] = /(\\w+)([^\\w]+)(\\w+)[^\\w]+(\\w+)/.exec(format) || [];\n this.input?.mask({\n date: true,\n dateMin: this.min,\n dateMax: this.max,\n delimiter: d1,\n datePattern: [p1, p2, p3]\n });\n }\n\n componentDidRender() {\n if (this.focusDate) {\n this.hostElement.shadowRoot\n ?.querySelector<HTMLCatButtonElement>(`[data-date=\"${this.toLocalISO(this.focusDate)}\"]`)\n ?.doFocus();\n this.focusDate = null;\n }\n }\n\n @Listen('catOpen')\n onOpen() {\n this.isOpen = true;\n this.setAriaLive('');\n const viewDate = this.selectionDate\n ? new Date(this.selectionDate.getFullYear(), this.selectionDate.getMonth(), 1)\n : this.now;\n this.viewDate = clampDate(this.minDate, viewDate, this.maxDate);\n }\n\n @Listen('catClose')\n onClose() {\n this.isOpen = false;\n }\n\n @Listen('keydown')\n onKeyDown(e: KeyboardEvent) {\n if (!this.isOpen || !['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown'].includes(e.key)) {\n return;\n }\n const focused = this.focusedDate;\n if (!focused) {\n e.preventDefault();\n this.focus(this.selectionDate || this.now);\n } else if (e.key === 'ArrowLeft') {\n e.preventDefault();\n this.focus(e.shiftKey ? addMonth(focused, -1) : addDays(focused, -1));\n } else if (e.key === 'ArrowRight') {\n e.preventDefault();\n this.focus(e.shiftKey ? addMonth(focused, 1) : addDays(focused, 1));\n } else if (e.key === 'ArrowUp') {\n e.preventDefault();\n this.focus(addDays(focused, -7));\n } else if (e.key === 'ArrowDown') {\n e.preventDefault();\n this.focus(addDays(focused, 7));\n }\n }\n\n /**\n * Select a date in the picker.\n *\n * @param date The date to select.\n */\n @Method()\n async select(date: Date): Promise<void> {\n const oldValue = this.value;\n const newDate = clampDate(\n this.minDate,\n new Date(date.getFullYear(), date.getMonth(), date.getDate()),\n this.maxDate\n );\n this.focus(newDate);\n this.selectionDate = newDate;\n this.value = newDate.toISOString();\n if (oldValue !== this.value) {\n this.catChange.emit(this.value);\n }\n }\n\n /**\n * Programmatically move focus to the input. Use this method instead of\n * `input.focus()`.\n *\n * @param options An optional object providing options to control aspects of\n * the focusing process.\n */\n @Method()\n async doFocus(options?: FocusOptions): Promise<void> {\n this.input?.doFocus(options);\n }\n\n /**\n * Programmatically remove focus from the input. Use this method instead of\n * `input.blur()`.\n */\n @Method()\n async doBlur(): Promise<void> {\n this.input?.doBlur();\n }\n\n /**\n * Clear the input.\n */\n @Method()\n async clear(): Promise<void> {\n this.input?.clear();\n }\n\n render() {\n const dateGrid = this.dateGrid(this.viewDate.getFullYear(), this.viewDate.getMonth());\n return (\n <Host>\n <cat-input\n class=\"cat-date-input\"\n ref={el => (this.input = el as HTMLCatInputElement)}\n requiredMarker={this.requiredMarker}\n horizontal={this.horizontal}\n autoComplete={this.autoComplete}\n clearable={this.clearable}\n disabled={this.disabled}\n hint={this.hint}\n icon={this.icon}\n iconRight={this.iconRight}\n identifier={this.identifier}\n labelHidden={this.labelHidden}\n name={this.name}\n placeholder={this.placeholder}\n textPrefix={this.textPrefix}\n textSuffix={this.textSuffix}\n readonly={this.readonly}\n required={this.required}\n errors={this.errors}\n errorUpdate={this.errorUpdate}\n nativeAttributes={this.nativeAttributes}\n value={this.getInputValue()}\n onCatFocus={e => this.catFocus.emit(e.detail)}\n onCatBlur={e => this.onInputBlur(e.detail)}\n >\n <span slot=\"label\">\n {this.label}\n <span class=\"label-aria\"> ({this.locale.formatStr})</span>\n </span>\n <cat-dropdown slot=\"addon\" placement={this.placement} arrowNavigation=\"none\" noResize>\n <cat-button\n slot=\"trigger\"\n icon=\"$cat:datepicker-calendar\"\n iconOnly\n class=\"cat-date-toggle\"\n disabled={this.disabled}\n a11yLabel={\n this.selectionDate\n ? `${this.locale.change}, ${this.getA11yLabelDay(this.selectionDate)}`\n : this.locale.choose\n }\n ></cat-button>\n <div class=\"picker\" slot=\"content\">\n <div class=\"picker-head\">\n <cat-button\n icon=\"$cat:datepicker-year-prev\"\n iconOnly\n size=\"xs\"\n variant=\"text\"\n a11y-label={this.locale.prevYear}\n disabled={isSameYear(this.viewDate, this.minDate)}\n onClick={() => this.navigate('prev', 'year')}\n data-dropdown-no-close\n ></cat-button>\n <cat-button\n icon=\"$cat:datepicker-month-prev\"\n iconOnly\n size=\"xs\"\n variant=\"text\"\n a11y-label={this.locale.prevMonth}\n disabled={isSameMonth(this.viewDate, this.minDate)}\n onClick={() => this.navigate('prev', 'month')}\n data-dropdown-no-close\n ></cat-button>\n <h3>{this.getHeadline()}</h3>\n <cat-button\n icon=\"$cat:datepicker-month-next\"\n iconOnly\n size=\"xs\"\n variant=\"text\"\n a11y-label={this.locale.nextMonth}\n disabled={isSameMonth(this.viewDate, this.maxDate)}\n onClick={() => this.navigate('next', 'month')}\n data-dropdown-no-close\n ></cat-button>\n <cat-button\n icon=\"$cat:datepicker-year-next\"\n iconOnly\n size=\"xs\"\n variant=\"text\"\n a11y-label={this.locale.nextYear}\n disabled={isSameYear(this.viewDate, this.maxDate)}\n onClick={() => this.navigate('next', 'year')}\n data-dropdown-no-close\n ></cat-button>\n </div>\n <div class=\"picker-grid\" onFocusin={() => this.setAriaLive(this.locale.arrowKeys)}>\n <div class=\"picker-grid-head\">\n {Array.from(Array(7), (_, i) => (\n <abbr title={this.locale.days.long[i]}>{this.locale.days.short[i]}</abbr>\n ))}\n </div>\n <div class=\"picker-grid-weeks\">\n {dateGrid\n .filter((_, i) => i % 7 === 0)\n .map(day => (\n <div>{this.getWeekNumber(day)}</div>\n ))}\n </div>\n <div class=\"picker-grid-days\">\n {dateGrid.map(day => (\n <cat-button\n class={{\n 'cat-date-item': true,\n 'date-other': !isSameMonth(this.viewDate, day),\n 'date-today': isSameDay(this.now, day),\n 'date-selected': isSameDay(this.selectionDate, day),\n 'date-focusable': this.canFocus(day),\n 'date-disabled': !this.canClick(day)\n }}\n nativeAttributes={!this.canFocus(day) ? { tabindex: '-1' } : {}}\n variant={\n isSameDay(this.selectionDate, day) ? 'filled' : isSameDay(this.now, day) ? 'outlined' : 'text'\n }\n a11yLabel={this.getA11yLabelDay(day)}\n active={isSameDay(this.selectionDate, day)}\n color={isSameDay(this.selectionDate, day) || isSameDay(this.now, day) ? 'primary' : 'secondary'}\n disabled={!this.canClick(day)}\n onClick={() => this.select(day)}\n data-date={this.toLocalISO(day)}\n >\n {day.getDate()}\n </cat-button>\n ))}\n </div>\n </div>\n <div class=\"picker-foot\">\n {this.canClick(this.now) && (\n <cat-button size=\"s\" data-dropdown-no-close onClick={() => this.select(this.now)}>\n {this.locale.today}\n </cat-button>\n )}\n <p\n class={{\n 'cursor-help': true,\n 'cursor-right': this.canClick(this.now)\n }}\n >\n {this.locale.arrowKeys}\n </p>\n <p class=\"cursor-aria\" aria-live=\"polite\"></p>\n </div>\n </div>\n </cat-dropdown>\n </cat-input>\n </Host>\n );\n }\n\n private parse(value: string) {\n const [, p1, d1, p2, p3] = /(\\w+)([^\\w]+)(\\w+)[^\\w]+(\\w+)/.exec(this.locale.formatStr) || [];\n const formatParts = [p1, p2, p3];\n const parts = value.split(d1).map(s => Number(s || 'x'));\n let year = parts[formatParts.indexOf('YYYY') || formatParts.indexOf('YY')] || this.now.getFullYear();\n const month = parts[formatParts.indexOf('MM')];\n const day = parts[formatParts.indexOf('DD')];\n if (!Number.isInteger(month) || !Number.isInteger(day)) {\n return null;\n } else if (year < 100) {\n year += year < 50 ? 2000 : 1900;\n }\n return new Date(year, month - 1, day);\n }\n\n private focus(date: Date) {\n this.focusDate = clampDate(this.minDate, date, this.maxDate);\n this.viewDate = new Date(this.focusDate.getFullYear(), this.focusDate.getMonth());\n this.hostElement.shadowRoot\n ?.querySelector<HTMLCatButtonElement>(`[data-date=\"${this.toLocalISO(this.focusDate)}\"]`)\n ?.doFocus();\n }\n\n private navigate(direction: 'prev' | 'next', period: 'year' | 'month') {\n this.viewDate = new Date(\n direction === 'prev'\n ? period === 'year'\n ? this.viewDate.setFullYear(this.viewDate.getFullYear() - 1)\n : this.viewDate.setMonth(this.viewDate.getMonth() - 1)\n : period === 'year'\n ? this.viewDate.setFullYear(this.viewDate.getFullYear() + 1)\n : this.viewDate.setMonth(this.viewDate.getMonth() + 1)\n );\n // announce the new month and year\n this.setAriaLive(this.getHeadline());\n }\n\n private setAriaLive(text: string) {\n const node = this.hostElement.shadowRoot?.querySelector('.cursor-aria');\n if (node) {\n node.innerHTML = text;\n }\n }\n\n private onInputBlur(e: FocusEvent) {\n if (!this.input) {\n return;\n }\n const oldValue = this.value;\n const value = this.parse(this.input.value ?? '');\n this.selectionDate = value ? clampDate(this.minDate, value, this.maxDate) : value;\n this.value = this.selectionDate?.toISOString();\n if (oldValue !== this.value) {\n this.catChange.emit(this.value);\n }\n this.input.value = this.getInputValue();\n this.catBlur.emit(e);\n }\n\n private dateGrid(year: number, month: number) {\n const firstDayOfWeek = new Date(year, month, 1).getDay();\n const daysInMonth = new Date(year, month + 1, 0).getDate();\n const days = [...Array(daysInMonth).keys()];\n const daysBefore = [...Array(firstDayOfWeek).keys()].map(day =>\n new Date(year, month, day - firstDayOfWeek).getDate()\n );\n const daysAfter = [...Array(42 - days.length - daysBefore.length).keys()];\n return [\n ...daysBefore.map(day => new Date(year, month - 1, day + 1)),\n ...days.map(day => new Date(year, month, day + 1)),\n ...daysAfter.map(day => new Date(year, month + 1, day + 1))\n ];\n }\n\n private getHeadline() {\n return `${this.locale.months.long[this.viewDate.getMonth()]} ${this.viewDate.getFullYear()}`;\n }\n\n private getInputValue() {\n const format = new Intl.DateTimeFormat(this.language, { year: 'numeric', month: '2-digit', day: '2-digit' });\n return this.selectionDate ? format.format(this.selectionDate) : '';\n }\n\n private getA11yLabelDay(date: Date) {\n const format = new Intl.DateTimeFormat(this.language, {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n weekday: 'long'\n });\n return format.format(date);\n }\n\n private getWeekNumber(date: Date, iso8601 = true) {\n const currentDate = new Date(date.getTime());\n const dayNum = iso8601 ? currentDate.getDay() || 7 : currentDate.getDay();\n currentDate.setDate(currentDate.getDate() + 4 - dayNum);\n const yearStart = new Date(currentDate.getFullYear(), 0, 1);\n return Math.ceil(((+currentDate - +yearStart) / 86400000 + 1) / 7);\n }\n\n private canFocus(date: Date): boolean {\n const now = this.now;\n const focused = this.focusedDate;\n if (focused && isSameMonth(focused, this.viewDate)) {\n return isSameMonth(focused, date) && isSameDay(focused, date);\n } else if (this.selectionDate && isSameMonth(this.selectionDate, this.viewDate)) {\n return isSameMonth(this.selectionDate, date) && isSameDay(this.selectionDate, date);\n } else if (isSameMonth(this.viewDate, now) && (!this.minDate || this.minDate <= now)) {\n return isSameMonth(this.viewDate, date) && isSameDay(now, date);\n }\n const minDay = isSameMonth(date, this.minDate) ? this.minDate?.getDate() ?? 1 : 1;\n return isSameMonth(this.viewDate, date) && date.getDate() === minDay;\n }\n\n private canClick(date: Date) {\n const min = this.minDate;\n const max = this.maxDate;\n return (!min || min <= date) && (!max || max >= date);\n }\n\n private toLocalISO(date: Date) {\n const year = date.getFullYear();\n const month = (date.getMonth() + 1).toString().padStart(2, '0');\n const day = date.getDate().toString().padStart(2, '0');\n return `${year}-${month}-${day}`;\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"cat-date.js","mappings":";;;;;;;;;AAAA,MAAM,UAAU,GAAG,6TAA6T,CAAC;AACjV,sBAAe,UAAU;;MCcZA,SAAO;;;;;;;;QACD,aAAQ,GAAGC,eAAI,CAAC,SAAS,EAAE,CAAC;QAC5B,WAAM,GAAG,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;+BAMxB,KAAK;8BAEN,KAAK;8BAKmE,UAAU;0BAKvF,KAAK;;yBAUN,KAAK;wBAKN,KAAK;;;yBAeJ,KAAK;;qBAUT,EAAE;2BAKI,KAAK;;;;;;;wBAmCR,KAAK;wBAKL,KAAK;;;2BAsBgB,CAAC;;yB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AG,QAAQ,CAAC;YACtB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SAC/B;KACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["CatDate","i18n"],"sources":["src/components/cat-date/cat-date.scss?tag=cat-date&encapsulation=shadow","src/components/cat-date/cat-date.tsx"],"sourcesContent":["@use 'variables' as *;\n@use 'mixins' as *;\n\n:host {\n display: block;\n}\n\n:host([hidden]) {\n display: none;\n}\n\n.label-aria {\n @include cat-visually-hidden;\n}\n\ncat-date-inline {\n margin: 1rem;\n}\n","import { Placement } from '@floating-ui/dom';\nimport { Component, Element, Event, EventEmitter, Host, Method, Prop, State, Watch, h } from '@stencil/core';\nimport { getLocale } from '../cat-date-inline/cat-date-locale';\nimport { clampDate } from '../cat-date-inline/cat-date-math';\nimport { ErrorMap } from '../cat-form-hint/cat-form-hint';\nimport { catI18nRegistry as i18n } from '../cat-i18n/cat-i18n-registry';\n\n/**\n * A date input component to select a date from a calendar in a dropdown.\n */\n@Component({\n tag: 'cat-date',\n styleUrl: 'cat-date.scss',\n shadow: true\n})\nexport class CatDate {\n private readonly language = i18n.getLocale();\n private readonly locale = getLocale(this.language);\n private input?: HTMLCatInputElement;\n private dateInline?: HTMLCatDateInlineElement;\n\n @Element() hostElement!: HTMLElement;\n\n @State() hasSlottedLabel = false;\n\n @State() hasSlottedHint = false;\n\n /**\n * Whether the label need a marker to shown if the input is required or optional.\n */\n @Prop() requiredMarker?: 'none' | 'required' | 'optional' | 'none!' | 'optional!' | 'required!' = 'optional';\n\n /**\n * Whether the label is on top or left.\n */\n @Prop() horizontal = false;\n\n /**\n * Hint for form autofill feature.\n */\n @Prop() autoComplete?: string;\n\n /**\n * Whether the input should show a clear button.\n */\n @Prop() clearable = false;\n\n /**\n * Whether the input is disabled.\n */\n @Prop() disabled = false;\n\n /**\n * Optional hint text(s) to be displayed with the input.\n */\n @Prop() hint?: string | string[];\n\n /**\n * The name of an icon to be displayed in the input.\n */\n @Prop() icon?: string;\n\n /**\n * Display the icon on the right.\n */\n @Prop() iconRight = false;\n\n /**\n * A unique identifier for the input.\n */\n @Prop() identifier?: string;\n\n /**\n * The label for the input.\n */\n @Prop() label = '';\n\n /**\n * Visually hide the label, but still show it to assistive technologies like screen readers.\n */\n @Prop() labelHidden = false;\n\n /**\n * A maximum value for the date, given in local ISO 8601 date format YYYY-MM-DD.\n */\n @Prop() max?: string;\n\n /**\n * A minimum value for the date, given in local ISO 8601 date format YYYY-MM-DD.\n */\n @Prop() min?: string;\n\n /**\n * The name of the form control. Submitted with the form as part of a name/value pair.\n */\n @Prop() name?: string;\n\n /**\n * The placeholder text to display within the input.\n */\n @Prop() placeholder?: string;\n\n /**\n * A textual prefix to be displayed in the input.\n */\n @Prop() textPrefix?: string;\n\n /**\n * A textual suffix to be displayed in the input.\n */\n @Prop() textSuffix?: string;\n\n /**\n * The value is not editable.\n */\n @Prop() readonly = false;\n\n /**\n * A value is required or must be check for the form to be submittable.\n */\n @Prop() required = false;\n\n /**\n * The value of the control, given in local ISO 8601 date format YYYY-MM-DD.\n */\n @Prop({ mutable: true }) value?: string;\n\n /**\n * The validation errors for this input. Will render a hint under the input\n * with the translated error message(s) `error.${key}`. If an object is\n * passed, the keys will be used as error keys and the values translation\n * parameters.\n * If the value is `true`, the input will be marked as invalid without any\n * hints under the input.\n */\n @Prop() errors?: boolean | string[] | ErrorMap;\n\n /**\n * Fine-grained control over when the errors are shown. Can be `false` to\n * never show errors, `true` to show errors on blur, or a number to show\n * errors on change with the given delay in milliseconds.\n */\n @Prop() errorUpdate: boolean | number = 0;\n\n /**\n * Attributes that will be added to the native HTML input element.\n */\n @Prop() nativeAttributes?: { [key: string]: string };\n\n /**\n * The placement of the dropdown.\n */\n @Prop() placement: Placement = 'bottom-end';\n\n @Watch('min')\n onMinChanged(min?: string, oldMin?: string) {\n if (min !== oldMin) {\n this.reclamp('min', min);\n }\n }\n\n @Watch('max')\n onMaxChanged(max?: string, oldMax?: string) {\n if (max !== oldMax) {\n this.reclamp('max', max);\n }\n }\n\n /**\n * Emitted when the value is changed.\n */\n @Event() catChange!: EventEmitter<string>;\n\n /**\n * Emitted when the input received focus.\n */\n @Event() catFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the input loses focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n private get inputValue() {\n const [match, year, month, day] = this.value?.match(/^(\\d{4})-(\\d{2})-(\\d{2})/) ?? [];\n if (match) {\n const date = new Date(Number(year), Number(month) - 1, Number(day));\n const format = new Intl.DateTimeFormat(this.language, { year: 'numeric', month: '2-digit', day: '2-digit' });\n return format.format(date);\n }\n return '';\n }\n\n componentWillRender(): void {\n this.hasSlottedLabel = !!this.hostElement.querySelector('[slot=\"label\"]');\n this.hasSlottedHint = !!this.hostElement.querySelector('[slot=\"hint\"]');\n }\n\n componentDidLoad() {\n const format = this.locale.formatStr.replace('YYYY', 'Y').replace('YY', 'y').replace('MM', 'm').replace('DD', 'd');\n const [, p1, d1, p2, p3] = /(\\w+)([^\\w]+)(\\w+)[^\\w]+(\\w+)/.exec(format) || [];\n this.input?.mask({\n date: true,\n dateMin: this.min,\n dateMax: this.max,\n delimiter: d1,\n datePattern: [p1, p2, p3]\n });\n }\n\n /**\n * Programmatically move focus to the input. Use this method instead of\n * `input.focus()`.\n *\n * @param options An optional object providing options to control aspects of\n * the focusing process.\n */\n @Method()\n async doFocus(options?: FocusOptions): Promise<void> {\n this.input?.doFocus(options);\n }\n\n /**\n * Programmatically remove focus from the input. Use this method instead of\n * `input.blur()`.\n */\n @Method()\n async doBlur(): Promise<void> {\n this.input?.doBlur();\n }\n\n /**\n * Clear the input.\n */\n @Method()\n async clear(): Promise<void> {\n this.input?.clear();\n }\n\n render() {\n return (\n <Host>\n <cat-input\n class=\"cat-date-input\"\n ref={el => (this.input = el as HTMLCatInputElement)}\n requiredMarker={this.requiredMarker}\n horizontal={this.horizontal}\n autoComplete={this.autoComplete}\n clearable={this.clearable}\n disabled={this.disabled}\n hint={this.hint}\n icon={this.icon}\n iconRight={this.iconRight}\n identifier={this.identifier}\n labelHidden={this.labelHidden}\n name={this.name}\n placeholder={this.placeholder}\n textPrefix={this.textPrefix}\n textSuffix={this.textSuffix}\n readonly={this.readonly}\n required={this.required}\n errors={this.errors}\n errorUpdate={this.errorUpdate}\n nativeAttributes={this.nativeAttributes}\n value={this.inputValue}\n onCatFocus={e => {\n e.stopPropagation();\n this.catFocus.emit(e.detail);\n }}\n onCatBlur={e => {\n e.stopPropagation();\n this.onInputBlur(e.detail);\n }}\n >\n <span slot=\"label\">\n {this.label}\n <span class=\"label-aria\"> ({this.locale.formatStr})</span>\n </span>\n <cat-dropdown\n slot=\"addon\"\n placement={this.placement}\n arrowNavigation=\"none\"\n noResize\n onCatOpen={() => this.dateInline?.resetView()}\n >\n <cat-button\n slot=\"trigger\"\n icon=\"$cat:datepicker-calendar\"\n iconOnly\n class=\"cat-date-toggle\"\n disabled={this.disabled}\n a11yLabel={this.getTriggerA11yLabel()}\n ></cat-button>\n <div slot=\"content\">\n <cat-date-inline\n ref={el => (this.dateInline = el as HTMLCatDateInlineElement)}\n min={this.min}\n max={this.max}\n value={this.value}\n noClear\n onCatChange={this.onDateChange.bind(this)}\n ></cat-date-inline>\n </div>\n </cat-dropdown>\n </cat-input>\n </Host>\n );\n }\n\n private getTriggerA11yLabel() {\n const date = this.locale.fromLocalISO(this.value);\n return date ? `${this.locale.change}, ${this.locale.toLocalStr(date)}` : this.locale.choose;\n }\n\n private onInputBlur(e: FocusEvent) {\n if (!this.input) {\n return;\n }\n const oldValue = this.value;\n const dateParsed = this.parse(this.input.value ?? '');\n const dateMin = this.locale.fromLocalISO(this.min);\n const dateMax = this.locale.fromLocalISO(this.max);\n const date = dateParsed ? clampDate(dateMin, dateParsed, dateMax) : null;\n this.value = date ? this.locale.toLocalISO(date) : undefined;\n if (oldValue !== this.value) {\n if (date) {\n this.dateInline?.select(date);\n } else {\n this.dateInline?.clear();\n }\n this.catChange.emit(this.value);\n }\n this.input.value = this.inputValue;\n this.catBlur.emit(e);\n }\n\n private onDateChange(e: CustomEvent<string>) {\n e.stopPropagation();\n const oldValue = this.value;\n const date = e.detail ? new Date(e.detail) : null;\n this.value = date ? this.locale.toLocalISO(date) : undefined;\n if (oldValue !== this.value) {\n this.catChange.emit(this.value);\n }\n }\n\n private parse(value: string) {\n const [, p1, d1, p2, p3] = /(\\w+)([^\\w]+)(\\w+)[^\\w]+(\\w+)/.exec(this.locale.formatStr) || [];\n const formatParts = [p1, p2, p3];\n const parts = value.split(d1).map(s => Number(s || 'x'));\n let year = parts[formatParts.indexOf('YYYY') || formatParts.indexOf('YY')] || this.locale.now().getFullYear();\n const month = parts[formatParts.indexOf('MM')];\n const day = parts[formatParts.indexOf('DD')];\n if (!Number.isInteger(month) || !Number.isInteger(day)) {\n return null;\n } else if (year < 100) {\n year += year < 50 ? 2000 : 1900;\n }\n return new Date(year, month - 1, day);\n }\n\n private reclamp(mode: 'min' | 'max', limit: string | undefined) {\n const oldValue = this.value;\n const oldDate = this.locale.fromLocalISO(oldValue);\n const limitDate = this.locale.fromLocalISO(limit);\n if (!oldDate || !limitDate) {\n return;\n }\n const newDate = clampDate(mode === 'min' ? limitDate : null, oldDate, mode === 'max' ? limitDate : null);\n const newValue = this.locale.toLocalISO(newDate);\n if (oldValue !== newValue) {\n this.value = newValue;\n this.catChange.emit(newValue);\n }\n }\n}\n"],"version":3}
|
|
@@ -42,11 +42,11 @@ const CatDatepickerInline$1 = /*@__PURE__*/ proxyCustomElement(class CatDatepick
|
|
|
42
42
|
this.pickr = this.initDatepicker(this.input);
|
|
43
43
|
}
|
|
44
44
|
render() {
|
|
45
|
-
return (h(Host, { key: '
|
|
45
|
+
return (h(Host, { key: '6f363a4a673603f0c39f5a24b31bb768e804abfc' }, h("div", { key: '2c56934aad4d60ea96a6a3c983ae9d1e39c82bde', tabIndex: this.disabled || this.readonly ? -1 : undefined, class: {
|
|
46
46
|
'datepicker-wrapper': true,
|
|
47
47
|
'datepicker-disabled': this.disabled,
|
|
48
48
|
'datepicker-readonly': this.readonly
|
|
49
|
-
} }, h("input", { key: '
|
|
49
|
+
} }, h("input", { key: '6885c1c919af468401dddda38045ab9a8dc26aaf', ref: el => (this.input = el), value: this.value, disabled: this.disabled, readonly: this.readonly }))));
|
|
50
50
|
}
|
|
51
51
|
initDatepicker(input) {
|
|
52
52
|
if (!input) {
|