@tabworthy/components 0.8.0 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/tabworthy-components.cjs.js +1 -1
- package/dist/cjs/tabworthy-dates.cjs.entry.js +8 -4
- package/dist/cjs/tabworthy-times-picker.cjs.entry.js +14 -14
- package/dist/cjs/tabworthy-times.cjs.entry.js +7 -3
- package/dist/collection/components/tabworthy-dates/tabworthy-dates.js +29 -5
- package/dist/collection/components/tabworthy-times/tabworthy-times.js +29 -5
- package/dist/collection/components/tabworthy-times-picker/tabworthy-times-picker.js +16 -16
- package/dist/components/p-Bnmroodq.js +1 -0
- package/dist/components/tabworthy-dates.js +1 -1
- package/dist/components/tabworthy-times-picker.js +1 -1
- package/dist/components/tabworthy-times.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/tabworthy-components.js +1 -1
- package/dist/esm/tabworthy-dates.entry.js +8 -4
- package/dist/esm/tabworthy-times-picker.entry.js +14 -14
- package/dist/esm/tabworthy-times.entry.js +7 -3
- package/dist/tabworthy-components/p-141bd515.entry.js +1 -0
- package/dist/tabworthy-components/{p-eeaeddda.entry.js → p-6986ab96.entry.js} +1 -1
- package/dist/tabworthy-components/p-8416e0a9.entry.js +1 -0
- package/dist/tabworthy-components/tabworthy-components.esm.js +1 -1
- package/dist/themes/light.css +1 -1
- package/dist/types/components/tabworthy-dates/tabworthy-dates.d.ts +2 -1
- package/dist/types/components/tabworthy-times/tabworthy-times.d.ts +2 -1
- package/dist/types/components/tabworthy-times-picker/tabworthy-times-picker.d.ts +1 -1
- package/dist/types/components.d.ts +25 -7
- package/package.json +3 -3
- package/dist/components/p-EEyUR8TJ.js +0 -1
- package/dist/tabworthy-components/p-2f81bbfa.entry.js +0 -1
- package/dist/tabworthy-components/p-7265cf4a.entry.js +0 -1
- package/dist/themes/dark.css +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{I as o,d as
|
|
1
|
+
import{I as o,d as r}from"./p-Bnmroodq.js";const s=o,m=r;export{s as TabworthyTimesPicker,m as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as t,H as s,c as e,h as i,d as a,t as h}from"./p-Kr35QPhi.js";import{h as r}from"./p-Mki5YqAR.js";import{g as o,r as
|
|
1
|
+
import{p as t,H as s,c as e,h as i,d as a,t as h}from"./p-Kr35QPhi.js";import{h as r}from"./p-Mki5YqAR.js";import{g as o,r as d,c as n}from"./p-DT8TK_a8.js";import{d as l}from"./p-CGobNAdR.js";import{d as c}from"./p-Bnmroodq.js";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"},u=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.timesLabels=b,this.inline=!1,this.hasError=!1,this.showYearStepper=!1,this.showMonthStepper=!0,this.showClearButton=!0,this.showTodayButton=!0,this.disableDate=()=>!1,this.elementClassName="tabworthy-times",this.firstDayOfWeek=1,this.format="YYYY-MM-DDTHH:mm:ss",this.inputShouldFormat=!0,this.disableFreeformInput=!1,this.inputClass="",this.selectedHours=12,this.selectedMinutes=0,this.errorState=this.hasError,this.disabledState=this.disabled,this.errorMessage="",this.handlePickerSelection=async t=>{const s=t.split(",");if(this.range&&2===s.length){const t=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,this.selectedDate&&this.updateValue(this.selectedDate)},this.handleCalendarButtonClick=async()=>{this.modalRef&&(await this.modalRef.setTriggerElement(this.calendarButtonRef),await this.modalRef.open())},this.handleYearChange=t=>{this.changeYear&&this.changeYear.emit(t)},this.handleChangedMonths=()=>{},this.handleInputBlur=()=>{this.shouldInputFormat()&&this.formatInput()},this.handleInputChange=t=>{const s=r(t.target.value);s.isValid()&&(this.selectedHours=s.hours(),this.selectedMinutes=s.minutes(),this.updateValue(s.toDate()))}}shouldInputFormat(){return"string"==typeof this.inputShouldFormat?"true"===this.inputShouldFormat:!!this.inputShouldFormat}watchValue(t){this.syncFromValueProp()}watchDisabled(t){this.disabledState=t}watchHasError(t){this.errorState=t}componentDidLoad(){this.syncFromValueProp(),this.componentReady.emit(),this.id||console.error('tabworthy-times: The "id" prop is required for accessibility')}syncFromValueProp(){if(this.value){this.internalValue=this.value;const t=Array.isArray(this.value)?this.value[0]:this.value;if(t){const s=r(t,this.format);s.isValid()&&(this.selectedDate=s.toDate(),this.selectedHours=s.hours(),this.selectedMinutes=s.minutes())}}else this.internalValue=null}updateValue(t){if(Array.isArray(t)){const s=t.map((t=>{const s=r(t);return s.hours(this.selectedHours),s.minutes(this.selectedMinutes),s.seconds(0),s.format(this.format)}));this.internalValue=s,this.value=s,this.selectDateTime.emit(s)}else{const s=r(t);s.hours(this.selectedHours),s.minutes(this.selectedMinutes),s.seconds(0);const e=s.format(this.format);this.internalValue=e,this.value=e,this.selectedDate=t,this.selectDateTime.emit(e)}this.errorState=!1,this.shouldInputFormat()&&this.formatInput()}formatInput(){if(this.internalValue)if(Array.isArray(this.internalValue)){const t=this.internalValue.map((t=>r(t,this.format).format("lll"))).join(` ${this.timesLabels.to} `);this.inputRef.value=t}else this.inputRef.value=r(this.internalValue,this.format).format("lll")}getClassName(t){return`${this.elementClassName}__${t}`}async clearValue(){this.internalValue=null,this.value=void 0,this.selectedDate=void 0,this.inputRef.value="",this.pickerRef&&(this.pickerRef.value=null),this.selectDateTime.emit(void 0)}render(){var t;return i(a,{key:"a2bfc28b058319e0e1c723483c0f98aae766a371",class:this.elementClassName,"has-error":this.errorState,disabled:this.disabledState},i("label",{key:"072b5974746736864e482853198409c969dff6d7",htmlFor:this.id+"-input",class:this.getClassName("label")},this.label),i("div",{key:"bcc38045d990ce22960cdbfbbf43a218b05cdb12",class:this.getClassName("input-container")},i("input",{key:"e741093da1a37022ad73bd27fc2aecfaa39b5a6c",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:"9c088d60d8ed20d6e385bd2467766091a0ffab60",type:"button",ref:t=>this.calendarButtonRef=t,onClick:this.handleCalendarButtonClick,class:this.getClassName("calendar-button"),disabled:this.disabledState},this.calendarButtonContent?i("span",{innerHTML:this.calendarButtonContent}):this.timesLabels.openCalendar)),i("tabworthy-dates-modal",{key:"a2df562a114f9131b8a43d7f226d09b07cd21c63",label:this.timesLabels.calendar,ref:t=>this.modalRef=t,onOpened:()=>{this.pickerRef&&(this.pickerRef.modalIsOpen=!0)},onClosed:()=>{this.pickerRef&&(this.pickerRef.modalIsOpen=!1)},inline:this.inline},i("div",{key:"c02d2c09cbb10a99d65cdd37723dcb0b30c31800",class:this.getClassName("picker-container")},i("tabworthy-dates-calendar",{key:"ab24fcb28e457937f10d7914f0c65219fbd1aa7e",range:this.range,locale:this.locale,onSelectDate:t=>this.handlePickerSelection(t.detail),onChangeMonth:t=>this.handleChangedMonths(t.detail),onChangeYear:t=>this.handleYearChange(t.detail),labels:this.datesCalendarLabels,ref:t=>this.pickerRef=t,startDate:this.startDate,firstDayOfWeek:this.firstDayOfWeek,showHiddenTitle:!0,disabled:this.disabledState,showMonthStepper:this.showMonthStepper,showYearStepper:this.showYearStepper,showClearButton:this.showClearButton,showTodayButton:this.showTodayButton,disableDate:this.disableDate,minDate:this.minDate,maxDate:this.maxDate,inline:this.inline},i("div",{key:"1c2d6e1f290ef75840fd5ea33dd7debbe10d6cf4",slot:"after-calendar",class:this.getClassName("time-section")},i("hr",{key:"34ed116961c27d81a4daf44c5c9325fad4b491fe",class:this.getClassName("divider")}),i("tabworthy-times-picker",{key:"5862db463ee502572c6d04bc039ddf8a51455511",hours:this.selectedHours,minutes:this.selectedMinutes,useTwelveHourFormat:this.useTwelveHourFormat,disabled:this.disabledState,onTimeChanged:this.handleTimeChange}))))),this.errorState&&i("div",{key:"2dccd8a4b09eed861c3e9c9ee9a02163ef2b0149",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"],timesLabels:[16],datesCalendarLabels:[16],inline:[4],hasError:[1028,"has-error"],showYearStepper:[4,"show-year-stepper"],showMonthStepper:[4,"show-month-stepper"],showClearButton:[4,"show-clear-button"],showTodayButton:[4,"show-today-button"],calendarButtonContent:[1,"calendar-button-content"],disableDate:[16],elementClassName:[1,"element-class-name"],firstDayOfWeek:[2,"first-day-of-week"],format:[1],inputShouldFormat:[8,"input-should-format"],disableFreeformInput:[4,"disable-freeform-input"],inputClass:[1,"input-class"],internalValue:[32],selectedDate:[32],selectedHours:[32],selectedMinutes:[32],errorState:[32],disabledState:[32],clearValue:[64]},void 0,{value:[{watchValue:0}],disabled:[{watchDisabled:0}],hasError:[{watchHasError:0}]}]),m=u,f=function(){"undefined"!=typeof customElements&&["tabworthy-times","tabworthy-dates-calendar","tabworthy-dates-modal","tabworthy-times-picker"].forEach((t=>{switch(t){case"tabworthy-times":customElements.get(h(t))||customElements.define(h(t),u);break;case"tabworthy-dates-calendar":customElements.get(h(t))||n();break;case"tabworthy-dates-modal":customElements.get(h(t))||l();break;case"tabworthy-times-picker":customElements.get(h(t))||c()}}))};export{m as TabworthyTimes,f as defineCustomElement}
|
package/dist/esm/loader.js
CHANGED
|
@@ -5,7 +5,7 @@ import { g as globalScripts } from './app-globals-DQuL1Twl.js';
|
|
|
5
5
|
const defineCustomElements = async (win, options) => {
|
|
6
6
|
if (typeof window === 'undefined') return undefined;
|
|
7
7
|
await globalScripts();
|
|
8
|
-
return bootstrapLazy([["tabworthy-times-picker",[[2,"tabworthy-times-picker",{"hours":[1026],"minutes":[1026],"
|
|
8
|
+
return bootstrapLazy([["tabworthy-times-picker",[[2,"tabworthy-times-picker",{"hours":[1026],"minutes":[1026],"useTwelveHourFormat":[4,"use-twelve-hour-format"],"labels":[16],"labelsSrOnly":[4,"labels-sr-only"],"disabled":[4],"elementClassName":[1,"element-class-name"],"internalHours":[32],"internalMinutes":[32],"period":[32]},null,{"hours":[{"watchHours":0}],"minutes":[{"watchMinutes":0}]}]]],["tabworthy-dates-calendar_2",[[262,"tabworthy-dates-calendar",{"clearButtonContent":[1,"clear-button-content"],"disabled":[4],"modalIsOpen":[4,"modal-is-open"],"disableDate":[16],"elementClassName":[1,"element-class-name"],"firstDayOfWeek":[2,"first-day-of-week"],"range":[4],"labels":[16],"locale":[1],"nextMonthButtonContent":[1,"next-month-button-content"],"nextYearButtonContent":[1,"next-year-button-content"],"previousMonthButtonContent":[1,"previous-month-button-content"],"previousYearButtonContent":[1,"previous-year-button-content"],"minDate":[1,"min-date"],"maxDate":[1,"max-date"],"inline":[4],"showClearButton":[4,"show-clear-button"],"showMonthStepper":[4,"show-month-stepper"],"showTodayButton":[4,"show-today-button"],"showYearStepper":[4,"show-year-stepper"],"showKeyboardHint":[4,"show-keyboard-hint"],"showHiddenTitle":[4,"show-hidden-title"],"startDate":[1,"start-date"],"todayButtonContent":[1,"today-button-content"],"value":[1040],"currentDate":[32],"hoveredDate":[32],"weekdays":[32]},null,{"modalIsOpen":[{"watchModalIsOpen":0}],"firstDayOfWeek":[{"watchFirstDayOfWeek":0}],"locale":[{"watchLocale":0}],"range":[{"watchRange":0}],"startDate":[{"watchStartDate":0}],"value":[{"watchValue":0}]}],[257,"tabworthy-dates-modal",{"label":[1],"inline":[4],"closing":[32],"showing":[32],"open":[64],"close":[64],"getState":[64],"setTriggerElement":[64]},[[10,"click","handleClick"]]]]],["tabworthy-times",[[2,"tabworthy-times",{"id":[513],"value":[1025],"range":[4],"label":[1],"placeholder":[1],"locale":[1],"disabled":[4],"minDate":[1,"min-date"],"maxDate":[1,"max-date"],"startDate":[1,"start-date"],"referenceDate":[1,"reference-date"],"useTwelveHourFormat":[4,"use-twelve-hour-format"],"timesLabels":[16],"datesCalendarLabels":[16],"inline":[4],"hasError":[1028,"has-error"],"showYearStepper":[4,"show-year-stepper"],"showMonthStepper":[4,"show-month-stepper"],"showClearButton":[4,"show-clear-button"],"showTodayButton":[4,"show-today-button"],"calendarButtonContent":[1,"calendar-button-content"],"disableDate":[16],"elementClassName":[1,"element-class-name"],"firstDayOfWeek":[2,"first-day-of-week"],"format":[1],"inputShouldFormat":[8,"input-should-format"],"disableFreeformInput":[4,"disable-freeform-input"],"inputClass":[1,"input-class"],"internalValue":[32],"selectedDate":[32],"selectedHours":[32],"selectedMinutes":[32],"errorState":[32],"disabledState":[32],"clearValue":[64]},null,{"value":[{"watchValue":0}],"disabled":[{"watchDisabled":0}],"hasError":[{"watchHasError":0}]}]]],["tabworthy-dates",[[2,"tabworthy-dates",{"id":[513],"value":[1025],"range":[4],"label":[1],"placeholder":[1],"locale":[1],"disabled":[4],"minDate":[1,"min-date"],"maxDate":[1,"max-date"],"startDate":[1,"start-date"],"referenceDate":[1,"reference-date"],"useStrictDateParsing":[4,"use-strict-date-parsing"],"datesLabels":[16],"datesCalendarLabels":[16],"inline":[4],"hasError":[1028,"has-error"],"nextMonthButtonContent":[1,"next-month-button-content"],"nextYearButtonContent":[1,"next-year-button-content"],"showYearStepper":[4,"show-year-stepper"],"showMonthStepper":[4,"show-month-stepper"],"showClearButton":[4,"show-clear-button"],"showTodayButton":[4,"show-today-button"],"inputShouldFormat":[8,"input-should-format"],"showKeyboardHint":[4,"show-keyboard-hint"],"disableDate":[16],"elementClassName":[1,"element-class-name"],"firstDayOfWeek":[2,"first-day-of-week"],"format":[1],"quickButtons":[16],"todayButtonContent":[1,"today-button-content"],"calendarButtonContent":[1,"calendar-button-content"],"showQuickButtons":[4,"show-quick-buttons"],"disableFreeformInput":[4,"disable-freeform-input"],"inputClass":[1,"input-class"],"internalValue":[32],"errorState":[32],"disabledState":[32],"parseDate":[64]},null,{"disabled":[{"watchDisabled":0}],"value":[{"watchValue":0}]}]]]], options);
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export { defineCustomElements };
|
|
@@ -17,5 +17,5 @@ var patchBrowser = () => {
|
|
|
17
17
|
|
|
18
18
|
patchBrowser().then(async (options) => {
|
|
19
19
|
await globalScripts();
|
|
20
|
-
return bootstrapLazy([["tabworthy-times-picker",[[2,"tabworthy-times-picker",{"hours":[1026],"minutes":[1026],"
|
|
20
|
+
return bootstrapLazy([["tabworthy-times-picker",[[2,"tabworthy-times-picker",{"hours":[1026],"minutes":[1026],"useTwelveHourFormat":[4,"use-twelve-hour-format"],"labels":[16],"labelsSrOnly":[4,"labels-sr-only"],"disabled":[4],"elementClassName":[1,"element-class-name"],"internalHours":[32],"internalMinutes":[32],"period":[32]},null,{"hours":[{"watchHours":0}],"minutes":[{"watchMinutes":0}]}]]],["tabworthy-dates-calendar_2",[[262,"tabworthy-dates-calendar",{"clearButtonContent":[1,"clear-button-content"],"disabled":[4],"modalIsOpen":[4,"modal-is-open"],"disableDate":[16],"elementClassName":[1,"element-class-name"],"firstDayOfWeek":[2,"first-day-of-week"],"range":[4],"labels":[16],"locale":[1],"nextMonthButtonContent":[1,"next-month-button-content"],"nextYearButtonContent":[1,"next-year-button-content"],"previousMonthButtonContent":[1,"previous-month-button-content"],"previousYearButtonContent":[1,"previous-year-button-content"],"minDate":[1,"min-date"],"maxDate":[1,"max-date"],"inline":[4],"showClearButton":[4,"show-clear-button"],"showMonthStepper":[4,"show-month-stepper"],"showTodayButton":[4,"show-today-button"],"showYearStepper":[4,"show-year-stepper"],"showKeyboardHint":[4,"show-keyboard-hint"],"showHiddenTitle":[4,"show-hidden-title"],"startDate":[1,"start-date"],"todayButtonContent":[1,"today-button-content"],"value":[1040],"currentDate":[32],"hoveredDate":[32],"weekdays":[32]},null,{"modalIsOpen":[{"watchModalIsOpen":0}],"firstDayOfWeek":[{"watchFirstDayOfWeek":0}],"locale":[{"watchLocale":0}],"range":[{"watchRange":0}],"startDate":[{"watchStartDate":0}],"value":[{"watchValue":0}]}],[257,"tabworthy-dates-modal",{"label":[1],"inline":[4],"closing":[32],"showing":[32],"open":[64],"close":[64],"getState":[64],"setTriggerElement":[64]},[[10,"click","handleClick"]]]]],["tabworthy-times",[[2,"tabworthy-times",{"id":[513],"value":[1025],"range":[4],"label":[1],"placeholder":[1],"locale":[1],"disabled":[4],"minDate":[1,"min-date"],"maxDate":[1,"max-date"],"startDate":[1,"start-date"],"referenceDate":[1,"reference-date"],"useTwelveHourFormat":[4,"use-twelve-hour-format"],"timesLabels":[16],"datesCalendarLabels":[16],"inline":[4],"hasError":[1028,"has-error"],"showYearStepper":[4,"show-year-stepper"],"showMonthStepper":[4,"show-month-stepper"],"showClearButton":[4,"show-clear-button"],"showTodayButton":[4,"show-today-button"],"calendarButtonContent":[1,"calendar-button-content"],"disableDate":[16],"elementClassName":[1,"element-class-name"],"firstDayOfWeek":[2,"first-day-of-week"],"format":[1],"inputShouldFormat":[8,"input-should-format"],"disableFreeformInput":[4,"disable-freeform-input"],"inputClass":[1,"input-class"],"internalValue":[32],"selectedDate":[32],"selectedHours":[32],"selectedMinutes":[32],"errorState":[32],"disabledState":[32],"clearValue":[64]},null,{"value":[{"watchValue":0}],"disabled":[{"watchDisabled":0}],"hasError":[{"watchHasError":0}]}]]],["tabworthy-dates",[[2,"tabworthy-dates",{"id":[513],"value":[1025],"range":[4],"label":[1],"placeholder":[1],"locale":[1],"disabled":[4],"minDate":[1,"min-date"],"maxDate":[1,"max-date"],"startDate":[1,"start-date"],"referenceDate":[1,"reference-date"],"useStrictDateParsing":[4,"use-strict-date-parsing"],"datesLabels":[16],"datesCalendarLabels":[16],"inline":[4],"hasError":[1028,"has-error"],"nextMonthButtonContent":[1,"next-month-button-content"],"nextYearButtonContent":[1,"next-year-button-content"],"showYearStepper":[4,"show-year-stepper"],"showMonthStepper":[4,"show-month-stepper"],"showClearButton":[4,"show-clear-button"],"showTodayButton":[4,"show-today-button"],"inputShouldFormat":[8,"input-should-format"],"showKeyboardHint":[4,"show-keyboard-hint"],"disableDate":[16],"elementClassName":[1,"element-class-name"],"firstDayOfWeek":[2,"first-day-of-week"],"format":[1],"quickButtons":[16],"todayButtonContent":[1,"today-button-content"],"calendarButtonContent":[1,"calendar-button-content"],"showQuickButtons":[4,"show-quick-buttons"],"disableFreeformInput":[4,"disable-freeform-input"],"inputClass":[1,"input-class"],"internalValue":[32],"errorState":[32],"disabledState":[32],"parseDate":[64]},null,{"disabled":[{"watchDisabled":0}],"value":[{"watchValue":0}]}]]]], options);
|
|
21
21
|
});
|
|
@@ -10541,6 +10541,7 @@ const TabworthyDates = class {
|
|
|
10541
10541
|
// Show or hide the quick buttons
|
|
10542
10542
|
this.showQuickButtons = true;
|
|
10543
10543
|
this.disableFreeformInput = false;
|
|
10544
|
+
this.inputClass = "";
|
|
10544
10545
|
this.errorState = this.hasError;
|
|
10545
10546
|
this.disabledState = this.disabled;
|
|
10546
10547
|
this.chronoSupportedLocale = ["en", "ja", "fr", "nl", "ru", "pt"].includes(this.locale.slice(0, 2));
|
|
@@ -10893,7 +10894,10 @@ const TabworthyDates = class {
|
|
|
10893
10894
|
}
|
|
10894
10895
|
render() {
|
|
10895
10896
|
var _a;
|
|
10896
|
-
return (h(Host, { key: '
|
|
10897
|
+
return (h(Host, { key: 'd424c911d4fd2d05222249b401e9b704430e6f29' }, h("label", { key: 'd14130a7b0b02e7124f7c7e9ec0642620da7aab6', htmlFor: this.id ? `${this.id}-input` : undefined, class: this.getClassName("label") }, this.label), h("br", { key: 'c4f5397785326f323772f46a8cfb6d868f5ff230' }), h("div", { key: '9f52005781b9a54426ee3c094727b8890681a4d5', class: this.getClassName("input-container") }, h("input", { key: 'e67af61ef75a592acadcfbd14da4527b84b08417', disabled: this.disabledState || this.disableFreeformInput, id: this.id ? `${this.id}-input` : undefined, type: "text", placeholder: this.placeholder, class: {
|
|
10898
|
+
[this.getClassName("input")]: true,
|
|
10899
|
+
[this.inputClass]: !!this.inputClass
|
|
10900
|
+
}, 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: 'dd9421438de95497d2e7037cfc927bb0f27cd3c0', type: "button", ref: (r) => (this.calendarButtonRef = r), onClick: this.handleCalendarButtonClick, class: this.getClassName("calendar-button"), disabled: this.disabledState }, this.calendarButtonContent ? (h("span", { innerHTML: this.calendarButtonContent })) : (this.datesLabels.openCalendar)))), h("tabworthy-dates-modal", { key: 'b8a3278a07bc1ddc36eac5a0c9808595c4bcdde5', label: this.datesLabels.calendar, ref: (el) => (this.modalRef = el), onOpened: () => {
|
|
10897
10901
|
if (!this.pickerRef)
|
|
10898
10902
|
return;
|
|
10899
10903
|
this.pickerRef.modalIsOpen = true;
|
|
@@ -10901,11 +10905,11 @@ const TabworthyDates = class {
|
|
|
10901
10905
|
if (!this.pickerRef)
|
|
10902
10906
|
return;
|
|
10903
10907
|
this.pickerRef.modalIsOpen = false;
|
|
10904
|
-
}, inline: this.inline }, h("tabworthy-dates-calendar", { key: '
|
|
10908
|
+
}, inline: this.inline }, h("tabworthy-dates-calendar", { key: '29dc57f6a1951091476de39c8861b43d83242007', range: this.range, locale: this.locale, onSelectDate: (event) => this.handlePickerSelection(event.detail), onChangeMonth: (event) => this.handleChangedMonths(event.detail), onChangeYear: (event) => this.handleYearChange(event.detail), labels: this.datesCalendarLabels ? this.datesCalendarLabels : undefined, ref: (el) => (this.pickerRef = el), startDate: this.startDate, firstDayOfWeek: this.firstDayOfWeek, showHiddenTitle: true, disabled: this.disabledState, showMonthStepper: this.showMonthStepper, showYearStepper: this.showYearStepper, showClearButton: this.showClearButton, showKeyboardHint: this.showKeyboardHint, showTodayButton: this.showTodayButton, disableDate: this.disableDate, minDate: this.minDate, maxDate: this.maxDate, inline: this.inline })), this.showQuickButtons &&
|
|
10905
10909
|
((_a = this.quickButtons) === null || _a === void 0 ? void 0 : _a.length) > 0 &&
|
|
10906
|
-
this.chronoSupportedLocale && (h("div", { key: '
|
|
10910
|
+
this.chronoSupportedLocale && (h("div", { key: '1bb09b44a219648203d803c76d17a9b41b0278bf', class: this.getClassName("quick-group"), role: "group", "aria-label": "Quick selection" }, this.quickButtons.map((buttonText) => {
|
|
10907
10911
|
return (h("button", { class: this.getClassName("quick-button"), onClick: this.handleQuickButtonClick, disabled: this.disabledState, type: "button" }, buttonText));
|
|
10908
|
-
}))), this.errorState && (h("div", { key: '
|
|
10912
|
+
}))), this.errorState && (h("div", { key: '92d843bf6d0234568bf41a0fd2fdf281cb48487f', class: this.getClassName("input-error"), id: this.id ? `${this.id}-error` : undefined, role: "status" }, this.errorMessage))));
|
|
10909
10913
|
}
|
|
10910
10914
|
get el() { return getElement(this); }
|
|
10911
10915
|
static get watchers() { return {
|
|
@@ -18,7 +18,7 @@ const InclusiveTimesPicker = class {
|
|
|
18
18
|
// Current time value (24-hour format)
|
|
19
19
|
this.hours = 12;
|
|
20
20
|
this.minutes = 0;
|
|
21
|
-
this.
|
|
21
|
+
this.useTwelveHourFormat = false;
|
|
22
22
|
// Labels for accessibility and i18n
|
|
23
23
|
this.labels = defaultLabels;
|
|
24
24
|
// Hide labels visually but keep them for screen readers
|
|
@@ -30,7 +30,7 @@ const InclusiveTimesPicker = class {
|
|
|
30
30
|
this.period = this.hours >= 12 ? "PM" : "AM";
|
|
31
31
|
this.handleHourChange = (e) => {
|
|
32
32
|
const value = parseInt(e.target.value, 10);
|
|
33
|
-
if (this.
|
|
33
|
+
if (this.useTwelveHourFormat) {
|
|
34
34
|
// Convert to 24-hour format based on period
|
|
35
35
|
if (this.period === "AM") {
|
|
36
36
|
this.internalHours = value === 12 ? 0 : value;
|
|
@@ -49,7 +49,7 @@ const InclusiveTimesPicker = class {
|
|
|
49
49
|
this.emitTimeChange();
|
|
50
50
|
};
|
|
51
51
|
this.handlePeriodChange = (period) => {
|
|
52
|
-
if (this.period === period || !this.
|
|
52
|
+
if (this.period === period || !this.useTwelveHourFormat)
|
|
53
53
|
return;
|
|
54
54
|
this.period = period;
|
|
55
55
|
// Convert hours based on new period
|
|
@@ -63,7 +63,7 @@ const InclusiveTimesPicker = class {
|
|
|
63
63
|
this.emitTimeChange();
|
|
64
64
|
};
|
|
65
65
|
this.handleHourIncrement = () => {
|
|
66
|
-
if (this.
|
|
66
|
+
if (this.useTwelveHourFormat) {
|
|
67
67
|
const displayHours = this.getDisplayHours();
|
|
68
68
|
const newDisplayHours = displayHours === 12 ? 1 : displayHours + 1;
|
|
69
69
|
if (this.period === "AM") {
|
|
@@ -79,7 +79,7 @@ const InclusiveTimesPicker = class {
|
|
|
79
79
|
this.emitTimeChange();
|
|
80
80
|
};
|
|
81
81
|
this.handleHourDecrement = () => {
|
|
82
|
-
if (this.
|
|
82
|
+
if (this.useTwelveHourFormat) {
|
|
83
83
|
const displayHours = this.getDisplayHours();
|
|
84
84
|
const newDisplayHours = displayHours === 1 ? 12 : displayHours - 1;
|
|
85
85
|
if (this.period === "AM") {
|
|
@@ -118,7 +118,7 @@ const InclusiveTimesPicker = class {
|
|
|
118
118
|
this.period = this.hours >= 12 ? "PM" : "AM";
|
|
119
119
|
}
|
|
120
120
|
getDisplayHours() {
|
|
121
|
-
if (!this.
|
|
121
|
+
if (!this.useTwelveHourFormat) {
|
|
122
122
|
return this.internalHours;
|
|
123
123
|
}
|
|
124
124
|
if (this.internalHours === 0)
|
|
@@ -128,7 +128,7 @@ const InclusiveTimesPicker = class {
|
|
|
128
128
|
return this.internalHours;
|
|
129
129
|
}
|
|
130
130
|
get24HourValue() {
|
|
131
|
-
if (!this.
|
|
131
|
+
if (!this.useTwelveHourFormat) {
|
|
132
132
|
return this.internalHours;
|
|
133
133
|
}
|
|
134
134
|
const displayHours = this.getDisplayHours();
|
|
@@ -143,7 +143,7 @@ const InclusiveTimesPicker = class {
|
|
|
143
143
|
this.timeChanged.emit({
|
|
144
144
|
hours: this.get24HourValue(),
|
|
145
145
|
minutes: this.internalMinutes,
|
|
146
|
-
period: this.
|
|
146
|
+
period: this.useTwelveHourFormat ? this.period : undefined
|
|
147
147
|
});
|
|
148
148
|
}
|
|
149
149
|
padZero(num) {
|
|
@@ -151,18 +151,18 @@ const InclusiveTimesPicker = class {
|
|
|
151
151
|
}
|
|
152
152
|
render() {
|
|
153
153
|
const displayHours = this.getDisplayHours();
|
|
154
|
-
const maxHours = this.
|
|
155
|
-
const minHours = this.
|
|
156
|
-
return (h(Host, { key: '
|
|
154
|
+
const maxHours = this.useTwelveHourFormat ? 12 : 23;
|
|
155
|
+
const minHours = this.useTwelveHourFormat ? 1 : 0;
|
|
156
|
+
return (h(Host, { key: '6ccec0415bd1c35275e125355f69e871a2b3dc18', class: this.elementClassName, "aria-label": this.labels.timePicker }, h("div", { key: '52849e2d4e8ad6183d3017277f11fbd5bc3643c5', class: `${this.elementClassName}__container` }, h("div", { key: '9aa3980e371db20ae4ed4f590a0e9f49aa3d40cd', class: `${this.elementClassName}__field` }, h("label", { key: '77ea146e2d05b4bedec83a8d03096a6c51b6fd36', htmlFor: `${this.elementClassName}-hours`, class: {
|
|
157
157
|
[`${this.elementClassName}__label`]: true,
|
|
158
158
|
[`${this.elementClassName}__label--sr-only`]: this.labelsSrOnly
|
|
159
|
-
} }, this.labels.hours), h("div", { key: '
|
|
159
|
+
} }, this.labels.hours), h("div", { key: 'cf88cc85dce2a2e11e5e0ca61ab23d5bcc71b7be', class: `${this.elementClassName}__control` }, h("button", { key: 'e2e68d9e5ed00a2a72f4a019a59d7fa683a8d56c', type: "button", class: `${this.elementClassName}__button ${this.elementClassName}__button--increment`, onClick: this.handleHourIncrement, disabled: this.disabled, "aria-label": this.labels.incrementHours }, h("svg", { key: '269a5595fd1baf1ace113beb3147542353927c75', fill: "none", height: "16", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", stroke: "currentColor", viewBox: "0 0 24 24", width: "16" }, h("polyline", { key: '1d2c3fca6e81b9fdaab6f9b9f2c19f55b1af0ef5', points: "18 15 12 9 6 15" }))), h("input", { key: '53a57e4c6e1a40dcb89ecd11cd1cba0f6205c470', id: `${this.elementClassName}-hours`, type: "number", class: `${this.elementClassName}__input`, value: this.padZero(displayHours), min: minHours, max: maxHours, onInput: this.handleHourChange, disabled: this.disabled, "aria-label": this.labels.hours }), h("button", { key: 'ab36448a4f79a29592124dee72fa8e96f121f646', type: "button", class: `${this.elementClassName}__button ${this.elementClassName}__button--decrement`, onClick: this.handleHourDecrement, disabled: this.disabled, "aria-label": this.labels.decrementHours }, h("svg", { key: '705e207ffc41a38bff7d8739e02605e536e75a92', fill: "none", height: "16", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", stroke: "currentColor", viewBox: "0 0 24 24", width: "16" }, h("polyline", { key: 'c8c08acec53576456b330c4f40a7879556704d0f', points: "6 9 12 15 18 9" }))))), h("div", { key: '3b8c0125c18518463de020682de4620d918a3463', class: `${this.elementClassName}__separator` }, ":"), h("div", { key: 'c54430db728d8f48320f4e4983a1d67a1ec8c78e', class: `${this.elementClassName}__field` }, h("label", { key: 'b47c7ae65c0b34b70673a8bd60c3b1496acf9540', htmlFor: `${this.elementClassName}-minutes`, class: {
|
|
160
160
|
[`${this.elementClassName}__label`]: true,
|
|
161
161
|
[`${this.elementClassName}__label--sr-only`]: this.labelsSrOnly
|
|
162
|
-
} }, this.labels.minutes), h("div", { key: '
|
|
162
|
+
} }, this.labels.minutes), h("div", { key: '9a4434d935f34bfd910e2ab7656fc125c05de9ca', class: `${this.elementClassName}__control` }, h("button", { key: 'fcc7800df89c4739c257a5733affdabc8aca1e25', type: "button", class: `${this.elementClassName}__button ${this.elementClassName}__button--increment`, onClick: this.handleMinuteIncrement, disabled: this.disabled, "aria-label": this.labels.incrementMinutes }, h("svg", { key: '80b692e16555612a179fec5734c79966d0c5967a', fill: "none", height: "16", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", stroke: "currentColor", viewBox: "0 0 24 24", width: "16" }, h("polyline", { key: '086fbe45c600657c2f6bf37e8415b87e8d763c3e', points: "18 15 12 9 6 15" }))), h("input", { key: 'dc610011944c2ad1bf3aa68937265bdf835ba009', id: `${this.elementClassName}-minutes`, type: "number", class: `${this.elementClassName}__input`, value: this.padZero(this.internalMinutes), min: 0, max: 59, onInput: this.handleMinuteChange, disabled: this.disabled, "aria-label": this.labels.minutes }), h("button", { key: 'd2cabe46d53e0cbd2b58140f6a55217dd69a3c5e', type: "button", class: `${this.elementClassName}__button ${this.elementClassName}__button--decrement`, onClick: this.handleMinuteDecrement, disabled: this.disabled, "aria-label": this.labels.decrementMinutes }, h("svg", { key: '2e5e67efccb2a66a0c4a1377d3941d12b4bd7947', fill: "none", height: "16", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", stroke: "currentColor", viewBox: "0 0 24 24", width: "16" }, h("polyline", { key: '3da5561fb1f5bf1b07eb48de6e020047c1956158', points: "6 9 12 15 18 9" }))))), this.useTwelveHourFormat && (h("div", { key: '24c87e5e371f8a10816afcebb3dc2f7843fa89f5', class: `${this.elementClassName}__period` }, h("button", { key: '014126a0d5470d56ae384e12b2e196c3a9132700', type: "button", class: {
|
|
163
163
|
[`${this.elementClassName}__period-button`]: true,
|
|
164
164
|
[`${this.elementClassName}__period-button--active`]: this.period === "AM"
|
|
165
|
-
}, onClick: () => this.handlePeriodChange("AM"), disabled: this.disabled, "aria-label": this.labels.am, "aria-pressed": this.period === "AM" }, this.labels.am), h("button", { key: '
|
|
165
|
+
}, onClick: () => this.handlePeriodChange("AM"), disabled: this.disabled, "aria-label": this.labels.am, "aria-pressed": this.period === "AM" }, this.labels.am), h("button", { key: 'cf9f1f261456d7b5f64bf4b7d9ddbbb2e86d4447', type: "button", class: {
|
|
166
166
|
[`${this.elementClassName}__period-button`]: true,
|
|
167
167
|
[`${this.elementClassName}__period-button--active`]: this.period === "PM"
|
|
168
168
|
}, onClick: () => this.handlePeriodChange("PM"), disabled: this.disabled, "aria-label": this.labels.pm, "aria-pressed": this.period === "PM" }, this.labels.pm))))));
|
|
@@ -36,7 +36,7 @@ const InclusiveTimes = class {
|
|
|
36
36
|
// Reference date used for Chrono date parsing. Equals "today"
|
|
37
37
|
this.referenceDate = getISODateString(new Date());
|
|
38
38
|
// Use 12-hour format with AM/PM
|
|
39
|
-
this.
|
|
39
|
+
this.useTwelveHourFormat = true;
|
|
40
40
|
// Labels used for internal translations
|
|
41
41
|
this.timesLabels = defaultLabels;
|
|
42
42
|
// Prevent hiding the calendar
|
|
@@ -62,6 +62,7 @@ const InclusiveTimes = class {
|
|
|
62
62
|
// If true, format input on blur/accept (like dates)
|
|
63
63
|
this.inputShouldFormat = true;
|
|
64
64
|
this.disableFreeformInput = false;
|
|
65
|
+
this.inputClass = "";
|
|
65
66
|
this.selectedHours = 12;
|
|
66
67
|
this.selectedMinutes = 0;
|
|
67
68
|
this.errorState = this.hasError;
|
|
@@ -226,7 +227,10 @@ const InclusiveTimes = class {
|
|
|
226
227
|
}
|
|
227
228
|
render() {
|
|
228
229
|
var _a;
|
|
229
|
-
return (h(Host, { key: '
|
|
230
|
+
return (h(Host, { key: 'a2bfc28b058319e0e1c723483c0f98aae766a371', class: this.elementClassName, "has-error": this.errorState, disabled: this.disabledState }, h("label", { key: '072b5974746736864e482853198409c969dff6d7', htmlFor: `${this.id}-input`, class: this.getClassName("label") }, this.label), h("div", { key: 'bcc38045d990ce22960cdbfbbf43a218b05cdb12', class: this.getClassName("input-container") }, h("input", { key: 'e741093da1a37022ad73bd27fc2aecfaa39b5a6c', id: `${this.id}-input`, ref: (r) => (this.inputRef = r), type: "text", class: {
|
|
231
|
+
[this.getClassName("input")]: true,
|
|
232
|
+
[this.inputClass]: !!this.inputClass
|
|
233
|
+
}, 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: '9c088d60d8ed20d6e385bd2467766091a0ffab60', type: "button", ref: (r) => (this.calendarButtonRef = r), onClick: this.handleCalendarButtonClick, class: this.getClassName("calendar-button"), disabled: this.disabledState }, this.calendarButtonContent ? (h("span", { innerHTML: this.calendarButtonContent })) : (this.timesLabels.openCalendar)))), h("tabworthy-dates-modal", { key: 'a2df562a114f9131b8a43d7f226d09b07cd21c63', label: this.timesLabels.calendar, ref: (el) => (this.modalRef = el), onOpened: () => {
|
|
230
234
|
if (this.pickerRef) {
|
|
231
235
|
this.pickerRef.modalIsOpen = true;
|
|
232
236
|
}
|
|
@@ -234,7 +238,7 @@ const InclusiveTimes = class {
|
|
|
234
238
|
if (this.pickerRef) {
|
|
235
239
|
this.pickerRef.modalIsOpen = false;
|
|
236
240
|
}
|
|
237
|
-
}, inline: this.inline }, h("div", { key: '
|
|
241
|
+
}, inline: this.inline }, h("div", { key: 'c02d2c09cbb10a99d65cdd37723dcb0b30c31800', class: this.getClassName("picker-container") }, h("tabworthy-dates-calendar", { key: 'ab24fcb28e457937f10d7914f0c65219fbd1aa7e', range: this.range, locale: this.locale, onSelectDate: (event) => this.handlePickerSelection(event.detail), onChangeMonth: (event) => this.handleChangedMonths(event.detail), onChangeYear: (event) => this.handleYearChange(event.detail), labels: this.datesCalendarLabels, ref: (el) => (this.pickerRef = el), startDate: this.startDate, firstDayOfWeek: this.firstDayOfWeek, showHiddenTitle: true, disabled: this.disabledState, showMonthStepper: this.showMonthStepper, showYearStepper: this.showYearStepper, showClearButton: this.showClearButton, showTodayButton: this.showTodayButton, disableDate: this.disableDate, minDate: this.minDate, maxDate: this.maxDate, inline: this.inline }, h("div", { key: '1c2d6e1f290ef75840fd5ea33dd7debbe10d6cf4', slot: "after-calendar", class: this.getClassName("time-section") }, h("hr", { key: '34ed116961c27d81a4daf44c5c9325fad4b491fe', class: this.getClassName("divider") }), h("tabworthy-times-picker", { key: '5862db463ee502572c6d04bc039ddf8a51455511', hours: this.selectedHours, minutes: this.selectedMinutes, useTwelveHourFormat: this.useTwelveHourFormat, disabled: this.disabledState, onTimeChanged: this.handleTimeChange }))))), this.errorState && (h("div", { key: '2dccd8a4b09eed861c3e9c9ee9a02163ef2b0149', class: this.getClassName("input-error"), id: this.id ? `${this.id}-error` : undefined, role: "status" }, this.errorMessage))));
|
|
238
242
|
}
|
|
239
243
|
get el() { return getElement(this); }
|
|
240
244
|
static get watchers() { return {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,c as s,h as i,H as e,g as h}from"./p-CDFauf_3.js";import{h as a}from"./p-Mki5YqAR.js";import{g as r,r as d}from"./p-BVHu5CWV.js";const o={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"},n=class{constructor(i){t(this,i),this.selectDateTime=s(this,"selectDateTime",7),this.changeYear=s(this,"changeYear",7),this.componentReady=s(this,"componentReady",7),this.range=!1,this.label="Choose a date and time",this.placeholder="",this.locale=(null===navigator||void 0===navigator?void 0:navigator.language)||"en-US",this.disabled=!1,this.startDate=r(new Date),this.referenceDate=r(new Date),this.useTwelveHourFormat=!0,this.timesLabels=o,this.inline=!1,this.hasError=!1,this.showYearStepper=!1,this.showMonthStepper=!0,this.showClearButton=!0,this.showTodayButton=!0,this.disableDate=()=>!1,this.elementClassName="tabworthy-times",this.firstDayOfWeek=1,this.format="YYYY-MM-DDTHH:mm:ss",this.inputShouldFormat=!0,this.disableFreeformInput=!1,this.inputClass="",this.selectedHours=12,this.selectedMinutes=0,this.errorState=this.hasError,this.disabledState=this.disabled,this.errorMessage="",this.handlePickerSelection=async t=>{const s=t.split(",");if(this.range&&2===s.length){const t=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,this.selectedDate&&this.updateValue(this.selectedDate)},this.handleCalendarButtonClick=async()=>{this.modalRef&&(await this.modalRef.setTriggerElement(this.calendarButtonRef),await this.modalRef.open())},this.handleYearChange=t=>{this.changeYear&&this.changeYear.emit(t)},this.handleChangedMonths=()=>{},this.handleInputBlur=()=>{this.shouldInputFormat()&&this.formatInput()},this.handleInputChange=t=>{const s=a(t.target.value);s.isValid()&&(this.selectedHours=s.hours(),this.selectedMinutes=s.minutes(),this.updateValue(s.toDate()))}}shouldInputFormat(){return"string"==typeof this.inputShouldFormat?"true"===this.inputShouldFormat:!!this.inputShouldFormat}watchValue(t){this.syncFromValueProp()}watchDisabled(t){this.disabledState=t}watchHasError(t){this.errorState=t}componentDidLoad(){this.syncFromValueProp(),this.componentReady.emit(),this.id||console.error('tabworthy-times: The "id" prop is required for accessibility')}syncFromValueProp(){if(this.value){this.internalValue=this.value;const t=Array.isArray(this.value)?this.value[0]:this.value;if(t){const s=a(t,this.format);s.isValid()&&(this.selectedDate=s.toDate(),this.selectedHours=s.hours(),this.selectedMinutes=s.minutes())}}else this.internalValue=null}updateValue(t){if(Array.isArray(t)){const s=t.map((t=>{const s=a(t);return s.hours(this.selectedHours),s.minutes(this.selectedMinutes),s.seconds(0),s.format(this.format)}));this.internalValue=s,this.value=s,this.selectDateTime.emit(s)}else{const s=a(t);s.hours(this.selectedHours),s.minutes(this.selectedMinutes),s.seconds(0);const i=s.format(this.format);this.internalValue=i,this.value=i,this.selectedDate=t,this.selectDateTime.emit(i)}this.errorState=!1,this.shouldInputFormat()&&this.formatInput()}formatInput(){if(this.internalValue)if(Array.isArray(this.internalValue)){const t=this.internalValue.map((t=>a(t,this.format).format("lll"))).join(` ${this.timesLabels.to} `);this.inputRef.value=t}else this.inputRef.value=a(this.internalValue,this.format).format("lll")}getClassName(t){return`${this.elementClassName}__${t}`}async clearValue(){this.internalValue=null,this.value=void 0,this.selectedDate=void 0,this.inputRef.value="",this.pickerRef&&(this.pickerRef.value=null),this.selectDateTime.emit(void 0)}render(){var t;return i(e,{key:"a2bfc28b058319e0e1c723483c0f98aae766a371",class:this.elementClassName,"has-error":this.errorState,disabled:this.disabledState},i("label",{key:"072b5974746736864e482853198409c969dff6d7",htmlFor:`${this.id}-input`,class:this.getClassName("label")},this.label),i("div",{key:"bcc38045d990ce22960cdbfbbf43a218b05cdb12",class:this.getClassName("input-container")},i("input",{key:"e741093da1a37022ad73bd27fc2aecfaa39b5a6c",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:"9c088d60d8ed20d6e385bd2467766091a0ffab60",type:"button",ref:t=>this.calendarButtonRef=t,onClick:this.handleCalendarButtonClick,class:this.getClassName("calendar-button"),disabled:this.disabledState},this.calendarButtonContent?i("span",{innerHTML:this.calendarButtonContent}):this.timesLabels.openCalendar)),i("tabworthy-dates-modal",{key:"a2df562a114f9131b8a43d7f226d09b07cd21c63",label:this.timesLabels.calendar,ref:t=>this.modalRef=t,onOpened:()=>{this.pickerRef&&(this.pickerRef.modalIsOpen=!0)},onClosed:()=>{this.pickerRef&&(this.pickerRef.modalIsOpen=!1)},inline:this.inline},i("div",{key:"c02d2c09cbb10a99d65cdd37723dcb0b30c31800",class:this.getClassName("picker-container")},i("tabworthy-dates-calendar",{key:"ab24fcb28e457937f10d7914f0c65219fbd1aa7e",range:this.range,locale:this.locale,onSelectDate:t=>this.handlePickerSelection(t.detail),onChangeMonth:t=>this.handleChangedMonths(t.detail),onChangeYear:t=>this.handleYearChange(t.detail),labels:this.datesCalendarLabels,ref:t=>this.pickerRef=t,startDate:this.startDate,firstDayOfWeek:this.firstDayOfWeek,showHiddenTitle:!0,disabled:this.disabledState,showMonthStepper:this.showMonthStepper,showYearStepper:this.showYearStepper,showClearButton:this.showClearButton,showTodayButton:this.showTodayButton,disableDate:this.disableDate,minDate:this.minDate,maxDate:this.maxDate,inline:this.inline},i("div",{key:"1c2d6e1f290ef75840fd5ea33dd7debbe10d6cf4",slot:"after-calendar",class:this.getClassName("time-section")},i("hr",{key:"34ed116961c27d81a4daf44c5c9325fad4b491fe",class:this.getClassName("divider")}),i("tabworthy-times-picker",{key:"5862db463ee502572c6d04bc039ddf8a51455511",hours:this.selectedHours,minutes:this.selectedMinutes,useTwelveHourFormat:this.useTwelveHourFormat,disabled:this.disabledState,onTimeChanged:this.handleTimeChange}))))),this.errorState&&i("div",{key:"2dccd8a4b09eed861c3e9c9ee9a02163ef2b0149",class:this.getClassName("input-error"),id:this.id?`${this.id}-error`:void 0,role:"status"},this.errorMessage))}get el(){return h(this)}static get watchers(){return{value:[{watchValue:0}],disabled:[{watchDisabled:0}],hasError:[{watchHasError:0}]}}};export{n as tabworthy_times}
|