@tabworthy/components 0.12.1 → 0.12.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.
@@ -233,6 +233,16 @@ const TabworthyDatesCalendar = class {
233
233
  const row = daysOfMonth.slice(i, i + 7);
234
234
  calendarRows.push(row);
235
235
  }
236
+ const lastRow = calendarRows[calendarRows.length - 1];
237
+ let lastDay = lastRow === null || lastRow === void 0 ? void 0 : lastRow[lastRow.length - 1];
238
+ while (calendarRows.length < 6 && lastDay) {
239
+ const row = [];
240
+ for (let i = 0; i < 7; i += 1) {
241
+ lastDay = utils.addDays(lastDay, 1);
242
+ row.push(lastDay);
243
+ }
244
+ calendarRows.push(row);
245
+ }
236
246
  return calendarRows;
237
247
  }
238
248
  getTitle() {
@@ -328,15 +338,15 @@ const TabworthyDatesCalendar = class {
328
338
  utils.monthIsDisabled(utils.getNextMonth(this.currentDate).getMonth(), utils.getNextMonth(this.currentDate).getFullYear(), this.minDate, this.maxDate)
329
339
  }
330
340
  };
331
- return (index.h(index.Host, { key: 'abba9db6dddb2eda2732272a4965549e9efbcaa3' }, index.h("div", { key: '07e733d1bc665da354ad45f3441bbfe6f575284c', class: {
341
+ return (index.h(index.Host, { key: '1bda8d7a489d87cf27ecbcd978accf5363f32804' }, index.h("div", { key: '7118660fbbdfac4a73a1ace99d96d4ac32a4b137', class: {
332
342
  [`${this.getClassName()}-wrapper`]: true,
333
343
  [`${this.getClassName()}-wrapper--inline`]: this.inline
334
- } }, index.h("div", { key: '7cf7cda0096034917e4dc406b14b992f4fd59046', class: {
344
+ } }, index.h("div", { key: '41b62826cdff428aef8ad89844a50873f8853b5e', class: {
335
345
  [this.getClassName()]: true,
336
346
  [`${this.getClassName()}--disabled`]: this.disabled
337
- } }, index.h("div", { key: '6286dfb1d637d48b4338247309a4bd07ba9bcc47', class: this.getClassName("header") }, this.showHiddenTitle && (index.h("span", { key: '7ef10a2c9b56de6dd6dbebf42aa107cb5402837a', "aria-atomic": "true", "aria-live": "polite", class: "visually-hidden" }, this.getTitle())), this.showYearStepper && (index.h("button", { key: 'f82e1314c5b696a3d34b9c131d187b9814c1a3e7', "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: '8fb0e89ba5da9a5f22c4030f401512d907e93676', 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: '063019349c518195eb0b59177c39c1475d9cdaf0', points: "11 17 6 12 11 7" }), index.h("polyline", { key: 'e9a7e1ce55ed818788de12ea064ddc9030cf82a3', points: "18 17 13 12 18 7" })))), this.showMonthStepper && (index.h("button", { key: 'b4dafea59ef7d7ef705df7aaa95198f7236aac77', "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: '50aac77c0a53acef931af7ba1ef934e52f4a6e1f', 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: 'a7cebfbcc0be9e66815f3a69a13501d8ba1bbb83', points: "15 18 9 12 15 6" })))), index.h("span", { key: 'ec9add8bd9f35bccbf6c4c47510cd90be4ed7175', class: this.getClassName("current-month") }, index.h("select", { key: 'c36f648d42e8ee62e1a3b2d4bbeeab013dc871d5', "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) => {
347
+ } }, index.h("div", { key: '7a9ee67778c6f48e65d88defc1ff620e995d75bc', class: this.getClassName("header") }, this.showHiddenTitle && (index.h("span", { key: '404e50ab0f24235d6678af7c12f6b3cdd491e347', "aria-atomic": "true", "aria-live": "polite", class: "visually-hidden" }, this.getTitle())), this.showYearStepper && (index.h("button", { key: '88552edc01ae9c4a7d8225c2aab078d2123bf9f6', "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: '5daef016748f562ddf3866557774c87016887fc6', 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: '5b73b6ec2b5abcae4d2e5cd833b5de441938e533', points: "11 17 6 12 11 7" }), index.h("polyline", { key: '05e146e1c233c39403147e7af61948798db7c0f7', points: "18 17 13 12 18 7" })))), this.showMonthStepper && (index.h("button", { key: '6145f62f073563e9136ad454f4e9633e99b8d8a9', "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: '8ae9cc385a6fdbdd915a2717246752c7f2f17b01', 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: '9395192e65c1e550547220850b29a117569a79e2', points: "15 18 9 12 15 6" })))), index.h("span", { key: '3b282148e95b8b1facde4a2ab370c6088b72bccd', class: this.getClassName("current-month") }, index.h("select", { key: 'f782b9d803abd5eb1add6c869b3ac302a717780d', "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) => {
338
348
  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));
339
- })), index.h("input", { key: '547174f2f8fe0248589a40a46aace91171f08ad7', "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: '458fd7350775325c43895f9896b151f8d490a725', "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: '3b6c5f32830d6983e2e59e89f8986012533f1b0f', 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: 'b2dde5779945c6c7f6bd686b05874bc62f34c817', points: "9 18 15 12 9 6" })))), this.showYearStepper && (index.h("button", { key: '0f7ea0b890e11d42634c8751cca659caf788ca67', "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: 'a1f3037455d82547829d3f3afc15f6ea773277b4', 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: 'ee5bfeadf5b183cba36c15ce6a5c30654ff98fe2', points: "13 17 18 12 13 7" }), index.h("polyline", { key: '02966a045d9496e161bbd4a40e103990b0e146a9', points: "6 17 11 12 6 7" }))))), index.h("div", { key: 'e588f18d365e6e1f87e1da7033741cb22ebafed7', class: this.getClassName("body") }, index.h("table", { key: '7c6b926b3bc6b832b9fb1aabaac6841eb30cda30', class: this.getClassName("calendar"), onKeyDown: this.onKeyDown, role: "grid", "aria-label": this.getTitle() }, index.h("thead", { key: '4ebbefd8e10e5d83308e84eeafd85c29902275b1', class: this.getClassName("calendar-header") }, index.h("tr", { key: '101788f84e1f2a44a498813024944fe32a7c7388', 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: '4498ab21f627f5f8582db15d5babfc4e84c20b38' }, this.getCalendarRows().map((calendarRow) => {
349
+ })), index.h("input", { key: 'dcd8a96a130513d1cf34d900d6f8c09ce974ba15', "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: '7de261689d242a0116e85f3c5fda265f49eaaf13', "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: '2033c731d98fd53088857a92bdd35e5e977137d7', 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: 'dc88e8e5e4f79d5ae0b62ea51f6ba52d5e26ce9f', points: "9 18 15 12 9 6" })))), this.showYearStepper && (index.h("button", { key: 'e25bcd81e34e0e162954b2ab67876c148f50f5d4', "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: '70df81cfd06bcb1e6571933b7a43a5071522159b', 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: 'f8242866ca29743b19055d1ac53fcc8e84d68a35', points: "13 17 18 12 13 7" }), index.h("polyline", { key: '6bda80ff2eba82dac0d36e287976130e6b16113c', points: "6 17 11 12 6 7" }))))), index.h("div", { key: '6d5b0085437827c1db975f12dc5fe5927c7ba62f', class: this.getClassName("body") }, index.h("table", { key: '61975eac4e06c3a416fcb9503eef9c7a386a6b54', class: this.getClassName("calendar"), onKeyDown: this.onKeyDown, role: "grid", "aria-label": this.getTitle() }, index.h("thead", { key: 'fd259bd5ba6e12ff39dad5a31133913d17fdf276', class: this.getClassName("calendar-header") }, index.h("tr", { key: '410c84eabac58cf6139dd6c886b4803772abceb5', 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: '330d3b922d474b42edf0764556d2f2643b5b639d' }, this.getCalendarRows().map((calendarRow) => {
340
350
  const rowKey = `row-${calendarRow[0].getMonth()}-${calendarRow[0].getDate()}`;
341
351
  return (index.h("tr", { class: this.getClassName("calendar-row"), key: rowKey }, calendarRow.map((day) => {
342
352
  var _a, _b, _c;
@@ -403,8 +413,8 @@ const TabworthyDatesCalendar = class {
403
413
  ? 0
404
414
  : -1 }, index.h(Tag, { "aria-hidden": "true" }, day.getDate()), index.h("span", { class: "visually-hidden" }, getScreenReaderText())));
405
415
  })));
406
- })))), showFooter && (index.h("div", { key: '48fde61cd9cdf8900bf8e15d408f3ad11cba9d9d', class: this.getClassName("footer") }, index.h("div", { key: 'a0b3e3b48f1f530648dff20598a0665ded2fbbe1', class: this.getClassName("footer-buttons") }, this.showTodayButton && (index.h("button", { key: '06a03df2fe08b9c76d393fdfe48e279c58acf613', class: this.getClassName("today-button"), disabled: this.disabled, innerHTML: this.todayButtonContent || undefined, onClick: this.showToday, type: "button" }, this.labels.todayButton)), this.showClearButton && (index.h("button", { key: 'e8bc81d95650edbf8c3b4d4e217d155c8a6f88b2', class: this.getClassName("clear-button"), disabled: this.disabled, innerHTML: this.clearButtonContent || undefined, onClick: this.clear, type: "button" }, this.labels.clearButton)), this.showCloseButton && (index.h("button", { key: '4ca7b4c414ca22092bee6fffb51179bbc1d66ee6', class: this.getClassName("close-button"), disabled: this.disabled, innerHTML: this.closeButtonContent || undefined, onClick: this.close, type: "button" }, this.labels.closeButton))), this.showKeyboardHint &&
407
- !window.matchMedia("(pointer: coarse)").matches && (index.h("button", { key: 'd34f89d3fb25286752bc4aa71893d0277dde3d17', type: "button", onClick: () => alert("Todo: Add Keyboard helper!"), class: this.getClassName("keyboard-hint") }, index.h("svg", { key: '5cf389d28d296804a5b5adfea6a0084290d125dd', xmlns: "http://www.w3.org/2000/svg", height: "1em", width: "1em", viewBox: "0 0 48 48", fill: "currentColor" }, index.h("path", { key: 'b84709ea4f714b979ff76078ee71556dc8671b04', 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: '1a37c10a1e2e367b1ee42756c85894d7ff5325f5', name: "after-calendar" }))));
416
+ })))), showFooter && (index.h("div", { key: '88362c2e1731e8813ad9c5da3b34f6afe16f2036', class: this.getClassName("footer") }, index.h("div", { key: 'e93a0b8fff1be09855ab87db159cb186b9339a39', class: this.getClassName("footer-buttons") }, this.showTodayButton && (index.h("button", { key: 'a5b88ad46182dc5367987bd78cb02e98cd63aaef', class: this.getClassName("today-button"), disabled: this.disabled, innerHTML: this.todayButtonContent || undefined, onClick: this.showToday, type: "button" }, this.labels.todayButton)), this.showClearButton && (index.h("button", { key: '3929f2d213399b656057010ccdbead8020b04c2d', class: this.getClassName("clear-button"), disabled: this.disabled, innerHTML: this.clearButtonContent || undefined, onClick: this.clear, type: "button" }, this.labels.clearButton)), this.showCloseButton && (index.h("button", { key: '800308eb41769813d9191bec7537385255039a80', class: this.getClassName("close-button"), disabled: this.disabled, innerHTML: this.closeButtonContent || undefined, onClick: this.close, type: "button" }, this.labels.closeButton))), this.showKeyboardHint &&
417
+ !window.matchMedia("(pointer: coarse)").matches && (index.h("button", { key: '0b478f25499d1aec350b35bb9777c6ec03d7fea3', type: "button", onClick: () => alert("Todo: Add Keyboard helper!"), class: this.getClassName("keyboard-hint") }, index.h("svg", { key: '14840cb62c1a222a347e40f6d1ab043842377a49', xmlns: "http://www.w3.org/2000/svg", height: "1em", width: "1em", viewBox: "0 0 48 48", fill: "currentColor" }, index.h("path", { key: 'd73008de603c67c20e335845ce42d6eff3cf2fc6', 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: '4616ab014b3db34b2d42958aefdbc7795829bbba', name: "after-calendar" }))));
408
418
  }
409
419
  get el() { return index.getElement(this); }
410
420
  static get watchers() { return {
@@ -35,7 +35,6 @@ const defaultLabels = {
35
35
  disabledDateError: `Please choose an available date`,
36
36
  to: "to",
37
37
  startDate: "Start date",
38
- yearSelect: "Select year",
39
38
  timeLabel: "Time"
40
39
  };
41
40
  const TabworthyTimes = class {
@@ -295,10 +294,10 @@ const TabworthyTimes = class {
295
294
  }
296
295
  render() {
297
296
  var _a;
298
- return (index.h(index.Host, { key: '87a26428aa34838553ab9d888d59bdd662912d4d', class: this.elementClassName, "has-error": this.errorState, disabled: this.disabledState }, index.h("label", { key: '5e9168376f6f770edc72718843e3d393e3a8c8df', htmlFor: `${this.id}-input`, class: this.getClassName("label") }, this.label), index.h("div", { key: 'ca9b0ce61d685fea6a547043e3e345958d893473', class: this.getClassName("input-container"), ref: (r) => (this.inputContainerRef = r) }, index.h("input", { key: '35a57d49bd8660abf1aef8f496df0df0fc357712', id: `${this.id}-input`, ref: (r) => (this.inputRef = r), type: "text", class: {
297
+ return (index.h(index.Host, { key: '671702979dddb6a19cfa78a95df28a958af56df9', class: this.elementClassName, "has-error": this.errorState, disabled: this.disabledState }, index.h("label", { key: '7b23263f899b3a59d43f3f2922e9c98a0bc62524', htmlFor: `${this.id}-input`, class: this.getClassName("label") }, this.label), index.h("div", { key: '453d585bee8dd0262aadec8ba816cd22c51cffea', class: this.getClassName("input-container"), ref: (r) => (this.inputContainerRef = r) }, index.h("input", { key: 'd2ec7de2b31f3c1a6b9acb4f57341530cb8431dc', id: `${this.id}-input`, ref: (r) => (this.inputRef = r), type: "text", class: {
299
298
  [this.getClassName("input")]: true,
300
299
  [this.inputClass]: !!this.inputClass
301
- }, placeholder: this.placeholder, disabled: this.disabledState || this.disableFreeformInput, value: (_a = this.internalValue) === null || _a === void 0 ? void 0 : _a.toString(), onBlur: this.handleInputBlur, onChange: this.handleInputChange, "aria-describedby": this.errorState ? `${this.id}-error` : undefined, "aria-invalid": this.errorState }), !this.inline && (index.h("button", { key: '3144ec32c0866b120c27963a253fff87f8a73285', type: "button", onClick: this.handleCalendarButtonClick, class: this.getClassName("calendar-button"), disabled: this.disabledState }, this.calendarButtonContent ? (index.h("span", { innerHTML: this.calendarButtonContent })) : (this.timesLabels.openCalendar)))), index.h("tabworthy-dates-modal", { key: '6a5e765432ebe1eda8a02333d699033ec9f392ea', label: this.timesLabels.calendar, ref: (el) => (this.modalRef = el), onOpened: () => {
300
+ }, placeholder: this.placeholder, disabled: this.disabledState || this.disableFreeformInput, value: (_a = this.internalValue) === null || _a === void 0 ? void 0 : _a.toString(), onBlur: this.handleInputBlur, onChange: this.handleInputChange, "aria-describedby": this.errorState ? `${this.id}-error` : undefined, "aria-invalid": this.errorState }), !this.inline && (index.h("button", { key: '77b42f53ad8a5e0d5d70ea41f999f95d61942a83', type: "button", onClick: this.handleCalendarButtonClick, class: this.getClassName("calendar-button"), disabled: this.disabledState }, this.calendarButtonContent ? (index.h("span", { innerHTML: this.calendarButtonContent })) : (this.timesLabels.openCalendar)))), index.h("tabworthy-dates-modal", { key: '3633f9e7839b8947da48f83ac3808156bea8515d', label: this.timesLabels.calendar, ref: (el) => (this.modalRef = el), onOpened: () => {
302
301
  if (this.pickerRef) {
303
302
  this.pickerRef.modalIsOpen = true;
304
303
  }
@@ -306,7 +305,7 @@ const TabworthyTimes = class {
306
305
  if (this.pickerRef) {
307
306
  this.pickerRef.modalIsOpen = false;
308
307
  }
309
- }, inline: this.inline, appendTo: this.appendTo }, index.h("div", { key: 'ed1f2484ba3c2541009e86d1e0500e76561007fa', class: this.getClassName("picker-container") }, index.h("tabworthy-dates-calendar", { key: 'db96a7d4e2844c8825f5f774616b449164de3273', range: this.range, locale: this.locale, onSelectDate: (event) => this.handlePickerSelection(event.detail), onChangeMonth: (event) => this.handleChangedMonths(event.detail), onChangeYear: (event) => this.handleYearChange(event.detail), onRequestClose: () => { var _a; return (_a = this.modalRef) === null || _a === void 0 ? void 0 : _a.close(); }, labels: this.datesCalendarLabels, ref: (el) => (this.pickerRef = el), startDate: this.startDate, firstDayOfWeek: this.firstDayOfWeek, showHiddenTitle: true, disabled: this.disabledState, showMonthStepper: this.showMonthStepper, showYearStepper: this.showYearStepper, showClearButton: this.showClearButton, showCloseButton: this.showCloseButton, showTodayButton: this.showTodayButton, disableDate: this.disableDate, minDate: this.minDate, maxDate: this.maxDate, inline: this.inline, value: this.value ? this.toDate(this.value) : undefined }, index.h("div", { key: '146f445a91fae0d132cbf90ee5a23c457773857a', slot: "after-calendar", class: this.getClassName("time-section") }, index.h("hr", { key: 'e55e8dddbddca29d720d343d7ee8fa8fac80f2f4', class: this.getClassName("divider") }), index.h("tabworthy-times-picker", { key: '23857ca0f4874d5b2c0da426d8063072e1eee4a8', hours: this.selectedHours, minutes: this.selectedMinutes, seconds: this.selectedSeconds, showSeconds: this.showSeconds, useTwelveHourFormat: this.useTwelveHourFormat, disabled: this.disabledState, onTimeChanged: this.handleTimeChange, labels: this.timesPickerLabels }))))), this.errorState && (index.h("div", { key: '93cd7dcd8101e0bf9f5f4f81dd1dc8cb19997fd5', class: this.getClassName("input-error"), id: this.id ? `${this.id}-error` : undefined, role: "status" }, this.errorMessage))));
308
+ }, inline: this.inline, appendTo: this.appendTo }, index.h("div", { key: '706e2fdcd7e4ecf77f5ee63f4c5ced7951593735', class: this.getClassName("picker-container") }, index.h("tabworthy-dates-calendar", { key: 'cb027f3fe4d2bf73abea9ec6511fe11305e28aba', range: this.range, locale: this.locale, onSelectDate: (event) => this.handlePickerSelection(event.detail), onChangeMonth: (event) => this.handleChangedMonths(event.detail), onChangeYear: (event) => this.handleYearChange(event.detail), onRequestClose: () => { var _a; return (_a = this.modalRef) === null || _a === void 0 ? void 0 : _a.close(); }, labels: this.datesCalendarLabels, ref: (el) => (this.pickerRef = el), startDate: this.startDate, firstDayOfWeek: this.firstDayOfWeek, showHiddenTitle: true, disabled: this.disabledState, showMonthStepper: this.showMonthStepper, showYearStepper: this.showYearStepper, showClearButton: this.showClearButton, showCloseButton: this.showCloseButton, showTodayButton: this.showTodayButton, disableDate: this.disableDate, minDate: this.minDate, maxDate: this.maxDate, inline: this.inline, value: this.value ? this.toDate(this.value) : undefined }, index.h("div", { key: '2287a25cdec6fc40c36833c250536f99cabe5cbf', slot: "after-calendar", class: this.getClassName("time-section") }, index.h("hr", { key: '540cfd69b4ca3618ecd22f9d1ed3d240ed8eeee9', class: this.getClassName("divider") }), index.h("tabworthy-times-picker", { key: '79e8c05c3ba4af1ef46a78c6d6fcb211dec7abd5', hours: this.selectedHours, minutes: this.selectedMinutes, seconds: this.selectedSeconds, showSeconds: this.showSeconds, useTwelveHourFormat: this.useTwelveHourFormat, disabled: this.disabledState, onTimeChanged: this.handleTimeChange, labels: this.timesPickerLabels }))))), this.errorState && (index.h("div", { key: '4a568e01f57652308adb7a8c115ab6649fc591fc', class: this.getClassName("input-error"), id: this.id ? `${this.id}-error` : undefined, role: "status" }, this.errorMessage))));
310
309
  }
311
310
  get el() { return index.getElement(this); }
312
311
  static get watchers() { return {
@@ -224,6 +224,16 @@ export class TabworthyDatesCalendar {
224
224
  const row = daysOfMonth.slice(i, i + 7);
225
225
  calendarRows.push(row);
226
226
  }
227
+ const lastRow = calendarRows[calendarRows.length - 1];
228
+ let lastDay = lastRow === null || lastRow === void 0 ? void 0 : lastRow[lastRow.length - 1];
229
+ while (calendarRows.length < 6 && lastDay) {
230
+ const row = [];
231
+ for (let i = 0; i < 7; i += 1) {
232
+ lastDay = addDays(lastDay, 1);
233
+ row.push(lastDay);
234
+ }
235
+ calendarRows.push(row);
236
+ }
227
237
  return calendarRows;
228
238
  }
229
239
  getTitle() {
@@ -319,15 +329,15 @@ export class TabworthyDatesCalendar {
319
329
  monthIsDisabled(getNextMonth(this.currentDate).getMonth(), getNextMonth(this.currentDate).getFullYear(), this.minDate, this.maxDate)
320
330
  }
321
331
  };
322
- return (h(Host, { key: 'abba9db6dddb2eda2732272a4965549e9efbcaa3' }, h("div", { key: '07e733d1bc665da354ad45f3441bbfe6f575284c', class: {
332
+ return (h(Host, { key: '1bda8d7a489d87cf27ecbcd978accf5363f32804' }, h("div", { key: '7118660fbbdfac4a73a1ace99d96d4ac32a4b137', class: {
323
333
  [`${this.getClassName()}-wrapper`]: true,
324
334
  [`${this.getClassName()}-wrapper--inline`]: this.inline
325
- } }, h("div", { key: '7cf7cda0096034917e4dc406b14b992f4fd59046', class: {
335
+ } }, h("div", { key: '41b62826cdff428aef8ad89844a50873f8853b5e', class: {
326
336
  [this.getClassName()]: true,
327
337
  [`${this.getClassName()}--disabled`]: this.disabled
328
- } }, h("div", { key: '6286dfb1d637d48b4338247309a4bd07ba9bcc47', class: this.getClassName("header") }, this.showHiddenTitle && (h("span", { key: '7ef10a2c9b56de6dd6dbebf42aa107cb5402837a', "aria-atomic": "true", "aria-live": "polite", class: "visually-hidden" }, this.getTitle())), this.showYearStepper && (h("button", { key: 'f82e1314c5b696a3d34b9c131d187b9814c1a3e7', "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: '8fb0e89ba5da9a5f22c4030f401512d907e93676', 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: '063019349c518195eb0b59177c39c1475d9cdaf0', points: "11 17 6 12 11 7" }), h("polyline", { key: 'e9a7e1ce55ed818788de12ea064ddc9030cf82a3', points: "18 17 13 12 18 7" })))), this.showMonthStepper && (h("button", { key: 'b4dafea59ef7d7ef705df7aaa95198f7236aac77', "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: '50aac77c0a53acef931af7ba1ef934e52f4a6e1f', 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: 'a7cebfbcc0be9e66815f3a69a13501d8ba1bbb83', points: "15 18 9 12 15 6" })))), h("span", { key: 'ec9add8bd9f35bccbf6c4c47510cd90be4ed7175', class: this.getClassName("current-month") }, h("select", { key: 'c36f648d42e8ee62e1a3b2d4bbeeab013dc871d5', "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) => {
338
+ } }, h("div", { key: '7a9ee67778c6f48e65d88defc1ff620e995d75bc', class: this.getClassName("header") }, this.showHiddenTitle && (h("span", { key: '404e50ab0f24235d6678af7c12f6b3cdd491e347', "aria-atomic": "true", "aria-live": "polite", class: "visually-hidden" }, this.getTitle())), this.showYearStepper && (h("button", { key: '88552edc01ae9c4a7d8225c2aab078d2123bf9f6', "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: '5daef016748f562ddf3866557774c87016887fc6', 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: '5b73b6ec2b5abcae4d2e5cd833b5de441938e533', points: "11 17 6 12 11 7" }), h("polyline", { key: '05e146e1c233c39403147e7af61948798db7c0f7', points: "18 17 13 12 18 7" })))), this.showMonthStepper && (h("button", { key: '6145f62f073563e9136ad454f4e9633e99b8d8a9', "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: '8ae9cc385a6fdbdd915a2717246752c7f2f17b01', 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: '9395192e65c1e550547220850b29a117569a79e2', points: "15 18 9 12 15 6" })))), h("span", { key: '3b282148e95b8b1facde4a2ab370c6088b72bccd', class: this.getClassName("current-month") }, h("select", { key: 'f782b9d803abd5eb1add6c869b3ac302a717780d', "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) => {
329
339
  return (h("option", { key: month, selected: this.currentDate.getMonth() === index, value: index + 1, disabled: monthIsDisabled(index, this.currentDate.getFullYear(), this.minDate, this.maxDate) }, month));
330
- })), h("input", { key: '547174f2f8fe0248589a40a46aace91171f08ad7', "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: '458fd7350775325c43895f9896b151f8d490a725', "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: '3b6c5f32830d6983e2e59e89f8986012533f1b0f', 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: 'b2dde5779945c6c7f6bd686b05874bc62f34c817', points: "9 18 15 12 9 6" })))), this.showYearStepper && (h("button", { key: '0f7ea0b890e11d42634c8751cca659caf788ca67', "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: 'a1f3037455d82547829d3f3afc15f6ea773277b4', 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: 'ee5bfeadf5b183cba36c15ce6a5c30654ff98fe2', points: "13 17 18 12 13 7" }), h("polyline", { key: '02966a045d9496e161bbd4a40e103990b0e146a9', points: "6 17 11 12 6 7" }))))), h("div", { key: 'e588f18d365e6e1f87e1da7033741cb22ebafed7', class: this.getClassName("body") }, h("table", { key: '7c6b926b3bc6b832b9fb1aabaac6841eb30cda30', class: this.getClassName("calendar"), onKeyDown: this.onKeyDown, role: "grid", "aria-label": this.getTitle() }, h("thead", { key: '4ebbefd8e10e5d83308e84eeafd85c29902275b1', class: this.getClassName("calendar-header") }, h("tr", { key: '101788f84e1f2a44a498813024944fe32a7c7388', 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: '4498ab21f627f5f8582db15d5babfc4e84c20b38' }, this.getCalendarRows().map((calendarRow) => {
340
+ })), h("input", { key: 'dcd8a96a130513d1cf34d900d6f8c09ce974ba15', "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: '7de261689d242a0116e85f3c5fda265f49eaaf13', "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: '2033c731d98fd53088857a92bdd35e5e977137d7', 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: 'dc88e8e5e4f79d5ae0b62ea51f6ba52d5e26ce9f', points: "9 18 15 12 9 6" })))), this.showYearStepper && (h("button", { key: 'e25bcd81e34e0e162954b2ab67876c148f50f5d4', "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: '70df81cfd06bcb1e6571933b7a43a5071522159b', 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: 'f8242866ca29743b19055d1ac53fcc8e84d68a35', points: "13 17 18 12 13 7" }), h("polyline", { key: '6bda80ff2eba82dac0d36e287976130e6b16113c', points: "6 17 11 12 6 7" }))))), h("div", { key: '6d5b0085437827c1db975f12dc5fe5927c7ba62f', class: this.getClassName("body") }, h("table", { key: '61975eac4e06c3a416fcb9503eef9c7a386a6b54', class: this.getClassName("calendar"), onKeyDown: this.onKeyDown, role: "grid", "aria-label": this.getTitle() }, h("thead", { key: 'fd259bd5ba6e12ff39dad5a31133913d17fdf276', class: this.getClassName("calendar-header") }, h("tr", { key: '410c84eabac58cf6139dd6c886b4803772abceb5', 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: '330d3b922d474b42edf0764556d2f2643b5b639d' }, this.getCalendarRows().map((calendarRow) => {
331
341
  const rowKey = `row-${calendarRow[0].getMonth()}-${calendarRow[0].getDate()}`;
332
342
  return (h("tr", { class: this.getClassName("calendar-row"), key: rowKey }, calendarRow.map((day) => {
333
343
  var _a, _b, _c;
@@ -394,8 +404,8 @@ export class TabworthyDatesCalendar {
394
404
  ? 0
395
405
  : -1 }, h(Tag, { "aria-hidden": "true" }, day.getDate()), h("span", { class: "visually-hidden" }, getScreenReaderText())));
396
406
  })));
397
- })))), showFooter && (h("div", { key: '48fde61cd9cdf8900bf8e15d408f3ad11cba9d9d', class: this.getClassName("footer") }, h("div", { key: 'a0b3e3b48f1f530648dff20598a0665ded2fbbe1', class: this.getClassName("footer-buttons") }, this.showTodayButton && (h("button", { key: '06a03df2fe08b9c76d393fdfe48e279c58acf613', class: this.getClassName("today-button"), disabled: this.disabled, innerHTML: this.todayButtonContent || undefined, onClick: this.showToday, type: "button" }, this.labels.todayButton)), this.showClearButton && (h("button", { key: 'e8bc81d95650edbf8c3b4d4e217d155c8a6f88b2', class: this.getClassName("clear-button"), disabled: this.disabled, innerHTML: this.clearButtonContent || undefined, onClick: this.clear, type: "button" }, this.labels.clearButton)), this.showCloseButton && (h("button", { key: '4ca7b4c414ca22092bee6fffb51179bbc1d66ee6', class: this.getClassName("close-button"), disabled: this.disabled, innerHTML: this.closeButtonContent || undefined, onClick: this.close, type: "button" }, this.labels.closeButton))), this.showKeyboardHint &&
398
- !window.matchMedia("(pointer: coarse)").matches && (h("button", { key: 'd34f89d3fb25286752bc4aa71893d0277dde3d17', type: "button", onClick: () => alert("Todo: Add Keyboard helper!"), class: this.getClassName("keyboard-hint") }, h("svg", { key: '5cf389d28d296804a5b5adfea6a0084290d125dd', xmlns: "http://www.w3.org/2000/svg", height: "1em", width: "1em", viewBox: "0 0 48 48", fill: "currentColor" }, h("path", { key: 'b84709ea4f714b979ff76078ee71556dc8671b04', 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: '1a37c10a1e2e367b1ee42756c85894d7ff5325f5', name: "after-calendar" }))));
407
+ })))), showFooter && (h("div", { key: '88362c2e1731e8813ad9c5da3b34f6afe16f2036', class: this.getClassName("footer") }, h("div", { key: 'e93a0b8fff1be09855ab87db159cb186b9339a39', class: this.getClassName("footer-buttons") }, this.showTodayButton && (h("button", { key: 'a5b88ad46182dc5367987bd78cb02e98cd63aaef', class: this.getClassName("today-button"), disabled: this.disabled, innerHTML: this.todayButtonContent || undefined, onClick: this.showToday, type: "button" }, this.labels.todayButton)), this.showClearButton && (h("button", { key: '3929f2d213399b656057010ccdbead8020b04c2d', class: this.getClassName("clear-button"), disabled: this.disabled, innerHTML: this.clearButtonContent || undefined, onClick: this.clear, type: "button" }, this.labels.clearButton)), this.showCloseButton && (h("button", { key: '800308eb41769813d9191bec7537385255039a80', class: this.getClassName("close-button"), disabled: this.disabled, innerHTML: this.closeButtonContent || undefined, onClick: this.close, type: "button" }, this.labels.closeButton))), this.showKeyboardHint &&
408
+ !window.matchMedia("(pointer: coarse)").matches && (h("button", { key: '0b478f25499d1aec350b35bb9777c6ec03d7fea3', type: "button", onClick: () => alert("Todo: Add Keyboard helper!"), class: this.getClassName("keyboard-hint") }, h("svg", { key: '14840cb62c1a222a347e40f6d1ab043842377a49', xmlns: "http://www.w3.org/2000/svg", height: "1em", width: "1em", viewBox: "0 0 48 48", fill: "currentColor" }, h("path", { key: 'd73008de603c67c20e335845ce42d6eff3cf2fc6', 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: '4616ab014b3db34b2d42958aefdbc7795829bbba', name: "after-calendar" }))));
399
409
  }
400
410
  static get is() { return "tabworthy-dates-calendar"; }
401
411
  static get encapsulation() { return "scoped"; }
@@ -16,7 +16,6 @@ const defaultLabels = {
16
16
  disabledDateError: `Please choose an available date`,
17
17
  to: "to",
18
18
  startDate: "Start date",
19
- yearSelect: "Select year",
20
19
  timeLabel: "Time"
21
20
  };
22
21
  export class TabworthyTimes {
@@ -272,10 +271,10 @@ export class TabworthyTimes {
272
271
  }
273
272
  render() {
274
273
  var _a;
275
- return (h(Host, { key: '87a26428aa34838553ab9d888d59bdd662912d4d', class: this.elementClassName, "has-error": this.errorState, disabled: this.disabledState }, h("label", { key: '5e9168376f6f770edc72718843e3d393e3a8c8df', htmlFor: `${this.id}-input`, class: this.getClassName("label") }, this.label), h("div", { key: 'ca9b0ce61d685fea6a547043e3e345958d893473', class: this.getClassName("input-container"), ref: (r) => (this.inputContainerRef = r) }, h("input", { key: '35a57d49bd8660abf1aef8f496df0df0fc357712', id: `${this.id}-input`, ref: (r) => (this.inputRef = r), type: "text", class: {
274
+ return (h(Host, { key: '671702979dddb6a19cfa78a95df28a958af56df9', class: this.elementClassName, "has-error": this.errorState, disabled: this.disabledState }, h("label", { key: '7b23263f899b3a59d43f3f2922e9c98a0bc62524', htmlFor: `${this.id}-input`, class: this.getClassName("label") }, this.label), h("div", { key: '453d585bee8dd0262aadec8ba816cd22c51cffea', class: this.getClassName("input-container"), ref: (r) => (this.inputContainerRef = r) }, h("input", { key: 'd2ec7de2b31f3c1a6b9acb4f57341530cb8431dc', id: `${this.id}-input`, ref: (r) => (this.inputRef = r), type: "text", class: {
276
275
  [this.getClassName("input")]: true,
277
276
  [this.inputClass]: !!this.inputClass
278
- }, placeholder: this.placeholder, disabled: this.disabledState || this.disableFreeformInput, value: (_a = this.internalValue) === null || _a === void 0 ? void 0 : _a.toString(), onBlur: this.handleInputBlur, onChange: this.handleInputChange, "aria-describedby": this.errorState ? `${this.id}-error` : undefined, "aria-invalid": this.errorState }), !this.inline && (h("button", { key: '3144ec32c0866b120c27963a253fff87f8a73285', type: "button", onClick: this.handleCalendarButtonClick, class: this.getClassName("calendar-button"), disabled: this.disabledState }, this.calendarButtonContent ? (h("span", { innerHTML: this.calendarButtonContent })) : (this.timesLabels.openCalendar)))), h("tabworthy-dates-modal", { key: '6a5e765432ebe1eda8a02333d699033ec9f392ea', label: this.timesLabels.calendar, ref: (el) => (this.modalRef = el), onOpened: () => {
277
+ }, placeholder: this.placeholder, disabled: this.disabledState || this.disableFreeformInput, value: (_a = this.internalValue) === null || _a === void 0 ? void 0 : _a.toString(), onBlur: this.handleInputBlur, onChange: this.handleInputChange, "aria-describedby": this.errorState ? `${this.id}-error` : undefined, "aria-invalid": this.errorState }), !this.inline && (h("button", { key: '77b42f53ad8a5e0d5d70ea41f999f95d61942a83', type: "button", onClick: this.handleCalendarButtonClick, class: this.getClassName("calendar-button"), disabled: this.disabledState }, this.calendarButtonContent ? (h("span", { innerHTML: this.calendarButtonContent })) : (this.timesLabels.openCalendar)))), h("tabworthy-dates-modal", { key: '3633f9e7839b8947da48f83ac3808156bea8515d', label: this.timesLabels.calendar, ref: (el) => (this.modalRef = el), onOpened: () => {
279
278
  if (this.pickerRef) {
280
279
  this.pickerRef.modalIsOpen = true;
281
280
  }
@@ -283,7 +282,7 @@ export class TabworthyTimes {
283
282
  if (this.pickerRef) {
284
283
  this.pickerRef.modalIsOpen = false;
285
284
  }
286
- }, inline: this.inline, appendTo: this.appendTo }, h("div", { key: 'ed1f2484ba3c2541009e86d1e0500e76561007fa', class: this.getClassName("picker-container") }, h("tabworthy-dates-calendar", { key: 'db96a7d4e2844c8825f5f774616b449164de3273', range: this.range, locale: this.locale, onSelectDate: (event) => this.handlePickerSelection(event.detail), onChangeMonth: (event) => this.handleChangedMonths(event.detail), onChangeYear: (event) => this.handleYearChange(event.detail), onRequestClose: () => { var _a; return (_a = this.modalRef) === null || _a === void 0 ? void 0 : _a.close(); }, labels: this.datesCalendarLabels, ref: (el) => (this.pickerRef = el), startDate: this.startDate, firstDayOfWeek: this.firstDayOfWeek, showHiddenTitle: true, disabled: this.disabledState, showMonthStepper: this.showMonthStepper, showYearStepper: this.showYearStepper, showClearButton: this.showClearButton, showCloseButton: this.showCloseButton, showTodayButton: this.showTodayButton, disableDate: this.disableDate, minDate: this.minDate, maxDate: this.maxDate, inline: this.inline, value: this.value ? this.toDate(this.value) : undefined }, h("div", { key: '146f445a91fae0d132cbf90ee5a23c457773857a', slot: "after-calendar", class: this.getClassName("time-section") }, h("hr", { key: 'e55e8dddbddca29d720d343d7ee8fa8fac80f2f4', class: this.getClassName("divider") }), h("tabworthy-times-picker", { key: '23857ca0f4874d5b2c0da426d8063072e1eee4a8', hours: this.selectedHours, minutes: this.selectedMinutes, seconds: this.selectedSeconds, showSeconds: this.showSeconds, useTwelveHourFormat: this.useTwelveHourFormat, disabled: this.disabledState, onTimeChanged: this.handleTimeChange, labels: this.timesPickerLabels }))))), this.errorState && (h("div", { key: '93cd7dcd8101e0bf9f5f4f81dd1dc8cb19997fd5', class: this.getClassName("input-error"), id: this.id ? `${this.id}-error` : undefined, role: "status" }, this.errorMessage))));
285
+ }, inline: this.inline, appendTo: this.appendTo }, h("div", { key: '706e2fdcd7e4ecf77f5ee63f4c5ced7951593735', class: this.getClassName("picker-container") }, h("tabworthy-dates-calendar", { key: 'cb027f3fe4d2bf73abea9ec6511fe11305e28aba', range: this.range, locale: this.locale, onSelectDate: (event) => this.handlePickerSelection(event.detail), onChangeMonth: (event) => this.handleChangedMonths(event.detail), onChangeYear: (event) => this.handleYearChange(event.detail), onRequestClose: () => { var _a; return (_a = this.modalRef) === null || _a === void 0 ? void 0 : _a.close(); }, labels: this.datesCalendarLabels, ref: (el) => (this.pickerRef = el), startDate: this.startDate, firstDayOfWeek: this.firstDayOfWeek, showHiddenTitle: true, disabled: this.disabledState, showMonthStepper: this.showMonthStepper, showYearStepper: this.showYearStepper, showClearButton: this.showClearButton, showCloseButton: this.showCloseButton, showTodayButton: this.showTodayButton, disableDate: this.disableDate, minDate: this.minDate, maxDate: this.maxDate, inline: this.inline, value: this.value ? this.toDate(this.value) : undefined }, h("div", { key: '2287a25cdec6fc40c36833c250536f99cabe5cbf', slot: "after-calendar", class: this.getClassName("time-section") }, h("hr", { key: '540cfd69b4ca3618ecd22f9d1ed3d240ed8eeee9', class: this.getClassName("divider") }), h("tabworthy-times-picker", { key: '79e8c05c3ba4af1ef46a78c6d6fcb211dec7abd5', hours: this.selectedHours, minutes: this.selectedMinutes, seconds: this.selectedSeconds, showSeconds: this.showSeconds, useTwelveHourFormat: this.useTwelveHourFormat, disabled: this.disabledState, onTimeChanged: this.handleTimeChange, labels: this.timesPickerLabels }))))), this.errorState && (h("div", { key: '4a568e01f57652308adb7a8c115ab6649fc591fc', class: this.getClassName("input-error"), id: this.id ? `${this.id}-error` : undefined, role: "status" }, this.errorMessage))));
287
286
  }
288
287
  static get is() { return "tabworthy-times"; }
289
288
  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 m(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,e){const i=new Date(t);return i.setDate(i.getDate()-e),i}function D(t,e){if(e){const i=k(new Date(e));return t>=i||p(i,t)}return!0}function g(t,e){if(e){const i=k(new Date(e));return t<=i||p(t,i)}return!0}function C(t,e,i){return D(t,e)&&g(t,i)}function B(t,e,i,s){const a=new Date(e,t,1);a.setDate(a.getDate()-1);const n=new Date(e,t+1,0);return n.setDate(a.getDate()+1),!C(a,i,s)&&!C(n,i,s)}function $(t){if(null==t.match(/^\d{4}-\d{2}-\d{2}$/))return!1;var e=new Date(t);return!isNaN(e.getTime())}function x(t){var e=t.match(/\d{4}-\d{2}-\d{2}/g);return null==e?void 0:e.slice(0,2)}const S={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"},M=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=S,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=()=>{this.updateCurrentDate(u(this.currentDate))},this.nextYear=()=>{this.updateCurrentDate(b(this.currentDate),!1,!0)},this.previousMonth=()=>{this.updateCurrentDate(v(this.currentDate))},this.previousYear=()=>{this.updateCurrentDate(y(this.currentDate),!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);C(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);C(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(m(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=new Date(this.minDate)),g(t,this.maxDate)||(t=new Date(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)&&C(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&&new Date(this.minDate).getFullYear()>y(this.currentDate).getFullYear(),next:this.disabled||!!this.maxDate&&new Date(this.maxDate).getFullYear()<b(this.currentDate).getFullYear()},month:{prev:this.disabled||B(v(this.currentDate).getMonth(),v(this.currentDate).getFullYear(),this.minDate,this.maxDate),next:this.disabled||B(u(this.currentDate).getMonth(),u(this.currentDate).getFullYear(),this.minDate,this.maxDate)}};return s(a,{key:"1bda8d7a489d87cf27ecbcd978accf5363f32804"},s("div",{key:"7118660fbbdfac4a73a1ace99d96d4ac32a4b137",class:{[`${this.getClassName()}-wrapper`]:!0,[`${this.getClassName()}-wrapper--inline`]:this.inline}},s("div",{key:"41b62826cdff428aef8ad89844a50873f8853b5e",class:{[this.getClassName()]:!0,[`${this.getClassName()}--disabled`]:this.disabled}},s("div",{key:"7a9ee67778c6f48e65d88defc1ff620e995d75bc",class:this.getClassName("header")},this.showHiddenTitle&&s("span",{key:"404e50ab0f24235d6678af7c12f6b3cdd491e347","aria-atomic":"true","aria-live":"polite",class:"visually-hidden"},this.getTitle()),this.showYearStepper&&s("button",{key:"88552edc01ae9c4a7d8225c2aab078d2123bf9f6","aria-label":this.labels.previousYearButton,class:this.getClassName("previous-year-button"),"aria-disabled":i.year.prev,innerHTML:this.previousYearButtonContent||void 0,onClick:this.previousYear,type:"button"},s("svg",{key:"5daef016748f562ddf3866557774c87016887fc6",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:"5b73b6ec2b5abcae4d2e5cd833b5de441938e533",points:"11 17 6 12 11 7"}),s("polyline",{key:"05e146e1c233c39403147e7af61948798db7c0f7",points:"18 17 13 12 18 7"}))),this.showMonthStepper&&s("button",{key:"6145f62f073563e9136ad454f4e9633e99b8d8a9","aria-label":this.labels.previousMonthButton,class:this.getClassName("previous-month-button"),"aria-disabled":i.month.prev,innerHTML:this.previousMonthButtonContent||void 0,onClick:this.previousMonth,type:"button"},s("svg",{key:"8ae9cc385a6fdbdd915a2717246752c7f2f17b01",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:"9395192e65c1e550547220850b29a117569a79e2",points:"15 18 9 12 15 6"}))),s("span",{key:"3b282148e95b8b1facde4a2ab370c6088b72bccd",class:this.getClassName("current-month")},s("select",{key:"f782b9d803abd5eb1add6c869b3ac302a717780d","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:B(e,this.currentDate.getFullYear(),this.minDate,this.maxDate)},t)))),s("input",{key:"dcd8a96a130513d1cf34d900d6f8c09ce974ba15","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:"7de261689d242a0116e85f3c5fda265f49eaaf13","aria-label":this.labels.nextMonthButton,class:this.getClassName("next-month-button"),"aria-disabled":i.month.next,innerHTML:this.nextMonthButtonContent||void 0,onClick:this.nextMonth,type:"button"},s("svg",{key:"2033c731d98fd53088857a92bdd35e5e977137d7",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:"dc88e8e5e4f79d5ae0b62ea51f6ba52d5e26ce9f",points:"9 18 15 12 9 6"}))),this.showYearStepper&&s("button",{key:"e25bcd81e34e0e162954b2ab67876c148f50f5d4","aria-label":this.labels.nextYearButton,class:this.getClassName("next-year-button"),"aria-disabled":i.year.next,innerHTML:this.nextYearButtonContent||void 0,onClick:this.nextYear,type:"button"},s("svg",{key:"70df81cfd06bcb1e6571933b7a43a5071522159b",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:"f8242866ca29743b19055d1ac53fcc8e84d68a35",points:"13 17 18 12 13 7"}),s("polyline",{key:"6bda80ff2eba82dac0d36e287976130e6b16113c",points:"6 17 11 12 6 7"})))),s("div",{key:"6d5b0085437827c1db975f12dc5fe5927c7ba62f",class:this.getClassName("body")},s("table",{key:"61975eac4e06c3a416fcb9503eef9c7a386a6b54",class:this.getClassName("calendar"),onKeyDown:this.onKeyDown,role:"grid","aria-label":this.getTitle()},s("thead",{key:"fd259bd5ba6e12ff39dad5a31133913d17fdf276",class:this.getClassName("calendar-header")},s("tr",{key:"410c84eabac58cf6139dd6c886b4803772abceb5",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:"330d3b922d474b42edf0764556d2f2643b5b639d"},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]&&C(t,r(this.value[0]),r(this.value[1])):p(t,this.value),d=this.disableDate(t)||!C(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:"88362c2e1731e8813ad9c5da3b34f6afe16f2036",class:this.getClassName("footer")},s("div",{key:"e93a0b8fff1be09855ab87db159cb186b9339a39",class:this.getClassName("footer-buttons")},this.showTodayButton&&s("button",{key:"a5b88ad46182dc5367987bd78cb02e98cd63aaef",class:this.getClassName("today-button"),disabled:this.disabled,innerHTML:this.todayButtonContent||void 0,onClick:this.showToday,type:"button"},this.labels.todayButton),this.showClearButton&&s("button",{key:"3929f2d213399b656057010ccdbead8020b04c2d",class:this.getClassName("clear-button"),disabled:this.disabled,innerHTML:this.clearButtonContent||void 0,onClick:this.clear,type:"button"},this.labels.clearButton),this.showCloseButton&&s("button",{key:"800308eb41769813d9191bec7537385255039a80",class:this.getClassName("close-button"),disabled:this.disabled,innerHTML:this.closeButtonContent||void 0,onClick:this.close,type:"button"},this.labels.closeButton)),this.showKeyboardHint&&!window.matchMedia("(pointer: coarse)").matches&&s("button",{key:"0b478f25499d1aec350b35bb9777c6ec03d7fea3",type:"button",onClick:()=>alert("Todo: Add Keyboard helper!"),class:this.getClassName("keyboard-hint")},s("svg",{key:"14840cb62c1a222a347e40f6d1ab043842377a49",xmlns:"http://www.w3.org/2000/svg",height:"1em",width:"1em",viewBox:"0 0 48 48",fill:"currentColor"},s("path",{key:"d73008de603c67c20e335845ce42d6eff3cf2fc6",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:"4616ab014b3db34b2d42958aefdbc7795829bbba",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 Z(){"undefined"!=typeof customElements&&["tabworthy-dates-calendar"].forEach((t=>{"tabworthy-dates-calendar"===t&&(customElements.get(n(t))||customElements.define(n(t),M))}))}export{M as T,D as a,g as b,Z as c,C as d,x as e,r as g,$ as i,k as r}
@@ -1 +1 @@
1
- import{T as o,c as s}from"./p-M03P4DAz.js";const p=o,r=s;export{p as TabworthyDatesCalendar,r as defineCustomElement}
1
+ import{T as o,c as s}from"./p-CkD8Cvl_.js";const p=o,r=s;export{p as TabworthyDatesCalendar,r as defineCustomElement}