@tabworthy/components 0.14.2 → 0.14.3

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.
@@ -362,9 +362,9 @@ const TabworthyDatesCalendar = class {
362
362
  } }, index.h("div", { key: 'ad36d1e260a7a89110c53fc86e339eb5a259a4fc', class: {
363
363
  [this.getClassName()]: true,
364
364
  [`${this.getClassName()}--disabled`]: this.disabled
365
- } }, index.h("div", { key: '181b9ed0a6a9d6073d67f270d6b14efc28f6a6b2', class: this.getClassName("header") }, this.showHiddenTitle && (index.h("span", { key: '580656924dc3ba028458591399791423797d58d7', "aria-atomic": "true", "aria-live": "polite", class: "visually-hidden" }, this.getTitle())), this.showYearStepper && (index.h("button", { key: '7822100c140418bc3cb65ae39a32a3ebc1f53bc2', "aria-label": this.labels.previousYearButton, class: this.getClassName("previous-year-button"), "aria-disabled": disabled.year.prev, innerHTML: this.previousYearButtonContent || undefined, onClick: this.previousYear, type: "button" }, index.h("svg", { key: '9408d89cf59c268c3e44801297f1a7776a594539', fill: "none", height: "24", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", stroke: "currentColor", viewBox: "0 0 24 24", width: "24" }, index.h("polyline", { key: 'b9108784891de5eb7acef5c14425e90c25fc514a', points: "11 17 6 12 11 7" }), index.h("polyline", { key: 'a2fbabe46f6a0584d5c4b54296b9db13e979c818', points: "18 17 13 12 18 7" })))), this.showMonthStepper && (index.h("button", { key: '8e515d4fa9fde9f0e16fc2ff5629049039df09e0', "aria-label": this.labels.previousMonthButton, class: this.getClassName("previous-month-button"), "aria-disabled": disabled.month.prev, innerHTML: this.previousMonthButtonContent || undefined, onClick: this.previousMonth, type: "button" }, index.h("svg", { key: '5248668ca2f843102193fb57beb8a3a4b4edbb96', fill: "none", height: "24", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", stroke: "currentColor", viewBox: "0 0 24 24", width: "24" }, index.h("polyline", { key: '021c514ec8fb801fd0d3dbf250fc8d55b9c9ef08', points: "15 18 9 12 15 6" })))), index.h("span", { key: '8fab6b75376e1399b6ea07e3545ddcfa3eb120d8', class: this.getClassName("current-month") }, index.h("select", { key: '01f8fbd5a76c91b0bf121c2589af72860abe2a22', "aria-label": this.labels.monthSelect, class: this.getClassName("month-select"), "aria-disabled": this.disabled, name: "month", onChange: this.onMonthSelect }, utils.getMonths(this.locale).map((month, index$1) => {
365
+ } }, index.h("div", { key: '181b9ed0a6a9d6073d67f270d6b14efc28f6a6b2', class: this.getClassName("header") }, this.showHiddenTitle && (index.h("span", { key: '580656924dc3ba028458591399791423797d58d7', "aria-atomic": "true", "aria-live": "polite", class: "visually-hidden" }, this.getTitle())), this.showYearStepper && (index.h("button", { key: 'baedceb7e568df8bfc1cee64d13c6114b85c3764', "aria-label": this.labels.previousYearButton, class: this.getClassName("previous-year-button"), "aria-disabled": String(disabled.year.prev), disabled: disabled.year.prev, innerHTML: this.previousYearButtonContent || undefined, onClick: this.previousYear, type: "button" }, index.h("svg", { key: '4e3286e12ebd5c5bba8dfc3f0ecab29f37ddf9c0', fill: "none", height: "24", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", stroke: "currentColor", viewBox: "0 0 24 24", width: "24" }, index.h("polyline", { key: '6178bb5e4dc08a9b46c587c7b3e7c5fd27867f5b', points: "11 17 6 12 11 7" }), index.h("polyline", { key: '3d03d26acc37c91243d7cbd54d228f35752f80a7', points: "18 17 13 12 18 7" })))), this.showMonthStepper && (index.h("button", { key: '9ecb2f9e5adceda9526b15b64721f16e1c7a8ca5', "aria-label": this.labels.previousMonthButton, class: this.getClassName("previous-month-button"), "aria-disabled": String(disabled.month.prev), disabled: disabled.month.prev, innerHTML: this.previousMonthButtonContent || undefined, onClick: this.previousMonth, type: "button" }, index.h("svg", { key: 'a8c74b97c18cae04b86464a53b8a99f3cffd1379', fill: "none", height: "24", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", stroke: "currentColor", viewBox: "0 0 24 24", width: "24" }, index.h("polyline", { key: '196da2b5f0485a8af41232b2c9fd614e131230e6', points: "15 18 9 12 15 6" })))), index.h("span", { key: 'b044b7041af2cbd6b527b05b6d4175e85a4a5e0c', class: this.getClassName("current-month") }, index.h("select", { key: 'f4259d0b1448b19e861ed1bb7401508b6e8f5505', "aria-label": this.labels.monthSelect, class: this.getClassName("month-select"), "aria-disabled": this.disabled, name: "month", onChange: this.onMonthSelect }, utils.getMonths(this.locale).map((month, index$1) => {
366
366
  return (index.h("option", { key: month, selected: this.currentDate.getMonth() === index$1, value: index$1 + 1, disabled: utils.monthIsDisabled(index$1, this.currentDate.getFullYear(), this.minDate, this.maxDate) }, month));
367
- })), index.h("input", { key: 'cb126814e09a6ae81ce8a6db10152decef97d66a', "aria-label": this.labels.yearSelect, class: this.getClassName("year-select"), "aria-disabled": this.disabled, max: this.maxDate ? this.maxDate.slice(0, 4) : 9999, min: this.minDate ? this.minDate.slice(0, 4) : 1, name: "year", onChange: this.onYearSelect, type: "number", value: this.currentDate.getFullYear() })), this.showMonthStepper && (index.h("button", { key: '9ad3e382b769ada1ecb746a55c37c54d0c6b06e1', "aria-label": this.labels.nextMonthButton, class: this.getClassName("next-month-button"), "aria-disabled": disabled.month.next, innerHTML: this.nextMonthButtonContent || undefined, onClick: this.nextMonth, type: "button" }, index.h("svg", { key: '7ecdf33b13950c8972b5b3a66bd086f700967fad', fill: "none", height: "24", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", stroke: "currentColor", viewBox: "0 0 24 24", width: "24" }, index.h("polyline", { key: '78768373bb23d06e8babd79a77fb0a899ea5e942', points: "9 18 15 12 9 6" })))), this.showYearStepper && (index.h("button", { key: 'ab920b5dbdf0bf6000c58718d0d3a0e9a31bbebd', "aria-label": this.labels.nextYearButton, class: this.getClassName("next-year-button"), "aria-disabled": disabled.year.next, innerHTML: this.nextYearButtonContent || undefined, onClick: this.nextYear, type: "button" }, index.h("svg", { key: '7f5c83e6333e6c33984961722c855f2609e0999e', fill: "none", height: "24", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", stroke: "currentColor", viewBox: "0 0 24 24", width: "24" }, index.h("polyline", { key: 'dd3eed1b08d0373a089beb91eb9cb6b62b477b3b', points: "13 17 18 12 13 7" }), index.h("polyline", { key: 'fa989db37ceaf95817aef623770b895b3c10d0b4', points: "6 17 11 12 6 7" }))))), index.h("div", { key: '5b41060ca782df39e19ba35ec71d4425ae5c3a2a', class: this.getClassName("body") }, index.h("table", { key: '357337fd3a5f05cc204982682c99f99c46dd4b29', class: this.getClassName("calendar"), onKeyDown: this.onKeyDown, role: "grid", "aria-label": this.getTitle() }, index.h("thead", { key: '8fa7ecfada004b39dd406eb9079de3eab66fe298', class: this.getClassName("calendar-header") }, index.h("tr", { key: '364f6021007700c2da60082fca32e4896e071ccd', class: this.getClassName("weekday-row") }, (_a = this.weekdays) === null || _a === void 0 ? void 0 : _a.map((weekday) => (index.h("th", { role: "columnheader", abbr: weekday[1], class: this.getClassName("weekday"), key: weekday[0], scope: "col" }, index.h("span", { "aria-hidden": "true" }, weekday[0]), index.h("span", { class: "visually-hidden" }, weekday[1])))))), index.h("tbody", { key: 'e0269bd5bfe1310a8950635441edc472e3a5f413' }, this.getCalendarRows().map((calendarRow) => {
367
+ })), index.h("input", { key: '29566d4d17a43313d0cd09102ffe8f7dadab48a4', "aria-label": this.labels.yearSelect, class: this.getClassName("year-select"), "aria-disabled": this.disabled, max: this.maxDate ? this.maxDate.slice(0, 4) : 9999, min: this.minDate ? this.minDate.slice(0, 4) : 1, name: "year", onChange: this.onYearSelect, type: "number", value: this.currentDate.getFullYear() })), this.showMonthStepper && (index.h("button", { key: '3c3a08d8c1a9471d3c03656e1c69dd9b610964a6', "aria-label": this.labels.nextMonthButton, class: this.getClassName("next-month-button"), "aria-disabled": String(disabled.month.next), disabled: disabled.month.next, innerHTML: this.nextMonthButtonContent || undefined, onClick: this.nextMonth, type: "button" }, index.h("svg", { key: '691056b81918999f8cb5e411ea808bfc3d63d285', fill: "none", height: "24", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", stroke: "currentColor", viewBox: "0 0 24 24", width: "24" }, index.h("polyline", { key: '1ad9ffac020a5e77bfbe13e56be4039c0ab1bce1', points: "9 18 15 12 9 6" })))), this.showYearStepper && (index.h("button", { key: '541f139687c50d4515f6ba52f86e5bd0dfb480a8', "aria-label": this.labels.nextYearButton, class: this.getClassName("next-year-button"), "aria-disabled": String(disabled.year.next), disabled: disabled.year.next, innerHTML: this.nextYearButtonContent || undefined, onClick: this.nextYear, type: "button" }, index.h("svg", { key: '38ed3c8a59612395ef641d3ae1068f755f7d68b1', fill: "none", height: "24", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", stroke: "currentColor", viewBox: "0 0 24 24", width: "24" }, index.h("polyline", { key: '2b95dc3f77f314e84d2cfaec8e479d7097ab43d9', points: "13 17 18 12 13 7" }), index.h("polyline", { key: 'f26e6b1290a4817aef45fb8e7aa0f7956fefaa8c', points: "6 17 11 12 6 7" }))))), index.h("div", { key: '2c8eefeaac7909a66bd3975c4a5be18ac7f459fe', class: this.getClassName("body") }, index.h("table", { key: '2a3646bac9db5b7253fa17632d71d74bec41a6ee', class: this.getClassName("calendar"), onKeyDown: this.onKeyDown, role: "grid", "aria-label": this.getTitle() }, index.h("thead", { key: '146348c0e34687eb6b776698b8dd8eba44b51552', class: this.getClassName("calendar-header") }, index.h("tr", { key: 'afa9189bdbaab542fdf36c78849da38cdf387135', class: this.getClassName("weekday-row") }, (_a = this.weekdays) === null || _a === void 0 ? void 0 : _a.map((weekday) => (index.h("th", { role: "columnheader", abbr: weekday[1], class: this.getClassName("weekday"), key: weekday[0], scope: "col" }, index.h("span", { "aria-hidden": "true" }, weekday[0]), index.h("span", { class: "visually-hidden" }, weekday[1])))))), index.h("tbody", { key: 'd70b0012e308a5dadb5da96c78f6471253f9d1c0' }, this.getCalendarRows().map((calendarRow) => {
368
368
  const rowKey = `row-${calendarRow[0].getMonth()}-${calendarRow[0].getDate()}`;
369
369
  return (index.h("tr", { class: this.getClassName("calendar-row"), key: rowKey }, calendarRow.map((day) => {
370
370
  var _a, _b, _c;
@@ -431,14 +431,14 @@ const TabworthyDatesCalendar = class {
431
431
  ? 0
432
432
  : -1 }, index.h(Tag, { "aria-hidden": "true" }, day.getDate()), index.h("span", { class: "visually-hidden" }, getScreenReaderText())));
433
433
  })));
434
- })))), showFooter && (index.h("div", { key: '4d18b821b06e4eb7fd2f1a1210fcab01d3acdd00', class: this.getClassName("footer") }, index.h("div", { key: 'fec534b0bff03bfe3e15a8842abbcca9b57e9a1c', class: this.getClassName("footer-buttons") }, this.showTodayButton && (index.h("button", { key: '0d8aed7413f313c2ab6aa9a634093de1d46cd7ce', "aria-label": this.todayButtonContent
434
+ })))), showFooter && (index.h("div", { key: '574bd94d669e65194e7c26499007a320d950dff4', class: this.getClassName("footer") }, index.h("div", { key: 'c4fad38c1c3a57f221c3b7094e1f70981fcd9f65', class: this.getClassName("footer-buttons") }, this.showTodayButton && (index.h("button", { key: '26e4889dc3d806204df07aea74069741dc8794d9', "aria-label": this.todayButtonContent
435
435
  ? this.labels.todayButton
436
- : undefined, class: this.getClassName("today-button"), disabled: this.disabled, innerHTML: this.todayButtonContent || undefined, onClick: this.showToday, type: "button" }, !this.todayButtonContent && this.labels.todayButton)), this.showClearButton && (index.h("button", { key: '176c535cb85d6b95d40324a55aa11e1bc2faaa61', "aria-label": this.clearButtonContent
436
+ : undefined, class: this.getClassName("today-button"), disabled: this.disabled, innerHTML: this.todayButtonContent || undefined, onClick: this.showToday, type: "button" }, !this.todayButtonContent && this.labels.todayButton)), this.showClearButton && (index.h("button", { key: '347741d4adfc95c14060864de7674344da311a6e', "aria-label": this.clearButtonContent
437
437
  ? this.labels.clearButton
438
- : undefined, class: this.getClassName("clear-button"), disabled: this.disabled, innerHTML: this.clearButtonContent || undefined, onClick: this.clear, type: "button" }, !this.clearButtonContent && this.labels.clearButton)), this.showCloseButton && (index.h("button", { key: 'cea15baf92edabea6841510459c6b05ebfaf81fa', "aria-label": this.closeButtonContent
438
+ : undefined, class: this.getClassName("clear-button"), disabled: this.disabled, innerHTML: this.clearButtonContent || undefined, onClick: this.clear, type: "button" }, !this.clearButtonContent && this.labels.clearButton)), this.showCloseButton && (index.h("button", { key: '287053ef376238a807a1ff092da80a350700abd2', "aria-label": this.closeButtonContent
439
439
  ? this.labels.closeButton
440
440
  : undefined, class: this.getClassName("close-button"), disabled: this.disabled, innerHTML: this.closeButtonContent || undefined, onClick: this.close, type: "button" }, !this.closeButtonContent && this.labels.closeButton))), this.showKeyboardHint &&
441
- !window.matchMedia("(pointer: coarse)").matches && (index.h("button", { key: '51a48353fbb94243d93047141e26b8c8ef5545b2', type: "button", onClick: () => alert("Todo: Add Keyboard helper!"), class: this.getClassName("keyboard-hint") }, index.h("svg", { key: '2991aa978689e3a0bd4c795a8629451e252ccf41', xmlns: "http://www.w3.org/2000/svg", height: "1em", width: "1em", viewBox: "0 0 48 48", fill: "currentColor" }, index.h("path", { key: 'b84c3846f234a79e8c78eae3118aa2a9f24b8377', d: "M7 38q-1.2 0-2.1-.925Q4 36.15 4 35V13q0-1.2.9-2.1.9-.9 2.1-.9h34q1.2 0 2.1.9.9.9.9 2.1v22q0 1.15-.9 2.075Q42.2 38 41 38Zm0-3h34V13H7v22Zm8-3.25h18v-3H15Zm-4.85-6.25h3v-3h-3Zm6.2 0h3v-3h-3Zm6.15 0h3v-3h-3Zm6.2 0h3v-3h-3Zm6.15 0h3v-3h-3Zm-24.7-6.25h3v-3h-3Zm6.2 0h3v-3h-3Zm6.15 0h3v-3h-3Zm6.2 0h3v-3h-3Zm6.15 0h3v-3h-3ZM7 35V13v22Z" })), this.labels.keyboardHint))))), index.h("slot", { key: '86e8fb8907bf11951461baaf41f92b29ce0cc413', name: "after-calendar" }))));
441
+ !window.matchMedia("(pointer: coarse)").matches && (index.h("button", { key: 'bb05e75930b211fb43874b492c4e16229d0d7232', type: "button", onClick: () => alert("Todo: Add Keyboard helper!"), class: this.getClassName("keyboard-hint") }, index.h("svg", { key: '8b7e648ea409ce84086aaf06c4d4707dd6e09274', xmlns: "http://www.w3.org/2000/svg", height: "1em", width: "1em", viewBox: "0 0 48 48", fill: "currentColor" }, index.h("path", { key: 'aeaefade16771c198b74bb1c38f88bd9457d2baa', d: "M7 38q-1.2 0-2.1-.925Q4 36.15 4 35V13q0-1.2.9-2.1.9-.9 2.1-.9h34q1.2 0 2.1.9.9.9.9 2.1v22q0 1.15-.9 2.075Q42.2 38 41 38Zm0-3h34V13H7v22Zm8-3.25h18v-3H15Zm-4.85-6.25h3v-3h-3Zm6.2 0h3v-3h-3Zm6.15 0h3v-3h-3Zm6.2 0h3v-3h-3Zm6.15 0h3v-3h-3Zm-24.7-6.25h3v-3h-3Zm6.2 0h3v-3h-3Zm6.15 0h3v-3h-3Zm6.2 0h3v-3h-3Zm6.15 0h3v-3h-3ZM7 35V13v22Z" })), this.labels.keyboardHint))))), index.h("slot", { key: '6054a85ed3973b573f102c45d33995ad90eaf2f8', name: "after-calendar" }))));
442
442
  }
