@govtechsg/sgds-web-component 1.1.0 → 1.2.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/Masthead/index.js +1 -1
- package/base/sgds-element.cjs2.js +1 -1
- package/base/sgds-element2.js +1 -1
- package/components/Accordion/index.umd.js +3 -3
- package/components/Accordion/index.umd.js.map +1 -1
- package/components/Accordion/sgds-accordion.cjs.js +2 -2
- package/components/Accordion/sgds-accordion.cjs.js.map +1 -1
- package/components/Accordion/sgds-accordion.js +2 -2
- package/components/Accordion/sgds-accordion.js.map +1 -1
- package/components/ActionCard/index.umd.js +1 -1
- package/components/Alert/index.umd.js +1 -1
- package/components/Badge/index.umd.js +1 -1
- package/components/Breadcrumb/index.umd.js +1 -1
- package/components/Button/index.umd.js +1 -1
- package/components/Card/index.umd.js +1 -1
- package/components/Checkbox/index.umd.js +1 -1
- package/components/ComboBox/index.umd.js +10 -5
- package/components/ComboBox/index.umd.js.map +1 -1
- package/components/Datepicker/datepicker-calendar.cjs.js +43 -23
- package/components/Datepicker/datepicker-calendar.cjs.js.map +1 -1
- package/components/Datepicker/datepicker-calendar.cjs2.js +1 -1
- package/components/Datepicker/datepicker-calendar.d.ts +0 -1
- package/components/Datepicker/datepicker-calendar.js +43 -23
- package/components/Datepicker/datepicker-calendar.js.map +1 -1
- package/components/Datepicker/datepicker-calendar2.js +1 -1
- package/components/Datepicker/datepicker-header.cjs.js +44 -9
- package/components/Datepicker/datepicker-header.cjs.js.map +1 -1
- package/components/Datepicker/datepicker-header.cjs2.js +1 -1
- package/components/Datepicker/datepicker-header.d.ts +5 -1
- package/components/Datepicker/datepicker-header.js +44 -9
- package/components/Datepicker/datepicker-header.js.map +1 -1
- package/components/Datepicker/datepicker-header2.js +1 -1
- package/components/Datepicker/datepicker-input.cjs.js +4 -0
- package/components/Datepicker/datepicker-input.cjs.js.map +1 -1
- package/components/Datepicker/datepicker-input.d.ts +1 -0
- package/components/Datepicker/datepicker-input.js +4 -0
- package/components/Datepicker/datepicker-input.js.map +1 -1
- package/components/Datepicker/index.umd.js +252 -166
- package/components/Datepicker/index.umd.js.map +1 -1
- package/components/Datepicker/sgds-datepicker.cjs.js +25 -2
- package/components/Datepicker/sgds-datepicker.cjs.js.map +1 -1
- package/components/Datepicker/sgds-datepicker.d.ts +7 -1
- package/components/Datepicker/sgds-datepicker.js +25 -2
- package/components/Datepicker/sgds-datepicker.js.map +1 -1
- package/components/Datepicker/types.d.ts +0 -3
- package/components/Drawer/index.umd.js +1 -1
- package/components/Dropdown/index.umd.js +1 -1
- package/components/FileUpload/index.umd.js +2 -1
- package/components/FileUpload/index.umd.js.map +1 -1
- package/components/FileUpload/sgds-file-upload.cjs.js +1 -0
- package/components/FileUpload/sgds-file-upload.cjs.js.map +1 -1
- package/components/FileUpload/sgds-file-upload.d.ts +1 -0
- package/components/FileUpload/sgds-file-upload.js +1 -0
- package/components/FileUpload/sgds-file-upload.js.map +1 -1
- package/components/Footer/index.umd.js +1 -1
- package/components/Input/index.umd.js +10 -5
- package/components/Input/index.umd.js.map +1 -1
- package/components/Input/sgds-input.cjs.js +9 -4
- package/components/Input/sgds-input.cjs.js.map +1 -1
- package/components/Input/sgds-input.d.ts +1 -0
- package/components/Input/sgds-input.js +9 -4
- package/components/Input/sgds-input.js.map +1 -1
- package/components/Mainnav/index.umd.js +5989 -6128
- package/components/Mainnav/index.umd.js.map +1 -1
- package/components/Mainnav/sgds-mainnav.cjs.js +102 -29
- package/components/Mainnav/sgds-mainnav.cjs.js.map +1 -1
- package/components/Mainnav/sgds-mainnav.d.ts +16 -4
- package/components/Mainnav/sgds-mainnav.js +103 -26
- package/components/Mainnav/sgds-mainnav.js.map +1 -1
- package/components/Masthead/index.umd.js +1 -1
- package/components/Modal/index.umd.js +1 -1
- package/components/Pagination/index.umd.js +231 -41
- package/components/Pagination/index.umd.js.map +1 -1
- package/components/Pagination/sgds-pagination.cjs.js +94 -39
- package/components/Pagination/sgds-pagination.cjs.js.map +1 -1
- package/components/Pagination/sgds-pagination.cjs2.js +1 -1
- package/components/Pagination/sgds-pagination.d.ts +20 -13
- package/components/Pagination/sgds-pagination.js +95 -40
- package/components/Pagination/sgds-pagination.js.map +1 -1
- package/components/Pagination/sgds-pagination2.js +1 -1
- package/components/Progress/index.umd.js +1 -1
- package/components/QuantityToggle/index.umd.js +26 -8
- package/components/QuantityToggle/index.umd.js.map +1 -1
- package/components/QuantityToggle/sgds-quantity-toggle.cjs.js +25 -7
- package/components/QuantityToggle/sgds-quantity-toggle.cjs.js.map +1 -1
- package/components/QuantityToggle/sgds-quantity-toggle.d.ts +1 -0
- package/components/QuantityToggle/sgds-quantity-toggle.js +25 -7
- package/components/QuantityToggle/sgds-quantity-toggle.js.map +1 -1
- package/components/Radio/index.umd.js +1 -1
- package/components/Sidenav/index.umd.js +505 -1648
- package/components/Sidenav/index.umd.js.map +1 -1
- package/components/Sidenav/sgds-sidenav-item.cjs.js +122 -45
- package/components/Sidenav/sgds-sidenav-item.cjs.js.map +1 -1
- package/components/Sidenav/sgds-sidenav-item.d.ts +19 -8
- package/components/Sidenav/sgds-sidenav-item.js +123 -42
- package/components/Sidenav/sgds-sidenav-item.js.map +1 -1
- package/components/Sidenav/sgds-sidenav.cjs.js +38 -12
- package/components/Sidenav/sgds-sidenav.cjs.js.map +1 -1
- package/components/Sidenav/sgds-sidenav.cjs2.js +1 -1
- package/components/Sidenav/sgds-sidenav.d.ts +9 -0
- package/components/Sidenav/sgds-sidenav.js +39 -13
- package/components/Sidenav/sgds-sidenav.js.map +1 -1
- package/components/Sidenav/sgds-sidenav2.js +1 -1
- package/components/Spinner/index.umd.js +1 -1
- package/components/Stepper/index.umd.js +1 -1
- package/components/Tab/index.umd.js +1 -1
- package/components/Table/index.umd.js +1 -1
- package/components/Textarea/index.umd.js +1 -1
- package/components/Toast/index.umd.js +1 -1
- package/components/Tooltip/index.umd.js +1 -1
- package/components/index.umd.js +534 -539
- package/components/index.umd.js.map +1 -1
- package/index.umd.js +534 -539
- package/index.umd.js.map +1 -1
- package/package.json +2 -2
- package/react/mainnav/index.cjs.js +6 -1
- package/react/mainnav/index.cjs.js.map +1 -1
- package/react/mainnav/index.js +6 -1
- package/react/mainnav/index.js.map +1 -1
- package/react/sidenav-item/index.cjs.js +5 -1
- package/react/sidenav-item/index.cjs.js.map +1 -1
- package/react/sidenav-item/index.js +5 -1
- package/react/sidenav-item/index.js.map +1 -1
|
@@ -3,14 +3,15 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var tslib = require('tslib');
|
|
6
|
+
var dateFns = require('date-fns');
|
|
6
7
|
var lit = require('lit');
|
|
7
8
|
var decorators_js = require('lit/decorators.js');
|
|
9
|
+
var classMap_js = require('lit/directives/class-map.js');
|
|
8
10
|
var sgdsElement = require('../../base/sgds-element.cjs.js');
|
|
9
11
|
var time = require('../../utils/time.cjs.js');
|
|
10
12
|
var watch = require('../../utils/watch.cjs.js');
|
|
11
13
|
var datepickerCalendar = require('./datepicker-calendar.cjs2.js');
|
|
12
|
-
var
|
|
13
|
-
var dateFns = require('date-fns');
|
|
14
|
+
var ifDefined_js = require('lit/directives/if-defined.js');
|
|
14
15
|
|
|
15
16
|
const TODAY_DATE = new Date();
|
|
16
17
|
const keyPressAction = {
|
|
@@ -52,13 +53,6 @@ class DatepickerCalendar extends sgdsElement["default"] {
|
|
|
52
53
|
super.connectedCallback();
|
|
53
54
|
this.addEventListener("keydown", this._handleKeyPress);
|
|
54
55
|
}
|
|
55
|
-
firstUpdated() {
|
|
56
|
-
// if (this.selectedDate.length > 0) {
|
|
57
|
-
// this.focusedDate = setTimeToNoon(this.selectedDate[0]);
|
|
58
|
-
// } else {
|
|
59
|
-
// this.focusedDate = this.displayDate && setTimeToNoon(this.displayDate);
|
|
60
|
-
// }
|
|
61
|
-
}
|
|
62
56
|
updated() {
|
|
63
57
|
/** For KeyboardNavigation (switching months) and ClickNavigation:
|
|
64
58
|
* Runs after render has completed and td of next month has appeared.
|
|
@@ -264,20 +258,25 @@ class DatepickerCalendar extends sgdsElement["default"] {
|
|
|
264
258
|
const week = [];
|
|
265
259
|
for (let j = 0; j <= 6; j++) {
|
|
266
260
|
if (day <= monthLength && (i > 0 || j >= startingDayOfMonth)) {
|
|
267
|
-
const
|
|
268
|
-
const
|
|
269
|
-
const
|
|
261
|
+
const dateObj = new Date(year, month, day, 12, 0, 0, 0);
|
|
262
|
+
const dateStr = dateObj.toISOString();
|
|
263
|
+
const beforeMinDate = minimumDate && Date.parse(dateStr) < Date.parse(minimumDate.toISOString());
|
|
264
|
+
const afterMinDate = maximumDate && Date.parse(dateStr) > Date.parse(maximumDate.toISOString());
|
|
270
265
|
const clickHandler = beforeMinDate || afterMinDate ? undefined : this._onClickDay;
|
|
271
266
|
const isCurrentMonth = TODAY_DATE.getMonth() === this.displayDate.getMonth();
|
|
272
267
|
const isCurrentYear = TODAY_DATE.getFullYear() === this.displayDate.getFullYear();
|
|
273
268
|
const isCurrentDay = TODAY_DATE.getDate() === day;
|
|
274
|
-
const isSelected = selectedDates.length > 0 &&
|
|
275
|
-
|
|
276
|
-
const
|
|
269
|
+
const isSelected = selectedDates.length > 0 &&
|
|
270
|
+
rangeSelectedDates.some(d => Date.parse(dateStr) === Date.parse(d.toISOString()));
|
|
271
|
+
const isFirstSelectedDate = selectedDates.length > 0 && rangeSelectedDates[0].toISOString() === dateStr;
|
|
272
|
+
const isLastSelectedDate = selectedDates.length > 1 && rangeSelectedDates[rangeSelectedDates.length - 1].toISOString() === dateStr;
|
|
273
|
+
const ariaLabel = `${isCurrentDay && isCurrentMonth && isCurrentYear ? "Today's date, " : ""}` + dateFns.format(dateObj, "PPPP");
|
|
277
274
|
week.push(lit.html `<td
|
|
278
275
|
key=${j}
|
|
279
|
-
data-date=${
|
|
276
|
+
data-date=${dateStr}
|
|
280
277
|
data-day=${day}
|
|
278
|
+
aria-label=${ariaLabel}
|
|
279
|
+
aria-current=${ifDefined_js.ifDefined(isCurrentDay && isCurrentMonth && isCurrentYear ? "date" : undefined)}
|
|
281
280
|
class=${classMap_js.classMap({
|
|
282
281
|
today: isCurrentDay && isCurrentMonth && isCurrentYear,
|
|
283
282
|
"selected-ends": isFirstSelectedDate || isLastSelectedDate,
|
|
@@ -285,8 +284,11 @@ class DatepickerCalendar extends sgdsElement["default"] {
|
|
|
285
284
|
disabled: beforeMinDate || afterMinDate
|
|
286
285
|
})}
|
|
287
286
|
@click=${clickHandler}
|
|
288
|
-
|
|
287
|
+
aria-selected=${ifDefined_js.ifDefined(isSelected ? "true" : undefined)}
|
|
288
|
+
tabindex=${this.focusedDate === new Date(dateStr) ? "3" : "-1"}
|
|
289
289
|
?disabled=${beforeMinDate || afterMinDate}
|
|
290
|
+
aria-disabled=${ifDefined_js.ifDefined(beforeMinDate || afterMinDate ? "true" : undefined)}
|
|
291
|
+
role="button"
|
|
290
292
|
>
|
|
291
293
|
${day}
|
|
292
294
|
</td>`);
|
|
@@ -304,12 +306,12 @@ class DatepickerCalendar extends sgdsElement["default"] {
|
|
|
304
306
|
}
|
|
305
307
|
}
|
|
306
308
|
const dayView = lit.html `
|
|
307
|
-
<table class="text-center">
|
|
309
|
+
<table class="text-center" role="grid">
|
|
308
310
|
<thead>
|
|
309
311
|
<tr>
|
|
310
312
|
${DatepickerCalendar.DAY_LABELS.map((label, index) => lit.html `
|
|
311
|
-
<th key=${index}>
|
|
312
|
-
<small>${label}</small>
|
|
313
|
+
<th key=${index} abbr=${label} scope="col">
|
|
314
|
+
<small>${label.slice(0, 3)}</small>
|
|
313
315
|
</th>
|
|
314
316
|
`)}
|
|
315
317
|
</tr>
|
|
@@ -334,6 +336,7 @@ class DatepickerCalendar extends sgdsElement["default"] {
|
|
|
334
336
|
const isFirstSelectedYear = rangeDates[0].getFullYear() === year;
|
|
335
337
|
const isLastSelectedMonth = rangeDates[rangeDates.length - 1].getMonth() === idx;
|
|
336
338
|
const isLastSelectedYear = rangeDates[rangeDates.length - 1].getFullYear() === year;
|
|
339
|
+
const ariaLabel = isCurrentMonth ? `Current month ${m} ${year}` : `${m} ${year}`;
|
|
337
340
|
return lit.html ` <button
|
|
338
341
|
class=${classMap_js.classMap({
|
|
339
342
|
active: selectedTime.includes(time$1),
|
|
@@ -345,8 +348,10 @@ class DatepickerCalendar extends sgdsElement["default"] {
|
|
|
345
348
|
data-month=${idx}
|
|
346
349
|
data-year=${year}
|
|
347
350
|
tabindex="3"
|
|
351
|
+
aria-selected=${selectedTime.includes(time$1)}
|
|
352
|
+
aria-label=${ariaLabel}
|
|
348
353
|
>
|
|
349
|
-
${m}
|
|
354
|
+
${m.slice(0, 3)}
|
|
350
355
|
</button>`;
|
|
351
356
|
})}
|
|
352
357
|
</div>
|
|
@@ -374,6 +379,8 @@ class DatepickerCalendar extends sgdsElement["default"] {
|
|
|
374
379
|
data-year=${y}
|
|
375
380
|
tabindex="3"
|
|
376
381
|
?disabled=${y < 1900}
|
|
382
|
+
aria-selected=${selectedYears.includes(y)}
|
|
383
|
+
aria-label=${ifDefined_js.ifDefined(CURRENT_YEAR === y ? `Current year, ${y}` : undefined)}
|
|
377
384
|
>
|
|
378
385
|
${y}
|
|
379
386
|
</button>
|
|
@@ -404,11 +411,24 @@ class DatepickerCalendar extends sgdsElement["default"] {
|
|
|
404
411
|
}
|
|
405
412
|
DatepickerCalendar.styles = [sgdsElement["default"].styles, datepickerCalendar["default"]];
|
|
406
413
|
/** @internal */
|
|
407
|
-
DatepickerCalendar.DAY_LABELS = ["
|
|
414
|
+
DatepickerCalendar.DAY_LABELS = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
|
|
408
415
|
/** @internal */
|
|
409
416
|
DatepickerCalendar.daysInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
410
417
|
/** @internal */
|
|
411
|
-
DatepickerCalendar.MONTHVIEW_LABELS = [
|
|
418
|
+
DatepickerCalendar.MONTHVIEW_LABELS = [
|
|
419
|
+
"January",
|
|
420
|
+
"February",
|
|
421
|
+
"March",
|
|
422
|
+
"April",
|
|
423
|
+
"May",
|
|
424
|
+
"June",
|
|
425
|
+
"July",
|
|
426
|
+
"August",
|
|
427
|
+
"September",
|
|
428
|
+
"October",
|
|
429
|
+
"November",
|
|
430
|
+
"December"
|
|
431
|
+
];
|
|
412
432
|
tslib.__decorate([
|
|
413
433
|
decorators_js.property({ type: Array })
|
|
414
434
|
], DatepickerCalendar.prototype, "selectedDate", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datepicker-calendar.cjs.js","sources":["../../../src/components/Datepicker/datepicker-calendar.ts"],"sourcesContent":["import { HTMLTemplateResult, html } from \"lit\";\nimport { property } from \"lit/decorators.js\";\nimport SgdsElement from \"../../base/sgds-element\";\nimport { createYearViewArray, setTimeToNoon } from \"../../utils/time\";\nimport { watch } from \"../../utils/watch\";\nimport styles from \"./datepicker-calendar.scss\";\nimport { ViewEnum } from \"./types\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { isAfter, isEqual } from \"date-fns\";\n\nconst TODAY_DATE = new Date();\n\nconst keyPressAction = {\n ArrowUp: {\n days: -7,\n months: -3,\n years: -3\n },\n ArrowDown: {\n days: 7,\n months: 3,\n years: 3\n },\n ArrowRight: {\n days: 1,\n months: 1,\n years: 1\n },\n ArrowLeft: {\n days: -1,\n months: -1,\n years: -1\n }\n};\nexport class DatepickerCalendar extends SgdsElement {\n static styles = [SgdsElement.styles, styles];\n\n /** @internal */\n static DAY_LABELS = [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"];\n\n /** @internal */\n static daysInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\n\n /** @internal */\n static MONTHVIEW_LABELS = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"];\n\n /** @internal */\n @property({ type: Array }) selectedDate: Date[] = [];\n\n /** @internal */\n @property({ attribute: false }) displayDate: Date;\n\n /** @internal */\n @property({ type: String }) minDate?: string;\n\n /** @internal */\n @property({ type: String }) maxDate?: string;\n\n /** @internal */\n @property({ type: String, reflect: true }) mode: \"single\" | \"range\" = \"single\";\n\n private focusedDate: Date;\n\n /** @internal */\n @property() view: ViewEnum;\n\n /** @internal */\n @property({ type: Boolean }) show: boolean;\n\n @property()\n focusedTabIndex: number;\n\n /**Shifts focus from Input to Calendar */\n public focusOnCalendar(toBlurEl: HTMLElement) {\n toBlurEl.blur();\n this._focusOnCalendarCell();\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener(\"keydown\", this._handleKeyPress);\n }\n\n firstUpdated() {\n // if (this.selectedDate.length > 0) {\n // this.focusedDate = setTimeToNoon(this.selectedDate[0]);\n // } else {\n // this.focusedDate = this.displayDate && setTimeToNoon(this.displayDate);\n // }\n }\n updated() {\n /** For KeyboardNavigation (switching months) and ClickNavigation:\n * Runs after render has completed and td of next month has appeared.\n * For the case when calendar view changes to the next month\n * */\n\n if (this.focusedTabIndex === 3) {\n this._focusOnCalendarCell();\n }\n }\n\n @watch(\"displayDate\")\n _updateFocusedDate() {\n this.focusedDate = setTimeToNoon(this.displayDate);\n if (this.focusedDate.getFullYear() < 1900) {\n this.focusedDate.setFullYear(1900);\n }\n }\n\n private _setFocusedDate(shift: number) {\n const currentFocusedDate = this.focusedDate.getDate();\n const currentFocusedMonth = this.focusedDate.getMonth();\n const currentFocusedYear = this.focusedDate.getFullYear();\n switch (this.view) {\n case \"days\": {\n const newFocusedDate = setTimeToNoon(\n new Date(currentFocusedYear, currentFocusedMonth, currentFocusedDate + shift)\n );\n if (isAfter(newFocusedDate, new Date(0, 0, 1, 12)) || isEqual(newFocusedDate, new Date(0, 0, 1, 12)))\n this.focusedDate = newFocusedDate;\n break;\n }\n case \"months\": {\n const newFocusedDate = setTimeToNoon(\n new Date(currentFocusedYear, currentFocusedMonth + shift, currentFocusedDate)\n );\n\n if (isAfter(newFocusedDate, new Date(0, 0, 1, 12)) || isEqual(newFocusedDate, new Date(0, 0, 1, 12))) {\n this.focusedDate = newFocusedDate;\n }\n break;\n }\n case \"years\": {\n const newFocusedDate = setTimeToNoon(\n new Date(currentFocusedYear + shift, currentFocusedMonth, currentFocusedDate)\n );\n if (newFocusedDate.getFullYear() >= 1900) {\n this.focusedDate = newFocusedDate;\n }\n break;\n }\n }\n }\n private _handleEnterDateKeyboard(event: KeyboardEvent) {\n const targetElement = event.composedPath()[0] as HTMLElement;\n if (targetElement.classList.contains(\"disabled\")) return;\n\n switch (this.view) {\n case \"days\":\n this._onClickDay(event);\n break;\n case \"months\": {\n const { month } = targetElement.dataset;\n this._onClickMonth(parseInt(month));\n break;\n }\n case \"years\": {\n const { year } = targetElement.dataset;\n this._onClickYear(parseInt(year));\n }\n }\n }\n private _handleKeyPress(event: KeyboardEvent) {\n if (event.key === \"Enter\") {\n event.preventDefault();\n this._handleEnterDateKeyboard(event);\n return;\n }\n if (event.key === \"Tab\") {\n const targetEl: HTMLElement = this._getFocusedTarget();\n if (this.focusedTabIndex !== 3) targetEl.blur();\n return;\n }\n if (event.key.includes(\"Arrow\")) {\n event.preventDefault();\n this._blurCalendarCell();\n const keyShiftObject = keyPressAction[event.key];\n const shiftNumber = keyShiftObject[this.view];\n\n this._setFocusedDate(shiftNumber);\n\n this._focusOnCalendarCell();\n }\n }\n\n private _generateIncrementDates(): Date[] {\n const start = setTimeToNoon(this.selectedDate[0]);\n\n if (this.selectedDate.length < 2) {\n return [start];\n }\n\n const end = setTimeToNoon(this.selectedDate[1]);\n const arr: Date[] = [];\n if (start.getTime() < end.getTime()) {\n for (let dt = start; dt <= end; dt.setDate(dt.getDate() + 1)) {\n arr.push(new Date(dt));\n }\n } else {\n for (let dt = end; dt <= start; dt.setDate(dt.getDate() + 1)) {\n arr.push(new Date(dt));\n }\n }\n return arr;\n }\n\n private _onClickDay(event: MouseEvent | KeyboardEvent) {\n const { day, date } = (event.composedPath()[0] as HTMLTableCellElement).dataset;\n\n const displayDateClone = new Date(this.displayDate);\n displayDateClone.setDate(parseInt(day));\n /** update new focused date for mouse click */\n if (event.type === \"click\") {\n this.focusedDate = setTimeToNoon(new Date(date));\n }\n\n if (this.mode === \"single\") {\n // Single mode: Select a single date\n\n this.selectedDate = [displayDateClone];\n\n // Emit event with selected date\n this.emit(\"sgds-selectdates\", { detail: this.selectedDate });\n } else if (this.mode === \"range\") {\n // Range mode: Select a range of dates\n const selectedDates = [...this.selectedDate];\n\n if (selectedDates.length === 0 || selectedDates.length === 2) {\n // No dates selected yet or both dates already selected,\n // start a new range by clearing the selected dates array\n selectedDates.length = 0;\n }\n\n // Add the selected date to the range\n selectedDates.push(displayDateClone);\n\n // Update the selectedDate property\n this.selectedDate = selectedDates;\n\n // Emit event with the range of selected dates\n this.emit(\"sgds-selectdates\", { detail: this.selectedDate });\n }\n\n // Check if the selected date is before minDate or after maxDate\n const minimumDate = this.minDate ? setTimeToNoon(new Date(this.minDate)) : null;\n const maximumDate = this.maxDate ? setTimeToNoon(new Date(this.maxDate)) : null;\n\n const selectedDate = setTimeToNoon(displayDateClone);\n if ((minimumDate && selectedDate < minimumDate) || (maximumDate && selectedDate > maximumDate)) {\n event.stopPropagation();\n event.preventDefault();\n }\n }\n\n private _onClickMonth(month: number, year: number = this.focusedDate.getFullYear()) {\n const displayDateClone = new Date(this.displayDate);\n this.view = \"days\";\n displayDateClone.setMonth(month);\n displayDateClone.setFullYear(year);\n this.displayDate = displayDateClone;\n this.emit(\"sgds-view\", { detail: this.view });\n //once clicked, should change view to days, and hold value and change view\n this.emit(\"sgds-selectmonth\", { detail: this.displayDate });\n }\n\n private _onClickYear(year: number) {\n const displayDateClone = new Date(this.displayDate);\n displayDateClone.setFullYear(year);\n this.displayDate = displayDateClone;\n this.view = \"months\";\n this.emit(\"sgds-view\", { detail: this.view });\n\n this.emit(\"sgds-selectyear\", { detail: this.displayDate });\n }\n\n private _getFocusedTarget(): HTMLElement {\n const queryObj = {\n days: `td[data-date=\"${this.focusedDate.toISOString()}\"]`,\n months: `button[data-month=\"${this.focusedDate.getMonth()}\"][data-year=\"${this.focusedDate.getFullYear()}\"]`,\n years: `button[data-year=\"${this.focusedDate.getFullYear()}\"]`\n };\n const queryString = queryObj[this.view];\n const targetEl: HTMLElement = this.shadowRoot.querySelector(`${queryString}`);\n return targetEl;\n }\n private _blurCalendarCell() {\n const targetEl = this._getFocusedTarget();\n targetEl.setAttribute(\"tabindex\", \"-1\");\n targetEl.blur();\n }\n private _focusOnCalendarCell() {\n const targetEl = this._getFocusedTarget();\n if (targetEl) {\n targetEl.setAttribute(\"tabindex\", \"3\");\n targetEl.focus();\n this.emit(\"sgds-update-focus\", { detail: this.focusedDate });\n } else {\n /** Change month view */\n this.emit(\"sgds-change-calendar\", { detail: this.focusedDate });\n }\n }\n private _generateDays() {\n const selectedDates = this.selectedDate.map(d => setTimeToNoon(d));\n\n const rangeSelectedDates = this._generateIncrementDates();\n\n const minimumDate = this.minDate ? setTimeToNoon(new Date(this.minDate)) : null;\n const maximumDate = this.maxDate ? setTimeToNoon(new Date(this.maxDate)) : null;\n const year = this.displayDate.getFullYear();\n const month = this.displayDate.getMonth();\n const firstDateOfMonth = new Date(year, month, 1);\n const startingDayOfMonth = firstDateOfMonth.getDay();\n let monthLength = DatepickerCalendar.daysInMonth[month];\n if (month === 1) {\n if ((year % 4 === 0 && year % 100 !== 0) || year % 400 === 0) {\n monthLength = 29;\n }\n }\n\n const weeks = [];\n let day = 1;\n for (let i = 0; i < 9; i++) {\n const week = [];\n for (let j = 0; j <= 6; j++) {\n if (day <= monthLength && (i > 0 || j >= startingDayOfMonth)) {\n const date = new Date(year, month, day, 12, 0, 0, 0).toISOString();\n const beforeMinDate = minimumDate && Date.parse(date) < Date.parse(minimumDate.toISOString());\n const afterMinDate = maximumDate && Date.parse(date) > Date.parse(maximumDate.toISOString());\n const clickHandler = beforeMinDate || afterMinDate ? undefined : this._onClickDay;\n\n const isCurrentMonth = TODAY_DATE.getMonth() === this.displayDate.getMonth();\n const isCurrentYear = TODAY_DATE.getFullYear() === this.displayDate.getFullYear();\n const isCurrentDay = TODAY_DATE.getDate() === day;\n\n const isSelected =\n selectedDates.length > 0 && rangeSelectedDates.some(d => Date.parse(date) === Date.parse(d.toISOString()));\n const isFirstSelectedDate = selectedDates.length > 0 && rangeSelectedDates[0].toISOString() === date;\n const isLastSelectedDate =\n selectedDates.length > 1 && rangeSelectedDates[rangeSelectedDates.length - 1].toISOString() === date;\n\n week.push(\n html`<td\n key=${j}\n data-date=${date}\n data-day=${day}\n class=${classMap({\n today: isCurrentDay && isCurrentMonth && isCurrentYear,\n \"selected-ends\": isFirstSelectedDate || isLastSelectedDate,\n active: isSelected,\n disabled: beforeMinDate || afterMinDate\n })}\n @click=${clickHandler}\n tabindex=${this.focusedDate === new Date(date) ? \"3\" : \"-1\"}\n ?disabled=${beforeMinDate || afterMinDate}\n >\n ${day}\n </td>`\n );\n day++;\n } else {\n week.push(html`<td key=${j}></td>`);\n }\n }\n\n weeks.push(\n html`<tr key=${i}>\n ${week}\n </tr>`\n );\n if (day > monthLength) {\n break;\n }\n }\n\n const dayView = html`\n <table class=\"text-center\">\n <thead>\n <tr>\n ${DatepickerCalendar.DAY_LABELS.map(\n (label: string, index: number) =>\n html`\n <th key=${index}>\n <small>${label}</small>\n </th>\n `\n )}\n </tr>\n </thead>\n <tbody>\n ${weeks}\n </tbody>\n </table>\n `;\n return dayView;\n }\n\n private _generateMonths() {\n const rangeDates = this._generateIncrementDates();\n const selectedTime = rangeDates.map(e => setTimeToNoon(new Date(e.getFullYear(), e.getMonth())).getTime());\n\n const year = this.displayDate.getFullYear();\n\n const monthView = html`\n <div class=\"sgds monthpicker\">\n ${DatepickerCalendar.MONTHVIEW_LABELS.map((m, idx) => {\n const isCurrentMonth = idx === TODAY_DATE.getMonth() && year === TODAY_DATE.getFullYear();\n const time = setTimeToNoon(new Date(year, idx)).getTime();\n const isFirstSelectedMonth = rangeDates[0].getMonth() === idx;\n const isFirstSelectedYear = rangeDates[0].getFullYear() === year;\n const isLastSelectedMonth = rangeDates[rangeDates.length - 1].getMonth() === idx;\n const isLastSelectedYear = rangeDates[rangeDates.length - 1].getFullYear() === year;\n return html` <button\n class=${classMap({\n active: selectedTime.includes(time),\n today: isCurrentMonth,\n month: true,\n \"selected-ends\":\n (isFirstSelectedMonth && isFirstSelectedYear) || (isLastSelectedMonth && isLastSelectedYear)\n })}\n @click=${() => this._onClickMonth(idx)}\n data-month=${idx}\n data-year=${year}\n tabindex=\"3\"\n >\n ${m}\n </button>`;\n })}\n </div>\n `;\n return monthView;\n }\n\n private _generateYears() {\n const selectedYears = this._generateIncrementDates().map(e => e.getFullYear());\n const CURRENT_YEAR = TODAY_DATE.getFullYear();\n\n const yearArray = createYearViewArray(this.displayDate, CURRENT_YEAR);\n\n const yearView = html`\n <div class=\"sgds yearpicker\">\n ${yearArray.map(y => {\n const isFirstSelectedYear = selectedYears[0] === y;\n const isLastSectedYear = selectedYears[selectedYears.length - 1] === y;\n return html`\n <button\n class=${classMap({\n active: selectedYears.includes(y),\n year: true,\n today: CURRENT_YEAR === y,\n \"selected-ends\": isFirstSelectedYear || isLastSectedYear\n })}\n @click=${() => this._onClickYear(y)}\n data-year=${y}\n tabindex=\"3\"\n ?disabled=${y < 1900}\n >\n ${y}\n </button>\n `;\n })}\n </div>\n `;\n return yearView;\n }\n render() {\n let viewContent: HTMLTemplateResult;\n\n switch (this.view) {\n case \"days\":\n viewContent = html` ${this._generateDays()} `;\n break;\n case \"months\":\n viewContent = html` ${this._generateMonths()} `;\n break;\n case \"years\":\n viewContent = html` ${this._generateYears()} `;\n break;\n default:\n viewContent = html` ${this._generateDays()} `; // Set a default view\n break;\n }\n\n return html` <div class=\"datepicker-body\">${viewContent}</div> `;\n }\n}\n\nexport default DatepickerCalendar;\n"],"names":["SgdsElement","setTimeToNoon","isAfter","isEqual","html","classMap","time","createYearViewArray","styles","__decor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,CAAA,SAAA,EAAA,oBAAA,EAAA,IAAA,CAAA;;;;;"}
|
|
1
|
+
{"version":3,"file":"datepicker-calendar.cjs.js","sources":["../../../src/components/Datepicker/datepicker-calendar.ts"],"sourcesContent":["import { format, isAfter, isEqual } from \"date-fns\";\nimport { HTMLTemplateResult, html } from \"lit\";\nimport { property } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport SgdsElement from \"../../base/sgds-element\";\nimport { createYearViewArray, setTimeToNoon } from \"../../utils/time\";\nimport { watch } from \"../../utils/watch\";\nimport styles from \"./datepicker-calendar.scss\";\nimport { ViewEnum } from \"./types\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\n\nconst TODAY_DATE = new Date();\n\nconst keyPressAction = {\n ArrowUp: {\n days: -7,\n months: -3,\n years: -3\n },\n ArrowDown: {\n days: 7,\n months: 3,\n years: 3\n },\n ArrowRight: {\n days: 1,\n months: 1,\n years: 1\n },\n ArrowLeft: {\n days: -1,\n months: -1,\n years: -1\n }\n};\nexport class DatepickerCalendar extends SgdsElement {\n static styles = [SgdsElement.styles, styles];\n\n /** @internal */\n static DAY_LABELS = [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"];\n\n /** @internal */\n static daysInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\n\n /** @internal */\n static MONTHVIEW_LABELS = [\n \"January\",\n \"February\",\n \"March\",\n \"April\",\n \"May\",\n \"June\",\n \"July\",\n \"August\",\n \"September\",\n \"October\",\n \"November\",\n \"December\"\n ];\n\n /** @internal */\n @property({ type: Array }) selectedDate: Date[] = [];\n\n /** @internal */\n @property({ attribute: false }) displayDate: Date;\n\n /** @internal */\n @property({ type: String }) minDate?: string;\n\n /** @internal */\n @property({ type: String }) maxDate?: string;\n\n /** @internal */\n @property({ type: String, reflect: true }) mode: \"single\" | \"range\" = \"single\";\n\n private focusedDate: Date;\n\n /** @internal */\n @property() view: ViewEnum;\n\n /** @internal */\n @property({ type: Boolean }) show: boolean;\n\n @property()\n focusedTabIndex: number;\n\n /**Shifts focus from Input to Calendar */\n public focusOnCalendar(toBlurEl: HTMLElement) {\n toBlurEl.blur();\n this._focusOnCalendarCell();\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener(\"keydown\", this._handleKeyPress);\n }\n\n updated() {\n /** For KeyboardNavigation (switching months) and ClickNavigation:\n * Runs after render has completed and td of next month has appeared.\n * For the case when calendar view changes to the next month\n * */\n\n if (this.focusedTabIndex === 3) {\n this._focusOnCalendarCell();\n }\n }\n\n @watch(\"displayDate\")\n _updateFocusedDate() {\n this.focusedDate = setTimeToNoon(this.displayDate);\n if (this.focusedDate.getFullYear() < 1900) {\n this.focusedDate.setFullYear(1900);\n }\n }\n\n private _setFocusedDate(shift: number) {\n const currentFocusedDate = this.focusedDate.getDate();\n const currentFocusedMonth = this.focusedDate.getMonth();\n const currentFocusedYear = this.focusedDate.getFullYear();\n switch (this.view) {\n case \"days\": {\n const newFocusedDate = setTimeToNoon(\n new Date(currentFocusedYear, currentFocusedMonth, currentFocusedDate + shift)\n );\n if (isAfter(newFocusedDate, new Date(0, 0, 1, 12)) || isEqual(newFocusedDate, new Date(0, 0, 1, 12)))\n this.focusedDate = newFocusedDate;\n break;\n }\n case \"months\": {\n const newFocusedDate = setTimeToNoon(\n new Date(currentFocusedYear, currentFocusedMonth + shift, currentFocusedDate)\n );\n\n if (isAfter(newFocusedDate, new Date(0, 0, 1, 12)) || isEqual(newFocusedDate, new Date(0, 0, 1, 12))) {\n this.focusedDate = newFocusedDate;\n }\n break;\n }\n case \"years\": {\n const newFocusedDate = setTimeToNoon(\n new Date(currentFocusedYear + shift, currentFocusedMonth, currentFocusedDate)\n );\n if (newFocusedDate.getFullYear() >= 1900) {\n this.focusedDate = newFocusedDate;\n }\n break;\n }\n }\n }\n private _handleEnterDateKeyboard(event: KeyboardEvent) {\n const targetElement = event.composedPath()[0] as HTMLElement;\n if (targetElement.classList.contains(\"disabled\")) return;\n\n switch (this.view) {\n case \"days\":\n this._onClickDay(event);\n break;\n case \"months\": {\n const { month } = targetElement.dataset;\n this._onClickMonth(parseInt(month));\n break;\n }\n case \"years\": {\n const { year } = targetElement.dataset;\n this._onClickYear(parseInt(year));\n }\n }\n }\n private _handleKeyPress(event: KeyboardEvent) {\n if (event.key === \"Enter\") {\n event.preventDefault();\n this._handleEnterDateKeyboard(event);\n return;\n }\n if (event.key === \"Tab\") {\n const targetEl: HTMLElement = this._getFocusedTarget();\n if (this.focusedTabIndex !== 3) targetEl.blur();\n return;\n }\n if (event.key.includes(\"Arrow\")) {\n event.preventDefault();\n this._blurCalendarCell();\n const keyShiftObject = keyPressAction[event.key];\n const shiftNumber = keyShiftObject[this.view];\n\n this._setFocusedDate(shiftNumber);\n\n this._focusOnCalendarCell();\n }\n }\n\n private _generateIncrementDates(): Date[] {\n const start = setTimeToNoon(this.selectedDate[0]);\n\n if (this.selectedDate.length < 2) {\n return [start];\n }\n\n const end = setTimeToNoon(this.selectedDate[1]);\n const arr: Date[] = [];\n if (start.getTime() < end.getTime()) {\n for (let dt = start; dt <= end; dt.setDate(dt.getDate() + 1)) {\n arr.push(new Date(dt));\n }\n } else {\n for (let dt = end; dt <= start; dt.setDate(dt.getDate() + 1)) {\n arr.push(new Date(dt));\n }\n }\n return arr;\n }\n\n private _onClickDay(event: MouseEvent | KeyboardEvent) {\n const { day, date } = (event.composedPath()[0] as HTMLTableCellElement).dataset;\n\n const displayDateClone = new Date(this.displayDate);\n displayDateClone.setDate(parseInt(day));\n /** update new focused date for mouse click */\n if (event.type === \"click\") {\n this.focusedDate = setTimeToNoon(new Date(date));\n }\n\n if (this.mode === \"single\") {\n // Single mode: Select a single date\n\n this.selectedDate = [displayDateClone];\n\n // Emit event with selected date\n this.emit(\"sgds-selectdates\", { detail: this.selectedDate });\n } else if (this.mode === \"range\") {\n // Range mode: Select a range of dates\n const selectedDates = [...this.selectedDate];\n\n if (selectedDates.length === 0 || selectedDates.length === 2) {\n // No dates selected yet or both dates already selected,\n // start a new range by clearing the selected dates array\n selectedDates.length = 0;\n }\n\n // Add the selected date to the range\n selectedDates.push(displayDateClone);\n\n // Update the selectedDate property\n this.selectedDate = selectedDates;\n\n // Emit event with the range of selected dates\n this.emit(\"sgds-selectdates\", { detail: this.selectedDate });\n }\n\n // Check if the selected date is before minDate or after maxDate\n const minimumDate = this.minDate ? setTimeToNoon(new Date(this.minDate)) : null;\n const maximumDate = this.maxDate ? setTimeToNoon(new Date(this.maxDate)) : null;\n\n const selectedDate = setTimeToNoon(displayDateClone);\n if ((minimumDate && selectedDate < minimumDate) || (maximumDate && selectedDate > maximumDate)) {\n event.stopPropagation();\n event.preventDefault();\n }\n }\n\n private _onClickMonth(month: number, year: number = this.focusedDate.getFullYear()) {\n const displayDateClone = new Date(this.displayDate);\n this.view = \"days\";\n displayDateClone.setMonth(month);\n displayDateClone.setFullYear(year);\n this.displayDate = displayDateClone;\n this.emit(\"sgds-view\", { detail: this.view });\n //once clicked, should change view to days, and hold value and change view\n this.emit(\"sgds-selectmonth\", { detail: this.displayDate });\n }\n\n private _onClickYear(year: number) {\n const displayDateClone = new Date(this.displayDate);\n displayDateClone.setFullYear(year);\n this.displayDate = displayDateClone;\n this.view = \"months\";\n this.emit(\"sgds-view\", { detail: this.view });\n\n this.emit(\"sgds-selectyear\", { detail: this.displayDate });\n }\n\n private _getFocusedTarget(): HTMLElement {\n const queryObj = {\n days: `td[data-date=\"${this.focusedDate.toISOString()}\"]`,\n months: `button[data-month=\"${this.focusedDate.getMonth()}\"][data-year=\"${this.focusedDate.getFullYear()}\"]`,\n years: `button[data-year=\"${this.focusedDate.getFullYear()}\"]`\n };\n const queryString = queryObj[this.view];\n const targetEl: HTMLElement = this.shadowRoot.querySelector(`${queryString}`);\n return targetEl;\n }\n private _blurCalendarCell() {\n const targetEl = this._getFocusedTarget();\n targetEl.setAttribute(\"tabindex\", \"-1\");\n targetEl.blur();\n }\n private _focusOnCalendarCell() {\n const targetEl = this._getFocusedTarget();\n if (targetEl) {\n targetEl.setAttribute(\"tabindex\", \"3\");\n targetEl.focus();\n this.emit(\"sgds-update-focus\", { detail: this.focusedDate });\n } else {\n /** Change month view */\n this.emit(\"sgds-change-calendar\", { detail: this.focusedDate });\n }\n }\n private _generateDays() {\n const selectedDates = this.selectedDate.map(d => setTimeToNoon(d));\n\n const rangeSelectedDates = this._generateIncrementDates();\n const minimumDate = this.minDate ? setTimeToNoon(new Date(this.minDate)) : null;\n const maximumDate = this.maxDate ? setTimeToNoon(new Date(this.maxDate)) : null;\n const year = this.displayDate.getFullYear();\n const month = this.displayDate.getMonth();\n const firstDateOfMonth = new Date(year, month, 1);\n const startingDayOfMonth = firstDateOfMonth.getDay();\n let monthLength = DatepickerCalendar.daysInMonth[month];\n if (month === 1) {\n if ((year % 4 === 0 && year % 100 !== 0) || year % 400 === 0) {\n monthLength = 29;\n }\n }\n\n const weeks = [];\n let day = 1;\n for (let i = 0; i < 9; i++) {\n const week = [];\n for (let j = 0; j <= 6; j++) {\n if (day <= monthLength && (i > 0 || j >= startingDayOfMonth)) {\n const dateObj = new Date(year, month, day, 12, 0, 0, 0);\n const dateStr = dateObj.toISOString();\n const beforeMinDate = minimumDate && Date.parse(dateStr) < Date.parse(minimumDate.toISOString());\n const afterMinDate = maximumDate && Date.parse(dateStr) > Date.parse(maximumDate.toISOString());\n const clickHandler = beforeMinDate || afterMinDate ? undefined : this._onClickDay;\n\n const isCurrentMonth = TODAY_DATE.getMonth() === this.displayDate.getMonth();\n const isCurrentYear = TODAY_DATE.getFullYear() === this.displayDate.getFullYear();\n const isCurrentDay = TODAY_DATE.getDate() === day;\n\n const isSelected =\n selectedDates.length > 0 &&\n rangeSelectedDates.some(d => Date.parse(dateStr) === Date.parse(d.toISOString()));\n const isFirstSelectedDate = selectedDates.length > 0 && rangeSelectedDates[0].toISOString() === dateStr;\n const isLastSelectedDate =\n selectedDates.length > 1 && rangeSelectedDates[rangeSelectedDates.length - 1].toISOString() === dateStr;\n const ariaLabel =\n `${isCurrentDay && isCurrentMonth && isCurrentYear ? \"Today's date, \" : \"\"}` + format(dateObj, \"PPPP\");\n week.push(\n html`<td\n key=${j}\n data-date=${dateStr}\n data-day=${day}\n aria-label=${ariaLabel}\n aria-current=${ifDefined(isCurrentDay && isCurrentMonth && isCurrentYear ? \"date\" : undefined)}\n class=${classMap({\n today: isCurrentDay && isCurrentMonth && isCurrentYear,\n \"selected-ends\": isFirstSelectedDate || isLastSelectedDate,\n active: isSelected,\n disabled: beforeMinDate || afterMinDate\n })}\n @click=${clickHandler}\n aria-selected=${ifDefined(isSelected ? \"true\" : undefined)}\n tabindex=${this.focusedDate === new Date(dateStr) ? \"3\" : \"-1\"}\n ?disabled=${beforeMinDate || afterMinDate}\n aria-disabled=${ifDefined(beforeMinDate || afterMinDate ? \"true\" : undefined)}\n role=\"button\"\n >\n ${day}\n </td>`\n );\n day++;\n } else {\n week.push(html`<td key=${j}></td>`);\n }\n }\n\n weeks.push(\n html`<tr key=${i}>\n ${week}\n </tr>`\n );\n if (day > monthLength) {\n break;\n }\n }\n\n const dayView = html`\n <table class=\"text-center\" role=\"grid\">\n <thead>\n <tr>\n ${DatepickerCalendar.DAY_LABELS.map(\n (label: string, index: number) =>\n html`\n <th key=${index} abbr=${label} scope=\"col\">\n <small>${label.slice(0, 3)}</small>\n </th>\n `\n )}\n </tr>\n </thead>\n <tbody>\n ${weeks}\n </tbody>\n </table>\n `;\n return dayView;\n }\n\n private _generateMonths() {\n const rangeDates = this._generateIncrementDates();\n const selectedTime = rangeDates.map(e => setTimeToNoon(new Date(e.getFullYear(), e.getMonth())).getTime());\n\n const year = this.displayDate.getFullYear();\n\n const monthView = html`\n <div class=\"sgds monthpicker\">\n ${DatepickerCalendar.MONTHVIEW_LABELS.map((m, idx) => {\n const isCurrentMonth = idx === TODAY_DATE.getMonth() && year === TODAY_DATE.getFullYear();\n const time = setTimeToNoon(new Date(year, idx)).getTime();\n const isFirstSelectedMonth = rangeDates[0].getMonth() === idx;\n const isFirstSelectedYear = rangeDates[0].getFullYear() === year;\n const isLastSelectedMonth = rangeDates[rangeDates.length - 1].getMonth() === idx;\n const isLastSelectedYear = rangeDates[rangeDates.length - 1].getFullYear() === year;\n const ariaLabel = isCurrentMonth ? `Current month ${m} ${year}` : `${m} ${year}`;\n return html` <button\n class=${classMap({\n active: selectedTime.includes(time),\n today: isCurrentMonth,\n month: true,\n \"selected-ends\":\n (isFirstSelectedMonth && isFirstSelectedYear) || (isLastSelectedMonth && isLastSelectedYear)\n })}\n @click=${() => this._onClickMonth(idx)}\n data-month=${idx}\n data-year=${year}\n tabindex=\"3\"\n aria-selected=${selectedTime.includes(time)}\n aria-label=${ariaLabel}\n >\n ${m.slice(0, 3)}\n </button>`;\n })}\n </div>\n `;\n return monthView;\n }\n\n private _generateYears() {\n const selectedYears = this._generateIncrementDates().map(e => e.getFullYear());\n const CURRENT_YEAR = TODAY_DATE.getFullYear();\n\n const yearArray = createYearViewArray(this.displayDate, CURRENT_YEAR);\n\n const yearView = html`\n <div class=\"sgds yearpicker\">\n ${yearArray.map(y => {\n const isFirstSelectedYear = selectedYears[0] === y;\n const isLastSectedYear = selectedYears[selectedYears.length - 1] === y;\n return html`\n <button\n class=${classMap({\n active: selectedYears.includes(y),\n year: true,\n today: CURRENT_YEAR === y,\n \"selected-ends\": isFirstSelectedYear || isLastSectedYear\n })}\n @click=${() => this._onClickYear(y)}\n data-year=${y}\n tabindex=\"3\"\n ?disabled=${y < 1900}\n aria-selected=${selectedYears.includes(y)}\n aria-label=${ifDefined(CURRENT_YEAR === y ? `Current year, ${y}` : undefined)}\n >\n ${y}\n </button>\n `;\n })}\n </div>\n `;\n return yearView;\n }\n render() {\n let viewContent: HTMLTemplateResult;\n\n switch (this.view) {\n case \"days\":\n viewContent = html` ${this._generateDays()} `;\n break;\n case \"months\":\n viewContent = html` ${this._generateMonths()} `;\n break;\n case \"years\":\n viewContent = html` ${this._generateYears()} `;\n break;\n default:\n viewContent = html` ${this._generateDays()} `; // Set a default view\n break;\n }\n\n return html` <div class=\"datepicker-body\">${viewContent}</div> `;\n }\n}\n\nexport default DatepickerCalendar;\n"],"names":["SgdsElement","setTimeToNoon","isAfter","isEqual","format","html","ifDefined","classMap","time","createYearViewArray","styles","__decorate","property","watch"],"mappings":";;;;;;;;;;;;;;;AAWA,MAAM,UAAU,GAAG,IAAI,IAAI,EAAE,CAAC;AAE9B,MAAM,cAAc,GAAG;AACrB,IAAA,OAAO,EAAE;QACP,IAAI,EAAE,CAAC,CAAC;QACR,MAAM,EAAE,CAAC,CAAC;QACV,KAAK,EAAE,CAAC,CAAC;AACV,KAAA;AACD,IAAA,SAAS,EAAE;AACT,QAAA,IAAI,EAAE,CAAC;AACP,QAAA,MAAM,EAAE,CAAC;AACT,QAAA,KAAK,EAAE,CAAC;AACT,KAAA;AACD,IAAA,UAAU,EAAE;AACV,QAAA,IAAI,EAAE,CAAC;AACP,QAAA,MAAM,EAAE,CAAC;AACT,QAAA,KAAK,EAAE,CAAC;AACT,KAAA;AACD,IAAA,SAAS,EAAE;QACT,IAAI,EAAE,CAAC,CAAC;QACR,MAAM,EAAE,CAAC,CAAC;QACV,KAAK,EAAE,CAAC,CAAC;AACV,KAAA;CACF,CAAC;AACI,MAAO,kBAAmB,SAAQA,sBAAW,CAAA;AAAnD,IAAA,WAAA,GAAA;;;QA0B6B,IAAY,CAAA,YAAA,GAAW,EAAE,CAAC;;QAYV,IAAI,CAAA,IAAA,GAAuB,QAAQ,CAAC;KA8ahF;;AAhaQ,IAAA,eAAe,CAAC,QAAqB,EAAA;QAC1C,QAAQ,CAAC,IAAI,EAAE,CAAC;QAChB,IAAI,CAAC,oBAAoB,EAAE,CAAC;KAC7B;IAED,iBAAiB,GAAA;QACf,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,CAAC,gBAAgB,CAAC,SAAS,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;KACxD;IAED,OAAO,G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;"}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var lit = require('lit');
|
|
6
6
|
|
|
7
|
-
var css_248z = lit.css`.datepicker-body{padding:0 1.5rem 1.5rem}button.month.active.selected-ends,button.year.active.selected-ends,td[data-day].active.selected-ends{background-color:var(--datepicker-selected-date-bg-color);color:var(--datepicker-selected-date-text-color)}button.month.active,button.month:hover,button.year.active,button.year:hover,td[data-day].active,td[data-day]:hover:not(.disabled){background-color:var(--datepicker-hover-bg-color);cursor:pointer}.sgds.monthpicker,.sgds.yearpicker{align-content:space-between;display:grid;grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(4,3rem);justify-content:space-between;padding:1rem 0 0}button.month,button.year{background-color:transparent;border:0;padding:0}button.month:focus,button.year:focus{outline:var(--datepicker-theme-color) auto 2px;z-index:100}td{height:3rem;padding:0;width:3rem}td[data-day]{cursor:pointer}td[data-day]:focus{outline:var(--datepicker-theme-color) auto 2px}td[data-day].disabled{color:var(--sgds-gray-400);cursor:not-allowed}.today{color:var(--datepicker-theme-color)}`;
|
|
7
|
+
var css_248z = lit.css`.datepicker-body{padding:0 1.5rem 1.5rem}button.month.active.selected-ends,button.year.active.selected-ends,td[data-day].active.selected-ends{background-color:var(--datepicker-selected-date-bg-color);color:var(--datepicker-selected-date-text-color)}button.month.active,button.month:hover:not(.active),button.year.active,button.year:hover:not(.active),td[data-day].active,td[data-day]:hover:not(.disabled):not(.selected-ends){background-color:var(--datepicker-hover-bg-color);cursor:pointer}.sgds.monthpicker,.sgds.yearpicker{align-content:space-between;display:grid;grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(4,3rem);justify-content:space-between;padding:1rem 0 0}button.month,button.year{background-color:transparent;border:0;padding:0}button.month:focus,button.year:focus{outline:var(--datepicker-theme-color) auto 2px;z-index:100}td{height:3rem;padding:0;width:3rem}td[data-day]{cursor:pointer}td[data-day]:focus{outline:var(--datepicker-theme-color) auto 2px}td[data-day].disabled{color:var(--sgds-gray-400);cursor:not-allowed}.today{color:var(--datepicker-theme-color)}`;
|
|
8
8
|
|
|
9
9
|
exports["default"] = css_248z;
|
|
10
10
|
//# sourceMappingURL=datepicker-calendar.cjs2.js.map
|
|
@@ -27,7 +27,6 @@ export declare class DatepickerCalendar extends SgdsElement {
|
|
|
27
27
|
/**Shifts focus from Input to Calendar */
|
|
28
28
|
focusOnCalendar(toBlurEl: HTMLElement): void;
|
|
29
29
|
connectedCallback(): void;
|
|
30
|
-
firstUpdated(): void;
|
|
31
30
|
updated(): void;
|
|
32
31
|
_updateFocusedDate(): void;
|
|
33
32
|
private _setFocusedDate;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { __decorate } from 'tslib';
|
|
2
|
+
import { isAfter, isEqual, format } from 'date-fns';
|
|
2
3
|
import { html } from 'lit';
|
|
3
4
|
import { property } from 'lit/decorators.js';
|
|
5
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
4
6
|
import SgdsElement from '../../base/sgds-element.js';
|
|
5
7
|
import { setTimeToNoon, createYearViewArray } from '../../utils/time.js';
|
|
6
8
|
import { watch } from '../../utils/watch.js';
|
|
7
9
|
import css_248z from './datepicker-calendar2.js';
|
|
8
|
-
import {
|
|
9
|
-
import { isAfter, isEqual } from 'date-fns';
|
|
10
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
10
11
|
|
|
11
12
|
const TODAY_DATE = new Date();
|
|
12
13
|
const keyPressAction = {
|
|
@@ -48,13 +49,6 @@ class DatepickerCalendar extends SgdsElement {
|
|
|
48
49
|
super.connectedCallback();
|
|
49
50
|
this.addEventListener("keydown", this._handleKeyPress);
|
|
50
51
|
}
|
|
51
|
-
firstUpdated() {
|
|
52
|
-
// if (this.selectedDate.length > 0) {
|
|
53
|
-
// this.focusedDate = setTimeToNoon(this.selectedDate[0]);
|
|
54
|
-
// } else {
|
|
55
|
-
// this.focusedDate = this.displayDate && setTimeToNoon(this.displayDate);
|
|
56
|
-
// }
|
|
57
|
-
}
|
|
58
52
|
updated() {
|
|
59
53
|
/** For KeyboardNavigation (switching months) and ClickNavigation:
|
|
60
54
|
* Runs after render has completed and td of next month has appeared.
|
|
@@ -260,20 +254,25 @@ class DatepickerCalendar extends SgdsElement {
|
|
|
260
254
|
const week = [];
|
|
261
255
|
for (let j = 0; j <= 6; j++) {
|
|
262
256
|
if (day <= monthLength && (i > 0 || j >= startingDayOfMonth)) {
|
|
263
|
-
const
|
|
264
|
-
const
|
|
265
|
-
const
|
|
257
|
+
const dateObj = new Date(year, month, day, 12, 0, 0, 0);
|
|
258
|
+
const dateStr = dateObj.toISOString();
|
|
259
|
+
const beforeMinDate = minimumDate && Date.parse(dateStr) < Date.parse(minimumDate.toISOString());
|
|
260
|
+
const afterMinDate = maximumDate && Date.parse(dateStr) > Date.parse(maximumDate.toISOString());
|
|
266
261
|
const clickHandler = beforeMinDate || afterMinDate ? undefined : this._onClickDay;
|
|
267
262
|
const isCurrentMonth = TODAY_DATE.getMonth() === this.displayDate.getMonth();
|
|
268
263
|
const isCurrentYear = TODAY_DATE.getFullYear() === this.displayDate.getFullYear();
|
|
269
264
|
const isCurrentDay = TODAY_DATE.getDate() === day;
|
|
270
|
-
const isSelected = selectedDates.length > 0 &&
|
|
271
|
-
|
|
272
|
-
const
|
|
265
|
+
const isSelected = selectedDates.length > 0 &&
|
|
266
|
+
rangeSelectedDates.some(d => Date.parse(dateStr) === Date.parse(d.toISOString()));
|
|
267
|
+
const isFirstSelectedDate = selectedDates.length > 0 && rangeSelectedDates[0].toISOString() === dateStr;
|
|
268
|
+
const isLastSelectedDate = selectedDates.length > 1 && rangeSelectedDates[rangeSelectedDates.length - 1].toISOString() === dateStr;
|
|
269
|
+
const ariaLabel = `${isCurrentDay && isCurrentMonth && isCurrentYear ? "Today's date, " : ""}` + format(dateObj, "PPPP");
|
|
273
270
|
week.push(html `<td
|
|
274
271
|
key=${j}
|
|
275
|
-
data-date=${
|
|
272
|
+
data-date=${dateStr}
|
|
276
273
|
data-day=${day}
|
|
274
|
+
aria-label=${ariaLabel}
|
|
275
|
+
aria-current=${ifDefined(isCurrentDay && isCurrentMonth && isCurrentYear ? "date" : undefined)}
|
|
277
276
|
class=${classMap({
|
|
278
277
|
today: isCurrentDay && isCurrentMonth && isCurrentYear,
|
|
279
278
|
"selected-ends": isFirstSelectedDate || isLastSelectedDate,
|
|
@@ -281,8 +280,11 @@ class DatepickerCalendar extends SgdsElement {
|
|
|
281
280
|
disabled: beforeMinDate || afterMinDate
|
|
282
281
|
})}
|
|
283
282
|
@click=${clickHandler}
|
|
284
|
-
|
|
283
|
+
aria-selected=${ifDefined(isSelected ? "true" : undefined)}
|
|
284
|
+
tabindex=${this.focusedDate === new Date(dateStr) ? "3" : "-1"}
|
|
285
285
|
?disabled=${beforeMinDate || afterMinDate}
|
|
286
|
+
aria-disabled=${ifDefined(beforeMinDate || afterMinDate ? "true" : undefined)}
|
|
287
|
+
role="button"
|
|
286
288
|
>
|
|
287
289
|
${day}
|
|
288
290
|
</td>`);
|
|
@@ -300,12 +302,12 @@ class DatepickerCalendar extends SgdsElement {
|
|
|
300
302
|
}
|
|
301
303
|
}
|
|
302
304
|
const dayView = html `
|
|
303
|
-
<table class="text-center">
|
|
305
|
+
<table class="text-center" role="grid">
|
|
304
306
|
<thead>
|
|
305
307
|
<tr>
|
|
306
308
|
${DatepickerCalendar.DAY_LABELS.map((label, index) => html `
|
|
307
|
-
<th key=${index}>
|
|
308
|
-
<small>${label}</small>
|
|
309
|
+
<th key=${index} abbr=${label} scope="col">
|
|
310
|
+
<small>${label.slice(0, 3)}</small>
|
|
309
311
|
</th>
|
|
310
312
|
`)}
|
|
311
313
|
</tr>
|
|
@@ -330,6 +332,7 @@ class DatepickerCalendar extends SgdsElement {
|
|
|
330
332
|
const isFirstSelectedYear = rangeDates[0].getFullYear() === year;
|
|
331
333
|
const isLastSelectedMonth = rangeDates[rangeDates.length - 1].getMonth() === idx;
|
|
332
334
|
const isLastSelectedYear = rangeDates[rangeDates.length - 1].getFullYear() === year;
|
|
335
|
+
const ariaLabel = isCurrentMonth ? `Current month ${m} ${year}` : `${m} ${year}`;
|
|
333
336
|
return html ` <button
|
|
334
337
|
class=${classMap({
|
|
335
338
|
active: selectedTime.includes(time),
|
|
@@ -341,8 +344,10 @@ class DatepickerCalendar extends SgdsElement {
|
|
|
341
344
|
data-month=${idx}
|
|
342
345
|
data-year=${year}
|
|
343
346
|
tabindex="3"
|
|
347
|
+
aria-selected=${selectedTime.includes(time)}
|
|
348
|
+
aria-label=${ariaLabel}
|
|
344
349
|
>
|
|
345
|
-
${m}
|
|
350
|
+
${m.slice(0, 3)}
|
|
346
351
|
</button>`;
|
|
347
352
|
})}
|
|
348
353
|
</div>
|
|
@@ -370,6 +375,8 @@ class DatepickerCalendar extends SgdsElement {
|
|
|
370
375
|
data-year=${y}
|
|
371
376
|
tabindex="3"
|
|
372
377
|
?disabled=${y < 1900}
|
|
378
|
+
aria-selected=${selectedYears.includes(y)}
|
|
379
|
+
aria-label=${ifDefined(CURRENT_YEAR === y ? `Current year, ${y}` : undefined)}
|
|
373
380
|
>
|
|
374
381
|
${y}
|
|
375
382
|
</button>
|
|
@@ -400,11 +407,24 @@ class DatepickerCalendar extends SgdsElement {
|
|
|
400
407
|
}
|
|
401
408
|
DatepickerCalendar.styles = [SgdsElement.styles, css_248z];
|
|
402
409
|
/** @internal */
|
|
403
|
-
DatepickerCalendar.DAY_LABELS = ["
|
|
410
|
+
DatepickerCalendar.DAY_LABELS = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
|
|
404
411
|
/** @internal */
|
|
405
412
|
DatepickerCalendar.daysInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
406
413
|
/** @internal */
|
|
407
|
-
DatepickerCalendar.MONTHVIEW_LABELS = [
|
|
414
|
+
DatepickerCalendar.MONTHVIEW_LABELS = [
|
|
415
|
+
"January",
|
|
416
|
+
"February",
|
|
417
|
+
"March",
|
|
418
|
+
"April",
|
|
419
|
+
"May",
|
|
420
|
+
"June",
|
|
421
|
+
"July",
|
|
422
|
+
"August",
|
|
423
|
+
"September",
|
|
424
|
+
"October",
|
|
425
|
+
"November",
|
|
426
|
+
"December"
|
|
427
|
+
];
|
|
408
428
|
__decorate([
|
|
409
429
|
property({ type: Array })
|
|
410
430
|
], DatepickerCalendar.prototype, "selectedDate", void 0);
|