@tabworthy/components 0.4.0 → 0.5.1
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-C15oswCE.js → index-DlzGiVkc.js} +3 -3
- 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 +12 -12
- package/dist/cjs/tabworthy-dates.cjs.entry.js +10 -12
- package/dist/cjs/tabworthy-times-picker.cjs.entry.js +2 -2
- package/dist/cjs/tabworthy-times.cjs.entry.js +7 -6
- package/dist/collection/components/tabworthy-dates/tabworthy-dates.js +26 -8
- package/dist/collection/components/tabworthy-dates-calendar/tabworthy-dates-calendar.js +9 -9
- package/dist/collection/components/tabworthy-times/tabworthy-times.js +23 -2
- package/dist/components/tabworthy-dates-calendar2.js +1 -1
- package/dist/components/tabworthy-dates.js +1 -1
- package/dist/components/tabworthy-times.js +1 -1
- package/dist/esm/{index-BusoZVTR.js → index-zgp3PkTz.js} +3 -3
- package/dist/esm/loader.js +3 -3
- package/dist/esm/tabworthy-components.js +3 -3
- package/dist/esm/tabworthy-dates-calendar_2.entry.js +12 -12
- package/dist/esm/tabworthy-dates.entry.js +10 -12
- package/dist/esm/tabworthy-times-picker.entry.js +2 -2
- package/dist/esm/tabworthy-times.entry.js +7 -6
- package/dist/tabworthy-components/p-6b1d06a7.entry.js +1 -0
- package/dist/tabworthy-components/p-92257938.entry.js +1 -0
- package/dist/tabworthy-components/p-a261cea6.entry.js +1 -0
- package/dist/tabworthy-components/{p-1072baac.entry.js → p-c49e980d.entry.js} +1 -1
- package/dist/tabworthy-components/p-zgp3PkTz.js +2 -0
- package/dist/tabworthy-components/tabworthy-components.esm.js +1 -1
- package/dist/themes/dark.css +1 -1
- package/dist/themes/light.css +1 -1
- package/dist/types/components/tabworthy-dates/tabworthy-dates.d.ts +1 -0
- package/dist/types/components/tabworthy-times/tabworthy-times.d.ts +1 -0
- package/dist/types/components.d.ts +18 -0
- package/package.json +1 -1
- package/dist/tabworthy-components/p-841f3e8f.entry.js +0 -1
- package/dist/tabworthy-components/p-9aa97b54.entry.js +0 -1
- package/dist/tabworthy-components/p-BusoZVTR.js +0 -2
- package/dist/tabworthy-components/p-cedac657.entry.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as t,HTMLElement as s,createEvent as e,h as i,Host as a,transformTag as h}from"@stencil/core/internal/client";import{h as r}from"./moment.js";import{g as o,r as n,d}from"./tabworthy-dates-calendar2.js";import{d as l}from"./tabworthy-dates-modal2.js";import{d as c}from"./tabworthy-times-picker2.js";const b={selected:"selected",openCalendar:"Open date and time picker",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=t(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.selectDateTime=e(this,"selectDateTime",7),this.changeYear=e(this,"changeYear",7),this.componentReady=e(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.use12HourFormat=!0,this.timesLabels=b,this.inline=!1,this.hasError=!1,this.showYearStepper=!1,this.showMonthStepper=!0,this.showClearButton=!0,this.showTodayButton=!0,this.disableDate=()=>!1,this.elementClassName="tabworthy-times",this.firstDayOfWeek=1,this.format="YYYY-MM-DDTHH:mm:ss",this.inputShouldFormat=!0,this.selectedHours=12,this.selectedMinutes=0,this.errorState=this.hasError,this.disabledState=this.disabled,this.errorMessage="",this.handlePickerSelection=async t=>{const s=t.split(",");if(this.range&&2===s.length){const t=n(new Date(s[0])),e=n(new Date(s[1]));this.updateValue([t,e]),this.pickerRef&&(this.pickerRef.value=[t,e])}else{const t=n(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,this.selectedDate&&this.updateValue(this.selectedDate)},this.handleCalendarButtonClick=async()=>{this.modalRef&&(await this.modalRef.setTriggerElement(this.calendarButtonRef),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=r(t.target.value);s.isValid()&&(this.selectedHours=s.hours(),this.selectedMinutes=s.minutes(),this.updateValue(s.toDate()))}}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=r(t,this.format);s.isValid()&&(this.selectedDate=s.toDate(),this.selectedHours=s.hours(),this.selectedMinutes=s.minutes())}}else this.internalValue=null}updateValue(t){if(Array.isArray(t)){const s=t.map((t=>{const s=r(t);return s.hours(this.selectedHours),s.minutes(this.selectedMinutes),s.seconds(0),s.format(this.format)}));this.internalValue=s,this.value=s,this.selectDateTime.emit(s)}else{const s=r(t);s.hours(this.selectedHours),s.minutes(this.selectedMinutes),s.seconds(0);const e=s.format(this.format);this.internalValue=e,this.value=e,this.selectedDate=t,this.selectDateTime.emit(e)}this.errorState=!1,this.shouldInputFormat()&&this.formatInput()}formatInput(){if(this.internalValue)if(Array.isArray(this.internalValue)){const t=this.internalValue.map((t=>r(t,this.format).format("lll"))).join(` ${this.timesLabels.to} `);this.inputRef.value=t}else this.inputRef.value=r(this.internalValue,this.format).format("lll")}getClassName(t){return`${this.elementClassName}__${t}`}async clearValue(){this.internalValue=null,this.value=void 0,this.selectedDate=void 0,this.inputRef.value="",this.pickerRef&&(this.pickerRef.value=null),this.selectDateTime.emit(void 0)}render(){var t;return i(a,{key:"
|
|
1
|
+
import{proxyCustomElement as t,HTMLElement as s,createEvent as e,h as i,Host as a,transformTag as h}from"@stencil/core/internal/client";import{h as r}from"./moment.js";import{g as o,r as n,d}from"./tabworthy-dates-calendar2.js";import{d as l}from"./tabworthy-dates-modal2.js";import{d as c}from"./tabworthy-times-picker2.js";const b={selected:"selected",openCalendar:"Open date and time picker",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=t(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.selectDateTime=e(this,"selectDateTime",7),this.changeYear=e(this,"changeYear",7),this.componentReady=e(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.use12HourFormat=!0,this.timesLabels=b,this.inline=!1,this.hasError=!1,this.showYearStepper=!1,this.showMonthStepper=!0,this.showClearButton=!0,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.selectedHours=12,this.selectedMinutes=0,this.errorState=this.hasError,this.disabledState=this.disabled,this.errorMessage="",this.handlePickerSelection=async t=>{const s=t.split(",");if(this.range&&2===s.length){const t=n(new Date(s[0])),e=n(new Date(s[1]));this.updateValue([t,e]),this.pickerRef&&(this.pickerRef.value=[t,e])}else{const t=n(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,this.selectedDate&&this.updateValue(this.selectedDate)},this.handleCalendarButtonClick=async()=>{this.modalRef&&(await this.modalRef.setTriggerElement(this.calendarButtonRef),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=r(t.target.value);s.isValid()&&(this.selectedHours=s.hours(),this.selectedMinutes=s.minutes(),this.updateValue(s.toDate()))}}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=r(t,this.format);s.isValid()&&(this.selectedDate=s.toDate(),this.selectedHours=s.hours(),this.selectedMinutes=s.minutes())}}else this.internalValue=null}updateValue(t){if(Array.isArray(t)){const s=t.map((t=>{const s=r(t);return s.hours(this.selectedHours),s.minutes(this.selectedMinutes),s.seconds(0),s.format(this.format)}));this.internalValue=s,this.value=s,this.selectDateTime.emit(s)}else{const s=r(t);s.hours(this.selectedHours),s.minutes(this.selectedMinutes),s.seconds(0);const e=s.format(this.format);this.internalValue=e,this.value=e,this.selectedDate=t,this.selectDateTime.emit(e)}this.errorState=!1,this.shouldInputFormat()&&this.formatInput()}formatInput(){if(this.internalValue)if(Array.isArray(this.internalValue)){const t=this.internalValue.map((t=>r(t,this.format).format("lll"))).join(` ${this.timesLabels.to} `);this.inputRef.value=t}else this.inputRef.value=r(this.internalValue,this.format).format("lll")}getClassName(t){return`${this.elementClassName}__${t}`}async clearValue(){this.internalValue=null,this.value=void 0,this.selectedDate=void 0,this.inputRef.value="",this.pickerRef&&(this.pickerRef.value=null),this.selectDateTime.emit(void 0)}render(){var t;return i(a,{key:"f5ad31075413f2d2c14751265fdaa2845f695baa",class:this.elementClassName,"has-error":this.errorState,disabled:this.disabledState},i("label",{key:"84e8799efa652f93e6ca56ce5696729441e61319",htmlFor:this.id+"-input",class:this.getClassName("label")},this.label),i("div",{key:"cc3dc9198dbd90a2405938810aebc564b08c2ac3",class:this.getClassName("input-container")},i("input",{key:"1b63faf6d946fa9bad5198d967eb12fd12dbb02d",id:this.id+"-input",ref:t=>this.inputRef=t,type:"text",class:this.getClassName("input"),placeholder:this.placeholder,disabled:this.disabledState||this.disableFreeformInput,value:null===(t=this.internalValue)||void 0===t?void 0:""+t,onBlur:this.handleInputBlur,onChange:this.handleInputChange,"aria-describedby":this.errorState?this.id+"-error":void 0,"aria-invalid":this.errorState}),!this.inline&&i("button",{key:"a9f580d5d5c46334492b9bfef2dcd80d6808e77c",type:"button",ref:t=>this.calendarButtonRef=t,onClick:this.handleCalendarButtonClick,class:this.getClassName("calendar-button"),disabled:this.disabledState},this.calendarButtonContent?i("span",{innerHTML:this.calendarButtonContent}):this.timesLabels.openCalendar)),i("tabworthy-dates-modal",{key:"7fc50538aa0f972999867a6f7175d87bb86ef0d1",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},i("div",{key:"014187e74184b02318dea891a36c7c0d4888f4db",class:this.getClassName("picker-container")},i("tabworthy-dates-calendar",{key:"8b35d3640cd1e7c1a30a92c090a41945c807f51f",range:this.range,locale:this.locale,onSelectDate:t=>this.handlePickerSelection(t.detail),onChangeMonth:t=>this.handleChangedMonths(t.detail),onChangeYear:t=>this.handleYearChange(t.detail),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,showTodayButton:this.showTodayButton,disableDate:this.disableDate,minDate:this.minDate,maxDate:this.maxDate,inline:this.inline},i("div",{key:"e7802bd55d717def48fd4ff0093c41bfdd3a9d37",slot:"after-calendar",class:this.getClassName("time-section")},i("tabworthy-times-picker",{key:"4c8e49f3fb82f3b8e9c914fe060b80a5aa76bafe",hours:this.selectedHours,minutes:this.selectedMinutes,use12HourFormat:this.use12HourFormat,disabled:this.disabledState,onTimeChanged:this.handleTimeChange}))))),this.errorState&&i("div",{key:"f83e3028c666e16b065da2c1f1d92c5f157acd16",class:this.getClassName("input-error"),id:this.id?this.id+"-error":void 0,role:"status"},this.errorMessage))}get el(){return this}static get watchers(){return{value:[{watchValue:0}],disabled:[{watchDisabled:0}],hasError:[{watchHasError:0}]}}},[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"],use12HourFormat:[4,"use-1-2-hour-format"],timesLabels:[16],datesCalendarLabels:[16],inline:[4],hasError:[1028,"has-error"],showYearStepper:[4,"show-year-stepper"],showMonthStepper:[4,"show-month-stepper"],showClearButton:[4,"show-clear-button"],showTodayButton:[4,"show-today-button"],calendarButtonContent:[1,"calendar-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"],internalValue:[32],selectedDate:[32],selectedHours:[32],selectedMinutes:[32],errorState:[32],disabledState:[32],clearValue:[64]},void 0,{value:[{watchValue:0}],disabled:[{watchDisabled:0}],hasError:[{watchHasError:0}]}]),u=m,f=function(){"undefined"!=typeof customElements&&["tabworthy-times","tabworthy-dates-calendar","tabworthy-dates-modal","tabworthy-times-picker"].forEach((t=>{switch(t){case"tabworthy-times":customElements.get(h(t))||customElements.define(h(t),m);break;case"tabworthy-dates-calendar":customElements.get(h(t))||d();break;case"tabworthy-dates-modal":customElements.get(h(t))||l();break;case"tabworthy-times-picker":customElements.get(h(t))||c()}}))};export{u as TabworthyTimes,f as defineCustomElement}
|
|
@@ -630,9 +630,9 @@ var createEvent = (ref, name, flags) => {
|
|
|
630
630
|
return {
|
|
631
631
|
emit: (detail) => {
|
|
632
632
|
return emitEvent(elm, name, {
|
|
633
|
-
bubbles:
|
|
634
|
-
composed:
|
|
635
|
-
cancelable:
|
|
633
|
+
bubbles: !!(flags & 4 /* Bubbles */),
|
|
634
|
+
composed: !!(flags & 2 /* Composed */),
|
|
635
|
+
cancelable: !!(flags & 1 /* Cancellable */),
|
|
636
636
|
detail
|
|
637
637
|
});
|
|
638
638
|
}
|
package/dist/esm/loader.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { b as bootstrapLazy } from './index-
|
|
2
|
-
export { s as setNonce } from './index-
|
|
1
|
+
import { b as bootstrapLazy } from './index-zgp3PkTz.js';
|
|
2
|
+
export { s as setNonce } from './index-zgp3PkTz.js';
|
|
3
3
|
import { g as globalScripts } from './app-globals-DQuL1Twl.js';
|
|
4
4
|
|
|
5
5
|
const defineCustomElements = async (win, options) => {
|
|
6
6
|
if (typeof window === 'undefined') return undefined;
|
|
7
7
|
await globalScripts();
|
|
8
|
-
return bootstrapLazy([["tabworthy-times-picker",[[2,"tabworthy-times-picker",{"hours":[1026],"minutes":[1026],"use12HourFormat":[4,"use-1-2-hour-format"],"labels":[16],"labelsSrOnly":[4,"labels-sr-only"],"disabled":[4],"elementClassName":[1,"element-class-name"],"internalHours":[32],"internalMinutes":[32],"period":[32]},null,{"hours":[{"watchHours":0}],"minutes":[{"watchMinutes":0}]}]]],["tabworthy-dates-calendar_2",[[262,"tabworthy-dates-calendar",{"clearButtonContent":[1,"clear-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"],"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],"closing":[32],"showing":[32],"open":[64],"close":[64],"getState":[64],"setTriggerElement":[64]},[[10,"click","handleClick"]]]]],["tabworthy-times",[[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"],"use12HourFormat":[4,"use-1-2-hour-format"],"timesLabels":[16],"datesCalendarLabels":[16],"inline":[4],"hasError":[1028,"has-error"],"showYearStepper":[4,"show-year-stepper"],"showMonthStepper":[4,"show-month-stepper"],"showClearButton":[4,"show-clear-button"],"showTodayButton":[4,"show-today-button"],"calendarButtonContent":[1,"calendar-button-content"],"disableDate":[16],"elementClassName":[1,"element-class-name"],"firstDayOfWeek":[2,"first-day-of-week"],"format":[1],"inputShouldFormat":[8,"input-should-format"],"internalValue":[32],"selectedDate":[32],"selectedHours":[32],"selectedMinutes":[32],"errorState":[32],"disabledState":[32],"clearValue":[64]},null,{"value":[{"watchValue":0}],"disabled":[{"watchDisabled":0}],"hasError":[{"watchHasError":0}]}]]],["tabworthy-dates",[[2,"tabworthy-dates",{"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"],"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"],"showYearStepper":[4,"show-year-stepper"],"showMonthStepper":[4,"show-month-stepper"],"showClearButton":[4,"show-clear-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"],"calendarButtonContent":[1,"calendar-button-content"],"showQuickButtons":[4,"show-quick-buttons"],"internalValue":[32],"errorState":[32],"disabledState":[32],"parseDate":[64]},null,{"disabled":[{"watchDisabled":0}],"value":[{"watchValue":0}]}]]]], options);
|
|
8
|
+
return bootstrapLazy([["tabworthy-times-picker",[[2,"tabworthy-times-picker",{"hours":[1026],"minutes":[1026],"use12HourFormat":[4,"use-1-2-hour-format"],"labels":[16],"labelsSrOnly":[4,"labels-sr-only"],"disabled":[4],"elementClassName":[1,"element-class-name"],"internalHours":[32],"internalMinutes":[32],"period":[32]},null,{"hours":[{"watchHours":0}],"minutes":[{"watchMinutes":0}]}]]],["tabworthy-dates-calendar_2",[[262,"tabworthy-dates-calendar",{"clearButtonContent":[1,"clear-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"],"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],"closing":[32],"showing":[32],"open":[64],"close":[64],"getState":[64],"setTriggerElement":[64]},[[10,"click","handleClick"]]]]],["tabworthy-times",[[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"],"use12HourFormat":[4,"use-1-2-hour-format"],"timesLabels":[16],"datesCalendarLabels":[16],"inline":[4],"hasError":[1028,"has-error"],"showYearStepper":[4,"show-year-stepper"],"showMonthStepper":[4,"show-month-stepper"],"showClearButton":[4,"show-clear-button"],"showTodayButton":[4,"show-today-button"],"calendarButtonContent":[1,"calendar-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"],"internalValue":[32],"selectedDate":[32],"selectedHours":[32],"selectedMinutes":[32],"errorState":[32],"disabledState":[32],"clearValue":[64]},null,{"value":[{"watchValue":0}],"disabled":[{"watchDisabled":0}],"hasError":[{"watchHasError":0}]}]]],["tabworthy-dates",[[2,"tabworthy-dates",{"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"],"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"],"showYearStepper":[4,"show-year-stepper"],"showMonthStepper":[4,"show-month-stepper"],"showClearButton":[4,"show-clear-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"],"calendarButtonContent":[1,"calendar-button-content"],"showQuickButtons":[4,"show-quick-buttons"],"disableFreeformInput":[4,"disable-freeform-input"],"internalValue":[32],"errorState":[32],"disabledState":[32],"parseDate":[64]},null,{"disabled":[{"watchDisabled":0}],"value":[{"watchValue":0}]}]]]], options);
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export { defineCustomElements };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { p as promiseResolve, b as bootstrapLazy } from './index-
|
|
2
|
-
export { s as setNonce } from './index-
|
|
1
|
+
import { p as promiseResolve, b as bootstrapLazy } from './index-zgp3PkTz.js';
|
|
2
|
+
export { s as setNonce } from './index-zgp3PkTz.js';
|
|
3
3
|
import { g as globalScripts } from './app-globals-DQuL1Twl.js';
|
|
4
4
|
|
|
5
5
|
/*
|
|
@@ -17,5 +17,5 @@ var patchBrowser = () => {
|
|
|
17
17
|
|
|
18
18
|
patchBrowser().then(async (options) => {
|
|
19
19
|
await globalScripts();
|
|
20
|
-
return bootstrapLazy([["tabworthy-times-picker",[[2,"tabworthy-times-picker",{"hours":[1026],"minutes":[1026],"use12HourFormat":[4,"use-1-2-hour-format"],"labels":[16],"labelsSrOnly":[4,"labels-sr-only"],"disabled":[4],"elementClassName":[1,"element-class-name"],"internalHours":[32],"internalMinutes":[32],"period":[32]},null,{"hours":[{"watchHours":0}],"minutes":[{"watchMinutes":0}]}]]],["tabworthy-dates-calendar_2",[[262,"tabworthy-dates-calendar",{"clearButtonContent":[1,"clear-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"],"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],"closing":[32],"showing":[32],"open":[64],"close":[64],"getState":[64],"setTriggerElement":[64]},[[10,"click","handleClick"]]]]],["tabworthy-times",[[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"],"use12HourFormat":[4,"use-1-2-hour-format"],"timesLabels":[16],"datesCalendarLabels":[16],"inline":[4],"hasError":[1028,"has-error"],"showYearStepper":[4,"show-year-stepper"],"showMonthStepper":[4,"show-month-stepper"],"showClearButton":[4,"show-clear-button"],"showTodayButton":[4,"show-today-button"],"calendarButtonContent":[1,"calendar-button-content"],"disableDate":[16],"elementClassName":[1,"element-class-name"],"firstDayOfWeek":[2,"first-day-of-week"],"format":[1],"inputShouldFormat":[8,"input-should-format"],"internalValue":[32],"selectedDate":[32],"selectedHours":[32],"selectedMinutes":[32],"errorState":[32],"disabledState":[32],"clearValue":[64]},null,{"value":[{"watchValue":0}],"disabled":[{"watchDisabled":0}],"hasError":[{"watchHasError":0}]}]]],["tabworthy-dates",[[2,"tabworthy-dates",{"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"],"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"],"showYearStepper":[4,"show-year-stepper"],"showMonthStepper":[4,"show-month-stepper"],"showClearButton":[4,"show-clear-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"],"calendarButtonContent":[1,"calendar-button-content"],"showQuickButtons":[4,"show-quick-buttons"],"internalValue":[32],"errorState":[32],"disabledState":[32],"parseDate":[64]},null,{"disabled":[{"watchDisabled":0}],"value":[{"watchValue":0}]}]]]], options);
|
|
20
|
+
return bootstrapLazy([["tabworthy-times-picker",[[2,"tabworthy-times-picker",{"hours":[1026],"minutes":[1026],"use12HourFormat":[4,"use-1-2-hour-format"],"labels":[16],"labelsSrOnly":[4,"labels-sr-only"],"disabled":[4],"elementClassName":[1,"element-class-name"],"internalHours":[32],"internalMinutes":[32],"period":[32]},null,{"hours":[{"watchHours":0}],"minutes":[{"watchMinutes":0}]}]]],["tabworthy-dates-calendar_2",[[262,"tabworthy-dates-calendar",{"clearButtonContent":[1,"clear-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"],"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],"closing":[32],"showing":[32],"open":[64],"close":[64],"getState":[64],"setTriggerElement":[64]},[[10,"click","handleClick"]]]]],["tabworthy-times",[[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"],"use12HourFormat":[4,"use-1-2-hour-format"],"timesLabels":[16],"datesCalendarLabels":[16],"inline":[4],"hasError":[1028,"has-error"],"showYearStepper":[4,"show-year-stepper"],"showMonthStepper":[4,"show-month-stepper"],"showClearButton":[4,"show-clear-button"],"showTodayButton":[4,"show-today-button"],"calendarButtonContent":[1,"calendar-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"],"internalValue":[32],"selectedDate":[32],"selectedHours":[32],"selectedMinutes":[32],"errorState":[32],"disabledState":[32],"clearValue":[64]},null,{"value":[{"watchValue":0}],"disabled":[{"watchDisabled":0}],"hasError":[{"watchHasError":0}]}]]],["tabworthy-dates",[[2,"tabworthy-dates",{"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"],"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"],"showYearStepper":[4,"show-year-stepper"],"showMonthStepper":[4,"show-month-stepper"],"showClearButton":[4,"show-clear-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"],"calendarButtonContent":[1,"calendar-button-content"],"showQuickButtons":[4,"show-quick-buttons"],"disableFreeformInput":[4,"disable-freeform-input"],"internalValue":[32],"errorState":[32],"disabledState":[32],"parseDate":[64]},null,{"disabled":[{"watchDisabled":0}],"value":[{"watchValue":0}]}]]]], options);
|
|
21
21
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-zgp3PkTz.js';
|
|
2
2
|
import { g as getISODateString, r as removeTimezoneOffset, a as getNextMonth, b as getNextYear, c as getPreviousMonth, d as getPreviousYear, e as dateIsWithinBounds, f as getPreviousDay, h as getNextDay, s as subDays, i as addDays, j as getFirstOfMonth, k as getLastOfMonth, l as getWeekDays, m as getDaysOfMonth, n as dateIsWithinLowerBounds, o as dateIsWithinUpperBounds, p as getYear, q as getMonth, t as monthIsDisabled, u as getMonths, v as isSameDay, w as isDateInRange } from './utils-BVHu5CWV.js';
|
|
3
3
|
|
|
4
4
|
const tabworthyDatesCalendarCss = () => `.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%)}`;
|
|
@@ -21,9 +21,9 @@ const defaultLabels = {
|
|
|
21
21
|
const InclusiveDatesCalendar = class {
|
|
22
22
|
constructor(hostRef) {
|
|
23
23
|
registerInstance(this, hostRef);
|
|
24
|
-
this.selectDate = createEvent(this, "selectDate");
|
|
25
|
-
this.changeMonth = createEvent(this, "changeMonth");
|
|
26
|
-
this.changeYear = createEvent(this, "changeYear");
|
|
24
|
+
this.selectDate = createEvent(this, "selectDate", 3);
|
|
25
|
+
this.changeMonth = createEvent(this, "changeMonth", 3);
|
|
26
|
+
this.changeYear = createEvent(this, "changeYear", 3);
|
|
27
27
|
this.disabled = false;
|
|
28
28
|
this.modalIsOpen = false;
|
|
29
29
|
this.disableDate = () => false;
|
|
@@ -313,15 +313,15 @@ const InclusiveDatesCalendar = class {
|
|
|
313
313
|
monthIsDisabled(getNextMonth(this.currentDate).getMonth(), getNextMonth(this.currentDate).getFullYear(), this.minDate, this.maxDate)
|
|
314
314
|
}
|
|
315
315
|
};
|
|
316
|
-
return (h(Host, { key: '
|
|
316
|
+
return (h(Host, { key: '0ca78d9d8d4d0edd2375f48f23c5d879a2c6fb44' }, h("div", { key: '8ba043e2d7c70958ca73253348de57c07424c7f2', class: {
|
|
317
317
|
[`${this.getClassName()}-wrapper`]: true,
|
|
318
318
|
[`${this.getClassName()}-wrapper--inline`]: this.inline
|
|
319
|
-
} }, h("div", { key: '
|
|
319
|
+
} }, h("div", { key: '2b6d87a26620acd162d6321add8cb52fe9c41e97', class: {
|
|
320
320
|
[this.getClassName()]: true,
|
|
321
321
|
[`${this.getClassName()}--disabled`]: this.disabled
|
|
322
|
-
} }, h("div", { key: '
|
|
322
|
+
} }, h("div", { key: 'f773d4c95f3ebf4ea79dd5e72385a1f16b6cfe87', class: this.getClassName("header") }, this.showHiddenTitle && (h("span", { key: 'c6249db5073485bcf479bcd1d8c9da6a8270757c', "aria-atomic": "true", "aria-live": "polite", class: "visually-hidden" }, this.getTitle())), this.showYearStepper && (h("button", { key: 'ecf43dac6e8539598c43f782fb211ff44758d58a', "aria-label": this.labels.previousYearButton, class: this.getClassName("previous-year-button"), "aria-disabled": disabled.year.prev, innerHTML: this.previousYearButtonContent || undefined, onClick: this.previousYear, type: "button" }, h("svg", { key: '7986a7b8b7a4a696c6e62bba6677f9801c6d9059', fill: "none", height: "24", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", stroke: "currentColor", viewBox: "0 0 24 24", width: "24" }, h("polyline", { key: '3a1474883ab05ef0c0376944cfc4dbfe63aa6434', points: "11 17 6 12 11 7" }), h("polyline", { key: 'eb15b38a86f440e5b77723e8551e774af50c4a32', points: "18 17 13 12 18 7" })))), this.showMonthStepper && (h("button", { key: 'f3a6e864f855833ae24f6b15930ff85a5939d39e', "aria-label": this.labels.previousMonthButton, class: this.getClassName("previous-month-button"), "aria-disabled": disabled.month.prev, innerHTML: this.previousMonthButtonContent || undefined, onClick: this.previousMonth, type: "button" }, h("svg", { key: 'b15bc4eb6009b5872bc0d1253b5ca0e863505956', fill: "none", height: "24", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", stroke: "currentColor", viewBox: "0 0 24 24", width: "24" }, h("polyline", { key: '90d0590bdafd7b802e8967366f30411ac65aead1', points: "15 18 9 12 15 6" })))), h("span", { key: 'c0a4670b7f7f71706e1b02430f08302d69e7bec4', class: this.getClassName("current-month") }, h("select", { key: 'd7b43fcb12387644b74403f52c3e72948d2a460d', "aria-label": this.labels.monthSelect, class: this.getClassName("month-select"), "aria-disabled": this.disabled, name: "month", onChange: this.onMonthSelect }, getMonths(this.locale).map((month, index) => {
|
|
323
323
|
return (h("option", { key: month, selected: this.currentDate.getMonth() === index, value: index + 1, disabled: monthIsDisabled(index, this.currentDate.getFullYear(), this.minDate, this.maxDate) }, month));
|
|
324
|
-
})), h("input", { key: '
|
|
324
|
+
})), h("input", { key: '6123f052aa28fd745ee52a37d817855a31c6a888', "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 && (h("button", { key: '9a9ded70d8cfb7f61d15edc15873f1c7cc24d352', "aria-label": this.labels.nextMonthButton, class: this.getClassName("next-month-button"), "aria-disabled": disabled.month.next, innerHTML: this.nextMonthButtonContent || undefined, onClick: this.nextMonth, type: "button" }, h("svg", { key: '500969c2fd840a7131c348c4d562f3493dfddd4e', fill: "none", height: "24", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", stroke: "currentColor", viewBox: "0 0 24 24", width: "24" }, h("polyline", { key: '9e7fdecb2585366f9dc96fe32f0c83123257bd0a', points: "9 18 15 12 9 6" })))), this.showYearStepper && (h("button", { key: '7ee30553302a226836261fd21dafdfa065f831d8', "aria-label": this.labels.nextYearButton, class: this.getClassName("next-year-button"), "aria-disabled": disabled.year.next, innerHTML: this.nextYearButtonContent || undefined, onClick: this.nextYear, type: "button" }, h("svg", { key: 'd3c6f21d586a2be2ef8f52419fde77c1ad4398ad', fill: "none", height: "24", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", stroke: "currentColor", viewBox: "0 0 24 24", width: "24" }, h("polyline", { key: '19da599079fab7e31a853a7f09e68d12e66c9974', points: "13 17 18 12 13 7" }), h("polyline", { key: 'b23802d92bc35c3af659f86ecad9d41320cf3467', points: "6 17 11 12 6 7" }))))), h("div", { key: '75b511a738d0d421828c64a88b79cdadeb3e77db', class: this.getClassName("body") }, h("table", { key: '7f62f9985c99c4c19cbf320e009fbefbb436f5c2', class: this.getClassName("calendar"), onKeyDown: this.onKeyDown, role: "grid", "aria-label": this.getTitle() }, h("thead", { key: '6d518a1c015ee4f545278e175d9f71456b7cb525', class: this.getClassName("calendar-header") }, h("tr", { key: 'd5f289679c98b5ef8f67f8ccbf3999aac68a022c', class: this.getClassName("weekday-row") }, (_a = this.weekdays) === null || _a === void 0 ? void 0 : _a.map((weekday) => (h("th", { role: "columnheader", abbr: weekday[1], class: this.getClassName("weekday"), key: weekday[0], scope: "col" }, h("span", { "aria-hidden": "true" }, weekday[0]), h("span", { class: "visually-hidden" }, weekday[1])))))), h("tbody", { key: 'f4cf7ef148106044880c2b6c360e4319a7b31d83' }, this.getCalendarRows().map((calendarRow) => {
|
|
325
325
|
const rowKey = `row-${calendarRow[0].getMonth()}-${calendarRow[0].getDate()}`;
|
|
326
326
|
return (h("tr", { class: this.getClassName("calendar-row"), key: rowKey }, calendarRow.map((day) => {
|
|
327
327
|
var _a, _b, _c;
|
|
@@ -388,8 +388,8 @@ const InclusiveDatesCalendar = class {
|
|
|
388
388
|
? 0
|
|
389
389
|
: -1 }, h(Tag, { "aria-hidden": "true" }, day.getDate()), h("span", { class: "visually-hidden" }, getScreenReaderText())));
|
|
390
390
|
})));
|
|
391
|
-
})))), showFooter && (h("div", { key: '
|
|
392
|
-
!window.matchMedia("(pointer: coarse)").matches && (h("button", { key: '
|
|
391
|
+
})))), showFooter && (h("div", { key: 'a34938c0321570d5a4983cb47822d12335cb5fba', class: this.getClassName("footer") }, h("div", { key: '0c52dc84cb734326025e7927f94ab7d9947f89c3', class: this.getClassName("footer-buttons") }, this.showTodayButton && (h("button", { key: '11d7621dc4b8ffa33b51bf4312de6f0cedcc94e9', class: this.getClassName("today-button"), disabled: this.disabled, innerHTML: this.todayButtonContent || undefined, onClick: this.showToday, type: "button" }, this.labels.todayButton)), this.showClearButton && (h("button", { key: '2eb6ef128169727ba993a68d270e730b600b130a', class: this.getClassName("clear-button"), disabled: this.disabled, innerHTML: this.clearButtonContent || undefined, onClick: this.clear, type: "button" }, this.labels.clearButton))), this.showKeyboardHint &&
|
|
392
|
+
!window.matchMedia("(pointer: coarse)").matches && (h("button", { key: 'f2f52bf2b5de8d810dab6f3376d5b0923a2abb0c', type: "button", onClick: () => alert("Todo: Add Keyboard helper!"), class: this.getClassName("keyboard-hint") }, h("svg", { key: '1d2f5e1323af69c00c185b450a3e4ac2ed5b9f69', xmlns: "http://www.w3.org/2000/svg", height: "1em", width: "1em", viewBox: "0 0 48 48", fill: "currentColor" }, h("path", { key: 'd3f34347335b0e1f100b5e6346a283678daba519', 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))))), h("slot", { key: 'fa342bcfcd2cf4cb057b33b0cc8231264e97c51c', name: "after-calendar" }))));
|
|
393
393
|
}
|
|
394
394
|
get el() { return getElement(this); }
|
|
395
395
|
static get watchers() { return {
|
|
@@ -836,8 +836,8 @@ const tabworthyDatesModalCss = () => `:host::part(body){position:absolute;width:
|
|
|
836
836
|
const InclusiveDatesModal = class {
|
|
837
837
|
constructor(hostRef) {
|
|
838
838
|
registerInstance(this, hostRef);
|
|
839
|
-
this.opened = createEvent(this, "opened");
|
|
840
|
-
this.closed = createEvent(this, "closed");
|
|
839
|
+
this.opened = createEvent(this, "opened", 7);
|
|
840
|
+
this.closed = createEvent(this, "closed", 7);
|
|
841
841
|
this.inline = false;
|
|
842
842
|
this.closing = false;
|
|
843
843
|
this.showing = this.inline || false;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-zgp3PkTz.js';
|
|
2
2
|
import { h as hooks } from './moment-Mki5YqAR.js';
|
|
3
3
|
import { r as removeTimezoneOffset, x as extractDates, y as isValidISODate, e as dateIsWithinBounds, n as dateIsWithinLowerBounds, o as dateIsWithinUpperBounds, g as getISODateString } from './utils-BVHu5CWV.js';
|
|
4
4
|
|
|
@@ -10485,9 +10485,9 @@ const defaultLabels = {
|
|
|
10485
10485
|
const TabworthyDates = class {
|
|
10486
10486
|
constructor(hostRef) {
|
|
10487
10487
|
registerInstance(this, hostRef);
|
|
10488
|
-
this.selectDate = createEvent(this, "selectDate");
|
|
10489
|
-
this.changeYear = createEvent(this, "changeYear");
|
|
10490
|
-
this.componentReady = createEvent(this, "componentReady");
|
|
10488
|
+
this.selectDate = createEvent(this, "selectDate", 7);
|
|
10489
|
+
this.changeYear = createEvent(this, "changeYear", 7);
|
|
10490
|
+
this.componentReady = createEvent(this, "componentReady", 7);
|
|
10491
10491
|
// Enable or disable range mode
|
|
10492
10492
|
this.range = false;
|
|
10493
10493
|
// A label for the text field
|
|
@@ -10540,6 +10540,7 @@ const TabworthyDates = class {
|
|
|
10540
10540
|
: ["Yesterday", "Today", "Tomorrow", "In 10 days"];
|
|
10541
10541
|
// Show or hide the quick buttons
|
|
10542
10542
|
this.showQuickButtons = true;
|
|
10543
|
+
this.disableFreeformInput = false;
|
|
10543
10544
|
this.errorState = this.hasError;
|
|
10544
10545
|
this.disabledState = this.disabled;
|
|
10545
10546
|
this.chronoSupportedLocale = ["en", "ja", "fr", "nl", "ru", "pt"].includes(this.locale.slice(0, 2));
|
|
@@ -10794,10 +10795,6 @@ const TabworthyDates = class {
|
|
|
10794
10795
|
}).format(dateToFormat);
|
|
10795
10796
|
}
|
|
10796
10797
|
}
|
|
10797
|
-
else if (this.internalValue &&
|
|
10798
|
-
this.internalValue.length > 0 &&
|
|
10799
|
-
this.errorState === false)
|
|
10800
|
-
this.inputRef.value = this.internalValue.toString();
|
|
10801
10798
|
}
|
|
10802
10799
|
handlePickerSelection(newValue) {
|
|
10803
10800
|
var _a, _b;
|
|
@@ -10824,6 +10821,7 @@ const TabworthyDates = class {
|
|
|
10824
10821
|
}
|
|
10825
10822
|
this.announceDateChange(this.internalValue);
|
|
10826
10823
|
}
|
|
10824
|
+
this.selectDate.emit(this.internalValue);
|
|
10827
10825
|
}
|
|
10828
10826
|
announceDateChange(newValue) {
|
|
10829
10827
|
let content = "";
|
|
@@ -10892,7 +10890,7 @@ const TabworthyDates = class {
|
|
|
10892
10890
|
}
|
|
10893
10891
|
render() {
|
|
10894
10892
|
var _a;
|
|
10895
|
-
return (h(Host, { key: '
|
|
10893
|
+
return (h(Host, { key: 'e8042c6411dbded3f86703ee75b43a8e75ddf621' }, h("label", { key: 'ed3a309a7f11a41122badd9549b513ea3f70c491', htmlFor: this.id ? `${this.id}-input` : undefined, class: this.getClassName("label") }, this.label), h("br", { key: '73391914e5e39af0b054cfcbab02b1d18aca452a' }), h("div", { key: '6b3394842bc2813f918f731745307ea798a483b9', class: this.getClassName("input-container") }, h("input", { key: '8a1f1ac45bbe0050cfc98063d723542a37d86ef5', disabled: this.disabledState || this.disableFreeformInput, id: this.id ? `${this.id}-input` : undefined, type: "text", placeholder: this.placeholder, class: this.getClassName("input"), 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: 'bbafef3a62331b26e8d0a0eb9886816d8e819085', type: "button", ref: (r) => (this.calendarButtonRef = r), onClick: this.handleCalendarButtonClick, class: this.getClassName("calendar-button"), disabled: this.disabledState }, this.calendarButtonContent ? (h("span", { innerHTML: this.calendarButtonContent })) : (this.datesLabels.openCalendar)))), h("tabworthy-dates-modal", { key: '68451bf1e8d40dd25f51a370cf745244cf1897eb', label: this.datesLabels.calendar, ref: (el) => (this.modalRef = el), onOpened: () => {
|
|
10896
10894
|
if (!this.pickerRef)
|
|
10897
10895
|
return;
|
|
10898
10896
|
this.pickerRef.modalIsOpen = true;
|
|
@@ -10900,11 +10898,11 @@ const TabworthyDates = class {
|
|
|
10900
10898
|
if (!this.pickerRef)
|
|
10901
10899
|
return;
|
|
10902
10900
|
this.pickerRef.modalIsOpen = false;
|
|
10903
|
-
}, inline: this.inline }, h("tabworthy-dates-calendar", { key: '
|
|
10901
|
+
}, inline: this.inline }, h("tabworthy-dates-calendar", { key: '9ba747fc1bbc1481943624634090b7e8a4792d56', 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 &&
|
|
10904
10902
|
((_a = this.quickButtons) === null || _a === void 0 ? void 0 : _a.length) > 0 &&
|
|
10905
|
-
this.chronoSupportedLocale && (h("div", { key: '
|
|
10903
|
+
this.chronoSupportedLocale && (h("div", { key: '302a5aca1e85df7ae68bbc416dcc62f406a46868', class: this.getClassName("quick-group"), role: "group", "aria-label": "Quick selection" }, this.quickButtons.map((buttonText) => {
|
|
10906
10904
|
return (h("button", { class: this.getClassName("quick-button"), onClick: this.handleQuickButtonClick, disabled: this.disabledState, type: "button" }, buttonText));
|
|
10907
|
-
}))), this.errorState && (h("div", { key: '
|
|
10905
|
+
}))), this.errorState && (h("div", { key: 'c753c27a93017df169b6d603b1f8fb4e6f601a0d', class: this.getClassName("input-error"), id: this.id ? `${this.id}-error` : undefined, role: "status" }, this.errorMessage))));
|
|
10908
10906
|
}
|
|
10909
10907
|
get el() { return getElement(this); }
|
|
10910
10908
|
static get watchers() { return {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-zgp3PkTz.js';
|
|
2
2
|
|
|
3
3
|
const defaultLabels = {
|
|
4
4
|
hours: "Hours",
|
|
@@ -14,7 +14,7 @@ const defaultLabels = {
|
|
|
14
14
|
const InclusiveTimesPicker = class {
|
|
15
15
|
constructor(hostRef) {
|
|
16
16
|
registerInstance(this, hostRef);
|
|
17
|
-
this.timeChanged = createEvent(this, "timeChanged");
|
|
17
|
+
this.timeChanged = createEvent(this, "timeChanged", 7);
|
|
18
18
|
// Current time value (24-hour format)
|
|
19
19
|
this.hours = 12;
|
|
20
20
|
this.minutes = 0;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-zgp3PkTz.js';
|
|
2
2
|
import { h as hooks } from './moment-Mki5YqAR.js';
|
|
3
3
|
import { g as getISODateString, r as removeTimezoneOffset } from './utils-BVHu5CWV.js';
|
|
4
4
|
|
|
@@ -18,9 +18,9 @@ const defaultLabels = {
|
|
|
18
18
|
const InclusiveTimes = class {
|
|
19
19
|
constructor(hostRef) {
|
|
20
20
|
registerInstance(this, hostRef);
|
|
21
|
-
this.selectDateTime = createEvent(this, "selectDateTime");
|
|
22
|
-
this.changeYear = createEvent(this, "changeYear");
|
|
23
|
-
this.componentReady = createEvent(this, "componentReady");
|
|
21
|
+
this.selectDateTime = createEvent(this, "selectDateTime", 7);
|
|
22
|
+
this.changeYear = createEvent(this, "changeYear", 7);
|
|
23
|
+
this.componentReady = createEvent(this, "componentReady", 7);
|
|
24
24
|
// Enable or disable range mode
|
|
25
25
|
this.range = false;
|
|
26
26
|
// A label for the text field
|
|
@@ -61,6 +61,7 @@ const InclusiveTimes = class {
|
|
|
61
61
|
this.format = "YYYY-MM-DDTHH:mm:ss";
|
|
62
62
|
// If true, format input on blur/accept (like dates)
|
|
63
63
|
this.inputShouldFormat = true;
|
|
64
|
+
this.disableFreeformInput = false;
|
|
64
65
|
this.selectedHours = 12;
|
|
65
66
|
this.selectedMinutes = 0;
|
|
66
67
|
this.errorState = this.hasError;
|
|
@@ -225,7 +226,7 @@ const InclusiveTimes = class {
|
|
|
225
226
|
}
|
|
226
227
|
render() {
|
|
227
228
|
var _a;
|
|
228
|
-
return (h(Host, { key: '
|
|
229
|
+
return (h(Host, { key: 'f5ad31075413f2d2c14751265fdaa2845f695baa', class: this.elementClassName, "has-error": this.errorState, disabled: this.disabledState }, h("label", { key: '84e8799efa652f93e6ca56ce5696729441e61319', htmlFor: `${this.id}-input`, class: this.getClassName("label") }, this.label), h("div", { key: 'cc3dc9198dbd90a2405938810aebc564b08c2ac3', class: this.getClassName("input-container") }, h("input", { key: '1b63faf6d946fa9bad5198d967eb12fd12dbb02d', id: `${this.id}-input`, ref: (r) => (this.inputRef = r), type: "text", class: this.getClassName("input"), 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: 'a9f580d5d5c46334492b9bfef2dcd80d6808e77c', type: "button", ref: (r) => (this.calendarButtonRef = r), onClick: this.handleCalendarButtonClick, class: this.getClassName("calendar-button"), disabled: this.disabledState }, this.calendarButtonContent ? (h("span", { innerHTML: this.calendarButtonContent })) : (this.timesLabels.openCalendar)))), h("tabworthy-dates-modal", { key: '7fc50538aa0f972999867a6f7175d87bb86ef0d1', label: this.timesLabels.calendar, ref: (el) => (this.modalRef = el), onOpened: () => {
|
|
229
230
|
if (this.pickerRef) {
|
|
230
231
|
this.pickerRef.modalIsOpen = true;
|
|
231
232
|
}
|
|
@@ -233,7 +234,7 @@ const InclusiveTimes = class {
|
|
|
233
234
|
if (this.pickerRef) {
|
|
234
235
|
this.pickerRef.modalIsOpen = false;
|
|
235
236
|
}
|
|
236
|
-
}, inline: this.inline }, h("div", { key: '
|
|
237
|
+
}, inline: this.inline }, h("div", { key: '014187e74184b02318dea891a36c7c0d4888f4db', class: this.getClassName("picker-container") }, h("tabworthy-dates-calendar", { key: '8b35d3640cd1e7c1a30a92c090a41945c807f51f', 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 }, h("div", { key: 'e7802bd55d717def48fd4ff0093c41bfdd3a9d37', slot: "after-calendar", class: this.getClassName("time-section") }, h("tabworthy-times-picker", { key: '4c8e49f3fb82f3b8e9c914fe060b80a5aa76bafe', hours: this.selectedHours, minutes: this.selectedMinutes, use12HourFormat: this.use12HourFormat, disabled: this.disabledState, onTimeChanged: this.handleTimeChange }))))), this.errorState && (h("div", { key: 'f83e3028c666e16b065da2c1f1d92c5f157acd16', class: this.getClassName("input-error"), id: this.id ? `${this.id}-error` : undefined, role: "status" }, this.errorMessage))));
|
|
237
238
|
}
|
|
238
239
|
get el() { return getElement(this); }
|
|
239
240
|
static get watchers() { return {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,c as i,h as s,H as e,g as h}from"./p-zgp3PkTz.js";const a={hours:"Hours",minutes:"Minutes",am:"AM",pm:"PM",timePicker:"Time picker",incrementHours:"Increment hours",decrementHours:"Decrement hours",incrementMinutes:"Increment minutes",decrementMinutes:"Decrement minutes"},n=class{constructor(s){t(this,s),this.timeChanged=i(this,"timeChanged",7),this.hours=12,this.minutes=0,this.use12HourFormat=!1,this.labels=a,this.labelsSrOnly=!0,this.disabled=!1,this.elementClassName="tabworthy-times-picker",this.internalHours=this.hours,this.internalMinutes=this.minutes,this.period=this.hours>=12?"PM":"AM",this.handleHourChange=t=>{const i=parseInt(t.target.value,10);this.internalHours=this.use12HourFormat?"AM"===this.period?12===i?0:i:12===i?12:i+12:i,this.emitTimeChange()},this.handleMinuteChange=t=>{this.internalMinutes=parseInt(t.target.value,10),this.emitTimeChange()},this.handlePeriodChange=t=>{if(this.period===t||!this.use12HourFormat)return;this.period=t;const i=this.getDisplayHours();this.internalHours="AM"===t?12===i?0:i:12===i?12:i+12,this.emitTimeChange()},this.handleHourIncrement=()=>{if(this.use12HourFormat){const t=this.getDisplayHours(),i=12===t?1:t+1;this.internalHours="AM"===this.period?12===i?0:i:12===i?12:i+12}else this.internalHours=(this.internalHours+1)%24;this.emitTimeChange()},this.handleHourDecrement=()=>{if(this.use12HourFormat){const t=this.getDisplayHours(),i=1===t?12:t-1;this.internalHours="AM"===this.period?12===i?0:i:12===i?12:i+12}else this.internalHours=0===this.internalHours?23:this.internalHours-1;this.emitTimeChange()},this.handleMinuteIncrement=()=>{this.internalMinutes=(this.internalMinutes+1)%60,this.emitTimeChange()},this.handleMinuteDecrement=()=>{this.internalMinutes=0===this.internalMinutes?59:this.internalMinutes-1,this.emitTimeChange()}}watchHours(t){this.internalHours=t,this.period=t>=12?"PM":"AM"}watchMinutes(t){this.internalMinutes=t}componentWillLoad(){this.internalHours=this.hours,this.internalMinutes=this.minutes,this.period=this.hours>=12?"PM":"AM"}getDisplayHours(){return this.use12HourFormat?0===this.internalHours?12:this.internalHours>12?this.internalHours-12:this.internalHours:this.internalHours}get24HourValue(){if(!this.use12HourFormat)return this.internalHours;const t=this.getDisplayHours();return"AM"===this.period?12===t?0:t:12===t?12:t+12}emitTimeChange(){this.timeChanged.emit({hours:this.get24HourValue(),minutes:this.internalMinutes,period:this.use12HourFormat?this.period:void 0})}padZero(t){return t.toString().padStart(2,"0")}render(){const t=this.getDisplayHours(),i=this.use12HourFormat?12:23,h=this.use12HourFormat?1:0;return s(e,{key:"22eb745a93c68e4e4f78c11d2941681897aa73ef",class:this.elementClassName,"aria-label":this.labels.timePicker},s("div",{key:"ccb05b5d5793442b63aa4c25d5120db8b60bedf3",class:`${this.elementClassName}__container`},s("div",{key:"3fc4ede2d685e43edcfefe8c88de19f705e94478",class:`${this.elementClassName}__field`},s("label",{key:"fb04e846fc9807155c4390e92722850cdaa4bba2",htmlFor:`${this.elementClassName}-hours`,class:{[`${this.elementClassName}__label`]:!0,[`${this.elementClassName}__label--sr-only`]:this.labelsSrOnly}},this.labels.hours),s("div",{key:"d5ed4a06ea4ce2eaaefda2fa316a4789aa4a210a",class:`${this.elementClassName}__control`},s("button",{key:"193c89e3b50934225c05f3241546bc3e7063b1b8",type:"button",class:`${this.elementClassName}__button ${this.elementClassName}__button--increment`,onClick:this.handleHourIncrement,disabled:this.disabled,"aria-label":this.labels.incrementHours},s("svg",{key:"f6cefeb18839bce2b644d92608f802bc001377b3",fill:"none",height:"16","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"16"},s("polyline",{key:"58519a5d7a8cddfe2273f5c8beec3eab7307b43c",points:"18 15 12 9 6 15"}))),s("input",{key:"187ace01f2d83ad59766159d6509e30100b7f812",id:`${this.elementClassName}-hours`,type:"number",class:`${this.elementClassName}__input`,value:this.padZero(t),min:h,max:i,onInput:this.handleHourChange,disabled:this.disabled,"aria-label":this.labels.hours}),s("button",{key:"3bbe5b73ac8a85c165f0332d3c70d30aede096e6",type:"button",class:`${this.elementClassName}__button ${this.elementClassName}__button--decrement`,onClick:this.handleHourDecrement,disabled:this.disabled,"aria-label":this.labels.decrementHours},s("svg",{key:"fd7c431618e09d4326c95398f83f22ea2258695e",fill:"none",height:"16","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"16"},s("polyline",{key:"99aab5a584aed4d8fc1b30dcada0c76e42ba6ac7",points:"6 9 12 15 18 9"}))))),s("div",{key:"a8958b60136f6220bbd944beaa6cf73c7660e3fb",class:`${this.elementClassName}__separator`},":"),s("div",{key:"72b46b517876dc8bc3490afef1860514b46efc46",class:`${this.elementClassName}__field`},s("label",{key:"e09788653c3873e97e1922fcda3076878f9b1ca7",htmlFor:`${this.elementClassName}-minutes`,class:{[`${this.elementClassName}__label`]:!0,[`${this.elementClassName}__label--sr-only`]:this.labelsSrOnly}},this.labels.minutes),s("div",{key:"7bf9642b58249014b2ad802c3fe30f67e5354f4d",class:`${this.elementClassName}__control`},s("button",{key:"71c889d966bceb4aa9e7b6f78c57e968b207ddda",type:"button",class:`${this.elementClassName}__button ${this.elementClassName}__button--increment`,onClick:this.handleMinuteIncrement,disabled:this.disabled,"aria-label":this.labels.incrementMinutes},s("svg",{key:"3aad10f2b79e5e819277d4566ab7d336449162f9",fill:"none",height:"16","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"16"},s("polyline",{key:"68dfdfc6cd2bd1f8f916dbf60155eb2cc4a8328d",points:"18 15 12 9 6 15"}))),s("input",{key:"15eb767d9318c6d3e7aa0075bf9c3362adf75dd3",id:`${this.elementClassName}-minutes`,type:"number",class:`${this.elementClassName}__input`,value:this.padZero(this.internalMinutes),min:0,max:59,onInput:this.handleMinuteChange,disabled:this.disabled,"aria-label":this.labels.minutes}),s("button",{key:"5c808f40c040e8ff3e4632738f58e9941e69ec03",type:"button",class:`${this.elementClassName}__button ${this.elementClassName}__button--decrement`,onClick:this.handleMinuteDecrement,disabled:this.disabled,"aria-label":this.labels.decrementMinutes},s("svg",{key:"bad9dba94e622c208cb26823963664ff77fc7799",fill:"none",height:"16","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"16"},s("polyline",{key:"92eb0d63e7be970b2207cc0c47964eef48005baf",points:"6 9 12 15 18 9"}))))),this.use12HourFormat&&s("div",{key:"8a3235abb0bf0764993271ff4969ca6aaac83bd7",class:`${this.elementClassName}__period`},s("button",{key:"d8f0679faadf7f0cf04e2f57bed4e9c202d0a056",type:"button",class:{[`${this.elementClassName}__period-button`]:!0,[`${this.elementClassName}__period-button--active`]:"AM"===this.period},onClick:()=>this.handlePeriodChange("AM"),disabled:this.disabled,"aria-label":this.labels.am,"aria-pressed":"AM"===this.period},this.labels.am),s("button",{key:"393802044645d205a71ae593227df550adce2970",type:"button",class:{[`${this.elementClassName}__period-button`]:!0,[`${this.elementClassName}__period-button--active`]:"PM"===this.period},onClick:()=>this.handlePeriodChange("PM"),disabled:this.disabled,"aria-label":this.labels.pm,"aria-pressed":"PM"===this.period},this.labels.pm))))}get el(){return h(this)}static get watchers(){return{hours:[{watchHours:0}],minutes:[{watchMinutes:0}]}}};export{n as tabworthy_times_picker}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,c as i,h as e,H as s,g as a}from"./p-zgp3PkTz.js";import{g as h,r as n,a as o,b as d,c as r,d as c,e as l,f,h as u,s as b,i as v,j as y,k as p,l as k,m as w,n as m,o as g,p as D,q as M,t as x,u as C,v as A,w as L}from"./p-BVHu5CWV.js";const T={clearButton:"Clear value",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"},H=class{constructor(e){t(this,e),this.selectDate=i(this,"selectDate",3),this.changeMonth=i(this,"changeMonth",3),this.changeYear=i(this,"changeYear",3),this.disabled=!1,this.modalIsOpen=!1,this.disableDate=()=>!1,this.elementClassName="tabworthy-dates-calendar",this.firstDayOfWeek=0,this.range=!1,this.labels=T,this.locale=(null===navigator||void 0===navigator?void 0:navigator.language)||"en-US",this.inline=!1,this.showClearButton=!1,this.showMonthStepper=!0,this.showTodayButton=!0,this.showYearStepper=!1,this.showKeyboardHint=!1,this.showHiddenTitle=!0,this.startDate=h(new Date),this.init=()=>{this.currentDate=this.startDate?n(new Date(this.startDate)):new Date,this.updateWeekdays()},this.nextMonth=()=>{this.updateCurrentDate(o(this.currentDate))},this.nextYear=()=>{this.updateCurrentDate(d(this.currentDate))},this.previousMonth=()=>{this.updateCurrentDate(r(this.currentDate))},this.previousYear=()=>{this.updateCurrentDate(c(this.currentDate))},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 i=t.target.closest("[data-date]");if(!Boolean(i))return;const e=n(new Date(i.dataset.date));this.updateCurrentDate(e),this.onSelectDate(e)},this.onMonthSelect=t=>{const i=+t.target.value-1,e=new Date(this.currentDate);l(e,this.minDate,this.maxDate)&&(e.setMonth(i),this.updateCurrentDate(e))},this.onYearSelect=t=>{var i;const e=+t.target.value,s=new Date(this.currentDate);l(s,this.minDate,this.maxDate)&&(s.setFullYear(e),null===(i=this.changeYear)||void 0===i||i.emit({year:e}),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(u(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?c(this.currentDate):r(this.currentDate),!0)):"PageDown"===t.code?(t.preventDefault(),this.updateCurrentDate(t.shiftKey?d(this.currentDate):o(this.currentDate),!0)):"Home"===t.code?(t.preventDefault(),this.updateCurrentDate(y(this.currentDate),!0)):"End"===t.code?(t.preventDefault(),this.updateCurrentDate(p(this.currentDate),!0)):"Space"!==t.code&&"Enter"!==t.code||(t.preventDefault(),this.onSelectDate(this.currentDate)))},this.onMouseEnter=t=>{var i;if(this.disabled)return;const e=n(new Date(null===(i=t.target.closest("td"))||void 0===i?void 0:i.dataset.date));this.hoveredDate=e},this.onMouseLeave=()=>{this.hoveredDate=void 0}}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?n(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=k(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),i=[];for(let e=0;e<t.length;e+=7){const s=t.slice(e,e+7);i.push(s)}return i}getTitle(){if(Boolean(this.currentDate))return Intl.DateTimeFormat(this.locale,{month:"long",year:"numeric"}).format(this.currentDate)}focusDate(t){var i;t&&(null===(i=this.el.querySelector(`[data-date="${h(t)}"]`))||void 0===i||i.focus())}updateCurrentDate(t,i){var e,s;const a=t.getMonth(),h=t.getFullYear();m(t,this.minDate)||(t=new Date(this.minDate)),g(t,this.maxDate)||(t=new Date(this.maxDate)),(a!==(null===(e=this.currentDate)||void 0===e?void 0:e.getMonth())||h!==this.currentDate.getFullYear())&&(null===(s=this.changeMonth)||void 0===s||s.emit({month:M(t),year:D(t)}),i&&(this.moveFocusAfterMonthChanged=!0)),this.currentDate=t,i&&this.focusDate(this.currentDate)}onSelectDate(t){var i,e,s,a;if(!this.disableDate(t)&&l(t,this.minDate,this.maxDate))if(this.isRangeValue(this.value)){const s=void 0===(null===(i=this.value)||void 0===i?void 0:i[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]?[h(s[0])]:[h(s[0]),h(s[1])];this.value=s,null===(e=this.selectDate)||void 0===e||e.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(h(t))}}isRangeValue(t){return!!this.range}render(){var t;const i=this.showTodayButton||this.showClearButton||this.showKeyboardHint,a={year:{prev:this.disabled||!!this.minDate&&new Date(this.minDate).getFullYear()>c(this.currentDate).getFullYear(),next:this.disabled||!!this.maxDate&&new Date(this.maxDate).getFullYear()<d(this.currentDate).getFullYear()},month:{prev:this.disabled||x(r(this.currentDate).getMonth(),r(this.currentDate).getFullYear(),this.minDate,this.maxDate),next:this.disabled||x(o(this.currentDate).getMonth(),o(this.currentDate).getFullYear(),this.minDate,this.maxDate)}};return e(s,{key:"0ca78d9d8d4d0edd2375f48f23c5d879a2c6fb44"},e("div",{key:"8ba043e2d7c70958ca73253348de57c07424c7f2",class:{[`${this.getClassName()}-wrapper`]:!0,[`${this.getClassName()}-wrapper--inline`]:this.inline}},e("div",{key:"2b6d87a26620acd162d6321add8cb52fe9c41e97",class:{[this.getClassName()]:!0,[`${this.getClassName()}--disabled`]:this.disabled}},e("div",{key:"f773d4c95f3ebf4ea79dd5e72385a1f16b6cfe87",class:this.getClassName("header")},this.showHiddenTitle&&e("span",{key:"c6249db5073485bcf479bcd1d8c9da6a8270757c","aria-atomic":"true","aria-live":"polite",class:"visually-hidden"},this.getTitle()),this.showYearStepper&&e("button",{key:"ecf43dac6e8539598c43f782fb211ff44758d58a","aria-label":this.labels.previousYearButton,class:this.getClassName("previous-year-button"),"aria-disabled":a.year.prev,innerHTML:this.previousYearButtonContent||void 0,onClick:this.previousYear,type:"button"},e("svg",{key:"7986a7b8b7a4a696c6e62bba6677f9801c6d9059",fill:"none",height:"24","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"24"},e("polyline",{key:"3a1474883ab05ef0c0376944cfc4dbfe63aa6434",points:"11 17 6 12 11 7"}),e("polyline",{key:"eb15b38a86f440e5b77723e8551e774af50c4a32",points:"18 17 13 12 18 7"}))),this.showMonthStepper&&e("button",{key:"f3a6e864f855833ae24f6b15930ff85a5939d39e","aria-label":this.labels.previousMonthButton,class:this.getClassName("previous-month-button"),"aria-disabled":a.month.prev,innerHTML:this.previousMonthButtonContent||void 0,onClick:this.previousMonth,type:"button"},e("svg",{key:"b15bc4eb6009b5872bc0d1253b5ca0e863505956",fill:"none",height:"24","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"24"},e("polyline",{key:"90d0590bdafd7b802e8967366f30411ac65aead1",points:"15 18 9 12 15 6"}))),e("span",{key:"c0a4670b7f7f71706e1b02430f08302d69e7bec4",class:this.getClassName("current-month")},e("select",{key:"d7b43fcb12387644b74403f52c3e72948d2a460d","aria-label":this.labels.monthSelect,class:this.getClassName("month-select"),"aria-disabled":this.disabled,name:"month",onChange:this.onMonthSelect},C(this.locale).map(((t,i)=>e("option",{key:t,selected:this.currentDate.getMonth()===i,value:i+1,disabled:x(i,this.currentDate.getFullYear(),this.minDate,this.maxDate)},t)))),e("input",{key:"6123f052aa28fd745ee52a37d817855a31c6a888","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&&e("button",{key:"9a9ded70d8cfb7f61d15edc15873f1c7cc24d352","aria-label":this.labels.nextMonthButton,class:this.getClassName("next-month-button"),"aria-disabled":a.month.next,innerHTML:this.nextMonthButtonContent||void 0,onClick:this.nextMonth,type:"button"},e("svg",{key:"500969c2fd840a7131c348c4d562f3493dfddd4e",fill:"none",height:"24","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"24"},e("polyline",{key:"9e7fdecb2585366f9dc96fe32f0c83123257bd0a",points:"9 18 15 12 9 6"}))),this.showYearStepper&&e("button",{key:"7ee30553302a226836261fd21dafdfa065f831d8","aria-label":this.labels.nextYearButton,class:this.getClassName("next-year-button"),"aria-disabled":a.year.next,innerHTML:this.nextYearButtonContent||void 0,onClick:this.nextYear,type:"button"},e("svg",{key:"d3c6f21d586a2be2ef8f52419fde77c1ad4398ad",fill:"none",height:"24","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"24"},e("polyline",{key:"19da599079fab7e31a853a7f09e68d12e66c9974",points:"13 17 18 12 13 7"}),e("polyline",{key:"b23802d92bc35c3af659f86ecad9d41320cf3467",points:"6 17 11 12 6 7"})))),e("div",{key:"75b511a738d0d421828c64a88b79cdadeb3e77db",class:this.getClassName("body")},e("table",{key:"7f62f9985c99c4c19cbf320e009fbefbb436f5c2",class:this.getClassName("calendar"),onKeyDown:this.onKeyDown,role:"grid","aria-label":this.getTitle()},e("thead",{key:"6d518a1c015ee4f545278e175d9f71456b7cb525",class:this.getClassName("calendar-header")},e("tr",{key:"d5f289679c98b5ef8f67f8ccbf3999aac68a022c",class:this.getClassName("weekday-row")},null===(t=this.weekdays)||void 0===t?void 0:t.map((t=>e("th",{role:"columnheader",abbr:t[1],class:this.getClassName("weekday"),key:t[0],scope:"col"},e("span",{"aria-hidden":"true"},t[0]),e("span",{class:"visually-hidden"},t[1])))))),e("tbody",{key:"f4cf7ef148106044880c2b6c360e4319a7b31d83"},this.getCalendarRows().map((t=>{const i=`row-${t[0].getMonth()}-${t[0].getDate()}`;return e("tr",{class:this.getClassName("calendar-row"),key:i},t.map((t=>{var i,s,a;const n=A(t,this.currentDate),o=t.getMonth()!==(null===(i=this.currentDate)||void 0===i?void 0:i.getMonth()),d=Array.isArray(this.value)?A(t,this.value[0])||this.value[1]&&l(t,h(this.value[0]),h(this.value[1])):A(t,this.value),r=this.disableDate(t)||!l(t,this.minDate,this.maxDate),c=!!this.isRangeValue(this.value)&&L(t,{from:null===(s=this.value)||void 0===s?void 0:s[0],to:(null===(a=this.value)||void 0===a?void 0:a[1])||this.hoveredDate||this.currentDate})&&!r,f=A(t,new Date),u=`cell-${t.getMonth()}-${t.getDate()}`,b={[this.getClassName("date")]:!0,[this.getClassName("date--current")]:n,[this.getClassName("date--disabled")]:r,[this.getClassName("date--overflowing")]:o,[this.getClassName("date--today")]:f,[this.getClassName("date--selected")]:d,[this.getClassName("date--in-range")]:c},v=d?"strong":f?"em":"span";return e("td",{"aria-disabled":String(r),"aria-selected":d?"true":void 0,class:b,"data-date":h(t),key:u,onClick:this.onClick,onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,role:"gridcell",tabIndex:A(t,this.currentDate)&&!this.disabled?0:-1},e(v,{"aria-hidden":"true"},t.getDate()),e("span",{class:"visually-hidden"},(()=>{if(this.range){let i=this.value?"":`, ${this.labels.chooseAsStartDate}.`;return Array.isArray(this.value)&&(i={1:`, ${this.labels.chooseAsEndDate}.`,2:`, ${this.labels.chooseAsStartDate}.`}[this.value.length]),`${d?`${this.labels.selected}, `:""}${Intl.DateTimeFormat(this.locale,{day:"numeric",month:"long",year:"numeric"}).format(t)}${i}`}return`${d?`${this.labels.selected}, `:""}${Intl.DateTimeFormat(this.locale,{day:"numeric",month:"long",year:"numeric"}).format(t)}`})()))})))}))))),i&&e("div",{key:"a34938c0321570d5a4983cb47822d12335cb5fba",class:this.getClassName("footer")},e("div",{key:"0c52dc84cb734326025e7927f94ab7d9947f89c3",class:this.getClassName("footer-buttons")},this.showTodayButton&&e("button",{key:"11d7621dc4b8ffa33b51bf4312de6f0cedcc94e9",class:this.getClassName("today-button"),disabled:this.disabled,innerHTML:this.todayButtonContent||void 0,onClick:this.showToday,type:"button"},this.labels.todayButton),this.showClearButton&&e("button",{key:"2eb6ef128169727ba993a68d270e730b600b130a",class:this.getClassName("clear-button"),disabled:this.disabled,innerHTML:this.clearButtonContent||void 0,onClick:this.clear,type:"button"},this.labels.clearButton)),this.showKeyboardHint&&!window.matchMedia("(pointer: coarse)").matches&&e("button",{key:"f2f52bf2b5de8d810dab6f3376d5b0923a2abb0c",type:"button",onClick:()=>alert("Todo: Add Keyboard helper!"),class:this.getClassName("keyboard-hint")},e("svg",{key:"1d2f5e1323af69c00c185b450a3e4ac2ed5b9f69",xmlns:"http://www.w3.org/2000/svg",height:"1em",width:"1em",viewBox:"0 0 48 48",fill:"currentColor"},e("path",{key:"d3f34347335b0e1f100b5e6346a283678daba519",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))),e("slot",{key:"fa342bcfcd2cf4cb057b33b0cc8231264e97c51c",name:"after-calendar"})))}get el(){return a(this)}static get watchers(){return{modalIsOpen:[{watchModalIsOpen:0}],firstDayOfWeek:[{watchFirstDayOfWeek:0}],locale:[{watchLocale:0}],range:[{watchRange:0}],startDate:[{watchStartDate:0}],value:[{watchValue:0}]}}};function $(t,i,e,s=20,a=0){let h=[];if(a>=s)return h;const n=t=>{const h=t.assignedNodes().filter((t=>1===t.nodeType));return h.length>0?$(h[0].parentElement,i,e,s,a+1):[]},o=Array.from(t.children||[]);for(const t of o)i(t)||(e(t)&&h.push(t),null!=t.shadowRoot?h.push(...$(t.shadowRoot,i,e,s,a+1)):"SLOT"===t.tagName?h.push(...n(t)):h.push(...$(t,i,e,s,a+1)));return h}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 S(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)}H.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 E=new Map,Z=document.createElement("template");Z.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 W extends HTMLElement{constructor(){super(),this.debounceId=Math.random().toString(),this._focused=!1;const t=this.attachShadow({mode:"open"});t.appendChild(Z.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 $(this,B,S)}trapFocus(t){if(this.inactive)return;let i=this.getFocusableElements();i.length>0?(t?i[i.length-1].focus():i[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,i,e){const s=E.get(e);null!=s&&window.clearTimeout(s),E.set(e,window.setTimeout((()=>{t(),E.delete(e)}),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",W);var I=new WeakMap,F=new WeakMap,O={},V=0,j=function(t){return t&&(t.host||j(t.parentNode))},R=function(t,i,e){void 0===e&&(e="data-aria-hidden");var s=Array.from(Array.isArray(t)?t:[t]),a=function(t){return"undefined"==typeof document?null:(Array.isArray(t)?t[0]:t).ownerDocument.body}(t);return a?(s.push.apply(s,Array.from(a.querySelectorAll("[aria-live]"))),function(t,i,e,s){var a=function(t,i){return i.map((function(i){if(t.contains(i))return i;var e=j(i);return e&&t.contains(e)?e:(console.error("aria-hidden",i,"in not contained inside",t,". Doing nothing"),null)})).filter((function(t){return Boolean(t)}))}(i,Array.isArray(t)?t:[t]);O[e]||(O[e]=new WeakMap);var h=O[e],n=[],o=new Set,d=new Set(a),r=function(t){t&&!o.has(t)&&(o.add(t),r(t.parentNode))};a.forEach(r);var c=function(t){t&&!d.has(t)&&Array.prototype.forEach.call(t.children,(function(t){if(o.has(t))c(t);else{var i=t.getAttribute(s),a=null!==i&&"false"!==i,d=(I.get(t)||0)+1,r=(h.get(t)||0)+1;I.set(t,d),h.set(t,r),n.push(t),1===d&&a&&F.set(t,!0),1===r&&t.setAttribute(e,"true"),a||t.setAttribute(s,"true")}}))};return c(i),o.clear(),V++,function(){n.forEach((function(t){var i=I.get(t)-1,a=h.get(t)-1;I.set(t,i),h.set(t,a),i||(F.has(t)||t.removeAttribute(s),F.delete(t)),a||t.removeAttribute(e)})),--V||(I=new WeakMap,I=new WeakMap,F=new WeakMap,O={})}}(s,a,e,"aria-hidden")):function(){return null}};const _=class{constructor(e){t(this,e),this.opened=i(this,"opened",7),this.closed=i(this,"closed",7),this.inline=!1,this.closing=!1,this.showing=this.inline||!1,this.onKeyDown=t=>{"Escape"===t.code&&this.close()}}async open(){this.inline||(this.showing=!0,this.undo=R(this.el),this.opened.emit(void 0))}async close(){this.inline||(this.showing=!1,this.closed.emit(void 0),this.undo(),this.triggerElement&&this.triggerElement.focus())}async getState(){return this.showing}async setTriggerElement(t){this.triggerElement=t}handleClick(t){this.showing&&!this.el.contains(t.target)&&this.close()}render(){return e(s,{key:"773d9edf7cf6598394c1210a1fab91af0bcb951e",showing:this.showing,ref:t=>t&&(this.el=t)},!this.inline&&this.showing&&e("div",{key:"c456932007f7ea9a9c3727d9d08fd8fbea5b8670",part:"body",onKeyDown:this.onKeyDown,role:"dialog",tabindex:-1,"aria-hidden":!this.showing,"aria-label":this.label,"aria-modal":this.showing},e("focus-trap",{key:"c1355fe48117067d62ede321afd1f90bf9bf4c22"},e("div",{key:"fbd3ec5e0e7069574f1dbd6c38b40e409b837045",part:"content"},e("slot",{key:"bad04015cc3945efbb68a52de623ee1f4b584868"})))),this.inline&&e("div",{key:"b0577b12dd1bec091de967ccd0ac297451576ad8",part:"content"},e("slot",{key:"5457a9bd5d08feac90adb2ee061d60fb5fb94657"})))}};_.style=":host::part(body){position:absolute;width:-moz-fit-content;width:fit-content;z-index:1200;margin-top:0.5rem}:host::part(backdrop){}:host::part(content){}";export{H as tabworthy_dates_calendar,_ as tabworthy_dates_modal}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,c as s,h as i,H as e,g as h}from"./p-zgp3PkTz.js";import{h as a}from"./p-Mki5YqAR.js";import{g as r,r as n}from"./p-BVHu5CWV.js";const o={selected:"selected",openCalendar:"Open date and time picker",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"},d=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=r(new Date),this.referenceDate=r(new Date),this.use12HourFormat=!0,this.timesLabels=o,this.inline=!1,this.hasError=!1,this.showYearStepper=!1,this.showMonthStepper=!0,this.showClearButton=!0,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.selectedHours=12,this.selectedMinutes=0,this.errorState=this.hasError,this.disabledState=this.disabled,this.errorMessage="",this.handlePickerSelection=async t=>{const s=t.split(",");if(this.range&&2===s.length){const t=n(new Date(s[0])),i=n(new Date(s[1]));this.updateValue([t,i]),this.pickerRef&&(this.pickerRef.value=[t,i])}else{const t=n(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,this.selectedDate&&this.updateValue(this.selectedDate)},this.handleCalendarButtonClick=async()=>{this.modalRef&&(await this.modalRef.setTriggerElement(this.calendarButtonRef),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=a(t.target.value);s.isValid()&&(this.selectedHours=s.hours(),this.selectedMinutes=s.minutes(),this.updateValue(s.toDate()))}}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=a(t,this.format);s.isValid()&&(this.selectedDate=s.toDate(),this.selectedHours=s.hours(),this.selectedMinutes=s.minutes())}}else this.internalValue=null}updateValue(t){if(Array.isArray(t)){const s=t.map((t=>{const s=a(t);return s.hours(this.selectedHours),s.minutes(this.selectedMinutes),s.seconds(0),s.format(this.format)}));this.internalValue=s,this.value=s,this.selectDateTime.emit(s)}else{const s=a(t);s.hours(this.selectedHours),s.minutes(this.selectedMinutes),s.seconds(0);const i=s.format(this.format);this.internalValue=i,this.value=i,this.selectedDate=t,this.selectDateTime.emit(i)}this.errorState=!1,this.shouldInputFormat()&&this.formatInput()}formatInput(){if(this.internalValue)if(Array.isArray(this.internalValue)){const t=this.internalValue.map((t=>a(t,this.format).format("lll"))).join(` ${this.timesLabels.to} `);this.inputRef.value=t}else this.inputRef.value=a(this.internalValue,this.format).format("lll")}getClassName(t){return`${this.elementClassName}__${t}`}async clearValue(){this.internalValue=null,this.value=void 0,this.selectedDate=void 0,this.inputRef.value="",this.pickerRef&&(this.pickerRef.value=null),this.selectDateTime.emit(void 0)}render(){var t;return i(e,{key:"f5ad31075413f2d2c14751265fdaa2845f695baa",class:this.elementClassName,"has-error":this.errorState,disabled:this.disabledState},i("label",{key:"84e8799efa652f93e6ca56ce5696729441e61319",htmlFor:`${this.id}-input`,class:this.getClassName("label")},this.label),i("div",{key:"cc3dc9198dbd90a2405938810aebc564b08c2ac3",class:this.getClassName("input-container")},i("input",{key:"1b63faf6d946fa9bad5198d967eb12fd12dbb02d",id:`${this.id}-input`,ref:t=>this.inputRef=t,type:"text",class:this.getClassName("input"),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:"a9f580d5d5c46334492b9bfef2dcd80d6808e77c",type:"button",ref:t=>this.calendarButtonRef=t,onClick:this.handleCalendarButtonClick,class:this.getClassName("calendar-button"),disabled:this.disabledState},this.calendarButtonContent?i("span",{innerHTML:this.calendarButtonContent}):this.timesLabels.openCalendar)),i("tabworthy-dates-modal",{key:"7fc50538aa0f972999867a6f7175d87bb86ef0d1",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},i("div",{key:"014187e74184b02318dea891a36c7c0d4888f4db",class:this.getClassName("picker-container")},i("tabworthy-dates-calendar",{key:"8b35d3640cd1e7c1a30a92c090a41945c807f51f",range:this.range,locale:this.locale,onSelectDate:t=>this.handlePickerSelection(t.detail),onChangeMonth:t=>this.handleChangedMonths(t.detail),onChangeYear:t=>this.handleYearChange(t.detail),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,showTodayButton:this.showTodayButton,disableDate:this.disableDate,minDate:this.minDate,maxDate:this.maxDate,inline:this.inline},i("div",{key:"e7802bd55d717def48fd4ff0093c41bfdd3a9d37",slot:"after-calendar",class:this.getClassName("time-section")},i("tabworthy-times-picker",{key:"4c8e49f3fb82f3b8e9c914fe060b80a5aa76bafe",hours:this.selectedHours,minutes:this.selectedMinutes,use12HourFormat:this.use12HourFormat,disabled:this.disabledState,onTimeChanged:this.handleTimeChange}))))),this.errorState&&i("div",{key:"f83e3028c666e16b065da2c1f1d92c5f157acd16",class:this.getClassName("input-error"),id:this.id?`${this.id}-error`:void 0,role:"status"},this.errorMessage))}get el(){return h(this)}static get watchers(){return{value:[{watchValue:0}],disabled:[{watchDisabled:0}],hasError:[{watchHasError:0}]}}};export{d as tabworthy_times}
|