@tabworthy/components 0.15.1 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/dist/cjs/{customParseFormat-l09KVyWD.js → date-error-CCtoCDtq.js} +3 -0
  2. package/dist/cjs/tabworthy-dates.cjs.entry.js +28 -26
  3. package/dist/cjs/tabworthy-times.cjs.entry.js +41 -41
  4. package/dist/collection/components/tabworthy-dates/tabworthy-dates.js +12 -9
  5. package/dist/collection/components/tabworthy-times/tabworthy-times.js +9 -8
  6. package/dist/collection/utils/date-error.js +1 -0
  7. package/dist/components/{p-DkyM-7xr.js → p-DCgn1Avj.js} +1 -1
  8. package/dist/components/tabworthy-dates.js +1 -1
  9. package/dist/components/tabworthy-times.js +1 -1
  10. package/dist/esm/{customParseFormat-DkyM-7xr.js → date-error-DCgn1Avj.js} +3 -1
  11. package/dist/esm/tabworthy-dates.entry.js +12 -10
  12. package/dist/esm/tabworthy-times.entry.js +9 -9
  13. package/dist/tabworthy-components/p-82d70f28.entry.js +1 -0
  14. package/dist/tabworthy-components/{p-DkyM-7xr.js → p-DCgn1Avj.js} +1 -1
  15. package/dist/tabworthy-components/p-c57563a0.entry.js +1 -0
  16. package/dist/tabworthy-components/tabworthy-components.esm.js +1 -1
  17. package/dist/types/Users/damirbogdanov_1/work/tabworthy-components/.stencil/shared/utils/chrono-parser/chrono-parser.d.ts +3 -0
  18. package/dist/types/Users/damirbogdanov_1/work/tabworthy-components/.stencil/shared/utils/chrono-parser/chrono-parser.type.d.ts +40 -0
  19. package/dist/types/Users/damirbogdanov_1/work/tabworthy-components/.stencil/shared/utils/utils.d.ts +34 -0
  20. package/dist/types/components/tabworthy-dates/tabworthy-dates.d.ts +4 -2
  21. package/dist/types/index.d.ts +1 -0
  22. package/dist/types/utils/date-error.d.ts +2 -0
  23. package/package.json +1 -1
  24. package/dist/tabworthy-components/p-3e890a9c.entry.js +0 -1
  25. package/dist/tabworthy-components/p-af49d0fc.entry.js +0 -1
