@haiilo/catalyst 10.3.1 → 10.5.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.
Files changed (131) hide show
  1. package/dist/catalyst/catalyst.esm.js +1 -1
  2. package/dist/catalyst/catalyst.esm.js.map +1 -1
  3. package/dist/catalyst/index.esm.js +1 -1
  4. package/dist/catalyst/index.esm.js.map +1 -1
  5. package/dist/catalyst/p-54544546.js +2 -0
  6. package/dist/catalyst/p-54544546.js.map +1 -0
  7. package/dist/catalyst/{p-8a1d505d.entry.js → p-66b41008.entry.js} +4 -4
  8. package/dist/catalyst/p-66b41008.entry.js.map +1 -0
  9. package/dist/cjs/{cat-alert_28.cjs.entry.js → cat-alert_29.cjs.entry.js} +269 -176
  10. package/dist/cjs/cat-alert_29.cjs.entry.js.map +1 -0
  11. package/dist/cjs/catalyst.cjs.js +1 -1
  12. package/dist/cjs/index.cjs.js +4 -1
  13. package/dist/cjs/index.cjs.js.map +1 -1
  14. package/dist/cjs/loader.cjs.js +1 -1
  15. package/dist/cjs/{of-45281229.js → of-8163b41f.js} +11 -3
  16. package/dist/cjs/of-8163b41f.js.map +1 -0
  17. package/dist/collection/collection-manifest.json +1 -0
  18. package/dist/collection/components/cat-button/cat-button.css +12 -2
  19. package/dist/collection/components/cat-date/cat-date.css +2 -96
  20. package/dist/collection/components/cat-date/cat-date.js +46 -254
  21. package/dist/collection/components/cat-date/cat-date.js.map +1 -1
  22. package/dist/collection/components/cat-date/cat-date.spec.js +2 -1
  23. package/dist/collection/components/cat-date/cat-date.spec.js.map +1 -1
  24. package/dist/collection/components/cat-date-inline/cat-date-inline.css +166 -0
  25. package/dist/collection/components/cat-date-inline/cat-date-inline.e2e.js +11 -0
  26. package/dist/collection/components/cat-date-inline/cat-date-inline.e2e.js.map +1 -0
  27. package/dist/collection/components/cat-date-inline/cat-date-inline.js +505 -0
  28. package/dist/collection/components/cat-date-inline/cat-date-inline.js.map +1 -0
  29. package/dist/collection/components/cat-date-inline/cat-date-inline.spec.js +16 -0
  30. package/dist/collection/components/cat-date-inline/cat-date-inline.spec.js.map +1 -0
  31. package/dist/collection/components/{cat-date → cat-date-inline}/cat-date-locale.js +22 -1
  32. package/dist/collection/components/cat-date-inline/cat-date-locale.js.map +1 -0
  33. package/dist/collection/components/cat-date-inline/cat-date-math.js.map +1 -0
  34. package/dist/collection/components/cat-datepicker/cat-datepicker.js +2 -2
  35. package/dist/collection/components/cat-datepicker-inline/cat-datepicker-inline.js +2 -2
  36. package/dist/collection/components/cat-dropdown/cat-dropdown.js +5 -1
  37. package/dist/collection/components/cat-dropdown/cat-dropdown.js.map +1 -1
  38. package/dist/collection/components/cat-form-group/cat-form-group.js +4 -1
  39. package/dist/collection/components/cat-form-group/cat-form-group.js.map +1 -1
  40. package/dist/collection/components/cat-i18n/cat-i18n-registry.js +6 -0
  41. package/dist/collection/components/cat-i18n/cat-i18n-registry.js.map +1 -1
  42. package/dist/collection/components/cat-icon/cat-icon-registry.js +4 -2
  43. package/dist/collection/components/cat-icon/cat-icon-registry.js.map +1 -1
  44. package/dist/collection/components/cat-icon/cat-icon.js +1 -1
  45. package/dist/collection/components/cat-input/cat-input.js +4 -4
  46. package/dist/collection/components/cat-notification/cat-notification.js +3 -0
  47. package/dist/collection/components/cat-notification/cat-notification.js.map +1 -1
  48. package/dist/collection/components/cat-pagination/cat-pagination.js +2 -2
  49. package/dist/collection/components/cat-radio/cat-radio.js +1 -1
  50. package/dist/collection/components/cat-radio-group/cat-radio-group.js +1 -1
  51. package/dist/collection/components/cat-scrollable/cat-scrollable.js +3 -3
  52. package/dist/collection/components/cat-select-demo/cat-select-demo.js +1 -1
  53. package/dist/collection/components/cat-skeleton/cat-skeleton.js +1 -1
  54. package/dist/collection/components/cat-spinner/cat-spinner.js +2 -2
  55. package/dist/collection/components/cat-tab/cat-tab.js +1 -1
  56. package/dist/collection/components/cat-tabs/cat-tabs.js +1 -1
  57. package/dist/collection/components/cat-textarea/cat-textarea.js +3 -3
  58. package/dist/collection/components/cat-time/cat-time.js +4 -1
  59. package/dist/collection/components/cat-time/cat-time.js.map +1 -1
  60. package/dist/collection/components/cat-toggle/cat-toggle.js +1 -1
  61. package/dist/collection/components/cat-tooltip/cat-tooltip.js +7 -2
  62. package/dist/collection/components/cat-tooltip/cat-tooltip.js.map +1 -1
  63. package/dist/components/cat-button2.js +1 -1
  64. package/dist/components/cat-button2.js.map +1 -1
  65. package/dist/components/cat-date-inline.d.ts +11 -0
  66. package/dist/components/cat-date-inline.js +8 -0
  67. package/dist/components/cat-date-inline.js.map +1 -0
  68. package/dist/components/cat-date-inline2.js +386 -0
  69. package/dist/components/cat-date-inline2.js.map +1 -0
  70. package/dist/components/cat-date.js +50 -288
  71. package/dist/components/cat-date.js.map +1 -1
  72. package/dist/components/cat-datepicker-inline.js +2 -2
  73. package/dist/components/cat-datepicker.js +2 -2
  74. package/dist/components/cat-dropdown2.js +1 -1
  75. package/dist/components/cat-dropdown2.js.map +1 -1
  76. package/dist/components/cat-form-group.js +1 -1
  77. package/dist/components/cat-form-group.js.map +1 -1
  78. package/dist/components/cat-i18n-registry.js +6 -0
  79. package/dist/components/cat-i18n-registry.js.map +1 -1
  80. package/dist/components/cat-icon-registry.js +4 -2
  81. package/dist/components/cat-icon-registry.js.map +1 -1
  82. package/dist/components/cat-icon2.js +1 -1
  83. package/dist/components/cat-input2.js +4 -4
  84. package/dist/components/cat-pagination.js +2 -2
  85. package/dist/components/cat-radio-group.js +1 -1
  86. package/dist/components/cat-radio.js +1 -1
  87. package/dist/components/cat-scrollable2.js +3 -3
  88. package/dist/components/cat-select-demo.js +1 -1
  89. package/dist/components/cat-skeleton2.js +1 -1
  90. package/dist/components/cat-spinner2.js +2 -2
  91. package/dist/components/cat-tab.js +1 -1
  92. package/dist/components/cat-tabs.js +1 -1
  93. package/dist/components/cat-textarea.js +3 -3
  94. package/dist/components/cat-time.js +1 -1
  95. package/dist/components/cat-time.js.map +1 -1
  96. package/dist/components/cat-toggle.js +1 -1
  97. package/dist/components/cat-tooltip.js +2 -2
  98. package/dist/components/cat-tooltip.js.map +1 -1
  99. package/dist/components/index.js +3 -0
  100. package/dist/components/index.js.map +1 -1
  101. package/dist/esm/{cat-alert_28.entry.js → cat-alert_29.entry.js} +269 -177
  102. package/dist/esm/cat-alert_29.entry.js.map +1 -0
  103. package/dist/esm/catalyst.js +1 -1
  104. package/dist/esm/index.js +5 -2
  105. package/dist/esm/index.js.map +1 -1
  106. package/dist/esm/loader.js +1 -1
  107. package/dist/esm/{of-19888f3b.js → of-f4b9a3ca.js} +11 -3
  108. package/dist/esm/of-f4b9a3ca.js.map +1 -0
  109. package/dist/types/components/cat-date/cat-date.d.ts +8 -31
  110. package/dist/types/components/cat-date-inline/cat-date-inline.d.ts +81 -0
  111. package/dist/types/components/{cat-date → cat-date-inline}/cat-date-locale.d.ts +5 -0
  112. package/dist/types/components/cat-dropdown/cat-dropdown.d.ts +4 -0
  113. package/dist/types/components/cat-form-group/cat-form-group.d.ts +3 -0
  114. package/dist/types/components/cat-i18n/cat-i18n-registry.d.ts +6 -0
  115. package/dist/types/components/cat-icon/cat-icon-registry.d.ts +1 -0
  116. package/dist/types/components/cat-notification/cat-notification.d.ts +3 -0
  117. package/dist/types/components/cat-time/cat-time.d.ts +3 -0
  118. package/dist/types/components/cat-tooltip/cat-tooltip.d.ts +5 -0
  119. package/dist/types/components.d.ts +201 -5
  120. package/package.json +2 -2
  121. package/dist/catalyst/p-81800b65.js +0 -2
  122. package/dist/catalyst/p-81800b65.js.map +0 -1
  123. package/dist/catalyst/p-8a1d505d.entry.js.map +0 -1
  124. package/dist/cjs/cat-alert_28.cjs.entry.js.map +0 -1
  125. package/dist/cjs/of-45281229.js.map +0 -1
  126. package/dist/collection/components/cat-date/cat-date-locale.js.map +0 -1
  127. package/dist/collection/components/cat-date/cat-date-math.js.map +0 -1
  128. package/dist/esm/cat-alert_28.entry.js.map +0 -1
  129. package/dist/esm/of-19888f3b.js.map +0 -1
  130. /package/dist/collection/components/{cat-date → cat-date-inline}/cat-date-math.js +0 -0
  131. /package/dist/types/components/{cat-date → cat-date-inline}/cat-date-math.d.ts +0 -0
