@tabworthy/components 0.11.3 → 0.11.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/customParseFormat-l09KVyWD.js +45 -0
- package/dist/cjs/tabworthy-dates.cjs.entry.js +19 -22
- package/dist/cjs/tabworthy-times.cjs.entry.js +43 -23
- package/dist/collection/components/tabworthy-dates/tabworthy-dates.js +19 -17
- package/dist/collection/components/tabworthy-times/tabworthy-times.js +27 -23
- package/dist/components/p-DkyM-7xr.js +1 -0
- package/dist/components/tabworthy-dates.js +1 -1
- package/dist/components/tabworthy-times.js +1 -1
- package/dist/esm/customParseFormat-DkyM-7xr.js +41 -0
- package/dist/esm/tabworthy-dates.entry.js +18 -21
- package/dist/esm/tabworthy-times.entry.js +43 -23
- package/dist/tabworthy-components/p-6335f1a7.entry.js +1 -0
- package/dist/tabworthy-components/p-DkyM-7xr.js +1 -0
- package/dist/tabworthy-components/p-c378a069.entry.js +1 -0
- package/dist/tabworthy-components/tabworthy-components.esm.js +1 -1
- package/package.json +2 -3
- package/dist/cjs/moment-CdViwxPQ.js +0 -5681
- package/dist/components/p-Mki5YqAR.js +0 -8
- package/dist/esm/moment-Mki5YqAR.js +0 -5679
- package/dist/tabworthy-components/p-Mki5YqAR.js +0 -8
- package/dist/tabworthy-components/p-d4a7458b.entry.js +0 -1
- package/dist/tabworthy-components/p-ea7b79b0.entry.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as t,H as s,c as e,h as i,d as a,t as h}from"./p-BiJ0HZVY.js";import{h as r}from"./p-Mki5YqAR.js";import{g as o,r as n,c as l}from"./p-CGo5md1l.js";import{d}from"./p-CIQgnOXj.js";import{d as c}from"./p-B6lbpNd2.js";const u={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"},b=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.useTwelveHourFormat=!0,this.showSeconds=!1,this.timesLabels=u,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=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,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=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(),this.selectedSeconds=s.seconds())}}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(this.selectedSeconds),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(this.selectedSeconds);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}`}toDate(t){return t?Array.isArray(t)?t.map((t=>r(t,this.format).toDate())):r(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(a,{key:"de07eab0ee0cd6624756ce18a0dcc38a509692e4",class:this.elementClassName,"has-error":this.errorState,disabled:this.disabledState},i("label",{key:"666a1cd43b7c2d1633210d7422ec8d2c3fc44e44",htmlFor:this.id+"-input",class:this.getClassName("label")},this.label),i("div",{key:"222432b8a431bac954fb625f5b724df077d9feeb",class:this.getClassName("input-container"),ref:t=>this.inputContainerRef=t},i("input",{key:"c3284e4348cd736f2edf708978956fb88f78118a",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,onBlur:this.handleInputBlur,onChange:this.handleInputChange,"aria-describedby":this.errorState?this.id+"-error":void 0,"aria-invalid":this.errorState}),!this.inline&&i("button",{key:"9087c6b9cec31990b13ba6a1a7ad66f937ddee3a",type:"button",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:"79613c7af13afe36e03cfede116b260f9d1d2b63",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:"716440a779e1e614fbef292c7c1cc801cde57ee6",class:this.getClassName("picker-container")},i("tabworthy-dates-calendar",{key:"02579a80370918076f36e04f64b6626893acf1cd",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},i("div",{key:"df629acf66bc6a83c7c0601f6cff39a8a27ddba2",slot:"after-calendar",class:this.getClassName("time-section")},i("hr",{key:"084ba933dbe96086d9c8f21494e4016eb6d3ac66",class:this.getClassName("divider")}),i("tabworthy-times-picker",{key:"788081745c21b0702fcc0f8d79f0c6fe88b4372d",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:"0742a70dcb66f4523131c29d60f2056c9cf94320",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"],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"],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]},void 0,{value:[{watchValue:0}],disabled:[{watchDisabled:0}],hasError:[{watchHasError:0}]}]),f=b,m=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),b);break;case"tabworthy-dates-calendar":customElements.get(h(t))||l();break;case"tabworthy-dates-modal":customElements.get(h(t))||d();break;case"tabworthy-times-picker":customElements.get(h(t))||c()}}))};export{f as TabworthyTimes,m as defineCustomElement}
|
|
1
|
+
import{p as t,H as s,c as e,h as i,d as a,t as h}from"./p-BiJ0HZVY.js";import{g as r,d as o,c as n}from"./p-DkyM-7xr.js";import{g as l,r as d,c}from"./p-CGo5md1l.js";import{d as u}from"./p-CIQgnOXj.js";import{d as b}from"./p-B6lbpNd2.js";var m,f={exports:{}},p=r(m?f.exports:(m=1,f.exports=function(){var t={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"};return function(s,e,i){var a=e.prototype,h=a.format;i.en.formats=t,a.format=function(s){void 0===s&&(s="YYYY-MM-DDTHH:mm:ssZ");var e=this.$locale().formats,i=function(s,e){return s.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(s,i,a){var h=a&&a.toUpperCase();return i||e[a]||t[a]||e[h].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(t,s,e){return s||e.slice(1)}))}))}(s,void 0===e?{}:e);return h.call(this,i)}}}()));o.extend(n),o.extend(p);const w={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"},y=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=l(new Date),this.referenceDate=l(new Date),this.useTwelveHourFormat=!0,this.showSeconds=!1,this.timesLabels=w,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])),e=d(new Date(s[1]));this.updateValue([t,e]),this.pickerRef&&(this.pickerRef.value=[t,e])}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=o(t.target.value);s.isValid()&&(this.selectedHours=s.hour(),this.selectedMinutes=s.minute(),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=o(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=>o(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=o(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=>o(t,this.format).format("lll"))).join(` ${this.timesLabels.to} `);this.inputRef.value=t}else this.inputRef.value=o(this.internalValue,this.format).format("lll")}getClassName(t){return`${this.elementClassName}__${t}`}toDate(t){return t?Array.isArray(t)?t.map((t=>o(t,this.format).toDate())):o(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(a,{key:"03aaff051aa6af4a7606b64056336c4f597ffaeb",class:this.elementClassName,"has-error":this.errorState,disabled:this.disabledState},i("label",{key:"d05264d3b32741ccfeca0be4473f9323b4934071",htmlFor:this.id+"-input",class:this.getClassName("label")},this.label),i("div",{key:"7a4306a4863ffffe35a0d33c80ebfc19298c2182",class:this.getClassName("input-container"),ref:t=>this.inputContainerRef=t},i("input",{key:"03080dc8619d396347b831b307c8fa9070434b35",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,onBlur:this.handleInputBlur,onChange:this.handleInputChange,"aria-describedby":this.errorState?this.id+"-error":void 0,"aria-invalid":this.errorState}),!this.inline&&i("button",{key:"cc384691007bc6eb4044098ab79ba38809375de7",type:"button",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:"14290fe8ca21e0027c384bd56d913d2cdda55380",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:"83c1e85f688a0ff213872e54a96702429f00869b",class:this.getClassName("picker-container")},i("tabworthy-dates-calendar",{key:"6afcc9ddb6fcedf07127c933ad1ed192a4c88eaf",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},i("div",{key:"7e47f4b63a85d6431f8019a8725acbf79fb44d67",slot:"after-calendar",class:this.getClassName("time-section")},i("hr",{key:"8b72711de0422f1b1848bb22a72ed363b1c63ebb",class:this.getClassName("divider")}),i("tabworthy-times-picker",{key:"29f47e57c4f3f94232345bbe602d0278b5f53fa4",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:"aa6f743bc35538f6271a45bb2564e89164e5a909",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"],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"],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]},void 0,{value:[{watchValue:0}],disabled:[{watchDisabled:0}],hasError:[{watchHasError:0}]}]),D=y,v=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),y);break;case"tabworthy-dates-calendar":customElements.get(h(t))||c();break;case"tabworthy-dates-modal":customElements.get(h(t))||u();break;case"tabworthy-times-picker":customElements.get(h(t))||b()}}))};export{D as TabworthyTimes,v as defineCustomElement}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
function getDefaultExportFromCjs (x) {
|
|
2
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
var dayjs_min$1 = {exports: {}};
|
|
6
|
+
|
|
7
|
+
var dayjs_min = dayjs_min$1.exports;
|
|
8
|
+
|
|
9
|
+
var hasRequiredDayjs_min;
|
|
10
|
+
|
|
11
|
+
function requireDayjs_min () {
|
|
12
|
+
if (hasRequiredDayjs_min) return dayjs_min$1.exports;
|
|
13
|
+
hasRequiredDayjs_min = 1;
|
|
14
|
+
(function (module, exports) {
|
|
15
|
+
!function(t,e){module.exports=e();}(dayjs_min,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p="$isDayjsObject",S=function(t){return t instanceof _||!(!t||!t[p])},w=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,true),this.parse(t),this.$x=this.$x||t.x||{},this[p]=true;}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return b},m.isValid=function(){return !(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<O(t)},m.$g=function(t,e,n){return b.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!b.u(e)||e,f=b.p(t),l=function(t,e){var i=b.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return b.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(f){case h:return r?l(1,0):l(31,11);case c:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,false)},m.$set=function(t,e){var n,o=b.p(t),f="set"+(this.$u?"UTC":""),l=(n={},n[a]=f+"Date",n[d]=f+"Date",n[c]=f+"Month",n[h]=f+"FullYear",n[u]=f+"Hours",n[s]=f+"Minutes",n[i]=f+"Seconds",n[r]=f+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[b.p(t)]()},m.add=function(r,f){var d,l=this;r=Number(r);var $=b.p(f),y=function(t){var e=O(l);return b.w(e.date(e.date()+Math.round(t*r)),l)};if($===c)return this.set(c,this.$M+r);if($===h)return this.set(h,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return b.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=b.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return b.s(s%12||12,t,"0")},$=f||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(y,(function(t,r){return r||function(t){switch(t){case "YY":return String(e.$y).slice(-2);case "YYYY":return b.s(e.$y,4,"0");case "M":return a+1;case "MM":return b.s(a+1,2,"0");case "MMM":return h(n.monthsShort,a,c,3);case "MMMM":return h(c,a);case "D":return e.$D;case "DD":return b.s(e.$D,2,"0");case "d":return String(e.$W);case "dd":return h(n.weekdaysMin,e.$W,o,2);case "ddd":return h(n.weekdaysShort,e.$W,o,3);case "dddd":return o[e.$W];case "H":return String(s);case "HH":return b.s(s,2,"0");case "h":return d(1);case "hh":return d(2);case "a":return $(s,u,true);case "A":return $(s,u,false);case "m":return String(u);case "mm":return b.s(u,2,"0");case "s":return String(e.$s);case "ss":return b.s(e.$s,2,"0");case "SSS":return b.s(e.$ms,3,"0");case "Z":return i}return null}(t)||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=this,M=b.p(d),m=O(r),v=(m.utcOffset()-this.utcOffset())*e,g=this-m,D=function(){return b.m(y,m)};switch(M){case h:$=D()/12;break;case c:$=D();break;case f:$=D()/3;break;case o:$=(g-v)/6048e5;break;case a:$=(g-v)/864e5;break;case u:$=g/n;break;case s:$=g/e;break;case i:$=g/t;break;default:$=g;}return l?$:b.a($)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=w(t,e,true);return r&&(n.$L=r),n},m.clone=function(){return b.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),k=_.prototype;return O.prototype=k,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",c],["$y",h],["$D",d]].forEach((function(t){k[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),O.extend=function(t,e){return t.$i||(t(e,_,O),t.$i=true),O},O.locale=w,O.isDayjs=S,O.unix=function(t){return O(1e3*t)},O.en=D[g],O.Ls=D,O.p={},O}));
|
|
16
|
+
} (dayjs_min$1));
|
|
17
|
+
return dayjs_min$1.exports;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
var dayjs_minExports = requireDayjs_min();
|
|
21
|
+
var dayjs = /*@__PURE__*/getDefaultExportFromCjs(dayjs_minExports);
|
|
22
|
+
|
|
23
|
+
var customParseFormat$2 = {exports: {}};
|
|
24
|
+
|
|
25
|
+
var customParseFormat$1 = customParseFormat$2.exports;
|
|
26
|
+
|
|
27
|
+
var hasRequiredCustomParseFormat;
|
|
28
|
+
|
|
29
|
+
function requireCustomParseFormat () {
|
|
30
|
+
if (hasRequiredCustomParseFormat) return customParseFormat$2.exports;
|
|
31
|
+
hasRequiredCustomParseFormat = 1;
|
|
32
|
+
(function (module, exports) {
|
|
33
|
+
!function(e,t){module.exports=t();}(customParseFormat$1,(function(){var e={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"},t=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d/,r=/\d\d/,i=/\d\d?/,o=/\d*[^-_:/,()\s\d]+/,s={},a=function(e){return (e=+e)+(e>68?1900:2e3)};var f=function(e){return function(t){this[e]=+t;}},h=[/[+-]\d\d:?(\d\d)?|Z/,function(e){(this.zone||(this.zone={})).offset=function(e){if(!e)return 0;if("Z"===e)return 0;var t=e.match(/([+-]|\d\d)/g),n=60*t[1]+(+t[2]||0);return 0===n?0:"+"===t[0]?-n:n}(e);}],u=function(e){var t=s[e];return t&&(t.indexOf?t:t.s.concat(t.f))},d=function(e,t){var n,r=s.meridiem;if(r){for(var i=1;i<=24;i+=1)if(e.indexOf(r(i,0,t))>-1){n=i>12;break}}else n=e===(t?"pm":"PM");return n},c={A:[o,function(e){this.afternoon=d(e,false);}],a:[o,function(e){this.afternoon=d(e,true);}],Q:[n,function(e){this.month=3*(e-1)+1;}],S:[n,function(e){this.milliseconds=100*+e;}],SS:[r,function(e){this.milliseconds=10*+e;}],SSS:[/\d{3}/,function(e){this.milliseconds=+e;}],s:[i,f("seconds")],ss:[i,f("seconds")],m:[i,f("minutes")],mm:[i,f("minutes")],H:[i,f("hours")],h:[i,f("hours")],HH:[i,f("hours")],hh:[i,f("hours")],D:[i,f("day")],DD:[r,f("day")],Do:[o,function(e){var t=s.ordinal,n=e.match(/\d+/);if(this.day=n[0],t)for(var r=1;r<=31;r+=1)t(r).replace(/\[|\]/g,"")===e&&(this.day=r);}],w:[i,f("week")],ww:[r,f("week")],M:[i,f("month")],MM:[r,f("month")],MMM:[o,function(e){var t=u("months"),n=(u("monthsShort")||t.map((function(e){return e.slice(0,3)}))).indexOf(e)+1;if(n<1)throw new Error;this.month=n%12||n;}],MMMM:[o,function(e){var t=u("months").indexOf(e)+1;if(t<1)throw new Error;this.month=t%12||t;}],Y:[/[+-]?\d+/,f("year")],YY:[r,function(e){this.year=a(e);}],YYYY:[/\d{4}/,f("year")],Z:h,ZZ:h};function l(n){var r,i;r=n,i=s&&s.formats;for(var o=(n=r.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(t,n,r){var o=r&&r.toUpperCase();return n||i[r]||e[r]||i[o].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(e,t,n){return t||n.slice(1)}))}))).match(t),a=o.length,f=0;f<a;f+=1){var h=o[f],u=c[h],d=u&&u[0],l=u&&u[1];o[f]=l?{regex:d,parser:l}:h.replace(/^\[|\]$/g,"");}return function(e){for(var t={},n=0,r=0;n<a;n+=1){var i=o[n];if("string"==typeof i)r+=i.length;else {var s=i.regex,f=i.parser,h=e.slice(r),u=s.exec(h)[0];f.call(t,u),e=e.replace(u,"");}}return function(e){var t=e.afternoon;if(void 0!==t){var n=e.hours;t?n<12&&(e.hours+=12):12===n&&(e.hours=0),delete e.afternoon;}}(t),t}}return function(e,t,n){n.p.customParseFormat=true,e&&e.parseTwoDigitYear&&(a=e.parseTwoDigitYear);var r=t.prototype,i=r.parse;r.parse=function(e){var t=e.date,r=e.utc,o=e.args;this.$u=r;var a=o[1];if("string"==typeof a){var f=true===o[2],h=true===o[3],u=f||h,d=o[2];h&&(d=o[2]),s=this.$locale(),!f&&d&&(s=n.Ls[d]),this.$d=function(e,t,n,r){try{if(["x","X"].indexOf(t)>-1)return new Date(("X"===t?1e3:1)*e);var i=l(t)(e),o=i.year,s=i.month,a=i.day,f=i.hours,h=i.minutes,u=i.seconds,d=i.milliseconds,c=i.zone,m=i.week,M=new Date,Y=a||(o||s?1:M.getDate()),p=o||M.getFullYear(),v=0;o&&!s||(v=s>0?s-1:M.getMonth());var D,w=f||0,g=h||0,y=u||0,L=d||0;return c?new Date(Date.UTC(p,v,Y,w,g,y,L+60*c.offset*1e3)):n?new Date(Date.UTC(p,v,Y,w,g,y,L)):(D=new Date(p,v,Y,w,g,y,L),m&&(D=r(D).week(m).toDate()),D)}catch(e){return new Date("")}}(t,a,r,n),this.init(),d&&true!==d&&(this.$L=this.locale(d).$L),u&&t!=this.format(a)&&(this.$d=new Date("")),s={};}else if(a instanceof Array)for(var c=a.length,m=1;m<=c;m+=1){o[1]=a[m-1];var M=n.apply(this,o);if(M.isValid()){this.$d=M.$d,this.$L=M.$L,this.init();break}m===c&&(this.$d=new Date(""));}else i.call(this,e);};}}));
|
|
34
|
+
} (customParseFormat$2));
|
|
35
|
+
return customParseFormat$2.exports;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
var customParseFormatExports = requireCustomParseFormat();
|
|
39
|
+
var customParseFormat = /*@__PURE__*/getDefaultExportFromCjs(customParseFormatExports);
|
|
40
|
+
|
|
41
|
+
export { customParseFormat as c, dayjs as d, getDefaultExportFromCjs as g };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-CwtZ_Lud.js';
|
|
2
|
-
import {
|
|
2
|
+
import { g as getDefaultExportFromCjs, d as dayjs$1, c as customParseFormat } from './customParseFormat-DkyM-7xr.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
|
|
|
5
5
|
function _mergeNamespaces(n, m) {
|
|
@@ -101,10 +101,6 @@ class $319e236875307eab$var$LiveAnnouncer {
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
function getDefaultExportFromCjs (x) {
|
|
105
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
104
|
var dist = {};
|
|
109
105
|
|
|
110
106
|
var en = {};
|
|
@@ -10470,6 +10466,7 @@ const chronoParseRange = async (dateString, options) => {
|
|
|
10470
10466
|
|
|
10471
10467
|
const tabworthyDatesCss = () => `.visually-hidden.sc-tabworthy-dates{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%)}`;
|
|
10472
10468
|
|
|
10469
|
+
dayjs$1.extend(customParseFormat);
|
|
10473
10470
|
const defaultLabels = {
|
|
10474
10471
|
selected: "selected",
|
|
10475
10472
|
openCalendar: "Open calendar",
|
|
@@ -10730,7 +10727,7 @@ const TabworthyDates = class {
|
|
|
10730
10727
|
}
|
|
10731
10728
|
return {
|
|
10732
10729
|
value: parsedDate && parsedDate.value instanceof Date
|
|
10733
|
-
?
|
|
10730
|
+
? dayjs$1(parsedDate.value).format(this.format)
|
|
10734
10731
|
: undefined,
|
|
10735
10732
|
reason: parsedDate && parsedDate.reason ? parsedDate.reason : undefined
|
|
10736
10733
|
};
|
|
@@ -10745,11 +10742,11 @@ const TabworthyDates = class {
|
|
|
10745
10742
|
updateValue(newValue) {
|
|
10746
10743
|
// Range
|
|
10747
10744
|
if (Array.isArray(newValue)) {
|
|
10748
|
-
this.internalValue = newValue.map((date) =>
|
|
10745
|
+
this.internalValue = newValue.map((date) => dayjs$1(date).format(this.format));
|
|
10749
10746
|
}
|
|
10750
10747
|
// Single
|
|
10751
10748
|
else {
|
|
10752
|
-
this.internalValue =
|
|
10749
|
+
this.internalValue = dayjs$1(newValue).format(this.format);
|
|
10753
10750
|
}
|
|
10754
10751
|
if (this.pickerRef) {
|
|
10755
10752
|
this.pickerRef.value = newValue;
|
|
@@ -10778,7 +10775,7 @@ const TabworthyDates = class {
|
|
|
10778
10775
|
return; // Range date is invalid, leave the text field as is
|
|
10779
10776
|
let output = "";
|
|
10780
10777
|
this.internalValue.forEach((value, index) => {
|
|
10781
|
-
const parsedDate =
|
|
10778
|
+
const parsedDate = dayjs$1(useInputValue ? this.inputRef.value : value, this.format, true);
|
|
10782
10779
|
const dateToFormat = parsedDate.isValid()
|
|
10783
10780
|
? parsedDate.toDate()
|
|
10784
10781
|
: removeTimezoneOffset(new Date(useInputValue ? this.inputRef.value : value));
|
|
@@ -10791,7 +10788,7 @@ const TabworthyDates = class {
|
|
|
10791
10788
|
this.inputRef.value = output;
|
|
10792
10789
|
}
|
|
10793
10790
|
else {
|
|
10794
|
-
const parsedDate =
|
|
10791
|
+
const parsedDate = dayjs$1(useInputValue ? this.inputRef.value : this.internalValue, this.format, true);
|
|
10795
10792
|
const dateToFormat = parsedDate.isValid()
|
|
10796
10793
|
? parsedDate.toDate()
|
|
10797
10794
|
: removeTimezoneOffset(new Date(useInputValue ? this.inputRef.value : this.internalValue));
|
|
@@ -10810,7 +10807,7 @@ const TabworthyDates = class {
|
|
|
10810
10807
|
if (newValue.length === 2)
|
|
10811
10808
|
(_a = this.modalRef) === null || _a === void 0 ? void 0 : _a.close();
|
|
10812
10809
|
// Convert ISO dates to specified format
|
|
10813
|
-
this.internalValue = newValue.map((date) =>
|
|
10810
|
+
this.internalValue = newValue.map((date) => dayjs$1(date).format(this.format));
|
|
10814
10811
|
this.errorState = false;
|
|
10815
10812
|
if (document.activeElement !== this.inputRef) {
|
|
10816
10813
|
this.formatInput(true, false);
|
|
@@ -10821,7 +10818,7 @@ const TabworthyDates = class {
|
|
|
10821
10818
|
(_b = this.modalRef) === null || _b === void 0 ? void 0 : _b.close();
|
|
10822
10819
|
// Convert ISO date to specified format
|
|
10823
10820
|
const formattedDate = newValue
|
|
10824
|
-
?
|
|
10821
|
+
? dayjs$1(newValue).format(this.format)
|
|
10825
10822
|
: "";
|
|
10826
10823
|
this.inputRef.value = formattedDate;
|
|
10827
10824
|
this.internalValue = formattedDate;
|
|
@@ -10839,8 +10836,8 @@ const TabworthyDates = class {
|
|
|
10839
10836
|
return;
|
|
10840
10837
|
}
|
|
10841
10838
|
const newValueInIsoFormat = Array.isArray(newValue)
|
|
10842
|
-
? newValue.map((date) =>
|
|
10843
|
-
:
|
|
10839
|
+
? newValue.map((date) => dayjs$1(date, this.format).toISOString())
|
|
10840
|
+
: dayjs$1(newValue, this.format).toISOString();
|
|
10844
10841
|
let content = "";
|
|
10845
10842
|
if (Array.isArray(newValueInIsoFormat)) {
|
|
10846
10843
|
if (newValueInIsoFormat.length === 1) {
|
|
@@ -10883,7 +10880,7 @@ const TabworthyDates = class {
|
|
|
10883
10880
|
if (this.pickerRef) {
|
|
10884
10881
|
if (Array.isArray(value)) {
|
|
10885
10882
|
const dates = value.reduce((acc, v) => {
|
|
10886
|
-
const d =
|
|
10883
|
+
const d = dayjs$1(v, this.format, true);
|
|
10887
10884
|
if (d.isValid())
|
|
10888
10885
|
acc.push(d.toDate());
|
|
10889
10886
|
return acc;
|
|
@@ -10892,7 +10889,7 @@ const TabworthyDates = class {
|
|
|
10892
10889
|
}
|
|
10893
10890
|
else {
|
|
10894
10891
|
if (value) {
|
|
10895
|
-
const parsedDate =
|
|
10892
|
+
const parsedDate = dayjs$1(value, this.format, true);
|
|
10896
10893
|
if (parsedDate.isValid()) {
|
|
10897
10894
|
this.pickerRef.value = parsedDate.toDate();
|
|
10898
10895
|
}
|
|
@@ -10912,10 +10909,10 @@ const TabworthyDates = class {
|
|
|
10912
10909
|
}
|
|
10913
10910
|
render() {
|
|
10914
10911
|
var _a;
|
|
10915
|
-
return (h(Host, { key: '
|
|
10912
|
+
return (h(Host, { key: '7dc37ffe7603f9c65f674910f5e1de3fec6d13f7' }, h("label", { key: '240bdaf77226608e88efc0bf810ed0d08090927a', htmlFor: this.id ? `${this.id}-input` : undefined, class: this.getClassName("label") }, this.label), h("br", { key: 'd37a77330ffabc8b8565c5c058ee4c5ee32e755b' }), h("div", { key: 'db290a3f753694a073ab8dd779b90e06fabe3b25', class: this.getClassName("input-container"), ref: (r) => (this.inputContainerRef = r) }, h("input", { key: 'd51dcd7f6abc15bd605a5d8c5b77da97eec76ed8', disabled: this.disabledState || this.disableFreeformInput, id: this.id ? `${this.id}-input` : undefined, type: "text", placeholder: this.placeholder, class: {
|
|
10916
10913
|
[this.getClassName("input")]: true,
|
|
10917
10914
|
[this.inputClass]: !!this.inputClass
|
|
10918
|
-
}, 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: '
|
|
10915
|
+
}, 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: '41527ddd0ae71c44a645c887cd395957dc22252c', type: "button", onClick: this.handleCalendarButtonClick, class: this.getClassName("calendar-button"), disabled: this.disabledState }, this.calendarButtonContent ? (h("span", { innerHTML: this.calendarButtonContent })) : (this.datesLabels.openCalendar)))), h("tabworthy-dates-modal", { key: '9356c01fadb2450a04664dcd4c4b3a1fce278394', label: this.datesLabels.calendar, ref: (el) => (this.modalRef = el), onOpened: () => {
|
|
10919
10916
|
if (!this.pickerRef)
|
|
10920
10917
|
return;
|
|
10921
10918
|
this.pickerRef.modalIsOpen = true;
|
|
@@ -10923,11 +10920,11 @@ const TabworthyDates = class {
|
|
|
10923
10920
|
if (!this.pickerRef)
|
|
10924
10921
|
return;
|
|
10925
10922
|
this.pickerRef.modalIsOpen = false;
|
|
10926
|
-
}, inline: this.inline, appendTo: this.appendTo }, h("tabworthy-dates-calendar", { key: '
|
|
10923
|
+
}, inline: this.inline, appendTo: this.appendTo }, h("tabworthy-dates-calendar", { key: '371f6b079a3dc3d42d84e0ce0d301a4121747130', range: this.range, locale: this.locale, onSelectDate: (event) => this.handlePickerSelection(event.detail), onChangeMonth: (event) => this.handleChangedMonths(event.detail), onChangeYear: (event) => this.handleYearChange(event.detail), onRequestClose: () => { var _a; return (_a = this.modalRef) === null || _a === void 0 ? void 0 : _a.close(); }, labels: this.datesCalendarLabels ? 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, showCloseButton: this.showCloseButton, showKeyboardHint: this.showKeyboardHint, showTodayButton: this.showTodayButton, disableDate: this.disableDate, minDate: this.minDate, maxDate: this.maxDate, inline: this.inline })), this.showQuickButtons &&
|
|
10927
10924
|
((_a = this.quickButtons) === null || _a === void 0 ? void 0 : _a.length) > 0 &&
|
|
10928
|
-
this.chronoSupportedLocale && (h("div", { key: '
|
|
10925
|
+
this.chronoSupportedLocale && (h("div", { key: 'afadda0a46a2e3224c940d27ba884edc45487bf3', class: this.getClassName("quick-group"), role: "group", "aria-label": this.datesLabels.quickSelection }, this.quickButtons.map((buttonText) => {
|
|
10929
10926
|
return (h("button", { class: this.getClassName("quick-button"), onClick: this.handleQuickButtonClick, disabled: this.disabledState, type: "button" }, buttonText));
|
|
10930
|
-
}))), this.errorState && (h("div", { key: '
|
|
10927
|
+
}))), this.errorState && (h("div", { key: '7caa060a5da1846323cc161cbf9cff4b5275b90f', class: this.getClassName("input-error"), id: this.id ? `${this.id}-error` : undefined, role: "status" }, this.errorMessage))));
|
|
10931
10928
|
}
|
|
10932
10929
|
get el() { return getElement(this); }
|
|
10933
10930
|
static get watchers() { return {
|
|
@@ -1,7 +1,27 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-CwtZ_Lud.js';
|
|
2
|
-
import {
|
|
2
|
+
import { g as getDefaultExportFromCjs, d as dayjs, c as customParseFormat } from './customParseFormat-DkyM-7xr.js';
|
|
3
3
|
import { g as getISODateString, r as removeTimezoneOffset } from './utils-BVHu5CWV.js';
|
|
4
4
|
|
|
5
|
+
var localizedFormat$2 = {exports: {}};
|
|
6
|
+
|
|
7
|
+
var localizedFormat$1 = localizedFormat$2.exports;
|
|
8
|
+
|
|
9
|
+
var hasRequiredLocalizedFormat;
|
|
10
|
+
|
|
11
|
+
function requireLocalizedFormat () {
|
|
12
|
+
if (hasRequiredLocalizedFormat) return localizedFormat$2.exports;
|
|
13
|
+
hasRequiredLocalizedFormat = 1;
|
|
14
|
+
(function (module, exports) {
|
|
15
|
+
!function(e,t){module.exports=t();}(localizedFormat$1,(function(){var e={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"};return function(t,o,n){var r=o.prototype,i=r.format;n.en.formats=e,r.format=function(t){ void 0===t&&(t="YYYY-MM-DDTHH:mm:ssZ");var o=this.$locale().formats,n=function(t,o){return t.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(t,n,r){var i=r&&r.toUpperCase();return n||o[r]||e[r]||o[i].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(e,t,o){return t||o.slice(1)}))}))}(t,void 0===o?{}:o);return i.call(this,n)};}}));
|
|
16
|
+
} (localizedFormat$2));
|
|
17
|
+
return localizedFormat$2.exports;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
var localizedFormatExports = requireLocalizedFormat();
|
|
21
|
+
var localizedFormat = /*@__PURE__*/getDefaultExportFromCjs(localizedFormatExports);
|
|
22
|
+
|
|
23
|
+
dayjs.extend(customParseFormat);
|
|
24
|
+
dayjs.extend(localizedFormat);
|
|
5
25
|
const defaultLabels = {
|
|
6
26
|
selected: "selected",
|
|
7
27
|
openCalendar: "Choose time",
|
|
@@ -130,10 +150,10 @@ const InclusiveTimes = class {
|
|
|
130
150
|
this.handleInputChange = (event) => {
|
|
131
151
|
const value = event.target.value;
|
|
132
152
|
// Try to parse the input value as a datetime
|
|
133
|
-
const parsed =
|
|
153
|
+
const parsed = dayjs(value);
|
|
134
154
|
if (parsed.isValid()) {
|
|
135
|
-
this.selectedHours = parsed.
|
|
136
|
-
this.selectedMinutes = parsed.
|
|
155
|
+
this.selectedHours = parsed.hour();
|
|
156
|
+
this.selectedMinutes = parsed.minute();
|
|
137
157
|
this.updateValue(parsed.toDate());
|
|
138
158
|
}
|
|
139
159
|
};
|
|
@@ -166,12 +186,12 @@ const InclusiveTimes = class {
|
|
|
166
186
|
// Parse the first datetime value to set time picker
|
|
167
187
|
const firstValue = Array.isArray(this.value) ? this.value[0] : this.value;
|
|
168
188
|
if (firstValue) {
|
|
169
|
-
const parsed =
|
|
189
|
+
const parsed = dayjs(firstValue, this.format);
|
|
170
190
|
if (parsed.isValid()) {
|
|
171
191
|
this.selectedDate = parsed.toDate();
|
|
172
|
-
this.selectedHours = parsed.
|
|
173
|
-
this.selectedMinutes = parsed.
|
|
174
|
-
this.selectedSeconds = parsed.
|
|
192
|
+
this.selectedHours = parsed.hour();
|
|
193
|
+
this.selectedMinutes = parsed.minute();
|
|
194
|
+
this.selectedSeconds = parsed.second();
|
|
175
195
|
}
|
|
176
196
|
}
|
|
177
197
|
}
|
|
@@ -183,10 +203,10 @@ const InclusiveTimes = class {
|
|
|
183
203
|
if (Array.isArray(date)) {
|
|
184
204
|
// Range mode
|
|
185
205
|
const formattedDates = date.map((d) => {
|
|
186
|
-
const m =
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
206
|
+
const m = dayjs(d)
|
|
207
|
+
.hour(this.selectedHours)
|
|
208
|
+
.minute(this.selectedMinutes)
|
|
209
|
+
.second(this.selectedSeconds);
|
|
190
210
|
return m.format(this.format);
|
|
191
211
|
});
|
|
192
212
|
this.internalValue = formattedDates;
|
|
@@ -195,10 +215,10 @@ const InclusiveTimes = class {
|
|
|
195
215
|
}
|
|
196
216
|
else {
|
|
197
217
|
// Single date mode
|
|
198
|
-
const m =
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
218
|
+
const m = dayjs(date)
|
|
219
|
+
.hour(this.selectedHours)
|
|
220
|
+
.minute(this.selectedMinutes)
|
|
221
|
+
.second(this.selectedSeconds);
|
|
202
222
|
const formatted = m.format(this.format);
|
|
203
223
|
this.internalValue = formatted;
|
|
204
224
|
this.value = formatted;
|
|
@@ -216,13 +236,13 @@ const InclusiveTimes = class {
|
|
|
216
236
|
if (Array.isArray(this.internalValue)) {
|
|
217
237
|
// Format range
|
|
218
238
|
const formatted = this.internalValue
|
|
219
|
-
.map((v) =>
|
|
239
|
+
.map((v) => dayjs(v, this.format).format("lll"))
|
|
220
240
|
.join(` ${this.timesLabels.to} `);
|
|
221
241
|
this.inputRef.value = formatted;
|
|
222
242
|
}
|
|
223
243
|
else {
|
|
224
244
|
// Format single datetime
|
|
225
|
-
this.inputRef.value =
|
|
245
|
+
this.inputRef.value = dayjs(this.internalValue, this.format).format("lll");
|
|
226
246
|
}
|
|
227
247
|
}
|
|
228
248
|
getClassName(suffix) {
|
|
@@ -232,8 +252,8 @@ const InclusiveTimes = class {
|
|
|
232
252
|
if (!dateString)
|
|
233
253
|
return null;
|
|
234
254
|
const date = Array.isArray(dateString)
|
|
235
|
-
? dateString.map((d) =>
|
|
236
|
-
:
|
|
255
|
+
? dateString.map((d) => dayjs(d, this.format).toDate())
|
|
256
|
+
: dayjs(dateString, this.format).toDate();
|
|
237
257
|
return date;
|
|
238
258
|
}
|
|
239
259
|
async clearValue() {
|
|
@@ -250,10 +270,10 @@ const InclusiveTimes = class {
|
|
|
250
270
|
}
|
|
251
271
|
render() {
|
|
252
272
|
var _a;
|
|
253
|
-
return (h(Host, { key: '
|
|
273
|
+
return (h(Host, { key: '03aaff051aa6af4a7606b64056336c4f597ffaeb', class: this.elementClassName, "has-error": this.errorState, disabled: this.disabledState }, h("label", { key: 'd05264d3b32741ccfeca0be4473f9323b4934071', htmlFor: `${this.id}-input`, class: this.getClassName("label") }, this.label), h("div", { key: '7a4306a4863ffffe35a0d33c80ebfc19298c2182', class: this.getClassName("input-container"), ref: (r) => (this.inputContainerRef = r) }, h("input", { key: '03080dc8619d396347b831b307c8fa9070434b35', id: `${this.id}-input`, ref: (r) => (this.inputRef = r), type: "text", class: {
|
|
254
274
|
[this.getClassName("input")]: true,
|
|
255
275
|
[this.inputClass]: !!this.inputClass
|
|
256
|
-
}, 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: '
|
|
276
|
+
}, 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: 'cc384691007bc6eb4044098ab79ba38809375de7', type: "button", onClick: this.handleCalendarButtonClick, class: this.getClassName("calendar-button"), disabled: this.disabledState }, this.calendarButtonContent ? (h("span", { innerHTML: this.calendarButtonContent })) : (this.timesLabels.openCalendar)))), h("tabworthy-dates-modal", { key: '14290fe8ca21e0027c384bd56d913d2cdda55380', label: this.timesLabels.calendar, ref: (el) => (this.modalRef = el), onOpened: () => {
|
|
257
277
|
if (this.pickerRef) {
|
|
258
278
|
this.pickerRef.modalIsOpen = true;
|
|
259
279
|
}
|
|
@@ -261,7 +281,7 @@ const InclusiveTimes = class {
|
|
|
261
281
|
if (this.pickerRef) {
|
|
262
282
|
this.pickerRef.modalIsOpen = false;
|
|
263
283
|
}
|
|
264
|
-
}, inline: this.inline, appendTo: this.appendTo }, h("div", { key: '
|
|
284
|
+
}, inline: this.inline, appendTo: this.appendTo }, h("div", { key: '83c1e85f688a0ff213872e54a96702429f00869b', class: this.getClassName("picker-container") }, h("tabworthy-dates-calendar", { key: '6afcc9ddb6fcedf07127c933ad1ed192a4c88eaf', range: this.range, locale: this.locale, onSelectDate: (event) => this.handlePickerSelection(event.detail), onChangeMonth: (event) => this.handleChangedMonths(event.detail), onChangeYear: (event) => this.handleYearChange(event.detail), onRequestClose: () => { var _a; return (_a = this.modalRef) === null || _a === void 0 ? void 0 : _a.close(); }, labels: this.datesCalendarLabels, ref: (el) => (this.pickerRef = el), startDate: this.startDate, firstDayOfWeek: this.firstDayOfWeek, showHiddenTitle: true, disabled: this.disabledState, showMonthStepper: this.showMonthStepper, showYearStepper: this.showYearStepper, showClearButton: this.showClearButton, showCloseButton: this.showCloseButton, showTodayButton: this.showTodayButton, disableDate: this.disableDate, minDate: this.minDate, maxDate: this.maxDate, inline: this.inline, value: this.value ? this.toDate(this.value) : undefined }, h("div", { key: '7e47f4b63a85d6431f8019a8725acbf79fb44d67', slot: "after-calendar", class: this.getClassName("time-section") }, h("hr", { key: '8b72711de0422f1b1848bb22a72ed363b1c63ebb', class: this.getClassName("divider") }), h("tabworthy-times-picker", { key: '29f47e57c4f3f94232345bbe602d0278b5f53fa4', 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 && (h("div", { key: 'aa6f743bc35538f6271a45bb2564e89164e5a909', class: this.getClassName("input-error"), id: this.id ? `${this.id}-error` : undefined, role: "status" }, this.errorMessage))));
|
|
265
285
|
}
|
|
266
286
|
get el() { return getElement(this); }
|
|
267
287
|
static get watchers() { return {
|
|
@@ -0,0 +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 r,c as n}from"./p-DkyM-7xr.js";import{g as o,r as d}from"./p-BVHu5CWV.js";var l,c,f={exports:{}},u=a(l?f.exports:(l=1,f.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)}})));r.extend(n),r.extend(u);const b={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=b,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=r(t.target.value);s.isValid()&&(this.selectedHours=s.hour(),this.selectedMinutes=s.minute(),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.hour(),this.selectedMinutes=s.minute(),this.selectedSeconds=s.second())}}else this.internalValue=null}updateValue(t){if(Array.isArray(t)){const s=t.map((t=>r(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=r(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=>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}`}toDate(t){return t?Array.isArray(t)?t.map((t=>r(t,this.format).toDate())):r(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:"03aaff051aa6af4a7606b64056336c4f597ffaeb",class:this.elementClassName,"has-error":this.errorState,disabled:this.disabledState},i("label",{key:"d05264d3b32741ccfeca0be4473f9323b4934071",htmlFor:`${this.id}-input`,class:this.getClassName("label")},this.label),i("div",{key:"7a4306a4863ffffe35a0d33c80ebfc19298c2182",class:this.getClassName("input-container"),ref:t=>this.inputContainerRef=t},i("input",{key:"03080dc8619d396347b831b307c8fa9070434b35",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:"cc384691007bc6eb4044098ab79ba38809375de7",type:"button",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:"14290fe8ca21e0027c384bd56d913d2cdda55380",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:"83c1e85f688a0ff213872e54a96702429f00869b",class:this.getClassName("picker-container")},i("tabworthy-dates-calendar",{key:"6afcc9ddb6fcedf07127c933ad1ed192a4c88eaf",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},i("div",{key:"7e47f4b63a85d6431f8019a8725acbf79fb44d67",slot:"after-calendar",class:this.getClassName("time-section")},i("hr",{key:"8b72711de0422f1b1848bb22a72ed363b1c63ebb",class:this.getClassName("divider")}),i("tabworthy-times-picker",{key:"29f47e57c4f3f94232345bbe602d0278b5f53fa4",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:"aa6f743bc35538f6271a45bb2564e89164e5a909",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}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var r,n,e={exports:{}},i=t((r||(r=1,e.exports=function(){var t=6e4,r=36e5,n="millisecond",e="second",i="minute",u="hour",s="day",a="week",c="month",h="quarter",o="year",f="date",d="Invalid Date",M=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,v=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,D={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var r=["th","st","nd","rd"],n=t%100;return"["+t+(r[(n-20)%10]||r[n]||r[0])+"]"}},m=function(t,r,n){var e=String(t);return!e||e.length>=r?t:""+Array(r+1-e.length).join(n)+t},Y={s:m,z:function(t){var r=-t.utcOffset(),n=Math.abs(r),e=Math.floor(n/60),i=n%60;return(r<=0?"+":"-")+m(e,2,"0")+":"+m(i,2,"0")},m:function t(r,n){if(r.date()<n.date())return-t(n,r);var e=12*(n.year()-r.year())+(n.month()-r.month()),i=r.clone().add(e,c),u=n-i<0,s=r.clone().add(e+(u?-1:1),c);return+(-(e+(n-i)/(u?i-s:s-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return{M:c,y:o,w:a,d:s,D:f,h:u,m:i,s:e,ms:n,Q:h}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},w="en",l={};l[w]=D;var y="$isDayjsObject",S=function(t){return t instanceof k||!(!t||!t[y])},g=function t(r,n,e){var i;if(!r)return w;if("string"==typeof r){var u=r.toLowerCase();l[u]&&(i=u),n&&(l[u]=n,i=u);var s=r.split("-");if(!i&&s.length>1)return t(s[0])}else{var a=r.name;l[a]=r,i=a}return!e&&i&&(w=i),i||!e&&w},_=function(t,r){if(S(t))return t.clone();var n="object"==typeof r?r:{};return n.date=t,n.args=arguments,new k(n)},b=Y;b.l=g,b.i=S,b.w=function(t,r){return _(t,{locale:r.$L,utc:r.$u,x:r.$x,$offset:r.$offset})};var k=function(){function D(t){this.$L=g(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[y]=!0}var m=D.prototype;return m.parse=function(t){this.$d=function(t){var r=t.date,n=t.utc;if(null===r)return new Date(NaN);if(b.u(r))return new Date;if(r instanceof Date)return new Date(r);if("string"==typeof r&&!/Z$/i.test(r)){var e=r.match(M);if(e){var i=e[2]-1||0,u=(e[7]||"0").substring(0,3);return n?new Date(Date.UTC(e[1],i,e[3]||1,e[4]||0,e[5]||0,e[6]||0,u)):new Date(e[1],i,e[3]||1,e[4]||0,e[5]||0,e[6]||0,u)}}return new Date(r)}(t),this.init()},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},m.$utils=function(){return b},m.isValid=function(){return!(this.$d.toString()===d)},m.isSame=function(t,r){var n=_(t);return this.startOf(r)<=n&&n<=this.endOf(r)},m.isAfter=function(t,r){return _(t)<this.startOf(r)},m.isBefore=function(t,r){return this.endOf(r)<_(t)},m.$g=function(t,r,n){return b.u(t)?this[r]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,r){var n=this,h=!!b.u(r)||r,d=b.p(t),M=function(t,r){var e=b.w(n.$u?Date.UTC(n.$y,r,t):new Date(n.$y,r,t),n);return h?e:e.endOf(s)},v=function(t,r){return b.w(n.toDate()[t].apply(n.toDate("s"),(h?[0,0,0,0]:[23,59,59,999]).slice(r)),n)},D=this.$W,m=this.$M,Y=this.$D,w="set"+(this.$u?"UTC":"");switch(d){case o:return h?M(1,0):M(31,11);case c:return h?M(1,m):M(0,m+1);case a:var l=this.$locale().weekStart||0,y=(D<l?D+7:D)-l;return M(h?Y-y:Y+(6-y),m);case s:case f:return v(w+"Hours",0);case u:return v(w+"Minutes",1);case i:return v(w+"Seconds",2);case e:return v(w+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,r){var a,h=b.p(t),d="set"+(this.$u?"UTC":""),M=(a={},a[s]=d+"Date",a[f]=d+"Date",a[c]=d+"Month",a[o]=d+"FullYear",a[u]=d+"Hours",a[i]=d+"Minutes",a[e]=d+"Seconds",a[n]=d+"Milliseconds",a)[h],v=h===s?this.$D+(r-this.$W):r;if(h===c||h===o){var D=this.clone().set(f,1);D.$d[M](v),D.init(),this.$d=D.set(f,Math.min(this.$D,D.daysInMonth())).$d}else M&&this.$d[M](v);return this.init(),this},m.set=function(t,r){return this.clone().$set(t,r)},m.get=function(t){return this[b.p(t)]()},m.add=function(n,h){var f,d=this;n=Number(n);var M=b.p(h),v=function(t){var r=_(d);return b.w(r.date(r.date()+Math.round(t*n)),d)};if(M===c)return this.set(c,this.$M+n);if(M===o)return this.set(o,this.$y+n);if(M===s)return v(1);if(M===a)return v(7);var D=(f={},f[i]=t,f[u]=r,f[e]=1e3,f)[M]||1,m=this.$d.getTime()+n*D;return b.w(m,this)},m.subtract=function(t,r){return this.add(-1*t,r)},m.format=function(t){var r=this,n=this.$locale();if(!this.isValid())return n.invalidDate||d;var e=t||"YYYY-MM-DDTHH:mm:ssZ",i=b.z(this),u=this.$H,s=this.$m,a=this.$M,c=n.weekdays,h=n.months,o=function(t,n,i,u){return t&&(t[n]||t(r,e))||i[n].slice(0,u)},f=function(t){return b.s(u%12||12,t,"0")},M=n.meridiem||function(t,r,n){var e=t<12?"AM":"PM";return n?e.toLowerCase():e};return e.replace(v,(function(t,e){return e||function(t){switch(t){case"YY":return String(r.$y).slice(-2);case"YYYY":return b.s(r.$y,4,"0");case"M":return a+1;case"MM":return b.s(a+1,2,"0");case"MMM":return o(n.monthsShort,a,h,3);case"MMMM":return o(h,a);case"D":return r.$D;case"DD":return b.s(r.$D,2,"0");case"d":return String(r.$W);case"dd":return o(n.weekdaysMin,r.$W,c,2);case"ddd":return o(n.weekdaysShort,r.$W,c,3);case"dddd":return c[r.$W];case"H":return String(u);case"HH":return b.s(u,2,"0");case"h":return f(1);case"hh":return f(2);case"a":return M(u,s,!0);case"A":return M(u,s,!1);case"m":return String(s);case"mm":return b.s(s,2,"0");case"s":return String(r.$s);case"ss":return b.s(r.$s,2,"0");case"SSS":return b.s(r.$ms,3,"0");case"Z":return i}return null}(t)||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(n,f,d){var M,v=this,D=b.p(f),m=_(n),Y=(m.utcOffset()-this.utcOffset())*t,w=this-m,l=function(){return b.m(v,m)};switch(D){case o:M=l()/12;break;case c:M=l();break;case h:M=l()/3;break;case a:M=(w-Y)/6048e5;break;case s:M=(w-Y)/864e5;break;case u:M=w/r;break;case i:M=w/t;break;case e:M=w/1e3;break;default:M=w}return d?M:b.a(M)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return l[this.$L]},m.locale=function(t,r){if(!t)return this.$L;var n=this.clone(),e=g(t,r,!0);return e&&(n.$L=e),n},m.clone=function(){return b.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},D}(),H=k.prototype;return _.prototype=H,[["$ms",n],["$s",e],["$m",i],["$H",u],["$W",s],["$M",c],["$y",o],["$D",f]].forEach((function(t){H[t[1]]=function(r){return this.$g(r,t[0],t[1])}})),_.extend=function(t,r){return t.$i||(t(r,k,_),t.$i=!0),_},_.locale=g,_.isDayjs=S,_.unix=function(t){return _(1e3*t)},_.en=l[w],_.Ls=l,_.p={},_}()),e.exports)),u={exports:{}},s=t(n?u.exports:(n=1,u.exports=function(){var t={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"},r=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d/,e=/\d\d/,i=/\d\d?/,u=/\d*[^-_:/,()\s\d]+/,s={},a=function(t){return(t=+t)+(t>68?1900:2e3)},c=function(t){return function(r){this[t]=+r}},h=[/[+-]\d\d:?(\d\d)?|Z/,function(t){(this.zone||(this.zone={})).offset=function(t){if(!t)return 0;if("Z"===t)return 0;var r=t.match(/([+-]|\d\d)/g),n=60*r[1]+(+r[2]||0);return 0===n?0:"+"===r[0]?-n:n}(t)}],o=function(t){var r=s[t];return r&&(r.indexOf?r:r.s.concat(r.f))},f=function(t,r){var n,e=s.meridiem;if(e){for(var i=1;i<=24;i+=1)if(t.indexOf(e(i,0,r))>-1){n=i>12;break}}else n=t===(r?"pm":"PM");return n},d={A:[u,function(t){this.afternoon=f(t,!1)}],a:[u,function(t){this.afternoon=f(t,!0)}],Q:[n,function(t){this.month=3*(t-1)+1}],S:[n,function(t){this.milliseconds=100*+t}],SS:[e,function(t){this.milliseconds=10*+t}],SSS:[/\d{3}/,function(t){this.milliseconds=+t}],s:[i,c("seconds")],ss:[i,c("seconds")],m:[i,c("minutes")],mm:[i,c("minutes")],H:[i,c("hours")],h:[i,c("hours")],HH:[i,c("hours")],hh:[i,c("hours")],D:[i,c("day")],DD:[e,c("day")],Do:[u,function(t){var r=s.ordinal,n=t.match(/\d+/);if(this.day=n[0],r)for(var e=1;e<=31;e+=1)r(e).replace(/\[|\]/g,"")===t&&(this.day=e)}],w:[i,c("week")],ww:[e,c("week")],M:[i,c("month")],MM:[e,c("month")],MMM:[u,function(t){var r=o("months"),n=(o("monthsShort")||r.map((function(t){return t.slice(0,3)}))).indexOf(t)+1;if(n<1)throw new Error;this.month=n%12||n}],MMMM:[u,function(t){var r=o("months").indexOf(t)+1;if(r<1)throw new Error;this.month=r%12||r}],Y:[/[+-]?\d+/,c("year")],YY:[e,function(t){this.year=a(t)}],YYYY:[/\d{4}/,c("year")],Z:h,ZZ:h};function M(n){var e;e=s&&s.formats;for(var i=(n=n.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(r,n,i){var u=i&&i.toUpperCase();return n||e[i]||t[i]||e[u].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(t,r,n){return r||n.slice(1)}))}))).match(r),u=i.length,a=0;a<u;a+=1){var c=i[a],h=d[c],o=h&&h[1];i[a]=o?{regex:h&&h[0],parser:o}:c.replace(/^\[|\]$/g,"")}return function(t){for(var r={},n=0,e=0;n<u;n+=1){var s=i[n];if("string"==typeof s)e+=s.length;else{var a=s.regex,c=s.parser,h=t.slice(e),o=a.exec(h)[0];c.call(r,o),t=t.replace(o,"")}}return function(t){var r=t.afternoon;if(void 0!==r){var n=t.hours;r?n<12&&(t.hours+=12):12===n&&(t.hours=0),delete t.afternoon}}(r),r}}return function(t,r,n){n.p.customParseFormat=!0,t&&t.parseTwoDigitYear&&(a=t.parseTwoDigitYear);var e=r.prototype,i=e.parse;e.parse=function(t){var r=t.date,e=t.utc,u=t.args;this.$u=e;var a=u[1];if("string"==typeof a){var c=!0===u[2],h=!0===u[3],o=c||h,f=u[2];h&&(f=u[2]),s=this.$locale(),!c&&f&&(s=n.Ls[f]),this.$d=function(t,r,n,e){try{if(["x","X"].indexOf(r)>-1)return new Date(("X"===r?1e3:1)*t);var i=M(r)(t),u=i.year,s=i.month,a=i.day,c=i.hours,h=i.minutes,o=i.seconds,f=i.milliseconds,d=i.zone,v=i.week,D=new Date,m=a||(u||s?1:D.getDate()),Y=u||D.getFullYear(),w=0;u&&!s||(w=s>0?s-1:D.getMonth());var l,y=c||0,S=h||0,g=o||0,_=f||0;return d?new Date(Date.UTC(Y,w,m,y,S,g,_+60*d.offset*1e3)):n?new Date(Date.UTC(Y,w,m,y,S,g,_)):(l=new Date(Y,w,m,y,S,g,_),v&&(l=e(l).week(v).toDate()),l)}catch(t){return new Date("")}}(r,a,e,n),this.init(),f&&!0!==f&&(this.$L=this.locale(f).$L),o&&r!=this.format(a)&&(this.$d=new Date("")),s={}}else if(a instanceof Array)for(var d=a.length,v=1;v<=d;v+=1){u[1]=a[v-1];var D=n.apply(this,u);if(D.isValid()){this.$d=D.$d,this.$L=D.$L,this.init();break}v===d&&(this.$d=new Date(""))}else i.call(this,t)}}}()));export{s as c,i as d,t as g}
|