@tabworthy/components 0.12.4 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/tabworthy-components.cjs.js +1 -1
- package/dist/cjs/tabworthy-dates-calendar_2.cjs.entry.js +35 -17
- package/dist/cjs/tabworthy-dates.cjs.entry.js +58 -10
- package/dist/cjs/tabworthy-times-picker.cjs.entry.js +82 -10
- package/dist/cjs/tabworthy-times.cjs.entry.js +147 -6
- package/dist/cjs/{utils-y5Vtky2t.js → utils-DGbdK8VF.js} +29 -8
- package/dist/collection/components/tabworthy-dates/tabworthy-dates.js +78 -10
- package/dist/collection/components/tabworthy-dates-calendar/tabworthy-dates-calendar.js +35 -17
- package/dist/collection/components/tabworthy-times/tabworthy-times.js +167 -5
- package/dist/collection/components/tabworthy-times-picker/tabworthy-times-picker.js +128 -10
- package/dist/components/p-BzY8iIVW.js +1 -0
- package/dist/components/p-C_uZGgcG.js +1 -0
- package/dist/components/tabworthy-dates-calendar.js +1 -1
- package/dist/components/tabworthy-dates.js +1 -1
- package/dist/components/tabworthy-times-picker.js +1 -1
- package/dist/components/tabworthy-times.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/tabworthy-components.js +1 -1
- package/dist/esm/tabworthy-dates-calendar_2.entry.js +35 -17
- package/dist/esm/tabworthy-dates.entry.js +58 -10
- package/dist/esm/tabworthy-times-picker.entry.js +82 -10
- package/dist/esm/tabworthy-times.entry.js +147 -6
- package/dist/esm/{utils-BVHu5CWV.js → utils-CoFOnMSw.js} +29 -9
- package/dist/shared/utils/utils.js +28 -8
- package/dist/tabworthy-components/p-4eedf24e.entry.js +1 -0
- package/dist/tabworthy-components/p-69334c34.entry.js +1 -0
- package/dist/tabworthy-components/p-7cd6ccc1.entry.js +1 -0
- package/dist/tabworthy-components/{p-BVHu5CWV.js → p-CoFOnMSw.js} +1 -1
- package/dist/tabworthy-components/p-b6a5d970.entry.js +1 -0
- package/dist/tabworthy-components/tabworthy-components.esm.js +1 -1
- package/dist/themes/light.css +1 -1
- package/dist/types/components/tabworthy-dates/tabworthy-dates.d.ts +7 -0
- package/dist/types/components/tabworthy-times/tabworthy-times.d.ts +13 -1
- package/dist/types/components/tabworthy-times-picker/tabworthy-times-picker.d.ts +15 -0
- package/dist/types/components.d.ts +14 -4
- package/dist/types/home/runner/work/tabworthy-components/tabworthy-components/.stencil/shared/utils/utils.d.ts +6 -0
- package/package.json +1 -1
- package/dist/components/p-BTQaxOHo.js +0 -1
- package/dist/components/p-DAc3jaFB.js +0 -1
- package/dist/tabworthy-components/p-1743bf7a.entry.js +0 -1
- package/dist/tabworthy-components/p-28192b55.entry.js +0 -1
- package/dist/tabworthy-components/p-3b548ae1.entry.js +0 -1
- package/dist/tabworthy-components/p-626a5c0b.entry.js +0 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var index = require('./index-B1s0tI-Z.js');
|
|
4
4
|
var customParseFormat = require('./customParseFormat-l09KVyWD.js');
|
|
5
|
-
var utils = require('./utils-
|
|
5
|
+
var utils = require('./utils-DGbdK8VF.js');
|
|
6
6
|
|
|
7
7
|
var localizedFormat$2 = {exports: {}};
|
|
8
8
|
|
|
@@ -42,6 +42,7 @@ const TabworthyTimes = class {
|
|
|
42
42
|
index.registerInstance(this, hostRef);
|
|
43
43
|
this.selectDateTime = index.createEvent(this, "selectDateTime", 7);
|
|
44
44
|
this.changeYear = index.createEvent(this, "changeYear", 7);
|
|
45
|
+
this.errorChange = index.createEvent(this, "errorChange", 7);
|
|
45
46
|
this.componentReady = index.createEvent(this, "componentReady", 7);
|
|
46
47
|
// Enable or disable range mode
|
|
47
48
|
this.range = false;
|
|
@@ -103,6 +104,8 @@ const TabworthyTimes = class {
|
|
|
103
104
|
if (this.range && dates.length === 2) {
|
|
104
105
|
const startDate = utils.removeTimezoneOffset(new Date(dates[0]));
|
|
105
106
|
const endDate = utils.removeTimezoneOffset(new Date(dates[1]));
|
|
107
|
+
if (!this.isDateValid(startDate) || !this.isDateValid(endDate))
|
|
108
|
+
return;
|
|
106
109
|
this.updateValue([startDate, endDate]);
|
|
107
110
|
// Update calendar with selected dates
|
|
108
111
|
if (this.pickerRef) {
|
|
@@ -111,9 +114,14 @@ const TabworthyTimes = class {
|
|
|
111
114
|
}
|
|
112
115
|
else {
|
|
113
116
|
const date = utils.removeTimezoneOffset(new Date(dates[0]));
|
|
117
|
+
if (!this.isDateValid(date))
|
|
118
|
+
return;
|
|
119
|
+
// Clamp time to boundary constraints when selecting a boundary day
|
|
120
|
+
this.clampTimeToBounds(date);
|
|
114
121
|
this.updateValue(date);
|
|
115
|
-
//
|
|
122
|
+
// Reset then set calendar value so re-clicking the same date still emits
|
|
116
123
|
if (this.pickerRef) {
|
|
124
|
+
this.pickerRef.value = undefined;
|
|
117
125
|
this.pickerRef.value = date;
|
|
118
126
|
}
|
|
119
127
|
}
|
|
@@ -169,6 +177,25 @@ const TabworthyTimes = class {
|
|
|
169
177
|
parsed = customParseFormat.dayjs(value);
|
|
170
178
|
}
|
|
171
179
|
if (parsed.isValid()) {
|
|
180
|
+
// Check minDate/maxDate bounds (supports both date-only and datetime strings)
|
|
181
|
+
if (this.minDate && parsed.isBefore(customParseFormat.dayjs(this.minDate))) {
|
|
182
|
+
this.errorState = true;
|
|
183
|
+
this.errorMessage = `${this.timesLabels.minDateError} ${this.formatBoundaryDate(this.minDate)}`;
|
|
184
|
+
this.emitErrorChange("minDate", this.errorMessage);
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
if (this.maxDate && parsed.isAfter(customParseFormat.dayjs(this.maxDate))) {
|
|
188
|
+
this.errorState = true;
|
|
189
|
+
this.errorMessage = `${this.timesLabels.maxDateError} ${this.formatBoundaryDate(this.maxDate)}`;
|
|
190
|
+
this.emitErrorChange("maxDate", this.errorMessage);
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
if (this.disableDate(parsed.toDate())) {
|
|
194
|
+
this.errorState = true;
|
|
195
|
+
this.errorMessage = this.timesLabels.disabledDateError;
|
|
196
|
+
this.emitErrorChange("disabledDate", this.errorMessage);
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
172
199
|
this.errorState = false;
|
|
173
200
|
this.selectedHours = parsed.hour();
|
|
174
201
|
this.selectedMinutes = parsed.minute();
|
|
@@ -179,9 +206,99 @@ const TabworthyTimes = class {
|
|
|
179
206
|
// Set error state for invalid/garbage input
|
|
180
207
|
this.errorState = true;
|
|
181
208
|
this.errorMessage = this.timesLabels.invalidDateError;
|
|
209
|
+
this.emitErrorChange("invalid", this.errorMessage);
|
|
182
210
|
}
|
|
183
211
|
};
|
|
184
212
|
}
|
|
213
|
+
emitErrorChange(reason, message) {
|
|
214
|
+
this.errorChange.emit({ reason, message });
|
|
215
|
+
}
|
|
216
|
+
formatBoundaryDate(dateString) {
|
|
217
|
+
const parsed = customParseFormat.dayjs(dateString);
|
|
218
|
+
if (!parsed.isValid())
|
|
219
|
+
return dateString;
|
|
220
|
+
const hasTime = dateString.includes("T") || dateString.includes(" ");
|
|
221
|
+
if (!hasTime) {
|
|
222
|
+
return Intl.DateTimeFormat(this.locale, {
|
|
223
|
+
day: "numeric",
|
|
224
|
+
month: "short",
|
|
225
|
+
year: "numeric"
|
|
226
|
+
}).format(parsed.toDate());
|
|
227
|
+
}
|
|
228
|
+
const options = Object.assign({ day: "numeric", month: "short", year: "numeric", hour: "numeric", minute: "numeric" }, (this.showSeconds ? { second: "numeric" } : {}));
|
|
229
|
+
return Intl.DateTimeFormat(this.locale, options).format(parsed.toDate());
|
|
230
|
+
}
|
|
231
|
+
getEffectiveMinTime() {
|
|
232
|
+
if (!this.minDate || !this.selectedDate)
|
|
233
|
+
return undefined;
|
|
234
|
+
const min = customParseFormat.dayjs(this.minDate);
|
|
235
|
+
const sel = customParseFormat.dayjs(this.selectedDate);
|
|
236
|
+
if (!min.isValid() || !sel.isSame(min, "day"))
|
|
237
|
+
return undefined;
|
|
238
|
+
return {
|
|
239
|
+
hours: min.hour(),
|
|
240
|
+
minutes: min.minute(),
|
|
241
|
+
seconds: min.second()
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
getEffectiveMaxTime() {
|
|
245
|
+
if (!this.maxDate || !this.selectedDate)
|
|
246
|
+
return undefined;
|
|
247
|
+
const max = customParseFormat.dayjs(this.maxDate);
|
|
248
|
+
const sel = customParseFormat.dayjs(this.selectedDate);
|
|
249
|
+
if (!max.isValid() || !sel.isSame(max, "day"))
|
|
250
|
+
return undefined;
|
|
251
|
+
return {
|
|
252
|
+
hours: max.hour(),
|
|
253
|
+
minutes: max.minute(),
|
|
254
|
+
seconds: max.second()
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
isDateOutOfBounds() {
|
|
258
|
+
if (!this.selectedDate)
|
|
259
|
+
return false;
|
|
260
|
+
const sel = customParseFormat.dayjs(this.selectedDate);
|
|
261
|
+
if (this.minDate && sel.isBefore(customParseFormat.dayjs(this.minDate), "day"))
|
|
262
|
+
return true;
|
|
263
|
+
if (this.maxDate && sel.isAfter(customParseFormat.dayjs(this.maxDate), "day"))
|
|
264
|
+
return true;
|
|
265
|
+
return false;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* When selecting a date on a boundary day, adjust the time to the first
|
|
269
|
+
* available time if the current selection falls outside the allowed range.
|
|
270
|
+
*/
|
|
271
|
+
clampTimeToBounds(date) {
|
|
272
|
+
const sel = customParseFormat.dayjs(date);
|
|
273
|
+
if (this.minDate) {
|
|
274
|
+
const min = customParseFormat.dayjs(this.minDate);
|
|
275
|
+
if (min.isValid() && sel.isSame(min, "day")) {
|
|
276
|
+
const curTotal = this.selectedHours * 3600 +
|
|
277
|
+
this.selectedMinutes * 60 +
|
|
278
|
+
this.selectedSeconds;
|
|
279
|
+
const minTotal = min.hour() * 3600 + min.minute() * 60 + min.second();
|
|
280
|
+
if (curTotal < minTotal) {
|
|
281
|
+
this.selectedHours = min.hour();
|
|
282
|
+
this.selectedMinutes = min.minute();
|
|
283
|
+
this.selectedSeconds = min.second();
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
if (this.maxDate) {
|
|
288
|
+
const max = customParseFormat.dayjs(this.maxDate);
|
|
289
|
+
if (max.isValid() && sel.isSame(max, "day")) {
|
|
290
|
+
const curTotal = this.selectedHours * 3600 +
|
|
291
|
+
this.selectedMinutes * 60 +
|
|
292
|
+
this.selectedSeconds;
|
|
293
|
+
const maxTotal = max.hour() * 3600 + max.minute() * 60 + max.second();
|
|
294
|
+
if (curTotal > maxTotal) {
|
|
295
|
+
this.selectedHours = max.hour();
|
|
296
|
+
this.selectedMinutes = max.minute();
|
|
297
|
+
this.selectedSeconds = max.second();
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
185
302
|
shouldInputFormat() {
|
|
186
303
|
if (typeof this.inputShouldFormat === "string") {
|
|
187
304
|
return this.inputShouldFormat === "true";
|
|
@@ -254,6 +371,30 @@ const TabworthyTimes = class {
|
|
|
254
371
|
this.formatInput();
|
|
255
372
|
}
|
|
256
373
|
}
|
|
374
|
+
isDateValid(date) {
|
|
375
|
+
const parsed = customParseFormat.dayjs(date);
|
|
376
|
+
if (!parsed.isValid())
|
|
377
|
+
return false;
|
|
378
|
+
if (this.minDate && parsed.isBefore(customParseFormat.dayjs(this.minDate), "day")) {
|
|
379
|
+
this.errorState = true;
|
|
380
|
+
this.errorMessage = `${this.timesLabels.minDateError} ${this.formatBoundaryDate(this.minDate)}`;
|
|
381
|
+
this.emitErrorChange("minDate", this.errorMessage);
|
|
382
|
+
return false;
|
|
383
|
+
}
|
|
384
|
+
if (this.maxDate && parsed.isAfter(customParseFormat.dayjs(this.maxDate), "day")) {
|
|
385
|
+
this.errorState = true;
|
|
386
|
+
this.errorMessage = `${this.timesLabels.maxDateError} ${this.formatBoundaryDate(this.maxDate)}`;
|
|
387
|
+
this.emitErrorChange("maxDate", this.errorMessage);
|
|
388
|
+
return false;
|
|
389
|
+
}
|
|
390
|
+
if (this.disableDate(date)) {
|
|
391
|
+
this.errorState = true;
|
|
392
|
+
this.errorMessage = this.timesLabels.disabledDateError;
|
|
393
|
+
this.emitErrorChange("disabledDate", this.errorMessage);
|
|
394
|
+
return false;
|
|
395
|
+
}
|
|
396
|
+
return true;
|
|
397
|
+
}
|
|
257
398
|
formatInput() {
|
|
258
399
|
if (!this.internalValue)
|
|
259
400
|
return;
|
|
@@ -294,12 +435,12 @@ const TabworthyTimes = class {
|
|
|
294
435
|
}
|
|
295
436
|
render() {
|
|
296
437
|
var _a;
|
|
297
|
-
return (index.h(index.Host, { key: '
|
|
438
|
+
return (index.h(index.Host, { key: '6c3049b02eda2e976f14616027cfb3fd1a0b0100', class: this.elementClassName, "has-error": this.errorState, disabled: this.disabledState }, index.h("label", { key: 'eb9ecc8c81d04338a5935ad414c6cd544a01bb58', htmlFor: `${this.id}-input`, class: this.getClassName("label") }, this.label), index.h("div", { key: '8906972aec0b8c7b24cc3f2d07212c3f6c2d8f56', class: this.getClassName("input-container"), ref: (r) => (this.inputContainerRef = r) }, index.h("input", { key: 'bca908ac7aa2710569fa86be5c7c6643d7f73574', id: `${this.id}-input`, ref: (r) => (this.inputRef = r), type: "text", class: {
|
|
298
439
|
[this.getClassName("input")]: true,
|
|
299
440
|
[this.inputClass]: !!this.inputClass
|
|
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: '
|
|
441
|
+
}, 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: 'c0d27ab5207fb62606e017bea14c93bc44daebb9', type: "button", onClick: this.handleCalendarButtonClick, class: this.getClassName("calendar-button"), disabled: this.disabledState, "aria-label": this.calendarButtonContent
|
|
301
442
|
? this.timesLabels.openCalendar
|
|
302
|
-
: undefined }, this.calendarButtonContent ? (index.h("span", { innerHTML: this.calendarButtonContent })) : (this.timesLabels.openCalendar)))), index.h("tabworthy-dates-modal", { key: '
|
|
443
|
+
: undefined }, this.calendarButtonContent ? (index.h("span", { innerHTML: this.calendarButtonContent })) : (this.timesLabels.openCalendar)))), index.h("tabworthy-dates-modal", { key: '1e6761504cd55a9fd380902861aeec0e7e655d47', label: this.timesLabels.calendar, ref: (el) => (this.modalRef = el), onOpened: () => {
|
|
303
444
|
if (this.pickerRef) {
|
|
304
445
|
this.pickerRef.modalIsOpen = true;
|
|
305
446
|
}
|
|
@@ -307,7 +448,7 @@ const TabworthyTimes = class {
|
|
|
307
448
|
if (this.pickerRef) {
|
|
308
449
|
this.pickerRef.modalIsOpen = false;
|
|
309
450
|
}
|
|
310
|
-
}, inline: this.inline, appendTo: this.appendTo }, index.h("div", { key: '
|
|
451
|
+
}, inline: this.inline, appendTo: this.appendTo }, index.h("div", { key: '14966bd22b73a14fcb54bf118543e6aedf6e291f', class: this.getClassName("picker-container") }, index.h("tabworthy-dates-calendar", { key: 'aef55f7ee2cb19eb68bf8db51dd3e111e4f0dbff', 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, nextMonthButtonContent: this.nextMonthButtonContent, nextYearButtonContent: this.nextYearButtonContent, previousMonthButtonContent: this.previousMonthButtonContent, previousYearButtonContent: this.previousYearButtonContent, todayButtonContent: this.todayButtonContent, clearButtonContent: this.clearButtonContent, closeButtonContent: this.closeButtonContent }, index.h("div", { key: 'f89b6d83e9ef68bd98eb6e08ea3aec00c2b6dd86', slot: "after-calendar", class: this.getClassName("time-section") }, index.h("hr", { key: '2ae84e5817c25641ab56ff096f164355524abfdf', class: this.getClassName("divider") }), index.h("tabworthy-times-picker", { key: '55bfe07297efd0c60d47d6049572f502311abf15', hours: this.selectedHours, minutes: this.selectedMinutes, seconds: this.selectedSeconds, showSeconds: this.showSeconds, useTwelveHourFormat: this.useTwelveHourFormat, disabled: this.disabledState || this.isDateOutOfBounds(), onTimeChanged: this.handleTimeChange, labels: this.timesPickerLabels, minTime: this.getEffectiveMinTime(), maxTime: this.getEffectiveMaxTime() }))))), this.errorState && (index.h("div", { key: '97dbda7bc8725c8964a627e37e9236e9bf699ee0', class: this.getClassName("input-error"), id: this.id ? `${this.id}-error` : undefined, role: "status" }, this.errorMessage))));
|
|
311
452
|
}
|
|
312
453
|
get el() { return index.getElement(this); }
|
|
313
454
|
static get watchers() { return {
|
|
@@ -138,6 +138,17 @@ function removeTimezoneOffset(date) {
|
|
|
138
138
|
newDate.setMinutes(newDate.getMinutes() + newDate.getTimezoneOffset());
|
|
139
139
|
return newDate;
|
|
140
140
|
}
|
|
141
|
+
/**
|
|
142
|
+
* Parse a date boundary string to a local Date.
|
|
143
|
+
* Date-only strings ("YYYY-MM-DD") are parsed as UTC by JS, so we apply removeTimezoneOffset.
|
|
144
|
+
* Datetime strings (containing "T" or space+time) are already parsed as local time.
|
|
145
|
+
*/
|
|
146
|
+
function parseDateString(dateString) {
|
|
147
|
+
const hasTime = dateString.includes("T") ||
|
|
148
|
+
/\d{4}-\d{2}-\d{2}\s\d{2}:/.test(dateString);
|
|
149
|
+
const parsed = new Date(dateString);
|
|
150
|
+
return hasTime ? parsed : removeTimezoneOffset(parsed);
|
|
151
|
+
}
|
|
141
152
|
function subDays(date, days) {
|
|
142
153
|
const newDate = new Date(date);
|
|
143
154
|
newDate.setDate(newDate.getDate() - days);
|
|
@@ -145,7 +156,7 @@ function subDays(date, days) {
|
|
|
145
156
|
}
|
|
146
157
|
function dateIsWithinLowerBounds(date, minDate) {
|
|
147
158
|
if (minDate) {
|
|
148
|
-
const min =
|
|
159
|
+
const min = parseDateString(minDate);
|
|
149
160
|
return date >= min || isSameDay(min, date);
|
|
150
161
|
}
|
|
151
162
|
else
|
|
@@ -153,7 +164,7 @@ function dateIsWithinLowerBounds(date, minDate) {
|
|
|
153
164
|
}
|
|
154
165
|
function dateIsWithinUpperBounds(date, maxDate) {
|
|
155
166
|
if (maxDate) {
|
|
156
|
-
const max =
|
|
167
|
+
const max = parseDateString(maxDate);
|
|
157
168
|
return date <= max || isSameDay(date, max);
|
|
158
169
|
}
|
|
159
170
|
else
|
|
@@ -164,12 +175,21 @@ function dateIsWithinBounds(date, minDate, maxDate) {
|
|
|
164
175
|
dateIsWithinUpperBounds(date, maxDate));
|
|
165
176
|
}
|
|
166
177
|
function monthIsDisabled(month, year, minDate, maxDate) {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
178
|
+
if (minDate) {
|
|
179
|
+
const min = parseDateString(minDate);
|
|
180
|
+
const minYear = min.getFullYear();
|
|
181
|
+
const minMonth = min.getMonth();
|
|
182
|
+
if (year < minYear || (year === minYear && month < minMonth))
|
|
183
|
+
return true;
|
|
184
|
+
}
|
|
185
|
+
if (maxDate) {
|
|
186
|
+
const max = parseDateString(maxDate);
|
|
187
|
+
const maxYear = max.getFullYear();
|
|
188
|
+
const maxMonth = max.getMonth();
|
|
189
|
+
if (year > maxYear || (year === maxYear && month > maxMonth))
|
|
190
|
+
return true;
|
|
191
|
+
}
|
|
192
|
+
return false;
|
|
173
193
|
}
|
|
174
194
|
function isValidISODate(dateString) {
|
|
175
195
|
var isoFormat = /^\d{4}-\d{2}-\d{2}$/;
|
|
@@ -210,5 +230,6 @@ exports.isDateInRange = isDateInRange;
|
|
|
210
230
|
exports.isSameDay = isSameDay;
|
|
211
231
|
exports.isValidISODate = isValidISODate;
|
|
212
232
|
exports.monthIsDisabled = monthIsDisabled;
|
|
233
|
+
exports.parseDateString = parseDateString;
|
|
213
234
|
exports.removeTimezoneOffset = removeTimezoneOffset;
|
|
214
235
|
exports.subDays = subDays;
|
|
@@ -3,7 +3,7 @@ import { announce } from "@react-aria/live-announcer";
|
|
|
3
3
|
import dayjs from "dayjs";
|
|
4
4
|
import customParseFormat from "dayjs/plugin/customParseFormat";
|
|
5
5
|
dayjs.extend(customParseFormat);
|
|
6
|
-
import { getISODateString, removeTimezoneOffset } from "../../../../shared/utils/utils";
|
|
6
|
+
import { getISODateString, parseDateString, removeTimezoneOffset } from "../../../../shared/utils/utils";
|
|
7
7
|
import { chronoParseDate, chronoParseRange } from "../../../../shared/utils/chrono-parser/chrono-parser";
|
|
8
8
|
const defaultLabels = {
|
|
9
9
|
selected: "selected",
|
|
@@ -184,6 +184,7 @@ export class TabworthyDates {
|
|
|
184
184
|
maxDate: ""
|
|
185
185
|
}[parsedRange.reason];
|
|
186
186
|
}
|
|
187
|
+
this.emitErrorChange(parsedRange === null || parsedRange === void 0 ? void 0 : parsedRange.reason, this.errorMessage);
|
|
187
188
|
}
|
|
188
189
|
};
|
|
189
190
|
this.handleSingleDateChange = async (value) => {
|
|
@@ -196,6 +197,16 @@ export class TabworthyDates {
|
|
|
196
197
|
this.value = this.internalValue;
|
|
197
198
|
return this.selectDate.emit(this.internalValue);
|
|
198
199
|
}
|
|
200
|
+
// Try strict format parsing first to avoid DD/MM vs MM/DD ambiguity
|
|
201
|
+
const strictParsed = dayjs(value, this.format, true);
|
|
202
|
+
if (strictParsed.isValid()) {
|
|
203
|
+
const date = strictParsed.toDate();
|
|
204
|
+
if (!this.isPickedDateValid(date))
|
|
205
|
+
return;
|
|
206
|
+
this.updateValue(date);
|
|
207
|
+
this.formatInput(true, false);
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
199
210
|
const parsedDate = await chronoParseDate(value, {
|
|
200
211
|
locale: this.locale.slice(0, 2),
|
|
201
212
|
minDate: this.minDate,
|
|
@@ -206,6 +217,7 @@ export class TabworthyDates {
|
|
|
206
217
|
if (this.disableDate(parsedDate.value)) {
|
|
207
218
|
this.errorState = true;
|
|
208
219
|
this.errorMessage = this.datesLabels.disabledDateError;
|
|
220
|
+
this.emitErrorChange("disabledDate", this.errorMessage);
|
|
209
221
|
}
|
|
210
222
|
else {
|
|
211
223
|
this.updateValue(parsedDate.value);
|
|
@@ -218,30 +230,31 @@ export class TabworthyDates {
|
|
|
218
230
|
let maxDate = undefined;
|
|
219
231
|
let minDate = undefined;
|
|
220
232
|
if (this.maxDate) {
|
|
221
|
-
maxDate = this.maxDate
|
|
222
|
-
? removeTimezoneOffset(new Date(this.maxDate))
|
|
223
|
-
: undefined;
|
|
233
|
+
maxDate = this.maxDate ? parseDateString(this.maxDate) : undefined;
|
|
224
234
|
maxDate === null || maxDate === void 0 ? void 0 : maxDate.setDate(maxDate.getDate() + 1);
|
|
225
235
|
}
|
|
226
236
|
if (this.minDate) {
|
|
227
|
-
minDate = this.minDate
|
|
228
|
-
? removeTimezoneOffset(new Date(this.minDate))
|
|
229
|
-
: undefined;
|
|
237
|
+
minDate = this.minDate ? parseDateString(this.minDate) : undefined;
|
|
230
238
|
minDate === null || minDate === void 0 ? void 0 : minDate.setDate(minDate.getDate() - 1);
|
|
231
239
|
}
|
|
232
240
|
if (!!parsedDate.reason) {
|
|
241
|
+
const formatLocalizedDate = (date) => Intl.DateTimeFormat(this.locale, {
|
|
242
|
+
day: "numeric",
|
|
243
|
+
month: "short",
|
|
244
|
+
year: "numeric"
|
|
245
|
+
}).format(date);
|
|
233
246
|
this.errorMessage = parsedDate.reason;
|
|
234
247
|
this.errorMessage = {
|
|
235
|
-
// TODO: Add locale date formatting to these messages
|
|
236
248
|
minDate: minDate
|
|
237
|
-
? `${this.datesLabels.minDateError} ${
|
|
249
|
+
? `${this.datesLabels.minDateError} ${formatLocalizedDate(minDate)}`
|
|
238
250
|
: "",
|
|
239
251
|
maxDate: maxDate
|
|
240
|
-
? `${this.datesLabels.maxDateError} ${
|
|
252
|
+
? `${this.datesLabels.maxDateError} ${formatLocalizedDate(maxDate)}`
|
|
241
253
|
: "",
|
|
242
254
|
invalid: this.datesLabels.invalidDateError
|
|
243
255
|
}[parsedDate.reason];
|
|
244
256
|
}
|
|
257
|
+
this.emitErrorChange(parsedDate === null || parsedDate === void 0 ? void 0 : parsedDate.reason, this.errorMessage);
|
|
245
258
|
}
|
|
246
259
|
};
|
|
247
260
|
this.handleChange = async (event) => {
|
|
@@ -310,6 +323,9 @@ export class TabworthyDates {
|
|
|
310
323
|
this.selectDate.emit(this.internalValue);
|
|
311
324
|
this.announceDateChange(this.internalValue);
|
|
312
325
|
}
|
|
326
|
+
emitErrorChange(reason, message) {
|
|
327
|
+
this.errorChange.emit({ reason, message });
|
|
328
|
+
}
|
|
313
329
|
formatInput(enabled, useInputValue = true) {
|
|
314
330
|
if (this.shouldInputFormat() === false || enabled === false) {
|
|
315
331
|
if (this.internalValue) {
|
|
@@ -355,9 +371,37 @@ export class TabworthyDates {
|
|
|
355
371
|
}
|
|
356
372
|
}
|
|
357
373
|
}
|
|
374
|
+
isPickedDateValid(dateString) {
|
|
375
|
+
const parsed = dayjs(dateString);
|
|
376
|
+
if (!parsed.isValid())
|
|
377
|
+
return false;
|
|
378
|
+
const isoDate = typeof dateString === "string" ? dateString : parsed.format("YYYY-MM-DD");
|
|
379
|
+
if (this.minDate && isoDate < this.minDate) {
|
|
380
|
+
this.errorState = true;
|
|
381
|
+
this.errorMessage = `${this.datesLabels.minDateError} ${this.minDate}`;
|
|
382
|
+
this.emitErrorChange("minDate", this.errorMessage);
|
|
383
|
+
return false;
|
|
384
|
+
}
|
|
385
|
+
if (this.maxDate && isoDate > this.maxDate) {
|
|
386
|
+
this.errorState = true;
|
|
387
|
+
this.errorMessage = `${this.datesLabels.maxDateError} ${this.maxDate}`;
|
|
388
|
+
this.emitErrorChange("maxDate", this.errorMessage);
|
|
389
|
+
return false;
|
|
390
|
+
}
|
|
391
|
+
if (this.disableDate(parsed.toDate())) {
|
|
392
|
+
this.errorState = true;
|
|
393
|
+
this.errorMessage = this.datesLabels.disabledDateError;
|
|
394
|
+
this.emitErrorChange("disabledDate", this.errorMessage);
|
|
395
|
+
return false;
|
|
396
|
+
}
|
|
397
|
+
return true;
|
|
398
|
+
}
|
|
358
399
|
handlePickerSelection(newValue) {
|
|
359
400
|
var _a, _b;
|
|
360
401
|
if (this.isRangeValue(newValue)) {
|
|
402
|
+
// Validate each date in the range
|
|
403
|
+
if (newValue.some((date) => !this.isPickedDateValid(date)))
|
|
404
|
+
return;
|
|
361
405
|
if (newValue.length === 2)
|
|
362
406
|
(_a = this.modalRef) === null || _a === void 0 ? void 0 : _a.close();
|
|
363
407
|
// Convert ISO dates to specified format
|
|
@@ -369,6 +413,9 @@ export class TabworthyDates {
|
|
|
369
413
|
this.announceDateChange(this.internalValue);
|
|
370
414
|
}
|
|
371
415
|
else {
|
|
416
|
+
// Validate the single date
|
|
417
|
+
if (newValue && !this.isPickedDateValid(newValue))
|
|
418
|
+
return;
|
|
372
419
|
(_b = this.modalRef) === null || _b === void 0 ? void 0 : _b.close();
|
|
373
420
|
// Convert ISO date to specified format
|
|
374
421
|
const formattedDate = newValue
|
|
@@ -1375,6 +1422,27 @@ export class TabworthyDates {
|
|
|
1375
1422
|
}
|
|
1376
1423
|
}
|
|
1377
1424
|
}
|
|
1425
|
+
}, {
|
|
1426
|
+
"method": "errorChange",
|
|
1427
|
+
"name": "errorChange",
|
|
1428
|
+
"bubbles": true,
|
|
1429
|
+
"cancelable": true,
|
|
1430
|
+
"composed": true,
|
|
1431
|
+
"docs": {
|
|
1432
|
+
"tags": [],
|
|
1433
|
+
"text": ""
|
|
1434
|
+
},
|
|
1435
|
+
"complexType": {
|
|
1436
|
+
"original": "ErrorChangeEventDetails",
|
|
1437
|
+
"resolved": "ErrorChangeEventDetails",
|
|
1438
|
+
"references": {
|
|
1439
|
+
"ErrorChangeEventDetails": {
|
|
1440
|
+
"location": "local",
|
|
1441
|
+
"path": "/home/runner/work/tabworthy-components/tabworthy-components/src/components/tabworthy-dates/tabworthy-dates.tsx",
|
|
1442
|
+
"id": "src/components/tabworthy-dates/tabworthy-dates.tsx::ErrorChangeEventDetails"
|
|
1443
|
+
}
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1378
1446
|
}, {
|
|
1379
1447
|
"method": "componentReady",
|
|
1380
1448
|
"name": "componentReady",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { h, Host } from "@stencil/core";
|
|
2
|
-
import { addDays, dateIsWithinLowerBounds, dateIsWithinUpperBounds, getDaysOfMonth, getFirstOfMonth, getISODateString, getLastOfMonth, getMonth, getMonths, getNextDay, getNextMonth, getNextYear, getPreviousDay, getPreviousMonth, getPreviousYear, getWeekDays, getYear, isDateInRange, isSameDay, monthIsDisabled, removeTimezoneOffset, subDays } from "../../../../shared/utils/utils";
|
|
2
|
+
import { addDays, dateIsWithinLowerBounds, dateIsWithinUpperBounds, getDaysOfMonth, getFirstOfMonth, getISODateString, getLastOfMonth, getMonth, getMonths, getNextDay, getNextMonth, getNextYear, getPreviousDay, getPreviousMonth, getPreviousYear, getWeekDays, getYear, isDateInRange, isSameDay, monthIsDisabled, parseDateString, removeTimezoneOffset, subDays } from "../../../../shared/utils/utils";
|
|
3
3
|
import { dateIsWithinBounds } from "../../../../shared/utils/utils";
|
|
4
4
|
const defaultLabels = {
|
|
5
5
|
clearButton: "Clear value",
|
|
@@ -43,16 +43,34 @@ export class TabworthyDatesCalendar {
|
|
|
43
43
|
this.updateWeekdays();
|
|
44
44
|
};
|
|
45
45
|
this.nextMonth = () => {
|
|
46
|
-
|
|
46
|
+
const next = getNextMonth(this.currentDate);
|
|
47
|
+
if (this.disabled ||
|
|
48
|
+
monthIsDisabled(next.getMonth(), next.getFullYear(), this.minDate, this.maxDate))
|
|
49
|
+
return;
|
|
50
|
+
this.updateCurrentDate(next);
|
|
47
51
|
};
|
|
48
52
|
this.nextYear = () => {
|
|
49
|
-
|
|
53
|
+
const next = getNextYear(this.currentDate);
|
|
54
|
+
if (this.disabled ||
|
|
55
|
+
(this.maxDate &&
|
|
56
|
+
parseDateString(this.maxDate).getFullYear() < next.getFullYear()))
|
|
57
|
+
return;
|
|
58
|
+
this.updateCurrentDate(next, false, true);
|
|
50
59
|
};
|
|
51
60
|
this.previousMonth = () => {
|
|
52
|
-
|
|
61
|
+
const prev = getPreviousMonth(this.currentDate);
|
|
62
|
+
if (this.disabled ||
|
|
63
|
+
monthIsDisabled(prev.getMonth(), prev.getFullYear(), this.minDate, this.maxDate))
|
|
64
|
+
return;
|
|
65
|
+
this.updateCurrentDate(prev);
|
|
53
66
|
};
|
|
54
67
|
this.previousYear = () => {
|
|
55
|
-
|
|
68
|
+
const prev = getPreviousYear(this.currentDate);
|
|
69
|
+
if (this.disabled ||
|
|
70
|
+
(this.minDate &&
|
|
71
|
+
parseDateString(this.minDate).getFullYear() > prev.getFullYear()))
|
|
72
|
+
return;
|
|
73
|
+
this.updateCurrentDate(prev, false, true);
|
|
56
74
|
};
|
|
57
75
|
this.showToday = () => {
|
|
58
76
|
this.updateCurrentDate(new Date(), true);
|
|
@@ -256,9 +274,9 @@ export class TabworthyDatesCalendar {
|
|
|
256
274
|
const month = date.getMonth();
|
|
257
275
|
const year = date.getFullYear();
|
|
258
276
|
if (!dateIsWithinLowerBounds(date, this.minDate))
|
|
259
|
-
date =
|
|
277
|
+
date = parseDateString(this.minDate);
|
|
260
278
|
if (!dateIsWithinUpperBounds(date, this.maxDate))
|
|
261
|
-
date =
|
|
279
|
+
date = parseDateString(this.maxDate);
|
|
262
280
|
const monthChanged = month !== ((_a = this.currentDate) === null || _a === void 0 ? void 0 : _a.getMonth()) ||
|
|
263
281
|
year !== this.currentDate.getFullYear();
|
|
264
282
|
if (monthChanged) {
|
|
@@ -315,11 +333,11 @@ export class TabworthyDatesCalendar {
|
|
|
315
333
|
year: {
|
|
316
334
|
prev: this.disabled ||
|
|
317
335
|
(!!this.minDate &&
|
|
318
|
-
|
|
336
|
+
parseDateString(this.minDate).getFullYear() >
|
|
319
337
|
getPreviousYear(this.currentDate).getFullYear()),
|
|
320
338
|
next: this.disabled ||
|
|
321
339
|
(!!this.maxDate &&
|
|
322
|
-
|
|
340
|
+
parseDateString(this.maxDate).getFullYear() <
|
|
323
341
|
getNextYear(this.currentDate).getFullYear())
|
|
324
342
|
},
|
|
325
343
|
month: {
|
|
@@ -329,15 +347,15 @@ export class TabworthyDatesCalendar {
|
|
|
329
347
|
monthIsDisabled(getNextMonth(this.currentDate).getMonth(), getNextMonth(this.currentDate).getFullYear(), this.minDate, this.maxDate)
|
|
330
348
|
}
|
|
331
349
|
};
|
|
332
|
-
return (h(Host, { key: '
|
|
350
|
+
return (h(Host, { key: '60e2a56f8a1aadceb57d7f445098060293a0f937' }, h("div", { key: '12fd35c03b0c34e4ad88e4e491fcc685de5f09b2', class: {
|
|
333
351
|
[`${this.getClassName()}-wrapper`]: true,
|
|
334
352
|
[`${this.getClassName()}-wrapper--inline`]: this.inline
|
|
335
|
-
} }, h("div", { key: '
|
|
353
|
+
} }, h("div", { key: 'ad36d1e260a7a89110c53fc86e339eb5a259a4fc', class: {
|
|
336
354
|
[this.getClassName()]: true,
|
|
337
355
|
[`${this.getClassName()}--disabled`]: this.disabled
|
|
338
|
-
} }, h("div", { key: '
|
|
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) => {
|
|
339
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));
|
|
340
|
-
})), h("input", { key: '
|
|
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) => {
|
|
341
359
|
const rowKey = `row-${calendarRow[0].getMonth()}-${calendarRow[0].getDate()}`;
|
|
342
360
|
return (h("tr", { class: this.getClassName("calendar-row"), key: rowKey }, calendarRow.map((day) => {
|
|
343
361
|
var _a, _b, _c;
|
|
@@ -404,14 +422,14 @@ export class TabworthyDatesCalendar {
|
|
|
404
422
|
? 0
|
|
405
423
|
: -1 }, h(Tag, { "aria-hidden": "true" }, day.getDate()), h("span", { class: "visually-hidden" }, getScreenReaderText())));
|
|
406
424
|
})));
|
|
407
|
-
})))), showFooter && (h("div", { key: '
|
|
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
|
|
408
426
|
? this.labels.todayButton
|
|
409
|
-
: 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: '
|
|
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
|
|
410
428
|
? this.labels.clearButton
|
|
411
|
-
: 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: '
|
|
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
|
|
412
430
|
? this.labels.closeButton
|
|
413
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 &&
|
|
414
|
-
!window.matchMedia("(pointer: coarse)").matches && (h("button", { key: '
|
|
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" }))));
|
|
415
433
|
}
|
|
416
434
|
static get is() { return "tabworthy-dates-calendar"; }
|
|
417
435
|
static get encapsulation() { return "scoped"; }
|