@tabworthy/components 0.8.5 → 0.8.7
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/tabworthy-dates.cjs.entry.js +6 -6
- package/dist/cjs/tabworthy-times.cjs.entry.js +11 -3
- package/dist/collection/components/tabworthy-dates/tabworthy-dates.js +7 -7
- package/dist/collection/components/tabworthy-times/tabworthy-times.js +11 -3
- package/dist/components/tabworthy-dates.js +1 -1
- package/dist/components/tabworthy-times.js +1 -1
- package/dist/esm/tabworthy-dates.entry.js +6 -6
- package/dist/esm/tabworthy-times.entry.js +11 -3
- package/dist/tabworthy-components/{p-4de237aa.entry.js → p-224503da.entry.js} +1 -1
- package/dist/tabworthy-components/p-dcb3ea8d.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-times/tabworthy-times.d.ts +1 -0
- package/dist/types/components.d.ts +2 -2
- package/package.json +8 -6
- package/dist/tabworthy-components/p-141bd515.entry.js +0 -1
|
@@ -10499,7 +10499,7 @@ const TabworthyDates = class {
|
|
|
10499
10499
|
// A placeholder for the text field
|
|
10500
10500
|
this.placeholder = this.range
|
|
10501
10501
|
? `Try "June 8 to 12"`
|
|
10502
|
-
: `Try "
|
|
10502
|
+
: `Try "tomorrow" or "in ten days"`;
|
|
10503
10503
|
// Locale used for internal translations and date parsing
|
|
10504
10504
|
this.locale = (navigator === null || navigator === void 0 ? void 0 : navigator.language) || "en-US";
|
|
10505
10505
|
// If the datepicker is disabled
|
|
@@ -10910,10 +10910,10 @@ const TabworthyDates = class {
|
|
|
10910
10910
|
}
|
|
10911
10911
|
render() {
|
|
10912
10912
|
var _a;
|
|
10913
|
-
return (index$1.h(index$1.Host, { key: '
|
|
10913
|
+
return (index$1.h(index$1.Host, { key: 'e88b264159dd97824a678fd47e735daa7d6e7937' }, index$1.h("label", { key: 'bd130dbe90559f0f02760c0cd98069121208ead8', htmlFor: this.id ? `${this.id}-input` : undefined, class: this.getClassName("label") }, this.label), index$1.h("br", { key: 'e32218a5fd45461d589d10f7ed24b4512475f5e7' }), index$1.h("div", { key: '6a17c542843f1cbe42a17a6c437422773f17da5c', class: this.getClassName("input-container") }, index$1.h("input", { key: '72688ef25cd185f1c64e385602af5ac758eef488', disabled: this.disabledState || this.disableFreeformInput, id: this.id ? `${this.id}-input` : undefined, type: "text", placeholder: this.placeholder, class: {
|
|
10914
10914
|
[this.getClassName("input")]: true,
|
|
10915
10915
|
[this.inputClass]: !!this.inputClass
|
|
10916
|
-
}, ref: (r) => (this.inputRef = r), onChange: this.handleChange, onFocus: () => this.formatInput(false), onBlur: () => this.formatInput(true, false), "aria-describedby": this.errorState ? `${this.id}-error` : undefined, "aria-invalid": this.errorState }), !this.inline && (index$1.h("button", { key: '
|
|
10916
|
+
}, ref: (r) => (this.inputRef = r), onChange: this.handleChange, onFocus: () => this.formatInput(false), onBlur: () => this.formatInput(true, false), "aria-describedby": this.errorState ? `${this.id}-error` : undefined, "aria-invalid": this.errorState }), !this.inline && (index$1.h("button", { key: '89acd9aa82cb8c10b7f73e351620babfc13bc96f', type: "button", ref: (r) => (this.calendarButtonRef = r), onClick: this.handleCalendarButtonClick, class: this.getClassName("calendar-button"), disabled: this.disabledState }, this.calendarButtonContent ? (index$1.h("span", { innerHTML: this.calendarButtonContent })) : (this.datesLabels.openCalendar)))), index$1.h("tabworthy-dates-modal", { key: '3a853a44a3637007547aba3f55d41f8c4f4ce363', label: this.datesLabels.calendar, ref: (el) => (this.modalRef = el), onOpened: () => {
|
|
10917
10917
|
if (!this.pickerRef)
|
|
10918
10918
|
return;
|
|
10919
10919
|
this.pickerRef.modalIsOpen = true;
|
|
@@ -10921,11 +10921,11 @@ const TabworthyDates = class {
|
|
|
10921
10921
|
if (!this.pickerRef)
|
|
10922
10922
|
return;
|
|
10923
10923
|
this.pickerRef.modalIsOpen = false;
|
|
10924
|
-
}, inline: this.inline }, index$1.h("tabworthy-dates-calendar", { key: '
|
|
10924
|
+
}, inline: this.inline }, index$1.h("tabworthy-dates-calendar", { key: '12900a935aebd37116e805a0528966ab3bbff699', range: this.range, locale: this.locale, onSelectDate: (event) => this.handlePickerSelection(event.detail), onChangeMonth: (event) => this.handleChangedMonths(event.detail), onChangeYear: (event) => this.handleYearChange(event.detail), labels: this.datesCalendarLabels ? this.datesCalendarLabels : undefined, 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, showKeyboardHint: this.showKeyboardHint, showTodayButton: this.showTodayButton, disableDate: this.disableDate, minDate: this.minDate, maxDate: this.maxDate, inline: this.inline })), this.showQuickButtons &&
|
|
10925
10925
|
((_a = this.quickButtons) === null || _a === void 0 ? void 0 : _a.length) > 0 &&
|
|
10926
|
-
this.chronoSupportedLocale && (index$1.h("div", { key: '
|
|
10926
|
+
this.chronoSupportedLocale && (index$1.h("div", { key: 'db492a4c33d882a7f056dd66d669cd639894a714', class: this.getClassName("quick-group"), role: "group", "aria-label": "Quick selection" }, this.quickButtons.map((buttonText) => {
|
|
10927
10927
|
return (index$1.h("button", { class: this.getClassName("quick-button"), onClick: this.handleQuickButtonClick, disabled: this.disabledState, type: "button" }, buttonText));
|
|
10928
|
-
}))), this.errorState && (index$1.h("div", { key: '
|
|
10928
|
+
}))), this.errorState && (index$1.h("div", { key: '8a4a4d89be39da4438beda996b2f1f3b785d9010', class: this.getClassName("input-error"), id: this.id ? `${this.id}-error` : undefined, role: "status" }, this.errorMessage))));
|
|
10929
10929
|
}
|
|
10930
10930
|
get el() { return index$1.getElement(this); }
|
|
10931
10931
|
static get watchers() { return {
|
|
@@ -217,6 +217,14 @@ const InclusiveTimes = class {
|
|
|
217
217
|
getClassName(suffix) {
|
|
218
218
|
return `${this.elementClassName}__${suffix}`;
|
|
219
219
|
}
|
|
220
|
+
toDate(dateString) {
|
|
221
|
+
if (!dateString)
|
|
222
|
+
return null;
|
|
223
|
+
const date = Array.isArray(dateString)
|
|
224
|
+
? dateString.map((d) => moment.hooks(d, this.format).toDate())
|
|
225
|
+
: moment.hooks(dateString, this.format).toDate();
|
|
226
|
+
return date;
|
|
227
|
+
}
|
|
220
228
|
async clearValue() {
|
|
221
229
|
this.internalValue = null;
|
|
222
230
|
this.value = undefined;
|
|
@@ -229,10 +237,10 @@ const InclusiveTimes = class {
|
|
|
229
237
|
}
|
|
230
238
|
render() {
|
|
231
239
|
var _a;
|
|
232
|
-
return (index.h(index.Host, { key: '
|
|
240
|
+
return (index.h(index.Host, { key: '82b7e3ac499f9b8bea87955bfe55bbe645aa9d5a', class: this.elementClassName, "has-error": this.errorState, disabled: this.disabledState }, index.h("label", { key: '19a9a6cf34bccd49e6d079a4d9d7d5f3e527f1c7', htmlFor: `${this.id}-input`, class: this.getClassName("label") }, this.label), index.h("div", { key: '20a4dae28141bb9d3d124653df0f8f3a152a2ee8', class: this.getClassName("input-container") }, index.h("input", { key: '64779c1b8d59ecff3c9ddcbe0e67025e9bcbd325', id: `${this.id}-input`, ref: (r) => (this.inputRef = r), type: "text", class: {
|
|
233
241
|
[this.getClassName("input")]: true,
|
|
234
242
|
[this.inputClass]: !!this.inputClass
|
|
235
|
-
}, placeholder: this.placeholder, disabled: this.disabledState || this.disableFreeformInput, value: (_a = this.internalValue) === null || _a === void 0 ? void 0 : _a.toString(), onBlur: this.handleInputBlur, onChange: this.handleInputChange, "aria-describedby": this.errorState ? `${this.id}-error` : undefined, "aria-invalid": this.errorState }), !this.inline && (index.h("button", { key: '
|
|
243
|
+
}, placeholder: this.placeholder, disabled: this.disabledState || this.disableFreeformInput, value: (_a = this.internalValue) === null || _a === void 0 ? void 0 : _a.toString(), onBlur: this.handleInputBlur, onChange: this.handleInputChange, "aria-describedby": this.errorState ? `${this.id}-error` : undefined, "aria-invalid": this.errorState }), !this.inline && (index.h("button", { key: '503fb34dfa3b5328c1dfae06647601729d0c634d', type: "button", ref: (r) => (this.calendarButtonRef = r), onClick: this.handleCalendarButtonClick, class: this.getClassName("calendar-button"), disabled: this.disabledState }, this.calendarButtonContent ? (index.h("span", { innerHTML: this.calendarButtonContent })) : (this.timesLabels.openCalendar)))), index.h("tabworthy-dates-modal", { key: '915841d3053aae0e856b19ae24dafc8870c3d746', label: this.timesLabels.calendar, ref: (el) => (this.modalRef = el), onOpened: () => {
|
|
236
244
|
if (this.pickerRef) {
|
|
237
245
|
this.pickerRef.modalIsOpen = true;
|
|
238
246
|
}
|
|
@@ -240,7 +248,7 @@ const InclusiveTimes = class {
|
|
|
240
248
|
if (this.pickerRef) {
|
|
241
249
|
this.pickerRef.modalIsOpen = false;
|
|
242
250
|
}
|
|
243
|
-
}, inline: this.inline }, index.h("div", { key: '
|
|
251
|
+
}, inline: this.inline }, index.h("div", { key: 'b7ead351553fa42af52be2ab8e461b49d6f63b56', class: this.getClassName("picker-container") }, index.h("tabworthy-dates-calendar", { key: '9397be905159540b8645428d7624c4c6f2dd5133', range: this.range, locale: this.locale, onSelectDate: (event) => this.handlePickerSelection(event.detail), onChangeMonth: (event) => this.handleChangedMonths(event.detail), onChangeYear: (event) => this.handleYearChange(event.detail), 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, showTodayButton: this.showTodayButton, disableDate: this.disableDate, minDate: this.minDate, maxDate: this.maxDate, inline: this.inline, value: this.value ? this.toDate(this.value) : undefined }, index.h("div", { key: '6aa58750a3a13fc3e1ddadee0a9c4631220bb399', slot: "after-calendar", class: this.getClassName("time-section") }, index.h("hr", { key: '17943c66cef11e8a4335cb0c0711d5ae327076e9', class: this.getClassName("divider") }), index.h("tabworthy-times-picker", { key: 'f356db7d523202ee5a72089cf57cf072787c32ee', hours: this.selectedHours, minutes: this.selectedMinutes, useTwelveHourFormat: this.useTwelveHourFormat, disabled: this.disabledState, onTimeChanged: this.handleTimeChange }))))), this.errorState && (index.h("div", { key: 'db47877aa13a91f6441dfd371cc7da70375aa1ea', class: this.getClassName("input-error"), id: this.id ? `${this.id}-error` : undefined, role: "status" }, this.errorMessage))));
|
|
244
252
|
}
|
|
245
253
|
get el() { return index.getElement(this); }
|
|
246
254
|
static get watchers() { return {
|
|
@@ -26,7 +26,7 @@ export class TabworthyDates {
|
|
|
26
26
|
// A placeholder for the text field
|
|
27
27
|
this.placeholder = this.range
|
|
28
28
|
? `Try "June 8 to 12"`
|
|
29
|
-
: `Try "
|
|
29
|
+
: `Try "tomorrow" or "in ten days"`;
|
|
30
30
|
// Locale used for internal translations and date parsing
|
|
31
31
|
this.locale = (navigator === null || navigator === void 0 ? void 0 : navigator.language) || "en-US";
|
|
32
32
|
// If the datepicker is disabled
|
|
@@ -437,10 +437,10 @@ export class TabworthyDates {
|
|
|
437
437
|
}
|
|
438
438
|
render() {
|
|
439
439
|
var _a;
|
|
440
|
-
return (h(Host, { key: '
|
|
440
|
+
return (h(Host, { key: 'e88b264159dd97824a678fd47e735daa7d6e7937' }, h("label", { key: 'bd130dbe90559f0f02760c0cd98069121208ead8', htmlFor: this.id ? `${this.id}-input` : undefined, class: this.getClassName("label") }, this.label), h("br", { key: 'e32218a5fd45461d589d10f7ed24b4512475f5e7' }), h("div", { key: '6a17c542843f1cbe42a17a6c437422773f17da5c', class: this.getClassName("input-container") }, h("input", { key: '72688ef25cd185f1c64e385602af5ac758eef488', disabled: this.disabledState || this.disableFreeformInput, id: this.id ? `${this.id}-input` : undefined, type: "text", placeholder: this.placeholder, class: {
|
|
441
441
|
[this.getClassName("input")]: true,
|
|
442
442
|
[this.inputClass]: !!this.inputClass
|
|
443
|
-
}, ref: (r) => (this.inputRef = r), onChange: this.handleChange, onFocus: () => this.formatInput(false), onBlur: () => this.formatInput(true, false), "aria-describedby": this.errorState ? `${this.id}-error` : undefined, "aria-invalid": this.errorState }), !this.inline && (h("button", { key: '
|
|
443
|
+
}, ref: (r) => (this.inputRef = r), onChange: this.handleChange, onFocus: () => this.formatInput(false), onBlur: () => this.formatInput(true, false), "aria-describedby": this.errorState ? `${this.id}-error` : undefined, "aria-invalid": this.errorState }), !this.inline && (h("button", { key: '89acd9aa82cb8c10b7f73e351620babfc13bc96f', type: "button", ref: (r) => (this.calendarButtonRef = r), onClick: this.handleCalendarButtonClick, class: this.getClassName("calendar-button"), disabled: this.disabledState }, this.calendarButtonContent ? (h("span", { innerHTML: this.calendarButtonContent })) : (this.datesLabels.openCalendar)))), h("tabworthy-dates-modal", { key: '3a853a44a3637007547aba3f55d41f8c4f4ce363', label: this.datesLabels.calendar, ref: (el) => (this.modalRef = el), onOpened: () => {
|
|
444
444
|
if (!this.pickerRef)
|
|
445
445
|
return;
|
|
446
446
|
this.pickerRef.modalIsOpen = true;
|
|
@@ -448,11 +448,11 @@ export class TabworthyDates {
|
|
|
448
448
|
if (!this.pickerRef)
|
|
449
449
|
return;
|
|
450
450
|
this.pickerRef.modalIsOpen = false;
|
|
451
|
-
}, inline: this.inline }, h("tabworthy-dates-calendar", { key: '
|
|
451
|
+
}, inline: this.inline }, h("tabworthy-dates-calendar", { key: '12900a935aebd37116e805a0528966ab3bbff699', range: this.range, locale: this.locale, onSelectDate: (event) => this.handlePickerSelection(event.detail), onChangeMonth: (event) => this.handleChangedMonths(event.detail), onChangeYear: (event) => this.handleYearChange(event.detail), labels: this.datesCalendarLabels ? this.datesCalendarLabels : undefined, 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, showKeyboardHint: this.showKeyboardHint, showTodayButton: this.showTodayButton, disableDate: this.disableDate, minDate: this.minDate, maxDate: this.maxDate, inline: this.inline })), this.showQuickButtons &&
|
|
452
452
|
((_a = this.quickButtons) === null || _a === void 0 ? void 0 : _a.length) > 0 &&
|
|
453
|
-
this.chronoSupportedLocale && (h("div", { key: '
|
|
453
|
+
this.chronoSupportedLocale && (h("div", { key: 'db492a4c33d882a7f056dd66d669cd639894a714', class: this.getClassName("quick-group"), role: "group", "aria-label": "Quick selection" }, this.quickButtons.map((buttonText) => {
|
|
454
454
|
return (h("button", { class: this.getClassName("quick-button"), onClick: this.handleQuickButtonClick, disabled: this.disabledState, type: "button" }, buttonText));
|
|
455
|
-
}))), this.errorState && (h("div", { key: '
|
|
455
|
+
}))), this.errorState && (h("div", { key: '8a4a4d89be39da4438beda996b2f1f3b785d9010', class: this.getClassName("input-error"), id: this.id ? `${this.id}-error` : undefined, role: "status" }, this.errorMessage))));
|
|
456
456
|
}
|
|
457
457
|
static get is() { return "tabworthy-dates"; }
|
|
458
458
|
static get encapsulation() { return "scoped"; }
|
|
@@ -564,7 +564,7 @@ export class TabworthyDates {
|
|
|
564
564
|
"setter": false,
|
|
565
565
|
"reflect": false,
|
|
566
566
|
"attribute": "placeholder",
|
|
567
|
-
"defaultValue": "this.range\n ? `Try \"June 8 to 12\"`\n : `Try \"
|
|
567
|
+
"defaultValue": "this.range\n ? `Try \"June 8 to 12\"`\n : `Try \"tomorrow\" or \"in ten days\"`"
|
|
568
568
|
},
|
|
569
569
|
"locale": {
|
|
570
570
|
"type": "string",
|
|
@@ -210,6 +210,14 @@ export class InclusiveTimes {
|
|
|
210
210
|
getClassName(suffix) {
|
|
211
211
|
return `${this.elementClassName}__${suffix}`;
|
|
212
212
|
}
|
|
213
|
+
toDate(dateString) {
|
|
214
|
+
if (!dateString)
|
|
215
|
+
return null;
|
|
216
|
+
const date = Array.isArray(dateString)
|
|
217
|
+
? dateString.map((d) => moment(d, this.format).toDate())
|
|
218
|
+
: moment(dateString, this.format).toDate();
|
|
219
|
+
return date;
|
|
220
|
+
}
|
|
213
221
|
async clearValue() {
|
|
214
222
|
this.internalValue = null;
|
|
215
223
|
this.value = undefined;
|
|
@@ -222,10 +230,10 @@ export class InclusiveTimes {
|
|
|
222
230
|
}
|
|
223
231
|
render() {
|
|
224
232
|
var _a;
|
|
225
|
-
return (h(Host, { key: '
|
|
233
|
+
return (h(Host, { key: '82b7e3ac499f9b8bea87955bfe55bbe645aa9d5a', class: this.elementClassName, "has-error": this.errorState, disabled: this.disabledState }, h("label", { key: '19a9a6cf34bccd49e6d079a4d9d7d5f3e527f1c7', htmlFor: `${this.id}-input`, class: this.getClassName("label") }, this.label), h("div", { key: '20a4dae28141bb9d3d124653df0f8f3a152a2ee8', class: this.getClassName("input-container") }, h("input", { key: '64779c1b8d59ecff3c9ddcbe0e67025e9bcbd325', id: `${this.id}-input`, ref: (r) => (this.inputRef = r), type: "text", class: {
|
|
226
234
|
[this.getClassName("input")]: true,
|
|
227
235
|
[this.inputClass]: !!this.inputClass
|
|
228
|
-
}, 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: '
|
|
236
|
+
}, 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: '503fb34dfa3b5328c1dfae06647601729d0c634d', type: "button", ref: (r) => (this.calendarButtonRef = r), onClick: this.handleCalendarButtonClick, class: this.getClassName("calendar-button"), disabled: this.disabledState }, this.calendarButtonContent ? (h("span", { innerHTML: this.calendarButtonContent })) : (this.timesLabels.openCalendar)))), h("tabworthy-dates-modal", { key: '915841d3053aae0e856b19ae24dafc8870c3d746', label: this.timesLabels.calendar, ref: (el) => (this.modalRef = el), onOpened: () => {
|
|
229
237
|
if (this.pickerRef) {
|
|
230
238
|
this.pickerRef.modalIsOpen = true;
|
|
231
239
|
}
|
|
@@ -233,7 +241,7 @@ export class InclusiveTimes {
|
|
|
233
241
|
if (this.pickerRef) {
|
|
234
242
|
this.pickerRef.modalIsOpen = false;
|
|
235
243
|
}
|
|
236
|
-
}, inline: this.inline }, h("div", { key: '
|
|
244
|
+
}, inline: this.inline }, h("div", { key: 'b7ead351553fa42af52be2ab8e461b49d6f63b56', class: this.getClassName("picker-container") }, h("tabworthy-dates-calendar", { key: '9397be905159540b8645428d7624c4c6f2dd5133', range: this.range, locale: this.locale, onSelectDate: (event) => this.handlePickerSelection(event.detail), onChangeMonth: (event) => this.handleChangedMonths(event.detail), onChangeYear: (event) => this.handleYearChange(event.detail), 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, showTodayButton: this.showTodayButton, disableDate: this.disableDate, minDate: this.minDate, maxDate: this.maxDate, inline: this.inline, value: this.value ? this.toDate(this.value) : undefined }, h("div", { key: '6aa58750a3a13fc3e1ddadee0a9c4631220bb399', slot: "after-calendar", class: this.getClassName("time-section") }, h("hr", { key: '17943c66cef11e8a4335cb0c0711d5ae327076e9', class: this.getClassName("divider") }), h("tabworthy-times-picker", { key: 'f356db7d523202ee5a72089cf57cf072787c32ee', hours: this.selectedHours, minutes: this.selectedMinutes, useTwelveHourFormat: this.useTwelveHourFormat, disabled: this.disabledState, onTimeChanged: this.handleTimeChange }))))), this.errorState && (h("div", { key: 'db47877aa13a91f6441dfd371cc7da70375aa1ea', class: this.getClassName("input-error"), id: this.id ? `${this.id}-error` : undefined, role: "status" }, this.errorMessage))));
|
|
237
245
|
}
|
|
238
246
|
static get is() { return "tabworthy-times"; }
|
|
239
247
|
static get encapsulation() { return "scoped"; }
|