@@ -1 +1 @@
1
- import{p as t,H as s,c as i,h as e,d as h,t as a}from"./p-BiJ0HZVY.js";import{g as n,d as o,c as r}from"./p-DkyM-7xr.js";import{g as d,r as l,c}from"./p-C_Pq_S0e.js";import{d as u}from"./p-DXCumu2Y.js";import{d as m}from"./p-BvcvP308.js";var f,b={exports:{}},p=n(f?b.exports:(f=1,b.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,i,e){var h=i.prototype,a=h.format;e.en.formats=t,h.format=function(s){void 0===s&&(s="YYYY-MM-DDTHH:mm:ssZ");var i=this.$locale().formats,e=function(s,i){return s.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(s,e,h){var a=h&&h.toUpperCase();return e||i[h]||t[h]||i[a].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(t,s,i){return s||i.slice(1)}))}))}(s,void 0===i?{}:i);return a.call(this,e)}}}()));o.extend(r),o.extend(p);const y={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"},v=t(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.selectDateTime=i(this,"selectDateTime",7),this.changeYear=i(this,"changeYear",7),this.errorChange=i(this,"errorChange",7),this.componentReady=i(this,"componentReady",7),this.range=!1,this.timeOnly=!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=d(new Date),this.referenceDate=d(new Date),this.useTwelveHourFormat=!0,this.showSeconds=!1,this.timesLabels=y,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=l(new Date(s[0])),i=l(new Date(s[1]));if(!this.isDateValid(t)||!this.isDateValid(i))return;this.updateValue([t,i]),this.pickerRef&&(this.pickerRef.value=[t,i])}else{const t=l(new Date(s[0]));if(!this.isDateValid(t))return;this.clampTimeToBounds(t),this.updateValue(t),this.pickerRef&&(this.pickerRef.value=void 0,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.timeOnly&&this.updateValue(this.getDateForTimeOnlyValue())},this.handleCalendarButtonClick=async()=>{this.modalRef&&(await this.modalRef.setTriggerElement(this.inputContainerRef),await this.modalRef.open())},this.handleYearChange=t=>{this.changeYear&&this.changeYear.emit(t)},this.handleChangedMonths=()=>{},this.handleInputBlur=()=>{this.shouldInputFormat()&&this.formatInput()},this.handleInputChange=t=>{const s=t.target.value;if(0===s.length)return this.errorState=!1,this.internalValue="",this.pickerRef&&(this.pickerRef.value=null),this.value=this.internalValue,this.selectDateTime.emit(this.internalValue);let i=o(s,this.format,!0);if(i.isValid()||(i=o(s)),i.isValid()){if(this.minDate&&i.isBefore(o(this.minDate)))return this.errorState=!0,this.errorMessage=`${this.timesLabels.minDateError} ${this.formatBoundaryDate(this.minDate)}`,void this.emitErrorChange("minDate",this.errorMessage);if(this.maxDate&&i.isAfter(o(this.maxDate)))return this.errorState=!0,this.errorMessage=`${this.timesLabels.maxDateError} ${this.formatBoundaryDate(this.maxDate)}`,void this.emitErrorChange("maxDate",this.errorMessage);if(this.disableDate(i.toDate()))return this.errorState=!0,this.errorMessage=this.timesLabels.disabledDateError,void this.emitErrorChange("disabledDate",this.errorMessage);this.errorState=!1,this.selectedHours=i.hour(),this.selectedMinutes=i.minute(),this.selectedSeconds=i.second(),this.updateValue(i.toDate())}else this.errorState=!0,this.errorMessage=this.timesLabels.invalidDateError,this.emitErrorChange("invalid",this.errorMessage)}}emitErrorChange(t,s){this.errorChange.emit({reason:t,message:s})}formatBoundaryDate(t){const s=o(t);if(!s.isValid())return t;if(!t.includes("T")&&!t.includes(" "))return Intl.DateTimeFormat(this.locale,{day:"numeric",month:"short",year:"numeric"}).format(s.toDate());const i=Object.assign({day:"numeric",month:"short",year:"numeric",hour:"numeric",minute:"numeric"},this.showSeconds?{second:"numeric"}:{});return Intl.DateTimeFormat(this.locale,i).format(s.toDate())}getEffectiveMinTime(){if(!this.minDate||!this.selectedDate)return;const t=o(this.minDate),s=o(this.selectedDate);return t.isValid()&&s.isSame(t,"day")?{hours:t.hour(),minutes:t.minute(),seconds:t.second()}:void 0}getEffectiveMaxTime(){if(!this.maxDate||!this.selectedDate)return;const t=o(this.maxDate),s=o(this.selectedDate);return t.isValid()&&s.isSame(t,"day")?{hours:t.hour(),minutes:t.minute(),seconds:t.second()}:void 0}isDateOutOfBounds(){if(!this.selectedDate)return!1;const t=o(this.selectedDate);return!(!this.minDate||!t.isBefore(o(this.minDate),"day"))||!(!this.maxDate||!t.isAfter(o(this.maxDate),"day"))}clampTimeToBounds(t){const s=o(t);if(this.minDate){const t=o(this.minDate);t.isValid()&&s.isSame(t,"day")&&3600*this.selectedHours+60*this.selectedMinutes+this.selectedSeconds<3600*t.hour()+60*t.minute()+t.second()&&(this.selectedHours=t.hour(),this.selectedMinutes=t.minute(),this.selectedSeconds=t.second())}if(this.maxDate){const t=o(this.maxDate);t.isValid()&&s.isSame(t,"day")&&3600*this.selectedHours+60*this.selectedMinutes+this.selectedSeconds>3600*t.hour()+60*t.minute()+t.second()&&(this.selectedHours=t.hour(),this.selectedMinutes=t.minute(),this.selectedSeconds=t.second())}}shouldInputFormat(){return"string"==typeof this.inputShouldFormat?"true"===this.inputShouldFormat:!!this.inputShouldFormat}getDateForTimeOnlyValue(){if(this.selectedDate)return this.selectedDate;const t=o(this.referenceDate);return t.isValid()?t.toDate():new Date}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.internalValue=this.value||null,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.selectedDate=void 0;if(this.pickerRef)if(Array.isArray(this.value)){const t=this.value.reduce(((t,s)=>{const i=o(s,this.format,!0);return i.isValid()&&t.push(i.toDate()),t}),[]);this.pickerRef.value=t.length?t:null}else if(this.value){const t=o(this.value,this.format,!0);t.isValid()&&(this.pickerRef.value=t.toDate())}else this.pickerRef.value=null;this.inputRef&&(this.value?this.shouldInputFormat()?this.formatInput():this.inputRef.value=""+this.internalValue:this.inputRef.value="")}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()}isDateValid(t){const s=o(t);return!(!s.isValid()||(this.minDate&&s.isBefore(o(this.minDate),"day")?(this.errorState=!0,this.errorMessage=`${this.timesLabels.minDateError} ${this.formatBoundaryDate(this.minDate)}`,this.emitErrorChange("minDate",this.errorMessage),1):this.maxDate&&s.isAfter(o(this.maxDate),"day")?(this.errorState=!0,this.errorMessage=`${this.timesLabels.maxDateError} ${this.formatBoundaryDate(this.maxDate)}`,this.emitErrorChange("maxDate",this.errorMessage),1):this.disableDate(t)&&(this.errorState=!0,this.errorMessage=this.timesLabels.disabledDateError,this.emitErrorChange("disabledDate",this.errorMessage),1)))}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=this.timeOnly?o(this.internalValue,this.format).format(this.showSeconds?"LTS":"LT"):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 revertInput(t,s=!1){s&&(this.errorState=!1),this.value=t,this.syncFromValueProp()}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 e(h,{key:"ab639b86fb2e2afe854a1253a2caab53a82f9cc0",class:this.elementClassName,"has-error":this.errorState,disabled:this.disabledState,"time-only":this.timeOnly},e("label",{key:"55dd4b279bc847151a5f3cb50f98bddb62c2965c",htmlFor:this.id+"-input",class:this.getClassName("label")},this.label),e("div",{key:"5aa75daa3ee2d7de8f8385d5871dd732ce6c5d3c",class:this.getClassName("input-container"),ref:t=>this.inputContainerRef=t},e("input",{key:"49912db4c96619e20e818b494d553aad293920a8",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&&e("button",{key:"f22378a0ad106f560ed0d1e02e3b22b43e725289",type:"button",onClick:this.handleCalendarButtonClick,class:this.getClassName("calendar-button"),disabled:this.disabledState,"aria-label":this.calendarButtonContent?this.timesLabels.openCalendar:void 0},this.calendarButtonContent?e("span",{innerHTML:this.calendarButtonContent}):this.timesLabels.openCalendar)),e("tabworthy-dates-modal",{key:"c0f14cf67c2da5a3c4917b388949458e410009e8",label:this.timesLabels.calendar,ref:t=>this.modalRef=t,onOpened:()=>{this.pickerRef&&(this.pickerRef.modalIsOpen=!0),this.timeOnly&&this.timePickerRef&&(this.timePickerRef.modalIsOpen=!0)},onClosed:()=>{this.pickerRef&&(this.pickerRef.modalIsOpen=!1),this.timePickerRef&&(this.timePickerRef.modalIsOpen=!1)},inline:this.inline,appendTo:this.appendTo},e("div",{key:"c7051d360cfba74d9e0b3a8702683da2f79c013c",class:this.getClassName("picker-container")},!this.timeOnly&&e("tabworthy-dates-calendar",{key:"c9c72c072116568cd6ca0ce99de136940876e3b0",range:this.range,locale:this.locale,onSelectDate:t=>this.handlePickerSelection(t.detail),onChangeMonth:t=>this.handleChangedMonths(t.detail),onChangeYear:t=>this.handleYearChange(t.detail),onRequestClose:()=>{var t;return null===(t=this.modalRef)||void 0===t?void 0:t.close()},labels:this.datesCalendarLabels,ref:t=>this.pickerRef=t,startDate:this.startDate,firstDayOfWeek:this.firstDayOfWeek,showHiddenTitle:!0,disabled:this.disabledState,showMonthStepper:this.showMonthStepper,showYearStepper:this.showYearStepper,showClearButton:this.showClearButton,showCloseButton:this.showCloseButton,showTodayButton:this.showTodayButton,disableDate:this.disableDate,minDate:this.minDate,maxDate:this.maxDate,inline:this.inline,value:this.value?this.toDate(this.value):void 0,nextMonthButtonContent:this.nextMonthButtonContent,nextYearButtonContent:this.nextYearButtonContent,previousMonthButtonContent:this.previousMonthButtonContent,previousYearButtonContent:this.previousYearButtonContent,todayButtonContent:this.todayButtonContent,clearButtonContent:this.clearButtonContent,closeButtonContent:this.closeButtonContent},e("div",{key:"325945a90d36cb39ef23db27f99fd6224984b735",slot:"after-calendar",class:this.getClassName("time-section")},e("hr",{key:"ff305cef7f526fb05dd3f193ea4093f0064fc813",class:this.getClassName("divider")}),e("tabworthy-times-picker",{key:"ad163d7fa0c3282312b848a758bfcc8b08a663ad",hours:this.selectedHours,minutes:this.selectedMinutes,seconds:this.selectedSeconds,showSeconds:this.showSeconds,useTwelveHourFormat:this.useTwelveHourFormat,disabled:this.disabledState||this.isDateOutOfBounds(),onTimeChanged:this.handleTimeChange,labels:this.timesPickerLabels,minTime:this.getEffectiveMinTime(),maxTime:this.getEffectiveMaxTime(),ref:t=>this.timePickerRef=t}))),this.timeOnly&&e("div",{key:"c19252f05b91934af956c5ed9453185e591c4f71",class:this.getClassName("time-section")},e("tabworthy-times-picker",{key:"d8456d201c430625d2181a7da76f0ec5a471aec4",hours:this.selectedHours,minutes:this.selectedMinutes,seconds:this.selectedSeconds,showSeconds:this.showSeconds,useTwelveHourFormat:this.useTwelveHourFormat,disabled:this.disabledState||this.isDateOutOfBounds(),onTimeChanged:this.handleTimeChange,labels:this.timesPickerLabels,minTime:this.getEffectiveMinTime(),maxTime:this.getEffectiveMaxTime(),ref:t=>this.timePickerRef=t})))),this.errorState&&e("div",{key:"0968907cbf6971aa00a486184394fe7d342ee237",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],timeOnly:[4,"time-only"],label:[1],placeholder:[1],locale:[1],disabled:[4],minDate:[1,"min-date"],maxDate:[1,"max-date"],startDate:[1,"start-date"],referenceDate:[1,"reference-date"],useTwelveHourFormat:[4,"use-twelve-hour-format"],showSeconds:[4,"show-seconds"],timesLabels:[16],datesCalendarLabels:[16],timesPickerLabels:[16],inline:[4],hasError:[1028,"has-error"],showYearStepper:[4,"show-year-stepper"],showMonthStepper:[4,"show-month-stepper"],showClearButton:[4,"show-clear-button"],showCloseButton:[4,"show-close-button"],showTodayButton:[4,"show-today-button"],calendarButtonContent:[1,"calendar-button-content"],nextMonthButtonContent:[1,"next-month-button-content"],nextYearButtonContent:[1,"next-year-button-content"],previousMonthButtonContent:[1,"previous-month-button-content"],previousYearButtonContent:[1,"previous-year-button-content"],todayButtonContent:[1,"today-button-content"],clearButtonContent:[1,"clear-button-content"],closeButtonContent:[1,"close-button-content"],disableDate:[16],elementClassName:[1,"element-class-name"],firstDayOfWeek:[2,"first-day-of-week"],format:[1],inputShouldFormat:[8,"input-should-format"],disableFreeformInput:[4,"disable-freeform-input"],inputClass:[1,"input-class"],appendTo:[1,"append-to"],internalValue:[32],selectedDate:[32],selectedHours:[32],selectedMinutes:[32],selectedSeconds:[32],errorState:[32],disabledState:[32],revertInput:[64],clearValue:[64]},void 0,{value:[{watchValue:0}],disabled:[{watchDisabled:0}],hasError:[{watchHasError:0}]}]),w=v,D=function(){"undefined"!=typeof customElements&&["tabworthy-times","tabworthy-dates-calendar","tabworthy-dates-modal","tabworthy-times-picker"].forEach((t=>{switch(t){case"tabworthy-times":customElements.get(a(t))||customElements.define(a(t),v);break;case"tabworthy-dates-calendar":customElements.get(a(t))||c();break;case"tabworthy-dates-modal":customElements.get(a(t))||u();break;case"tabworthy-times-picker":customElements.get(a(t))||m()}}))};export{w as TabworthyTimes,D as defineCustomElement}
1
+ import{p as t,H as s,c as i,h as e,d as h,t as a}from"./p-BiJ0HZVY.js";import{g as n,d as o,c as r,f as d}from"./p-DCgn1Avj.js";import{g as l,r as c,c as u}from"./p-C_Pq_S0e.js";import{d as m}from"./p-DXCumu2Y.js";import{d as f}from"./p-BvcvP308.js";var b,p={exports:{}},y=n(b?p.exports:(b=1,p.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,i,e){var h=i.prototype,a=h.format;e.en.formats=t,h.format=function(s){void 0===s&&(s="YYYY-MM-DDTHH:mm:ssZ");var i=this.$locale().formats,e=function(s,i){return s.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(s,e,h){var a=h&&h.toUpperCase();return e||i[h]||t[h]||i[a].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(t,s,i){return s||i.slice(1)}))}))}(s,void 0===i?{}:i);return a.call(this,e)}}}()));o.extend(r),o.extend(y);const v={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"},w=t(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.selectDateTime=i(this,"selectDateTime",7),this.changeYear=i(this,"changeYear",7),this.errorChange=i(this,"errorChange",7),this.componentReady=i(this,"componentReady",7),this.range=!1,this.timeOnly=!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=v,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=c(new Date(s[0])),i=c(new Date(s[1]));if(!this.isDateValid(t)||!this.isDateValid(i))return;this.updateValue([t,i]),this.pickerRef&&(this.pickerRef.value=[t,i])}else{const t=c(new Date(s[0]));if(!this.isDateValid(t))return;this.clampTimeToBounds(t),this.updateValue(t),this.pickerRef&&(this.pickerRef.value=void 0,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.timeOnly&&this.updateValue(this.getDateForTimeOnlyValue())},this.handleCalendarButtonClick=async()=>{this.modalRef&&(await this.modalRef.setTriggerElement(this.inputContainerRef),await this.modalRef.open())},this.handleYearChange=t=>{this.changeYear&&this.changeYear.emit(t)},this.handleChangedMonths=()=>{},this.handleInputBlur=()=>{this.shouldInputFormat()&&this.formatInput()},this.handleInputChange=t=>{const s=t.target.value;if(0===s.length)return this.errorState=!1,this.internalValue="",this.pickerRef&&(this.pickerRef.value=null),this.value=this.internalValue,this.selectDateTime.emit(this.internalValue);let i=o(s,this.format,!0);if(i.isValid()||(i=o(s)),i.isValid()){if(this.minDate&&i.isBefore(o(this.minDate)))return this.errorState=!0,this.errorMessage=d(this.timesLabels.minDateError,this.formatBoundaryDate(this.minDate)),void this.emitErrorChange("minDate",this.errorMessage);if(this.maxDate&&i.isAfter(o(this.maxDate)))return this.errorState=!0,this.errorMessage=d(this.timesLabels.maxDateError,this.formatBoundaryDate(this.maxDate)),void this.emitErrorChange("maxDate",this.errorMessage);if(this.disableDate(i.toDate()))return this.errorState=!0,this.errorMessage=this.timesLabels.disabledDateError,void this.emitErrorChange("disabledDate",this.errorMessage);this.errorState=!1,this.selectedHours=i.hour(),this.selectedMinutes=i.minute(),this.selectedSeconds=i.second(),this.updateValue(i.toDate())}else this.errorState=!0,this.errorMessage=this.timesLabels.invalidDateError,this.emitErrorChange("invalid",this.errorMessage)}}emitErrorChange(t,s){this.errorChange.emit({reason:t,message:s})}formatBoundaryDate(t){const s=o(t);if(!s.isValid())return t;if(!t.includes("T")&&!t.includes(" "))return Intl.DateTimeFormat(this.locale,{day:"numeric",month:"short",year:"numeric"}).format(s.toDate());const i=Object.assign({day:"numeric",month:"short",year:"numeric",hour:"numeric",minute:"numeric"},this.showSeconds?{second:"numeric"}:{});return Intl.DateTimeFormat(this.locale,i).format(s.toDate())}getEffectiveMinTime(){if(!this.minDate||!this.selectedDate)return;const t=o(this.minDate),s=o(this.selectedDate);return t.isValid()&&s.isSame(t,"day")?{hours:t.hour(),minutes:t.minute(),seconds:t.second()}:void 0}getEffectiveMaxTime(){if(!this.maxDate||!this.selectedDate)return;const t=o(this.maxDate),s=o(this.selectedDate);return t.isValid()&&s.isSame(t,"day")?{hours:t.hour(),minutes:t.minute(),seconds:t.second()}:void 0}isDateOutOfBounds(){if(!this.selectedDate)return!1;const t=o(this.selectedDate);return!(!this.minDate||!t.isBefore(o(this.minDate),"day"))||!(!this.maxDate||!t.isAfter(o(this.maxDate),"day"))}clampTimeToBounds(t){const s=o(t);if(this.minDate){const t=o(this.minDate);t.isValid()&&s.isSame(t,"day")&&3600*this.selectedHours+60*this.selectedMinutes+this.selectedSeconds<3600*t.hour()+60*t.minute()+t.second()&&(this.selectedHours=t.hour(),this.selectedMinutes=t.minute(),this.selectedSeconds=t.second())}if(this.maxDate){const t=o(this.maxDate);t.isValid()&&s.isSame(t,"day")&&3600*this.selectedHours+60*this.selectedMinutes+this.selectedSeconds>3600*t.hour()+60*t.minute()+t.second()&&(this.selectedHours=t.hour(),this.selectedMinutes=t.minute(),this.selectedSeconds=t.second())}}shouldInputFormat(){return"string"==typeof this.inputShouldFormat?"true"===this.inputShouldFormat:!!this.inputShouldFormat}getDateForTimeOnlyValue(){if(this.selectedDate)return this.selectedDate;const t=o(this.referenceDate);return t.isValid()?t.toDate():new Date}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.internalValue=this.value||null,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.selectedDate=void 0;if(this.pickerRef)if(Array.isArray(this.value)){const t=this.value.reduce(((t,s)=>{const i=o(s,this.format,!0);return i.isValid()&&t.push(i.toDate()),t}),[]);this.pickerRef.value=t.length?t:null}else if(this.value){const t=o(this.value,this.format,!0);t.isValid()&&(this.pickerRef.value=t.toDate())}else this.pickerRef.value=null;this.inputRef&&(this.value?this.shouldInputFormat()?this.formatInput():this.inputRef.value=""+this.internalValue:this.inputRef.value="")}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()}isDateValid(t){const s=o(t);return!(!s.isValid()||(this.minDate&&s.isBefore(o(this.minDate),"day")?(this.errorState=!0,this.errorMessage=d(this.timesLabels.minDateError,this.formatBoundaryDate(this.minDate)),this.emitErrorChange("minDate",this.errorMessage),1):this.maxDate&&s.isAfter(o(this.maxDate),"day")?(this.errorState=!0,this.errorMessage=d(this.timesLabels.maxDateError,this.formatBoundaryDate(this.maxDate)),this.emitErrorChange("maxDate",this.errorMessage),1):this.disableDate(t)&&(this.errorState=!0,this.errorMessage=this.timesLabels.disabledDateError,this.emitErrorChange("disabledDate",this.errorMessage),1)))}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=this.timeOnly?o(this.internalValue,this.format).format(this.showSeconds?"LTS":"LT"):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 revertInput(t,s=!1){s&&(this.errorState=!1),this.value=t,this.syncFromValueProp()}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 e(h,{key:"40aebf1f077c4766cbbb9bd3929f5d8d959b60a4",class:this.elementClassName,"has-error":this.errorState,disabled:this.disabledState,"time-only":this.timeOnly},e("label",{key:"cbf04161329d320ebc9ae5b3a0fede08e3157afb",htmlFor:this.id+"-input",class:this.getClassName("label")},this.label),e("div",{key:"2e7e46172b8d46b2f88047d93f9e4d35e5c841f3",class:this.getClassName("input-container"),ref:t=>this.inputContainerRef=t},e("input",{key:"0fcf906d8bad7fe78e003bf881a6d22dcb42f4e8",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&&e("button",{key:"7d63c31494474844633f64faf0aba4851574dce6",type:"button",onClick:this.handleCalendarButtonClick,class:this.getClassName("calendar-button"),disabled:this.disabledState,"aria-label":this.calendarButtonContent?this.timesLabels.openCalendar:void 0},this.calendarButtonContent?e("span",{innerHTML:this.calendarButtonContent}):this.timesLabels.openCalendar)),e("tabworthy-dates-modal",{key:"802a7f839dd33d19885918819ae4a3fa9f6cb838",label:this.timesLabels.calendar,ref:t=>this.modalRef=t,onOpened:()=>{this.pickerRef&&(this.pickerRef.modalIsOpen=!0),this.timeOnly&&this.timePickerRef&&(this.timePickerRef.modalIsOpen=!0)},onClosed:()=>{this.pickerRef&&(this.pickerRef.modalIsOpen=!1),this.timePickerRef&&(this.timePickerRef.modalIsOpen=!1)},inline:this.inline,appendTo:this.appendTo},e("div",{key:"2ff172c30561b5962400dc2fa052162e01013c7a",class:this.getClassName("picker-container")},!this.timeOnly&&e("tabworthy-dates-calendar",{key:"6456181b374cae4d91c01b9b7873c91bb08a8778",range:this.range,locale:this.locale,onSelectDate:t=>this.handlePickerSelection(t.detail),onChangeMonth:t=>this.handleChangedMonths(t.detail),onChangeYear:t=>this.handleYearChange(t.detail),onRequestClose:()=>{var t;return null===(t=this.modalRef)||void 0===t?void 0:t.close()},labels:this.datesCalendarLabels,ref:t=>this.pickerRef=t,startDate:this.startDate,firstDayOfWeek:this.firstDayOfWeek,showHiddenTitle:!0,disabled:this.disabledState,showMonthStepper:this.showMonthStepper,showYearStepper:this.showYearStepper,showClearButton:this.showClearButton,showCloseButton:this.showCloseButton,showTodayButton:this.showTodayButton,disableDate:this.disableDate,minDate:this.minDate,maxDate:this.maxDate,inline:this.inline,value:this.value?this.toDate(this.value):void 0,nextMonthButtonContent:this.nextMonthButtonContent,nextYearButtonContent:this.nextYearButtonContent,previousMonthButtonContent:this.previousMonthButtonContent,previousYearButtonContent:this.previousYearButtonContent,todayButtonContent:this.todayButtonContent,clearButtonContent:this.clearButtonContent,closeButtonContent:this.closeButtonContent},e("div",{key:"4a89d517cfcf22cffccecddca841102cb913a8fb",slot:"after-calendar",class:this.getClassName("time-section")},e("hr",{key:"72d37f7058959877afa16b8336f834cc0e5aceba",class:this.getClassName("divider")}),e("tabworthy-times-picker",{key:"bdba34da5c2a2a0af681e40516b0d48e8833e276",hours:this.selectedHours,minutes:this.selectedMinutes,seconds:this.selectedSeconds,showSeconds:this.showSeconds,useTwelveHourFormat:this.useTwelveHourFormat,disabled:this.disabledState||this.isDateOutOfBounds(),onTimeChanged:this.handleTimeChange,labels:this.timesPickerLabels,minTime:this.getEffectiveMinTime(),maxTime:this.getEffectiveMaxTime(),ref:t=>this.timePickerRef=t}))),this.timeOnly&&e("div",{key:"50a2866b8e7a408f72d37ee540ecba546103d4f4",class:this.getClassName("time-section")},e("tabworthy-times-picker",{key:"de317aaa6579be60679cba468e5b28be8654aa5d",hours:this.selectedHours,minutes:this.selectedMinutes,seconds:this.selectedSeconds,showSeconds:this.showSeconds,useTwelveHourFormat:this.useTwelveHourFormat,disabled:this.disabledState||this.isDateOutOfBounds(),onTimeChanged:this.handleTimeChange,labels:this.timesPickerLabels,minTime:this.getEffectiveMinTime(),maxTime:this.getEffectiveMaxTime(),ref:t=>this.timePickerRef=t})))),this.errorState&&e("div",{key:"7617cfa25799dbbb8056abcba161284745022f44",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],timeOnly:[4,"time-only"],label:[1],placeholder:[1],locale:[1],disabled:[4],minDate:[1,"min-date"],maxDate:[1,"max-date"],startDate:[1,"start-date"],referenceDate:[1,"reference-date"],useTwelveHourFormat:[4,"use-twelve-hour-format"],showSeconds:[4,"show-seconds"],timesLabels:[16],datesCalendarLabels:[16],timesPickerLabels:[16],inline:[4],hasError:[1028,"has-error"],showYearStepper:[4,"show-year-stepper"],showMonthStepper:[4,"show-month-stepper"],showClearButton:[4,"show-clear-button"],showCloseButton:[4,"show-close-button"],showTodayButton:[4,"show-today-button"],calendarButtonContent:[1,"calendar-button-content"],nextMonthButtonContent:[1,"next-month-button-content"],nextYearButtonContent:[1,"next-year-button-content"],previousMonthButtonContent:[1,"previous-month-button-content"],previousYearButtonContent:[1,"previous-year-button-content"],todayButtonContent:[1,"today-button-content"],clearButtonContent:[1,"clear-button-content"],closeButtonContent:[1,"close-button-content"],disableDate:[16],elementClassName:[1,"element-class-name"],firstDayOfWeek:[2,"first-day-of-week"],format:[1],inputShouldFormat:[8,"input-should-format"],disableFreeformInput:[4,"disable-freeform-input"],inputClass:[1,"input-class"],appendTo:[1,"append-to"],internalValue:[32],selectedDate:[32],selectedHours:[32],selectedMinutes:[32],selectedSeconds:[32],errorState:[32],disabledState:[32],revertInput:[64],clearValue:[64]},void 0,{value:[{watchValue:0}],disabled:[{watchDisabled:0}],hasError:[{watchHasError:0}]}]),D=w,C=function(){"undefined"!=typeof customElements&&["tabworthy-times","tabworthy-dates-calendar","tabworthy-dates-modal","tabworthy-times-picker"].forEach((t=>{switch(t){case"tabworthy-times":customElements.get(a(t))||customElements.define(a(t),w);break;case"tabworthy-dates-calendar":customElements.get(a(t))||u();break;case"tabworthy-dates-modal":customElements.get(a(t))||m();break;case"tabworthy-times-picker":customElements.get(a(t))||f()}}))};export{D as TabworthyTimes,C as defineCustomElement}
@@ -38,4 +38,6 @@ function requireCustomParseFormat () {
38
38
  var customParseFormatExports = requireCustomParseFormat();
39
39
  var customParseFormat = /*@__PURE__*/getDefaultExportFromCjs(customParseFormatExports);
40
40
 
41
- export { customParseFormat as c, dayjs as d, getDefaultExportFromCjs as g };
41
+ const formatDateError = (label, date) => typeof label === "function" ? label(date) : `${label} ${date}`;
42
+
43
+ export { customParseFormat as c, dayjs as d, formatDateError as f, 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 { g as getDefaultExportFromCjs, d as dayjs$1, c as customParseFormat } from './customParseFormat-DkyM-7xr.js';
2
+ import { g as getDefaultExportFromCjs, d as dayjs$1, c as customParseFormat, f as formatDateError } from './date-error-DCgn1Avj.js';
3
3
  import { r as removeTimezoneOffset, y as extractDates, z as isValidISODate, e as dateIsWithinBounds, o as dateIsWithinLowerBounds, q as dateIsWithinUpperBounds, g as getISODateString, p as parseDateString } from './utils-CoFOnMSw.js';
4
4
 
5
5
  function _mergeNamespaces(n, m) {
@@ -10705,18 +10705,13 @@ const TabworthyDates = class {
10705
10705
  minDate === null || minDate === void 0 ? void 0 : minDate.setDate(minDate.getDate() - 1);
10706
10706
  }
10707
10707
  if (!!parsedDate.reason) {
10708
- const formatLocalizedDate = (date) => Intl.DateTimeFormat(this.locale, {
10709
- day: "numeric",
10710
- month: "short",
10711
- year: "numeric"
10712
- }).format(date);
10713
10708
  this.errorMessage = parsedDate.reason;
10714
10709
  this.errorMessage = {
10715
10710
  minDate: minDate
10716
- ? `${this.datesLabels.minDateError} ${formatLocalizedDate(minDate)}`
10711
+ ? formatDateError(this.datesLabels.minDateError, this.formatBoundaryDate(minDate))
10717
10712
  : "",
10718
10713
  maxDate: maxDate
10719
- ? `${this.datesLabels.maxDateError} ${formatLocalizedDate(maxDate)}`
10714
+ ? formatDateError(this.datesLabels.maxDateError, this.formatBoundaryDate(maxDate))
10720
10715
  : "",
10721
10716
  invalid: this.datesLabels.invalidDateError
10722
10717
  }[parsedDate.reason];
@@ -10799,6 +10794,13 @@ const TabworthyDates = class {
10799
10794
  emitErrorChange(reason, message) {
10800
10795
  this.errorChange.emit({ reason, message });
10801
10796
  }
10797
+ formatBoundaryDate(date) {
10798
+ return Intl.DateTimeFormat(this.locale, {
10799
+ day: "numeric",
10800
+ month: "short",
10801
+ year: "numeric"
10802
+ }).format(date);
10803
+ }
10802
10804
  formatInput(enabled, useInputValue = true) {
10803
10805
  if (this.shouldInputFormat() === false || enabled === false) {
10804
10806
  if (this.internalValue) {
@@ -10851,13 +10853,13 @@ const TabworthyDates = class {
10851
10853
  const isoDate = typeof dateString === "string" ? dateString : parsed.format("YYYY-MM-DD");
10852
10854
  if (this.minDate && isoDate < this.minDate) {
10853
10855
  this.errorState = true;
10854
- this.errorMessage = `${this.datesLabels.minDateError} ${this.minDate}`;
10856
+ this.errorMessage = formatDateError(this.datesLabels.minDateError, this.formatBoundaryDate(parseDateString(this.minDate)));
10855
10857
  this.emitErrorChange("minDate", this.errorMessage);
10856
10858
  return false;
10857
10859
  }
10858
10860
  if (this.maxDate && isoDate > this.maxDate) {
10859
10861
  this.errorState = true;
10860
- this.errorMessage = `${this.datesLabels.maxDateError} ${this.maxDate}`;
10862
+ this.errorMessage = formatDateError(this.datesLabels.maxDateError, this.formatBoundaryDate(parseDateString(this.maxDate)));
10861
10863
  this.emitErrorChange("maxDate", this.errorMessage);
10862
10864
  return false;
10863
10865
  }
@@ -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 { g as getDefaultExportFromCjs, d as dayjs, c as customParseFormat } from './customParseFormat-DkyM-7xr.js';
2
+ import { g as getDefaultExportFromCjs, d as dayjs, c as customParseFormat, f as formatDateError } from './date-error-DCgn1Avj.js';
3
3
  import { g as getISODateString, r as removeTimezoneOffset } from './utils-CoFOnMSw.js';
4
4
 
5
5
  var localizedFormat$2 = {exports: {}};
@@ -183,13 +183,13 @@ const TabworthyTimes = class {
183
183
  // Check minDate/maxDate bounds (supports both date-only and datetime strings)
184
184
  if (this.minDate && parsed.isBefore(dayjs(this.minDate))) {
185
185
  this.errorState = true;
186
- this.errorMessage = `${this.timesLabels.minDateError} ${this.formatBoundaryDate(this.minDate)}`;
186
+ this.errorMessage = formatDateError(this.timesLabels.minDateError, this.formatBoundaryDate(this.minDate));
187
187
  this.emitErrorChange("minDate", this.errorMessage);
188
188
  return;
189
189
  }
190
190
  if (this.maxDate && parsed.isAfter(dayjs(this.maxDate))) {
191
191
  this.errorState = true;
192
- this.errorMessage = `${this.timesLabels.maxDateError} ${this.formatBoundaryDate(this.maxDate)}`;
192
+ this.errorMessage = formatDateError(this.timesLabels.maxDateError, this.formatBoundaryDate(this.maxDate));
193
193
  this.emitErrorChange("maxDate", this.errorMessage);
194
194
  return;
195
195
  }
@@ -422,13 +422,13 @@ const TabworthyTimes = class {
422
422
  return false;
423
423
  if (this.minDate && parsed.isBefore(dayjs(this.minDate), "day")) {
424
424
  this.errorState = true;
425
- this.errorMessage = `${this.timesLabels.minDateError} ${this.formatBoundaryDate(this.minDate)}`;
425
+ this.errorMessage = formatDateError(this.timesLabels.minDateError, this.formatBoundaryDate(this.minDate));
426
426
  this.emitErrorChange("minDate", this.errorMessage);
427
427
  return false;
428
428
  }
429
429
  if (this.maxDate && parsed.isAfter(dayjs(this.maxDate), "day")) {
430
430
  this.errorState = true;
431
- this.errorMessage = `${this.timesLabels.maxDateError} ${this.formatBoundaryDate(this.maxDate)}`;
431
+ this.errorMessage = formatDateError(this.timesLabels.maxDateError, this.formatBoundaryDate(this.maxDate));
432
432
  this.emitErrorChange("maxDate", this.errorMessage);
433
433
  return false;
434
434
  }
@@ -489,12 +489,12 @@ const TabworthyTimes = class {
489
489
  }
490
490
  render() {
491
491
  var _a;
492
- return (h(Host, { key: 'ab639b86fb2e2afe854a1253a2caab53a82f9cc0', class: this.elementClassName, "has-error": this.errorState, disabled: this.disabledState, "time-only": this.timeOnly }, h("label", { key: '55dd4b279bc847151a5f3cb50f98bddb62c2965c', htmlFor: `${this.id}-input`, class: this.getClassName("label") }, this.label), h("div", { key: '5aa75daa3ee2d7de8f8385d5871dd732ce6c5d3c', class: this.getClassName("input-container"), ref: (r) => (this.inputContainerRef = r) }, h("input", { key: '49912db4c96619e20e818b494d553aad293920a8', id: `${this.id}-input`, ref: (r) => (this.inputRef = r), type: "text", class: {
492
+ return (h(Host, { key: '40aebf1f077c4766cbbb9bd3929f5d8d959b60a4', class: this.elementClassName, "has-error": this.errorState, disabled: this.disabledState, "time-only": this.timeOnly }, h("label", { key: 'cbf04161329d320ebc9ae5b3a0fede08e3157afb', htmlFor: `${this.id}-input`, class: this.getClassName("label") }, this.label), h("div", { key: '2e7e46172b8d46b2f88047d93f9e4d35e5c841f3', class: this.getClassName("input-container"), ref: (r) => (this.inputContainerRef = r) }, h("input", { key: '0fcf906d8bad7fe78e003bf881a6d22dcb42f4e8', id: `${this.id}-input`, ref: (r) => (this.inputRef = r), type: "text", class: {
493
493
  [this.getClassName("input")]: true,
494
494
  [this.inputClass]: !!this.inputClass
495
- }, 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: 'f22378a0ad106f560ed0d1e02e3b22b43e725289', type: "button", onClick: this.handleCalendarButtonClick, class: this.getClassName("calendar-button"), disabled: this.disabledState, "aria-label": this.calendarButtonContent
495
+ }, 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: '7d63c31494474844633f64faf0aba4851574dce6', type: "button", onClick: this.handleCalendarButtonClick, class: this.getClassName("calendar-button"), disabled: this.disabledState, "aria-label": this.calendarButtonContent
496
496
  ? this.timesLabels.openCalendar
497
- : undefined }, this.calendarButtonContent ? (h("span", { innerHTML: this.calendarButtonContent })) : (this.timesLabels.openCalendar)))), h("tabworthy-dates-modal", { key: 'c0f14cf67c2da5a3c4917b388949458e410009e8', label: this.timesLabels.calendar, ref: (el) => (this.modalRef = el), onOpened: () => {
497
+ : undefined }, this.calendarButtonContent ? (h("span", { innerHTML: this.calendarButtonContent })) : (this.timesLabels.openCalendar)))), h("tabworthy-dates-modal", { key: '802a7f839dd33d19885918819ae4a3fa9f6cb838', label: this.timesLabels.calendar, ref: (el) => (this.modalRef = el), onOpened: () => {
498
498
  if (this.pickerRef) {
499
499
  this.pickerRef.modalIsOpen = true;
500
500
  }
@@ -508,7 +508,7 @@ const TabworthyTimes = class {
508
508
  if (this.timePickerRef) {
509
509
  this.timePickerRef.modalIsOpen = false;
510
510
  }
511
- }, inline: this.inline, appendTo: this.appendTo }, h("div", { key: 'c7051d360cfba74d9e0b3a8702683da2f79c013c', class: this.getClassName("picker-container") }, !this.timeOnly && (h("tabworthy-dates-calendar", { key: 'c9c72c072116568cd6ca0ce99de136940876e3b0', 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, nextMonthButtonContent: this.nextMonthButtonContent, nextYearButtonContent: this.nextYearButtonContent, previousMonthButtonContent: this.previousMonthButtonContent, previousYearButtonContent: this.previousYearButtonContent, todayButtonContent: this.todayButtonContent, clearButtonContent: this.clearButtonContent, closeButtonContent: this.closeButtonContent }, h("div", { key: '325945a90d36cb39ef23db27f99fd6224984b735', slot: "after-calendar", class: this.getClassName("time-section") }, h("hr", { key: 'ff305cef7f526fb05dd3f193ea4093f0064fc813', class: this.getClassName("divider") }), h("tabworthy-times-picker", { key: 'ad163d7fa0c3282312b848a758bfcc8b08a663ad', hours: this.selectedHours, minutes: this.selectedMinutes, seconds: this.selectedSeconds, showSeconds: this.showSeconds, useTwelveHourFormat: this.useTwelveHourFormat, disabled: this.disabledState || this.isDateOutOfBounds(), onTimeChanged: this.handleTimeChange, labels: this.timesPickerLabels, minTime: this.getEffectiveMinTime(), maxTime: this.getEffectiveMaxTime(), ref: (el) => (this.timePickerRef = el) })))), this.timeOnly && (h("div", { key: 'c19252f05b91934af956c5ed9453185e591c4f71', class: this.getClassName("time-section") }, h("tabworthy-times-picker", { key: 'd8456d201c430625d2181a7da76f0ec5a471aec4', hours: this.selectedHours, minutes: this.selectedMinutes, seconds: this.selectedSeconds, showSeconds: this.showSeconds, useTwelveHourFormat: this.useTwelveHourFormat, disabled: this.disabledState || this.isDateOutOfBounds(), onTimeChanged: this.handleTimeChange, labels: this.timesPickerLabels, minTime: this.getEffectiveMinTime(), maxTime: this.getEffectiveMaxTime(), ref: (el) => (this.timePickerRef = el) }))))), this.errorState && (h("div", { key: '0968907cbf6971aa00a486184394fe7d342ee237', class: this.getClassName("input-error"), id: this.id ? `${this.id}-error` : undefined, role: "status" }, this.errorMessage))));
511
+ }, inline: this.inline, appendTo: this.appendTo }, h("div", { key: '2ff172c30561b5962400dc2fa052162e01013c7a', class: this.getClassName("picker-container") }, !this.timeOnly && (h("tabworthy-dates-calendar", { key: '6456181b374cae4d91c01b9b7873c91bb08a8778', 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, nextMonthButtonContent: this.nextMonthButtonContent, nextYearButtonContent: this.nextYearButtonContent, previousMonthButtonContent: this.previousMonthButtonContent, previousYearButtonContent: this.previousYearButtonContent, todayButtonContent: this.todayButtonContent, clearButtonContent: this.clearButtonContent, closeButtonContent: this.closeButtonContent }, h("div", { key: '4a89d517cfcf22cffccecddca841102cb913a8fb', slot: "after-calendar", class: this.getClassName("time-section") }, h("hr", { key: '72d37f7058959877afa16b8336f834cc0e5aceba', class: this.getClassName("divider") }), h("tabworthy-times-picker", { key: 'bdba34da5c2a2a0af681e40516b0d48e8833e276', hours: this.selectedHours, minutes: this.selectedMinutes, seconds: this.selectedSeconds, showSeconds: this.showSeconds, useTwelveHourFormat: this.useTwelveHourFormat, disabled: this.disabledState || this.isDateOutOfBounds(), onTimeChanged: this.handleTimeChange, labels: this.timesPickerLabels, minTime: this.getEffectiveMinTime(), maxTime: this.getEffectiveMaxTime(), ref: (el) => (this.timePickerRef = el) })))), this.timeOnly && (h("div", { key: '50a2866b8e7a408f72d37ee540ecba546103d4f4', class: this.getClassName("time-section") }, h("tabworthy-times-picker", { key: 'de317aaa6579be60679cba468e5b28be8654aa5d', hours: this.selectedHours, minutes: this.selectedMinutes, seconds: this.selectedSeconds, showSeconds: this.showSeconds, useTwelveHourFormat: this.useTwelveHourFormat, disabled: this.disabledState || this.isDateOutOfBounds(), onTimeChanged: this.handleTimeChange, labels: this.timesPickerLabels, minTime: this.getEffectiveMinTime(), maxTime: this.getEffectiveMaxTime(), ref: (el) => (this.timePickerRef = el) }))))), this.errorState && (h("div", { key: '7617cfa25799dbbb8056abcba161284745022f44', class: this.getClassName("input-error"), id: this.id ? `${this.id}-error` : undefined, role: "status" }, this.errorMessage))));
512
512
  }
513
513
  get el() { return getElement(this); }
514
514
  static get watchers() { return {