@tabworthy/components 0.12.4 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +48 -10
- package/dist/cjs/tabworthy-times-picker.cjs.entry.js +82 -10
- package/dist/cjs/tabworthy-times.cjs.entry.js +108 -5
- package/dist/cjs/{utils-y5Vtky2t.js → utils-DGbdK8VF.js} +29 -8
- package/dist/collection/components/tabworthy-dates/tabworthy-dates.js +68 -10
- package/dist/collection/components/tabworthy-dates-calendar/tabworthy-dates-calendar.js +35 -17
- package/dist/collection/components/tabworthy-times/tabworthy-times.js +128 -4
- 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 +48 -10
- package/dist/esm/tabworthy-times-picker.entry.js +82 -10
- package/dist/esm/tabworthy-times.entry.js +108 -5
- package/dist/esm/{utils-BVHu5CWV.js → utils-CoFOnMSw.js} +29 -9
- package/dist/shared/utils/utils.js +28 -8
- package/dist/tabworthy-components/p-69334c34.entry.js +1 -0
- package/dist/tabworthy-components/p-71f5c261.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-ed3c60d6.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 +8 -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
|
@@ -80,6 +80,8 @@ export class TabworthyTimes {
|
|
|
80
80
|
if (this.range && dates.length === 2) {
|
|
81
81
|
const startDate = removeTimezoneOffset(new Date(dates[0]));
|
|
82
82
|
const endDate = removeTimezoneOffset(new Date(dates[1]));
|
|
83
|
+
if (!this.isDateValid(startDate) || !this.isDateValid(endDate))
|
|
84
|
+
return;
|
|
83
85
|
this.updateValue([startDate, endDate]);
|
|
84
86
|
// Update calendar with selected dates
|
|
85
87
|
if (this.pickerRef) {
|
|
@@ -88,6 +90,8 @@ export class TabworthyTimes {
|
|
|
88
90
|
}
|
|
89
91
|
else {
|
|
90
92
|
const date = removeTimezoneOffset(new Date(dates[0]));
|
|
93
|
+
if (!this.isDateValid(date))
|
|
94
|
+
return;
|
|
91
95
|
this.updateValue(date);
|
|
92
96
|
// Update calendar with selected date
|
|
93
97
|
if (this.pickerRef) {
|
|
@@ -146,6 +150,25 @@ export class TabworthyTimes {
|
|
|
146
150
|
parsed = dayjs(value);
|
|
147
151
|
}
|
|
148
152
|
if (parsed.isValid()) {
|
|
153
|
+
// Check minDate/maxDate bounds (supports both date-only and datetime strings)
|
|
154
|
+
if (this.minDate && parsed.isBefore(dayjs(this.minDate))) {
|
|
155
|
+
this.errorState = true;
|
|
156
|
+
this.errorMessage = `${this.timesLabels.minDateError} ${this.formatBoundaryDate(this.minDate)}`;
|
|
157
|
+
this.emitErrorChange("minDate", this.errorMessage);
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
if (this.maxDate && parsed.isAfter(dayjs(this.maxDate))) {
|
|
161
|
+
this.errorState = true;
|
|
162
|
+
this.errorMessage = `${this.timesLabels.maxDateError} ${this.formatBoundaryDate(this.maxDate)}`;
|
|
163
|
+
this.emitErrorChange("maxDate", this.errorMessage);
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
if (this.disableDate(parsed.toDate())) {
|
|
167
|
+
this.errorState = true;
|
|
168
|
+
this.errorMessage = this.timesLabels.disabledDateError;
|
|
169
|
+
this.emitErrorChange("disabledDate", this.errorMessage);
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
149
172
|
this.errorState = false;
|
|
150
173
|
this.selectedHours = parsed.hour();
|
|
151
174
|
this.selectedMinutes = parsed.minute();
|
|
@@ -156,9 +179,64 @@ export class TabworthyTimes {
|
|
|
156
179
|
// Set error state for invalid/garbage input
|
|
157
180
|
this.errorState = true;
|
|
158
181
|
this.errorMessage = this.timesLabels.invalidDateError;
|
|
182
|
+
this.emitErrorChange("invalid", this.errorMessage);
|
|
159
183
|
}
|
|
160
184
|
};
|
|
161
185
|
}
|
|
186
|
+
emitErrorChange(reason, message) {
|
|
187
|
+
this.errorChange.emit({ reason, message });
|
|
188
|
+
}
|
|
189
|
+
formatBoundaryDate(dateString) {
|
|
190
|
+
const parsed = dayjs(dateString);
|
|
191
|
+
if (!parsed.isValid())
|
|
192
|
+
return dateString;
|
|
193
|
+
const hasTime = dateString.includes("T") || dateString.includes(" ");
|
|
194
|
+
if (!hasTime) {
|
|
195
|
+
return Intl.DateTimeFormat(this.locale, {
|
|
196
|
+
day: "numeric",
|
|
197
|
+
month: "short",
|
|
198
|
+
year: "numeric"
|
|
199
|
+
}).format(parsed.toDate());
|
|
200
|
+
}
|
|
201
|
+
const options = Object.assign({ day: "numeric", month: "short", year: "numeric", hour: "numeric", minute: "numeric" }, (this.showSeconds ? { second: "numeric" } : {}));
|
|
202
|
+
return Intl.DateTimeFormat(this.locale, options).format(parsed.toDate());
|
|
203
|
+
}
|
|
204
|
+
getEffectiveMinTime() {
|
|
205
|
+
if (!this.minDate || !this.selectedDate)
|
|
206
|
+
return undefined;
|
|
207
|
+
const min = dayjs(this.minDate);
|
|
208
|
+
const sel = dayjs(this.selectedDate);
|
|
209
|
+
if (!min.isValid() || !sel.isSame(min, "day"))
|
|
210
|
+
return undefined;
|
|
211
|
+
return {
|
|
212
|
+
hours: min.hour(),
|
|
213
|
+
minutes: min.minute(),
|
|
214
|
+
seconds: min.second()
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
getEffectiveMaxTime() {
|
|
218
|
+
if (!this.maxDate || !this.selectedDate)
|
|
219
|
+
return undefined;
|
|
220
|
+
const max = dayjs(this.maxDate);
|
|
221
|
+
const sel = dayjs(this.selectedDate);
|
|
222
|
+
if (!max.isValid() || !sel.isSame(max, "day"))
|
|
223
|
+
return undefined;
|
|
224
|
+
return {
|
|
225
|
+
hours: max.hour(),
|
|
226
|
+
minutes: max.minute(),
|
|
227
|
+
seconds: max.second()
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
isDateOutOfBounds() {
|
|
231
|
+
if (!this.selectedDate)
|
|
232
|
+
return false;
|
|
233
|
+
const sel = dayjs(this.selectedDate);
|
|
234
|
+
if (this.minDate && sel.isBefore(dayjs(this.minDate), "day"))
|
|
235
|
+
return true;
|
|
236
|
+
if (this.maxDate && sel.isAfter(dayjs(this.maxDate), "day"))
|
|
237
|
+
return true;
|
|
238
|
+
return false;
|
|
239
|
+
}
|
|
162
240
|
shouldInputFormat() {
|
|
163
241
|
if (typeof this.inputShouldFormat === "string") {
|
|
164
242
|
return this.inputShouldFormat === "true";
|
|
@@ -231,6 +309,30 @@ export class TabworthyTimes {
|
|
|
231
309
|
this.formatInput();
|
|
232
310
|
}
|
|
233
311
|
}
|
|
312
|
+
isDateValid(date) {
|
|
313
|
+
const parsed = dayjs(date);
|
|
314
|
+
if (!parsed.isValid())
|
|
315
|
+
return false;
|
|
316
|
+
if (this.minDate && parsed.isBefore(dayjs(this.minDate))) {
|
|
317
|
+
this.errorState = true;
|
|
318
|
+
this.errorMessage = `${this.timesLabels.minDateError} ${this.formatBoundaryDate(this.minDate)}`;
|
|
319
|
+
this.emitErrorChange("minDate", this.errorMessage);
|
|
320
|
+
return false;
|
|
321
|
+
}
|
|
322
|
+
if (this.maxDate && parsed.isAfter(dayjs(this.maxDate))) {
|
|
323
|
+
this.errorState = true;
|
|
324
|
+
this.errorMessage = `${this.timesLabels.maxDateError} ${this.formatBoundaryDate(this.maxDate)}`;
|
|
325
|
+
this.emitErrorChange("maxDate", this.errorMessage);
|
|
326
|
+
return false;
|
|
327
|
+
}
|
|
328
|
+
if (this.disableDate(date)) {
|
|
329
|
+
this.errorState = true;
|
|
330
|
+
this.errorMessage = this.timesLabels.disabledDateError;
|
|
331
|
+
this.emitErrorChange("disabledDate", this.errorMessage);
|
|
332
|
+
return false;
|
|
333
|
+
}
|
|
334
|
+
return true;
|
|
335
|
+
}
|
|
234
336
|
formatInput() {
|
|
235
337
|
if (!this.internalValue)
|
|
236
338
|
return;
|
|
@@ -271,12 +373,12 @@ export class TabworthyTimes {
|
|
|
271
373
|
}
|
|
272
374
|
render() {
|
|
273
375
|
var _a;
|
|
274
|
-
return (h(Host, { key: '
|
|
376
|
+
return (h(Host, { key: 'd258bd87c60aa773bd178e1e74eeb32934d8f068', class: this.elementClassName, "has-error": this.errorState, disabled: this.disabledState }, h("label", { key: '5e7a53cb36c350794af9fed2371c89823726ee2f', htmlFor: `${this.id}-input`, class: this.getClassName("label") }, this.label), h("div", { key: '986905f117271cfb82a1f8415d55536a590ac2bc', class: this.getClassName("input-container"), ref: (r) => (this.inputContainerRef = r) }, h("input", { key: '9ad436c1e0c8a427c1665db16913cddf93d94fed', id: `${this.id}-input`, ref: (r) => (this.inputRef = r), type: "text", class: {
|
|
275
377
|
[this.getClassName("input")]: true,
|
|
276
378
|
[this.inputClass]: !!this.inputClass
|
|
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: '
|
|
379
|
+
}, 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: 'd537e6f3251bada7ad50bbe1ca2c562737205897', type: "button", onClick: this.handleCalendarButtonClick, class: this.getClassName("calendar-button"), disabled: this.disabledState, "aria-label": this.calendarButtonContent
|
|
278
380
|
? this.timesLabels.openCalendar
|
|
279
|
-
: undefined }, this.calendarButtonContent ? (h("span", { innerHTML: this.calendarButtonContent })) : (this.timesLabels.openCalendar)))), h("tabworthy-dates-modal", { key: '
|
|
381
|
+
: undefined }, this.calendarButtonContent ? (h("span", { innerHTML: this.calendarButtonContent })) : (this.timesLabels.openCalendar)))), h("tabworthy-dates-modal", { key: '241700195e1d028f8d8b6b55af7de3aee09163ea', label: this.timesLabels.calendar, ref: (el) => (this.modalRef = el), onOpened: () => {
|
|
280
382
|
if (this.pickerRef) {
|
|
281
383
|
this.pickerRef.modalIsOpen = true;
|
|
282
384
|
}
|
|
@@ -284,7 +386,7 @@ export class TabworthyTimes {
|
|
|
284
386
|
if (this.pickerRef) {
|
|
285
387
|
this.pickerRef.modalIsOpen = false;
|
|
286
388
|
}
|
|
287
|
-
}, inline: this.inline, appendTo: this.appendTo }, h("div", { key: '
|
|
389
|
+
}, inline: this.inline, appendTo: this.appendTo }, h("div", { key: 'b99aa129e4d1d600971bc4d21b2c6a4316ff64cf', class: this.getClassName("picker-container") }, h("tabworthy-dates-calendar", { key: '6ac11c01936e2155c023d286d912ba87e0ed3415', 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 }, h("div", { key: '7eead2c25334abce43fe7371436a52b0970e648b', slot: "after-calendar", class: this.getClassName("time-section") }, h("hr", { key: '06ac45a5eaaaa56d39825f941b0951f99c4b28e9', class: this.getClassName("divider") }), h("tabworthy-times-picker", { key: 'ba4187a2a369cff58ca0ecf3a60abfeff3ba9ca3', 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 && (h("div", { key: 'c187d0bd982a5184aa796ffe8be4ed91c340230d', class: this.getClassName("input-error"), id: this.id ? `${this.id}-error` : undefined, role: "status" }, this.errorMessage))));
|
|
288
390
|
}
|
|
289
391
|
static get is() { return "tabworthy-times"; }
|
|
290
392
|
static get encapsulation() { return "scoped"; }
|
|
@@ -1128,6 +1230,28 @@ export class TabworthyTimes {
|
|
|
1128
1230
|
}
|
|
1129
1231
|
}
|
|
1130
1232
|
}
|
|
1233
|
+
}, {
|
|
1234
|
+
"method": "errorChange",
|
|
1235
|
+
"name": "errorChange",
|
|
1236
|
+
"bubbles": true,
|
|
1237
|
+
"cancelable": true,
|
|
1238
|
+
"composed": true,
|
|
1239
|
+
"docs": {
|
|
1240
|
+
"tags": [],
|
|
1241
|
+
"text": ""
|
|
1242
|
+
},
|
|
1243
|
+
"complexType": {
|
|
1244
|
+
"original": "ErrorChangeEventDetails",
|
|
1245
|
+
"resolved": "ErrorChangeEventDetails",
|
|
1246
|
+
"references": {
|
|
1247
|
+
"ErrorChangeEventDetails": {
|
|
1248
|
+
"location": "import",
|
|
1249
|
+
"path": "../tabworthy-dates/tabworthy-dates",
|
|
1250
|
+
"id": "src/components/tabworthy-dates/tabworthy-dates.tsx::ErrorChangeEventDetails",
|
|
1251
|
+
"referenceLocation": "ErrorChangeEventDetails"
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1131
1255
|
}, {
|
|
1132
1256
|
"method": "componentReady",
|
|
1133
1257
|
"name": "componentReady",
|
|
@@ -33,6 +33,8 @@ export class TabworthyTimesPicker {
|
|
|
33
33
|
this.period = this.hours >= 12 ? "PM" : "AM";
|
|
34
34
|
this.handleHourChange = (e) => {
|
|
35
35
|
const value = parseInt(e.target.value, 10);
|
|
36
|
+
if (isNaN(value))
|
|
37
|
+
return;
|
|
36
38
|
if (this.useTwelveHourFormat) {
|
|
37
39
|
// Convert to 24-hour format based on period
|
|
38
40
|
if (this.period === "AM") {
|
|
@@ -48,7 +50,10 @@ export class TabworthyTimesPicker {
|
|
|
48
50
|
this.emitTimeChange();
|
|
49
51
|
};
|
|
50
52
|
this.handleMinuteChange = (e) => {
|
|
51
|
-
|
|
53
|
+
const value = parseInt(e.target.value, 10);
|
|
54
|
+
if (isNaN(value))
|
|
55
|
+
return;
|
|
56
|
+
this.internalMinutes = value;
|
|
52
57
|
this.emitTimeChange();
|
|
53
58
|
};
|
|
54
59
|
this.handlePeriodChange = (period) => {
|
|
@@ -108,7 +113,10 @@ export class TabworthyTimesPicker {
|
|
|
108
113
|
this.emitTimeChange();
|
|
109
114
|
};
|
|
110
115
|
this.handleSecondChange = (e) => {
|
|
111
|
-
|
|
116
|
+
const value = parseInt(e.target.value, 10);
|
|
117
|
+
if (isNaN(value))
|
|
118
|
+
return;
|
|
119
|
+
this.internalSeconds = value;
|
|
112
120
|
this.emitTimeChange();
|
|
113
121
|
};
|
|
114
122
|
this.handleSecondIncrement = () => {
|
|
@@ -160,6 +168,7 @@ export class TabworthyTimesPicker {
|
|
|
160
168
|
}
|
|
161
169
|
}
|
|
162
170
|
emitTimeChange() {
|
|
171
|
+
this.clampToBounds();
|
|
163
172
|
this.timeChanged.emit({
|
|
164
173
|
hours: this.get24HourValue(),
|
|
165
174
|
minutes: this.internalMinutes,
|
|
@@ -167,6 +176,69 @@ export class TabworthyTimesPicker {
|
|
|
167
176
|
period: this.useTwelveHourFormat ? this.period : undefined
|
|
168
177
|
});
|
|
169
178
|
}
|
|
179
|
+
clampToBounds() {
|
|
180
|
+
var _a, _b;
|
|
181
|
+
const h = this.get24HourValue();
|
|
182
|
+
const m = this.internalMinutes;
|
|
183
|
+
const s = this.internalSeconds;
|
|
184
|
+
if (this.minTime) {
|
|
185
|
+
const minS = (_a = this.minTime.seconds) !== null && _a !== void 0 ? _a : 0;
|
|
186
|
+
if (h < this.minTime.hours ||
|
|
187
|
+
(h === this.minTime.hours && m < this.minTime.minutes) ||
|
|
188
|
+
(h === this.minTime.hours && m === this.minTime.minutes && s < minS)) {
|
|
189
|
+
this.setInternal24Hours(this.minTime.hours);
|
|
190
|
+
this.internalMinutes = this.minTime.minutes;
|
|
191
|
+
this.internalSeconds = minS;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
if (this.maxTime) {
|
|
195
|
+
const maxS = (_b = this.maxTime.seconds) !== null && _b !== void 0 ? _b : 59;
|
|
196
|
+
const curH = this.get24HourValue();
|
|
197
|
+
const curM = this.internalMinutes;
|
|
198
|
+
const curS = this.internalSeconds;
|
|
199
|
+
if (curH > this.maxTime.hours ||
|
|
200
|
+
(curH === this.maxTime.hours && curM > this.maxTime.minutes) ||
|
|
201
|
+
(curH === this.maxTime.hours &&
|
|
202
|
+
curM === this.maxTime.minutes &&
|
|
203
|
+
curS > maxS)) {
|
|
204
|
+
this.setInternal24Hours(this.maxTime.hours);
|
|
205
|
+
this.internalMinutes = this.maxTime.minutes;
|
|
206
|
+
this.internalSeconds = maxS;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
setInternal24Hours(h24) {
|
|
211
|
+
this.internalHours = h24;
|
|
212
|
+
this.period = h24 >= 12 ? "PM" : "AM";
|
|
213
|
+
}
|
|
214
|
+
isAtMinHour() {
|
|
215
|
+
return !!this.minTime && this.get24HourValue() <= this.minTime.hours;
|
|
216
|
+
}
|
|
217
|
+
isAtMaxHour() {
|
|
218
|
+
return !!this.maxTime && this.get24HourValue() >= this.maxTime.hours;
|
|
219
|
+
}
|
|
220
|
+
isAtMinMinute() {
|
|
221
|
+
return (this.isAtMinHour() &&
|
|
222
|
+
!!this.minTime &&
|
|
223
|
+
this.internalMinutes <= this.minTime.minutes);
|
|
224
|
+
}
|
|
225
|
+
isAtMaxMinute() {
|
|
226
|
+
return (this.isAtMaxHour() &&
|
|
227
|
+
!!this.maxTime &&
|
|
228
|
+
this.internalMinutes >= this.maxTime.minutes);
|
|
229
|
+
}
|
|
230
|
+
isAtMinSecond() {
|
|
231
|
+
var _a;
|
|
232
|
+
return (this.isAtMinMinute() &&
|
|
233
|
+
!!this.minTime &&
|
|
234
|
+
this.internalSeconds <= ((_a = this.minTime.seconds) !== null && _a !== void 0 ? _a : 0));
|
|
235
|
+
}
|
|
236
|
+
isAtMaxSecond() {
|
|
237
|
+
var _a;
|
|
238
|
+
return (this.isAtMaxMinute() &&
|
|
239
|
+
!!this.maxTime &&
|
|
240
|
+
this.internalSeconds >= ((_a = this.maxTime.seconds) !== null && _a !== void 0 ? _a : 59));
|
|
241
|
+
}
|
|
170
242
|
padZero(num) {
|
|
171
243
|
return num.toString().padStart(2, "0");
|
|
172
244
|
}
|
|
@@ -174,22 +246,22 @@ export class TabworthyTimesPicker {
|
|
|
174
246
|
const displayHours = this.getDisplayHours();
|
|
175
247
|
const maxHours = this.useTwelveHourFormat ? 12 : 23;
|
|
176
248
|
const minHours = this.useTwelveHourFormat ? 1 : 0;
|
|
177
|
-
return (h(Host, { key: '
|
|
249
|
+
return (h(Host, { key: '190cabad78886b1902d70c42c6c5b1f4ee90e5fe', class: this.elementClassName, "aria-label": this.labels.timePicker }, h("div", { key: '98b3d39baf501aeb9894949e807a365e26253fbc', class: `${this.elementClassName}__container` }, h("div", { key: '6697b77b177164a36297f911572d89beaa01cf23', class: `${this.elementClassName}__field` }, h("label", { key: '43f6e821b49f19041422741840439081f819f71c', htmlFor: `${this.elementClassName}-hours`, class: {
|
|
178
250
|
[`${this.elementClassName}__label`]: true,
|
|
179
251
|
[`${this.elementClassName}__label--sr-only`]: this.labelsSrOnly
|
|
180
|
-
} }, this.labels.hours), h("div", { key: '
|
|
252
|
+
} }, this.labels.hours), h("div", { key: 'a0e177ded2a849c22e41dbca95bad0888f7f956c', class: `${this.elementClassName}__control` }, h("button", { key: 'b12c268cc84f11ee078ba9285ae6d9cc605761e4', type: "button", class: `${this.elementClassName}__button ${this.elementClassName}__button--increment`, onClick: this.handleHourIncrement, disabled: this.disabled || this.isAtMaxHour(), "aria-label": this.labels.incrementHours }, h("svg", { key: '598eff59b528ec28a0e5b34924e77a4f632ba6ca', fill: "none", height: "16", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", stroke: "currentColor", viewBox: "0 0 24 24", width: "16" }, h("polyline", { key: '279b80304fc77a2fd74e26a2aba89f12155f9334', points: "18 15 12 9 6 15" }))), h("input", { key: '93f17e7c848d40bd513ad7af9f29d39586391573', id: `${this.elementClassName}-hours`, type: "number", class: `${this.elementClassName}__input`, value: this.padZero(displayHours), min: minHours, max: maxHours, onInput: this.handleHourChange, disabled: this.disabled, "aria-label": this.labels.hours }), h("button", { key: 'ba8f6463ee850c6349cad839eb851c67e0cb4d1e', type: "button", class: `${this.elementClassName}__button ${this.elementClassName}__button--decrement`, onClick: this.handleHourDecrement, disabled: this.disabled || this.isAtMinHour(), "aria-label": this.labels.decrementHours }, h("svg", { key: '21e585fbd6a9aa2b957e817ec55ab2ec01cf2fc4', fill: "none", height: "16", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", stroke: "currentColor", viewBox: "0 0 24 24", width: "16" }, h("polyline", { key: '742b64bddf3873a7bea1c10ed93b9b1e99588ede', points: "6 9 12 15 18 9" }))))), h("div", { key: 'f81f40c465cc84a5d02b9904631d3d24e33150e3', class: `${this.elementClassName}__separator` }, ":"), h("div", { key: 'd028bae721c1c9c2cc7290cd19f7050a901f4a4e', class: `${this.elementClassName}__field` }, h("label", { key: '3c88a3fa04ed2a65f72c48ded459e19d580f9c36', htmlFor: `${this.elementClassName}-minutes`, class: {
|
|
181
253
|
[`${this.elementClassName}__label`]: true,
|
|
182
254
|
[`${this.elementClassName}__label--sr-only`]: this.labelsSrOnly
|
|
183
|
-
} }, this.labels.minutes), h("div", { key: '
|
|
184
|
-
h("div", { key: '
|
|
185
|
-
h("div", { key: '
|
|
255
|
+
} }, this.labels.minutes), h("div", { key: 'dbd89633addd003b2e42414b587d03a6e65e9239', class: `${this.elementClassName}__control` }, h("button", { key: 'b113074a58889691dd5452a6353b691336f5ae14', type: "button", class: `${this.elementClassName}__button ${this.elementClassName}__button--increment`, onClick: this.handleMinuteIncrement, disabled: this.disabled || this.isAtMaxMinute(), "aria-label": this.labels.incrementMinutes }, h("svg", { key: '0d724c0e5110dd29ab4cedc005595d4e57fd3d06', fill: "none", height: "16", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", stroke: "currentColor", viewBox: "0 0 24 24", width: "16" }, h("polyline", { key: 'dbc89190f6fe10bb8c8074252b83ab3397112de4', points: "18 15 12 9 6 15" }))), h("input", { key: '65a9a61218d443676a8a2d03d4922b2303a484c5', id: `${this.elementClassName}-minutes`, type: "number", class: `${this.elementClassName}__input`, value: this.padZero(this.internalMinutes), min: 0, max: 59, onInput: this.handleMinuteChange, disabled: this.disabled, "aria-label": this.labels.minutes }), h("button", { key: '3f72a62add15d9288b421b84e791ba40b9acf569', type: "button", class: `${this.elementClassName}__button ${this.elementClassName}__button--decrement`, onClick: this.handleMinuteDecrement, disabled: this.disabled || this.isAtMinMinute(), "aria-label": this.labels.decrementMinutes }, h("svg", { key: '04eef7d1d332459e5191962c411aa9c83ace8b84', fill: "none", height: "16", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", stroke: "currentColor", viewBox: "0 0 24 24", width: "16" }, h("polyline", { key: '56045b19ec716a82f21406b647762ba0efcd8170', points: "6 9 12 15 18 9" }))))), this.showSeconds && [
|
|
256
|
+
h("div", { key: '9c2619ccebd147e626e10a21fb1a5fa1268128f3', class: `${this.elementClassName}__separator` }, ":"),
|
|
257
|
+
h("div", { key: 'dea8135d47a06d9624b480aa6123350a0899ca02', class: `${this.elementClassName}__field` }, h("label", { key: 'afaa88b59df63091088620ff2a49bf8472f4401f', htmlFor: `${this.elementClassName}-seconds`, class: {
|
|
186
258
|
[`${this.elementClassName}__label`]: true,
|
|
187
259
|
[`${this.elementClassName}__label--sr-only`]: this.labelsSrOnly
|
|
188
|
-
} }, this.labels.seconds), h("div", { key: '
|
|
189
|
-
], this.useTwelveHourFormat && (h("div", { key: '
|
|
260
|
+
} }, this.labels.seconds), h("div", { key: 'c2ed4d63a95a65bdc26926932e705744bbe776c5', class: `${this.elementClassName}__control` }, h("button", { key: '40d510ae7008802ce09ec98c9912f2f91cdb2db7', type: "button", class: `${this.elementClassName}__button ${this.elementClassName}__button--increment`, onClick: this.handleSecondIncrement, disabled: this.disabled || this.isAtMaxSecond(), "aria-label": this.labels.incrementSeconds }, h("svg", { key: 'fd3324d15759c7f2a752b6a32303c8eaddb0e588', fill: "none", height: "16", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", stroke: "currentColor", viewBox: "0 0 24 24", width: "16" }, h("polyline", { key: '5e2dad75d96a521f56f616bc2b88e4baa6c0eb50', points: "18 15 12 9 6 15" }))), h("input", { key: 'b1b517bb8147a45632388f432ae0e3595467ebce', id: `${this.elementClassName}-seconds`, type: "number", class: `${this.elementClassName}__input`, value: this.padZero(this.internalSeconds), min: 0, max: 59, onInput: this.handleSecondChange, disabled: this.disabled, "aria-label": this.labels.seconds }), h("button", { key: '7b82e86f2da4bd5c0f65c95cbcb26252e357625d', type: "button", class: `${this.elementClassName}__button ${this.elementClassName}__button--decrement`, onClick: this.handleSecondDecrement, disabled: this.disabled || this.isAtMinSecond(), "aria-label": this.labels.decrementSeconds }, h("svg", { key: 'c3b5ae33c5475b448c1a5e7fe3bb4748318441fb', fill: "none", height: "16", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", stroke: "currentColor", viewBox: "0 0 24 24", width: "16" }, h("polyline", { key: '3bb717320e078f5fa36912f15995ed604d9f702b', points: "6 9 12 15 18 9" })))))
|
|
261
|
+
], this.useTwelveHourFormat && (h("div", { key: 'ec583890c2f7d97c6a6196f3556dfd76c8209227', class: `${this.elementClassName}__period` }, h("button", { key: 'e99d9b41ded6b138660f2777f60991bf3af12182', type: "button", class: {
|
|
190
262
|
[`${this.elementClassName}__period-button`]: true,
|
|
191
263
|
[`${this.elementClassName}__period-button--active`]: this.period === "AM"
|
|
192
|
-
}, onClick: () => this.handlePeriodChange("AM"), disabled: this.disabled, "aria-label": this.labels.am, "aria-pressed": this.period === "AM" }, this.labels.am), h("button", { key: '
|
|
264
|
+
}, onClick: () => this.handlePeriodChange("AM"), disabled: this.disabled, "aria-label": this.labels.am, "aria-pressed": this.period === "AM" }, this.labels.am), h("button", { key: '3a3cbc3b47b0218694db2c8909da97ea50e521f2', type: "button", class: {
|
|
193
265
|
[`${this.elementClassName}__period-button`]: true,
|
|
194
266
|
[`${this.elementClassName}__period-button--active`]: this.period === "PM"
|
|
195
267
|
}, onClick: () => this.handlePeriodChange("PM"), disabled: this.disabled, "aria-label": this.labels.pm, "aria-pressed": this.period === "PM" }, this.labels.pm))))));
|
|
@@ -381,6 +453,52 @@ export class TabworthyTimesPicker {
|
|
|
381
453
|
"reflect": false,
|
|
382
454
|
"attribute": "element-class-name",
|
|
383
455
|
"defaultValue": "\"tabworthy-times-picker\""
|
|
456
|
+
},
|
|
457
|
+
"minTime": {
|
|
458
|
+
"type": "unknown",
|
|
459
|
+
"mutable": false,
|
|
460
|
+
"complexType": {
|
|
461
|
+
"original": "TimeBounds",
|
|
462
|
+
"resolved": "TimeBounds",
|
|
463
|
+
"references": {
|
|
464
|
+
"TimeBounds": {
|
|
465
|
+
"location": "local",
|
|
466
|
+
"path": "/home/runner/work/tabworthy-components/tabworthy-components/src/components/tabworthy-times-picker/tabworthy-times-picker.tsx",
|
|
467
|
+
"id": "src/components/tabworthy-times-picker/tabworthy-times-picker.tsx::TimeBounds"
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
},
|
|
471
|
+
"required": false,
|
|
472
|
+
"optional": true,
|
|
473
|
+
"docs": {
|
|
474
|
+
"tags": [],
|
|
475
|
+
"text": ""
|
|
476
|
+
},
|
|
477
|
+
"getter": false,
|
|
478
|
+
"setter": false
|
|
479
|
+
},
|
|
480
|
+
"maxTime": {
|
|
481
|
+
"type": "unknown",
|
|
482
|
+
"mutable": false,
|
|
483
|
+
"complexType": {
|
|
484
|
+
"original": "TimeBounds",
|
|
485
|
+
"resolved": "TimeBounds",
|
|
486
|
+
"references": {
|
|
487
|
+
"TimeBounds": {
|
|
488
|
+
"location": "local",
|
|
489
|
+
"path": "/home/runner/work/tabworthy-components/tabworthy-components/src/components/tabworthy-times-picker/tabworthy-times-picker.tsx",
|
|
490
|
+
"id": "src/components/tabworthy-times-picker/tabworthy-times-picker.tsx::TimeBounds"
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
},
|
|
494
|
+
"required": false,
|
|
495
|
+
"optional": true,
|
|
496
|
+
"docs": {
|
|
497
|
+
"tags": [],
|
|
498
|
+
"text": ""
|
|
499
|
+
},
|
|
500
|
+
"getter": false,
|
|
501
|
+
"setter": false
|
|
384
502
|
}
|
|
385
503
|
};
|
|
386
504
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as t,H as e,c as i,h as s,d as a,t as n}from"./p-BiJ0HZVY.js";function h(t,e){const i=new Date(t);return i.setDate(i.getDate()+e),i}function o(t){return k(new Date(`${w(t)}-${String(c(t)).padStart(2,"0")}-01`))}function r(t){return function(t){if(t instanceof Date)return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}(t)}function d(t){const e=o(t);return e.setMonth(e.getMonth()+1),e.setDate(e.getDate()-1),e}function c(t){return t.getMonth()+1}function l(t){return h(t,1)}function u(t){const e=new Date(t);return e.setMonth(e.getMonth()+1),e}function b(t){const e=new Date(t);return e.setFullYear(e.getFullYear()+1),e}function f(t){return g(t,1)}function v(t){const e=new Date(t);return e.setMonth(e.getMonth()-1),e}function y(t){const e=new Date(t);return e.setFullYear(e.getFullYear()-1),e}function w(t){return t.getFullYear()}function p(t,e){return!(!t||!e)&&t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()&&t.getDate()===e.getDate()}function k(t){const e=new Date(t);return e.setMinutes(e.getMinutes()+e.getTimezoneOffset()),e}function m(t){const e=t.includes("T")||/\d{4}-\d{2}-\d{2}\s\d{2}:/.test(t),i=new Date(t);return e?i:k(i)}function g(t,e){const i=new Date(t);return i.setDate(i.getDate()-e),i}function D(t,e){if(e){const i=m(e);return t>=i||p(i,t)}return!0}function C(t,e){if(e){const i=m(e);return t<=i||p(t,i)}return!0}function B(t,e,i){return D(t,e)&&C(t,i)}function $(t,e,i,s){if(i){const s=m(i),a=s.getFullYear(),n=s.getMonth();if(e<a||e===a&&t<n)return!0}if(s){const i=m(s),a=i.getFullYear(),n=i.getMonth();if(e>a||e===a&&t>n)return!0}return!1}function x(t){if(null==t.match(/^\d{4}-\d{2}-\d{2}$/))return!1;var e=new Date(t);return!isNaN(e.getTime())}function S(t){var e=t.match(/\d{4}-\d{2}-\d{2}/g);return null==e?void 0:e.slice(0,2)}const M={clearButton:"Clear value",closeButton:"Close",monthSelect:"Select month",nextMonthButton:"Next month",nextYearButton:"Next year",picker:"Choose date",previousMonthButton:"Previous month",previousYearButton:"Previous year",todayButton:"Show today",yearSelect:"Select year",keyboardHint:"Keyboard commands",selected:"Selected date",chooseAsStartDate:"choose as start date",chooseAsEndDate:"choose as end date"},Z=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.selectDate=i(this,"selectDate",3),this.changeMonth=i(this,"changeMonth",3),this.changeYear=i(this,"changeYear",3),this.requestClose=i(this,"requestClose",3),this.disabled=!1,this.modalIsOpen=!1,this.disableDate=()=>!1,this.elementClassName="tabworthy-dates-calendar",this.firstDayOfWeek=0,this.range=!1,this.labels=M,this.locale=(null===navigator||void 0===navigator?void 0:navigator.language)||"en-US",this.inline=!1,this.showClearButton=!1,this.showCloseButton=!1,this.showMonthStepper=!0,this.showTodayButton=!0,this.showYearStepper=!1,this.showKeyboardHint=!1,this.showHiddenTitle=!0,this.startDate=r(new Date),this.init=()=>{this.currentDate=this.startDate?k(new Date(this.startDate)):new Date,this.updateWeekdays()},this.nextMonth=()=>{const t=u(this.currentDate);this.disabled||$(t.getMonth(),t.getFullYear(),this.minDate,this.maxDate)||this.updateCurrentDate(t)},this.nextYear=()=>{const t=b(this.currentDate);this.disabled||this.maxDate&&m(this.maxDate).getFullYear()<t.getFullYear()||this.updateCurrentDate(t,!1,!0)},this.previousMonth=()=>{const t=v(this.currentDate);this.disabled||$(t.getMonth(),t.getFullYear(),this.minDate,this.maxDate)||this.updateCurrentDate(t)},this.previousYear=()=>{const t=y(this.currentDate);this.disabled||this.minDate&&m(this.minDate).getFullYear()>t.getFullYear()||this.updateCurrentDate(t,!1,!0)},this.showToday=()=>{this.updateCurrentDate(new Date,!0)},this.clear=()=>{var t;this.value=void 0,null===(t=this.selectDate)||void 0===t||t.emit(void 0)},this.onClick=t=>{if(this.disabled)return;const e=t.target.closest("[data-date]");if(!Boolean(e))return;const i=k(new Date(e.dataset.date));this.updateCurrentDate(i),this.onSelectDate(i)},this.onMonthSelect=t=>{const e=+t.target.value-1,i=new Date(this.currentDate);B(i,this.minDate,this.maxDate)&&(i.setMonth(e),this.updateCurrentDate(i))},this.onYearSelect=t=>{var e;const i=+t.target.value,s=new Date(this.currentDate);B(s,this.minDate,this.maxDate)&&(s.setFullYear(i),null===(e=this.changeYear)||void 0===e||e.emit({year:i}),this.updateCurrentDate(s))},this.onKeyDown=t=>{this.disabled||("ArrowLeft"===t.code?(t.preventDefault(),this.updateCurrentDate(f(this.currentDate),!0)):"ArrowRight"===t.code?(t.preventDefault(),this.updateCurrentDate(l(this.currentDate),!0)):"ArrowUp"===t.code?(t.preventDefault(),this.updateCurrentDate(g(this.currentDate,7),!0)):"ArrowDown"===t.code?(t.preventDefault(),this.updateCurrentDate(h(this.currentDate,7),!0)):"PageUp"===t.code?(t.preventDefault(),this.updateCurrentDate(t.shiftKey?y(this.currentDate):v(this.currentDate),!0)):"PageDown"===t.code?(t.preventDefault(),this.updateCurrentDate(t.shiftKey?b(this.currentDate):u(this.currentDate),!0)):"Home"===t.code?(t.preventDefault(),this.updateCurrentDate(o(this.currentDate),!0)):"End"===t.code?(t.preventDefault(),this.updateCurrentDate(d(this.currentDate),!0)):"Space"!==t.code&&"Enter"!==t.code||(t.preventDefault(),this.onSelectDate(this.currentDate)))},this.onMouseEnter=t=>{var e;if(this.disabled)return;const i=k(new Date(null===(e=t.target.closest("td"))||void 0===e?void 0:e.dataset.date));this.hoveredDate=i},this.onMouseLeave=()=>{this.hoveredDate=void 0},this.close=()=>{var t;null===(t=this.requestClose)||void 0===t||t.emit()}}componentWillLoad(){this.init()}watchModalIsOpen(){!0===this.modalIsOpen&&(this.moveFocusOnModalOpen=!0)}watchFirstDayOfWeek(){this.updateWeekdays()}watchLocale(){Boolean(this.locale)||(this.locale=(null===navigator||void 0===navigator?void 0:navigator.language)||"en-US"),this.updateWeekdays()}watchRange(){var t;this.value=void 0,null===(t=this.selectDate)||void 0===t||t.emit(void 0)}watchStartDate(){this.currentDate=this.startDate?k(new Date(this.startDate)):new Date}watchValue(){Boolean(this.value)&&(Array.isArray(this.value)&&this.value.length>=1?this.currentDate=this.value[0]:this.value instanceof Date&&(this.currentDate=this.value))}componentDidRender(){this.moveFocusAfterMonthChanged&&(this.focusDate(this.currentDate),this.moveFocusAfterMonthChanged=!1),this.moveFocusOnModalOpen&&setTimeout((()=>{this.focusDate(this.currentDate),this.moveFocusOnModalOpen=!1}),100)}updateWeekdays(){var t,e;this.weekdays=(t=this.firstDayOfWeek,e=this.locale,new Array(7).fill(void 0).map(((e,i)=>(t+i)%7+1)).map((t=>{const i=new Date(2006,0,t);return[Intl.DateTimeFormat(e,{weekday:"short"}).format(i),Intl.DateTimeFormat(e,{weekday:"long"}).format(i)]})))}getClassName(t){return Boolean(t)?`${this.elementClassName}__${t}`:this.elementClassName}getCalendarRows(){const t=function(t,e,i){const s=[],a=o(t),n=0===a.getDay()?7:a.getDay(),h=d(t),r=0===h.getDay()?7:h.getDay(),c=1===i?7:i-1,u=[],b=[];{let t=(7-i+n)%7,e=f(a);for(;t>0;)u.push(e),e=f(e),t-=1;u.reverse();let s=(7-r+c)%7,o=l(h);for(;s>0;)b.push(o),o=l(o),s-=1}let v=a;for(;v.getMonth()===t.getMonth();)s.push(v),v=l(v);return[...u,...s,...b]}(this.currentDate,0,0===this.firstDayOfWeek?7:this.firstDayOfWeek),e=[];for(let i=0;i<t.length;i+=7){const s=t.slice(i,i+7);e.push(s)}const i=e[e.length-1];let s=null==i?void 0:i[i.length-1];for(;e.length<6&&s;){const t=[];for(let e=0;e<7;e+=1)s=h(s,1),t.push(s);e.push(t)}return e}getTitle(){if(Boolean(this.currentDate))return Intl.DateTimeFormat(this.locale,{month:"long",year:"numeric"}).format(this.currentDate)}focusDate(t){var e;t&&(null===(e=this.el.querySelector(`[data-date="${r(t)}"]`))||void 0===e||e.focus())}updateCurrentDate(t,e,i=!1){var s,a,n;const h=t.getMonth(),o=t.getFullYear();D(t,this.minDate)||(t=m(this.minDate)),C(t,this.maxDate)||(t=m(this.maxDate)),(h!==(null===(s=this.currentDate)||void 0===s?void 0:s.getMonth())||o!==this.currentDate.getFullYear())&&(null===(a=this.changeMonth)||void 0===a||a.emit({month:c(t),year:w(t)}),e&&(this.moveFocusAfterMonthChanged=!0)),this.currentDate=t,e&&this.focusDate(this.currentDate),i&&(null===(n=this.changeYear)||void 0===n||n.emit({year:w(t)}))}onSelectDate(t){var e,i,s,a;if(!this.disableDate(t)&&B(t,this.minDate,this.maxDate))if(this.isRangeValue(this.value)){const s=void 0===(null===(e=this.value)||void 0===e?void 0:e[0])||2===this.value.length?[t]:[this.value[0],t];2===s.length&&s[0]>s[1]&&s.reverse();const a=void 0===s[1]?[r(s[0])]:[r(s[0]),r(s[1])];this.value=s,null===(i=this.selectDate)||void 0===i||i.emit(a)}else{if((null===(s=this.value)||void 0===s?void 0:s.getTime())===t.getTime())return;this.value=t,null===(a=this.selectDate)||void 0===a||a.emit(r(t))}}isRangeValue(t){return!!this.range}render(){var t;const e=this.showTodayButton||this.showClearButton||this.showCloseButton||this.showKeyboardHint,i={year:{prev:this.disabled||!!this.minDate&&m(this.minDate).getFullYear()>y(this.currentDate).getFullYear(),next:this.disabled||!!this.maxDate&&m(this.maxDate).getFullYear()<b(this.currentDate).getFullYear()},month:{prev:this.disabled||$(v(this.currentDate).getMonth(),v(this.currentDate).getFullYear(),this.minDate,this.maxDate),next:this.disabled||$(u(this.currentDate).getMonth(),u(this.currentDate).getFullYear(),this.minDate,this.maxDate)}};return s(a,{key:"60e2a56f8a1aadceb57d7f445098060293a0f937"},s("div",{key:"12fd35c03b0c34e4ad88e4e491fcc685de5f09b2",class:{[`${this.getClassName()}-wrapper`]:!0,[`${this.getClassName()}-wrapper--inline`]:this.inline}},s("div",{key:"ad36d1e260a7a89110c53fc86e339eb5a259a4fc",class:{[this.getClassName()]:!0,[`${this.getClassName()}--disabled`]:this.disabled}},s("div",{key:"181b9ed0a6a9d6073d67f270d6b14efc28f6a6b2",class:this.getClassName("header")},this.showHiddenTitle&&s("span",{key:"580656924dc3ba028458591399791423797d58d7","aria-atomic":"true","aria-live":"polite",class:"visually-hidden"},this.getTitle()),this.showYearStepper&&s("button",{key:"7822100c140418bc3cb65ae39a32a3ebc1f53bc2","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:"9408d89cf59c268c3e44801297f1a7776a594539",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:"b9108784891de5eb7acef5c14425e90c25fc514a",points:"11 17 6 12 11 7"}),s("polyline",{key:"a2fbabe46f6a0584d5c4b54296b9db13e979c818",points:"18 17 13 12 18 7"}))),this.showMonthStepper&&s("button",{key:"8e515d4fa9fde9f0e16fc2ff5629049039df09e0","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:"5248668ca2f843102193fb57beb8a3a4b4edbb96",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:"021c514ec8fb801fd0d3dbf250fc8d55b9c9ef08",points:"15 18 9 12 15 6"}))),s("span",{key:"8fab6b75376e1399b6ea07e3545ddcfa3eb120d8",class:this.getClassName("current-month")},s("select",{key:"01f8fbd5a76c91b0bf121c2589af72860abe2a22","aria-label":this.labels.monthSelect,class:this.getClassName("month-select"),"aria-disabled":this.disabled,name:"month",onChange:this.onMonthSelect},(n=this.locale,new Array(12).fill(void 0).map(((t,e)=>{const i=k(new Date(`2006-${String(e+1).padStart(2,"0")}-01`));return Intl.DateTimeFormat(n,{month:"long"}).format(i)}))).map(((t,e)=>s("option",{key:t,selected:this.currentDate.getMonth()===e,value:e+1,disabled:$(e,this.currentDate.getFullYear(),this.minDate,this.maxDate)},t)))),s("input",{key:"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&&s("button",{key:"9ad3e382b769ada1ecb746a55c37c54d0c6b06e1","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:"7ecdf33b13950c8972b5b3a66bd086f700967fad",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:"78768373bb23d06e8babd79a77fb0a899ea5e942",points:"9 18 15 12 9 6"}))),this.showYearStepper&&s("button",{key:"ab920b5dbdf0bf6000c58718d0d3a0e9a31bbebd","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:"7f5c83e6333e6c33984961722c855f2609e0999e",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:"dd3eed1b08d0373a089beb91eb9cb6b62b477b3b",points:"13 17 18 12 13 7"}),s("polyline",{key:"fa989db37ceaf95817aef623770b895b3c10d0b4",points:"6 17 11 12 6 7"})))),s("div",{key:"5b41060ca782df39e19ba35ec71d4425ae5c3a2a",class:this.getClassName("body")},s("table",{key:"357337fd3a5f05cc204982682c99f99c46dd4b29",class:this.getClassName("calendar"),onKeyDown:this.onKeyDown,role:"grid","aria-label":this.getTitle()},s("thead",{key:"8fa7ecfada004b39dd406eb9079de3eab66fe298",class:this.getClassName("calendar-header")},s("tr",{key:"364f6021007700c2da60082fca32e4896e071ccd",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:"e0269bd5bfe1310a8950635441edc472e3a5f413"},this.getCalendarRows().map((t=>{const e=`row-${t[0].getMonth()}-${t[0].getDate()}`;return s("tr",{class:this.getClassName("calendar-row"),key:e},t.map((t=>{var e,i,a;const n=p(t,this.currentDate),h=t.getMonth()!==(null===(e=this.currentDate)||void 0===e?void 0:e.getMonth()),o=Array.isArray(this.value)?p(t,this.value[0])||this.value[1]&&B(t,r(this.value[0]),r(this.value[1])):p(t,this.value),d=this.disableDate(t)||!B(t,this.minDate,this.maxDate),c=!!this.isRangeValue(this.value)&&(u={from:null===(i=this.value)||void 0===i?void 0:i[0],to:(null===(a=this.value)||void 0===a?void 0:a[1])||this.hoveredDate||this.currentDate},!!((l=t)&&u&&u.from&&u.to)&&l>=(u.from<u.to?u.from:u.to)&&l<=(u.from<u.to?u.to:u.from)&&!d);var l,u;const b=p(t,new Date),f=`cell-${t.getMonth()}-${t.getDate()}`,v={[this.getClassName("date")]:!0,[this.getClassName("date--current")]:n,[this.getClassName("date--disabled")]:d,[this.getClassName("date--overflowing")]:h,[this.getClassName("date--today")]:b,[this.getClassName("date--selected")]:o,[this.getClassName("date--in-range")]:c},y=o?"strong":b?"em":"span";return s("td",{"aria-disabled":String(d),"aria-selected":o?"true":void 0,class:v,"data-date":r(t),key:f,onClick:this.onClick,onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,role:"gridcell",tabIndex:p(t,this.currentDate)&&!this.disabled?0:-1},s(y,{"aria-hidden":"true"},t.getDate()),s("span",{class:"visually-hidden"},(()=>{if(this.range){let e=this.value?"":`, ${this.labels.chooseAsStartDate}.`;return Array.isArray(this.value)&&(e={1:`, ${this.labels.chooseAsEndDate}.`,2:`, ${this.labels.chooseAsStartDate}.`}[this.value.length]),`${o?`${this.labels.selected}, `:""}${Intl.DateTimeFormat(this.locale,{day:"numeric",month:"long",year:"numeric"}).format(t)}${e}`}return`${o?`${this.labels.selected}, `:""}${Intl.DateTimeFormat(this.locale,{day:"numeric",month:"long",year:"numeric"}).format(t)}`})()))})))}))))),e&&s("div",{key:"4d18b821b06e4eb7fd2f1a1210fcab01d3acdd00",class:this.getClassName("footer")},s("div",{key:"fec534b0bff03bfe3e15a8842abbcca9b57e9a1c",class:this.getClassName("footer-buttons")},this.showTodayButton&&s("button",{key:"0d8aed7413f313c2ab6aa9a634093de1d46cd7ce","aria-label":this.todayButtonContent?this.labels.todayButton:void 0,class:this.getClassName("today-button"),disabled:this.disabled,innerHTML:this.todayButtonContent||void 0,onClick:this.showToday,type:"button"},!this.todayButtonContent&&this.labels.todayButton),this.showClearButton&&s("button",{key:"176c535cb85d6b95d40324a55aa11e1bc2faaa61","aria-label":this.clearButtonContent?this.labels.clearButton:void 0,class:this.getClassName("clear-button"),disabled:this.disabled,innerHTML:this.clearButtonContent||void 0,onClick:this.clear,type:"button"},!this.clearButtonContent&&this.labels.clearButton),this.showCloseButton&&s("button",{key:"cea15baf92edabea6841510459c6b05ebfaf81fa","aria-label":this.closeButtonContent?this.labels.closeButton:void 0,class:this.getClassName("close-button"),disabled:this.disabled,innerHTML:this.closeButtonContent||void 0,onClick:this.close,type:"button"},!this.closeButtonContent&&this.labels.closeButton)),this.showKeyboardHint&&!window.matchMedia("(pointer: coarse)").matches&&s("button",{key:"51a48353fbb94243d93047141e26b8c8ef5545b2",type:"button",onClick:()=>alert("Todo: Add Keyboard helper!"),class:this.getClassName("keyboard-hint")},s("svg",{key:"2991aa978689e3a0bd4c795a8629451e252ccf41",xmlns:"http://www.w3.org/2000/svg",height:"1em",width:"1em",viewBox:"0 0 48 48",fill:"currentColor"},s("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))),s("slot",{key:"86e8fb8907bf11951461baaf41f92b29ce0cc413",name:"after-calendar"})));var n}get el(){return this}static get watchers(){return{modalIsOpen:[{watchModalIsOpen:0}],firstDayOfWeek:[{watchFirstDayOfWeek:0}],locale:[{watchLocale:0}],range:[{watchRange:0}],startDate:[{watchStartDate:0}],value:[{watchValue:0}]}}static get style(){return".visually-hidden.sc-tabworthy-dates-calendar{position:absolute;overflow:hidden;width:1px;height:1px;white-space:nowrap;clip:rect(0 0 0 0);-webkit-clip-path:inset(50%);clip-path:inset(50%)}"}},[262,"tabworthy-dates-calendar",{clearButtonContent:[1,"clear-button-content"],closeButtonContent:[1,"close-button-content"],disabled:[4],modalIsOpen:[4,"modal-is-open"],disableDate:[16],elementClassName:[1,"element-class-name"],firstDayOfWeek:[2,"first-day-of-week"],range:[4],labels:[16],locale:[1],nextMonthButtonContent:[1,"next-month-button-content"],nextYearButtonContent:[1,"next-year-button-content"],previousMonthButtonContent:[1,"previous-month-button-content"],previousYearButtonContent:[1,"previous-year-button-content"],minDate:[1,"min-date"],maxDate:[1,"max-date"],inline:[4],showClearButton:[4,"show-clear-button"],showCloseButton:[4,"show-close-button"],showMonthStepper:[4,"show-month-stepper"],showTodayButton:[4,"show-today-button"],showYearStepper:[4,"show-year-stepper"],showKeyboardHint:[4,"show-keyboard-hint"],showHiddenTitle:[4,"show-hidden-title"],startDate:[1,"start-date"],todayButtonContent:[1,"today-button-content"],value:[1040],currentDate:[32],hoveredDate:[32],weekdays:[32]},void 0,{modalIsOpen:[{watchModalIsOpen:0}],firstDayOfWeek:[{watchFirstDayOfWeek:0}],locale:[{watchLocale:0}],range:[{watchRange:0}],startDate:[{watchStartDate:0}],value:[{watchValue:0}]}]);function H(){"undefined"!=typeof customElements&&["tabworthy-dates-calendar"].forEach((t=>{"tabworthy-dates-calendar"===t&&(customElements.get(n(t))||customElements.define(n(t),Z))}))}export{Z as T,D as a,C as b,H as c,B as d,S as e,r as g,x as i,m as p,k as r}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as t,H as s,c as i,h as e,d as h,t as n}from"./p-BiJ0HZVY.js";const a={hours:"Hours",minutes:"Minutes",seconds:"Seconds",am:"AM",pm:"PM",timePicker:"Time picker",incrementHours:"Increment hours",decrementHours:"Decrement hours",incrementMinutes:"Increment minutes",decrementMinutes:"Decrement minutes",incrementSeconds:"Increment seconds",decrementSeconds:"Decrement seconds"},o=t(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.timeChanged=i(this,"timeChanged",7),this.hours=12,this.minutes=0,this.seconds=0,this.useTwelveHourFormat=!1,this.showSeconds=!1,this.labels=a,this.labelsSrOnly=!0,this.disabled=!1,this.elementClassName="tabworthy-times-picker",this.internalHours=this.hours,this.internalMinutes=this.minutes,this.internalSeconds=this.seconds,this.period=this.hours>=12?"PM":"AM",this.handleHourChange=t=>{const s=parseInt(t.target.value,10);isNaN(s)||(this.internalHours=this.useTwelveHourFormat?"AM"===this.period?12===s?0:s:12===s?12:s+12:s,this.emitTimeChange())},this.handleMinuteChange=t=>{const s=parseInt(t.target.value,10);isNaN(s)||(this.internalMinutes=s,this.emitTimeChange())},this.handlePeriodChange=t=>{if(this.period===t||!this.useTwelveHourFormat)return;this.period=t;const s=this.getDisplayHours();this.internalHours="AM"===t?12===s?0:s:12===s?12:s+12,this.emitTimeChange()},this.handleHourIncrement=()=>{if(this.useTwelveHourFormat){const t=this.getDisplayHours(),s=12===t?1:t+1;this.internalHours="AM"===this.period?12===s?0:s:12===s?12:s+12}else this.internalHours=(this.internalHours+1)%24;this.emitTimeChange()},this.handleHourDecrement=()=>{if(this.useTwelveHourFormat){const t=this.getDisplayHours(),s=1===t?12:t-1;this.internalHours="AM"===this.period?12===s?0:s:12===s?12:s+12}else this.internalHours=0===this.internalHours?23:this.internalHours-1;this.emitTimeChange()},this.handleMinuteIncrement=()=>{this.internalMinutes=(this.internalMinutes+1)%60,this.emitTimeChange()},this.handleMinuteDecrement=()=>{this.internalMinutes=0===this.internalMinutes?59:this.internalMinutes-1,this.emitTimeChange()},this.handleSecondChange=t=>{const s=parseInt(t.target.value,10);isNaN(s)||(this.internalSeconds=s,this.emitTimeChange())},this.handleSecondIncrement=()=>{this.internalSeconds=(this.internalSeconds+1)%60,this.emitTimeChange()},this.handleSecondDecrement=()=>{this.internalSeconds=0===this.internalSeconds?59:this.internalSeconds-1,this.emitTimeChange()}}watchHours(t){this.internalHours=t,this.period=t>=12?"PM":"AM"}watchMinutes(t){this.internalMinutes=t}watchSeconds(t){this.internalSeconds=t}componentWillLoad(){this.internalHours=this.hours,this.internalMinutes=this.minutes,this.internalSeconds=this.seconds,this.period=this.hours>=12?"PM":"AM"}getDisplayHours(){return this.useTwelveHourFormat?0===this.internalHours?12:this.internalHours>12?this.internalHours-12:this.internalHours:this.internalHours}get24HourValue(){if(!this.useTwelveHourFormat)return this.internalHours;const t=this.getDisplayHours();return"AM"===this.period?12===t?0:t:12===t?12:t+12}emitTimeChange(){this.clampToBounds(),this.timeChanged.emit({hours:this.get24HourValue(),minutes:this.internalMinutes,seconds:this.showSeconds?this.internalSeconds:void 0,period:this.useTwelveHourFormat?this.period:void 0})}clampToBounds(){var t,s;const i=this.get24HourValue(),e=this.internalMinutes;if(this.minTime){const s=null!==(t=this.minTime.seconds)&&void 0!==t?t:0;(i<this.minTime.hours||i===this.minTime.hours&&e<this.minTime.minutes||i===this.minTime.hours&&e===this.minTime.minutes&&this.internalSeconds<s)&&(this.setInternal24Hours(this.minTime.hours),this.internalMinutes=this.minTime.minutes,this.internalSeconds=s)}if(this.maxTime){const t=null!==(s=this.maxTime.seconds)&&void 0!==s?s:59,i=this.get24HourValue(),e=this.internalMinutes;(i>this.maxTime.hours||i===this.maxTime.hours&&e>this.maxTime.minutes||i===this.maxTime.hours&&e===this.maxTime.minutes&&this.internalSeconds>t)&&(this.setInternal24Hours(this.maxTime.hours),this.internalMinutes=this.maxTime.minutes,this.internalSeconds=t)}}setInternal24Hours(t){this.internalHours=t,this.period=t>=12?"PM":"AM"}isAtMinHour(){return!!this.minTime&&this.get24HourValue()<=this.minTime.hours}isAtMaxHour(){return!!this.maxTime&&this.get24HourValue()>=this.maxTime.hours}isAtMinMinute(){return this.isAtMinHour()&&!!this.minTime&&this.internalMinutes<=this.minTime.minutes}isAtMaxMinute(){return this.isAtMaxHour()&&!!this.maxTime&&this.internalMinutes>=this.maxTime.minutes}isAtMinSecond(){var t;return this.isAtMinMinute()&&!!this.minTime&&this.internalSeconds<=(null!==(t=this.minTime.seconds)&&void 0!==t?t:0)}isAtMaxSecond(){var t;return this.isAtMaxMinute()&&!!this.maxTime&&this.internalSeconds>=(null!==(t=this.maxTime.seconds)&&void 0!==t?t:59)}padZero(t){return t.toString().padStart(2,"0")}render(){const t=this.getDisplayHours(),s=this.useTwelveHourFormat?12:23,i=this.useTwelveHourFormat?1:0;return e(h,{key:"190cabad78886b1902d70c42c6c5b1f4ee90e5fe",class:this.elementClassName,"aria-label":this.labels.timePicker},e("div",{key:"98b3d39baf501aeb9894949e807a365e26253fbc",class:`${this.elementClassName}__container`},e("div",{key:"6697b77b177164a36297f911572d89beaa01cf23",class:`${this.elementClassName}__field`},e("label",{key:"43f6e821b49f19041422741840439081f819f71c",htmlFor:`${this.elementClassName}-hours`,class:{[`${this.elementClassName}__label`]:!0,[`${this.elementClassName}__label--sr-only`]:this.labelsSrOnly}},this.labels.hours),e("div",{key:"a0e177ded2a849c22e41dbca95bad0888f7f956c",class:`${this.elementClassName}__control`},e("button",{key:"b12c268cc84f11ee078ba9285ae6d9cc605761e4",type:"button",class:`${this.elementClassName}__button ${this.elementClassName}__button--increment`,onClick:this.handleHourIncrement,disabled:this.disabled||this.isAtMaxHour(),"aria-label":this.labels.incrementHours},e("svg",{key:"598eff59b528ec28a0e5b34924e77a4f632ba6ca",fill:"none",height:"16","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"16"},e("polyline",{key:"279b80304fc77a2fd74e26a2aba89f12155f9334",points:"18 15 12 9 6 15"}))),e("input",{key:"93f17e7c848d40bd513ad7af9f29d39586391573",id:`${this.elementClassName}-hours`,type:"number",class:`${this.elementClassName}__input`,value:this.padZero(t),min:i,max:s,onInput:this.handleHourChange,disabled:this.disabled,"aria-label":this.labels.hours}),e("button",{key:"ba8f6463ee850c6349cad839eb851c67e0cb4d1e",type:"button",class:`${this.elementClassName}__button ${this.elementClassName}__button--decrement`,onClick:this.handleHourDecrement,disabled:this.disabled||this.isAtMinHour(),"aria-label":this.labels.decrementHours},e("svg",{key:"21e585fbd6a9aa2b957e817ec55ab2ec01cf2fc4",fill:"none",height:"16","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"16"},e("polyline",{key:"742b64bddf3873a7bea1c10ed93b9b1e99588ede",points:"6 9 12 15 18 9"}))))),e("div",{key:"f81f40c465cc84a5d02b9904631d3d24e33150e3",class:`${this.elementClassName}__separator`},":"),e("div",{key:"d028bae721c1c9c2cc7290cd19f7050a901f4a4e",class:`${this.elementClassName}__field`},e("label",{key:"3c88a3fa04ed2a65f72c48ded459e19d580f9c36",htmlFor:`${this.elementClassName}-minutes`,class:{[`${this.elementClassName}__label`]:!0,[`${this.elementClassName}__label--sr-only`]:this.labelsSrOnly}},this.labels.minutes),e("div",{key:"dbd89633addd003b2e42414b587d03a6e65e9239",class:`${this.elementClassName}__control`},e("button",{key:"b113074a58889691dd5452a6353b691336f5ae14",type:"button",class:`${this.elementClassName}__button ${this.elementClassName}__button--increment`,onClick:this.handleMinuteIncrement,disabled:this.disabled||this.isAtMaxMinute(),"aria-label":this.labels.incrementMinutes},e("svg",{key:"0d724c0e5110dd29ab4cedc005595d4e57fd3d06",fill:"none",height:"16","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"16"},e("polyline",{key:"dbc89190f6fe10bb8c8074252b83ab3397112de4",points:"18 15 12 9 6 15"}))),e("input",{key:"65a9a61218d443676a8a2d03d4922b2303a484c5",id:`${this.elementClassName}-minutes`,type:"number",class:`${this.elementClassName}__input`,value:this.padZero(this.internalMinutes),min:0,max:59,onInput:this.handleMinuteChange,disabled:this.disabled,"aria-label":this.labels.minutes}),e("button",{key:"3f72a62add15d9288b421b84e791ba40b9acf569",type:"button",class:`${this.elementClassName}__button ${this.elementClassName}__button--decrement`,onClick:this.handleMinuteDecrement,disabled:this.disabled||this.isAtMinMinute(),"aria-label":this.labels.decrementMinutes},e("svg",{key:"04eef7d1d332459e5191962c411aa9c83ace8b84",fill:"none",height:"16","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"16"},e("polyline",{key:"56045b19ec716a82f21406b647762ba0efcd8170",points:"6 9 12 15 18 9"}))))),this.showSeconds&&[e("div",{key:"9c2619ccebd147e626e10a21fb1a5fa1268128f3",class:`${this.elementClassName}__separator`},":"),e("div",{key:"dea8135d47a06d9624b480aa6123350a0899ca02",class:`${this.elementClassName}__field`},e("label",{key:"afaa88b59df63091088620ff2a49bf8472f4401f",htmlFor:`${this.elementClassName}-seconds`,class:{[`${this.elementClassName}__label`]:!0,[`${this.elementClassName}__label--sr-only`]:this.labelsSrOnly}},this.labels.seconds),e("div",{key:"c2ed4d63a95a65bdc26926932e705744bbe776c5",class:`${this.elementClassName}__control`},e("button",{key:"40d510ae7008802ce09ec98c9912f2f91cdb2db7",type:"button",class:`${this.elementClassName}__button ${this.elementClassName}__button--increment`,onClick:this.handleSecondIncrement,disabled:this.disabled||this.isAtMaxSecond(),"aria-label":this.labels.incrementSeconds},e("svg",{key:"fd3324d15759c7f2a752b6a32303c8eaddb0e588",fill:"none",height:"16","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"16"},e("polyline",{key:"5e2dad75d96a521f56f616bc2b88e4baa6c0eb50",points:"18 15 12 9 6 15"}))),e("input",{key:"b1b517bb8147a45632388f432ae0e3595467ebce",id:`${this.elementClassName}-seconds`,type:"number",class:`${this.elementClassName}__input`,value:this.padZero(this.internalSeconds),min:0,max:59,onInput:this.handleSecondChange,disabled:this.disabled,"aria-label":this.labels.seconds}),e("button",{key:"7b82e86f2da4bd5c0f65c95cbcb26252e357625d",type:"button",class:`${this.elementClassName}__button ${this.elementClassName}__button--decrement`,onClick:this.handleSecondDecrement,disabled:this.disabled||this.isAtMinSecond(),"aria-label":this.labels.decrementSeconds},e("svg",{key:"c3b5ae33c5475b448c1a5e7fe3bb4748318441fb",fill:"none",height:"16","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"16"},e("polyline",{key:"3bb717320e078f5fa36912f15995ed604d9f702b",points:"6 9 12 15 18 9"})))))],this.useTwelveHourFormat&&e("div",{key:"ec583890c2f7d97c6a6196f3556dfd76c8209227",class:`${this.elementClassName}__period`},e("button",{key:"e99d9b41ded6b138660f2777f60991bf3af12182",type:"button",class:{[`${this.elementClassName}__period-button`]:!0,[`${this.elementClassName}__period-button--active`]:"AM"===this.period},onClick:()=>this.handlePeriodChange("AM"),disabled:this.disabled,"aria-label":this.labels.am,"aria-pressed":"AM"===this.period},this.labels.am),e("button",{key:"3a3cbc3b47b0218694db2c8909da97ea50e521f2",type:"button",class:{[`${this.elementClassName}__period-button`]:!0,[`${this.elementClassName}__period-button--active`]:"PM"===this.period},onClick:()=>this.handlePeriodChange("PM"),disabled:this.disabled,"aria-label":this.labels.pm,"aria-pressed":"PM"===this.period},this.labels.pm))))}get el(){return this}static get watchers(){return{hours:[{watchHours:0}],minutes:[{watchMinutes:0}],seconds:[{watchSeconds:0}]}}},[2,"tabworthy-times-picker",{hours:[1026],minutes:[1026],seconds:[1026],useTwelveHourFormat:[4,"use-twelve-hour-format"],showSeconds:[4,"show-seconds"],labels:[16],labelsSrOnly:[4,"labels-sr-only"],disabled:[4],elementClassName:[1,"element-class-name"],minTime:[16],maxTime:[16],internalHours:[32],internalMinutes:[32],internalSeconds:[32],period:[32]},void 0,{hours:[{watchHours:0}],minutes:[{watchMinutes:0}],seconds:[{watchSeconds:0}]}]);function c(){"undefined"!=typeof customElements&&["tabworthy-times-picker"].forEach((t=>{"tabworthy-times-picker"===t&&(customElements.get(n(t))||customElements.define(n(t),o))}))}export{o as T,c as d}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{T as o,c as s}from"./p-
|
|
1
|
+
import{T as o,c as s}from"./p-BzY8iIVW.js";const p=o,r=s;export{p as TabworthyDatesCalendar,r as defineCustomElement}
|