@tabworthy/components 0.8.6 → 0.9.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/{index-w-Wtojyv.js → index-B1s0tI-Z.js} +21 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/tabworthy-components.cjs.js +2 -2
- package/dist/cjs/tabworthy-dates-calendar_2.cjs.entry.js +1960 -8
- package/dist/cjs/tabworthy-dates.cjs.entry.js +9 -8
- package/dist/cjs/tabworthy-times-picker.cjs.entry.js +1 -1
- package/dist/cjs/tabworthy-times.cjs.entry.js +6 -5
- package/dist/collection/components/tabworthy-dates/tabworthy-dates.js +32 -7
- package/dist/collection/components/tabworthy-modal/tabworthy-dates-modal.css +4 -1
- package/dist/collection/components/tabworthy-modal/tabworthy-dates-modal.js +257 -5
- package/dist/collection/components/tabworthy-times/tabworthy-times.js +29 -4
- package/dist/components/index.js +1 -1
- package/dist/components/{p-DT8TK_a8.js → p-B8sG1vGD.js} +1 -1
- package/dist/components/{p-Bnmroodq.js → p-B9YA6avR.js} +1 -1
- package/dist/components/p-B9fGfjA-.js +1 -0
- package/dist/components/p-BiJ0HZVY.js +1 -0
- package/dist/components/tabworthy-dates-calendar.js +1 -1
- package/dist/components/tabworthy-dates-modal.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/{index-CDFauf_3.js → index-CwtZ_Lud.js} +21 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/tabworthy-components.js +3 -3
- package/dist/esm/tabworthy-dates-calendar_2.entry.js +1960 -8
- package/dist/esm/tabworthy-dates.entry.js +9 -8
- package/dist/esm/tabworthy-times-picker.entry.js +1 -1
- package/dist/esm/tabworthy-times.entry.js +6 -5
- package/dist/tabworthy-components/{p-8416e0a9.entry.js → p-4eec41e5.entry.js} +1 -1
- package/dist/tabworthy-components/{p-dcb3ea8d.entry.js → p-90de04dd.entry.js} +1 -1
- package/dist/tabworthy-components/p-CwtZ_Lud.js +2 -0
- package/dist/tabworthy-components/{p-224503da.entry.js → p-c0f957f5.entry.js} +1 -1
- package/dist/tabworthy-components/p-ee41beed.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 +6 -1
- package/dist/types/components/tabworthy-modal/tabworthy-dates-modal.d.ts +27 -0
- package/dist/types/components/tabworthy-times/tabworthy-times.d.ts +6 -1
- package/dist/types/components.d.ts +54 -0
- package/package.json +2 -1
- package/dist/components/p-CGobNAdR.js +0 -1
- package/dist/components/p-Kr35QPhi.js +0 -1
- package/dist/tabworthy-components/p-CDFauf_3.js +0 -2
- package/dist/tabworthy-components/p-e66c010b.entry.js +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index$1 = require('./index-
|
|
3
|
+
var index$1 = require('./index-B1s0tI-Z.js');
|
|
4
4
|
var moment = require('./moment-CdViwxPQ.js');
|
|
5
5
|
var utils = require('./utils-y5Vtky2t.js');
|
|
6
6
|
|
|
@@ -10551,8 +10551,9 @@ const TabworthyDates = class {
|
|
|
10551
10551
|
this.handleCalendarButtonClick = async () => {
|
|
10552
10552
|
var _a, _b, _c, _d, _e;
|
|
10553
10553
|
await customElements.whenDefined("tabworthy-dates-modal");
|
|
10554
|
-
|
|
10555
|
-
|
|
10554
|
+
// Use input container as trigger for proper dropdown alignment
|
|
10555
|
+
this.inputContainerRef &&
|
|
10556
|
+
(await ((_a = this.modalRef) === null || _a === void 0 ? void 0 : _a.setTriggerElement(this.inputContainerRef)));
|
|
10556
10557
|
if ((await ((_b = this.modalRef) === null || _b === void 0 ? void 0 : _b.getState())) === false)
|
|
10557
10558
|
await ((_c = this.modalRef) === null || _c === void 0 ? void 0 : _c.open());
|
|
10558
10559
|
else if ((await ((_d = this.modalRef) === null || _d === void 0 ? void 0 : _d.getState())) === true)
|
|
@@ -10910,10 +10911,10 @@ const TabworthyDates = class {
|
|
|
10910
10911
|
}
|
|
10911
10912
|
render() {
|
|
10912
10913
|
var _a;
|
|
10913
|
-
return (index$1.h(index$1.Host, { key: '
|
|
10914
|
+
return (index$1.h(index$1.Host, { key: '3e36f57e5d9f085e0175e79ce7a962e5ec338769' }, index$1.h("label", { key: 'ab7c37d2f5becd4caefade892cc6a2b14ffe517d', htmlFor: this.id ? `${this.id}-input` : undefined, class: this.getClassName("label") }, this.label), index$1.h("br", { key: '8c0a95500aeb784e6f9bf9295aa09077dc6801ca' }), index$1.h("div", { key: '63e8a6ee083b12791b52ecb2da15a736fb40611a', class: this.getClassName("input-container"), ref: (r) => (this.inputContainerRef = r) }, index$1.h("input", { key: '06a92d32ad8c629567fcacb4022a5a60ccd4f3d7', disabled: this.disabledState || this.disableFreeformInput, id: this.id ? `${this.id}-input` : undefined, type: "text", placeholder: this.placeholder, class: {
|
|
10914
10915
|
[this.getClassName("input")]: true,
|
|
10915
10916
|
[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: '
|
|
10917
|
+
}, 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: '1925a172f3fb59c02563495d038f0e9dd806662a', type: "button", 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: 'fb65c2d4e5e9b6daab3b9029315d751214c4a1d3', label: this.datesLabels.calendar, ref: (el) => (this.modalRef = el), onOpened: () => {
|
|
10917
10918
|
if (!this.pickerRef)
|
|
10918
10919
|
return;
|
|
10919
10920
|
this.pickerRef.modalIsOpen = true;
|
|
@@ -10921,11 +10922,11 @@ const TabworthyDates = class {
|
|
|
10921
10922
|
if (!this.pickerRef)
|
|
10922
10923
|
return;
|
|
10923
10924
|
this.pickerRef.modalIsOpen = false;
|
|
10924
|
-
}, inline: this.inline }, index$1.h("tabworthy-dates-calendar", { key: '
|
|
10925
|
+
}, inline: this.inline, appendTo: this.appendTo }, index$1.h("tabworthy-dates-calendar", { key: '4f48512b4647749af1f9d2d8bcc31c29f8833e1f', 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
10926
|
((_a = this.quickButtons) === null || _a === void 0 ? void 0 : _a.length) > 0 &&
|
|
10926
|
-
this.chronoSupportedLocale && (index$1.h("div", { key: '
|
|
10927
|
+
this.chronoSupportedLocale && (index$1.h("div", { key: 'c22bb344f5fd2668d8f09f4fb410baec74e1d047', class: this.getClassName("quick-group"), role: "group", "aria-label": "Quick selection" }, this.quickButtons.map((buttonText) => {
|
|
10927
10928
|
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: '
|
|
10929
|
+
}))), this.errorState && (index$1.h("div", { key: '0c6cacc8d5a536c5a79a9899627c6318c3c85800', class: this.getClassName("input-error"), id: this.id ? `${this.id}-error` : undefined, role: "status" }, this.errorMessage))));
|
|
10929
10930
|
}
|
|
10930
10931
|
get el() { return index$1.getElement(this); }
|
|
10931
10932
|
static get watchers() { return {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-B1s0tI-Z.js');
|
|
4
4
|
var moment = require('./moment-CdViwxPQ.js');
|
|
5
5
|
var utils = require('./utils-y5Vtky2t.js');
|
|
6
6
|
|
|
@@ -100,7 +100,8 @@ const InclusiveTimes = class {
|
|
|
100
100
|
};
|
|
101
101
|
this.handleCalendarButtonClick = async () => {
|
|
102
102
|
if (this.modalRef) {
|
|
103
|
-
|
|
103
|
+
// Use input container as trigger for proper dropdown alignment
|
|
104
|
+
await this.modalRef.setTriggerElement(this.inputContainerRef);
|
|
104
105
|
await this.modalRef.open();
|
|
105
106
|
}
|
|
106
107
|
};
|
|
@@ -237,10 +238,10 @@ const InclusiveTimes = class {
|
|
|
237
238
|
}
|
|
238
239
|
render() {
|
|
239
240
|
var _a;
|
|
240
|
-
return (index.h(index.Host, { key: '
|
|
241
|
+
return (index.h(index.Host, { key: '5dab8801e9296bb948cef7aea77b03bf40a74089', class: this.elementClassName, "has-error": this.errorState, disabled: this.disabledState }, index.h("label", { key: '4325a32a8a68423db7e287e759684c925dbffa6d', htmlFor: `${this.id}-input`, class: this.getClassName("label") }, this.label), index.h("div", { key: '618590fadfa9d63a54b7a545d7377003510e85fc', class: this.getClassName("input-container"), ref: (r) => (this.inputContainerRef = r) }, index.h("input", { key: 'fd0716e2cea9ede2cac51f1cd7ba1a6167157837', id: `${this.id}-input`, ref: (r) => (this.inputRef = r), type: "text", class: {
|
|
241
242
|
[this.getClassName("input")]: true,
|
|
242
243
|
[this.inputClass]: !!this.inputClass
|
|
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: '
|
|
244
|
+
}, 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: '9dc03047b232cb7286701d4f83daabc0f71c8a3b', type: "button", onClick: this.handleCalendarButtonClick, class: this.getClassName("calendar-button"), disabled: this.disabledState }, this.calendarButtonContent ? (index.h("span", { innerHTML: this.calendarButtonContent })) : (this.timesLabels.openCalendar)))), index.h("tabworthy-dates-modal", { key: '9b3321ec4b767d804766d43820b3938862aba46f', label: this.timesLabels.calendar, ref: (el) => (this.modalRef = el), onOpened: () => {
|
|
244
245
|
if (this.pickerRef) {
|
|
245
246
|
this.pickerRef.modalIsOpen = true;
|
|
246
247
|
}
|
|
@@ -248,7 +249,7 @@ const InclusiveTimes = class {
|
|
|
248
249
|
if (this.pickerRef) {
|
|
249
250
|
this.pickerRef.modalIsOpen = false;
|
|
250
251
|
}
|
|
251
|
-
}, inline: this.inline }, index.h("div", { key: '
|
|
252
|
+
}, inline: this.inline, appendTo: this.appendTo }, index.h("div", { key: '8cd6f661951ad17c95ad6cd8fe5482afa699e824', class: this.getClassName("picker-container") }, index.h("tabworthy-dates-calendar", { key: '85644573834a86c977b36dc71430f5f9b6a9da95', 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: 'f13b4a24fcc3b4b2914a80db7e087082c9d2743f', slot: "after-calendar", class: this.getClassName("time-section") }, index.h("hr", { key: '5b2641318160e08f1a4a3fdad849647c0a50affa', class: this.getClassName("divider") }), index.h("tabworthy-times-picker", { key: 'fba59fa7bd2a0e119b28b69eff15445f972924d6', hours: this.selectedHours, minutes: this.selectedMinutes, useTwelveHourFormat: this.useTwelveHourFormat, disabled: this.disabledState, onTimeChanged: this.handleTimeChange }))))), this.errorState && (index.h("div", { key: '4018611f9e51219a3ee1497f871e83c51b6bc29b', class: this.getClassName("input-error"), id: this.id ? `${this.id}-error` : undefined, role: "status" }, this.errorMessage))));
|
|
252
253
|
}
|
|
253
254
|
get el() { return index.getElement(this); }
|
|
254
255
|
static get watchers() { return {
|
|
@@ -78,8 +78,9 @@ export class TabworthyDates {
|
|
|
78
78
|
this.handleCalendarButtonClick = async () => {
|
|
79
79
|
var _a, _b, _c, _d, _e;
|
|
80
80
|
await customElements.whenDefined("tabworthy-dates-modal");
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
// Use input container as trigger for proper dropdown alignment
|
|
82
|
+
this.inputContainerRef &&
|
|
83
|
+
(await ((_a = this.modalRef) === null || _a === void 0 ? void 0 : _a.setTriggerElement(this.inputContainerRef)));
|
|
83
84
|
if ((await ((_b = this.modalRef) === null || _b === void 0 ? void 0 : _b.getState())) === false)
|
|
84
85
|
await ((_c = this.modalRef) === null || _c === void 0 ? void 0 : _c.open());
|
|
85
86
|
else if ((await ((_d = this.modalRef) === null || _d === void 0 ? void 0 : _d.getState())) === true)
|
|
@@ -437,10 +438,10 @@ export class TabworthyDates {
|
|
|
437
438
|
}
|
|
438
439
|
render() {
|
|
439
440
|
var _a;
|
|
440
|
-
return (h(Host, { key: '
|
|
441
|
+
return (h(Host, { key: '3e36f57e5d9f085e0175e79ce7a962e5ec338769' }, h("label", { key: 'ab7c37d2f5becd4caefade892cc6a2b14ffe517d', htmlFor: this.id ? `${this.id}-input` : undefined, class: this.getClassName("label") }, this.label), h("br", { key: '8c0a95500aeb784e6f9bf9295aa09077dc6801ca' }), h("div", { key: '63e8a6ee083b12791b52ecb2da15a736fb40611a', class: this.getClassName("input-container"), ref: (r) => (this.inputContainerRef = r) }, h("input", { key: '06a92d32ad8c629567fcacb4022a5a60ccd4f3d7', disabled: this.disabledState || this.disableFreeformInput, id: this.id ? `${this.id}-input` : undefined, type: "text", placeholder: this.placeholder, class: {
|
|
441
442
|
[this.getClassName("input")]: true,
|
|
442
443
|
[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: '
|
|
444
|
+
}, 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: '1925a172f3fb59c02563495d038f0e9dd806662a', type: "button", 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: 'fb65c2d4e5e9b6daab3b9029315d751214c4a1d3', label: this.datesLabels.calendar, ref: (el) => (this.modalRef = el), onOpened: () => {
|
|
444
445
|
if (!this.pickerRef)
|
|
445
446
|
return;
|
|
446
447
|
this.pickerRef.modalIsOpen = true;
|
|
@@ -448,11 +449,11 @@ export class TabworthyDates {
|
|
|
448
449
|
if (!this.pickerRef)
|
|
449
450
|
return;
|
|
450
451
|
this.pickerRef.modalIsOpen = false;
|
|
451
|
-
}, inline: this.inline }, h("tabworthy-dates-calendar", { key: '
|
|
452
|
+
}, inline: this.inline, appendTo: this.appendTo }, h("tabworthy-dates-calendar", { key: '4f48512b4647749af1f9d2d8bcc31c29f8833e1f', 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
453
|
((_a = this.quickButtons) === null || _a === void 0 ? void 0 : _a.length) > 0 &&
|
|
453
|
-
this.chronoSupportedLocale && (h("div", { key: '
|
|
454
|
+
this.chronoSupportedLocale && (h("div", { key: 'c22bb344f5fd2668d8f09f4fb410baec74e1d047', class: this.getClassName("quick-group"), role: "group", "aria-label": "Quick selection" }, this.quickButtons.map((buttonText) => {
|
|
454
455
|
return (h("button", { class: this.getClassName("quick-button"), onClick: this.handleQuickButtonClick, disabled: this.disabledState, type: "button" }, buttonText));
|
|
455
|
-
}))), this.errorState && (h("div", { key: '
|
|
456
|
+
}))), this.errorState && (h("div", { key: '0c6cacc8d5a536c5a79a9899627c6318c3c85800', class: this.getClassName("input-error"), id: this.id ? `${this.id}-error` : undefined, role: "status" }, this.errorMessage))));
|
|
456
457
|
}
|
|
457
458
|
static get is() { return "tabworthy-dates"; }
|
|
458
459
|
static get encapsulation() { return "scoped"; }
|
|
@@ -1148,6 +1149,30 @@ export class TabworthyDates {
|
|
|
1148
1149
|
"reflect": false,
|
|
1149
1150
|
"attribute": "input-class",
|
|
1150
1151
|
"defaultValue": "\"\""
|
|
1152
|
+
},
|
|
1153
|
+
"appendTo": {
|
|
1154
|
+
"type": "string",
|
|
1155
|
+
"mutable": false,
|
|
1156
|
+
"complexType": {
|
|
1157
|
+
"original": "string | HTMLElement",
|
|
1158
|
+
"resolved": "HTMLElement | string",
|
|
1159
|
+
"references": {
|
|
1160
|
+
"HTMLElement": {
|
|
1161
|
+
"location": "global",
|
|
1162
|
+
"id": "global::HTMLElement"
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
},
|
|
1166
|
+
"required": false,
|
|
1167
|
+
"optional": true,
|
|
1168
|
+
"docs": {
|
|
1169
|
+
"tags": [],
|
|
1170
|
+
"text": "Element to append the dropdown to. Use \"body\" to append to document.body,\nor pass a CSS selector or HTMLElement. Useful for escaping overflow:hidden containers."
|
|
1171
|
+
},
|
|
1172
|
+
"getter": false,
|
|
1173
|
+
"setter": false,
|
|
1174
|
+
"reflect": false,
|
|
1175
|
+
"attribute": "append-to"
|
|
1151
1176
|
}
|
|
1152
1177
|
};
|
|
1153
1178
|
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
:host::part(body) {
|
|
2
|
+
/* Popper.js sets position, top, left, transform */
|
|
2
3
|
position: absolute;
|
|
4
|
+
top: 0;
|
|
5
|
+
left: 0;
|
|
3
6
|
width: -moz-fit-content;
|
|
4
7
|
width: fit-content;
|
|
5
8
|
z-index: 1200;
|
|
6
|
-
margin-top: 0.5rem;
|
|
7
9
|
}
|
|
10
|
+
|
|
8
11
|
:host::part(backdrop) {
|
|
9
12
|
/* Placeholder */
|
|
10
13
|
}
|
|
@@ -1,20 +1,139 @@
|
|
|
1
1
|
import { h, Host } from "@stencil/core";
|
|
2
2
|
import "@a11y/focus-trap";
|
|
3
3
|
import { hideOthers } from "aria-hidden";
|
|
4
|
+
import { createPopper } from "@popperjs/core";
|
|
4
5
|
/**
|
|
5
6
|
* @slot slot - The dialog content
|
|
6
7
|
*/
|
|
7
8
|
export class InclusiveDatesModal {
|
|
8
9
|
constructor() {
|
|
9
10
|
this.inline = false;
|
|
11
|
+
/** Preferred placement of the dropdown (Popper.js placement) */
|
|
12
|
+
this.placement = "bottom-start";
|
|
13
|
+
/** Offset from the trigger element [skidding, distance] */
|
|
14
|
+
this.offset = [0, 8];
|
|
10
15
|
this.closing = false;
|
|
11
16
|
this.showing = this.inline || false;
|
|
17
|
+
this.positioned = false;
|
|
18
|
+
this.originalParent = null;
|
|
19
|
+
this.originalNextSibling = null;
|
|
20
|
+
this.isMovingPortal = false;
|
|
21
|
+
this.popperInstance = null;
|
|
12
22
|
this.onKeyDown = (event) => {
|
|
13
23
|
if (event.code === "Escape") {
|
|
14
24
|
this.close();
|
|
15
25
|
}
|
|
16
26
|
};
|
|
17
27
|
}
|
|
28
|
+
watchShowing(newValue) {
|
|
29
|
+
if (newValue) {
|
|
30
|
+
// Reset positioned state - portal setup happens in render ref callback
|
|
31
|
+
this.positioned = false;
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
this.destroyPopperInstance();
|
|
35
|
+
this.cleanupPortal();
|
|
36
|
+
this.positioned = false;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
getAppendToElement() {
|
|
40
|
+
if (!this.appendTo)
|
|
41
|
+
return null;
|
|
42
|
+
if (this.appendTo === "body") {
|
|
43
|
+
return document.body;
|
|
44
|
+
}
|
|
45
|
+
if (typeof this.appendTo === "string") {
|
|
46
|
+
return document.querySelector(this.appendTo);
|
|
47
|
+
}
|
|
48
|
+
return this.appendTo;
|
|
49
|
+
}
|
|
50
|
+
setupPortal() {
|
|
51
|
+
const appendToEl = this.getAppendToElement();
|
|
52
|
+
if (!appendToEl)
|
|
53
|
+
return;
|
|
54
|
+
// Store original position so we can restore later
|
|
55
|
+
this.originalParent = this.hostElement.parentElement;
|
|
56
|
+
this.originalNextSibling = this.hostElement.nextSibling;
|
|
57
|
+
// Guard against triggering disconnectedCallback during move
|
|
58
|
+
this.isMovingPortal = true;
|
|
59
|
+
appendToEl.appendChild(this.hostElement);
|
|
60
|
+
this.isMovingPortal = false;
|
|
61
|
+
}
|
|
62
|
+
cleanupPortal() {
|
|
63
|
+
// Guard against recursion - moving element triggers disconnectedCallback
|
|
64
|
+
if (this.isMovingPortal)
|
|
65
|
+
return;
|
|
66
|
+
// Move host back to original position
|
|
67
|
+
if (this.originalParent) {
|
|
68
|
+
this.isMovingPortal = true;
|
|
69
|
+
if (this.originalNextSibling) {
|
|
70
|
+
this.originalParent.insertBefore(this.hostElement, this.originalNextSibling);
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
this.originalParent.appendChild(this.hostElement);
|
|
74
|
+
}
|
|
75
|
+
this.originalParent = null;
|
|
76
|
+
this.originalNextSibling = null;
|
|
77
|
+
this.isMovingPortal = false;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
createPopperInstance() {
|
|
81
|
+
if (!this.triggerElement || !this.bodyRef)
|
|
82
|
+
return;
|
|
83
|
+
// Use fixed strategy when portaling to escape scroll containers
|
|
84
|
+
const useFixed = !!this.appendTo;
|
|
85
|
+
// When portaled, use viewport boundary; otherwise use clipping parents
|
|
86
|
+
const boundary = useFixed ? "viewport" : "clippingParents";
|
|
87
|
+
this.popperInstance = createPopper(this.triggerElement, this.bodyRef, {
|
|
88
|
+
placement: this.placement,
|
|
89
|
+
strategy: useFixed ? "fixed" : "absolute",
|
|
90
|
+
modifiers: [
|
|
91
|
+
{
|
|
92
|
+
name: "offset",
|
|
93
|
+
options: {
|
|
94
|
+
offset: this.offset
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
name: "flip",
|
|
99
|
+
options: {
|
|
100
|
+
fallbackPlacements: ["top-start", "top-end", "bottom-end"],
|
|
101
|
+
boundary
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name: "preventOverflow",
|
|
106
|
+
options: {
|
|
107
|
+
boundary,
|
|
108
|
+
altAxis: true,
|
|
109
|
+
padding: 8
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: "computeStyles",
|
|
114
|
+
options: {
|
|
115
|
+
// Use GPU acceleration for smooth animations
|
|
116
|
+
gpuAcceleration: true
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
// Custom modifier to ensure initial position is applied immediately
|
|
121
|
+
name: "applyStyles",
|
|
122
|
+
enabled: true
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
});
|
|
126
|
+
// Force immediate position update
|
|
127
|
+
this.popperInstance.forceUpdate();
|
|
128
|
+
// Mark as positioned to show the element
|
|
129
|
+
this.positioned = true;
|
|
130
|
+
}
|
|
131
|
+
destroyPopperInstance() {
|
|
132
|
+
if (this.popperInstance) {
|
|
133
|
+
this.popperInstance.destroy();
|
|
134
|
+
this.popperInstance = null;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
18
137
|
/**
|
|
19
138
|
* Open the dialog.
|
|
20
139
|
*/
|
|
@@ -29,27 +148,66 @@ export class InclusiveDatesModal {
|
|
|
29
148
|
* Close the dialog.
|
|
30
149
|
*/
|
|
31
150
|
async close() {
|
|
151
|
+
var _a;
|
|
32
152
|
if (this.inline)
|
|
33
153
|
return;
|
|
34
154
|
this.showing = false;
|
|
35
155
|
this.closed.emit(undefined);
|
|
36
|
-
this.undo();
|
|
156
|
+
(_a = this.undo) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
37
157
|
if (this.triggerElement)
|
|
38
158
|
this.triggerElement.focus();
|
|
39
159
|
}
|
|
160
|
+
disconnectedCallback() {
|
|
161
|
+
// Skip cleanup if we're in the middle of portal operations
|
|
162
|
+
if (this.isMovingPortal)
|
|
163
|
+
return;
|
|
164
|
+
this.destroyPopperInstance();
|
|
165
|
+
this.cleanupPortal();
|
|
166
|
+
}
|
|
40
167
|
async getState() {
|
|
41
168
|
return this.showing;
|
|
42
169
|
}
|
|
43
170
|
async setTriggerElement(element) {
|
|
44
171
|
this.triggerElement = element;
|
|
45
172
|
}
|
|
173
|
+
/** Force update the popper position */
|
|
174
|
+
async updatePosition() {
|
|
175
|
+
var _a;
|
|
176
|
+
await ((_a = this.popperInstance) === null || _a === void 0 ? void 0 : _a.update());
|
|
177
|
+
}
|
|
46
178
|
handleClick(event) {
|
|
47
|
-
|
|
48
|
-
|
|
179
|
+
var _a;
|
|
180
|
+
if (this.showing) {
|
|
181
|
+
const target = event.target;
|
|
182
|
+
// Check if click is inside the host element, trigger element, or original parent (when portaled)
|
|
183
|
+
const clickedInside = this.hostElement.contains(target) ||
|
|
184
|
+
((_a = this.triggerElement) === null || _a === void 0 ? void 0 : _a.contains(target)) ||
|
|
185
|
+
// When portaled, also check the original parent to avoid closing on container clicks
|
|
186
|
+
(this.originalParent && this.originalParent.contains(target));
|
|
187
|
+
if (!clickedInside) {
|
|
188
|
+
this.close();
|
|
189
|
+
}
|
|
49
190
|
}
|
|
50
191
|
}
|
|
51
192
|
render() {
|
|
52
|
-
return (h(Host, { key: '
|
|
193
|
+
return (h(Host, { key: '35e8ed14b0108e9cb75782516d070dfb8474b0b2', showing: this.showing, ref: (r) => r && (this.el = r) }, !this.inline && this.showing && (h("div", { key: 'fdb64ed8717e2a1620ef2d4ffb21a44d1de03a46', part: "body", ref: (r) => {
|
|
194
|
+
if (r) {
|
|
195
|
+
this.bodyRef = r;
|
|
196
|
+
// Setup portal and create popper when ref is set
|
|
197
|
+
if (this.showing &&
|
|
198
|
+
this.triggerElement &&
|
|
199
|
+
!this.popperInstance) {
|
|
200
|
+
// Setup portal first (move element to body), then create popper
|
|
201
|
+
this.setupPortal();
|
|
202
|
+
// Use double RAF to ensure DOM is fully settled after portal move
|
|
203
|
+
requestAnimationFrame(() => {
|
|
204
|
+
requestAnimationFrame(() => {
|
|
205
|
+
this.createPopperInstance();
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}, style: { visibility: this.positioned ? "visible" : "hidden" }, onKeyDown: this.onKeyDown, role: "dialog", tabindex: -1, "aria-hidden": !this.showing, "aria-label": this.label, "aria-modal": this.showing }, h("focus-trap", { key: 'af4734b1a18dd62a600ca49313b1ba07f2d19039' }, h("div", { key: 'fb41d5ce07b5aac179e4bed63c18a8d254503a50', part: "content" }, h("slot", { key: 'fc480cf1a29a42b1a19737a72d410c139dc32f07' }))))), this.inline && (h("div", { key: '7aef10d50f790a1e72e05b26dc108c40500fa7c3', part: "content" }, h("slot", { key: '06395cd19052d1b81ab448c0a9a618da876fa86d' })))));
|
|
53
211
|
}
|
|
54
212
|
static get is() { return "tabworthy-dates-modal"; }
|
|
55
213
|
static get encapsulation() { return "shadow"; }
|
|
@@ -103,13 +261,83 @@ export class InclusiveDatesModal {
|
|
|
103
261
|
"reflect": false,
|
|
104
262
|
"attribute": "inline",
|
|
105
263
|
"defaultValue": "false"
|
|
264
|
+
},
|
|
265
|
+
"placement": {
|
|
266
|
+
"type": "string",
|
|
267
|
+
"mutable": false,
|
|
268
|
+
"complexType": {
|
|
269
|
+
"original": "Placement",
|
|
270
|
+
"resolved": "\"auto\" | \"auto-end\" | \"auto-start\" | \"bottom\" | \"bottom-end\" | \"bottom-start\" | \"left\" | \"left-end\" | \"left-start\" | \"right\" | \"right-end\" | \"right-start\" | \"top\" | \"top-end\" | \"top-start\"",
|
|
271
|
+
"references": {
|
|
272
|
+
"Placement": {
|
|
273
|
+
"location": "import",
|
|
274
|
+
"path": "@popperjs/core",
|
|
275
|
+
"id": "node_modules::Placement",
|
|
276
|
+
"referenceLocation": "Placement"
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
"required": false,
|
|
281
|
+
"optional": false,
|
|
282
|
+
"docs": {
|
|
283
|
+
"tags": [],
|
|
284
|
+
"text": "Preferred placement of the dropdown (Popper.js placement)"
|
|
285
|
+
},
|
|
286
|
+
"getter": false,
|
|
287
|
+
"setter": false,
|
|
288
|
+
"reflect": false,
|
|
289
|
+
"attribute": "placement",
|
|
290
|
+
"defaultValue": "\"bottom-start\""
|
|
291
|
+
},
|
|
292
|
+
"offset": {
|
|
293
|
+
"type": "unknown",
|
|
294
|
+
"mutable": false,
|
|
295
|
+
"complexType": {
|
|
296
|
+
"original": "[number, number]",
|
|
297
|
+
"resolved": "[number, number]",
|
|
298
|
+
"references": {}
|
|
299
|
+
},
|
|
300
|
+
"required": false,
|
|
301
|
+
"optional": false,
|
|
302
|
+
"docs": {
|
|
303
|
+
"tags": [],
|
|
304
|
+
"text": "Offset from the trigger element [skidding, distance]"
|
|
305
|
+
},
|
|
306
|
+
"getter": false,
|
|
307
|
+
"setter": false,
|
|
308
|
+
"defaultValue": "[0, 8]"
|
|
309
|
+
},
|
|
310
|
+
"appendTo": {
|
|
311
|
+
"type": "string",
|
|
312
|
+
"mutable": false,
|
|
313
|
+
"complexType": {
|
|
314
|
+
"original": "string | HTMLElement",
|
|
315
|
+
"resolved": "HTMLElement | string",
|
|
316
|
+
"references": {
|
|
317
|
+
"HTMLElement": {
|
|
318
|
+
"location": "global",
|
|
319
|
+
"id": "global::HTMLElement"
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
},
|
|
323
|
+
"required": false,
|
|
324
|
+
"optional": true,
|
|
325
|
+
"docs": {
|
|
326
|
+
"tags": [],
|
|
327
|
+
"text": "Element to append the dropdown to. Use \"body\" to append to document.body,\nor pass a CSS selector or HTMLElement. When set, the dropdown will be\nportaled to escape overflow:hidden containers."
|
|
328
|
+
},
|
|
329
|
+
"getter": false,
|
|
330
|
+
"setter": false,
|
|
331
|
+
"reflect": false,
|
|
332
|
+
"attribute": "append-to"
|
|
106
333
|
}
|
|
107
334
|
};
|
|
108
335
|
}
|
|
109
336
|
static get states() {
|
|
110
337
|
return {
|
|
111
338
|
"closing": {},
|
|
112
|
-
"showing": {}
|
|
339
|
+
"showing": {},
|
|
340
|
+
"positioned": {}
|
|
113
341
|
};
|
|
114
342
|
}
|
|
115
343
|
static get events() {
|
|
@@ -222,9 +450,33 @@ export class InclusiveDatesModal {
|
|
|
222
450
|
"text": "",
|
|
223
451
|
"tags": []
|
|
224
452
|
}
|
|
453
|
+
},
|
|
454
|
+
"updatePosition": {
|
|
455
|
+
"complexType": {
|
|
456
|
+
"signature": "() => Promise<void>",
|
|
457
|
+
"parameters": [],
|
|
458
|
+
"references": {
|
|
459
|
+
"Promise": {
|
|
460
|
+
"location": "global",
|
|
461
|
+
"id": "global::Promise"
|
|
462
|
+
}
|
|
463
|
+
},
|
|
464
|
+
"return": "Promise<void>"
|
|
465
|
+
},
|
|
466
|
+
"docs": {
|
|
467
|
+
"text": "Force update the popper position",
|
|
468
|
+
"tags": []
|
|
469
|
+
}
|
|
225
470
|
}
|
|
226
471
|
};
|
|
227
472
|
}
|
|
473
|
+
static get elementRef() { return "hostElement"; }
|
|
474
|
+
static get watchers() {
|
|
475
|
+
return [{
|
|
476
|
+
"propName": "showing",
|
|
477
|
+
"methodName": "watchShowing"
|
|
478
|
+
}];
|
|
479
|
+
}
|
|
228
480
|
static get listeners() {
|
|
229
481
|
return [{
|
|
230
482
|
"name": "click",
|
|
@@ -93,7 +93,8 @@ export class InclusiveTimes {
|
|
|
93
93
|
};
|
|
94
94
|
this.handleCalendarButtonClick = async () => {
|
|
95
95
|
if (this.modalRef) {
|
|
96
|
-
|
|
96
|
+
// Use input container as trigger for proper dropdown alignment
|
|
97
|
+
await this.modalRef.setTriggerElement(this.inputContainerRef);
|
|
97
98
|
await this.modalRef.open();
|
|
98
99
|
}
|
|
99
100
|
};
|
|
@@ -230,10 +231,10 @@ export class InclusiveTimes {
|
|
|
230
231
|
}
|
|
231
232
|
render() {
|
|
232
233
|
var _a;
|
|
233
|
-
return (h(Host, { key: '
|
|
234
|
+
return (h(Host, { key: '5dab8801e9296bb948cef7aea77b03bf40a74089', class: this.elementClassName, "has-error": this.errorState, disabled: this.disabledState }, h("label", { key: '4325a32a8a68423db7e287e759684c925dbffa6d', htmlFor: `${this.id}-input`, class: this.getClassName("label") }, this.label), h("div", { key: '618590fadfa9d63a54b7a545d7377003510e85fc', class: this.getClassName("input-container"), ref: (r) => (this.inputContainerRef = r) }, h("input", { key: 'fd0716e2cea9ede2cac51f1cd7ba1a6167157837', id: `${this.id}-input`, ref: (r) => (this.inputRef = r), type: "text", class: {
|
|
234
235
|
[this.getClassName("input")]: true,
|
|
235
236
|
[this.inputClass]: !!this.inputClass
|
|
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: '
|
|
237
|
+
}, 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: '9dc03047b232cb7286701d4f83daabc0f71c8a3b', type: "button", onClick: this.handleCalendarButtonClick, class: this.getClassName("calendar-button"), disabled: this.disabledState }, this.calendarButtonContent ? (h("span", { innerHTML: this.calendarButtonContent })) : (this.timesLabels.openCalendar)))), h("tabworthy-dates-modal", { key: '9b3321ec4b767d804766d43820b3938862aba46f', label: this.timesLabels.calendar, ref: (el) => (this.modalRef = el), onOpened: () => {
|
|
237
238
|
if (this.pickerRef) {
|
|
238
239
|
this.pickerRef.modalIsOpen = true;
|
|
239
240
|
}
|
|
@@ -241,7 +242,7 @@ export class InclusiveTimes {
|
|
|
241
242
|
if (this.pickerRef) {
|
|
242
243
|
this.pickerRef.modalIsOpen = false;
|
|
243
244
|
}
|
|
244
|
-
}, inline: this.inline }, h("div", { key: '
|
|
245
|
+
}, inline: this.inline, appendTo: this.appendTo }, h("div", { key: '8cd6f661951ad17c95ad6cd8fe5482afa699e824', class: this.getClassName("picker-container") }, h("tabworthy-dates-calendar", { key: '85644573834a86c977b36dc71430f5f9b6a9da95', 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: 'f13b4a24fcc3b4b2914a80db7e087082c9d2743f', slot: "after-calendar", class: this.getClassName("time-section") }, h("hr", { key: '5b2641318160e08f1a4a3fdad849647c0a50affa', class: this.getClassName("divider") }), h("tabworthy-times-picker", { key: 'fba59fa7bd2a0e119b28b69eff15445f972924d6', hours: this.selectedHours, minutes: this.selectedMinutes, useTwelveHourFormat: this.useTwelveHourFormat, disabled: this.disabledState, onTimeChanged: this.handleTimeChange }))))), this.errorState && (h("div", { key: '4018611f9e51219a3ee1497f871e83c51b6bc29b', class: this.getClassName("input-error"), id: this.id ? `${this.id}-error` : undefined, role: "status" }, this.errorMessage))));
|
|
245
246
|
}
|
|
246
247
|
static get is() { return "tabworthy-times"; }
|
|
247
248
|
static get encapsulation() { return "scoped"; }
|
|
@@ -812,6 +813,30 @@ export class InclusiveTimes {
|
|
|
812
813
|
"reflect": false,
|
|
813
814
|
"attribute": "input-class",
|
|
814
815
|
"defaultValue": "\"\""
|
|
816
|
+
},
|
|
817
|
+
"appendTo": {
|
|
818
|
+
"type": "string",
|
|
819
|
+
"mutable": false,
|
|
820
|
+
"complexType": {
|
|
821
|
+
"original": "string | HTMLElement",
|
|
822
|
+
"resolved": "HTMLElement | string",
|
|
823
|
+
"references": {
|
|
824
|
+
"HTMLElement": {
|
|
825
|
+
"location": "global",
|
|
826
|
+
"id": "global::HTMLElement"
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
},
|
|
830
|
+
"required": false,
|
|
831
|
+
"optional": true,
|
|
832
|
+
"docs": {
|
|
833
|
+
"tags": [],
|
|
834
|
+
"text": "Element to append the dropdown to. Use \"body\" to append to document.body,\nor pass a CSS selector or HTMLElement. Useful for escaping overflow:hidden containers."
|
|
835
|
+
},
|
|
836
|
+
"getter": false,
|
|
837
|
+
"setter": false,
|
|
838
|
+
"reflect": false,
|
|
839
|
+
"attribute": "append-to"
|
|
815
840
|
}
|
|
816
841
|
};
|
|
817
842
|
}
|
package/dist/components/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t}from"./p-
|
|
1
|
+
import{t}from"./p-BiJ0HZVY.js";export{g as getAssetPath,r as render,s as setAssetPath,a as setNonce,b as setPlatformOptions}from"./p-BiJ0HZVY.js";import{TabworthyDates as o}from"./tabworthy-dates.js";import{TabworthyDatesCalendar as e}from"./tabworthy-dates-calendar.js";import{TabworthyDatesModal as m}from"./tabworthy-dates-modal.js";import{TabworthyTimes as i}from"./tabworthy-times.js";import{TabworthyTimesPicker as p}from"./tabworthy-times-picker.js";const f=s=>{"undefined"!=typeof customElements&&[o,e,m,i,p].forEach((o=>{customElements.get(t(o.is))||customElements.define(t(o.is),o,s)}))};export{f as defineCustomElements}
|