@@ -1,18 +1,16 @@
1
1
  import { Host, h } from "@stencil/core";
2
+ import { getLocale } from "../cat-date-inline/cat-date-locale";
3
+ import { clampDate } from "../cat-date-inline/cat-date-math";
2
4
  import { catI18nRegistry as i18n } from "../cat-i18n/cat-i18n-registry";
3
- import { getLocale } from "./cat-date-locale";
4
- import { addDays, addMonth, clampDate, isSameDay, isSameMonth, isSameYear } from "./cat-date-math";
5
+ /**
6
+ * A date input component to select a date from a calendar in a dropdown.
7
+ */
5
8
  export class CatDate {
6
9
  constructor() {
7
10
  this.language = i18n.getLocale();
8
11
  this.locale = getLocale(this.language);
9
- this.isOpen = false;
10
- // additonally store the focus date to ensure correct focus after potential re-render
11
- this.focusDate = null;
12
12
  this.hasSlottedLabel = false;
13
13
  this.hasSlottedHint = false;
14
- this.viewDate = this.now;
15
- this.selectionDate = null;
16
14
  this.requiredMarker = 'optional';
17
15
  this.horizontal = false;
18
16
  this.autoComplete = undefined;
@@ -38,29 +36,14 @@ export class CatDate {
38
36
  this.nativeAttributes = undefined;
39
37
  this.placement = 'bottom-end';
40
38
  }
41
- get maxDate() {
42
- const [y, m, d] = this.max?.split('-').map(Number) || [];
43
- return this.max ? new Date(y, m - 1, d) : null;
44
- }
45
- get minDate() {
46
- const [y, m, d] = this.min?.split('-').map(Number) || [];
47
- return this.min ? new Date(y, m - 1, d) : null;
48
- }
49
- get now() {
50
- const date = new Date();
51
- return new Date(date.getFullYear(), date.getMonth(), date.getDate());
52
- }
53
- get focusedDate() {
54
- const [all, year, month, day] = this.hostElement.shadowRoot
55
- ?.querySelector(`[data-date]:focus`)
56
- ?.dataset.date?.match(/^(\d{4})-(\d{2})-(\d{2})/) ?? [];
57
- return all ? new Date(Number(year), Number(month) - 1, Number(day)) : null;
58
- }
59
- componentWillLoad() {
39
+ get inputValue() {
60
40
  const [match, year, month, day] = this.value?.match(/^(\d{4})-(\d{2})-(\d{2})/) ?? [];
61
41
  if (match) {
62
- this.select(new Date(Number(year), Number(month) - 1, Number(day)));
42
+ const date = new Date(Number(year), Number(month) - 1, Number(day));
43
+ const format = new Intl.DateTimeFormat(this.language, { year: 'numeric', month: '2-digit', day: '2-digit' });
44
+ return format.format(date);
63
45
  }
46
+ return '';
64
47
  }
65
48
  componentWillRender() {
66
49
  this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
@@ -77,66 +60,6 @@ export class CatDate {
77
60
  datePattern: [p1, p2, p3]
78
61
  });
79
62
  }
80
- componentDidRender() {
81
- if (this.focusDate) {
82
- this.hostElement.shadowRoot
83
- ?.querySelector(`[data-date="${this.toLocalISO(this.focusDate)}"]`)
84
- ?.doFocus();
85
- this.focusDate = null;
86
- }
87
- }
88
- onOpen() {
89
- this.isOpen = true;
90
- this.setAriaLive('');
91
- const viewDate = this.selectionDate
92
- ? new Date(this.selectionDate.getFullYear(), this.selectionDate.getMonth(), 1)
93
- : this.now;
94
- this.viewDate = clampDate(this.minDate, viewDate, this.maxDate);
95
- }
96
- onClose() {
97
- this.isOpen = false;
98
- }
99
- onKeyDown(e) {
100
- if (!this.isOpen || !['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown'].includes(e.key)) {
101
- return;
102
- }
103
- const focused = this.focusedDate;
104
- if (!focused) {
105
- e.preventDefault();
106
- this.focus(this.selectionDate || this.now);
107
- }
108
- else if (e.key === 'ArrowLeft') {
109
- e.preventDefault();
110
- this.focus(e.shiftKey ? addMonth(focused, -1) : addDays(focused, -1));
111
- }
112
- else if (e.key === 'ArrowRight') {
113
- e.preventDefault();
114
- this.focus(e.shiftKey ? addMonth(focused, 1) : addDays(focused, 1));
115
- }
116
- else if (e.key === 'ArrowUp') {
117
- e.preventDefault();
118
- this.focus(addDays(focused, -7));
119
- }
120
- else if (e.key === 'ArrowDown') {
121
- e.preventDefault();
122
- this.focus(addDays(focused, 7));
123
- }
124
- }
125
- /**
126
- * Select a date in the picker.
127
- *
128
- * @param date The date to select.
129
- */
130
- async select(date) {
131
- const oldValue = this.value;
132
- const newDate = clampDate(this.minDate, new Date(date.getFullYear(), date.getMonth(), date.getDate()), this.maxDate);
133
- this.focus(newDate);
134
- this.selectionDate = newDate;
135
- this.value = newDate.toISOString();
136
- if (oldValue !== this.value) {
137
- this.catChange.emit(this.value);
138
- }
139
- }
140
63
  /**
141
64
  * Programmatically move focus to the input. Use this method instead of
142
65
  * `input.focus()`.
@@ -161,136 +84,56 @@ export class CatDate {
161
84
  this.input?.clear();
162
85
  }
163
86
  render() {
164
- const dateGrid = this.dateGrid(this.viewDate.getFullYear(), this.viewDate.getMonth());
165
- return (h(Host, { key: 'ebb5f193ca43bc3306449c91d2e391cb25b3287c' }, h("cat-input", { key: '27292844d077a8d79022074a191c47e72736d2c5', 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.getInputValue(), onCatFocus: e => this.catFocus.emit(e.detail), onCatBlur: e => this.onInputBlur(e.detail) }, h("span", { key: 'e9c9ad5b5374fcf944396a7ae45ae61775336be4', slot: "label" }, this.label, h("span", { key: '5a05917857fdc967bb122e0403f64b8b71ecf08a', class: "label-aria" }, " (", this.locale.formatStr, ")")), h("cat-dropdown", { key: 'ac1b7f5e1efae2648fa82acb31059ab41d0adb55', slot: "addon", placement: this.placement, arrowNavigation: "none", noResize: true }, h("cat-button", { key: 'bfaabd6f8120333b497b262894489628beb1d886', slot: "trigger", icon: "$cat:datepicker-calendar", iconOnly: true, class: "cat-date-toggle", disabled: this.disabled, a11yLabel: this.selectionDate
166
- ? `${this.locale.change}, ${this.getA11yLabelDay(this.selectionDate)}`
167
- : this.locale.choose }), h("div", { key: '9cfb02ca034584dcdd23fadb5f41ca598552a605', class: "picker", slot: "content" }, h("div", { key: '4d09c5f3ca84346bbcc68f4c83f3413159b8b608', class: "picker-head" }, h("cat-button", { key: '9e8d1695f1a882f2388a2b57ccd8cc51e8b52483', icon: "$cat:datepicker-year-prev", iconOnly: true, size: "xs", variant: "text", "a11y-label": this.locale.prevYear, disabled: isSameYear(this.viewDate, this.minDate), onClick: () => this.navigate('prev', 'year'), "data-dropdown-no-close": true }), h("cat-button", { key: '5af1b092c2f0d13e5c12d49699e85ea5dded7580', icon: "$cat:datepicker-month-prev", iconOnly: true, size: "xs", variant: "text", "a11y-label": this.locale.prevMonth, disabled: isSameMonth(this.viewDate, this.minDate), onClick: () => this.navigate('prev', 'month'), "data-dropdown-no-close": true }), h("h3", { key: 'cd730386e0fc19a4b12ee2910e6de7f079133584' }, this.getHeadline()), h("cat-button", { key: 'f0c76ac04573977e255956d2e377dd197080a5b8', icon: "$cat:datepicker-month-next", iconOnly: true, size: "xs", variant: "text", "a11y-label": this.locale.nextMonth, disabled: isSameMonth(this.viewDate, this.maxDate), onClick: () => this.navigate('next', 'month'), "data-dropdown-no-close": true }), h("cat-button", { key: 'd58917e0665df029acc6dac35e7ab05eab60f9d4', icon: "$cat:datepicker-year-next", iconOnly: true, size: "xs", variant: "text", "a11y-label": this.locale.nextYear, disabled: isSameYear(this.viewDate, this.maxDate), onClick: () => this.navigate('next', 'year'), "data-dropdown-no-close": true })), h("div", { key: '5307170ba72c90fceef4276aa5feb74dc569c74d', class: "picker-grid", onFocusin: () => this.setAriaLive(this.locale.arrowKeys) }, h("div", { key: 'acd6b0e720722ed3e3d013463645fe294a75b68d', class: "picker-grid-head" }, Array.from(Array(7), (_, i) => (h("abbr", { title: this.locale.days.long[i] }, this.locale.days.short[i])))), h("div", { key: 'a8b349d48f3595b7a29a037fb48b130dfb9af438', class: "picker-grid-weeks" }, dateGrid
168
- .filter((_, i) => i % 7 === 0)
169
- .map(day => (h("div", null, this.getWeekNumber(day))))), h("div", { key: '1e7750157710763ad977d866bb2e511b6ec44d03', class: "picker-grid-days" }, dateGrid.map(day => (h("cat-button", { class: {
170
- 'cat-date-item': true,
171
- 'date-other': !isSameMonth(this.viewDate, day),
172
- 'date-today': isSameDay(this.now, day),
173
- 'date-selected': isSameDay(this.selectionDate, day),
174
- 'date-focusable': this.canFocus(day),
175
- 'date-disabled': !this.canClick(day)
176
- }, nativeAttributes: !this.canFocus(day) ? { tabindex: '-1' } : {}, variant: isSameDay(this.selectionDate, day) ? 'filled' : isSameDay(this.now, day) ? 'outlined' : 'text', a11yLabel: this.getA11yLabelDay(day), active: isSameDay(this.selectionDate, day), color: isSameDay(this.selectionDate, day) || isSameDay(this.now, day) ? 'primary' : 'secondary', disabled: !this.canClick(day), onClick: () => this.select(day), "data-date": this.toLocalISO(day) }, day.getDate()))))), h("div", { key: 'd8874097357312b5ddd4bda5e4018d3e642aaf99', class: "picker-foot" }, this.canClick(this.now) && (h("cat-button", { size: "s", "data-dropdown-no-close": true, onClick: () => this.select(this.now) }, this.locale.today)), h("p", { key: '42d936d44ef0cb07375415ae42a95565cd7f342b', class: {
177
- 'cursor-help': true,
178
- 'cursor-right': this.canClick(this.now)
179
- } }, this.locale.arrowKeys), h("p", { key: '6df5566486d5082b3c2cb79fde22cedd7608c8bf', class: "cursor-aria", "aria-live": "polite" })))))));
180
- }
181
- parse(value) {
182
- const [, p1, d1, p2, p3] = /(\w+)([^\w]+)(\w+)[^\w]+(\w+)/.exec(this.locale.formatStr) || [];
183
- const formatParts = [p1, p2, p3];
184
- const parts = value.split(d1).map(s => Number(s || 'x'));
185
- let year = parts[formatParts.indexOf('YYYY') || formatParts.indexOf('YY')] || this.now.getFullYear();
186
- const month = parts[formatParts.indexOf('MM')];
187
- const day = parts[formatParts.indexOf('DD')];
188
- if (!Number.isInteger(month) || !Number.isInteger(day)) {
189
- return null;
190
- }
191
- else if (year < 100) {
192
- year += year < 50 ? 2000 : 1900;
193
- }
194
- return new Date(year, month - 1, day);
195
- }
196
- focus(date) {
197
- this.focusDate = clampDate(this.minDate, date, this.maxDate);
198
- this.viewDate = new Date(this.focusDate.getFullYear(), this.focusDate.getMonth());
199
- this.hostElement.shadowRoot
200
- ?.querySelector(`[data-date="${this.toLocalISO(this.focusDate)}"]`)
201
- ?.doFocus();
87
+ return (h(Host, { key: '6f8ed88396eb9932a91f26e1f32086a573f82add' }, h("cat-input", { key: 'e73ec2bceb1cd648e14d8917ebf7fb6c99079408', 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 => this.catFocus.emit(e.detail), onCatBlur: e => this.onInputBlur(e.detail) }, h("span", { key: '8fb02c395b64728db2a2f5d4896e3151b3dc5aec', slot: "label" }, this.label, h("span", { key: 'f08e83d369b1f35d45fb4c0b2c39a9ad52b68b77', class: "label-aria" }, " (", this.locale.formatStr, ")")), h("cat-dropdown", { key: '48ee8472fab9d59b511df69afbbc348aa7b04828', slot: "addon", placement: this.placement, arrowNavigation: "none", noResize: true, onCatOpen: () => this.dateInline?.resetView() }, h("cat-button", { key: 'b12ea88e170c2c8d916e9553b0bb205fae5e5d45', slot: "trigger", icon: "$cat:datepicker-calendar", iconOnly: true, class: "cat-date-toggle", disabled: this.disabled, a11yLabel: this.getTriggerA11yLabel() }), h("div", { key: '9173b680adcf83c32a7c10e818acbab188cfd979', slot: "content" }, h("cat-date-inline", { key: '997bc3bb5137d860893732234442feda61cd3d21', ref: el => (this.dateInline = el), min: this.min, max: this.max, value: this.value, noClear: true, onCatChange: this.onDateChange.bind(this) }))))));
202
88
  }
203
- navigate(direction, period) {
204
- this.viewDate = new Date(direction === 'prev'
205
- ? period === 'year'
206
- ? this.viewDate.setFullYear(this.viewDate.getFullYear() - 1)
207
- : this.viewDate.setMonth(this.viewDate.getMonth() - 1)
208
- : period === 'year'
209
- ? this.viewDate.setFullYear(this.viewDate.getFullYear() + 1)
210
- : this.viewDate.setMonth(this.viewDate.getMonth() + 1));
211
- // announce the new month and year
212
- this.setAriaLive(this.getHeadline());
213
- }
214
- setAriaLive(text) {
215
- const node = this.hostElement.shadowRoot?.querySelector('.cursor-aria');
216
- if (node) {
217
- node.innerHTML = text;
218
- }
89
+ getTriggerA11yLabel() {
90
+ const date = this.locale.fromLocalISO(this.value);
91
+ return date ? `${this.locale.change}, ${this.locale.toLocalStr(date)}` : this.locale.choose;
219
92
  }
220
93
  onInputBlur(e) {
221
94
  if (!this.input) {
222
95
  return;
223
96
  }
224
97
  const oldValue = this.value;
225
- const value = this.parse(this.input.value ?? '');
226
- this.selectionDate = value ? clampDate(this.minDate, value, this.maxDate) : value;
227
- this.value = this.selectionDate?.toISOString();
98
+ const dateParsed = this.parse(this.input.value ?? '');
99
+ const dateMin = this.locale.fromLocalISO(this.min);
100
+ const dateMax = this.locale.fromLocalISO(this.max);
101
+ const date = dateParsed ? clampDate(dateMin, dateParsed, dateMax) : null;
102
+ this.value = date ? this.locale.toLocalISO(date) : undefined;
228
103
  if (oldValue !== this.value) {
104
+ if (date) {
105
+ this.dateInline?.select(date);
106
+ }
107
+ else {
108
+ this.dateInline?.clear();
109
+ }
229
110
  this.catChange.emit(this.value);
230
111
  }
231
- this.input.value = this.getInputValue();
112
+ this.input.value = this.inputValue;
232
113
  this.catBlur.emit(e);
233
114
  }
234
- dateGrid(year, month) {
235
- const firstDayOfWeek = new Date(year, month, 1).getDay();
236
- const daysInMonth = new Date(year, month + 1, 0).getDate();
237
- const days = [...Array(daysInMonth).keys()];
238
- const daysBefore = [...Array(firstDayOfWeek).keys()].map(day => new Date(year, month, day - firstDayOfWeek).getDate());
239
- const daysAfter = [...Array(42 - days.length - daysBefore.length).keys()];
240
- return [
241
- ...daysBefore.map(day => new Date(year, month - 1, day + 1)),
242
- ...days.map(day => new Date(year, month, day + 1)),
243
- ...daysAfter.map(day => new Date(year, month + 1, day + 1))
244
- ];
245
- }
246
- getHeadline() {
247
- return `${this.locale.months.long[this.viewDate.getMonth()]} ${this.viewDate.getFullYear()}`;
248
- }
249
- getInputValue() {
250
- const format = new Intl.DateTimeFormat(this.language, { year: 'numeric', month: '2-digit', day: '2-digit' });
251
- return this.selectionDate ? format.format(this.selectionDate) : '';
252
- }
253
- getA11yLabelDay(date) {
254
- const format = new Intl.DateTimeFormat(this.language, {
255
- year: 'numeric',
256
- month: 'long',
257
- day: 'numeric',
258
- weekday: 'long'
259
- });
260
- return format.format(date);
261
- }
262
- getWeekNumber(date, iso8601 = true) {
263
- const currentDate = new Date(date.getTime());
264
- const dayNum = iso8601 ? currentDate.getDay() || 7 : currentDate.getDay();
265
- currentDate.setDate(currentDate.getDate() + 4 - dayNum);
266
- const yearStart = new Date(currentDate.getFullYear(), 0, 1);
267
- return Math.ceil(((+currentDate - +yearStart) / 86400000 + 1) / 7);
268
- }
269
- canFocus(date) {
270
- const now = this.now;
271
- const focused = this.focusedDate;
272
- if (focused && isSameMonth(focused, this.viewDate)) {
273
- return isSameMonth(focused, date) && isSameDay(focused, date);
115
+ onDateChange(e) {
116
+ const oldValue = this.value;
117
+ const date = e.detail ? new Date(e.detail) : null;
118
+ this.value = date ? this.locale.toLocalISO(date) : undefined;
119
+ if (oldValue !== this.value) {
120
+ this.catChange.emit(this.value);
274
121
  }
275
- else if (this.selectionDate && isSameMonth(this.selectionDate, this.viewDate)) {
276
- return isSameMonth(this.selectionDate, date) && isSameDay(this.selectionDate, date);
122
+ }
123
+ parse(value) {
124
+ const [, p1, d1, p2, p3] = /(\w+)([^\w]+)(\w+)[^\w]+(\w+)/.exec(this.locale.formatStr) || [];
125
+ const formatParts = [p1, p2, p3];
126
+ const parts = value.split(d1).map(s => Number(s || 'x'));
127
+ let year = parts[formatParts.indexOf('YYYY') || formatParts.indexOf('YY')] || this.locale.now().getFullYear();
128
+ const month = parts[formatParts.indexOf('MM')];
129
+ const day = parts[formatParts.indexOf('DD')];
130
+ if (!Number.isInteger(month) || !Number.isInteger(day)) {
131
+ return null;
277
132
  }
278
- else if (isSameMonth(this.viewDate, now) && (!this.minDate || this.minDate <= now)) {
279
- return isSameMonth(this.viewDate, date) && isSameDay(now, date);
133
+ else if (year < 100) {
134
+ year += year < 50 ? 2000 : 1900;
280
135
  }
281
- const minDay = isSameMonth(date, this.minDate) ? this.minDate?.getDate() ?? 1 : 1;
282
- return isSameMonth(this.viewDate, date) && date.getDate() === minDay;
283
- }
284
- canClick(date) {
285
- const min = this.minDate;
286
- const max = this.maxDate;
287
- return (!min || min <= date) && (!max || max >= date);
288
- }
289
- toLocalISO(date) {
290
- const year = date.getFullYear();
291
- const month = (date.getMonth() + 1).toString().padStart(2, '0');
292
- const day = date.getDate().toString().padStart(2, '0');
293
- return `${year}-${month}-${day}`;
136
+ return new Date(year, month - 1, day);
294
137
  }
295
138
  static get is() { return "cat-date"; }
296
139
  static get encapsulation() { return "shadow"; }
@@ -740,9 +583,7 @@ export class CatDate {
740
583
  static get states() {
741
584
  return {
742
585
  "hasSlottedLabel": {},
743
- "hasSlottedHint": {},
744
- "viewDate": {},
745
- "selectionDate": {}
586
+ "hasSlottedHint": {}
746
587
  };
747
588
  }
748
589
  static get events() {
@@ -805,34 +646,6 @@ export class CatDate {
805
646
  }
806
647
  static get methods() {
807
648
  return {
808
- "select": {
809
- "complexType": {
810
- "signature": "(date: Date) => Promise<void>",
811
- "parameters": [{
812
- "name": "date",
813
- "type": "Date",
814
- "docs": "The date to select."
815
- }],
816
- "references": {
817
- "Promise": {
818
- "location": "global",
819
- "id": "global::Promise"
820
- },
821
- "Date": {
822
- "location": "global",
823
- "id": "global::Date"
824
- }
825
- },
826
- "return": "Promise<void>"
827
- },
828
- "docs": {
829
- "text": "Select a date in the picker.",
830
- "tags": [{
831
- "name": "param",
832
- "text": "date The date to select."
833
- }]
834
- }
835
- },
836
649
  "doFocus": {
837
650
  "complexType": {
838
651
  "signature": "(options?: FocusOptions) => Promise<void>",
@@ -898,26 +711,5 @@ export class CatDate {
898
711
  };
899
712
  }
900
713
  static get elementRef() { return "hostElement"; }
901
- static get listeners() {
902
- return [{
903
- "name": "catOpen",
904
- "method": "onOpen",
905
- "target": undefined,
906
- "capture": false,
907
- "passive": false
908
- }, {
909
- "name": "catClose",
910
- "method": "onClose",
911
- "target": undefined,
912
- "capture": false,
913
- "passive": false
914
- }, {
915
- "name": "keydown",
916
- "method": "onKeyDown",
917
- "target": undefined,
918
- "capture": false,
919
- "passive": false
920
- }];
921
- }
922
714
  }
923
715
  //# sourceMappingURL=cat-date.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cat-date.js","sourceRoot":"","sources":["../../../src/components/cat-date/cat-date.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAE9G,OAAO,EAAE,eAAe,IAAI,IAAI,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAOnG,MAAM,OAAO,OAAO;;QACD,aAAQ,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;QAC5B,WAAM,GAAG,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAE3C,WAAM,GAAG,KAAK,C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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["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"]}
1
+ {"version":3,"file":"cat-date.js","sourceRoot":"","sources":["../../../src/components/cat-date/cat-date.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AACtG,OAAO,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAE7D,OAAO,EAAE,eAAe,IAAI,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAExE;;GAEG;AAMH,MAAM,OAAO,OAAO;;QACD,aAAQ,GAAG,IAAI,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;;yBAUV,YAAY;;IAiB3C,IAAY,UAAU;QACpB,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,0BAA0B,CAAC,IAAI,EAAE,CAAC;QACtF,IAAI,KAAK,EAAE,CAAC;YACV,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CA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I,CAAC,CAAC,CAAC;QAC7C,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC;YACvD,OAAO,IAAI,CAAC;QACd,CAAC;aAAM,IAAI,IAAI,GAAG,GAAG,EAAE,CAAC;YACtB,IAAI,IAAI,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;QAClC,CAAC;QACD,OAAO,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;IACxC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Placement } from '@floating-ui/dom';\nimport { Component, Element, Event, EventEmitter, Host, Method, Prop, State, 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 /**\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 => 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\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 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"]}
@@ -1,11 +1,12 @@
1
1
  jest.mock('../cat-i18n/cat-i18n-registry');
2
2
  import { newSpecPage } from "@stencil/core/testing";
3
+ import { CatDateInline } from "../cat-date-inline/cat-date-inline";
3
4
  import { CatInput } from "../cat-input/cat-input";
4
5
  import { CatDate } from "./cat-date";
5
6
  describe('cat-date', () => {
6
7
  it('renders', async () => {
7
8
  const page = await newSpecPage({
8
- components: [CatDate, CatInput],
9
+ components: [CatDate, CatInput, CatDateInline],
9
10
  html: `<cat-date></cat-date>`
10
11
  });
11
12
  expect(page.root).toEqualLightHtml(`
@@ -1 +1 @@
1
- {"version":3,"file":"cat-date.spec.js","sourceRoot":"","sources":["../../../src/components/cat-date/cat-date.spec.tsx"],"names":[],"mappings":"AAAA,IAAI,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;AAE3C,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACxB,EAAE,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;QACvB,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;YAC7B,UAAU,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC;YAC/B,IAAI,EAAE,uBAAuB;SAC9B,CAAC,CAAC;QACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,gBAAgB,CAAC;;KAElC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["jest.mock('../cat-i18n/cat-i18n-registry');\n\nimport { newSpecPage } from '@stencil/core/testing';\nimport { CatInput } from '../cat-input/cat-input';\nimport { CatDate } from './cat-date';\n\ndescribe('cat-date', () => {\n it('renders', async () => {\n const page = await newSpecPage({\n components: [CatDate, CatInput],\n html: `<cat-date></cat-date>`\n });\n expect(page.root).toEqualLightHtml(`\n <cat-date></cat-date>\n `);\n });\n});\n"]}
1
+ {"version":3,"file":"cat-date.spec.js","sourceRoot":"","sources":["../../../src/components/cat-date/cat-date.spec.tsx"],"names":[],"mappings":"AAAA,IAAI,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;AAE3C,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACxB,EAAE,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;QACvB,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;YAC7B,UAAU,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,aAAa,CAAC;YAC9C,IAAI,EAAE,uBAAuB;SAC9B,CAAC,CAAC;QACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,gBAAgB,CAAC;;KAElC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["jest.mock('../cat-i18n/cat-i18n-registry');\n\nimport { newSpecPage } from '@stencil/core/testing';\nimport { CatDateInline } from '../cat-date-inline/cat-date-inline';\nimport { CatInput } from '../cat-input/cat-input';\nimport { CatDate } from './cat-date';\n\ndescribe('cat-date', () => {\n it('renders', async () => {\n const page = await newSpecPage({\n components: [CatDate, CatInput, CatDateInline],\n html: `<cat-date></cat-date>`\n });\n expect(page.root).toEqualLightHtml(`\n <cat-date></cat-date>\n `);\n });\n});\n"]}