@tabworthy/components 0.12.3 → 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 +39 -15
- package/dist/cjs/tabworthy-dates.cjs.entry.js +52 -12
- package/dist/cjs/tabworthy-times-picker.cjs.entry.js +82 -10
- package/dist/cjs/tabworthy-times.cjs.entry.js +109 -4
- package/dist/cjs/{utils-y5Vtky2t.js → utils-DGbdK8VF.js} +29 -8
- package/dist/collection/components/tabworthy-dates/tabworthy-dates.js +148 -12
- package/dist/collection/components/tabworthy-dates-calendar/tabworthy-dates-calendar.js +39 -15
- package/dist/collection/components/tabworthy-times/tabworthy-times.js +262 -3
- 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 +39 -15
- package/dist/esm/tabworthy-dates.entry.js +52 -12
- package/dist/esm/tabworthy-times-picker.entry.js +82 -10
- package/dist/esm/tabworthy-times.entry.js +109 -4
- 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 +11 -0
- package/dist/types/components/tabworthy-times/tabworthy-times.d.ts +15 -1
- package/dist/types/components/tabworthy-times-picker/tabworthy-times-picker.d.ts +15 -0
- package/dist/types/components.d.ts +47 -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-CkD8Cvl_.js +0 -1
- package/dist/tabworthy-components/p-04240a8d.entry.js +0 -1
- package/dist/tabworthy-components/p-1743bf7a.entry.js +0 -1
- package/dist/tabworthy-components/p-744ffef9.entry.js +0 -1
- package/dist/tabworthy-components/p-8ccc0de2.entry.js +0 -1
|
@@ -36,6 +36,8 @@ const TabworthyTimesPicker = class {
|
|
|
36
36
|
this.period = this.hours >= 12 ? "PM" : "AM";
|
|
37
37
|
this.handleHourChange = (e) => {
|
|
38
38
|
const value = parseInt(e.target.value, 10);
|
|
39
|
+
if (isNaN(value))
|
|
40
|
+
return;
|
|
39
41
|
if (this.useTwelveHourFormat) {
|
|
40
42
|
// Convert to 24-hour format based on period
|
|
41
43
|
if (this.period === "AM") {
|
|
@@ -51,7 +53,10 @@ const TabworthyTimesPicker = class {
|
|
|
51
53
|
this.emitTimeChange();
|
|
52
54
|
};
|
|
53
55
|
this.handleMinuteChange = (e) => {
|
|
54
|
-
|
|
56
|
+
const value = parseInt(e.target.value, 10);
|
|
57
|
+
if (isNaN(value))
|
|
58
|
+
return;
|
|
59
|
+
this.internalMinutes = value;
|
|
55
60
|
this.emitTimeChange();
|
|
56
61
|
};
|
|
57
62
|
this.handlePeriodChange = (period) => {
|
|
@@ -111,7 +116,10 @@ const TabworthyTimesPicker = class {
|
|
|
111
116
|
this.emitTimeChange();
|
|
112
117
|
};
|
|
113
118
|
this.handleSecondChange = (e) => {
|
|
114
|
-
|
|
119
|
+
const value = parseInt(e.target.value, 10);
|
|
120
|
+
if (isNaN(value))
|
|
121
|
+
return;
|
|
122
|
+
this.internalSeconds = value;
|
|
115
123
|
this.emitTimeChange();
|
|
116
124
|
};
|
|
117
125
|
this.handleSecondIncrement = () => {
|
|
@@ -163,6 +171,7 @@ const TabworthyTimesPicker = class {
|
|
|
163
171
|
}
|
|
164
172
|
}
|
|
165
173
|
emitTimeChange() {
|
|
174
|
+
this.clampToBounds();
|
|
166
175
|
this.timeChanged.emit({
|
|
167
176
|
hours: this.get24HourValue(),
|
|
168
177
|
minutes: this.internalMinutes,
|
|
@@ -170,6 +179,69 @@ const TabworthyTimesPicker = class {
|
|
|
170
179
|
period: this.useTwelveHourFormat ? this.period : undefined
|
|
171
180
|
});
|
|
172
181
|
}
|
|
182
|
+
clampToBounds() {
|
|
183
|
+
var _a, _b;
|
|
184
|
+
const h = this.get24HourValue();
|
|
185
|
+
const m = this.internalMinutes;
|
|
186
|
+
const s = this.internalSeconds;
|
|
187
|
+
if (this.minTime) {
|
|
188
|
+
const minS = (_a = this.minTime.seconds) !== null && _a !== void 0 ? _a : 0;
|
|
189
|
+
if (h < this.minTime.hours ||
|
|
190
|
+
(h === this.minTime.hours && m < this.minTime.minutes) ||
|
|
191
|
+
(h === this.minTime.hours && m === this.minTime.minutes && s < minS)) {
|
|
192
|
+
this.setInternal24Hours(this.minTime.hours);
|
|
193
|
+
this.internalMinutes = this.minTime.minutes;
|
|
194
|
+
this.internalSeconds = minS;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
if (this.maxTime) {
|
|
198
|
+
const maxS = (_b = this.maxTime.seconds) !== null && _b !== void 0 ? _b : 59;
|
|
199
|
+
const curH = this.get24HourValue();
|
|
200
|
+
const curM = this.internalMinutes;
|
|
201
|
+
const curS = this.internalSeconds;
|
|
202
|
+
if (curH > this.maxTime.hours ||
|
|
203
|
+
(curH === this.maxTime.hours && curM > this.maxTime.minutes) ||
|
|
204
|
+
(curH === this.maxTime.hours &&
|
|
205
|
+
curM === this.maxTime.minutes &&
|
|
206
|
+
curS > maxS)) {
|
|
207
|
+
this.setInternal24Hours(this.maxTime.hours);
|
|
208
|
+
this.internalMinutes = this.maxTime.minutes;
|
|
209
|
+
this.internalSeconds = maxS;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
setInternal24Hours(h24) {
|
|
214
|
+
this.internalHours = h24;
|
|
215
|
+
this.period = h24 >= 12 ? "PM" : "AM";
|
|
216
|
+
}
|
|
217
|
+
isAtMinHour() {
|
|
218
|
+
return !!this.minTime && this.get24HourValue() <= this.minTime.hours;
|
|
219
|
+
}
|
|
220
|
+
isAtMaxHour() {
|
|
221
|
+
return !!this.maxTime && this.get24HourValue() >= this.maxTime.hours;
|
|
222
|
+
}
|
|
223
|
+
isAtMinMinute() {
|
|
224
|
+
return (this.isAtMinHour() &&
|
|
225
|
+
!!this.minTime &&
|
|
226
|
+
this.internalMinutes <= this.minTime.minutes);
|
|
227
|
+
}
|
|
228
|
+
isAtMaxMinute() {
|
|
229
|
+
return (this.isAtMaxHour() &&
|
|
230
|
+
!!this.maxTime &&
|
|
231
|
+
this.internalMinutes >= this.maxTime.minutes);
|
|
232
|
+
}
|
|
233
|
+
isAtMinSecond() {
|
|
234
|
+
var _a;
|
|
235
|
+
return (this.isAtMinMinute() &&
|
|
236
|
+
!!this.minTime &&
|
|
237
|
+
this.internalSeconds <= ((_a = this.minTime.seconds) !== null && _a !== void 0 ? _a : 0));
|
|
238
|
+
}
|
|
239
|
+
isAtMaxSecond() {
|
|
240
|
+
var _a;
|
|
241
|
+
return (this.isAtMaxMinute() &&
|
|
242
|
+
!!this.maxTime &&
|
|
243
|
+
this.internalSeconds >= ((_a = this.maxTime.seconds) !== null && _a !== void 0 ? _a : 59));
|
|
244
|
+
}
|
|
173
245
|
padZero(num) {
|
|
174
246
|
return num.toString().padStart(2, "0");
|
|
175
247
|
}
|
|
@@ -177,22 +249,22 @@ const TabworthyTimesPicker = class {
|
|
|
177
249
|
const displayHours = this.getDisplayHours();
|
|
178
250
|
const maxHours = this.useTwelveHourFormat ? 12 : 23;
|
|
179
251
|
const minHours = this.useTwelveHourFormat ? 1 : 0;
|
|
180
|
-
return (h(Host, { key: '
|
|
252
|
+
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: {
|
|
181
253
|
[`${this.elementClassName}__label`]: true,
|
|
182
254
|
[`${this.elementClassName}__label--sr-only`]: this.labelsSrOnly
|
|
183
|
-
} }, this.labels.hours), h("div", { key: '
|
|
255
|
+
} }, 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: {
|
|
184
256
|
[`${this.elementClassName}__label`]: true,
|
|
185
257
|
[`${this.elementClassName}__label--sr-only`]: this.labelsSrOnly
|
|
186
|
-
} }, this.labels.minutes), h("div", { key: '
|
|
187
|
-
h("div", { key: '
|
|
188
|
-
h("div", { key: '
|
|
258
|
+
} }, 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 && [
|
|
259
|
+
h("div", { key: '9c2619ccebd147e626e10a21fb1a5fa1268128f3', class: `${this.elementClassName}__separator` }, ":"),
|
|
260
|
+
h("div", { key: 'dea8135d47a06d9624b480aa6123350a0899ca02', class: `${this.elementClassName}__field` }, h("label", { key: 'afaa88b59df63091088620ff2a49bf8472f4401f', htmlFor: `${this.elementClassName}-seconds`, class: {
|
|
189
261
|
[`${this.elementClassName}__label`]: true,
|
|
190
262
|
[`${this.elementClassName}__label--sr-only`]: this.labelsSrOnly
|
|
191
|
-
} }, this.labels.seconds), h("div", { key: '
|
|
192
|
-
], this.useTwelveHourFormat && (h("div", { key: '
|
|
263
|
+
} }, 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" })))))
|
|
264
|
+
], this.useTwelveHourFormat && (h("div", { key: 'ec583890c2f7d97c6a6196f3556dfd76c8209227', class: `${this.elementClassName}__period` }, h("button", { key: 'e99d9b41ded6b138660f2777f60991bf3af12182', type: "button", class: {
|
|
193
265
|
[`${this.elementClassName}__period-button`]: true,
|
|
194
266
|
[`${this.elementClassName}__period-button--active`]: this.period === "AM"
|
|
195
|
-
}, onClick: () => this.handlePeriodChange("AM"), disabled: this.disabled, "aria-label": this.labels.am, "aria-pressed": this.period === "AM" }, this.labels.am), h("button", { key: '
|
|
267
|
+
}, 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: {
|
|
196
268
|
[`${this.elementClassName}__period-button`]: true,
|
|
197
269
|
[`${this.elementClassName}__period-button--active`]: this.period === "PM"
|
|
198
270
|
}, onClick: () => this.handlePeriodChange("PM"), disabled: this.disabled, "aria-label": this.labels.pm, "aria-pressed": this.period === "PM" }, this.labels.pm))))));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-CwtZ_Lud.js';
|
|
2
2
|
import { g as getDefaultExportFromCjs, d as dayjs, c as customParseFormat } from './customParseFormat-DkyM-7xr.js';
|
|
3
|
-
import { g as getISODateString, r as removeTimezoneOffset } from './utils-
|
|
3
|
+
import { g as getISODateString, r as removeTimezoneOffset } from './utils-CoFOnMSw.js';
|
|
4
4
|
|
|
5
5
|
var localizedFormat$2 = {exports: {}};
|
|
6
6
|
|
|
@@ -40,6 +40,7 @@ const TabworthyTimes = class {
|
|
|
40
40
|
registerInstance(this, hostRef);
|
|
41
41
|
this.selectDateTime = createEvent(this, "selectDateTime", 7);
|
|
42
42
|
this.changeYear = createEvent(this, "changeYear", 7);
|
|
43
|
+
this.errorChange = createEvent(this, "errorChange", 7);
|
|
43
44
|
this.componentReady = createEvent(this, "componentReady", 7);
|
|
44
45
|
// Enable or disable range mode
|
|
45
46
|
this.range = false;
|
|
@@ -101,6 +102,8 @@ const TabworthyTimes = class {
|
|
|
101
102
|
if (this.range && dates.length === 2) {
|
|
102
103
|
const startDate = removeTimezoneOffset(new Date(dates[0]));
|
|
103
104
|
const endDate = removeTimezoneOffset(new Date(dates[1]));
|
|
105
|
+
if (!this.isDateValid(startDate) || !this.isDateValid(endDate))
|
|
106
|
+
return;
|
|
104
107
|
this.updateValue([startDate, endDate]);
|
|
105
108
|
// Update calendar with selected dates
|
|
106
109
|
if (this.pickerRef) {
|
|
@@ -109,6 +112,8 @@ const TabworthyTimes = class {
|
|
|
109
112
|
}
|
|
110
113
|
else {
|
|
111
114
|
const date = removeTimezoneOffset(new Date(dates[0]));
|
|
115
|
+
if (!this.isDateValid(date))
|
|
116
|
+
return;
|
|
112
117
|
this.updateValue(date);
|
|
113
118
|
// Update calendar with selected date
|
|
114
119
|
if (this.pickerRef) {
|
|
@@ -167,6 +172,25 @@ const TabworthyTimes = class {
|
|
|
167
172
|
parsed = dayjs(value);
|
|
168
173
|
}
|
|
169
174
|
if (parsed.isValid()) {
|
|
175
|
+
// Check minDate/maxDate bounds (supports both date-only and datetime strings)
|
|
176
|
+
if (this.minDate && parsed.isBefore(dayjs(this.minDate))) {
|
|
177
|
+
this.errorState = true;
|
|
178
|
+
this.errorMessage = `${this.timesLabels.minDateError} ${this.formatBoundaryDate(this.minDate)}`;
|
|
179
|
+
this.emitErrorChange("minDate", this.errorMessage);
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
if (this.maxDate && parsed.isAfter(dayjs(this.maxDate))) {
|
|
183
|
+
this.errorState = true;
|
|
184
|
+
this.errorMessage = `${this.timesLabels.maxDateError} ${this.formatBoundaryDate(this.maxDate)}`;
|
|
185
|
+
this.emitErrorChange("maxDate", this.errorMessage);
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
if (this.disableDate(parsed.toDate())) {
|
|
189
|
+
this.errorState = true;
|
|
190
|
+
this.errorMessage = this.timesLabels.disabledDateError;
|
|
191
|
+
this.emitErrorChange("disabledDate", this.errorMessage);
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
170
194
|
this.errorState = false;
|
|
171
195
|
this.selectedHours = parsed.hour();
|
|
172
196
|
this.selectedMinutes = parsed.minute();
|
|
@@ -177,9 +201,64 @@ const TabworthyTimes = class {
|
|
|
177
201
|
// Set error state for invalid/garbage input
|
|
178
202
|
this.errorState = true;
|
|
179
203
|
this.errorMessage = this.timesLabels.invalidDateError;
|
|
204
|
+
this.emitErrorChange("invalid", this.errorMessage);
|
|
180
205
|
}
|
|
181
206
|
};
|
|
182
207
|
}
|
|
208
|
+
emitErrorChange(reason, message) {
|
|
209
|
+
this.errorChange.emit({ reason, message });
|
|
210
|
+
}
|
|
211
|
+
formatBoundaryDate(dateString) {
|
|
212
|
+
const parsed = dayjs(dateString);
|
|
213
|
+
if (!parsed.isValid())
|
|
214
|
+
return dateString;
|
|
215
|
+
const hasTime = dateString.includes("T") || dateString.includes(" ");
|
|
216
|
+
if (!hasTime) {
|
|
217
|
+
return Intl.DateTimeFormat(this.locale, {
|
|
218
|
+
day: "numeric",
|
|
219
|
+
month: "short",
|
|
220
|
+
year: "numeric"
|
|
221
|
+
}).format(parsed.toDate());
|
|
222
|
+
}
|
|
223
|
+
const options = Object.assign({ day: "numeric", month: "short", year: "numeric", hour: "numeric", minute: "numeric" }, (this.showSeconds ? { second: "numeric" } : {}));
|
|
224
|
+
return Intl.DateTimeFormat(this.locale, options).format(parsed.toDate());
|
|
225
|
+
}
|
|
226
|
+
getEffectiveMinTime() {
|
|
227
|
+
if (!this.minDate || !this.selectedDate)
|
|
228
|
+
return undefined;
|
|
229
|
+
const min = dayjs(this.minDate);
|
|
230
|
+
const sel = dayjs(this.selectedDate);
|
|
231
|
+
if (!min.isValid() || !sel.isSame(min, "day"))
|
|
232
|
+
return undefined;
|
|
233
|
+
return {
|
|
234
|
+
hours: min.hour(),
|
|
235
|
+
minutes: min.minute(),
|
|
236
|
+
seconds: min.second()
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
getEffectiveMaxTime() {
|
|
240
|
+
if (!this.maxDate || !this.selectedDate)
|
|
241
|
+
return undefined;
|
|
242
|
+
const max = dayjs(this.maxDate);
|
|
243
|
+
const sel = dayjs(this.selectedDate);
|
|
244
|
+
if (!max.isValid() || !sel.isSame(max, "day"))
|
|
245
|
+
return undefined;
|
|
246
|
+
return {
|
|
247
|
+
hours: max.hour(),
|
|
248
|
+
minutes: max.minute(),
|
|
249
|
+
seconds: max.second()
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
isDateOutOfBounds() {
|
|
253
|
+
if (!this.selectedDate)
|
|
254
|
+
return false;
|
|
255
|
+
const sel = dayjs(this.selectedDate);
|
|
256
|
+
if (this.minDate && sel.isBefore(dayjs(this.minDate), "day"))
|
|
257
|
+
return true;
|
|
258
|
+
if (this.maxDate && sel.isAfter(dayjs(this.maxDate), "day"))
|
|
259
|
+
return true;
|
|
260
|
+
return false;
|
|
261
|
+
}
|
|
183
262
|
shouldInputFormat() {
|
|
184
263
|
if (typeof this.inputShouldFormat === "string") {
|
|
185
264
|
return this.inputShouldFormat === "true";
|
|
@@ -252,6 +331,30 @@ const TabworthyTimes = class {
|
|
|
252
331
|
this.formatInput();
|
|
253
332
|
}
|
|
254
333
|
}
|
|
334
|
+
isDateValid(date) {
|
|
335
|
+
const parsed = dayjs(date);
|
|
336
|
+
if (!parsed.isValid())
|
|
337
|
+
return false;
|
|
338
|
+
if (this.minDate && parsed.isBefore(dayjs(this.minDate))) {
|
|
339
|
+
this.errorState = true;
|
|
340
|
+
this.errorMessage = `${this.timesLabels.minDateError} ${this.formatBoundaryDate(this.minDate)}`;
|
|
341
|
+
this.emitErrorChange("minDate", this.errorMessage);
|
|
342
|
+
return false;
|
|
343
|
+
}
|
|
344
|
+
if (this.maxDate && parsed.isAfter(dayjs(this.maxDate))) {
|
|
345
|
+
this.errorState = true;
|
|
346
|
+
this.errorMessage = `${this.timesLabels.maxDateError} ${this.formatBoundaryDate(this.maxDate)}`;
|
|
347
|
+
this.emitErrorChange("maxDate", this.errorMessage);
|
|
348
|
+
return false;
|
|
349
|
+
}
|
|
350
|
+
if (this.disableDate(date)) {
|
|
351
|
+
this.errorState = true;
|
|
352
|
+
this.errorMessage = this.timesLabels.disabledDateError;
|
|
353
|
+
this.emitErrorChange("disabledDate", this.errorMessage);
|
|
354
|
+
return false;
|
|
355
|
+
}
|
|
356
|
+
return true;
|
|
357
|
+
}
|
|
255
358
|
formatInput() {
|
|
256
359
|
if (!this.internalValue)
|
|
257
360
|
return;
|
|
@@ -292,10 +395,12 @@ const TabworthyTimes = class {
|
|
|
292
395
|
}
|
|
293
396
|
render() {
|
|
294
397
|
var _a;
|
|
295
|
-
return (h(Host, { key: '
|
|
398
|
+
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: {
|
|
296
399
|
[this.getClassName("input")]: true,
|
|
297
400
|
[this.inputClass]: !!this.inputClass
|
|
298
|
-
}, 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: '
|
|
401
|
+
}, 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
|
|
402
|
+
? this.timesLabels.openCalendar
|
|
403
|
+
: 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: () => {
|
|
299
404
|
if (this.pickerRef) {
|
|
300
405
|
this.pickerRef.modalIsOpen = true;
|
|
301
406
|
}
|
|
@@ -303,7 +408,7 @@ const TabworthyTimes = class {
|
|
|
303
408
|
if (this.pickerRef) {
|
|
304
409
|
this.pickerRef.modalIsOpen = false;
|
|
305
410
|
}
|
|
306
|
-
}, inline: this.inline, appendTo: this.appendTo }, h("div", { key: '
|
|
411
|
+
}, 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))));
|
|
307
412
|
}
|
|
308
413
|
get el() { return getElement(this); }
|
|
309
414
|
static get watchers() { return {
|
|
@@ -136,6 +136,17 @@ function removeTimezoneOffset(date) {
|
|
|
136
136
|
newDate.setMinutes(newDate.getMinutes() + newDate.getTimezoneOffset());
|
|
137
137
|
return newDate;
|
|
138
138
|
}
|
|
139
|
+
/**
|
|
140
|
+
* Parse a date boundary string to a local Date.
|
|
141
|
+
* Date-only strings ("YYYY-MM-DD") are parsed as UTC by JS, so we apply removeTimezoneOffset.
|
|
142
|
+
* Datetime strings (containing "T" or space+time) are already parsed as local time.
|
|
143
|
+
*/
|
|
144
|
+
function parseDateString(dateString) {
|
|
145
|
+
const hasTime = dateString.includes("T") ||
|
|
146
|
+
/\d{4}-\d{2}-\d{2}\s\d{2}:/.test(dateString);
|
|
147
|
+
const parsed = new Date(dateString);
|
|
148
|
+
return hasTime ? parsed : removeTimezoneOffset(parsed);
|
|
149
|
+
}
|
|
139
150
|
function subDays(date, days) {
|
|
140
151
|
const newDate = new Date(date);
|
|
141
152
|
newDate.setDate(newDate.getDate() - days);
|
|
@@ -143,7 +154,7 @@ function subDays(date, days) {
|
|
|
143
154
|
}
|
|
144
155
|
function dateIsWithinLowerBounds(date, minDate) {
|
|
145
156
|
if (minDate) {
|
|
146
|
-
const min =
|
|
157
|
+
const min = parseDateString(minDate);
|
|
147
158
|
return date >= min || isSameDay(min, date);
|
|
148
159
|
}
|
|
149
160
|
else
|
|
@@ -151,7 +162,7 @@ function dateIsWithinLowerBounds(date, minDate) {
|
|
|
151
162
|
}
|
|
152
163
|
function dateIsWithinUpperBounds(date, maxDate) {
|
|
153
164
|
if (maxDate) {
|
|
154
|
-
const max =
|
|
165
|
+
const max = parseDateString(maxDate);
|
|
155
166
|
return date <= max || isSameDay(date, max);
|
|
156
167
|
}
|
|
157
168
|
else
|
|
@@ -162,12 +173,21 @@ function dateIsWithinBounds(date, minDate, maxDate) {
|
|
|
162
173
|
dateIsWithinUpperBounds(date, maxDate));
|
|
163
174
|
}
|
|
164
175
|
function monthIsDisabled(month, year, minDate, maxDate) {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
176
|
+
if (minDate) {
|
|
177
|
+
const min = parseDateString(minDate);
|
|
178
|
+
const minYear = min.getFullYear();
|
|
179
|
+
const minMonth = min.getMonth();
|
|
180
|
+
if (year < minYear || (year === minYear && month < minMonth))
|
|
181
|
+
return true;
|
|
182
|
+
}
|
|
183
|
+
if (maxDate) {
|
|
184
|
+
const max = parseDateString(maxDate);
|
|
185
|
+
const maxYear = max.getFullYear();
|
|
186
|
+
const maxMonth = max.getMonth();
|
|
187
|
+
if (year > maxYear || (year === maxYear && month > maxMonth))
|
|
188
|
+
return true;
|
|
189
|
+
}
|
|
190
|
+
return false;
|
|
171
191
|
}
|
|
172
192
|
function isValidISODate(dateString) {
|
|
173
193
|
var isoFormat = /^\d{4}-\d{2}-\d{2}$/;
|
|
@@ -185,4 +205,4 @@ function extractDates(text) {
|
|
|
185
205
|
return matches === null || matches === void 0 ? void 0 : matches.slice(0, 2);
|
|
186
206
|
}
|
|
187
207
|
|
|
188
|
-
export { getNextMonth as a, getNextYear as b, getPreviousMonth as c, getPreviousYear as d, dateIsWithinBounds as e, getPreviousDay as f, getISODateString as g, getNextDay as h, addDays as i, getFirstOfMonth as j, getLastOfMonth as k, getWeekDays as l,
|
|
208
|
+
export { getNextMonth as a, getNextYear as b, getPreviousMonth as c, getPreviousYear as d, dateIsWithinBounds as e, getPreviousDay as f, getISODateString as g, getNextDay as h, addDays as i, getFirstOfMonth as j, getLastOfMonth as k, getWeekDays as l, monthIsDisabled as m, getDaysOfMonth as n, dateIsWithinLowerBounds as o, parseDateString as p, dateIsWithinUpperBounds as q, removeTimezoneOffset as r, subDays as s, getYear as t, getMonth as u, getMonths as v, isSameDay as w, isDateInRange as x, extractDates as y, isValidISODate as z };
|
|
@@ -136,6 +136,17 @@ export function removeTimezoneOffset(date) {
|
|
|
136
136
|
newDate.setMinutes(newDate.getMinutes() + newDate.getTimezoneOffset());
|
|
137
137
|
return newDate;
|
|
138
138
|
}
|
|
139
|
+
/**
|
|
140
|
+
* Parse a date boundary string to a local Date.
|
|
141
|
+
* Date-only strings ("YYYY-MM-DD") are parsed as UTC by JS, so we apply removeTimezoneOffset.
|
|
142
|
+
* Datetime strings (containing "T" or space+time) are already parsed as local time.
|
|
143
|
+
*/
|
|
144
|
+
export function parseDateString(dateString) {
|
|
145
|
+
const hasTime = dateString.includes("T") ||
|
|
146
|
+
/\d{4}-\d{2}-\d{2}\s\d{2}:/.test(dateString);
|
|
147
|
+
const parsed = new Date(dateString);
|
|
148
|
+
return hasTime ? parsed : removeTimezoneOffset(parsed);
|
|
149
|
+
}
|
|
139
150
|
export function subDays(date, days) {
|
|
140
151
|
const newDate = new Date(date);
|
|
141
152
|
newDate.setDate(newDate.getDate() - days);
|
|
@@ -143,7 +154,7 @@ export function subDays(date, days) {
|
|
|
143
154
|
}
|
|
144
155
|
export function dateIsWithinLowerBounds(date, minDate) {
|
|
145
156
|
if (minDate) {
|
|
146
|
-
const min =
|
|
157
|
+
const min = parseDateString(minDate);
|
|
147
158
|
return date >= min || isSameDay(min, date);
|
|
148
159
|
}
|
|
149
160
|
else
|
|
@@ -151,7 +162,7 @@ export function dateIsWithinLowerBounds(date, minDate) {
|
|
|
151
162
|
}
|
|
152
163
|
export function dateIsWithinUpperBounds(date, maxDate) {
|
|
153
164
|
if (maxDate) {
|
|
154
|
-
const max =
|
|
165
|
+
const max = parseDateString(maxDate);
|
|
155
166
|
return date <= max || isSameDay(date, max);
|
|
156
167
|
}
|
|
157
168
|
else
|
|
@@ -162,12 +173,21 @@ export function dateIsWithinBounds(date, minDate, maxDate) {
|
|
|
162
173
|
dateIsWithinUpperBounds(date, maxDate));
|
|
163
174
|
}
|
|
164
175
|
export function monthIsDisabled(month, year, minDate, maxDate) {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
176
|
+
if (minDate) {
|
|
177
|
+
const min = parseDateString(minDate);
|
|
178
|
+
const minYear = min.getFullYear();
|
|
179
|
+
const minMonth = min.getMonth();
|
|
180
|
+
if (year < minYear || (year === minYear && month < minMonth))
|
|
181
|
+
return true;
|
|
182
|
+
}
|
|
183
|
+
if (maxDate) {
|
|
184
|
+
const max = parseDateString(maxDate);
|
|
185
|
+
const maxYear = max.getFullYear();
|
|
186
|
+
const maxMonth = max.getMonth();
|
|
187
|
+
if (year > maxYear || (year === maxYear && month > maxMonth))
|
|
188
|
+
return true;
|
|
189
|
+
}
|
|
190
|
+
return false;
|
|
171
191
|
}
|
|
172
192
|
export function isValidISODate(dateString) {
|
|
173
193
|
var isoFormat = /^\d{4}-\d{2}-\d{2}$/;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,c as s,h as i,H as e,g as h}from"./p-CwtZ_Lud.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"},n=class{constructor(i){t(this,i),this.timeChanged=s(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,h=this.useTwelveHourFormat?1:0;return i(e,{key:"190cabad78886b1902d70c42c6c5b1f4ee90e5fe",class:this.elementClassName,"aria-label":this.labels.timePicker},i("div",{key:"98b3d39baf501aeb9894949e807a365e26253fbc",class:`${this.elementClassName}__container`},i("div",{key:"6697b77b177164a36297f911572d89beaa01cf23",class:`${this.elementClassName}__field`},i("label",{key:"43f6e821b49f19041422741840439081f819f71c",htmlFor:`${this.elementClassName}-hours`,class:{[`${this.elementClassName}__label`]:!0,[`${this.elementClassName}__label--sr-only`]:this.labelsSrOnly}},this.labels.hours),i("div",{key:"a0e177ded2a849c22e41dbca95bad0888f7f956c",class:`${this.elementClassName}__control`},i("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},i("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"},i("polyline",{key:"279b80304fc77a2fd74e26a2aba89f12155f9334",points:"18 15 12 9 6 15"}))),i("input",{key:"93f17e7c848d40bd513ad7af9f29d39586391573",id:`${this.elementClassName}-hours`,type:"number",class:`${this.elementClassName}__input`,value:this.padZero(t),min:h,max:s,onInput:this.handleHourChange,disabled:this.disabled,"aria-label":this.labels.hours}),i("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},i("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"},i("polyline",{key:"742b64bddf3873a7bea1c10ed93b9b1e99588ede",points:"6 9 12 15 18 9"}))))),i("div",{key:"f81f40c465cc84a5d02b9904631d3d24e33150e3",class:`${this.elementClassName}__separator`},":"),i("div",{key:"d028bae721c1c9c2cc7290cd19f7050a901f4a4e",class:`${this.elementClassName}__field`},i("label",{key:"3c88a3fa04ed2a65f72c48ded459e19d580f9c36",htmlFor:`${this.elementClassName}-minutes`,class:{[`${this.elementClassName}__label`]:!0,[`${this.elementClassName}__label--sr-only`]:this.labelsSrOnly}},this.labels.minutes),i("div",{key:"dbd89633addd003b2e42414b587d03a6e65e9239",class:`${this.elementClassName}__control`},i("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},i("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"},i("polyline",{key:"dbc89190f6fe10bb8c8074252b83ab3397112de4",points:"18 15 12 9 6 15"}))),i("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}),i("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},i("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"},i("polyline",{key:"56045b19ec716a82f21406b647762ba0efcd8170",points:"6 9 12 15 18 9"}))))),this.showSeconds&&[i("div",{key:"9c2619ccebd147e626e10a21fb1a5fa1268128f3",class:`${this.elementClassName}__separator`},":"),i("div",{key:"dea8135d47a06d9624b480aa6123350a0899ca02",class:`${this.elementClassName}__field`},i("label",{key:"afaa88b59df63091088620ff2a49bf8472f4401f",htmlFor:`${this.elementClassName}-seconds`,class:{[`${this.elementClassName}__label`]:!0,[`${this.elementClassName}__label--sr-only`]:this.labelsSrOnly}},this.labels.seconds),i("div",{key:"c2ed4d63a95a65bdc26926932e705744bbe776c5",class:`${this.elementClassName}__control`},i("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},i("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"},i("polyline",{key:"5e2dad75d96a521f56f616bc2b88e4baa6c0eb50",points:"18 15 12 9 6 15"}))),i("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}),i("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},i("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"},i("polyline",{key:"3bb717320e078f5fa36912f15995ed604d9f702b",points:"6 9 12 15 18 9"})))))],this.useTwelveHourFormat&&i("div",{key:"ec583890c2f7d97c6a6196f3556dfd76c8209227",class:`${this.elementClassName}__period`},i("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),i("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 h(this)}static get watchers(){return{hours:[{watchHours:0}],minutes:[{watchMinutes:0}],seconds:[{watchSeconds:0}]}}};export{n as tabworthy_times_picker}
|