443
443
  get el() { return index.getElement(this); }
444
444
  static get watchers() { return {
@@ -353,9 +353,9 @@ export class TabworthyDatesCalendar {
353
353
  } }, h("div", { key: 'ad36d1e260a7a89110c53fc86e339eb5a259a4fc', class: {
354
354
  [this.getClassName()]: true,
355
355
  [`${this.getClassName()}--disabled`]: this.disabled
356
- } }, h("div", { key: '181b9ed0a6a9d6073d67f270d6b14efc28f6a6b2', class: this.getClassName("header") }, this.showHiddenTitle && (h("span", { key: '580656924dc3ba028458591399791423797d58d7', "aria-atomic": "true", "aria-live": "polite", class: "visually-hidden" }, this.getTitle())), this.showYearStepper && (h("button", { key: '7822100c140418bc3cb65ae39a32a3ebc1f53bc2', "aria-label": this.labels.previousYearButton, class: this.getClassName("previous-year-button"), "aria-disabled": disabled.year.prev, innerHTML: this.previousYearButtonContent || undefined, onClick: this.previousYear, type: "button" }, h("svg", { key: '9408d89cf59c268c3e44801297f1a7776a594539', fill: "none", height: "24", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", stroke: "currentColor", viewBox: "0 0 24 24", width: "24" }, h("polyline", { key: 'b9108784891de5eb7acef5c14425e90c25fc514a', points: "11 17 6 12 11 7" }), h("polyline", { key: 'a2fbabe46f6a0584d5c4b54296b9db13e979c818', points: "18 17 13 12 18 7" })))), this.showMonthStepper && (h("button", { key: '8e515d4fa9fde9f0e16fc2ff5629049039df09e0', "aria-label": this.labels.previousMonthButton, class: this.getClassName("previous-month-button"), "aria-disabled": disabled.month.prev, innerHTML: this.previousMonthButtonContent || undefined, onClick: this.previousMonth, type: "button" }, h("svg", { key: '5248668ca2f843102193fb57beb8a3a4b4edbb96', fill: "none", height: "24", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", stroke: "currentColor", viewBox: "0 0 24 24", width: "24" }, h("polyline", { key: '021c514ec8fb801fd0d3dbf250fc8d55b9c9ef08', points: "15 18 9 12 15 6" })))), h("span", { key: '8fab6b75376e1399b6ea07e3545ddcfa3eb120d8', class: this.getClassName("current-month") }, h("select", { key: '01f8fbd5a76c91b0bf121c2589af72860abe2a22', "aria-label": this.labels.monthSelect, class: this.getClassName("month-select"), "aria-disabled": this.disabled, name: "month", onChange: this.onMonthSelect }, getMonths(this.locale).map((month, index) => {
356
+ } }, h("div", { key: '181b9ed0a6a9d6073d67f270d6b14efc28f6a6b2', class: this.getClassName("header") }, this.showHiddenTitle && (h("span", { key: '580656924dc3ba028458591399791423797d58d7', "aria-atomic": "true", "aria-live": "polite", class: "visually-hidden" }, this.getTitle())), this.showYearStepper && (h("button", { key: 'baedceb7e568df8bfc1cee64d13c6114b85c3764', "aria-label": this.labels.previousYearButton, class: this.getClassName("previous-year-button"), "aria-disabled": String(disabled.year.prev), disabled: disabled.year.prev, innerHTML: this.previousYearButtonContent || undefined, onClick: this.previousYear, type: "button" }, h("svg", { key: '4e3286e12ebd5c5bba8dfc3f0ecab29f37ddf9c0', fill: "none", height: "24", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", stroke: "currentColor", viewBox: "0 0 24 24", width: "24" }, h("polyline", { key: '6178bb5e4dc08a9b46c587c7b3e7c5fd27867f5b', points: "11 17 6 12 11 7" }), h("polyline", { key: '3d03d26acc37c91243d7cbd54d228f35752f80a7', points: "18 17 13 12 18 7" })))), this.showMonthStepper && (h("button", { key: '9ecb2f9e5adceda9526b15b64721f16e1c7a8ca5', "aria-label": this.labels.previousMonthButton, class: this.getClassName("previous-month-button"), "aria-disabled": String(disabled.month.prev), disabled: disabled.month.prev, innerHTML: this.previousMonthButtonContent || undefined, onClick: this.previousMonth, type: "button" }, h("svg", { key: 'a8c74b97c18cae04b86464a53b8a99f3cffd1379', fill: "none", height: "24", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", stroke: "currentColor", viewBox: "0 0 24 24", width: "24" }, h("polyline", { key: '196da2b5f0485a8af41232b2c9fd614e131230e6', points: "15 18 9 12 15 6" })))), h("span", { key: 'b044b7041af2cbd6b527b05b6d4175e85a4a5e0c', class: this.getClassName("current-month") }, h("select", { key: 'f4259d0b1448b19e861ed1bb7401508b6e8f5505', "aria-label": this.labels.monthSelect, class: this.getClassName("month-select"), "aria-disabled": this.disabled, name: "month", onChange: this.onMonthSelect }, getMonths(this.locale).map((month, index) => {
357
357
  return (h("option", { key: month, selected: this.currentDate.getMonth() === index, value: index + 1, disabled: monthIsDisabled(index, this.currentDate.getFullYear(), this.minDate, this.maxDate) }, month));
358
- })), h("input", { key: 'cb126814e09a6ae81ce8a6db10152decef97d66a', "aria-label": this.labels.yearSelect, class: this.getClassName("year-select"), "aria-disabled": this.disabled, max: this.maxDate ? this.maxDate.slice(0, 4) : 9999, min: this.minDate ? this.minDate.slice(0, 4) : 1, name: "year", onChange: this.onYearSelect, type: "number", value: this.currentDate.getFullYear() })), this.showMonthStepper && (h("button", { key: '9ad3e382b769ada1ecb746a55c37c54d0c6b06e1', "aria-label": this.labels.nextMonthButton, class: this.getClassName("next-month-button"), "aria-disabled": disabled.month.next, innerHTML: this.nextMonthButtonContent || undefined, onClick: this.nextMonth, type: "button" }, h("svg", { key: '7ecdf33b13950c8972b5b3a66bd086f700967fad', fill: "none", height: "24", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", stroke: "currentColor", viewBox: "0 0 24 24", width: "24" }, h("polyline", { key: '78768373bb23d06e8babd79a77fb0a899ea5e942', points: "9 18 15 12 9 6" })))), this.showYearStepper && (h("button", { key: 'ab920b5dbdf0bf6000c58718d0d3a0e9a31bbebd', "aria-label": this.labels.nextYearButton, class: this.getClassName("next-year-button"), "aria-disabled": disabled.year.next, innerHTML: this.nextYearButtonContent || undefined, onClick: this.nextYear, type: "button" }, h("svg", { key: '7f5c83e6333e6c33984961722c855f2609e0999e', fill: "none", height: "24", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", stroke: "currentColor", viewBox: "0 0 24 24", width: "24" }, h("polyline", { key: 'dd3eed1b08d0373a089beb91eb9cb6b62b477b3b', points: "13 17 18 12 13 7" }), h("polyline", { key: 'fa989db37ceaf95817aef623770b895b3c10d0b4', points: "6 17 11 12 6 7" }))))), h("div", { key: '5b41060ca782df39e19ba35ec71d4425ae5c3a2a', class: this.getClassName("body") }, h("table", { key: '357337fd3a5f05cc204982682c99f99c46dd4b29', class: this.getClassName("calendar"), onKeyDown: this.onKeyDown, role: "grid", "aria-label": this.getTitle() }, h("thead", { key: '8fa7ecfada004b39dd406eb9079de3eab66fe298', class: this.getClassName("calendar-header") }, h("tr", { key: '364f6021007700c2da60082fca32e4896e071ccd', class: this.getClassName("weekday-row") }, (_a = this.weekdays) === null || _a === void 0 ? void 0 : _a.map((weekday) => (h("th", { role: "columnheader", abbr: weekday[1], class: this.getClassName("weekday"), key: weekday[0], scope: "col" }, h("span", { "aria-hidden": "true" }, weekday[0]), h("span", { class: "visually-hidden" }, weekday[1])))))), h("tbody", { key: 'e0269bd5bfe1310a8950635441edc472e3a5f413' }, this.getCalendarRows().map((calendarRow) => {
358
+ })), h("input", { key: '29566d4d17a43313d0cd09102ffe8f7dadab48a4', "aria-label": this.labels.yearSelect, class: this.getClassName("year-select"), "aria-disabled": this.disabled, max: this.maxDate ? this.maxDate.slice(0, 4) : 9999, min: this.minDate ? this.minDate.slice(0, 4) : 1, name: "year", onChange: this.onYearSelect, type: "number", value: this.currentDate.getFullYear() })), this.showMonthStepper && (h("button", { key: '3c3a08d8c1a9471d3c03656e1c69dd9b610964a6', "aria-label": this.labels.nextMonthButton, class: this.getClassName("next-month-button"), "aria-disabled": String(disabled.month.next), disabled: disabled.month.next, innerHTML: this.nextMonthButtonContent || undefined, onClick: this.nextMonth, type: "button" }, h("svg", { key: '691056b81918999f8cb5e411ea808bfc3d63d285', fill: "none", height: "24", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", stroke: "currentColor", viewBox: "0 0 24 24", width: "24" }, h("polyline", { key: '1ad9ffac020a5e77bfbe13e56be4039c0ab1bce1', points: "9 18 15 12 9 6" })))), this.showYearStepper && (h("button", { key: '541f139687c50d4515f6ba52f86e5bd0dfb480a8', "aria-label": this.labels.nextYearButton, class: this.getClassName("next-year-button"), "aria-disabled": String(disabled.year.next), disabled: disabled.year.next, innerHTML: this.nextYearButtonContent || undefined, onClick: this.nextYear, type: "button" }, h("svg", { key: '38ed3c8a59612395ef641d3ae1068f755f7d68b1', fill: "none", height: "24", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", stroke: "currentColor", viewBox: "0 0 24 24", width: "24" }, h("polyline", { key: '2b95dc3f77f314e84d2cfaec8e479d7097ab43d9', points: "13 17 18 12 13 7" }), h("polyline", { key: 'f26e6b1290a4817aef45fb8e7aa0f7956fefaa8c', points: "6 17 11 12 6 7" }))))), h("div", { key: '2c8eefeaac7909a66bd3975c4a5be18ac7f459fe', class: this.getClassName("body") }, h("table", { key: '2a3646bac9db5b7253fa17632d71d74bec41a6ee', class: this.getClassName("calendar"), onKeyDown: this.onKeyDown, role: "grid", "aria-label": this.getTitle() }, h("thead", { key: '146348c0e34687eb6b776698b8dd8eba44b51552', class: this.getClassName("calendar-header") }, h("tr", { key: 'afa9189bdbaab542fdf36c78849da38cdf387135', class: this.getClassName("weekday-row") }, (_a = this.weekdays) === null || _a === void 0 ? void 0 : _a.map((weekday) => (h("th", { role: "columnheader", abbr: weekday[1], class: this.getClassName("weekday"), key: weekday[0], scope: "col" }, h("span", { "aria-hidden": "true" }, weekday[0]), h("span", { class: "visually-hidden" }, weekday[1])))))), h("tbody", { key: 'd70b0012e308a5dadb5da96c78f6471253f9d1c0' }, this.getCalendarRows().map((calendarRow) => {
359
359
  const rowKey = `row-${calendarRow[0].getMonth()}-${calendarRow[0].getDate()}`;
360
360
  return (h("tr", { class: this.getClassName("calendar-row"), key: rowKey }, calendarRow.map((day) => {
361
361
  var _a, _b, _c;
@@ -422,14 +422,14 @@ export class TabworthyDatesCalendar {
422
422
  ? 0
423
423
  : -1 }, h(Tag, { "aria-hidden": "true" }, day.getDate()), h("span", { class: "visually-hidden" }, getScreenReaderText())));
424
424
  })));
425
- })))), showFooter && (h("div", { key: '4d18b821b06e4eb7fd2f1a1210fcab01d3acdd00', class: this.getClassName("footer") }, h("div", { key: 'fec534b0bff03bfe3e15a8842abbcca9b57e9a1c', class: this.getClassName("footer-buttons") }, this.showTodayButton && (h("button", { key: '0d8aed7413f313c2ab6aa9a634093de1d46cd7ce', "aria-label": this.todayButtonContent
425
+ })))), showFooter && (h("div", { key: '574bd94d669e65194e7c26499007a320d950dff4', class: this.getClassName("footer") }, h("div", { key: 'c4fad38c1c3a57f221c3b7094e1f70981fcd9f65', class: this.getClassName("footer-buttons") }, this.showTodayButton && (h("button", { key: '26e4889dc3d806204df07aea74069741dc8794d9', "aria-label": this.todayButtonContent
426
426
  ? this.labels.todayButton
427
- : undefined, class: this.getClassName("today-button"), disabled: this.disabled, innerHTML: this.todayButtonContent || undefined, onClick: this.showToday, type: "button" }, !this.todayButtonContent && this.labels.todayButton)), this.showClearButton && (h("button", { key: '176c535cb85d6b95d40324a55aa11e1bc2faaa61', "aria-label": this.clearButtonContent
427
+ : undefined, class: this.getClassName("today-button"), disabled: this.disabled, innerHTML: this.todayButtonContent || undefined, onClick: this.showToday, type: "button" }, !this.todayButtonContent && this.labels.todayButton)), this.showClearButton && (h("button", { key: '347741d4adfc95c14060864de7674344da311a6e', "aria-label": this.clearButtonContent
428
428
  ? this.labels.clearButton
429
- : undefined, class: this.getClassName("clear-button"), disabled: this.disabled, innerHTML: this.clearButtonContent || undefined, onClick: this.clear, type: "button" }, !this.clearButtonContent && this.labels.clearButton)), this.showCloseButton && (h("button", { key: 'cea15baf92edabea6841510459c6b05ebfaf81fa', "aria-label": this.closeButtonContent
429
+ : undefined, class: this.getClassName("clear-button"), disabled: this.disabled, innerHTML: this.clearButtonContent || undefined, onClick: this.clear, type: "button" }, !this.clearButtonContent && this.labels.clearButton)), this.showCloseButton && (h("button", { key: '287053ef376238a807a1ff092da80a350700abd2', "aria-label": this.closeButtonContent
430
430
  ? this.labels.closeButton
431
431
  : undefined, class: this.getClassName("close-button"), disabled: this.disabled, innerHTML: this.closeButtonContent || undefined, onClick: this.close, type: "button" }, !this.closeButtonContent && this.labels.closeButton))), this.showKeyboardHint &&
432
- !window.matchMedia("(pointer: coarse)").matches && (h("button", { key: '51a48353fbb94243d93047141e26b8c8ef5545b2', type: "button", onClick: () => alert("Todo: Add Keyboard helper!"), class: this.getClassName("keyboard-hint") }, h("svg", { key: '2991aa978689e3a0bd4c795a8629451e252ccf41', xmlns: "http://www.w3.org/2000/svg", height: "1em", width: "1em", viewBox: "0 0 48 48", fill: "currentColor" }, h("path", { key: 'b84c3846f234a79e8c78eae3118aa2a9f24b8377', d: "M7 38q-1.2 0-2.1-.925Q4 36.15 4 35V13q0-1.2.9-2.1.9-.9 2.1-.9h34q1.2 0 2.1.9.9.9.9 2.1v22q0 1.15-.9 2.075Q42.2 38 41 38Zm0-3h34V13H7v22Zm8-3.25h18v-3H15Zm-4.85-6.25h3v-3h-3Zm6.2 0h3v-3h-3Zm6.15 0h3v-3h-3Zm6.2 0h3v-3h-3Zm6.15 0h3v-3h-3Zm-24.7-6.25h3v-3h-3Zm6.2 0h3v-3h-3Zm6.15 0h3v-3h-3Zm6.2 0h3v-3h-3Zm6.15 0h3v-3h-3ZM7 35V13v22Z" })), this.labels.keyboardHint))))), h("slot", { key: '86e8fb8907bf11951461baaf41f92b29ce0cc413', name: "after-calendar" }))));
432
+ !window.matchMedia("(pointer: coarse)").matches && (h("button", { key: 'bb05e75930b211fb43874b492c4e16229d0d7232', type: "button", onClick: () => alert("Todo: Add Keyboard helper!"), class: this.getClassName("keyboard-hint") }, h("svg", { key: '8b7e648ea409ce84086aaf06c4d4707dd6e09274', xmlns: "http://www.w3.org/2000/svg", height: "1em", width: "1em", viewBox: "0 0 48 48", fill: "currentColor" }, h("path", { key: 'aeaefade16771c198b74bb1c38f88bd9457d2baa', d: "M7 38q-1.2 0-2.1-.925Q4 36.15 4 35V13q0-1.2.9-2.1.9-.9 2.1-.9h34q1.2 0 2.1.9.9.9.9 2.1v22q0 1.15-.9 2.075Q42.2 38 41 38Zm0-3h34V13H7v22Zm8-3.25h18v-3H15Zm-4.85-6.25h3v-3h-3Zm6.2 0h3v-3h-3Zm6.15 0h3v-3h-3Zm6.2 0h3v-3h-3Zm6.15 0h3v-3h-3Zm-24.7-6.25h3v-3h-3Zm6.2 0h3v-3h-3Zm6.15 0h3v-3h-3Zm6.2 0h3v-3h-3Zm6.15 0h3v-3h-3ZM7 35V13v22Z" })), this.labels.keyboardHint))))), h("slot", { key: '6054a85ed3973b573f102c45d33995ad90eaf2f8', name: "after-calendar" }))));
433
433
  }
