@tabworthy/components 0.12.2 → 0.12.4
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 +22 -6
- package/dist/cjs/tabworthy-dates.cjs.entry.js +4 -2
- package/dist/cjs/tabworthy-times.cjs.entry.js +5 -3
- package/dist/collection/components/tabworthy-dates/tabworthy-dates.js +80 -2
- package/dist/collection/components/tabworthy-dates-calendar/tabworthy-dates-calendar.js +22 -6
- package/dist/collection/components/tabworthy-times/tabworthy-times.js +138 -3
- package/dist/components/p-DAc3jaFB.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.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 +22 -6
- package/dist/esm/tabworthy-dates.entry.js +4 -2
- package/dist/esm/tabworthy-times.entry.js +5 -3
- package/dist/tabworthy-components/p-28192b55.entry.js +1 -0
- package/dist/tabworthy-components/{p-744ffef9.entry.js → p-3b548ae1.entry.js} +1 -1
- package/dist/tabworthy-components/{p-04240a8d.entry.js → p-626a5c0b.entry.js} +1 -1
- package/dist/tabworthy-components/tabworthy-components.esm.js +1 -1
- package/dist/types/components/tabworthy-dates/tabworthy-dates.d.ts +4 -0
- package/dist/types/components/tabworthy-times/tabworthy-times.d.ts +7 -0
- package/dist/types/components.d.ts +33 -0
- package/package.json +1 -2
- package/dist/components/p-M03P4DAz.js +0 -1
- package/dist/tabworthy-components/p-df93e5d4.entry.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,c as s,h as i,H as h,g as e}from"./p-CwtZ_Lud.js";import{g as a,d as
|
|
1
|
+
import{r as t,c as s,h as i,H as h,g as e}from"./p-CwtZ_Lud.js";import{g as a,d as n,c as r}from"./p-DkyM-7xr.js";import{g as o,r as d}from"./p-BVHu5CWV.js";var l,c,u={exports:{}},b=a(l?u.exports:(l=1,u.exports=(c={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},function(t,s,i){var h=s.prototype,e=h.format;i.en.formats=c,h.format=function(t){void 0===t&&(t="YYYY-MM-DDTHH:mm:ssZ");var s=this.$locale().formats,i=function(t,s){return t.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(t,i,h){var e=h&&h.toUpperCase();return i||s[h]||c[h]||s[e].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(t,s,i){return s||i.slice(1)}))}))}(t,void 0===s?{}:s);return e.call(this,i)}})));n.extend(r),n.extend(b);const f={selected:"selected",openCalendar:"Choose time",calendar:"date and time picker",invalidDateError:"We could not find a matching date",minDateError:"Please fill in a date after ",maxDateError:"Please fill in a date before ",rangeOutOfBoundsError:"Please enter a valid range of dates",disabledDateError:"Please choose an available date",to:"to",startDate:"Start date",timeLabel:"Time"},m=class{constructor(i){t(this,i),this.selectDateTime=s(this,"selectDateTime",7),this.changeYear=s(this,"changeYear",7),this.componentReady=s(this,"componentReady",7),this.range=!1,this.label="Choose a date and time",this.placeholder="",this.locale=(null===navigator||void 0===navigator?void 0:navigator.language)||"en-US",this.disabled=!1,this.startDate=o(new Date),this.referenceDate=o(new Date),this.useTwelveHourFormat=!0,this.showSeconds=!1,this.timesLabels=f,this.inline=!1,this.hasError=!1,this.showYearStepper=!1,this.showMonthStepper=!0,this.showClearButton=!0,this.showCloseButton=!1,this.showTodayButton=!0,this.disableDate=()=>!1,this.elementClassName="tabworthy-times",this.firstDayOfWeek=1,this.format="YYYY-MM-DDTHH:mm:ss",this.inputShouldFormat=!0,this.disableFreeformInput=!1,this.inputClass="",this.selectedHours=(new Date).getHours(),this.selectedMinutes=(new Date).getMinutes(),this.selectedSeconds=(new Date).getSeconds(),this.errorState=this.hasError,this.disabledState=this.disabled,this.errorMessage="",this.handlePickerSelection=async t=>{if(!t)return this.clearValue();const s=t.split(",");if(this.range&&2===s.length){const t=d(new Date(s[0])),i=d(new Date(s[1]));this.updateValue([t,i]),this.pickerRef&&(this.pickerRef.value=[t,i])}else{const t=d(new Date(s[0]));this.updateValue(t),this.pickerRef&&(this.pickerRef.value=t)}},this.handleTimeChange=t=>{this.selectedHours=t.detail.hours,this.selectedMinutes=t.detail.minutes,void 0!==t.detail.seconds&&(this.selectedSeconds=t.detail.seconds),this.selectedDate&&this.updateValue(this.selectedDate)},this.handleCalendarButtonClick=async()=>{this.modalRef&&(await this.modalRef.setTriggerElement(this.inputContainerRef),await this.modalRef.open())},this.handleYearChange=t=>{this.changeYear&&this.changeYear.emit(t)},this.handleChangedMonths=()=>{},this.handleInputBlur=()=>{this.shouldInputFormat()&&this.formatInput()},this.handleInputChange=t=>{const s=t.target.value;if(0===s.length)return this.errorState=!1,this.internalValue="",this.pickerRef&&(this.pickerRef.value=null),this.value=this.internalValue,this.selectDateTime.emit(this.internalValue);let i=n(s,this.format,!0);i.isValid()||(i=n(s)),i.isValid()?(this.errorState=!1,this.selectedHours=i.hour(),this.selectedMinutes=i.minute(),this.selectedSeconds=i.second(),this.updateValue(i.toDate())):(this.errorState=!0,this.errorMessage=this.timesLabels.invalidDateError)}}shouldInputFormat(){return"string"==typeof this.inputShouldFormat?"true"===this.inputShouldFormat:!!this.inputShouldFormat}watchValue(t){this.syncFromValueProp()}watchDisabled(t){this.disabledState=t}watchHasError(t){this.errorState=t}componentDidLoad(){this.syncFromValueProp(),this.componentReady.emit(),this.id||console.error('tabworthy-times: The "id" prop is required for accessibility')}syncFromValueProp(){if(this.value){this.internalValue=this.value;const t=Array.isArray(this.value)?this.value[0]:this.value;if(t){const s=n(t,this.format);s.isValid()&&(this.selectedDate=s.toDate(),this.selectedHours=s.hour(),this.selectedMinutes=s.minute(),this.selectedSeconds=s.second())}}else this.internalValue=null}updateValue(t){if(Array.isArray(t)){const s=t.map((t=>n(t).hour(this.selectedHours).minute(this.selectedMinutes).second(this.selectedSeconds).format(this.format)));this.internalValue=s,this.value=s,this.selectDateTime.emit(s)}else{const s=n(t).hour(this.selectedHours).minute(this.selectedMinutes).second(this.selectedSeconds).format(this.format);this.internalValue=s,this.value=s,this.selectedDate=t,this.selectDateTime.emit(s)}this.errorState=!1,this.shouldInputFormat()&&this.formatInput()}formatInput(){if(this.internalValue)if(Array.isArray(this.internalValue)){const t=this.internalValue.map((t=>n(t,this.format).format("lll"))).join(` ${this.timesLabels.to} `);this.inputRef.value=t}else this.inputRef.value=n(this.internalValue,this.format).format("lll")}getClassName(t){return`${this.elementClassName}__${t}`}toDate(t){return t?Array.isArray(t)?t.map((t=>n(t,this.format).toDate())):n(t,this.format).toDate():null}async clearValue(){this.internalValue=null,this.value=void 0,this.selectedDate=void 0,this.inputRef&&(this.inputRef.value=""),this.pickerRef&&(this.pickerRef.value=null),this.selectDateTime.emit(void 0)}render(){var t;return i(h,{key:"e07a561aa76dedbf8f8e28c491b3aac19f45c472",class:this.elementClassName,"has-error":this.errorState,disabled:this.disabledState},i("label",{key:"24e11901760a8c7f989f3d33df9cd58af899a8dc",htmlFor:`${this.id}-input`,class:this.getClassName("label")},this.label),i("div",{key:"17c4a53c621b66e62f857d49b4b8f4b52d51183d",class:this.getClassName("input-container"),ref:t=>this.inputContainerRef=t},i("input",{key:"7dd776e464533c7bb6c842a0332f0d667f52c7cc",id:`${this.id}-input`,ref:t=>this.inputRef=t,type:"text",class:{[this.getClassName("input")]:!0,[this.inputClass]:!!this.inputClass},placeholder:this.placeholder,disabled:this.disabledState||this.disableFreeformInput,value:null===(t=this.internalValue)||void 0===t?void 0:t.toString(),onBlur:this.handleInputBlur,onChange:this.handleInputChange,"aria-describedby":this.errorState?`${this.id}-error`:void 0,"aria-invalid":this.errorState}),!this.inline&&i("button",{key:"0e84b4e3ae7f5abe1a59e939cccc227bf34ab992",type:"button",onClick:this.handleCalendarButtonClick,class:this.getClassName("calendar-button"),disabled:this.disabledState,"aria-label":this.calendarButtonContent?this.timesLabels.openCalendar:void 0},this.calendarButtonContent?i("span",{innerHTML:this.calendarButtonContent}):this.timesLabels.openCalendar)),i("tabworthy-dates-modal",{key:"baebeeeda4200bf13fe8f023bb39e2c13fc58b0b",label:this.timesLabels.calendar,ref:t=>this.modalRef=t,onOpened:()=>{this.pickerRef&&(this.pickerRef.modalIsOpen=!0)},onClosed:()=>{this.pickerRef&&(this.pickerRef.modalIsOpen=!1)},inline:this.inline,appendTo:this.appendTo},i("div",{key:"0fc94282af5f36ae9214e967dab2acac911bca14",class:this.getClassName("picker-container")},i("tabworthy-dates-calendar",{key:"4b0ef9c95058398d759fe913b22a84d5f22bd383",range:this.range,locale:this.locale,onSelectDate:t=>this.handlePickerSelection(t.detail),onChangeMonth:t=>this.handleChangedMonths(t.detail),onChangeYear:t=>this.handleYearChange(t.detail),onRequestClose:()=>{var t;return null===(t=this.modalRef)||void 0===t?void 0:t.close()},labels:this.datesCalendarLabels,ref:t=>this.pickerRef=t,startDate:this.startDate,firstDayOfWeek:this.firstDayOfWeek,showHiddenTitle:!0,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):void 0,nextMonthButtonContent:this.nextMonthButtonContent,nextYearButtonContent:this.nextYearButtonContent,previousMonthButtonContent:this.previousMonthButtonContent,previousYearButtonContent:this.previousYearButtonContent,todayButtonContent:this.todayButtonContent,clearButtonContent:this.clearButtonContent,closeButtonContent:this.closeButtonContent},i("div",{key:"b766d90c7bb4732c6ae26cadeb610a6e0c10a597",slot:"after-calendar",class:this.getClassName("time-section")},i("hr",{key:"f98fc31d11a3bdd999a5dc0cc15bf1921f349b9b",class:this.getClassName("divider")}),i("tabworthy-times-picker",{key:"cfe86bb9291d1a14d37ab7240ec2f2f7f9bece4d",hours:this.selectedHours,minutes:this.selectedMinutes,seconds:this.selectedSeconds,showSeconds:this.showSeconds,useTwelveHourFormat:this.useTwelveHourFormat,disabled:this.disabledState,onTimeChanged:this.handleTimeChange,labels:this.timesPickerLabels}))))),this.errorState&&i("div",{key:"1c2d4b6469266b894402512612a71721acf28f7e",class:this.getClassName("input-error"),id:this.id?`${this.id}-error`:void 0,role:"status"},this.errorMessage))}get el(){return e(this)}static get watchers(){return{value:[{watchValue:0}],disabled:[{watchDisabled:0}],hasError:[{watchHasError:0}]}}};export{m as tabworthy_times}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as
|
|
1
|
+
import{p as t,b as e}from"./p-CwtZ_Lud.js";export{s as setNonce}from"./p-CwtZ_Lud.js";import{g as n}from"./p-DQuL1Twl.js";(()=>{const e=import.meta.url,n={};return""!==e&&(n.resourcesUrl=new URL(".",e).href),t(n)})().then((async t=>(await n(),e([["p-1743bf7a",[[2,"tabworthy-times-picker",{hours:[1026],minutes:[1026],seconds:[1026],useTwelveHourFormat:[4,"use-twelve-hour-format"],showSeconds:[4,"show-seconds"],labels:[16],labelsSrOnly:[4,"labels-sr-only"],disabled:[4],elementClassName:[1,"element-class-name"],internalHours:[32],internalMinutes:[32],internalSeconds:[32],period:[32]},null,{hours:[{watchHours:0}],minutes:[{watchMinutes:0}],seconds:[{watchSeconds:0}]}]]],["p-28192b55",[[262,"tabworthy-dates-calendar",{clearButtonContent:[1,"clear-button-content"],closeButtonContent:[1,"close-button-content"],disabled:[4],modalIsOpen:[4,"modal-is-open"],disableDate:[16],elementClassName:[1,"element-class-name"],firstDayOfWeek:[2,"first-day-of-week"],range:[4],labels:[16],locale:[1],nextMonthButtonContent:[1,"next-month-button-content"],nextYearButtonContent:[1,"next-year-button-content"],previousMonthButtonContent:[1,"previous-month-button-content"],previousYearButtonContent:[1,"previous-year-button-content"],minDate:[1,"min-date"],maxDate:[1,"max-date"],inline:[4],showClearButton:[4,"show-clear-button"],showCloseButton:[4,"show-close-button"],showMonthStepper:[4,"show-month-stepper"],showTodayButton:[4,"show-today-button"],showYearStepper:[4,"show-year-stepper"],showKeyboardHint:[4,"show-keyboard-hint"],showHiddenTitle:[4,"show-hidden-title"],startDate:[1,"start-date"],todayButtonContent:[1,"today-button-content"],value:[1040],currentDate:[32],hoveredDate:[32],weekdays:[32]},null,{modalIsOpen:[{watchModalIsOpen:0}],firstDayOfWeek:[{watchFirstDayOfWeek:0}],locale:[{watchLocale:0}],range:[{watchRange:0}],startDate:[{watchStartDate:0}],value:[{watchValue:0}]}],[257,"tabworthy-dates-modal",{label:[1],inline:[4],placement:[1],offset:[16],appendTo:[1,"append-to"],closing:[32],showing:[32],positioned:[32],open:[64],close:[64],getState:[64],setTriggerElement:[64],updatePosition:[64]},[[10,"click","handleClick"]],{showing:[{watchShowing:0}]}]]],["p-626a5c0b",[[2,"tabworthy-times",{id:[513],value:[1025],range:[4],label:[1],placeholder:[1],locale:[1],disabled:[4],minDate:[1,"min-date"],maxDate:[1,"max-date"],startDate:[1,"start-date"],referenceDate:[1,"reference-date"],useTwelveHourFormat:[4,"use-twelve-hour-format"],showSeconds:[4,"show-seconds"],timesLabels:[16],datesCalendarLabels:[16],timesPickerLabels:[16],inline:[4],hasError:[1028,"has-error"],showYearStepper:[4,"show-year-stepper"],showMonthStepper:[4,"show-month-stepper"],showClearButton:[4,"show-clear-button"],showCloseButton:[4,"show-close-button"],showTodayButton:[4,"show-today-button"],calendarButtonContent:[1,"calendar-button-content"],nextMonthButtonContent:[1,"next-month-button-content"],nextYearButtonContent:[1,"next-year-button-content"],previousMonthButtonContent:[1,"previous-month-button-content"],previousYearButtonContent:[1,"previous-year-button-content"],todayButtonContent:[1,"today-button-content"],clearButtonContent:[1,"clear-button-content"],closeButtonContent:[1,"close-button-content"],disableDate:[16],elementClassName:[1,"element-class-name"],firstDayOfWeek:[2,"first-day-of-week"],format:[1],inputShouldFormat:[8,"input-should-format"],disableFreeformInput:[4,"disable-freeform-input"],inputClass:[1,"input-class"],appendTo:[1,"append-to"],internalValue:[32],selectedDate:[32],selectedHours:[32],selectedMinutes:[32],selectedSeconds:[32],errorState:[32],disabledState:[32],clearValue:[64]},null,{value:[{watchValue:0}],disabled:[{watchDisabled:0}],hasError:[{watchHasError:0}]}]]],["p-3b548ae1",[[2,"tabworthy-dates",{id:[513],value:[1025],range:[4],yearOnly:[4,"year-only"],label:[1],placeholder:[1],locale:[1],disabled:[4],minDate:[1,"min-date"],maxDate:[1,"max-date"],startDate:[1,"start-date"],referenceDate:[1,"reference-date"],useStrictDateParsing:[4,"use-strict-date-parsing"],datesLabels:[16],datesCalendarLabels:[16],inline:[4],hasError:[1028,"has-error"],nextMonthButtonContent:[1,"next-month-button-content"],nextYearButtonContent:[1,"next-year-button-content"],previousMonthButtonContent:[1,"previous-month-button-content"],previousYearButtonContent:[1,"previous-year-button-content"],showYearStepper:[4,"show-year-stepper"],showMonthStepper:[4,"show-month-stepper"],showClearButton:[4,"show-clear-button"],showCloseButton:[4,"show-close-button"],showTodayButton:[4,"show-today-button"],inputShouldFormat:[8,"input-should-format"],showKeyboardHint:[4,"show-keyboard-hint"],disableDate:[16],elementClassName:[1,"element-class-name"],firstDayOfWeek:[2,"first-day-of-week"],format:[1],quickButtons:[16],todayButtonContent:[1,"today-button-content"],clearButtonContent:[1,"clear-button-content"],closeButtonContent:[1,"close-button-content"],calendarButtonContent:[1,"calendar-button-content"],showQuickButtons:[4,"show-quick-buttons"],disableFreeformInput:[4,"disable-freeform-input"],inputClass:[1,"input-class"],appendTo:[1,"append-to"],internalValue:[32],errorState:[32],disabledState:[32],parseDate:[64]},null,{disabled:[{watchDisabled:0}],value:[{watchValue:0}]}]]]],t))));
|
|
@@ -37,6 +37,8 @@ export declare class TabworthyDates {
|
|
|
37
37
|
hasError: boolean;
|
|
38
38
|
nextMonthButtonContent?: string;
|
|
39
39
|
nextYearButtonContent?: string;
|
|
40
|
+
previousMonthButtonContent?: string;
|
|
41
|
+
previousYearButtonContent?: string;
|
|
40
42
|
showYearStepper: boolean;
|
|
41
43
|
showMonthStepper: boolean;
|
|
42
44
|
showClearButton: boolean;
|
|
@@ -50,6 +52,8 @@ export declare class TabworthyDates {
|
|
|
50
52
|
format: string;
|
|
51
53
|
quickButtons: string[];
|
|
52
54
|
todayButtonContent?: string;
|
|
55
|
+
clearButtonContent?: string;
|
|
56
|
+
closeButtonContent?: string;
|
|
53
57
|
calendarButtonContent?: string;
|
|
54
58
|
showQuickButtons: boolean;
|
|
55
59
|
disableFreeformInput: boolean;
|
|
@@ -31,6 +31,13 @@ export declare class TabworthyTimes {
|
|
|
31
31
|
showCloseButton: boolean;
|
|
32
32
|
showTodayButton: boolean;
|
|
33
33
|
calendarButtonContent?: string;
|
|
34
|
+
nextMonthButtonContent?: string;
|
|
35
|
+
nextYearButtonContent?: string;
|
|
36
|
+
previousMonthButtonContent?: string;
|
|
37
|
+
previousYearButtonContent?: string;
|
|
38
|
+
todayButtonContent?: string;
|
|
39
|
+
clearButtonContent?: string;
|
|
40
|
+
closeButtonContent?: string;
|
|
34
41
|
disableDate: (date: Date) => boolean;
|
|
35
42
|
elementClassName?: string;
|
|
36
43
|
firstDayOfWeek?: number;
|
|
@@ -28,6 +28,8 @@ export namespace Components {
|
|
|
28
28
|
*/
|
|
29
29
|
"appendTo"?: string | HTMLElement;
|
|
30
30
|
"calendarButtonContent"?: string;
|
|
31
|
+
"clearButtonContent"?: string;
|
|
32
|
+
"closeButtonContent"?: string;
|
|
31
33
|
"datesCalendarLabels"?: DatesCalendarLabels;
|
|
32
34
|
/**
|
|
33
35
|
* @default defaultLabels
|
|
@@ -92,6 +94,8 @@ export namespace Components {
|
|
|
92
94
|
* @default this.range ? `Try "June 8 to 12"` : `Try "tomorrow" or "in ten days"`
|
|
93
95
|
*/
|
|
94
96
|
"placeholder": string;
|
|
97
|
+
"previousMonthButtonContent"?: string;
|
|
98
|
+
"previousYearButtonContent"?: string;
|
|
95
99
|
/**
|
|
96
100
|
* @default this.range ? ["Monday to Wednesday", "July 5 to 10"] : ["Yesterday", "Today", "Tomorrow", "In 10 days"]
|
|
97
101
|
*/
|
|
@@ -268,7 +272,9 @@ export namespace Components {
|
|
|
268
272
|
*/
|
|
269
273
|
"appendTo"?: string | HTMLElement;
|
|
270
274
|
"calendarButtonContent"?: string;
|
|
275
|
+
"clearButtonContent"?: string;
|
|
271
276
|
"clearValue": () => Promise<void>;
|
|
277
|
+
"closeButtonContent"?: string;
|
|
272
278
|
"datesCalendarLabels"?: DatesCalendarLabels;
|
|
273
279
|
/**
|
|
274
280
|
* @default () => false
|
|
@@ -322,10 +328,14 @@ export namespace Components {
|
|
|
322
328
|
"locale": string;
|
|
323
329
|
"maxDate"?: string;
|
|
324
330
|
"minDate"?: string;
|
|
331
|
+
"nextMonthButtonContent"?: string;
|
|
332
|
+
"nextYearButtonContent"?: string;
|
|
325
333
|
/**
|
|
326
334
|
* @default ""
|
|
327
335
|
*/
|
|
328
336
|
"placeholder": string;
|
|
337
|
+
"previousMonthButtonContent"?: string;
|
|
338
|
+
"previousYearButtonContent"?: string;
|
|
329
339
|
/**
|
|
330
340
|
* @default false
|
|
331
341
|
*/
|
|
@@ -367,6 +377,7 @@ export namespace Components {
|
|
|
367
377
|
*/
|
|
368
378
|
"timesLabels": TimesLabels;
|
|
369
379
|
"timesPickerLabels"?: TimesPickerLabels;
|
|
380
|
+
"todayButtonContent"?: string;
|
|
370
381
|
/**
|
|
371
382
|
* @default true
|
|
372
383
|
*/
|
|
@@ -543,6 +554,8 @@ declare namespace LocalJSX {
|
|
|
543
554
|
*/
|
|
544
555
|
"appendTo"?: string | HTMLElement;
|
|
545
556
|
"calendarButtonContent"?: string;
|
|
557
|
+
"clearButtonContent"?: string;
|
|
558
|
+
"closeButtonContent"?: string;
|
|
546
559
|
"datesCalendarLabels"?: DatesCalendarLabels;
|
|
547
560
|
/**
|
|
548
561
|
* @default defaultLabels
|
|
@@ -609,6 +622,8 @@ declare namespace LocalJSX {
|
|
|
609
622
|
* @default this.range ? `Try "June 8 to 12"` : `Try "tomorrow" or "in ten days"`
|
|
610
623
|
*/
|
|
611
624
|
"placeholder"?: string;
|
|
625
|
+
"previousMonthButtonContent"?: string;
|
|
626
|
+
"previousYearButtonContent"?: string;
|
|
612
627
|
/**
|
|
613
628
|
* @default this.range ? ["Monday to Wednesday", "July 5 to 10"] : ["Yesterday", "Today", "Tomorrow", "In 10 days"]
|
|
614
629
|
*/
|
|
@@ -777,6 +792,8 @@ declare namespace LocalJSX {
|
|
|
777
792
|
*/
|
|
778
793
|
"appendTo"?: string | HTMLElement;
|
|
779
794
|
"calendarButtonContent"?: string;
|
|
795
|
+
"clearButtonContent"?: string;
|
|
796
|
+
"closeButtonContent"?: string;
|
|
780
797
|
"datesCalendarLabels"?: DatesCalendarLabels;
|
|
781
798
|
/**
|
|
782
799
|
* @default () => false
|
|
@@ -830,6 +847,8 @@ declare namespace LocalJSX {
|
|
|
830
847
|
"locale"?: string;
|
|
831
848
|
"maxDate"?: string;
|
|
832
849
|
"minDate"?: string;
|
|
850
|
+
"nextMonthButtonContent"?: string;
|
|
851
|
+
"nextYearButtonContent"?: string;
|
|
833
852
|
"onChangeYear"?: (event: TabworthyTimesCustomEvent<YearChangedEventDetails>) => void;
|
|
834
853
|
"onComponentReady"?: (event: TabworthyTimesCustomEvent<void>) => void;
|
|
835
854
|
"onSelectDateTime"?: (event: TabworthyTimesCustomEvent<string | string[] | undefined>) => void;
|
|
@@ -837,6 +856,8 @@ declare namespace LocalJSX {
|
|
|
837
856
|
* @default ""
|
|
838
857
|
*/
|
|
839
858
|
"placeholder"?: string;
|
|
859
|
+
"previousMonthButtonContent"?: string;
|
|
860
|
+
"previousYearButtonContent"?: string;
|
|
840
861
|
/**
|
|
841
862
|
* @default false
|
|
842
863
|
*/
|
|
@@ -878,6 +899,7 @@ declare namespace LocalJSX {
|
|
|
878
899
|
*/
|
|
879
900
|
"timesLabels"?: TimesLabels;
|
|
880
901
|
"timesPickerLabels"?: TimesPickerLabels;
|
|
902
|
+
"todayButtonContent"?: string;
|
|
881
903
|
/**
|
|
882
904
|
* @default true
|
|
883
905
|
*/
|
|
@@ -942,6 +964,8 @@ declare namespace LocalJSX {
|
|
|
942
964
|
"hasError": boolean;
|
|
943
965
|
"nextMonthButtonContent": string;
|
|
944
966
|
"nextYearButtonContent": string;
|
|
967
|
+
"previousMonthButtonContent": string;
|
|
968
|
+
"previousYearButtonContent": string;
|
|
945
969
|
"showYearStepper": boolean;
|
|
946
970
|
"showMonthStepper": boolean;
|
|
947
971
|
"showClearButton": boolean;
|
|
@@ -953,6 +977,8 @@ declare namespace LocalJSX {
|
|
|
953
977
|
"firstDayOfWeek": number;
|
|
954
978
|
"format": string;
|
|
955
979
|
"todayButtonContent": string;
|
|
980
|
+
"clearButtonContent": string;
|
|
981
|
+
"closeButtonContent": string;
|
|
956
982
|
"calendarButtonContent": string;
|
|
957
983
|
"showQuickButtons": boolean;
|
|
958
984
|
"disableFreeformInput": boolean;
|
|
@@ -1013,6 +1039,13 @@ declare namespace LocalJSX {
|
|
|
1013
1039
|
"showCloseButton": boolean;
|
|
1014
1040
|
"showTodayButton": boolean;
|
|
1015
1041
|
"calendarButtonContent": string;
|
|
1042
|
+
"nextMonthButtonContent": string;
|
|
1043
|
+
"nextYearButtonContent": string;
|
|
1044
|
+
"previousMonthButtonContent": string;
|
|
1045
|
+
"previousYearButtonContent": string;
|
|
1046
|
+
"todayButtonContent": string;
|
|
1047
|
+
"clearButtonContent": string;
|
|
1048
|
+
"closeButtonContent": string;
|
|
1016
1049
|
"elementClassName": string;
|
|
1017
1050
|
"firstDayOfWeek": number;
|
|
1018
1051
|
"format": string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tabworthy/components",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.4",
|
|
4
4
|
"description": "Small, accessible datepicker and datetimepicker Web Components with natural language date input.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -47,7 +47,6 @@
|
|
|
47
47
|
"test:storybook": "TZ=UTC vitest --project=storybook",
|
|
48
48
|
"generate": "stencil generate",
|
|
49
49
|
"release": "yarn build:stencil && npm publish",
|
|
50
|
-
"publish": "npm publish",
|
|
51
50
|
"prepare": "husky install",
|
|
52
51
|
"sass:watch": "sass src/themes/base.scss:src/themes/base.css src/themes/light.scss:src/themes/light.css --watch --style compressed",
|
|
53
52
|
"sass": "sass src/themes/light.scss:src/themes/light.css --style compressed --no-source-map"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{p as t,H as e,c as i,h as s,d as a,t as n}from"./p-BiJ0HZVY.js";function h(t,e){const i=new Date(t);return i.setDate(i.getDate()+e),i}function o(t){return k(new Date(`${w(t)}-${String(c(t)).padStart(2,"0")}-01`))}function r(t){return function(t){if(t instanceof Date)return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}(t)}function d(t){const e=o(t);return e.setMonth(e.getMonth()+1),e.setDate(e.getDate()-1),e}function c(t){return t.getMonth()+1}function l(t){return h(t,1)}function u(t){const e=new Date(t);return e.setMonth(e.getMonth()+1),e}function b(t){const e=new Date(t);return e.setFullYear(e.getFullYear()+1),e}function f(t){return m(t,1)}function v(t){const e=new Date(t);return e.setMonth(e.getMonth()-1),e}function y(t){const e=new Date(t);return e.setFullYear(e.getFullYear()-1),e}function w(t){return t.getFullYear()}function p(t,e){return!(!t||!e)&&t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()&&t.getDate()===e.getDate()}function k(t){const e=new Date(t);return e.setMinutes(e.getMinutes()+e.getTimezoneOffset()),e}function m(t,e){const i=new Date(t);return i.setDate(i.getDate()-e),i}function D(t,e){if(e){const i=k(new Date(e));return t>=i||p(i,t)}return!0}function g(t,e){if(e){const i=k(new Date(e));return t<=i||p(t,i)}return!0}function C(t,e,i){return D(t,e)&&g(t,i)}function B(t,e,i,s){const a=new Date(e,t,1);a.setDate(a.getDate()-1);const n=new Date(e,t+1,0);return n.setDate(a.getDate()+1),!C(a,i,s)&&!C(n,i,s)}function $(t){if(null==t.match(/^\d{4}-\d{2}-\d{2}$/))return!1;var e=new Date(t);return!isNaN(e.getTime())}function x(t){var e=t.match(/\d{4}-\d{2}-\d{2}/g);return null==e?void 0:e.slice(0,2)}const S={clearButton:"Clear value",closeButton:"Close",monthSelect:"Select month",nextMonthButton:"Next month",nextYearButton:"Next year",picker:"Choose date",previousMonthButton:"Previous month",previousYearButton:"Previous year",todayButton:"Show today",yearSelect:"Select year",keyboardHint:"Keyboard commands",selected:"Selected date",chooseAsStartDate:"choose as start date",chooseAsEndDate:"choose as end date"},M=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.selectDate=i(this,"selectDate",3),this.changeMonth=i(this,"changeMonth",3),this.changeYear=i(this,"changeYear",3),this.requestClose=i(this,"requestClose",3),this.disabled=!1,this.modalIsOpen=!1,this.disableDate=()=>!1,this.elementClassName="tabworthy-dates-calendar",this.firstDayOfWeek=0,this.range=!1,this.labels=S,this.locale=(null===navigator||void 0===navigator?void 0:navigator.language)||"en-US",this.inline=!1,this.showClearButton=!1,this.showCloseButton=!1,this.showMonthStepper=!0,this.showTodayButton=!0,this.showYearStepper=!1,this.showKeyboardHint=!1,this.showHiddenTitle=!0,this.startDate=r(new Date),this.init=()=>{this.currentDate=this.startDate?k(new Date(this.startDate)):new Date,this.updateWeekdays()},this.nextMonth=()=>{this.updateCurrentDate(u(this.currentDate))},this.nextYear=()=>{this.updateCurrentDate(b(this.currentDate),!1,!0)},this.previousMonth=()=>{this.updateCurrentDate(v(this.currentDate))},this.previousYear=()=>{this.updateCurrentDate(y(this.currentDate),!1,!0)},this.showToday=()=>{this.updateCurrentDate(new Date,!0)},this.clear=()=>{var t;this.value=void 0,null===(t=this.selectDate)||void 0===t||t.emit(void 0)},this.onClick=t=>{if(this.disabled)return;const e=t.target.closest("[data-date]");if(!Boolean(e))return;const i=k(new Date(e.dataset.date));this.updateCurrentDate(i),this.onSelectDate(i)},this.onMonthSelect=t=>{const e=+t.target.value-1,i=new Date(this.currentDate);C(i,this.minDate,this.maxDate)&&(i.setMonth(e),this.updateCurrentDate(i))},this.onYearSelect=t=>{var e;const i=+t.target.value,s=new Date(this.currentDate);C(s,this.minDate,this.maxDate)&&(s.setFullYear(i),null===(e=this.changeYear)||void 0===e||e.emit({year:i}),this.updateCurrentDate(s))},this.onKeyDown=t=>{this.disabled||("ArrowLeft"===t.code?(t.preventDefault(),this.updateCurrentDate(f(this.currentDate),!0)):"ArrowRight"===t.code?(t.preventDefault(),this.updateCurrentDate(l(this.currentDate),!0)):"ArrowUp"===t.code?(t.preventDefault(),this.updateCurrentDate(m(this.currentDate,7),!0)):"ArrowDown"===t.code?(t.preventDefault(),this.updateCurrentDate(h(this.currentDate,7),!0)):"PageUp"===t.code?(t.preventDefault(),this.updateCurrentDate(t.shiftKey?y(this.currentDate):v(this.currentDate),!0)):"PageDown"===t.code?(t.preventDefault(),this.updateCurrentDate(t.shiftKey?b(this.currentDate):u(this.currentDate),!0)):"Home"===t.code?(t.preventDefault(),this.updateCurrentDate(o(this.currentDate),!0)):"End"===t.code?(t.preventDefault(),this.updateCurrentDate(d(this.currentDate),!0)):"Space"!==t.code&&"Enter"!==t.code||(t.preventDefault(),this.onSelectDate(this.currentDate)))},this.onMouseEnter=t=>{var e;if(this.disabled)return;const i=k(new Date(null===(e=t.target.closest("td"))||void 0===e?void 0:e.dataset.date));this.hoveredDate=i},this.onMouseLeave=()=>{this.hoveredDate=void 0},this.close=()=>{var t;null===(t=this.requestClose)||void 0===t||t.emit()}}componentWillLoad(){this.init()}watchModalIsOpen(){!0===this.modalIsOpen&&(this.moveFocusOnModalOpen=!0)}watchFirstDayOfWeek(){this.updateWeekdays()}watchLocale(){Boolean(this.locale)||(this.locale=(null===navigator||void 0===navigator?void 0:navigator.language)||"en-US"),this.updateWeekdays()}watchRange(){var t;this.value=void 0,null===(t=this.selectDate)||void 0===t||t.emit(void 0)}watchStartDate(){this.currentDate=this.startDate?k(new Date(this.startDate)):new Date}watchValue(){Boolean(this.value)&&(Array.isArray(this.value)&&this.value.length>=1?this.currentDate=this.value[0]:this.value instanceof Date&&(this.currentDate=this.value))}componentDidRender(){this.moveFocusAfterMonthChanged&&(this.focusDate(this.currentDate),this.moveFocusAfterMonthChanged=!1),this.moveFocusOnModalOpen&&setTimeout((()=>{this.focusDate(this.currentDate),this.moveFocusOnModalOpen=!1}),100)}updateWeekdays(){var t,e;this.weekdays=(t=this.firstDayOfWeek,e=this.locale,new Array(7).fill(void 0).map(((e,i)=>(t+i)%7+1)).map((t=>{const i=new Date(2006,0,t);return[Intl.DateTimeFormat(e,{weekday:"short"}).format(i),Intl.DateTimeFormat(e,{weekday:"long"}).format(i)]})))}getClassName(t){return Boolean(t)?`${this.elementClassName}__${t}`:this.elementClassName}getCalendarRows(){const t=function(t,e,i){const s=[],a=o(t),n=0===a.getDay()?7:a.getDay(),h=d(t),r=0===h.getDay()?7:h.getDay(),c=1===i?7:i-1,u=[],b=[];{let t=(7-i+n)%7,e=f(a);for(;t>0;)u.push(e),e=f(e),t-=1;u.reverse();let s=(7-r+c)%7,o=l(h);for(;s>0;)b.push(o),o=l(o),s-=1}let v=a;for(;v.getMonth()===t.getMonth();)s.push(v),v=l(v);return[...u,...s,...b]}(this.currentDate,0,0===this.firstDayOfWeek?7:this.firstDayOfWeek),e=[];for(let i=0;i<t.length;i+=7){const s=t.slice(i,i+7);e.push(s)}return e}getTitle(){if(Boolean(this.currentDate))return Intl.DateTimeFormat(this.locale,{month:"long",year:"numeric"}).format(this.currentDate)}focusDate(t){var e;t&&(null===(e=this.el.querySelector(`[data-date="${r(t)}"]`))||void 0===e||e.focus())}updateCurrentDate(t,e,i=!1){var s,a,n;const h=t.getMonth(),o=t.getFullYear();D(t,this.minDate)||(t=new Date(this.minDate)),g(t,this.maxDate)||(t=new Date(this.maxDate)),(h!==(null===(s=this.currentDate)||void 0===s?void 0:s.getMonth())||o!==this.currentDate.getFullYear())&&(null===(a=this.changeMonth)||void 0===a||a.emit({month:c(t),year:w(t)}),e&&(this.moveFocusAfterMonthChanged=!0)),this.currentDate=t,e&&this.focusDate(this.currentDate),i&&(null===(n=this.changeYear)||void 0===n||n.emit({year:w(t)}))}onSelectDate(t){var e,i,s,a;if(!this.disableDate(t)&&C(t,this.minDate,this.maxDate))if(this.isRangeValue(this.value)){const s=void 0===(null===(e=this.value)||void 0===e?void 0:e[0])||2===this.value.length?[t]:[this.value[0],t];2===s.length&&s[0]>s[1]&&s.reverse();const a=void 0===s[1]?[r(s[0])]:[r(s[0]),r(s[1])];this.value=s,null===(i=this.selectDate)||void 0===i||i.emit(a)}else{if((null===(s=this.value)||void 0===s?void 0:s.getTime())===t.getTime())return;this.value=t,null===(a=this.selectDate)||void 0===a||a.emit(r(t))}}isRangeValue(t){return!!this.range}render(){var t;const e=this.showTodayButton||this.showClearButton||this.showCloseButton||this.showKeyboardHint,i={year:{prev:this.disabled||!!this.minDate&&new Date(this.minDate).getFullYear()>y(this.currentDate).getFullYear(),next:this.disabled||!!this.maxDate&&new Date(this.maxDate).getFullYear()<b(this.currentDate).getFullYear()},month:{prev:this.disabled||B(v(this.currentDate).getMonth(),v(this.currentDate).getFullYear(),this.minDate,this.maxDate),next:this.disabled||B(u(this.currentDate).getMonth(),u(this.currentDate).getFullYear(),this.minDate,this.maxDate)}};return s(a,{key:"abba9db6dddb2eda2732272a4965549e9efbcaa3"},s("div",{key:"07e733d1bc665da354ad45f3441bbfe6f575284c",class:{[`${this.getClassName()}-wrapper`]:!0,[`${this.getClassName()}-wrapper--inline`]:this.inline}},s("div",{key:"7cf7cda0096034917e4dc406b14b992f4fd59046",class:{[this.getClassName()]:!0,[`${this.getClassName()}--disabled`]:this.disabled}},s("div",{key:"6286dfb1d637d48b4338247309a4bd07ba9bcc47",class:this.getClassName("header")},this.showHiddenTitle&&s("span",{key:"7ef10a2c9b56de6dd6dbebf42aa107cb5402837a","aria-atomic":"true","aria-live":"polite",class:"visually-hidden"},this.getTitle()),this.showYearStepper&&s("button",{key:"f82e1314c5b696a3d34b9c131d187b9814c1a3e7","aria-label":this.labels.previousYearButton,class:this.getClassName("previous-year-button"),"aria-disabled":i.year.prev,innerHTML:this.previousYearButtonContent||void 0,onClick:this.previousYear,type:"button"},s("svg",{key:"8fb0e89ba5da9a5f22c4030f401512d907e93676",fill:"none",height:"24","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"24"},s("polyline",{key:"063019349c518195eb0b59177c39c1475d9cdaf0",points:"11 17 6 12 11 7"}),s("polyline",{key:"e9a7e1ce55ed818788de12ea064ddc9030cf82a3",points:"18 17 13 12 18 7"}))),this.showMonthStepper&&s("button",{key:"b4dafea59ef7d7ef705df7aaa95198f7236aac77","aria-label":this.labels.previousMonthButton,class:this.getClassName("previous-month-button"),"aria-disabled":i.month.prev,innerHTML:this.previousMonthButtonContent||void 0,onClick:this.previousMonth,type:"button"},s("svg",{key:"50aac77c0a53acef931af7ba1ef934e52f4a6e1f",fill:"none",height:"24","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"24"},s("polyline",{key:"a7cebfbcc0be9e66815f3a69a13501d8ba1bbb83",points:"15 18 9 12 15 6"}))),s("span",{key:"ec9add8bd9f35bccbf6c4c47510cd90be4ed7175",class:this.getClassName("current-month")},s("select",{key:"c36f648d42e8ee62e1a3b2d4bbeeab013dc871d5","aria-label":this.labels.monthSelect,class:this.getClassName("month-select"),"aria-disabled":this.disabled,name:"month",onChange:this.onMonthSelect},(n=this.locale,new Array(12).fill(void 0).map(((t,e)=>{const i=k(new Date(`2006-${String(e+1).padStart(2,"0")}-01`));return Intl.DateTimeFormat(n,{month:"long"}).format(i)}))).map(((t,e)=>s("option",{key:t,selected:this.currentDate.getMonth()===e,value:e+1,disabled:B(e,this.currentDate.getFullYear(),this.minDate,this.maxDate)},t)))),s("input",{key:"547174f2f8fe0248589a40a46aace91171f08ad7","aria-label":this.labels.yearSelect,class:this.getClassName("year-select"),"aria-disabled":this.disabled,max:this.maxDate?this.maxDate.slice(0,4):9999,min:this.minDate?this.minDate.slice(0,4):1,name:"year",onChange:this.onYearSelect,type:"number",value:this.currentDate.getFullYear()})),this.showMonthStepper&&s("button",{key:"458fd7350775325c43895f9896b151f8d490a725","aria-label":this.labels.nextMonthButton,class:this.getClassName("next-month-button"),"aria-disabled":i.month.next,innerHTML:this.nextMonthButtonContent||void 0,onClick:this.nextMonth,type:"button"},s("svg",{key:"3b6c5f32830d6983e2e59e89f8986012533f1b0f",fill:"none",height:"24","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"24"},s("polyline",{key:"b2dde5779945c6c7f6bd686b05874bc62f34c817",points:"9 18 15 12 9 6"}))),this.showYearStepper&&s("button",{key:"0f7ea0b890e11d42634c8751cca659caf788ca67","aria-label":this.labels.nextYearButton,class:this.getClassName("next-year-button"),"aria-disabled":i.year.next,innerHTML:this.nextYearButtonContent||void 0,onClick:this.nextYear,type:"button"},s("svg",{key:"a1f3037455d82547829d3f3afc15f6ea773277b4",fill:"none",height:"24","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"24"},s("polyline",{key:"ee5bfeadf5b183cba36c15ce6a5c30654ff98fe2",points:"13 17 18 12 13 7"}),s("polyline",{key:"02966a045d9496e161bbd4a40e103990b0e146a9",points:"6 17 11 12 6 7"})))),s("div",{key:"e588f18d365e6e1f87e1da7033741cb22ebafed7",class:this.getClassName("body")},s("table",{key:"7c6b926b3bc6b832b9fb1aabaac6841eb30cda30",class:this.getClassName("calendar"),onKeyDown:this.onKeyDown,role:"grid","aria-label":this.getTitle()},s("thead",{key:"4ebbefd8e10e5d83308e84eeafd85c29902275b1",class:this.getClassName("calendar-header")},s("tr",{key:"101788f84e1f2a44a498813024944fe32a7c7388",class:this.getClassName("weekday-row")},null===(t=this.weekdays)||void 0===t?void 0:t.map((t=>s("th",{role:"columnheader",abbr:t[1],class:this.getClassName("weekday"),key:t[0],scope:"col"},s("span",{"aria-hidden":"true"},t[0]),s("span",{class:"visually-hidden"},t[1])))))),s("tbody",{key:"4498ab21f627f5f8582db15d5babfc4e84c20b38"},this.getCalendarRows().map((t=>{const e=`row-${t[0].getMonth()}-${t[0].getDate()}`;return s("tr",{class:this.getClassName("calendar-row"),key:e},t.map((t=>{var e,i,a;const n=p(t,this.currentDate),h=t.getMonth()!==(null===(e=this.currentDate)||void 0===e?void 0:e.getMonth()),o=Array.isArray(this.value)?p(t,this.value[0])||this.value[1]&&C(t,r(this.value[0]),r(this.value[1])):p(t,this.value),d=this.disableDate(t)||!C(t,this.minDate,this.maxDate),c=!!this.isRangeValue(this.value)&&(u={from:null===(i=this.value)||void 0===i?void 0:i[0],to:(null===(a=this.value)||void 0===a?void 0:a[1])||this.hoveredDate||this.currentDate},!!((l=t)&&u&&u.from&&u.to)&&l>=(u.from<u.to?u.from:u.to)&&l<=(u.from<u.to?u.to:u.from)&&!d);var l,u;const b=p(t,new Date),f=`cell-${t.getMonth()}-${t.getDate()}`,v={[this.getClassName("date")]:!0,[this.getClassName("date--current")]:n,[this.getClassName("date--disabled")]:d,[this.getClassName("date--overflowing")]:h,[this.getClassName("date--today")]:b,[this.getClassName("date--selected")]:o,[this.getClassName("date--in-range")]:c},y=o?"strong":b?"em":"span";return s("td",{"aria-disabled":String(d),"aria-selected":o?"true":void 0,class:v,"data-date":r(t),key:f,onClick:this.onClick,onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,role:"gridcell",tabIndex:p(t,this.currentDate)&&!this.disabled?0:-1},s(y,{"aria-hidden":"true"},t.getDate()),s("span",{class:"visually-hidden"},(()=>{if(this.range){let e=this.value?"":`, ${this.labels.chooseAsStartDate}.`;return Array.isArray(this.value)&&(e={1:`, ${this.labels.chooseAsEndDate}.`,2:`, ${this.labels.chooseAsStartDate}.`}[this.value.length]),`${o?`${this.labels.selected}, `:""}${Intl.DateTimeFormat(this.locale,{day:"numeric",month:"long",year:"numeric"}).format(t)}${e}`}return`${o?`${this.labels.selected}, `:""}${Intl.DateTimeFormat(this.locale,{day:"numeric",month:"long",year:"numeric"}).format(t)}`})()))})))}))))),e&&s("div",{key:"48fde61cd9cdf8900bf8e15d408f3ad11cba9d9d",class:this.getClassName("footer")},s("div",{key:"a0b3e3b48f1f530648dff20598a0665ded2fbbe1",class:this.getClassName("footer-buttons")},this.showTodayButton&&s("button",{key:"06a03df2fe08b9c76d393fdfe48e279c58acf613",class:this.getClassName("today-button"),disabled:this.disabled,innerHTML:this.todayButtonContent||void 0,onClick:this.showToday,type:"button"},this.labels.todayButton),this.showClearButton&&s("button",{key:"e8bc81d95650edbf8c3b4d4e217d155c8a6f88b2",class:this.getClassName("clear-button"),disabled:this.disabled,innerHTML:this.clearButtonContent||void 0,onClick:this.clear,type:"button"},this.labels.clearButton),this.showCloseButton&&s("button",{key:"4ca7b4c414ca22092bee6fffb51179bbc1d66ee6",class:this.getClassName("close-button"),disabled:this.disabled,innerHTML:this.closeButtonContent||void 0,onClick:this.close,type:"button"},this.labels.closeButton)),this.showKeyboardHint&&!window.matchMedia("(pointer: coarse)").matches&&s("button",{key:"d34f89d3fb25286752bc4aa71893d0277dde3d17",type:"button",onClick:()=>alert("Todo: Add Keyboard helper!"),class:this.getClassName("keyboard-hint")},s("svg",{key:"5cf389d28d296804a5b5adfea6a0084290d125dd",xmlns:"http://www.w3.org/2000/svg",height:"1em",width:"1em",viewBox:"0 0 48 48",fill:"currentColor"},s("path",{key:"b84709ea4f714b979ff76078ee71556dc8671b04",d:"M7 38q-1.2 0-2.1-.925Q4 36.15 4 35V13q0-1.2.9-2.1.9-.9 2.1-.9h34q1.2 0 2.1.9.9.9.9 2.1v22q0 1.15-.9 2.075Q42.2 38 41 38Zm0-3h34V13H7v22Zm8-3.25h18v-3H15Zm-4.85-6.25h3v-3h-3Zm6.2 0h3v-3h-3Zm6.15 0h3v-3h-3Zm6.2 0h3v-3h-3Zm6.15 0h3v-3h-3Zm-24.7-6.25h3v-3h-3Zm6.2 0h3v-3h-3Zm6.15 0h3v-3h-3Zm6.2 0h3v-3h-3Zm6.15 0h3v-3h-3ZM7 35V13v22Z"})),this.labels.keyboardHint))),s("slot",{key:"1a37c10a1e2e367b1ee42756c85894d7ff5325f5",name:"after-calendar"})));var n}get el(){return this}static get watchers(){return{modalIsOpen:[{watchModalIsOpen:0}],firstDayOfWeek:[{watchFirstDayOfWeek:0}],locale:[{watchLocale:0}],range:[{watchRange:0}],startDate:[{watchStartDate:0}],value:[{watchValue:0}]}}static get style(){return".visually-hidden.sc-tabworthy-dates-calendar{position:absolute;overflow:hidden;width:1px;height:1px;white-space:nowrap;clip:rect(0 0 0 0);-webkit-clip-path:inset(50%);clip-path:inset(50%)}"}},[262,"tabworthy-dates-calendar",{clearButtonContent:[1,"clear-button-content"],closeButtonContent:[1,"close-button-content"],disabled:[4],modalIsOpen:[4,"modal-is-open"],disableDate:[16],elementClassName:[1,"element-class-name"],firstDayOfWeek:[2,"first-day-of-week"],range:[4],labels:[16],locale:[1],nextMonthButtonContent:[1,"next-month-button-content"],nextYearButtonContent:[1,"next-year-button-content"],previousMonthButtonContent:[1,"previous-month-button-content"],previousYearButtonContent:[1,"previous-year-button-content"],minDate:[1,"min-date"],maxDate:[1,"max-date"],inline:[4],showClearButton:[4,"show-clear-button"],showCloseButton:[4,"show-close-button"],showMonthStepper:[4,"show-month-stepper"],showTodayButton:[4,"show-today-button"],showYearStepper:[4,"show-year-stepper"],showKeyboardHint:[4,"show-keyboard-hint"],showHiddenTitle:[4,"show-hidden-title"],startDate:[1,"start-date"],todayButtonContent:[1,"today-button-content"],value:[1040],currentDate:[32],hoveredDate:[32],weekdays:[32]},void 0,{modalIsOpen:[{watchModalIsOpen:0}],firstDayOfWeek:[{watchFirstDayOfWeek:0}],locale:[{watchLocale:0}],range:[{watchRange:0}],startDate:[{watchStartDate:0}],value:[{watchValue:0}]}]);function Z(){"undefined"!=typeof customElements&&["tabworthy-dates-calendar"].forEach((t=>{"tabworthy-dates-calendar"===t&&(customElements.get(n(t))||customElements.define(n(t),M))}))}export{M as T,D as a,g as b,Z as c,C as d,x as e,r as g,$ as i,k as r}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as e,h as i,H as n,g as s}from"./p-CwtZ_Lud.js";import{g as a,r as o,a as r,b as h,c,d,e as u,f,h as l,s as b,i as v,j as p,k as y,l as m,m as w,n as g,o as k,p as x,q as O,t as M,u as j,v as D,w as A}from"./p-BVHu5CWV.js";const C={clearButton:"Clear value",closeButton:"Close",monthSelect:"Select month",nextMonthButton:"Next month",nextYearButton:"Next year",picker:"Choose date",previousMonthButton:"Previous month",previousYearButton:"Previous year",todayButton:"Show today",yearSelect:"Select year",keyboardHint:"Keyboard commands",selected:"Selected date",chooseAsStartDate:"choose as start date",chooseAsEndDate:"choose as end date"},S=class{constructor(i){t(this,i),this.selectDate=e(this,"selectDate",3),this.changeMonth=e(this,"changeMonth",3),this.changeYear=e(this,"changeYear",3),this.requestClose=e(this,"requestClose",3),this.disabled=!1,this.modalIsOpen=!1,this.disableDate=()=>!1,this.elementClassName="tabworthy-dates-calendar",this.firstDayOfWeek=0,this.range=!1,this.labels=C,this.locale=(null===navigator||void 0===navigator?void 0:navigator.language)||"en-US",this.inline=!1,this.showClearButton=!1,this.showCloseButton=!1,this.showMonthStepper=!0,this.showTodayButton=!0,this.showYearStepper=!1,this.showKeyboardHint=!1,this.showHiddenTitle=!0,this.startDate=a(new Date),this.init=()=>{this.currentDate=this.startDate?o(new Date(this.startDate)):new Date,this.updateWeekdays()},this.nextMonth=()=>{this.updateCurrentDate(r(this.currentDate))},this.nextYear=()=>{this.updateCurrentDate(h(this.currentDate),!1,!0)},this.previousMonth=()=>{this.updateCurrentDate(c(this.currentDate))},this.previousYear=()=>{this.updateCurrentDate(d(this.currentDate),!1,!0)},this.showToday=()=>{this.updateCurrentDate(new Date,!0)},this.clear=()=>{var t;this.value=void 0,null===(t=this.selectDate)||void 0===t||t.emit(void 0)},this.onClick=t=>{if(this.disabled)return;const e=t.target.closest("[data-date]");if(!Boolean(e))return;const i=o(new Date(e.dataset.date));this.updateCurrentDate(i),this.onSelectDate(i)},this.onMonthSelect=t=>{const e=+t.target.value-1,i=new Date(this.currentDate);u(i,this.minDate,this.maxDate)&&(i.setMonth(e),this.updateCurrentDate(i))},this.onYearSelect=t=>{var e;const i=+t.target.value,n=new Date(this.currentDate);u(n,this.minDate,this.maxDate)&&(n.setFullYear(i),null===(e=this.changeYear)||void 0===e||e.emit({year:i}),this.updateCurrentDate(n))},this.onKeyDown=t=>{this.disabled||("ArrowLeft"===t.code?(t.preventDefault(),this.updateCurrentDate(f(this.currentDate),!0)):"ArrowRight"===t.code?(t.preventDefault(),this.updateCurrentDate(l(this.currentDate),!0)):"ArrowUp"===t.code?(t.preventDefault(),this.updateCurrentDate(b(this.currentDate,7),!0)):"ArrowDown"===t.code?(t.preventDefault(),this.updateCurrentDate(v(this.currentDate,7),!0)):"PageUp"===t.code?(t.preventDefault(),this.updateCurrentDate(t.shiftKey?d(this.currentDate):c(this.currentDate),!0)):"PageDown"===t.code?(t.preventDefault(),this.updateCurrentDate(t.shiftKey?h(this.currentDate):r(this.currentDate),!0)):"Home"===t.code?(t.preventDefault(),this.updateCurrentDate(p(this.currentDate),!0)):"End"===t.code?(t.preventDefault(),this.updateCurrentDate(y(this.currentDate),!0)):"Space"!==t.code&&"Enter"!==t.code||(t.preventDefault(),this.onSelectDate(this.currentDate)))},this.onMouseEnter=t=>{var e;if(this.disabled)return;const i=o(new Date(null===(e=t.target.closest("td"))||void 0===e?void 0:e.dataset.date));this.hoveredDate=i},this.onMouseLeave=()=>{this.hoveredDate=void 0},this.close=()=>{var t;null===(t=this.requestClose)||void 0===t||t.emit()}}componentWillLoad(){this.init()}watchModalIsOpen(){!0===this.modalIsOpen&&(this.moveFocusOnModalOpen=!0)}watchFirstDayOfWeek(){this.updateWeekdays()}watchLocale(){Boolean(this.locale)||(this.locale=(null===navigator||void 0===navigator?void 0:navigator.language)||"en-US"),this.updateWeekdays()}watchRange(){var t;this.value=void 0,null===(t=this.selectDate)||void 0===t||t.emit(void 0)}watchStartDate(){this.currentDate=this.startDate?o(new Date(this.startDate)):new Date}watchValue(){Boolean(this.value)&&(Array.isArray(this.value)&&this.value.length>=1?this.currentDate=this.value[0]:this.value instanceof Date&&(this.currentDate=this.value))}componentDidRender(){this.moveFocusAfterMonthChanged&&(this.focusDate(this.currentDate),this.moveFocusAfterMonthChanged=!1),this.moveFocusOnModalOpen&&setTimeout((()=>{this.focusDate(this.currentDate),this.moveFocusOnModalOpen=!1}),100)}updateWeekdays(){this.weekdays=m(this.firstDayOfWeek,this.locale)}getClassName(t){return Boolean(t)?`${this.elementClassName}__${t}`:this.elementClassName}getCalendarRows(){const t=w(this.currentDate,!0,0===this.firstDayOfWeek?7:this.firstDayOfWeek),e=[];for(let i=0;i<t.length;i+=7){const n=t.slice(i,i+7);e.push(n)}return e}getTitle(){if(Boolean(this.currentDate))return Intl.DateTimeFormat(this.locale,{month:"long",year:"numeric"}).format(this.currentDate)}focusDate(t){var e;t&&(null===(e=this.el.querySelector(`[data-date="${a(t)}"]`))||void 0===e||e.focus())}updateCurrentDate(t,e,i=!1){var n,s,a;const o=t.getMonth(),r=t.getFullYear();g(t,this.minDate)||(t=new Date(this.minDate)),k(t,this.maxDate)||(t=new Date(this.maxDate)),(o!==(null===(n=this.currentDate)||void 0===n?void 0:n.getMonth())||r!==this.currentDate.getFullYear())&&(null===(s=this.changeMonth)||void 0===s||s.emit({month:O(t),year:x(t)}),e&&(this.moveFocusAfterMonthChanged=!0)),this.currentDate=t,e&&this.focusDate(this.currentDate),i&&(null===(a=this.changeYear)||void 0===a||a.emit({year:x(t)}))}onSelectDate(t){var e,i,n,s;if(!this.disableDate(t)&&u(t,this.minDate,this.maxDate))if(this.isRangeValue(this.value)){const n=void 0===(null===(e=this.value)||void 0===e?void 0:e[0])||2===this.value.length?[t]:[this.value[0],t];2===n.length&&n[0]>n[1]&&n.reverse();const s=void 0===n[1]?[a(n[0])]:[a(n[0]),a(n[1])];this.value=n,null===(i=this.selectDate)||void 0===i||i.emit(s)}else{if((null===(n=this.value)||void 0===n?void 0:n.getTime())===t.getTime())return;this.value=t,null===(s=this.selectDate)||void 0===s||s.emit(a(t))}}isRangeValue(t){return!!this.range}render(){var t;const e=this.showTodayButton||this.showClearButton||this.showCloseButton||this.showKeyboardHint,s={year:{prev:this.disabled||!!this.minDate&&new Date(this.minDate).getFullYear()>d(this.currentDate).getFullYear(),next:this.disabled||!!this.maxDate&&new Date(this.maxDate).getFullYear()<h(this.currentDate).getFullYear()},month:{prev:this.disabled||M(c(this.currentDate).getMonth(),c(this.currentDate).getFullYear(),this.minDate,this.maxDate),next:this.disabled||M(r(this.currentDate).getMonth(),r(this.currentDate).getFullYear(),this.minDate,this.maxDate)}};return i(n,{key:"abba9db6dddb2eda2732272a4965549e9efbcaa3"},i("div",{key:"07e733d1bc665da354ad45f3441bbfe6f575284c",class:{[`${this.getClassName()}-wrapper`]:!0,[`${this.getClassName()}-wrapper--inline`]:this.inline}},i("div",{key:"7cf7cda0096034917e4dc406b14b992f4fd59046",class:{[this.getClassName()]:!0,[`${this.getClassName()}--disabled`]:this.disabled}},i("div",{key:"6286dfb1d637d48b4338247309a4bd07ba9bcc47",class:this.getClassName("header")},this.showHiddenTitle&&i("span",{key:"7ef10a2c9b56de6dd6dbebf42aa107cb5402837a","aria-atomic":"true","aria-live":"polite",class:"visually-hidden"},this.getTitle()),this.showYearStepper&&i("button",{key:"f82e1314c5b696a3d34b9c131d187b9814c1a3e7","aria-label":this.labels.previousYearButton,class:this.getClassName("previous-year-button"),"aria-disabled":s.year.prev,innerHTML:this.previousYearButtonContent||void 0,onClick:this.previousYear,type:"button"},i("svg",{key:"8fb0e89ba5da9a5f22c4030f401512d907e93676",fill:"none",height:"24","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"24"},i("polyline",{key:"063019349c518195eb0b59177c39c1475d9cdaf0",points:"11 17 6 12 11 7"}),i("polyline",{key:"e9a7e1ce55ed818788de12ea064ddc9030cf82a3",points:"18 17 13 12 18 7"}))),this.showMonthStepper&&i("button",{key:"b4dafea59ef7d7ef705df7aaa95198f7236aac77","aria-label":this.labels.previousMonthButton,class:this.getClassName("previous-month-button"),"aria-disabled":s.month.prev,innerHTML:this.previousMonthButtonContent||void 0,onClick:this.previousMonth,type:"button"},i("svg",{key:"50aac77c0a53acef931af7ba1ef934e52f4a6e1f",fill:"none",height:"24","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"24"},i("polyline",{key:"a7cebfbcc0be9e66815f3a69a13501d8ba1bbb83",points:"15 18 9 12 15 6"}))),i("span",{key:"ec9add8bd9f35bccbf6c4c47510cd90be4ed7175",class:this.getClassName("current-month")},i("select",{key:"c36f648d42e8ee62e1a3b2d4bbeeab013dc871d5","aria-label":this.labels.monthSelect,class:this.getClassName("month-select"),"aria-disabled":this.disabled,name:"month",onChange:this.onMonthSelect},j(this.locale).map(((t,e)=>i("option",{key:t,selected:this.currentDate.getMonth()===e,value:e+1,disabled:M(e,this.currentDate.getFullYear(),this.minDate,this.maxDate)},t)))),i("input",{key:"547174f2f8fe0248589a40a46aace91171f08ad7","aria-label":this.labels.yearSelect,class:this.getClassName("year-select"),"aria-disabled":this.disabled,max:this.maxDate?this.maxDate.slice(0,4):9999,min:this.minDate?this.minDate.slice(0,4):1,name:"year",onChange:this.onYearSelect,type:"number",value:this.currentDate.getFullYear()})),this.showMonthStepper&&i("button",{key:"458fd7350775325c43895f9896b151f8d490a725","aria-label":this.labels.nextMonthButton,class:this.getClassName("next-month-button"),"aria-disabled":s.month.next,innerHTML:this.nextMonthButtonContent||void 0,onClick:this.nextMonth,type:"button"},i("svg",{key:"3b6c5f32830d6983e2e59e89f8986012533f1b0f",fill:"none",height:"24","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"24"},i("polyline",{key:"b2dde5779945c6c7f6bd686b05874bc62f34c817",points:"9 18 15 12 9 6"}))),this.showYearStepper&&i("button",{key:"0f7ea0b890e11d42634c8751cca659caf788ca67","aria-label":this.labels.nextYearButton,class:this.getClassName("next-year-button"),"aria-disabled":s.year.next,innerHTML:this.nextYearButtonContent||void 0,onClick:this.nextYear,type:"button"},i("svg",{key:"a1f3037455d82547829d3f3afc15f6ea773277b4",fill:"none",height:"24","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"24"},i("polyline",{key:"ee5bfeadf5b183cba36c15ce6a5c30654ff98fe2",points:"13 17 18 12 13 7"}),i("polyline",{key:"02966a045d9496e161bbd4a40e103990b0e146a9",points:"6 17 11 12 6 7"})))),i("div",{key:"e588f18d365e6e1f87e1da7033741cb22ebafed7",class:this.getClassName("body")},i("table",{key:"7c6b926b3bc6b832b9fb1aabaac6841eb30cda30",class:this.getClassName("calendar"),onKeyDown:this.onKeyDown,role:"grid","aria-label":this.getTitle()},i("thead",{key:"4ebbefd8e10e5d83308e84eeafd85c29902275b1",class:this.getClassName("calendar-header")},i("tr",{key:"101788f84e1f2a44a498813024944fe32a7c7388",class:this.getClassName("weekday-row")},null===(t=this.weekdays)||void 0===t?void 0:t.map((t=>i("th",{role:"columnheader",abbr:t[1],class:this.getClassName("weekday"),key:t[0],scope:"col"},i("span",{"aria-hidden":"true"},t[0]),i("span",{class:"visually-hidden"},t[1])))))),i("tbody",{key:"4498ab21f627f5f8582db15d5babfc4e84c20b38"},this.getCalendarRows().map((t=>{const e=`row-${t[0].getMonth()}-${t[0].getDate()}`;return i("tr",{class:this.getClassName("calendar-row"),key:e},t.map((t=>{var e,n,s;const o=D(t,this.currentDate),r=t.getMonth()!==(null===(e=this.currentDate)||void 0===e?void 0:e.getMonth()),h=Array.isArray(this.value)?D(t,this.value[0])||this.value[1]&&u(t,a(this.value[0]),a(this.value[1])):D(t,this.value),c=this.disableDate(t)||!u(t,this.minDate,this.maxDate),d=!!this.isRangeValue(this.value)&&A(t,{from:null===(n=this.value)||void 0===n?void 0:n[0],to:(null===(s=this.value)||void 0===s?void 0:s[1])||this.hoveredDate||this.currentDate})&&!c,f=D(t,new Date),l=`cell-${t.getMonth()}-${t.getDate()}`,b={[this.getClassName("date")]:!0,[this.getClassName("date--current")]:o,[this.getClassName("date--disabled")]:c,[this.getClassName("date--overflowing")]:r,[this.getClassName("date--today")]:f,[this.getClassName("date--selected")]:h,[this.getClassName("date--in-range")]:d},v=h?"strong":f?"em":"span";return i("td",{"aria-disabled":String(c),"aria-selected":h?"true":void 0,class:b,"data-date":a(t),key:l,onClick:this.onClick,onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,role:"gridcell",tabIndex:D(t,this.currentDate)&&!this.disabled?0:-1},i(v,{"aria-hidden":"true"},t.getDate()),i("span",{class:"visually-hidden"},(()=>{if(this.range){let e=this.value?"":`, ${this.labels.chooseAsStartDate}.`;return Array.isArray(this.value)&&(e={1:`, ${this.labels.chooseAsEndDate}.`,2:`, ${this.labels.chooseAsStartDate}.`}[this.value.length]),`${h?`${this.labels.selected}, `:""}${Intl.DateTimeFormat(this.locale,{day:"numeric",month:"long",year:"numeric"}).format(t)}${e}`}return`${h?`${this.labels.selected}, `:""}${Intl.DateTimeFormat(this.locale,{day:"numeric",month:"long",year:"numeric"}).format(t)}`})()))})))}))))),e&&i("div",{key:"48fde61cd9cdf8900bf8e15d408f3ad11cba9d9d",class:this.getClassName("footer")},i("div",{key:"a0b3e3b48f1f530648dff20598a0665ded2fbbe1",class:this.getClassName("footer-buttons")},this.showTodayButton&&i("button",{key:"06a03df2fe08b9c76d393fdfe48e279c58acf613",class:this.getClassName("today-button"),disabled:this.disabled,innerHTML:this.todayButtonContent||void 0,onClick:this.showToday,type:"button"},this.labels.todayButton),this.showClearButton&&i("button",{key:"e8bc81d95650edbf8c3b4d4e217d155c8a6f88b2",class:this.getClassName("clear-button"),disabled:this.disabled,innerHTML:this.clearButtonContent||void 0,onClick:this.clear,type:"button"},this.labels.clearButton),this.showCloseButton&&i("button",{key:"4ca7b4c414ca22092bee6fffb51179bbc1d66ee6",class:this.getClassName("close-button"),disabled:this.disabled,innerHTML:this.closeButtonContent||void 0,onClick:this.close,type:"button"},this.labels.closeButton)),this.showKeyboardHint&&!window.matchMedia("(pointer: coarse)").matches&&i("button",{key:"d34f89d3fb25286752bc4aa71893d0277dde3d17",type:"button",onClick:()=>alert("Todo: Add Keyboard helper!"),class:this.getClassName("keyboard-hint")},i("svg",{key:"5cf389d28d296804a5b5adfea6a0084290d125dd",xmlns:"http://www.w3.org/2000/svg",height:"1em",width:"1em",viewBox:"0 0 48 48",fill:"currentColor"},i("path",{key:"b84709ea4f714b979ff76078ee71556dc8671b04",d:"M7 38q-1.2 0-2.1-.925Q4 36.15 4 35V13q0-1.2.9-2.1.9-.9 2.1-.9h34q1.2 0 2.1.9.9.9.9 2.1v22q0 1.15-.9 2.075Q42.2 38 41 38Zm0-3h34V13H7v22Zm8-3.25h18v-3H15Zm-4.85-6.25h3v-3h-3Zm6.2 0h3v-3h-3Zm6.15 0h3v-3h-3Zm6.2 0h3v-3h-3Zm6.15 0h3v-3h-3Zm-24.7-6.25h3v-3h-3Zm6.2 0h3v-3h-3Zm6.15 0h3v-3h-3Zm6.2 0h3v-3h-3Zm6.15 0h3v-3h-3ZM7 35V13v22Z"})),this.labels.keyboardHint))),i("slot",{key:"1a37c10a1e2e367b1ee42756c85894d7ff5325f5",name:"after-calendar"})))}get el(){return s(this)}static get watchers(){return{modalIsOpen:[{watchModalIsOpen:0}],firstDayOfWeek:[{watchFirstDayOfWeek:0}],locale:[{watchLocale:0}],range:[{watchRange:0}],startDate:[{watchStartDate:0}],value:[{watchValue:0}]}}};function L(t,e,i,n=20,s=0){let a=[];if(s>=n)return a;const o=t=>{const a=t.assignedNodes().filter((t=>1===t.nodeType));return a.length>0?L(a[0].parentElement,e,i,n,s+1):[]},r=Array.from(t.children||[]);for(const t of r)e(t)||(i(t)&&a.push(t),null!=t.shadowRoot?a.push(...L(t.shadowRoot,e,i,n,s+1)):"SLOT"===t.tagName?a.push(...o(t)):a.push(...L(t,e,i,n,s+1)));return a}function B(t){return t.hasAttribute("hidden")||t.hasAttribute("aria-hidden")&&"false"!==t.getAttribute("aria-hidden")||"none"===t.style.display||"0"===t.style.opacity||"hidden"===t.style.visibility||"collapse"===t.style.visibility}function E(t){return"-1"!==t.getAttribute("tabindex")&&!B(t)&&!function(t){return t.hasAttribute("disabled")||t.hasAttribute("aria-disabled")&&"false"!==t.getAttribute("aria-disabled")}(t)&&(t.hasAttribute("tabindex")||(t instanceof HTMLAnchorElement||t instanceof HTMLAreaElement)&&t.hasAttribute("href")||t instanceof HTMLButtonElement||t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement||t instanceof HTMLIFrameElement)}S.style=".visually-hidden.sc-tabworthy-dates-calendar{position:absolute;overflow:hidden;width:1px;height:1px;white-space:nowrap;clip:rect(0 0 0 0);-webkit-clip-path:inset(50%);clip-path:inset(50%)}";const T=new Map,H=document.createElement("template");H.innerHTML='\n\t<div id="start"></div>\n\t<div id="backup"></div>\n\t<slot></slot>\n\t<div id="end"></div>\n';class $ extends HTMLElement{constructor(){super(),this.debounceId=Math.random().toString(),this._focused=!1;const t=this.attachShadow({mode:"open"});t.appendChild(H.content.cloneNode(!0)),this.$backup=t.querySelector("#backup"),this.$start=t.querySelector("#start"),this.$end=t.querySelector("#end"),this.focusLastElement=this.focusLastElement.bind(this),this.focusFirstElement=this.focusFirstElement.bind(this),this.onFocusIn=this.onFocusIn.bind(this),this.onFocusOut=this.onFocusOut.bind(this)}static get observedAttributes(){return["inactive"]}get inactive(){return this.hasAttribute("inactive")}set inactive(t){t?this.setAttribute("inactive",""):this.removeAttribute("inactive")}get focused(){return this._focused}connectedCallback(){this.$start.addEventListener("focus",this.focusLastElement),this.$end.addEventListener("focus",this.focusFirstElement),this.addEventListener("focusin",this.onFocusIn),this.addEventListener("focusout",this.onFocusOut),this.render()}disconnectedCallback(){this.$start.removeEventListener("focus",this.focusLastElement),this.$end.removeEventListener("focus",this.focusFirstElement),this.removeEventListener("focusin",this.onFocusIn),this.removeEventListener("focusout",this.onFocusOut)}attributeChangedCallback(){this.render()}focusFirstElement(){this.trapFocus()}focusLastElement(){this.trapFocus(!0)}getFocusableElements(){return L(this,B,E)}trapFocus(t){if(this.inactive)return;let e=this.getFocusableElements();e.length>0?(t?e[e.length-1].focus():e[0].focus(),this.$backup.setAttribute("tabindex","-1")):(this.$backup.setAttribute("tabindex","0"),this.$backup.focus())}onFocusIn(){this.updateFocused(!0)}onFocusOut(){this.updateFocused(!1)}updateFocused(t){!function(t,e,i){const n=T.get(i);null!=n&&window.clearTimeout(n),T.set(i,window.setTimeout((()=>{t(),T.delete(i)}),0))}((()=>{this.focused!==t&&(this._focused=t,this.render())}),0,this.debounceId)}render(){this.$start.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.$end.setAttribute("tabindex",!this.focused||this.inactive?"-1":"0"),this.focused?this.setAttribute("focused",""):this.removeAttribute("focused")}}window.customElements.define("focus-trap",$);var P=new WeakMap,W=new WeakMap,I={},q=0,Z=function(t){return t&&(t.host||Z(t.parentNode))},F=function(t,e,i){void 0===i&&(i="data-aria-hidden");var n=Array.from(Array.isArray(t)?t:[t]),s=function(t){return"undefined"==typeof document?null:(Array.isArray(t)?t[0]:t).ownerDocument.body}(t);return s?(n.push.apply(n,Array.from(s.querySelectorAll("[aria-live]"))),function(t,e,i,n){var s=function(t,e){return e.map((function(e){if(t.contains(e))return e;var i=Z(e);return i&&t.contains(i)?i:(console.error("aria-hidden",e,"in not contained inside",t,". Doing nothing"),null)})).filter((function(t){return Boolean(t)}))}(e,Array.isArray(t)?t:[t]);I[i]||(I[i]=new WeakMap);var a=I[i],o=[],r=new Set,h=new Set(s),c=function(t){t&&!r.has(t)&&(r.add(t),c(t.parentNode))};s.forEach(c);var d=function(t){t&&!h.has(t)&&Array.prototype.forEach.call(t.children,(function(t){if(r.has(t))d(t);else{var e=t.getAttribute(n),s=null!==e&&"false"!==e,h=(P.get(t)||0)+1,c=(a.get(t)||0)+1;P.set(t,h),a.set(t,c),o.push(t),1===h&&s&&W.set(t,!0),1===c&&t.setAttribute(i,"true"),s||t.setAttribute(n,"true")}}))};return d(e),r.clear(),q++,function(){o.forEach((function(t){var e=P.get(t)-1,s=a.get(t)-1;P.set(t,e),a.set(t,s),e||(W.has(t)||t.removeAttribute(n),W.delete(t)),s||t.removeAttribute(i)})),--q||(P=new WeakMap,P=new WeakMap,W=new WeakMap,I={})}}(n,s,i,"aria-hidden")):function(){return null}},R="top",V="bottom",_="right",U="left",z="auto",K=[R,V,_,U],N="start",Y="end",Q="viewport",G="popper",J=K.reduce((function(t,e){return t.concat([e+"-"+N,e+"-"+Y])}),[]),X=[].concat(K,[z]).reduce((function(t,e){return t.concat([e,e+"-"+N,e+"-"+Y])}),[]),tt=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function et(t){return t?(t.nodeName||"").toLowerCase():null}function it(t){if(null==t)return window;if("[object Window]"!==t.toString()){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function nt(t){return t instanceof it(t).Element||t instanceof Element}function st(t){return t instanceof it(t).HTMLElement||t instanceof HTMLElement}function at(t){return"undefined"!=typeof ShadowRoot&&(t instanceof it(t).ShadowRoot||t instanceof ShadowRoot)}function ot(t){return t.split("-")[0]}var rt=Math.max,ht=Math.min,ct=Math.round;function dt(){var t=navigator.userAgentData;return null!=t&&t.brands&&Array.isArray(t.brands)?t.brands.map((function(t){return t.brand+"/"+t.version})).join(" "):navigator.userAgent}function ut(){return!/^((?!chrome|android).)*safari/i.test(dt())}function ft(t,e,i){void 0===e&&(e=!1),void 0===i&&(i=!1);var n=t.getBoundingClientRect(),s=1,a=1;e&&st(t)&&(s=t.offsetWidth>0&&ct(n.width)/t.offsetWidth||1,a=t.offsetHeight>0&&ct(n.height)/t.offsetHeight||1);var o=(nt(t)?it(t):window).visualViewport,r=!ut()&&i,h=(n.left+(r&&o?o.offsetLeft:0))/s,c=(n.top+(r&&o?o.offsetTop:0))/a,d=n.width/s,u=n.height/a;return{width:d,height:u,top:c,right:h+d,bottom:c+u,left:h,x:h,y:c}}function lt(t){var e=ft(t),i=t.offsetWidth,n=t.offsetHeight;return Math.abs(e.width-i)<=1&&(i=e.width),Math.abs(e.height-n)<=1&&(n=e.height),{x:t.offsetLeft,y:t.offsetTop,width:i,height:n}}function bt(t,e){var i=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(i&&at(i)){var n=e;do{if(n&&t.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}function vt(t){return it(t).getComputedStyle(t)}function pt(t){return["table","td","th"].indexOf(et(t))>=0}function yt(t){return((nt(t)?t.ownerDocument:t.document)||window.document).documentElement}function mt(t){return"html"===et(t)?t:t.assignedSlot||t.parentNode||(at(t)?t.host:null)||yt(t)}function wt(t){return st(t)&&"fixed"!==vt(t).position?t.offsetParent:null}function gt(t){for(var e=it(t),i=wt(t);i&&pt(i)&&"static"===vt(i).position;)i=wt(i);return i&&("html"===et(i)||"body"===et(i)&&"static"===vt(i).position)?e:i||function(t){var e=/firefox/i.test(dt());if(/Trident/i.test(dt())&&st(t)&&"fixed"===vt(t).position)return null;var i=mt(t);for(at(i)&&(i=i.host);st(i)&&["html","body"].indexOf(et(i))<0;){var n=vt(i);if("none"!==n.transform||"none"!==n.perspective||"paint"===n.contain||-1!==["transform","perspective"].indexOf(n.willChange)||e&&"filter"===n.willChange||e&&n.filter&&"none"!==n.filter)return i;i=i.parentNode}return null}(t)||e}function kt(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function xt(t,e,i){return rt(t,ht(e,i))}function Ot(t){return Object.assign({},{top:0,right:0,bottom:0,left:0},t)}function Mt(t,e){return e.reduce((function(e,i){return e[i]=t,e}),{})}function jt(t){return t.split("-")[1]}var Dt={top:"auto",right:"auto",bottom:"auto",left:"auto"};function At(t){var e,i=t.popper,n=t.popperRect,s=t.placement,a=t.variation,o=t.offsets,r=t.position,h=t.gpuAcceleration,c=t.adaptive,d=t.roundOffsets,u=t.isFixed,f=o.x,l=void 0===f?0:f,b=o.y,v=void 0===b?0:b,p="function"==typeof d?d({x:l,y:v}):{x:l,y:v};l=p.x,v=p.y;var y=o.hasOwnProperty("x"),m=o.hasOwnProperty("y"),w=U,g=R,k=window;if(c){var x=gt(i),O="clientHeight",M="clientWidth";x===it(i)&&"static"!==vt(x=yt(i)).position&&"absolute"===r&&(O="scrollHeight",M="scrollWidth"),(s===R||(s===U||s===_)&&a===Y)&&(g=V,v-=(u&&x===k&&k.visualViewport?k.visualViewport.height:x[O])-n.height,v*=h?1:-1),s!==U&&(s!==R&&s!==V||a!==Y)||(w=_,l-=(u&&x===k&&k.visualViewport?k.visualViewport.width:x[M])-n.width,l*=h?1:-1)}var j,D=Object.assign({position:r},c&&Dt),A=!0===d?function(t,e){var i=t.y,n=e.devicePixelRatio||1;return{x:ct(t.x*n)/n||0,y:ct(i*n)/n||0}}({x:l,y:v},it(i)):{x:l,y:v};return l=A.x,v=A.y,Object.assign({},D,h?((j={})[g]=m?"0":"",j[w]=y?"0":"",j.transform=(k.devicePixelRatio||1)<=1?"translate("+l+"px, "+v+"px)":"translate3d("+l+"px, "+v+"px, 0)",j):((e={})[g]=m?v+"px":"",e[w]=y?l+"px":"",e.transform="",e))}var Ct={passive:!0},St={left:"right",right:"left",bottom:"top",top:"bottom"};function Lt(t){return t.replace(/left|right|bottom|top/g,(function(t){return St[t]}))}var Bt={start:"end",end:"start"};function Et(t){return t.replace(/start|end/g,(function(t){return Bt[t]}))}function Tt(t){var e=it(t);return{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Ht(t){return ft(yt(t)).left+Tt(t).scrollLeft}function $t(t){var e=vt(t);return/auto|scroll|overlay|hidden/.test(e.overflow+e.overflowY+e.overflowX)}function Pt(t){return["html","body","#document"].indexOf(et(t))>=0?t.ownerDocument.body:st(t)&&$t(t)?t:Pt(mt(t))}function Wt(t,e){var i;void 0===e&&(e=[]);var n=Pt(t),s=n===(null==(i=t.ownerDocument)?void 0:i.body),a=it(n),o=s?[a].concat(a.visualViewport||[],$t(n)?n:[]):n,r=e.concat(o);return s?r:r.concat(Wt(mt(o)))}function It(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function qt(t,e,i){return e===Q?It(function(t,e){var i=it(t),n=yt(t),s=i.visualViewport,a=n.clientWidth,o=n.clientHeight,r=0,h=0;if(s){a=s.width,o=s.height;var c=ut();(c||!c&&"fixed"===e)&&(r=s.offsetLeft,h=s.offsetTop)}return{width:a,height:o,x:r+Ht(t),y:h}}(t,i)):nt(e)?function(t,e){var i=ft(t,!1,"fixed"===e);return i.top=i.top+t.clientTop,i.left=i.left+t.clientLeft,i.bottom=i.top+t.clientHeight,i.right=i.left+t.clientWidth,i.width=t.clientWidth,i.height=t.clientHeight,i.x=i.left,i.y=i.top,i}(e,i):It(function(t){var e,i=yt(t),n=Tt(t),s=null==(e=t.ownerDocument)?void 0:e.body,a=rt(i.scrollWidth,i.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),o=rt(i.scrollHeight,i.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),r=-n.scrollLeft+Ht(t),h=-n.scrollTop;return"rtl"===vt(s||i).direction&&(r+=rt(i.clientWidth,s?s.clientWidth:0)-a),{width:a,height:o,x:r,y:h}}(yt(t)))}function Zt(t){var e,i=t.reference,n=t.element,s=t.placement,a=s?ot(s):null,o=s?jt(s):null,r=i.x+i.width/2-n.width/2,h=i.y+i.height/2-n.height/2;switch(a){case R:e={x:r,y:i.y-n.height};break;case V:e={x:r,y:i.y+i.height};break;case _:e={x:i.x+i.width,y:h};break;case U:e={x:i.x-n.width,y:h};break;default:e={x:i.x,y:i.y}}var c=a?kt(a):null;if(null!=c){var d="y"===c?"height":"width";switch(o){case N:e[c]=e[c]-(i[d]/2-n[d]/2);break;case Y:e[c]=e[c]+(i[d]/2-n[d]/2)}}return e}function Ft(t,e){void 0===e&&(e={});var i=e.placement,n=void 0===i?t.placement:i,s=e.strategy,a=void 0===s?t.strategy:s,o=e.boundary,r=void 0===o?"clippingParents":o,h=e.rootBoundary,c=void 0===h?Q:h,d=e.elementContext,u=void 0===d?G:d,f=e.altBoundary,l=void 0!==f&&f,b=e.padding,v=void 0===b?0:b,p=Ot("number"!=typeof v?v:Mt(v,K)),y=t.rects.popper,m=t.elements[l?u===G?"reference":G:u],w=function(t,e,i,n){var s="clippingParents"===e?function(t){var e=Wt(mt(t)),i=["absolute","fixed"].indexOf(vt(t).position)>=0&&st(t)?gt(t):t;return nt(i)?e.filter((function(t){return nt(t)&&bt(t,i)&&"body"!==et(t)})):[]}(t):[].concat(e),a=[].concat(s,[i]),o=a.reduce((function(e,i){var s=qt(t,i,n);return e.top=rt(s.top,e.top),e.right=ht(s.right,e.right),e.bottom=ht(s.bottom,e.bottom),e.left=rt(s.left,e.left),e}),qt(t,a[0],n));return o.width=o.right-o.left,o.height=o.bottom-o.top,o.x=o.left,o.y=o.top,o}(nt(m)?m:m.contextElement||yt(t.elements.popper),r,c,a),g=ft(t.elements.reference),k=Zt({reference:g,element:y,placement:n}),x=It(Object.assign({},y,k)),O=u===G?x:g,M={top:w.top-O.top+p.top,bottom:O.bottom-w.bottom+p.bottom,left:w.left-O.left+p.left,right:O.right-w.right+p.right},j=t.modifiersData.offset;if(u===G&&j){var D=j[n];Object.keys(M).forEach((function(t){var e=[_,V].indexOf(t)>=0?1:-1,i=[R,V].indexOf(t)>=0?"y":"x";M[t]+=D[i]*e}))}return M}function Rt(t,e){void 0===e&&(e={});var i=e.boundary,n=e.rootBoundary,s=e.padding,a=e.flipVariations,o=e.allowedAutoPlacements,r=void 0===o?X:o,h=jt(e.placement),c=h?a?J:J.filter((function(t){return jt(t)===h})):K,d=c.filter((function(t){return r.indexOf(t)>=0}));0===d.length&&(d=c);var u=d.reduce((function(e,a){return e[a]=Ft(t,{placement:a,boundary:i,rootBoundary:n,padding:s})[ot(a)],e}),{});return Object.keys(u).sort((function(t,e){return u[t]-u[e]}))}var Vt={name:"flip",enabled:!0,phase:"main",fn:function(t){var e=t.state,i=t.options,n=t.name;if(!e.modifiersData[n]._skip){for(var s=i.mainAxis,a=void 0===s||s,o=i.altAxis,r=void 0===o||o,h=i.fallbackPlacements,c=i.padding,d=i.boundary,u=i.rootBoundary,f=i.altBoundary,l=i.flipVariations,b=void 0===l||l,v=i.allowedAutoPlacements,p=e.options.placement,y=ot(p),m=h||(y!==p&&b?function(t){if(ot(t)===z)return[];var e=Lt(t);return[Et(t),e,Et(e)]}(p):[Lt(p)]),w=[p].concat(m).reduce((function(t,i){return t.concat(ot(i)===z?Rt(e,{placement:i,boundary:d,rootBoundary:u,padding:c,flipVariations:b,allowedAutoPlacements:v}):i)}),[]),g=e.rects.reference,k=e.rects.popper,x=new Map,O=!0,M=w[0],j=0;j<w.length;j++){var D=w[j],A=ot(D),C=jt(D)===N,S=[R,V].indexOf(A)>=0,L=S?"width":"height",B=Ft(e,{placement:D,boundary:d,rootBoundary:u,altBoundary:f,padding:c}),E=S?C?_:U:C?V:R;g[L]>k[L]&&(E=Lt(E));var T=Lt(E),H=[];if(a&&H.push(B[A]<=0),r&&H.push(B[E]<=0,B[T]<=0),H.every((function(t){return t}))){M=D,O=!1;break}x.set(D,H)}if(O)for(var $=function(t){var e=w.find((function(e){var i=x.get(e);if(i)return i.slice(0,t).every((function(t){return t}))}));if(e)return M=e,"break"},P=b?3:1;P>0&&"break"!==$(P);P--);e.placement!==M&&(e.modifiersData[n]._skip=!0,e.placement=M,e.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function _t(t,e,i){return void 0===i&&(i={x:0,y:0}),{top:t.top-e.height-i.y,right:t.right-e.width+i.x,bottom:t.bottom-e.height+i.y,left:t.left-e.width-i.x}}function Ut(t){return[R,_,V,U].some((function(e){return t[e]>=0}))}function zt(t,e,i){void 0===i&&(i=!1);var n,s,a=st(e),o=st(e)&&function(t){var e=t.getBoundingClientRect(),i=ct(e.width)/t.offsetWidth||1,n=ct(e.height)/t.offsetHeight||1;return 1!==i||1!==n}(e),r=yt(e),h=ft(t,o,i),c={scrollLeft:0,scrollTop:0},d={x:0,y:0};return(a||!a&&!i)&&(("body"!==et(e)||$t(r))&&(c=(n=e)!==it(n)&&st(n)?{scrollLeft:(s=n).scrollLeft,scrollTop:s.scrollTop}:Tt(n)),st(e)?((d=ft(e,!0)).x+=e.clientLeft,d.y+=e.clientTop):r&&(d.x=Ht(r))),{x:h.left+c.scrollLeft-d.x,y:h.top+c.scrollTop-d.y,width:h.width,height:h.height}}function Kt(t){var e=new Map,i=new Set,n=[];function s(t){i.add(t.name),[].concat(t.requires||[],t.requiresIfExists||[]).forEach((function(t){if(!i.has(t)){var n=e.get(t);n&&s(n)}})),n.push(t)}return t.forEach((function(t){e.set(t.name,t)})),t.forEach((function(t){i.has(t.name)||s(t)})),n}var Nt={placement:"bottom",modifiers:[],strategy:"absolute"};function Yt(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return!e.some((function(t){return!(t&&"function"==typeof t.getBoundingClientRect)}))}function Qt(t){void 0===t&&(t={});var e=t.defaultModifiers,i=void 0===e?[]:e,n=t.defaultOptions,s=void 0===n?Nt:n;return function(t,e,n){void 0===n&&(n=s);var a,o,r={placement:"bottom",orderedModifiers:[],options:Object.assign({},Nt,s),modifiersData:{},elements:{reference:t,popper:e},attributes:{},styles:{}},h=[],c=!1,d={state:r,setOptions:function(n){var a="function"==typeof n?n(r.options):n;u(),r.options=Object.assign({},s,r.options,a),r.scrollParents={reference:nt(t)?Wt(t):t.contextElement?Wt(t.contextElement):[],popper:Wt(e)};var o,c,f=function(t){var e=Kt(t);return tt.reduce((function(t,i){return t.concat(e.filter((function(t){return t.phase===i})))}),[])}((o=[].concat(i,r.options.modifiers),c=o.reduce((function(t,e){var i=t[e.name];return t[e.name]=i?Object.assign({},i,e,{options:Object.assign({},i.options,e.options),data:Object.assign({},i.data,e.data)}):e,t}),{}),Object.keys(c).map((function(t){return c[t]}))));return r.orderedModifiers=f.filter((function(t){return t.enabled})),r.orderedModifiers.forEach((function(t){var e=t.options,i=t.effect;if("function"==typeof i){var n=i({state:r,name:t.name,instance:d,options:void 0===e?{}:e});h.push(n||function(){})}})),d.update()},forceUpdate:function(){if(!c){var t=r.elements,e=t.reference,i=t.popper;if(Yt(e,i)){r.rects={reference:zt(e,gt(i),"fixed"===r.options.strategy),popper:lt(i)},r.reset=!1,r.placement=r.options.placement,r.orderedModifiers.forEach((function(t){return r.modifiersData[t.name]=Object.assign({},t.data)}));for(var n=0;n<r.orderedModifiers.length;n++)if(!0!==r.reset){var s=r.orderedModifiers[n],a=s.fn,o=s.options;"function"==typeof a&&(r=a({state:r,options:void 0===o?{}:o,name:s.name,instance:d})||r)}else r.reset=!1,n=-1}}},update:(a=function(){return new Promise((function(t){d.forceUpdate(),t(r)}))},function(){return o||(o=new Promise((function(t){Promise.resolve().then((function(){o=void 0,t(a())}))}))),o}),destroy:function(){u(),c=!0}};if(!Yt(t,e))return d;function u(){h.forEach((function(t){return t()})),h=[]}return d.setOptions(n).then((function(t){!c&&n.onFirstUpdate&&n.onFirstUpdate(t)})),d}}var Gt=Qt({defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(t){var e=t.state,i=t.instance,n=t.options,s=n.scroll,a=void 0===s||s,o=n.resize,r=void 0===o||o,h=it(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return a&&c.forEach((function(t){t.addEventListener("scroll",i.update,Ct)})),r&&h.addEventListener("resize",i.update,Ct),function(){a&&c.forEach((function(t){t.removeEventListener("scroll",i.update,Ct)})),r&&h.removeEventListener("resize",i.update,Ct)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(t){var e=t.state;e.modifiersData[t.name]=Zt({reference:e.rects.reference,element:e.rects.popper,placement:e.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(t){var e=t.state,i=t.options,n=i.gpuAcceleration,s=void 0===n||n,a=i.adaptive,o=void 0===a||a,r=i.roundOffsets,h=void 0===r||r,c={placement:ot(e.placement),variation:jt(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:s,isFixed:"fixed"===e.options.strategy};null!=e.modifiersData.popperOffsets&&(e.styles.popper=Object.assign({},e.styles.popper,At(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:h})))),null!=e.modifiersData.arrow&&(e.styles.arrow=Object.assign({},e.styles.arrow,At(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:h})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})},data:{}},{name:"applyStyles",enabled:!0,phase:"write",fn:function(t){var e=t.state;Object.keys(e.elements).forEach((function(t){var i=e.styles[t]||{},n=e.attributes[t]||{},s=e.elements[t];st(s)&&et(s)&&(Object.assign(s.style,i),Object.keys(n).forEach((function(t){var e=n[t];!1===e?s.removeAttribute(t):s.setAttribute(t,!0===e?"":e)})))}))},effect:function(t){var e=t.state,i={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,i.popper),e.styles=i,e.elements.arrow&&Object.assign(e.elements.arrow.style,i.arrow),function(){Object.keys(e.elements).forEach((function(t){var n=e.elements[t],s=e.attributes[t]||{},a=Object.keys(e.styles.hasOwnProperty(t)?e.styles[t]:i[t]).reduce((function(t,e){return t[e]="",t}),{});st(n)&&et(n)&&(Object.assign(n.style,a),Object.keys(s).forEach((function(t){n.removeAttribute(t)})))}))}},requires:["computeStyles"]},{name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(t){var e=t.state,i=t.name,n=t.options.offset,s=void 0===n?[0,0]:n,a=X.reduce((function(t,i){return t[i]=function(t,e,i){var n=ot(t),s=[U,R].indexOf(n)>=0?-1:1,a="function"==typeof i?i(Object.assign({},e,{placement:t})):i,o=a[0],r=a[1];return o=o||0,r=(r||0)*s,[U,_].indexOf(n)>=0?{x:r,y:o}:{x:o,y:r}}(i,e.rects,s),t}),{}),o=a[e.placement],r=o.y;null!=e.modifiersData.popperOffsets&&(e.modifiersData.popperOffsets.x+=o.x,e.modifiersData.popperOffsets.y+=r),e.modifiersData[i]=a}},Vt,{name:"preventOverflow",enabled:!0,phase:"main",fn:function(t){var e=t.state,i=t.options,n=t.name,s=i.mainAxis,a=void 0===s||s,o=i.altAxis,r=void 0!==o&&o,h=i.tether,c=void 0===h||h,d=i.tetherOffset,u=void 0===d?0:d,f=Ft(e,{boundary:i.boundary,rootBoundary:i.rootBoundary,padding:i.padding,altBoundary:i.altBoundary}),l=ot(e.placement),b=jt(e.placement),v=!b,p=kt(l),y="x"===p?"y":"x",m=e.modifiersData.popperOffsets,w=e.rects.reference,g=e.rects.popper,k="function"==typeof u?u(Object.assign({},e.rects,{placement:e.placement})):u,x="number"==typeof k?{mainAxis:k,altAxis:k}:Object.assign({mainAxis:0,altAxis:0},k),O=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,M={x:0,y:0};if(m){if(a){var j,D="y"===p?R:U,A="y"===p?V:_,C="y"===p?"height":"width",S=m[p],L=S+f[D],B=S-f[A],E=c?-g[C]/2:0,T=b===N?w[C]:g[C],H=b===N?-g[C]:-w[C],$=e.elements.arrow,P=c&&$?lt($):{width:0,height:0},W=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},I=W[D],q=W[A],Z=xt(0,w[C],P[C]),F=v?w[C]/2-E-Z-I-x.mainAxis:T-Z-I-x.mainAxis,z=v?-w[C]/2+E+Z+q+x.mainAxis:H+Z+q+x.mainAxis,K=e.elements.arrow&>(e.elements.arrow),Y=null!=(j=null==O?void 0:O[p])?j:0,Q=S+z-Y,G=xt(c?ht(L,S+F-Y-(K?"y"===p?K.clientTop||0:K.clientLeft||0:0)):L,S,c?rt(B,Q):B);m[p]=G,M[p]=G-S}if(r){var J,X=m[y],tt="y"===y?"height":"width",et=X+f["x"===p?R:U],it=X-f["x"===p?V:_],nt=-1!==[R,U].indexOf(l),st=null!=(J=null==O?void 0:O[y])?J:0,at=nt?et:X-w[tt]-g[tt]-st+x.altAxis,ct=nt?X+w[tt]+g[tt]-st-x.altAxis:it,dt=c&&nt?function(t,e,i){var n=xt(t,e,i);return n>i?i:n}(at,X,ct):xt(c?at:et,X,c?ct:it);m[y]=dt,M[y]=dt-X}e.modifiersData[n]=M}},requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:function(t){var e,i=t.state,n=t.name,s=t.options,a=i.elements.arrow,o=i.modifiersData.popperOffsets,r=ot(i.placement),h=kt(r),c=[U,_].indexOf(r)>=0?"height":"width";if(a&&o){var d=function(t,e){return Ot("number"!=typeof(t="function"==typeof t?t(Object.assign({},e.rects,{placement:e.placement})):t)?t:Mt(t,K))}(s.padding,i),u=lt(a),f="y"===h?R:U,l="y"===h?V:_,b=i.rects.reference[c]+i.rects.reference[h]-o[h]-i.rects.popper[c],v=o[h]-i.rects.reference[h],p=gt(a),y=p?"y"===h?p.clientHeight||0:p.clientWidth||0:0,m=y/2-u[c]/2+(b/2-v/2),w=xt(d[f],m,y-u[c]-d[l]);i.modifiersData[n]=((e={})[h]=w,e.centerOffset=w-m,e)}},effect:function(t){var e=t.state,i=t.options.element,n=void 0===i?"[data-popper-arrow]":i;null!=n&&("string"!=typeof n||(n=e.elements.popper.querySelector(n)))&&bt(e.elements.popper,n)&&(e.elements.arrow=n)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(t){var e=t.state,i=t.name,n=e.rects.reference,s=e.rects.popper,a=e.modifiersData.preventOverflow,o=Ft(e,{elementContext:"reference"}),r=Ft(e,{altBoundary:!0}),h=_t(o,n),c=_t(r,s,a),d=Ut(h),u=Ut(c);e.modifiersData[i]={referenceClippingOffsets:h,popperEscapeOffsets:c,isReferenceHidden:d,hasPopperEscaped:u},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":d,"data-popper-escaped":u})}}]});const Jt=class{constructor(i){t(this,i),this.opened=e(this,"opened",7),this.closed=e(this,"closed",7),this.inline=!1,this.placement="bottom-start",this.offset=[0,8],this.closing=!1,this.showing=this.inline||!1,this.positioned=!1,this.originalParent=null,this.originalNextSibling=null,this.isMovingPortal=!1,this.popperInstance=null,this.onKeyDown=t=>{"Escape"===t.code&&this.close()}}watchShowing(t){t||(this.destroyPopperInstance(),this.cleanupPortal()),this.positioned=!1}getAppendToElement(){return this.appendTo?"body"===this.appendTo?document.body:"string"==typeof this.appendTo?document.querySelector(this.appendTo):this.appendTo:null}setupPortal(){const t=this.getAppendToElement();t&&(this.originalParent=this.hostElement.parentElement,this.originalNextSibling=this.hostElement.nextSibling,this.isMovingPortal=!0,t.appendChild(this.hostElement),this.isMovingPortal=!1)}cleanupPortal(){this.isMovingPortal||this.originalParent&&(this.isMovingPortal=!0,this.originalNextSibling?this.originalParent.insertBefore(this.hostElement,this.originalNextSibling):this.originalParent.appendChild(this.hostElement),this.originalParent=null,this.originalNextSibling=null,this.isMovingPortal=!1)}createPopperInstance(){if(!this.triggerElement||!this.bodyRef)return;const t=!!this.appendTo,e=t?"viewport":"clippingParents";this.popperInstance=Gt(this.triggerElement,this.bodyRef,{placement:this.placement,strategy:t?"fixed":"absolute",modifiers:[{name:"offset",options:{offset:this.offset}},{name:"flip",options:{fallbackPlacements:["top-start","top-end","bottom-end"],boundary:e}},{name:"preventOverflow",options:{boundary:e,altAxis:!0,padding:8}},{name:"computeStyles",options:{gpuAcceleration:!0}},{name:"applyStyles",enabled:!0}]}),this.popperInstance.forceUpdate(),this.positioned=!0}destroyPopperInstance(){this.popperInstance&&(this.popperInstance.destroy(),this.popperInstance=null)}async open(){this.inline||(this.showing=!0,this.undo=F(this.el),this.opened.emit(void 0))}async close(){var t;this.inline||(this.showing=!1,this.closed.emit(void 0),null===(t=this.undo)||void 0===t||t.call(this),this.triggerElement&&this.triggerElement.focus())}disconnectedCallback(){this.isMovingPortal||(this.destroyPopperInstance(),this.cleanupPortal())}async getState(){return this.showing}async setTriggerElement(t){this.triggerElement=t}async updatePosition(){var t;await(null===(t=this.popperInstance)||void 0===t?void 0:t.update())}handleClick(t){var e;if(this.showing){const i=t.target;this.hostElement.contains(i)||(null===(e=this.triggerElement)||void 0===e?void 0:e.contains(i))||this.originalParent&&this.originalParent.contains(i)||this.close()}}render(){return i(n,{key:"488fb845bb3a168c45f715b5f7315a80e1857589",showing:this.showing,ref:t=>t&&(this.el=t)},!this.inline&&this.showing&&i("div",{key:"d6263beffa3dbeaa7f0e5e65c1f2627c07164648",part:"body",ref:t=>{t&&(this.bodyRef=t,this.showing&&this.triggerElement&&!this.popperInstance&&(this.setupPortal(),requestAnimationFrame((()=>{requestAnimationFrame((()=>{this.createPopperInstance()}))}))))},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},i("focus-trap",{key:"7ffb9cc684198ab9f3b127a4abe5f60f3241cd49"},i("div",{key:"c6c7c14220c01969f3a5c92dda882685f4c43268",part:"content"},i("slot",{key:"a1e6ce7ed152f61b3970e20b40e36bb13ee7580a"})))),this.inline&&i("div",{key:"632750cfce76139771642e03051f5c4a654db56a",part:"content"},i("slot",{key:"c1aa297a6ffdeee55840a9e05adddb7220e7f954"})))}get hostElement(){return s(this)}static get watchers(){return{showing:[{watchShowing:0}]}}};Jt.style=":host::part(body){position:absolute;top:0;left:0;width:-moz-fit-content;width:fit-content;z-index:1200}:host::part(backdrop){}:host::part(content){}";export{S as tabworthy_dates_calendar,Jt as tabworthy_dates_modal}
|