@tabworthy/components 0.10.1 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/tabworthy-components.cjs.js +1 -1
- package/dist/cjs/tabworthy-dates-calendar_2.cjs.entry.js +2 -2
- package/dist/cjs/tabworthy-times-picker.cjs.entry.js +39 -5
- package/dist/cjs/tabworthy-times.cjs.entry.js +21 -8
- package/dist/collection/components/tabworthy-modal/tabworthy-dates-modal.js +2 -2
- package/dist/collection/components/tabworthy-times/tabworthy-times.js +42 -8
- package/dist/collection/components/tabworthy-times-picker/tabworthy-times-picker.js +80 -5
- package/dist/components/{p-D0CX07Ep.js → p-CIQgnOXj.js} +1 -1
- package/dist/components/p-D_zy0B-F.js +1 -0
- package/dist/components/tabworthy-dates-modal.js +1 -1
- 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-calendar_2.entry.js +2 -2
- package/dist/esm/tabworthy-times-picker.entry.js +39 -5
- package/dist/esm/tabworthy-times.entry.js +21 -8
- package/dist/tabworthy-components/p-dc960590.entry.js +1 -0
- package/dist/tabworthy-components/p-ea7b79b0.entry.js +1 -0
- package/dist/tabworthy-components/{p-42e77ac7.entry.js → p-f1688c61.entry.js} +1 -1
- package/dist/tabworthy-components/tabworthy-components.esm.js +1 -1
- package/dist/types/components/tabworthy-times/tabworthy-times.d.ts +2 -0
- package/dist/types/components/tabworthy-times-picker/tabworthy-times-picker.d.ts +11 -0
- package/dist/types/components.d.ts +27 -0
- package/package.json +2 -1
- package/dist/components/p-DDp2dGlo.js +0 -1
- package/dist/tabworthy-components/p-327d119d.entry.js +0 -1
- package/dist/tabworthy-components/p-a67ad7af.entry.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{T as o,d as
|
|
1
|
+
import{T as o,d as s}from"./p-D_zy0B-F.js";const p=o,r=s;export{p as TabworthyTimesPicker,r 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-BiJ0HZVY.js";import{h as r}from"./p-Mki5YqAR.js";import{g as o,r as n,c as l}from"./p-CGo5md1l.js";import{d}from"./p-
|
|
1
|
+
import{p as t,H as s,c as e,h as i,d as a,t as h}from"./p-BiJ0HZVY.js";import{h as r}from"./p-Mki5YqAR.js";import{g as o,r as n,c as l}from"./p-CGo5md1l.js";import{d}from"./p-CIQgnOXj.js";import{d as c}from"./p-D_zy0B-F.js";const u={selected:"selected",openCalendar:"Choose time",calendar:"date and time picker",invalidDateError:"We could not find a matching date",minDateError:"Please fill in a date after ",maxDateError:"Please fill in a date before ",rangeOutOfBoundsError:"Please enter a valid range of dates",disabledDateError:"Please choose an available date",to:"to",startDate:"Start date",timeLabel:"Time"},b=t(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.selectDateTime=e(this,"selectDateTime",7),this.changeYear=e(this,"changeYear",7),this.componentReady=e(this,"componentReady",7),this.range=!1,this.label="Choose a date and time",this.placeholder="",this.locale=(null===navigator||void 0===navigator?void 0:navigator.language)||"en-US",this.disabled=!1,this.startDate=o(new Date),this.referenceDate=o(new Date),this.useTwelveHourFormat=!0,this.showSeconds=!1,this.timesLabels=u,this.inline=!1,this.hasError=!1,this.showYearStepper=!1,this.showMonthStepper=!0,this.showClearButton=!0,this.showCloseButton=!1,this.showTodayButton=!0,this.disableDate=()=>!1,this.elementClassName="tabworthy-times",this.firstDayOfWeek=1,this.format="YYYY-MM-DDTHH:mm:ss",this.inputShouldFormat=!0,this.disableFreeformInput=!1,this.inputClass="",this.selectedHours=(new Date).getHours(),this.selectedMinutes=(new Date).getMinutes(),this.selectedSeconds=(new Date).getSeconds(),this.errorState=this.hasError,this.disabledState=this.disabled,this.errorMessage="",this.handlePickerSelection=async t=>{if(!t)return this.clearValue();const s=t.split(",");if(this.range&&2===s.length){const t=n(new Date(s[0])),e=n(new Date(s[1]));this.updateValue([t,e]),this.pickerRef&&(this.pickerRef.value=[t,e])}else{const t=n(new Date(s[0]));this.updateValue(t),this.pickerRef&&(this.pickerRef.value=t)}},this.handleTimeChange=t=>{this.selectedHours=t.detail.hours,this.selectedMinutes=t.detail.minutes,void 0!==t.detail.seconds&&(this.selectedSeconds=t.detail.seconds),this.selectedDate&&this.updateValue(this.selectedDate)},this.handleCalendarButtonClick=async()=>{this.modalRef&&(await this.modalRef.setTriggerElement(this.inputContainerRef),await this.modalRef.open())},this.handleYearChange=t=>{this.changeYear&&this.changeYear.emit(t)},this.handleChangedMonths=()=>{},this.handleInputBlur=()=>{this.shouldInputFormat()&&this.formatInput()},this.handleInputChange=t=>{const s=r(t.target.value);s.isValid()&&(this.selectedHours=s.hours(),this.selectedMinutes=s.minutes(),this.updateValue(s.toDate()))}}shouldInputFormat(){return"string"==typeof this.inputShouldFormat?"true"===this.inputShouldFormat:!!this.inputShouldFormat}watchValue(t){this.syncFromValueProp()}watchDisabled(t){this.disabledState=t}watchHasError(t){this.errorState=t}componentDidLoad(){this.syncFromValueProp(),this.componentReady.emit(),this.id||console.error('tabworthy-times: The "id" prop is required for accessibility')}syncFromValueProp(){if(this.value){this.internalValue=this.value;const t=Array.isArray(this.value)?this.value[0]:this.value;if(t){const s=r(t,this.format);s.isValid()&&(this.selectedDate=s.toDate(),this.selectedHours=s.hours(),this.selectedMinutes=s.minutes(),this.selectedSeconds=s.seconds())}}else this.internalValue=null}updateValue(t){if(Array.isArray(t)){const s=t.map((t=>{const s=r(t);return s.hours(this.selectedHours),s.minutes(this.selectedMinutes),s.seconds(this.selectedSeconds),s.format(this.format)}));this.internalValue=s,this.value=s,this.selectDateTime.emit(s)}else{const s=r(t);s.hours(this.selectedHours),s.minutes(this.selectedMinutes),s.seconds(this.selectedSeconds);const e=s.format(this.format);this.internalValue=e,this.value=e,this.selectedDate=t,this.selectDateTime.emit(e)}this.errorState=!1,this.shouldInputFormat()&&this.formatInput()}formatInput(){if(this.internalValue)if(Array.isArray(this.internalValue)){const t=this.internalValue.map((t=>r(t,this.format).format("lll"))).join(` ${this.timesLabels.to} `);this.inputRef.value=t}else this.inputRef.value=r(this.internalValue,this.format).format("lll")}getClassName(t){return`${this.elementClassName}__${t}`}toDate(t){return t?Array.isArray(t)?t.map((t=>r(t,this.format).toDate())):r(t,this.format).toDate():null}async clearValue(){this.internalValue=null,this.value=void 0,this.selectedDate=void 0,this.inputRef&&(this.inputRef.value=""),this.pickerRef&&(this.pickerRef.value=null),this.selectDateTime.emit(void 0)}render(){var t;return i(a,{key:"de07eab0ee0cd6624756ce18a0dcc38a509692e4",class:this.elementClassName,"has-error":this.errorState,disabled:this.disabledState},i("label",{key:"666a1cd43b7c2d1633210d7422ec8d2c3fc44e44",htmlFor:this.id+"-input",class:this.getClassName("label")},this.label),i("div",{key:"222432b8a431bac954fb625f5b724df077d9feeb",class:this.getClassName("input-container"),ref:t=>this.inputContainerRef=t},i("input",{key:"c3284e4348cd736f2edf708978956fb88f78118a",id:this.id+"-input",ref:t=>this.inputRef=t,type:"text",class:{[this.getClassName("input")]:!0,[this.inputClass]:!!this.inputClass},placeholder:this.placeholder,disabled:this.disabledState||this.disableFreeformInput,value:null===(t=this.internalValue)||void 0===t?void 0:""+t,onBlur:this.handleInputBlur,onChange:this.handleInputChange,"aria-describedby":this.errorState?this.id+"-error":void 0,"aria-invalid":this.errorState}),!this.inline&&i("button",{key:"9087c6b9cec31990b13ba6a1a7ad66f937ddee3a",type:"button",onClick:this.handleCalendarButtonClick,class:this.getClassName("calendar-button"),disabled:this.disabledState},this.calendarButtonContent?i("span",{innerHTML:this.calendarButtonContent}):this.timesLabels.openCalendar)),i("tabworthy-dates-modal",{key:"79613c7af13afe36e03cfede116b260f9d1d2b63",label:this.timesLabels.calendar,ref:t=>this.modalRef=t,onOpened:()=>{this.pickerRef&&(this.pickerRef.modalIsOpen=!0)},onClosed:()=>{this.pickerRef&&(this.pickerRef.modalIsOpen=!1)},inline:this.inline,appendTo:this.appendTo},i("div",{key:"716440a779e1e614fbef292c7c1cc801cde57ee6",class:this.getClassName("picker-container")},i("tabworthy-dates-calendar",{key:"02579a80370918076f36e04f64b6626893acf1cd",range:this.range,locale:this.locale,onSelectDate:t=>this.handlePickerSelection(t.detail),onChangeMonth:t=>this.handleChangedMonths(t.detail),onChangeYear:t=>this.handleYearChange(t.detail),onRequestClose:()=>{var t;return null===(t=this.modalRef)||void 0===t?void 0:t.close()},labels:this.datesCalendarLabels,ref:t=>this.pickerRef=t,startDate:this.startDate,firstDayOfWeek:this.firstDayOfWeek,showHiddenTitle:!0,disabled:this.disabledState,showMonthStepper:this.showMonthStepper,showYearStepper:this.showYearStepper,showClearButton:this.showClearButton,showCloseButton:this.showCloseButton,showTodayButton:this.showTodayButton,disableDate:this.disableDate,minDate:this.minDate,maxDate:this.maxDate,inline:this.inline,value:this.value?this.toDate(this.value):void 0},i("div",{key:"df629acf66bc6a83c7c0601f6cff39a8a27ddba2",slot:"after-calendar",class:this.getClassName("time-section")},i("hr",{key:"084ba933dbe96086d9c8f21494e4016eb6d3ac66",class:this.getClassName("divider")}),i("tabworthy-times-picker",{key:"788081745c21b0702fcc0f8d79f0c6fe88b4372d",hours:this.selectedHours,minutes:this.selectedMinutes,seconds:this.selectedSeconds,showSeconds:this.showSeconds,useTwelveHourFormat:this.useTwelveHourFormat,disabled:this.disabledState,onTimeChanged:this.handleTimeChange,labels:this.timesPickerLabels}))))),this.errorState&&i("div",{key:"0742a70dcb66f4523131c29d60f2056c9cf94320",class:this.getClassName("input-error"),id:this.id?this.id+"-error":void 0,role:"status"},this.errorMessage))}get el(){return this}static get watchers(){return{value:[{watchValue:0}],disabled:[{watchDisabled:0}],hasError:[{watchHasError:0}]}}},[2,"tabworthy-times",{id:[513],value:[1025],range:[4],label:[1],placeholder:[1],locale:[1],disabled:[4],minDate:[1,"min-date"],maxDate:[1,"max-date"],startDate:[1,"start-date"],referenceDate:[1,"reference-date"],useTwelveHourFormat:[4,"use-twelve-hour-format"],showSeconds:[4,"show-seconds"],timesLabels:[16],datesCalendarLabels:[16],timesPickerLabels:[16],inline:[4],hasError:[1028,"has-error"],showYearStepper:[4,"show-year-stepper"],showMonthStepper:[4,"show-month-stepper"],showClearButton:[4,"show-clear-button"],showCloseButton:[4,"show-close-button"],showTodayButton:[4,"show-today-button"],calendarButtonContent:[1,"calendar-button-content"],disableDate:[16],elementClassName:[1,"element-class-name"],firstDayOfWeek:[2,"first-day-of-week"],format:[1],inputShouldFormat:[8,"input-should-format"],disableFreeformInput:[4,"disable-freeform-input"],inputClass:[1,"input-class"],appendTo:[1,"append-to"],internalValue:[32],selectedDate:[32],selectedHours:[32],selectedMinutes:[32],selectedSeconds:[32],errorState:[32],disabledState:[32],clearValue:[64]},void 0,{value:[{watchValue:0}],disabled:[{watchDisabled:0}],hasError:[{watchHasError:0}]}]),f=b,m=function(){"undefined"!=typeof customElements&&["tabworthy-times","tabworthy-dates-calendar","tabworthy-dates-modal","tabworthy-times-picker"].forEach((t=>{switch(t){case"tabworthy-times":customElements.get(h(t))||customElements.define(h(t),b);break;case"tabworthy-dates-calendar":customElements.get(h(t))||l();break;case"tabworthy-dates-modal":customElements.get(h(t))||d();break;case"tabworthy-times-picker":customElements.get(h(t))||c()}}))};export{f as TabworthyTimes,m as defineCustomElement}
|
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],"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"],"closeButtonContent":[1,"close-button-content"],"disabled":[4],"modalIsOpen":[4,"modal-is-open"],"disableDate":[16],"elementClassName":[1,"element-class-name"],"firstDayOfWeek":[2,"first-day-of-week"],"range":[4],"labels":[16],"locale":[1],"nextMonthButtonContent":[1,"next-month-button-content"],"nextYearButtonContent":[1,"next-year-button-content"],"previousMonthButtonContent":[1,"previous-month-button-content"],"previousYearButtonContent":[1,"previous-year-button-content"],"minDate":[1,"min-date"],"maxDate":[1,"max-date"],"inline":[4],"showClearButton":[4,"show-clear-button"],"showCloseButton":[4,"show-close-button"],"showMonthStepper":[4,"show-month-stepper"],"showTodayButton":[4,"show-today-button"],"showYearStepper":[4,"show-year-stepper"],"showKeyboardHint":[4,"show-keyboard-hint"],"showHiddenTitle":[4,"show-hidden-title"],"startDate":[1,"start-date"],"todayButtonContent":[1,"today-button-content"],"value":[1040],"currentDate":[32],"hoveredDate":[32],"weekdays":[32]},null,{"modalIsOpen":[{"watchModalIsOpen":0}],"firstDayOfWeek":[{"watchFirstDayOfWeek":0}],"locale":[{"watchLocale":0}],"range":[{"watchRange":0}],"startDate":[{"watchStartDate":0}],"value":[{"watchValue":0}]}],[257,"tabworthy-dates-modal",{"label":[1],"inline":[4],"placement":[1],"offset":[16],"appendTo":[1,"append-to"],"closing":[32],"showing":[32],"positioned":[32],"open":[64],"close":[64],"getState":[64],"setTriggerElement":[64],"updatePosition":[64]},[[10,"click","handleClick"]],{"showing":[{"watchShowing":0}]}]]],["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],"timesPickerLabels":[16],"inline":[4],"hasError":[1028,"has-error"],"showYearStepper":[4,"show-year-stepper"],"showMonthStepper":[4,"show-month-stepper"],"showClearButton":[4,"show-clear-button"],"showCloseButton":[4,"show-close-button"],"showTodayButton":[4,"show-today-button"],"calendarButtonContent":[1,"calendar-button-content"],"disableDate":[16],"elementClassName":[1,"element-class-name"],"firstDayOfWeek":[2,"first-day-of-week"],"format":[1],"inputShouldFormat":[8,"input-should-format"],"disableFreeformInput":[4,"disable-freeform-input"],"inputClass":[1,"input-class"],"appendTo":[1,"append-to"],"internalValue":[32],"selectedDate":[32],"selectedHours":[32],"selectedMinutes":[32],"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"],"showCloseButton":[4,"show-close-button"],"showTodayButton":[4,"show-today-button"],"inputShouldFormat":[8,"input-should-format"],"showKeyboardHint":[4,"show-keyboard-hint"],"disableDate":[16],"elementClassName":[1,"element-class-name"],"firstDayOfWeek":[2,"first-day-of-week"],"format":[1],"quickButtons":[16],"todayButtonContent":[1,"today-button-content"],"calendarButtonContent":[1,"calendar-button-content"],"showQuickButtons":[4,"show-quick-buttons"],"disableFreeformInput":[4,"disable-freeform-input"],"inputClass":[1,"input-class"],"appendTo":[1,"append-to"],"internalValue":[32],"errorState":[32],"disabledState":[32],"parseDate":[64]},null,{"disabled":[{"watchDisabled":0}],"value":[{"watchValue":0}]}]]]], options);
|
|
8
|
+
return bootstrapLazy([["tabworthy-times-picker",[[2,"tabworthy-times-picker",{"hours":[1026],"minutes":[1026],"seconds":[1026],"useTwelveHourFormat":[4,"use-twelve-hour-format"],"showSeconds":[4,"show-seconds"],"labels":[16],"labelsSrOnly":[4,"labels-sr-only"],"disabled":[4],"elementClassName":[1,"element-class-name"],"internalHours":[32],"internalMinutes":[32],"internalSeconds":[32],"period":[32]},null,{"hours":[{"watchHours":0}],"minutes":[{"watchMinutes":0}],"seconds":[{"watchSeconds":0}]}]]],["tabworthy-dates-calendar_2",[[262,"tabworthy-dates-calendar",{"clearButtonContent":[1,"clear-button-content"],"closeButtonContent":[1,"close-button-content"],"disabled":[4],"modalIsOpen":[4,"modal-is-open"],"disableDate":[16],"elementClassName":[1,"element-class-name"],"firstDayOfWeek":[2,"first-day-of-week"],"range":[4],"labels":[16],"locale":[1],"nextMonthButtonContent":[1,"next-month-button-content"],"nextYearButtonContent":[1,"next-year-button-content"],"previousMonthButtonContent":[1,"previous-month-button-content"],"previousYearButtonContent":[1,"previous-year-button-content"],"minDate":[1,"min-date"],"maxDate":[1,"max-date"],"inline":[4],"showClearButton":[4,"show-clear-button"],"showCloseButton":[4,"show-close-button"],"showMonthStepper":[4,"show-month-stepper"],"showTodayButton":[4,"show-today-button"],"showYearStepper":[4,"show-year-stepper"],"showKeyboardHint":[4,"show-keyboard-hint"],"showHiddenTitle":[4,"show-hidden-title"],"startDate":[1,"start-date"],"todayButtonContent":[1,"today-button-content"],"value":[1040],"currentDate":[32],"hoveredDate":[32],"weekdays":[32]},null,{"modalIsOpen":[{"watchModalIsOpen":0}],"firstDayOfWeek":[{"watchFirstDayOfWeek":0}],"locale":[{"watchLocale":0}],"range":[{"watchRange":0}],"startDate":[{"watchStartDate":0}],"value":[{"watchValue":0}]}],[257,"tabworthy-dates-modal",{"label":[1],"inline":[4],"placement":[1],"offset":[16],"appendTo":[1,"append-to"],"closing":[32],"showing":[32],"positioned":[32],"open":[64],"close":[64],"getState":[64],"setTriggerElement":[64],"updatePosition":[64]},[[10,"click","handleClick"]],{"showing":[{"watchShowing":0}]}]]],["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"],"showSeconds":[4,"show-seconds"],"timesLabels":[16],"datesCalendarLabels":[16],"timesPickerLabels":[16],"inline":[4],"hasError":[1028,"has-error"],"showYearStepper":[4,"show-year-stepper"],"showMonthStepper":[4,"show-month-stepper"],"showClearButton":[4,"show-clear-button"],"showCloseButton":[4,"show-close-button"],"showTodayButton":[4,"show-today-button"],"calendarButtonContent":[1,"calendar-button-content"],"disableDate":[16],"elementClassName":[1,"element-class-name"],"firstDayOfWeek":[2,"first-day-of-week"],"format":[1],"inputShouldFormat":[8,"input-should-format"],"disableFreeformInput":[4,"disable-freeform-input"],"inputClass":[1,"input-class"],"appendTo":[1,"append-to"],"internalValue":[32],"selectedDate":[32],"selectedHours":[32],"selectedMinutes":[32],"selectedSeconds":[32],"errorState":[32],"disabledState":[32],"clearValue":[64]},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"],"showCloseButton":[4,"show-close-button"],"showTodayButton":[4,"show-today-button"],"inputShouldFormat":[8,"input-should-format"],"showKeyboardHint":[4,"show-keyboard-hint"],"disableDate":[16],"elementClassName":[1,"element-class-name"],"firstDayOfWeek":[2,"first-day-of-week"],"format":[1],"quickButtons":[16],"todayButtonContent":[1,"today-button-content"],"calendarButtonContent":[1,"calendar-button-content"],"showQuickButtons":[4,"show-quick-buttons"],"disableFreeformInput":[4,"disable-freeform-input"],"inputClass":[1,"input-class"],"appendTo":[1,"append-to"],"internalValue":[32],"errorState":[32],"disabledState":[32],"parseDate":[64]},null,{"disabled":[{"watchDisabled":0}],"value":[{"watchValue":0}]}]]]], 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],"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"],"closeButtonContent":[1,"close-button-content"],"disabled":[4],"modalIsOpen":[4,"modal-is-open"],"disableDate":[16],"elementClassName":[1,"element-class-name"],"firstDayOfWeek":[2,"first-day-of-week"],"range":[4],"labels":[16],"locale":[1],"nextMonthButtonContent":[1,"next-month-button-content"],"nextYearButtonContent":[1,"next-year-button-content"],"previousMonthButtonContent":[1,"previous-month-button-content"],"previousYearButtonContent":[1,"previous-year-button-content"],"minDate":[1,"min-date"],"maxDate":[1,"max-date"],"inline":[4],"showClearButton":[4,"show-clear-button"],"showCloseButton":[4,"show-close-button"],"showMonthStepper":[4,"show-month-stepper"],"showTodayButton":[4,"show-today-button"],"showYearStepper":[4,"show-year-stepper"],"showKeyboardHint":[4,"show-keyboard-hint"],"showHiddenTitle":[4,"show-hidden-title"],"startDate":[1,"start-date"],"todayButtonContent":[1,"today-button-content"],"value":[1040],"currentDate":[32],"hoveredDate":[32],"weekdays":[32]},null,{"modalIsOpen":[{"watchModalIsOpen":0}],"firstDayOfWeek":[{"watchFirstDayOfWeek":0}],"locale":[{"watchLocale":0}],"range":[{"watchRange":0}],"startDate":[{"watchStartDate":0}],"value":[{"watchValue":0}]}],[257,"tabworthy-dates-modal",{"label":[1],"inline":[4],"placement":[1],"offset":[16],"appendTo":[1,"append-to"],"closing":[32],"showing":[32],"positioned":[32],"open":[64],"close":[64],"getState":[64],"setTriggerElement":[64],"updatePosition":[64]},[[10,"click","handleClick"]],{"showing":[{"watchShowing":0}]}]]],["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],"timesPickerLabels":[16],"inline":[4],"hasError":[1028,"has-error"],"showYearStepper":[4,"show-year-stepper"],"showMonthStepper":[4,"show-month-stepper"],"showClearButton":[4,"show-clear-button"],"showCloseButton":[4,"show-close-button"],"showTodayButton":[4,"show-today-button"],"calendarButtonContent":[1,"calendar-button-content"],"disableDate":[16],"elementClassName":[1,"element-class-name"],"firstDayOfWeek":[2,"first-day-of-week"],"format":[1],"inputShouldFormat":[8,"input-should-format"],"disableFreeformInput":[4,"disable-freeform-input"],"inputClass":[1,"input-class"],"appendTo":[1,"append-to"],"internalValue":[32],"selectedDate":[32],"selectedHours":[32],"selectedMinutes":[32],"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"],"showCloseButton":[4,"show-close-button"],"showTodayButton":[4,"show-today-button"],"inputShouldFormat":[8,"input-should-format"],"showKeyboardHint":[4,"show-keyboard-hint"],"disableDate":[16],"elementClassName":[1,"element-class-name"],"firstDayOfWeek":[2,"first-day-of-week"],"format":[1],"quickButtons":[16],"todayButtonContent":[1,"today-button-content"],"calendarButtonContent":[1,"calendar-button-content"],"showQuickButtons":[4,"show-quick-buttons"],"disableFreeformInput":[4,"disable-freeform-input"],"inputClass":[1,"input-class"],"appendTo":[1,"append-to"],"internalValue":[32],"errorState":[32],"disabledState":[32],"parseDate":[64]},null,{"disabled":[{"watchDisabled":0}],"value":[{"watchValue":0}]}]]]], options);
|
|
20
|
+
return bootstrapLazy([["tabworthy-times-picker",[[2,"tabworthy-times-picker",{"hours":[1026],"minutes":[1026],"seconds":[1026],"useTwelveHourFormat":[4,"use-twelve-hour-format"],"showSeconds":[4,"show-seconds"],"labels":[16],"labelsSrOnly":[4,"labels-sr-only"],"disabled":[4],"elementClassName":[1,"element-class-name"],"internalHours":[32],"internalMinutes":[32],"internalSeconds":[32],"period":[32]},null,{"hours":[{"watchHours":0}],"minutes":[{"watchMinutes":0}],"seconds":[{"watchSeconds":0}]}]]],["tabworthy-dates-calendar_2",[[262,"tabworthy-dates-calendar",{"clearButtonContent":[1,"clear-button-content"],"closeButtonContent":[1,"close-button-content"],"disabled":[4],"modalIsOpen":[4,"modal-is-open"],"disableDate":[16],"elementClassName":[1,"element-class-name"],"firstDayOfWeek":[2,"first-day-of-week"],"range":[4],"labels":[16],"locale":[1],"nextMonthButtonContent":[1,"next-month-button-content"],"nextYearButtonContent":[1,"next-year-button-content"],"previousMonthButtonContent":[1,"previous-month-button-content"],"previousYearButtonContent":[1,"previous-year-button-content"],"minDate":[1,"min-date"],"maxDate":[1,"max-date"],"inline":[4],"showClearButton":[4,"show-clear-button"],"showCloseButton":[4,"show-close-button"],"showMonthStepper":[4,"show-month-stepper"],"showTodayButton":[4,"show-today-button"],"showYearStepper":[4,"show-year-stepper"],"showKeyboardHint":[4,"show-keyboard-hint"],"showHiddenTitle":[4,"show-hidden-title"],"startDate":[1,"start-date"],"todayButtonContent":[1,"today-button-content"],"value":[1040],"currentDate":[32],"hoveredDate":[32],"weekdays":[32]},null,{"modalIsOpen":[{"watchModalIsOpen":0}],"firstDayOfWeek":[{"watchFirstDayOfWeek":0}],"locale":[{"watchLocale":0}],"range":[{"watchRange":0}],"startDate":[{"watchStartDate":0}],"value":[{"watchValue":0}]}],[257,"tabworthy-dates-modal",{"label":[1],"inline":[4],"placement":[1],"offset":[16],"appendTo":[1,"append-to"],"closing":[32],"showing":[32],"positioned":[32],"open":[64],"close":[64],"getState":[64],"setTriggerElement":[64],"updatePosition":[64]},[[10,"click","handleClick"]],{"showing":[{"watchShowing":0}]}]]],["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"],"showSeconds":[4,"show-seconds"],"timesLabels":[16],"datesCalendarLabels":[16],"timesPickerLabels":[16],"inline":[4],"hasError":[1028,"has-error"],"showYearStepper":[4,"show-year-stepper"],"showMonthStepper":[4,"show-month-stepper"],"showClearButton":[4,"show-clear-button"],"showCloseButton":[4,"show-close-button"],"showTodayButton":[4,"show-today-button"],"calendarButtonContent":[1,"calendar-button-content"],"disableDate":[16],"elementClassName":[1,"element-class-name"],"firstDayOfWeek":[2,"first-day-of-week"],"format":[1],"inputShouldFormat":[8,"input-should-format"],"disableFreeformInput":[4,"disable-freeform-input"],"inputClass":[1,"input-class"],"appendTo":[1,"append-to"],"internalValue":[32],"selectedDate":[32],"selectedHours":[32],"selectedMinutes":[32],"selectedSeconds":[32],"errorState":[32],"disabledState":[32],"clearValue":[64]},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"],"showCloseButton":[4,"show-close-button"],"showTodayButton":[4,"show-today-button"],"inputShouldFormat":[8,"input-should-format"],"showKeyboardHint":[4,"show-keyboard-hint"],"disableDate":[16],"elementClassName":[1,"element-class-name"],"firstDayOfWeek":[2,"first-day-of-week"],"format":[1],"quickButtons":[16],"todayButtonContent":[1,"today-button-content"],"calendarButtonContent":[1,"calendar-button-content"],"showQuickButtons":[4,"show-quick-buttons"],"disableFreeformInput":[4,"disable-freeform-input"],"inputClass":[1,"input-class"],"appendTo":[1,"append-to"],"internalValue":[32],"errorState":[32],"disabledState":[32],"parseDate":[64]},null,{"disabled":[{"watchDisabled":0}],"value":[{"watchValue":0}]}]]]], options);
|
|
21
21
|
});
|
|
@@ -2823,7 +2823,7 @@ const InclusiveDatesModal = class {
|
|
|
2823
2823
|
}
|
|
2824
2824
|
}
|
|
2825
2825
|
render() {
|
|
2826
|
-
return (h(Host, { key: '
|
|
2826
|
+
return (h(Host, { key: 'bf48e957915fbc2975d7ba2f2ca6844e2c14270e', showing: this.showing, ref: (r) => r && (this.el = r) }, !this.inline && this.showing && (h("div", { key: '87fd577d1289e3c6f888b614d127e729003b1fe6', part: "body", ref: (r) => {
|
|
2827
2827
|
if (r) {
|
|
2828
2828
|
this.bodyRef = r;
|
|
2829
2829
|
// Setup portal and create popper when ref is set
|
|
@@ -2840,7 +2840,7 @@ const InclusiveDatesModal = class {
|
|
|
2840
2840
|
});
|
|
2841
2841
|
}
|
|
2842
2842
|
}
|
|
2843
|
-
}, style: { visibility: this.positioned ? "visible" : "hidden" }, onKeyDown: this.onKeyDown, role: "dialog", tabindex: -1, "aria-hidden": !this.showing, "aria-label": this.label, "aria-modal": this.showing }, h("focus-trap", { key: '
|
|
2843
|
+
}, style: { visibility: this.positioned ? "visible" : "hidden" }, onKeyDown: this.onKeyDown, role: "dialog", tabindex: -1, "aria-hidden": !this.showing, "aria-label": this.label, "aria-modal": this.showing }, h("focus-trap", { key: '5f994a20957137ce8e95d17191cb9436ae4c2315' }, h("div", { key: '6ab5e6990d04e9e6b0905971b52b33410608759e', part: "content" }, h("slot", { key: '9d99fbd7f47ee014277fe4493f86a90b3929103c' }))))), this.inline && (h("div", { key: 'fc1766214d1727cc2865a17da6661f06bd67429f', part: "content" }, h("slot", { key: '28d41dba4356ce3bd0aa7db06943296de4372695' })))));
|
|
2844
2844
|
}
|
|
2845
2845
|
get hostElement() { return getElement(this); }
|
|
2846
2846
|
static get watchers() { return {
|
|
@@ -3,13 +3,16 @@ import { r as registerInstance, c as createEvent, h, H as Host, g as getElement
|
|
|
3
3
|
const defaultLabels = {
|
|
4
4
|
hours: "Hours",
|
|
5
5
|
minutes: "Minutes",
|
|
6
|
+
seconds: "Seconds",
|
|
6
7
|
am: "AM",
|
|
7
8
|
pm: "PM",
|
|
8
9
|
timePicker: "Time picker",
|
|
9
10
|
incrementHours: "Increment hours",
|
|
10
11
|
decrementHours: "Decrement hours",
|
|
11
12
|
incrementMinutes: "Increment minutes",
|
|
12
|
-
decrementMinutes: "Decrement minutes"
|
|
13
|
+
decrementMinutes: "Decrement minutes",
|
|
14
|
+
incrementSeconds: "Increment seconds",
|
|
15
|
+
decrementSeconds: "Decrement seconds"
|
|
13
16
|
};
|
|
14
17
|
const TabworthyTimesPicker = class {
|
|
15
18
|
constructor(hostRef) {
|
|
@@ -18,7 +21,10 @@ const TabworthyTimesPicker = class {
|
|
|
18
21
|
// Current time value (24-hour format)
|
|
19
22
|
this.hours = 12;
|
|
20
23
|
this.minutes = 0;
|
|
24
|
+
this.seconds = 0;
|
|
21
25
|
this.useTwelveHourFormat = false;
|
|
26
|
+
// Show seconds control
|
|
27
|
+
this.showSeconds = false;
|
|
22
28
|
// Labels for accessibility and i18n
|
|
23
29
|
this.labels = defaultLabels;
|
|
24
30
|
// Hide labels visually but keep them for screen readers
|
|
@@ -27,6 +33,7 @@ const TabworthyTimesPicker = class {
|
|
|
27
33
|
this.elementClassName = "tabworthy-times-picker";
|
|
28
34
|
this.internalHours = this.hours;
|
|
29
35
|
this.internalMinutes = this.minutes;
|
|
36
|
+
this.internalSeconds = this.seconds;
|
|
30
37
|
this.period = this.hours >= 12 ? "PM" : "AM";
|
|
31
38
|
this.handleHourChange = (e) => {
|
|
32
39
|
const value = parseInt(e.target.value, 10);
|
|
@@ -104,6 +111,19 @@ const TabworthyTimesPicker = class {
|
|
|
104
111
|
this.internalMinutes === 0 ? 59 : this.internalMinutes - 1;
|
|
105
112
|
this.emitTimeChange();
|
|
106
113
|
};
|
|
114
|
+
this.handleSecondChange = (e) => {
|
|
115
|
+
this.internalSeconds = parseInt(e.target.value, 10);
|
|
116
|
+
this.emitTimeChange();
|
|
117
|
+
};
|
|
118
|
+
this.handleSecondIncrement = () => {
|
|
119
|
+
this.internalSeconds = (this.internalSeconds + 1) % 60;
|
|
120
|
+
this.emitTimeChange();
|
|
121
|
+
};
|
|
122
|
+
this.handleSecondDecrement = () => {
|
|
123
|
+
this.internalSeconds =
|
|
124
|
+
this.internalSeconds === 0 ? 59 : this.internalSeconds - 1;
|
|
125
|
+
this.emitTimeChange();
|
|
126
|
+
};
|
|
107
127
|
}
|
|
108
128
|
watchHours(newValue) {
|
|
109
129
|
this.internalHours = newValue;
|
|
@@ -112,9 +132,13 @@ const TabworthyTimesPicker = class {
|
|
|
112
132
|
watchMinutes(newValue) {
|
|
113
133
|
this.internalMinutes = newValue;
|
|
114
134
|
}
|
|
135
|
+
watchSeconds(newValue) {
|
|
136
|
+
this.internalSeconds = newValue;
|
|
137
|
+
}
|
|
115
138
|
componentWillLoad() {
|
|
116
139
|
this.internalHours = this.hours;
|
|
117
140
|
this.internalMinutes = this.minutes;
|
|
141
|
+
this.internalSeconds = this.seconds;
|
|
118
142
|
this.period = this.hours >= 12 ? "PM" : "AM";
|
|
119
143
|
}
|
|
120
144
|
getDisplayHours() {
|
|
@@ -143,6 +167,7 @@ const TabworthyTimesPicker = class {
|
|
|
143
167
|
this.timeChanged.emit({
|
|
144
168
|
hours: this.get24HourValue(),
|
|
145
169
|
minutes: this.internalMinutes,
|
|
170
|
+
seconds: this.showSeconds ? this.internalSeconds : undefined,
|
|
146
171
|
period: this.useTwelveHourFormat ? this.period : undefined
|
|
147
172
|
});
|
|
148
173
|
}
|
|
@@ -153,16 +178,22 @@ const TabworthyTimesPicker = class {
|
|
|
153
178
|
const displayHours = this.getDisplayHours();
|
|
154
179
|
const maxHours = this.useTwelveHourFormat ? 12 : 23;
|
|
155
180
|
const minHours = this.useTwelveHourFormat ? 1 : 0;
|
|
156
|
-
return (h(Host, { key: '
|
|
181
|
+
return (h(Host, { key: 'be075e309d41904bf237c3a4b31b063ac4d1a7e0', class: this.elementClassName, "aria-label": this.labels.timePicker }, h("div", { key: '39d3a55428ad6f567490aa9a55ab94766de39e7f', class: `${this.elementClassName}__container` }, h("div", { key: '5efcc6b13a4473d5d889689d205128b328ae9417', class: `${this.elementClassName}__field` }, h("label", { key: 'f2e760229dd54d2265539e924dc133eda7f53fb8', htmlFor: `${this.elementClassName}-hours`, class: {
|
|
157
182
|
[`${this.elementClassName}__label`]: true,
|
|
158
183
|
[`${this.elementClassName}__label--sr-only`]: this.labelsSrOnly
|
|
159
|
-
} }, this.labels.hours), h("div", { key: '
|
|
184
|
+
} }, this.labels.hours), h("div", { key: 'a1f92371d923c50adb423d8fa36d84fe632fcdcb', class: `${this.elementClassName}__control` }, h("button", { key: 'ce1a13d5d97f664cd5a7ef9ac144cb2d7a76b0e3', type: "button", class: `${this.elementClassName}__button ${this.elementClassName}__button--increment`, onClick: this.handleHourIncrement, disabled: this.disabled, "aria-label": this.labels.incrementHours }, h("svg", { key: '9f4f27bc5e3ecc1da7f9520c5a67bef79b546229', 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: '2537a3c151f846b52f427bff20145dd581b2db7b', points: "18 15 12 9 6 15" }))), h("input", { key: 'dbe3c7e05bf44f2942f38e397fa8abcd5ec9a080', 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: '69e610902e8324369a57f5943699f019533f9b0a', type: "button", class: `${this.elementClassName}__button ${this.elementClassName}__button--decrement`, onClick: this.handleHourDecrement, disabled: this.disabled, "aria-label": this.labels.decrementHours }, h("svg", { key: 'fd3a91c8c82abb4ba948c1735a4d6b1ab9879452', 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: 'f2fb31860bc57fe95b78e0331d4dce611976f1cc', points: "6 9 12 15 18 9" }))))), h("div", { key: '5f488705145ebbaaba10f7e0370dd614e5ac9c91', class: `${this.elementClassName}__separator` }, ":"), h("div", { key: 'c886bc72ad9098a1015d97cdb64d609d10b4b7c0', class: `${this.elementClassName}__field` }, h("label", { key: '3590285320f4ee5403e41cceb964aa2440ee3caa', htmlFor: `${this.elementClassName}-minutes`, class: {
|
|
160
185
|
[`${this.elementClassName}__label`]: true,
|
|
161
186
|
[`${this.elementClassName}__label--sr-only`]: this.labelsSrOnly
|
|
162
|
-
} }, this.labels.minutes), h("div", { key: '
|
|
187
|
+
} }, this.labels.minutes), h("div", { key: '0e4271bc5e35b9664ef599af056c997a0b09c64f', class: `${this.elementClassName}__control` }, h("button", { key: '29d095829fb141f2f2495a5cbc4bb7f28f39b54b', type: "button", class: `${this.elementClassName}__button ${this.elementClassName}__button--increment`, onClick: this.handleMinuteIncrement, disabled: this.disabled, "aria-label": this.labels.incrementMinutes }, h("svg", { key: '683cb78389935a9a68e59d875df60dc168ca5a4b', 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: '21084833e0479ace54ee23b2b9a39276752d6467', points: "18 15 12 9 6 15" }))), h("input", { key: '07d608da760816c37ae394fe5798ad25ca0c17db', 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: '07aee6f5f9b6cfe23fa50ae9ad2319f627c9efe2', type: "button", class: `${this.elementClassName}__button ${this.elementClassName}__button--decrement`, onClick: this.handleMinuteDecrement, disabled: this.disabled, "aria-label": this.labels.decrementMinutes }, h("svg", { key: '3e284e93b451ab57b0c4e0a29b8c3953f5a79033', 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: '589c1da5150f4b3def68b9dcb14f2ee56b9022e2', points: "6 9 12 15 18 9" }))))), this.showSeconds && [
|
|
188
|
+
h("div", { key: '717844859ad07d5912fdd0b386151aeb40ccbf94', class: `${this.elementClassName}__separator` }, ":"),
|
|
189
|
+
h("div", { key: 'a27907f31a3d71abb9f7c5bce411569ddd22594d', class: `${this.elementClassName}__field` }, h("label", { key: 'c6312aeccdfe835aa0bd02bc7078b4a30aa70921', htmlFor: `${this.elementClassName}-seconds`, class: {
|
|
190
|
+
[`${this.elementClassName}__label`]: true,
|
|
191
|
+
[`${this.elementClassName}__label--sr-only`]: this.labelsSrOnly
|
|
192
|
+
} }, this.labels.seconds), h("div", { key: 'c347d3847e999a900cba2410dbc2c5711d01d746', class: `${this.elementClassName}__control` }, h("button", { key: 'b0862893f9d99e6ef7da0cfc02f6a6e1f0bc4443', type: "button", class: `${this.elementClassName}__button ${this.elementClassName}__button--increment`, onClick: this.handleSecondIncrement, disabled: this.disabled, "aria-label": this.labels.incrementSeconds }, h("svg", { key: 'b4032699911ed9e589c015b4c3b9d31766b53d38', 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: '5bfbeefa5ea9d4901a7bc08de5bf01578fbf6cec', points: "18 15 12 9 6 15" }))), h("input", { key: '3c7e4e5b4f7a162e9ce9efa815d1c180ff5395d2', id: `${this.elementClassName}-seconds`, type: "number", class: `${this.elementClassName}__input`, value: this.padZero(this.internalSeconds), min: 0, max: 59, onInput: this.handleSecondChange, disabled: this.disabled, "aria-label": this.labels.seconds }), h("button", { key: '6f5a37921ef128033fe8241b63903739f0ddc245', type: "button", class: `${this.elementClassName}__button ${this.elementClassName}__button--decrement`, onClick: this.handleSecondDecrement, disabled: this.disabled, "aria-label": this.labels.decrementSeconds }, h("svg", { key: '5c24cc5df194f53889ec353a5527c239df94a380', 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: '090946e452acf54e8bc491094573368160f55cbe', points: "6 9 12 15 18 9" })))))
|
|
193
|
+
], this.useTwelveHourFormat && (h("div", { key: '4bbd646f21dc099efc94e86b05ce35e22c28ee16', class: `${this.elementClassName}__period` }, h("button", { key: '3b41814b8fe32ffe3ef898fe816cc027440c6c2b', type: "button", class: {
|
|
163
194
|
[`${this.elementClassName}__period-button`]: true,
|
|
164
195
|
[`${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: '
|
|
196
|
+
}, onClick: () => this.handlePeriodChange("AM"), disabled: this.disabled, "aria-label": this.labels.am, "aria-pressed": this.period === "AM" }, this.labels.am), h("button", { key: 'fd9052000876c0516e13ab701a4e5164a7d72112', type: "button", class: {
|
|
166
197
|
[`${this.elementClassName}__period-button`]: true,
|
|
167
198
|
[`${this.elementClassName}__period-button--active`]: this.period === "PM"
|
|
168
199
|
}, onClick: () => this.handlePeriodChange("PM"), disabled: this.disabled, "aria-label": this.labels.pm, "aria-pressed": this.period === "PM" }, this.labels.pm))))));
|
|
@@ -174,6 +205,9 @@ const TabworthyTimesPicker = class {
|
|
|
174
205
|
}],
|
|
175
206
|
"minutes": [{
|
|
176
207
|
"watchMinutes": 0
|
|
208
|
+
}],
|
|
209
|
+
"seconds": [{
|
|
210
|
+
"watchSeconds": 0
|
|
177
211
|
}]
|
|
178
212
|
}; }
|
|
179
213
|
};
|
|
@@ -37,6 +37,8 @@ const InclusiveTimes = class {
|
|
|
37
37
|
this.referenceDate = getISODateString(new Date());
|
|
38
38
|
// Use 12-hour format with AM/PM
|
|
39
39
|
this.useTwelveHourFormat = true;
|
|
40
|
+
// Show seconds picker control
|
|
41
|
+
this.showSeconds = false;
|
|
40
42
|
// Labels used for internal translations
|
|
41
43
|
this.timesLabels = defaultLabels;
|
|
42
44
|
this.inline = false;
|
|
@@ -64,12 +66,17 @@ const InclusiveTimes = class {
|
|
|
64
66
|
this.inputShouldFormat = true;
|
|
65
67
|
this.disableFreeformInput = false;
|
|
66
68
|
this.inputClass = "";
|
|
67
|
-
this.selectedHours =
|
|
68
|
-
this.selectedMinutes =
|
|
69
|
+
this.selectedHours = new Date().getHours();
|
|
70
|
+
this.selectedMinutes = new Date().getMinutes();
|
|
71
|
+
this.selectedSeconds = new Date().getSeconds();
|
|
69
72
|
this.errorState = this.hasError;
|
|
70
73
|
this.disabledState = this.disabled;
|
|
71
74
|
this.errorMessage = "";
|
|
72
75
|
this.handlePickerSelection = async (dateString) => {
|
|
76
|
+
// Handle clear button click (calendar emits undefined)
|
|
77
|
+
if (!dateString) {
|
|
78
|
+
return this.clearValue();
|
|
79
|
+
}
|
|
73
80
|
const dates = dateString.split(",");
|
|
74
81
|
if (this.range && dates.length === 2) {
|
|
75
82
|
const startDate = removeTimezoneOffset(new Date(dates[0]));
|
|
@@ -92,6 +99,9 @@ const InclusiveTimes = class {
|
|
|
92
99
|
this.handleTimeChange = (event) => {
|
|
93
100
|
this.selectedHours = event.detail.hours;
|
|
94
101
|
this.selectedMinutes = event.detail.minutes;
|
|
102
|
+
if (event.detail.seconds !== undefined) {
|
|
103
|
+
this.selectedSeconds = event.detail.seconds;
|
|
104
|
+
}
|
|
95
105
|
// Update the value if we have a selected date
|
|
96
106
|
if (this.selectedDate) {
|
|
97
107
|
this.updateValue(this.selectedDate);
|
|
@@ -161,6 +171,7 @@ const InclusiveTimes = class {
|
|
|
161
171
|
this.selectedDate = parsed.toDate();
|
|
162
172
|
this.selectedHours = parsed.hours();
|
|
163
173
|
this.selectedMinutes = parsed.minutes();
|
|
174
|
+
this.selectedSeconds = parsed.seconds();
|
|
164
175
|
}
|
|
165
176
|
}
|
|
166
177
|
}
|
|
@@ -175,7 +186,7 @@ const InclusiveTimes = class {
|
|
|
175
186
|
const m = hooks(d);
|
|
176
187
|
m.hours(this.selectedHours);
|
|
177
188
|
m.minutes(this.selectedMinutes);
|
|
178
|
-
m.seconds(
|
|
189
|
+
m.seconds(this.selectedSeconds);
|
|
179
190
|
return m.format(this.format);
|
|
180
191
|
});
|
|
181
192
|
this.internalValue = formattedDates;
|
|
@@ -187,7 +198,7 @@ const InclusiveTimes = class {
|
|
|
187
198
|
const m = hooks(date);
|
|
188
199
|
m.hours(this.selectedHours);
|
|
189
200
|
m.minutes(this.selectedMinutes);
|
|
190
|
-
m.seconds(
|
|
201
|
+
m.seconds(this.selectedSeconds);
|
|
191
202
|
const formatted = m.format(this.format);
|
|
192
203
|
this.internalValue = formatted;
|
|
193
204
|
this.value = formatted;
|
|
@@ -229,7 +240,9 @@ const InclusiveTimes = class {
|
|
|
229
240
|
this.internalValue = null;
|
|
230
241
|
this.value = undefined;
|
|
231
242
|
this.selectedDate = undefined;
|
|
232
|
-
this.inputRef
|
|
243
|
+
if (this.inputRef) {
|
|
244
|
+
this.inputRef.value = "";
|
|
245
|
+
}
|
|
233
246
|
if (this.pickerRef) {
|
|
234
247
|
this.pickerRef.value = null;
|
|
235
248
|
}
|
|
@@ -237,10 +250,10 @@ const InclusiveTimes = class {
|
|
|
237
250
|
}
|
|
238
251
|
render() {
|
|
239
252
|
var _a;
|
|
240
|
-
return (h(Host, { key: '
|
|
253
|
+
return (h(Host, { key: 'de07eab0ee0cd6624756ce18a0dcc38a509692e4', class: this.elementClassName, "has-error": this.errorState, disabled: this.disabledState }, h("label", { key: '666a1cd43b7c2d1633210d7422ec8d2c3fc44e44', htmlFor: `${this.id}-input`, class: this.getClassName("label") }, this.label), h("div", { key: '222432b8a431bac954fb625f5b724df077d9feeb', class: this.getClassName("input-container"), ref: (r) => (this.inputContainerRef = r) }, h("input", { key: 'c3284e4348cd736f2edf708978956fb88f78118a', id: `${this.id}-input`, ref: (r) => (this.inputRef = r), type: "text", class: {
|
|
241
254
|
[this.getClassName("input")]: true,
|
|
242
255
|
[this.inputClass]: !!this.inputClass
|
|
243
|
-
}, 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: '
|
|
256
|
+
}, placeholder: this.placeholder, disabled: this.disabledState || this.disableFreeformInput, value: (_a = this.internalValue) === null || _a === void 0 ? void 0 : _a.toString(), onBlur: this.handleInputBlur, onChange: this.handleInputChange, "aria-describedby": this.errorState ? `${this.id}-error` : undefined, "aria-invalid": this.errorState }), !this.inline && (h("button", { key: '9087c6b9cec31990b13ba6a1a7ad66f937ddee3a', type: "button", onClick: this.handleCalendarButtonClick, class: this.getClassName("calendar-button"), disabled: this.disabledState }, this.calendarButtonContent ? (h("span", { innerHTML: this.calendarButtonContent })) : (this.timesLabels.openCalendar)))), h("tabworthy-dates-modal", { key: '79613c7af13afe36e03cfede116b260f9d1d2b63', label: this.timesLabels.calendar, ref: (el) => (this.modalRef = el), onOpened: () => {
|
|
244
257
|
if (this.pickerRef) {
|
|
245
258
|
this.pickerRef.modalIsOpen = true;
|
|
246
259
|
}
|
|
@@ -248,7 +261,7 @@ const InclusiveTimes = class {
|
|
|
248
261
|
if (this.pickerRef) {
|
|
249
262
|
this.pickerRef.modalIsOpen = false;
|
|
250
263
|
}
|
|
251
|
-
}, inline: this.inline, appendTo: this.appendTo }, h("div", { key: '
|
|
264
|
+
}, inline: this.inline, appendTo: this.appendTo }, h("div", { key: '716440a779e1e614fbef292c7c1cc801cde57ee6', class: this.getClassName("picker-container") }, h("tabworthy-dates-calendar", { key: '02579a80370918076f36e04f64b6626893acf1cd', range: this.range, locale: this.locale, onSelectDate: (event) => this.handlePickerSelection(event.detail), onChangeMonth: (event) => this.handleChangedMonths(event.detail), onChangeYear: (event) => this.handleYearChange(event.detail), onRequestClose: () => { var _a; return (_a = this.modalRef) === null || _a === void 0 ? void 0 : _a.close(); }, labels: this.datesCalendarLabels, ref: (el) => (this.pickerRef = el), startDate: this.startDate, firstDayOfWeek: this.firstDayOfWeek, showHiddenTitle: true, disabled: this.disabledState, showMonthStepper: this.showMonthStepper, showYearStepper: this.showYearStepper, showClearButton: this.showClearButton, showCloseButton: this.showCloseButton, showTodayButton: this.showTodayButton, disableDate: this.disableDate, minDate: this.minDate, maxDate: this.maxDate, inline: this.inline, value: this.value ? this.toDate(this.value) : undefined }, h("div", { key: 'df629acf66bc6a83c7c0601f6cff39a8a27ddba2', slot: "after-calendar", class: this.getClassName("time-section") }, h("hr", { key: '084ba933dbe96086d9c8f21494e4016eb6d3ac66', class: this.getClassName("divider") }), h("tabworthy-times-picker", { key: '788081745c21b0702fcc0f8d79f0c6fe88b4372d', hours: this.selectedHours, minutes: this.selectedMinutes, seconds: this.selectedSeconds, showSeconds: this.showSeconds, useTwelveHourFormat: this.useTwelveHourFormat, disabled: this.disabledState, onTimeChanged: this.handleTimeChange, labels: this.timesPickerLabels }))))), this.errorState && (h("div", { key: '0742a70dcb66f4523131c29d60f2056c9cf94320', class: this.getClassName("input-error"), id: this.id ? `${this.id}-error` : undefined, role: "status" }, this.errorMessage))));
|
|
252
265
|
}
|
|
253
266
|
get el() { return getElement(this); }
|
|
254
267
|
static get watchers() { return {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,c as s,h as e,H as i,g as h}from"./p-CwtZ_Lud.js";const a={hours:"Hours",minutes:"Minutes",seconds:"Seconds",am:"AM",pm:"PM",timePicker:"Time picker",incrementHours:"Increment hours",decrementHours:"Decrement hours",incrementMinutes:"Increment minutes",decrementMinutes:"Decrement minutes",incrementSeconds:"Increment seconds",decrementSeconds:"Decrement seconds"},n=class{constructor(e){t(this,e),this.timeChanged=s(this,"timeChanged",7),this.hours=12,this.minutes=0,this.seconds=0,this.useTwelveHourFormat=!1,this.showSeconds=!1,this.labels=a,this.labelsSrOnly=!0,this.disabled=!1,this.elementClassName="tabworthy-times-picker",this.internalHours=this.hours,this.internalMinutes=this.minutes,this.internalSeconds=this.seconds,this.period=this.hours>=12?"PM":"AM",this.handleHourChange=t=>{const s=parseInt(t.target.value,10);this.internalHours=this.useTwelveHourFormat?"AM"===this.period?12===s?0:s:12===s?12:s+12:s,this.emitTimeChange()},this.handleMinuteChange=t=>{this.internalMinutes=parseInt(t.target.value,10),this.emitTimeChange()},this.handlePeriodChange=t=>{if(this.period===t||!this.useTwelveHourFormat)return;this.period=t;const s=this.getDisplayHours();this.internalHours="AM"===t?12===s?0:s:12===s?12:s+12,this.emitTimeChange()},this.handleHourIncrement=()=>{if(this.useTwelveHourFormat){const t=this.getDisplayHours(),s=12===t?1:t+1;this.internalHours="AM"===this.period?12===s?0:s:12===s?12:s+12}else this.internalHours=(this.internalHours+1)%24;this.emitTimeChange()},this.handleHourDecrement=()=>{if(this.useTwelveHourFormat){const t=this.getDisplayHours(),s=1===t?12:t-1;this.internalHours="AM"===this.period?12===s?0:s:12===s?12:s+12}else this.internalHours=0===this.internalHours?23:this.internalHours-1;this.emitTimeChange()},this.handleMinuteIncrement=()=>{this.internalMinutes=(this.internalMinutes+1)%60,this.emitTimeChange()},this.handleMinuteDecrement=()=>{this.internalMinutes=0===this.internalMinutes?59:this.internalMinutes-1,this.emitTimeChange()},this.handleSecondChange=t=>{this.internalSeconds=parseInt(t.target.value,10),this.emitTimeChange()},this.handleSecondIncrement=()=>{this.internalSeconds=(this.internalSeconds+1)%60,this.emitTimeChange()},this.handleSecondDecrement=()=>{this.internalSeconds=0===this.internalSeconds?59:this.internalSeconds-1,this.emitTimeChange()}}watchHours(t){this.internalHours=t,this.period=t>=12?"PM":"AM"}watchMinutes(t){this.internalMinutes=t}watchSeconds(t){this.internalSeconds=t}componentWillLoad(){this.internalHours=this.hours,this.internalMinutes=this.minutes,this.internalSeconds=this.seconds,this.period=this.hours>=12?"PM":"AM"}getDisplayHours(){return this.useTwelveHourFormat?0===this.internalHours?12:this.internalHours>12?this.internalHours-12:this.internalHours:this.internalHours}get24HourValue(){if(!this.useTwelveHourFormat)return this.internalHours;const t=this.getDisplayHours();return"AM"===this.period?12===t?0:t:12===t?12:t+12}emitTimeChange(){this.timeChanged.emit({hours:this.get24HourValue(),minutes:this.internalMinutes,seconds:this.showSeconds?this.internalSeconds:void 0,period:this.useTwelveHourFormat?this.period:void 0})}padZero(t){return t.toString().padStart(2,"0")}render(){const t=this.getDisplayHours(),s=this.useTwelveHourFormat?12:23,h=this.useTwelveHourFormat?1:0;return e(i,{key:"be075e309d41904bf237c3a4b31b063ac4d1a7e0",class:this.elementClassName,"aria-label":this.labels.timePicker},e("div",{key:"39d3a55428ad6f567490aa9a55ab94766de39e7f",class:`${this.elementClassName}__container`},e("div",{key:"5efcc6b13a4473d5d889689d205128b328ae9417",class:`${this.elementClassName}__field`},e("label",{key:"f2e760229dd54d2265539e924dc133eda7f53fb8",htmlFor:`${this.elementClassName}-hours`,class:{[`${this.elementClassName}__label`]:!0,[`${this.elementClassName}__label--sr-only`]:this.labelsSrOnly}},this.labels.hours),e("div",{key:"a1f92371d923c50adb423d8fa36d84fe632fcdcb",class:`${this.elementClassName}__control`},e("button",{key:"ce1a13d5d97f664cd5a7ef9ac144cb2d7a76b0e3",type:"button",class:`${this.elementClassName}__button ${this.elementClassName}__button--increment`,onClick:this.handleHourIncrement,disabled:this.disabled,"aria-label":this.labels.incrementHours},e("svg",{key:"9f4f27bc5e3ecc1da7f9520c5a67bef79b546229",fill:"none",height:"16","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"16"},e("polyline",{key:"2537a3c151f846b52f427bff20145dd581b2db7b",points:"18 15 12 9 6 15"}))),e("input",{key:"dbe3c7e05bf44f2942f38e397fa8abcd5ec9a080",id:`${this.elementClassName}-hours`,type:"number",class:`${this.elementClassName}__input`,value:this.padZero(t),min:h,max:s,onInput:this.handleHourChange,disabled:this.disabled,"aria-label":this.labels.hours}),e("button",{key:"69e610902e8324369a57f5943699f019533f9b0a",type:"button",class:`${this.elementClassName}__button ${this.elementClassName}__button--decrement`,onClick:this.handleHourDecrement,disabled:this.disabled,"aria-label":this.labels.decrementHours},e("svg",{key:"fd3a91c8c82abb4ba948c1735a4d6b1ab9879452",fill:"none",height:"16","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"16"},e("polyline",{key:"f2fb31860bc57fe95b78e0331d4dce611976f1cc",points:"6 9 12 15 18 9"}))))),e("div",{key:"5f488705145ebbaaba10f7e0370dd614e5ac9c91",class:`${this.elementClassName}__separator`},":"),e("div",{key:"c886bc72ad9098a1015d97cdb64d609d10b4b7c0",class:`${this.elementClassName}__field`},e("label",{key:"3590285320f4ee5403e41cceb964aa2440ee3caa",htmlFor:`${this.elementClassName}-minutes`,class:{[`${this.elementClassName}__label`]:!0,[`${this.elementClassName}__label--sr-only`]:this.labelsSrOnly}},this.labels.minutes),e("div",{key:"0e4271bc5e35b9664ef599af056c997a0b09c64f",class:`${this.elementClassName}__control`},e("button",{key:"29d095829fb141f2f2495a5cbc4bb7f28f39b54b",type:"button",class:`${this.elementClassName}__button ${this.elementClassName}__button--increment`,onClick:this.handleMinuteIncrement,disabled:this.disabled,"aria-label":this.labels.incrementMinutes},e("svg",{key:"683cb78389935a9a68e59d875df60dc168ca5a4b",fill:"none",height:"16","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"16"},e("polyline",{key:"21084833e0479ace54ee23b2b9a39276752d6467",points:"18 15 12 9 6 15"}))),e("input",{key:"07d608da760816c37ae394fe5798ad25ca0c17db",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}),e("button",{key:"07aee6f5f9b6cfe23fa50ae9ad2319f627c9efe2",type:"button",class:`${this.elementClassName}__button ${this.elementClassName}__button--decrement`,onClick:this.handleMinuteDecrement,disabled:this.disabled,"aria-label":this.labels.decrementMinutes},e("svg",{key:"3e284e93b451ab57b0c4e0a29b8c3953f5a79033",fill:"none",height:"16","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"16"},e("polyline",{key:"589c1da5150f4b3def68b9dcb14f2ee56b9022e2",points:"6 9 12 15 18 9"}))))),this.showSeconds&&[e("div",{key:"717844859ad07d5912fdd0b386151aeb40ccbf94",class:`${this.elementClassName}__separator`},":"),e("div",{key:"a27907f31a3d71abb9f7c5bce411569ddd22594d",class:`${this.elementClassName}__field`},e("label",{key:"c6312aeccdfe835aa0bd02bc7078b4a30aa70921",htmlFor:`${this.elementClassName}-seconds`,class:{[`${this.elementClassName}__label`]:!0,[`${this.elementClassName}__label--sr-only`]:this.labelsSrOnly}},this.labels.seconds),e("div",{key:"c347d3847e999a900cba2410dbc2c5711d01d746",class:`${this.elementClassName}__control`},e("button",{key:"b0862893f9d99e6ef7da0cfc02f6a6e1f0bc4443",type:"button",class:`${this.elementClassName}__button ${this.elementClassName}__button--increment`,onClick:this.handleSecondIncrement,disabled:this.disabled,"aria-label":this.labels.incrementSeconds},e("svg",{key:"b4032699911ed9e589c015b4c3b9d31766b53d38",fill:"none",height:"16","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"16"},e("polyline",{key:"5bfbeefa5ea9d4901a7bc08de5bf01578fbf6cec",points:"18 15 12 9 6 15"}))),e("input",{key:"3c7e4e5b4f7a162e9ce9efa815d1c180ff5395d2",id:`${this.elementClassName}-seconds`,type:"number",class:`${this.elementClassName}__input`,value:this.padZero(this.internalSeconds),min:0,max:59,onInput:this.handleSecondChange,disabled:this.disabled,"aria-label":this.labels.seconds}),e("button",{key:"6f5a37921ef128033fe8241b63903739f0ddc245",type:"button",class:`${this.elementClassName}__button ${this.elementClassName}__button--decrement`,onClick:this.handleSecondDecrement,disabled:this.disabled,"aria-label":this.labels.decrementSeconds},e("svg",{key:"5c24cc5df194f53889ec353a5527c239df94a380",fill:"none",height:"16","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"16"},e("polyline",{key:"090946e452acf54e8bc491094573368160f55cbe",points:"6 9 12 15 18 9"})))))],this.useTwelveHourFormat&&e("div",{key:"4bbd646f21dc099efc94e86b05ce35e22c28ee16",class:`${this.elementClassName}__period`},e("button",{key:"3b41814b8fe32ffe3ef898fe816cc027440c6c2b",type:"button",class:{[`${this.elementClassName}__period-button`]:!0,[`${this.elementClassName}__period-button--active`]:"AM"===this.period},onClick:()=>this.handlePeriodChange("AM"),disabled:this.disabled,"aria-label":this.labels.am,"aria-pressed":"AM"===this.period},this.labels.am),e("button",{key:"fd9052000876c0516e13ab701a4e5164a7d72112",type:"button",class:{[`${this.elementClassName}__period-button`]:!0,[`${this.elementClassName}__period-button--active`]:"PM"===this.period},onClick:()=>this.handlePeriodChange("PM"),disabled:this.disabled,"aria-label":this.labels.pm,"aria-pressed":"PM"===this.period},this.labels.pm))))}get el(){return h(this)}static get watchers(){return{hours:[{watchHours:0}],minutes:[{watchMinutes:0}],seconds:[{watchSeconds:0}]}}};export{n as tabworthy_times_picker}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,c as s,h as i,H as e,g as h}from"./p-CwtZ_Lud.js";import{h as a}from"./p-Mki5YqAR.js";import{g as r,r as o}from"./p-BVHu5CWV.js";const n={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"},d=class{constructor(i){t(this,i),this.selectDateTime=s(this,"selectDateTime",7),this.changeYear=s(this,"changeYear",7),this.componentReady=s(this,"componentReady",7),this.range=!1,this.label="Choose a date and time",this.placeholder="",this.locale=(null===navigator||void 0===navigator?void 0:navigator.language)||"en-US",this.disabled=!1,this.startDate=r(new Date),this.referenceDate=r(new Date),this.useTwelveHourFormat=!0,this.showSeconds=!1,this.timesLabels=n,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=o(new Date(s[0])),i=o(new Date(s[1]));this.updateValue([t,i]),this.pickerRef&&(this.pickerRef.value=[t,i])}else{const t=o(new Date(s[0]));this.updateValue(t),this.pickerRef&&(this.pickerRef.value=t)}},this.handleTimeChange=t=>{this.selectedHours=t.detail.hours,this.selectedMinutes=t.detail.minutes,void 0!==t.detail.seconds&&(this.selectedSeconds=t.detail.seconds),this.selectedDate&&this.updateValue(this.selectedDate)},this.handleCalendarButtonClick=async()=>{this.modalRef&&(await this.modalRef.setTriggerElement(this.inputContainerRef),await this.modalRef.open())},this.handleYearChange=t=>{this.changeYear&&this.changeYear.emit(t)},this.handleChangedMonths=()=>{},this.handleInputBlur=()=>{this.shouldInputFormat()&&this.formatInput()},this.handleInputChange=t=>{const s=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(),this.selectedSeconds=s.seconds())}}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(this.selectedSeconds),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(this.selectedSeconds);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}`}toDate(t){return t?Array.isArray(t)?t.map((t=>a(t,this.format).toDate())):a(t,this.format).toDate():null}async clearValue(){this.internalValue=null,this.value=void 0,this.selectedDate=void 0,this.inputRef&&(this.inputRef.value=""),this.pickerRef&&(this.pickerRef.value=null),this.selectDateTime.emit(void 0)}render(){var t;return i(e,{key:"de07eab0ee0cd6624756ce18a0dcc38a509692e4",class:this.elementClassName,"has-error":this.errorState,disabled:this.disabledState},i("label",{key:"666a1cd43b7c2d1633210d7422ec8d2c3fc44e44",htmlFor:`${this.id}-input`,class:this.getClassName("label")},this.label),i("div",{key:"222432b8a431bac954fb625f5b724df077d9feeb",class:this.getClassName("input-container"),ref:t=>this.inputContainerRef=t},i("input",{key:"c3284e4348cd736f2edf708978956fb88f78118a",id:`${this.id}-input`,ref:t=>this.inputRef=t,type:"text",class:{[this.getClassName("input")]:!0,[this.inputClass]:!!this.inputClass},placeholder:this.placeholder,disabled:this.disabledState||this.disableFreeformInput,value:null===(t=this.internalValue)||void 0===t?void 0:t.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:"9087c6b9cec31990b13ba6a1a7ad66f937ddee3a",type:"button",onClick:this.handleCalendarButtonClick,class:this.getClassName("calendar-button"),disabled:this.disabledState},this.calendarButtonContent?i("span",{innerHTML:this.calendarButtonContent}):this.timesLabels.openCalendar)),i("tabworthy-dates-modal",{key:"79613c7af13afe36e03cfede116b260f9d1d2b63",label:this.timesLabels.calendar,ref:t=>this.modalRef=t,onOpened:()=>{this.pickerRef&&(this.pickerRef.modalIsOpen=!0)},onClosed:()=>{this.pickerRef&&(this.pickerRef.modalIsOpen=!1)},inline:this.inline,appendTo:this.appendTo},i("div",{key:"716440a779e1e614fbef292c7c1cc801cde57ee6",class:this.getClassName("picker-container")},i("tabworthy-dates-calendar",{key:"02579a80370918076f36e04f64b6626893acf1cd",range:this.range,locale:this.locale,onSelectDate:t=>this.handlePickerSelection(t.detail),onChangeMonth:t=>this.handleChangedMonths(t.detail),onChangeYear:t=>this.handleYearChange(t.detail),onRequestClose:()=>{var t;return null===(t=this.modalRef)||void 0===t?void 0:t.close()},labels:this.datesCalendarLabels,ref:t=>this.pickerRef=t,startDate:this.startDate,firstDayOfWeek:this.firstDayOfWeek,showHiddenTitle:!0,disabled:this.disabledState,showMonthStepper:this.showMonthStepper,showYearStepper:this.showYearStepper,showClearButton:this.showClearButton,showCloseButton:this.showCloseButton,showTodayButton:this.showTodayButton,disableDate:this.disableDate,minDate:this.minDate,maxDate:this.maxDate,inline:this.inline,value:this.value?this.toDate(this.value):void 0},i("div",{key:"df629acf66bc6a83c7c0601f6cff39a8a27ddba2",slot:"after-calendar",class:this.getClassName("time-section")},i("hr",{key:"084ba933dbe96086d9c8f21494e4016eb6d3ac66",class:this.getClassName("divider")}),i("tabworthy-times-picker",{key:"788081745c21b0702fcc0f8d79f0c6fe88b4372d",hours:this.selectedHours,minutes:this.selectedMinutes,seconds:this.selectedSeconds,showSeconds:this.showSeconds,useTwelveHourFormat:this.useTwelveHourFormat,disabled:this.disabledState,onTimeChanged:this.handleTimeChange,labels:this.timesPickerLabels}))))),this.errorState&&i("div",{key:"0742a70dcb66f4523131c29d60f2056c9cf94320",class:this.getClassName("input-error"),id:this.id?`${this.id}-error`:void 0,role:"status"},this.errorMessage))}get el(){return h(this)}static get watchers(){return{value:[{watchValue:0}],disabled:[{watchDisabled:0}],hasError:[{watchHasError:0}]}}};export{d as tabworthy_times}
|