434
434
  static get is() { return "tabworthy-dates-calendar"; }
435
435
  static get encapsulation() { return "scoped"; }
@@ -0,0 +1 @@
1
+ import{p as t,H as e,c as i,h as s,d as a,t as n}from"./p-BiJ0HZVY.js";function h(t,e){const i=new Date(t);return i.setDate(i.getDate()+e),i}function o(t){return k(new Date(`${w(t)}-${String(c(t)).padStart(2,"0")}-01`))}function r(t){return function(t){if(t instanceof Date)return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}(t)}function d(t){const e=o(t);return e.setMonth(e.getMonth()+1),e.setDate(e.getDate()-1),e}function c(t){return t.getMonth()+1}function l(t){return h(t,1)}function u(t){const e=new Date(t);return e.setMonth(e.getMonth()+1),e}function b(t){const e=new Date(t);return e.setFullYear(e.getFullYear()+1),e}function f(t){return g(t,1)}function v(t){const e=new Date(t);return e.setMonth(e.getMonth()-1),e}function y(t){const e=new Date(t);return e.setFullYear(e.getFullYear()-1),e}function w(t){return t.getFullYear()}function p(t,e){return!(!t||!e)&&t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()&&t.getDate()===e.getDate()}function k(t){const e=new Date(t);return e.setMinutes(e.getMinutes()+e.getTimezoneOffset()),e}function m(t){const e=t.includes("T")||/\d{4}-\d{2}-\d{2}\s\d{2}:/.test(t),i=new Date(t);return e?i:k(i)}function g(t,e){const i=new Date(t);return i.setDate(i.getDate()-e),i}function D(t,e){if(e){const i=m(e);return t>=i||p(i,t)}return!0}function C(t,e){if(e){const i=m(e);return t<=i||p(t,i)}return!0}function B(t,e,i){return D(t,e)&&C(t,i)}function $(t,e,i,s){if(i){const s=m(i),a=s.getFullYear(),n=s.getMonth();if(e<a||e===a&&t<n)return!0}if(s){const i=m(s),a=i.getFullYear(),n=i.getMonth();if(e>a||e===a&&t>n)return!0}return!1}function x(t){if(null==t.match(/^\d{4}-\d{2}-\d{2}$/))return!1;var e=new Date(t);return!isNaN(e.getTime())}function S(t){var e=t.match(/\d{4}-\d{2}-\d{2}/g);return null==e?void 0:e.slice(0,2)}const M={clearButton:"Clear value",closeButton:"Close",monthSelect:"Select month",nextMonthButton:"Next month",nextYearButton:"Next year",picker:"Choose date",previousMonthButton:"Previous month",previousYearButton:"Previous year",todayButton:"Show today",yearSelect:"Select year",keyboardHint:"Keyboard commands",selected:"Selected date",chooseAsStartDate:"choose as start date",chooseAsEndDate:"choose as end date"},Z=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.selectDate=i(this,"selectDate",3),this.changeMonth=i(this,"changeMonth",3),this.changeYear=i(this,"changeYear",3),this.requestClose=i(this,"requestClose",3),this.disabled=!1,this.modalIsOpen=!1,this.disableDate=()=>!1,this.elementClassName="tabworthy-dates-calendar",this.firstDayOfWeek=0,this.range=!1,this.labels=M,this.locale=(null===navigator||void 0===navigator?void 0:navigator.language)||"en-US",this.inline=!1,this.showClearButton=!1,this.showCloseButton=!1,this.showMonthStepper=!0,this.showTodayButton=!0,this.showYearStepper=!1,this.showKeyboardHint=!1,this.showHiddenTitle=!0,this.startDate=r(new Date),this.init=()=>{this.currentDate=this.startDate?k(new Date(this.startDate)):new Date,this.updateWeekdays()},this.nextMonth=()=>{const t=u(this.currentDate);this.disabled||$(t.getMonth(),t.getFullYear(),this.minDate,this.maxDate)||this.updateCurrentDate(t)},this.nextYear=()=>{const t=b(this.currentDate);this.disabled||this.maxDate&&m(this.maxDate).getFullYear()<t.getFullYear()||this.updateCurrentDate(t,!1,!0)},this.previousMonth=()=>{const t=v(this.currentDate);this.disabled||$(t.getMonth(),t.getFullYear(),this.minDate,this.maxDate)||this.updateCurrentDate(t)},this.previousYear=()=>{const t=y(this.currentDate);this.disabled||this.minDate&&m(this.minDate).getFullYear()>t.getFullYear()||this.updateCurrentDate(t,!1,!0)},this.showToday=()=>{this.updateCurrentDate(new Date,!0)},this.clear=()=>{var t;this.value=void 0,null===(t=this.selectDate)||void 0===t||t.emit(void 0)},this.onClick=t=>{if(this.disabled)return;const e=t.target.closest("[data-date]");if(!Boolean(e))return;const i=k(new Date(e.dataset.date));this.updateCurrentDate(i),this.onSelectDate(i)},this.onMonthSelect=t=>{const e=+t.target.value-1,i=new Date(this.currentDate);B(i,this.minDate,this.maxDate)&&(i.setMonth(e),this.updateCurrentDate(i))},this.onYearSelect=t=>{var e;const i=+t.target.value,s=new Date(this.currentDate);B(s,this.minDate,this.maxDate)&&(s.setFullYear(i),null===(e=this.changeYear)||void 0===e||e.emit({year:i}),this.updateCurrentDate(s))},this.onKeyDown=t=>{this.disabled||("ArrowLeft"===t.code?(t.preventDefault(),this.updateCurrentDate(f(this.currentDate),!0)):"ArrowRight"===t.code?(t.preventDefault(),this.updateCurrentDate(l(this.currentDate),!0)):"ArrowUp"===t.code?(t.preventDefault(),this.updateCurrentDate(g(this.currentDate,7),!0)):"ArrowDown"===t.code?(t.preventDefault(),this.updateCurrentDate(h(this.currentDate,7),!0)):"PageUp"===t.code?(t.preventDefault(),this.updateCurrentDate(t.shiftKey?y(this.currentDate):v(this.currentDate),!0)):"PageDown"===t.code?(t.preventDefault(),this.updateCurrentDate(t.shiftKey?b(this.currentDate):u(this.currentDate),!0)):"Home"===t.code?(t.preventDefault(),this.updateCurrentDate(o(this.currentDate),!0)):"End"===t.code?(t.preventDefault(),this.updateCurrentDate(d(this.currentDate),!0)):"Space"!==t.code&&"Enter"!==t.code||(t.preventDefault(),this.onSelectDate(this.currentDate)))},this.onMouseEnter=t=>{var e;if(this.disabled)return;const i=k(new Date(null===(e=t.target.closest("td"))||void 0===e?void 0:e.dataset.date));this.hoveredDate=i},this.onMouseLeave=()=>{this.hoveredDate=void 0},this.close=()=>{var t;null===(t=this.requestClose)||void 0===t||t.emit()}}componentWillLoad(){this.init()}watchModalIsOpen(){!0===this.modalIsOpen&&(this.moveFocusOnModalOpen=!0)}watchFirstDayOfWeek(){this.updateWeekdays()}watchLocale(){Boolean(this.locale)||(this.locale=(null===navigator||void 0===navigator?void 0:navigator.language)||"en-US"),this.updateWeekdays()}watchRange(){var t;this.value=void 0,null===(t=this.selectDate)||void 0===t||t.emit(void 0)}watchStartDate(){this.currentDate=this.startDate?k(new Date(this.startDate)):new Date}watchValue(){Boolean(this.value)&&(Array.isArray(this.value)&&this.value.length>=1?this.currentDate=this.value[0]:this.value instanceof Date&&(this.currentDate=this.value))}componentDidRender(){this.moveFocusAfterMonthChanged&&(this.focusDate(this.currentDate),this.moveFocusAfterMonthChanged=!1),this.moveFocusOnModalOpen&&setTimeout((()=>{this.focusDate(this.currentDate),this.moveFocusOnModalOpen=!1}),100)}updateWeekdays(){var t,e;this.weekdays=(t=this.firstDayOfWeek,e=this.locale,new Array(7).fill(void 0).map(((e,i)=>(t+i)%7+1)).map((t=>{const i=new Date(2006,0,t);return[Intl.DateTimeFormat(e,{weekday:"short"}).format(i),Intl.DateTimeFormat(e,{weekday:"long"}).format(i)]})))}getClassName(t){return Boolean(t)?`${this.elementClassName}__${t}`:this.elementClassName}getCalendarRows(){const t=function(t,e,i){const s=[],a=o(t),n=0===a.getDay()?7:a.getDay(),h=d(t),r=0===h.getDay()?7:h.getDay(),c=1===i?7:i-1,u=[],b=[];{let t=(7-i+n)%7,e=f(a);for(;t>0;)u.push(e),e=f(e),t-=1;u.reverse();let s=(7-r+c)%7,o=l(h);for(;s>0;)b.push(o),o=l(o),s-=1}let v=a;for(;v.getMonth()===t.getMonth();)s.push(v),v=l(v);return[...u,...s,...b]}(this.currentDate,0,0===this.firstDayOfWeek?7:this.firstDayOfWeek),e=[];for(let i=0;i<t.length;i+=7){const s=t.slice(i,i+7);e.push(s)}const i=e[e.length-1];let s=null==i?void 0:i[i.length-1];for(;e.length<6&&s;){const t=[];for(let e=0;e<7;e+=1)s=h(s,1),t.push(s);e.push(t)}return e}getTitle(){if(Boolean(this.currentDate))return Intl.DateTimeFormat(this.locale,{month:"long",year:"numeric"}).format(this.currentDate)}focusDate(t){var e;t&&(null===(e=this.el.querySelector(`[data-date="${r(t)}"]`))||void 0===e||e.focus())}updateCurrentDate(t,e,i=!1){var s,a,n;const h=t.getMonth(),o=t.getFullYear();D(t,this.minDate)||(t=m(this.minDate)),C(t,this.maxDate)||(t=m(this.maxDate)),(h!==(null===(s=this.currentDate)||void 0===s?void 0:s.getMonth())||o!==this.currentDate.getFullYear())&&(null===(a=this.changeMonth)||void 0===a||a.emit({month:c(t),year:w(t)}),e&&(this.moveFocusAfterMonthChanged=!0)),this.currentDate=t,e&&this.focusDate(this.currentDate),i&&(null===(n=this.changeYear)||void 0===n||n.emit({year:w(t)}))}onSelectDate(t){var e,i,s,a;if(!this.disableDate(t)&&B(t,this.minDate,this.maxDate))if(this.isRangeValue(this.value)){const s=void 0===(null===(e=this.value)||void 0===e?void 0:e[0])||2===this.value.length?[t]:[this.value[0],t];2===s.length&&s[0]>s[1]&&s.reverse();const a=void 0===s[1]?[r(s[0])]:[r(s[0]),r(s[1])];this.value=s,null===(i=this.selectDate)||void 0===i||i.emit(a)}else{if((null===(s=this.value)||void 0===s?void 0:s.getTime())===t.getTime())return;this.value=t,null===(a=this.selectDate)||void 0===a||a.emit(r(t))}}isRangeValue(t){return!!this.range}render(){var t;const e=this.showTodayButton||this.showClearButton||this.showCloseButton||this.showKeyboardHint,i={year:{prev:this.disabled||!!this.minDate&&m(this.minDate).getFullYear()>y(this.currentDate).getFullYear(),next:this.disabled||!!this.maxDate&&m(this.maxDate).getFullYear()<b(this.currentDate).getFullYear()},month:{prev:this.disabled||$(v(this.currentDate).getMonth(),v(this.currentDate).getFullYear(),this.minDate,this.maxDate),next:this.disabled||$(u(this.currentDate).getMonth(),u(this.currentDate).getFullYear(),this.minDate,this.maxDate)}};return s(a,{key:"60e2a56f8a1aadceb57d7f445098060293a0f937"},s("div",{key:"12fd35c03b0c34e4ad88e4e491fcc685de5f09b2",class:{[`${this.getClassName()}-wrapper`]:!0,[`${this.getClassName()}-wrapper--inline`]:this.inline}},s("div",{key:"ad36d1e260a7a89110c53fc86e339eb5a259a4fc",class:{[this.getClassName()]:!0,[`${this.getClassName()}--disabled`]:this.disabled}},s("div",{key:"181b9ed0a6a9d6073d67f270d6b14efc28f6a6b2",class:this.getClassName("header")},this.showHiddenTitle&&s("span",{key:"580656924dc3ba028458591399791423797d58d7","aria-atomic":"true","aria-live":"polite",class:"visually-hidden"},this.getTitle()),this.showYearStepper&&s("button",{key:"baedceb7e568df8bfc1cee64d13c6114b85c3764","aria-label":this.labels.previousYearButton,class:this.getClassName("previous-year-button"),"aria-disabled":String(i.year.prev),disabled:i.year.prev,innerHTML:this.previousYearButtonContent||void 0,onClick:this.previousYear,type:"button"},s("svg",{key:"4e3286e12ebd5c5bba8dfc3f0ecab29f37ddf9c0",fill:"none",height:"24","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"24"},s("polyline",{key:"6178bb5e4dc08a9b46c587c7b3e7c5fd27867f5b",points:"11 17 6 12 11 7"}),s("polyline",{key:"3d03d26acc37c91243d7cbd54d228f35752f80a7",points:"18 17 13 12 18 7"}))),this.showMonthStepper&&s("button",{key:"9ecb2f9e5adceda9526b15b64721f16e1c7a8ca5","aria-label":this.labels.previousMonthButton,class:this.getClassName("previous-month-button"),"aria-disabled":String(i.month.prev),disabled:i.month.prev,innerHTML:this.previousMonthButtonContent||void 0,onClick:this.previousMonth,type:"button"},s("svg",{key:"a8c74b97c18cae04b86464a53b8a99f3cffd1379",fill:"none",height:"24","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"24"},s("polyline",{key:"196da2b5f0485a8af41232b2c9fd614e131230e6",points:"15 18 9 12 15 6"}))),s("span",{key:"b044b7041af2cbd6b527b05b6d4175e85a4a5e0c",class:this.getClassName("current-month")},s("select",{key:"f4259d0b1448b19e861ed1bb7401508b6e8f5505","aria-label":this.labels.monthSelect,class:this.getClassName("month-select"),"aria-disabled":this.disabled,name:"month",onChange:this.onMonthSelect},(n=this.locale,new Array(12).fill(void 0).map(((t,e)=>{const i=k(new Date(`2006-${String(e+1).padStart(2,"0")}-01`));return Intl.DateTimeFormat(n,{month:"long"}).format(i)}))).map(((t,e)=>s("option",{key:t,selected:this.currentDate.getMonth()===e,value:e+1,disabled:$(e,this.currentDate.getFullYear(),this.minDate,this.maxDate)},t)))),s("input",{key:"29566d4d17a43313d0cd09102ffe8f7dadab48a4","aria-label":this.labels.yearSelect,class:this.getClassName("year-select"),"aria-disabled":this.disabled,max:this.maxDate?this.maxDate.slice(0,4):9999,min:this.minDate?this.minDate.slice(0,4):1,name:"year",onChange:this.onYearSelect,type:"number",value:this.currentDate.getFullYear()})),this.showMonthStepper&&s("button",{key:"3c3a08d8c1a9471d3c03656e1c69dd9b610964a6","aria-label":this.labels.nextMonthButton,class:this.getClassName("next-month-button"),"aria-disabled":String(i.month.next),disabled:i.month.next,innerHTML:this.nextMonthButtonContent||void 0,onClick:this.nextMonth,type:"button"},s("svg",{key:"691056b81918999f8cb5e411ea808bfc3d63d285",fill:"none",height:"24","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"24"},s("polyline",{key:"1ad9ffac020a5e77bfbe13e56be4039c0ab1bce1",points:"9 18 15 12 9 6"}))),this.showYearStepper&&s("button",{key:"541f139687c50d4515f6ba52f86e5bd0dfb480a8","aria-label":this.labels.nextYearButton,class:this.getClassName("next-year-button"),"aria-disabled":String(i.year.next),disabled:i.year.next,innerHTML:this.nextYearButtonContent||void 0,onClick:this.nextYear,type:"button"},s("svg",{key:"38ed3c8a59612395ef641d3ae1068f755f7d68b1",fill:"none",height:"24","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"24"},s("polyline",{key:"2b95dc3f77f314e84d2cfaec8e479d7097ab43d9",points:"13 17 18 12 13 7"}),s("polyline",{key:"f26e6b1290a4817aef45fb8e7aa0f7956fefaa8c",points:"6 17 11 12 6 7"})))),s("div",{key:"2c8eefeaac7909a66bd3975c4a5be18ac7f459fe",class:this.getClassName("body")},s("table",{key:"2a3646bac9db5b7253fa17632d71d74bec41a6ee",class:this.getClassName("calendar"),onKeyDown:this.onKeyDown,role:"grid","aria-label":this.getTitle()},s("thead",{key:"146348c0e34687eb6b776698b8dd8eba44b51552",class:this.getClassName("calendar-header")},s("tr",{key:"afa9189bdbaab542fdf36c78849da38cdf387135",class:this.getClassName("weekday-row")},null===(t=this.weekdays)||void 0===t?void 0:t.map((t=>s("th",{role:"columnheader",abbr:t[1],class:this.getClassName("weekday"),key:t[0],scope:"col"},s("span",{"aria-hidden":"true"},t[0]),s("span",{class:"visually-hidden"},t[1])))))),s("tbody",{key:"d70b0012e308a5dadb5da96c78f6471253f9d1c0"},this.getCalendarRows().map((t=>{const e=`row-${t[0].getMonth()}-${t[0].getDate()}`;return s("tr",{class:this.getClassName("calendar-row"),key:e},t.map((t=>{var e,i,a;const n=p(t,this.currentDate),h=t.getMonth()!==(null===(e=this.currentDate)||void 0===e?void 0:e.getMonth()),o=Array.isArray(this.value)?p(t,this.value[0])||this.value[1]&&B(t,r(this.value[0]),r(this.value[1])):p(t,this.value),d=this.disableDate(t)||!B(t,this.minDate,this.maxDate),c=!!this.isRangeValue(this.value)&&(u={from:null===(i=this.value)||void 0===i?void 0:i[0],to:(null===(a=this.value)||void 0===a?void 0:a[1])||this.hoveredDate||this.currentDate},!!((l=t)&&u&&u.from&&u.to)&&l>=(u.from<u.to?u.from:u.to)&&l<=(u.from<u.to?u.to:u.from)&&!d);var l,u;const b=p(t,new Date),f=`cell-${t.getMonth()}-${t.getDate()}`,v={[this.getClassName("date")]:!0,[this.getClassName("date--current")]:n,[this.getClassName("date--disabled")]:d,[this.getClassName("date--overflowing")]:h,[this.getClassName("date--today")]:b,[this.getClassName("date--selected")]:o,[this.getClassName("date--in-range")]:c},y=o?"strong":b?"em":"span";return s("td",{"aria-disabled":String(d),"aria-selected":o?"true":void 0,class:v,"data-date":r(t),key:f,onClick:this.onClick,onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,role:"gridcell",tabIndex:p(t,this.currentDate)&&!this.disabled?0:-1},s(y,{"aria-hidden":"true"},t.getDate()),s("span",{class:"visually-hidden"},(()=>{if(this.range){let e=this.value?"":`, ${this.labels.chooseAsStartDate}.`;return Array.isArray(this.value)&&(e={1:`, ${this.labels.chooseAsEndDate}.`,2:`, ${this.labels.chooseAsStartDate}.`}[this.value.length]),`${o?`${this.labels.selected}, `:""}${Intl.DateTimeFormat(this.locale,{day:"numeric",month:"long",year:"numeric"}).format(t)}${e}`}return`${o?`${this.labels.selected}, `:""}${Intl.DateTimeFormat(this.locale,{day:"numeric",month:"long",year:"numeric"}).format(t)}`})()))})))}))))),e&&s("div",{key:"574bd94d669e65194e7c26499007a320d950dff4",class:this.getClassName("footer")},s("div",{key:"c4fad38c1c3a57f221c3b7094e1f70981fcd9f65",class:this.getClassName("footer-buttons")},this.showTodayButton&&s("button",{key:"26e4889dc3d806204df07aea74069741dc8794d9","aria-label":this.todayButtonContent?this.labels.todayButton:void 0,class:this.getClassName("today-button"),disabled:this.disabled,innerHTML:this.todayButtonContent||void 0,onClick:this.showToday,type:"button"},!this.todayButtonContent&&this.labels.todayButton),this.showClearButton&&s("button",{key:"347741d4adfc95c14060864de7674344da311a6e","aria-label":this.clearButtonContent?this.labels.clearButton:void 0,class:this.getClassName("clear-button"),disabled:this.disabled,innerHTML:this.clearButtonContent||void 0,onClick:this.clear,type:"button"},!this.clearButtonContent&&this.labels.clearButton),this.showCloseButton&&s("button",{key:"287053ef376238a807a1ff092da80a350700abd2","aria-label":this.closeButtonContent?this.labels.closeButton:void 0,class:this.getClassName("close-button"),disabled:this.disabled,innerHTML:this.closeButtonContent||void 0,onClick:this.close,type:"button"},!this.closeButtonContent&&this.labels.closeButton)),this.showKeyboardHint&&!window.matchMedia("(pointer: coarse)").matches&&s("button",{key:"bb05e75930b211fb43874b492c4e16229d0d7232",type:"button",onClick:()=>alert("Todo: Add Keyboard helper!"),class:this.getClassName("keyboard-hint")},s("svg",{key:"8b7e648ea409ce84086aaf06c4d4707dd6e09274",xmlns:"http://www.w3.org/2000/svg",height:"1em",width:"1em",viewBox:"0 0 48 48",fill:"currentColor"},s("path",{key:"aeaefade16771c198b74bb1c38f88bd9457d2baa",d:"M7 38q-1.2 0-2.1-.925Q4 36.15 4 35V13q0-1.2.9-2.1.9-.9 2.1-.9h34q1.2 0 2.1.9.9.9.9 2.1v22q0 1.15-.9 2.075Q42.2 38 41 38Zm0-3h34V13H7v22Zm8-3.25h18v-3H15Zm-4.85-6.25h3v-3h-3Zm6.2 0h3v-3h-3Zm6.15 0h3v-3h-3Zm6.2 0h3v-3h-3Zm6.15 0h3v-3h-3Zm-24.7-6.25h3v-3h-3Zm6.2 0h3v-3h-3Zm6.15 0h3v-3h-3Zm6.2 0h3v-3h-3Zm6.15 0h3v-3h-3ZM7 35V13v22Z"})),this.labels.keyboardHint))),s("slot",{key:"6054a85ed3973b573f102c45d33995ad90eaf2f8",name:"after-calendar"})));var n}get el(){return this}static get watchers(){return{modalIsOpen:[{watchModalIsOpen:0}],firstDayOfWeek:[{watchFirstDayOfWeek:0}],locale:[{watchLocale:0}],range:[{watchRange:0}],startDate:[{watchStartDate:0}],value:[{watchValue:0}]}}static get style(){return".visually-hidden.sc-tabworthy-dates-calendar{position:absolute;overflow:hidden;width:1px;height:1px;white-space:nowrap;clip:rect(0 0 0 0);-webkit-clip-path:inset(50%);clip-path:inset(50%)}"}},[262,"tabworthy-dates-calendar",{clearButtonContent:[1,"clear-button-content"],closeButtonContent:[1,"close-button-content"],disabled:[4],modalIsOpen:[4,"modal-is-open"],disableDate:[16],elementClassName:[1,"element-class-name"],firstDayOfWeek:[2,"first-day-of-week"],range:[4],labels:[16],locale:[1],nextMonthButtonContent:[1,"next-month-button-content"],nextYearButtonContent:[1,"next-year-button-content"],previousMonthButtonContent:[1,"previous-month-button-content"],previousYearButtonContent:[1,"previous-year-button-content"],minDate:[1,"min-date"],maxDate:[1,"max-date"],inline:[4],showClearButton:[4,"show-clear-button"],showCloseButton:[4,"show-close-button"],showMonthStepper:[4,"show-month-stepper"],showTodayButton:[4,"show-today-button"],showYearStepper:[4,"show-year-stepper"],showKeyboardHint:[4,"show-keyboard-hint"],showHiddenTitle:[4,"show-hidden-title"],startDate:[1,"start-date"],todayButtonContent:[1,"today-button-content"],value:[1040],currentDate:[32],hoveredDate:[32],weekdays:[32]},void 0,{modalIsOpen:[{watchModalIsOpen:0}],firstDayOfWeek:[{watchFirstDayOfWeek:0}],locale:[{watchLocale:0}],range:[{watchRange:0}],startDate:[{watchStartDate:0}],value:[{watchValue:0}]}]);function H(){"undefined"!=typeof customElements&&["tabworthy-dates-calendar"].forEach((t=>{"tabworthy-dates-calendar"===t&&(customElements.get(n(t))||customElements.define(n(t),Z))}))}export{Z as T,D as a,C as b,H as c,B as d,S as e,r as g,x as i,m as p,k as r}
@@ -1 +1 @@
1
- import{T as o,c as s}from"./p-BzY8iIVW.js";const p=o,r=s;export{p as TabworthyDatesCalendar,r as defineCustomElement}
1
+ import{T as o,c as s}from"./p-C_Pq_S0e.js";const p=o,r=s;export{p as TabworthyDatesCalendar,r as defineCustomElement}