@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
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -6,7 +6,7 @@ var appGlobals = require('./app-globals-V2Kpy_OQ.js');
|
|
|
6
6
|
const defineCustomElements = async (win, options) => {
|
|
7
7
|
if (typeof window === 'undefined') return undefined;
|
|
8
8
|
await appGlobals.globalScripts();
|
|
9
|
-
return index.bootstrapLazy([["tabworthy-times-picker.cjs",[[2,"tabworthy-times-picker",{"hours":[1026],"minutes":[1026],"
|
|
9
|
+
return index.bootstrapLazy([["tabworthy-times-picker.cjs",[[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.cjs",[[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.cjs",[[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.cjs",[[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);
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
exports.setNonce = index.setNonce;
|
|
@@ -19,7 +19,7 @@ var patchBrowser = () => {
|
|
|
19
19
|
|
|
20
20
|
patchBrowser().then(async (options) => {
|
|
21
21
|
await appGlobals.globalScripts();
|
|
22
|
-
return index.bootstrapLazy([["tabworthy-times-picker.cjs",[[2,"tabworthy-times-picker",{"hours":[1026],"minutes":[1026],"
|
|
22
|
+
return index.bootstrapLazy([["tabworthy-times-picker.cjs",[[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.cjs",[[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.cjs",[[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.cjs",[[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);
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
exports.setNonce = index.setNonce;
|
|
@@ -10543,6 +10543,7 @@ const TabworthyDates = class {
|
|
|
10543
10543
|
// Show or hide the quick buttons
|
|
10544
10544
|
this.showQuickButtons = true;
|
|
10545
10545
|
this.disableFreeformInput = false;
|
|
10546
|
+
this.inputClass = "";
|
|
10546
10547
|
this.errorState = this.hasError;
|
|
10547
10548
|
this.disabledState = this.disabled;
|
|
10548
10549
|
this.chronoSupportedLocale = ["en", "ja", "fr", "nl", "ru", "pt"].includes(this.locale.slice(0, 2));
|
|
@@ -10895,7 +10896,10 @@ const TabworthyDates = class {
|
|
|
10895
10896
|
}
|
|
10896
10897
|
render() {
|
|
10897
10898
|
var _a;
|
|
10898
|
-
return (index$1.h(index$1.Host, { key: '
|
|
10899
|
+
return (index$1.h(index$1.Host, { key: 'd424c911d4fd2d05222249b401e9b704430e6f29' }, index$1.h("label", { key: 'd14130a7b0b02e7124f7c7e9ec0642620da7aab6', htmlFor: this.id ? `${this.id}-input` : undefined, class: this.getClassName("label") }, this.label), index$1.h("br", { key: 'c4f5397785326f323772f46a8cfb6d868f5ff230' }), index$1.h("div", { key: '9f52005781b9a54426ee3c094727b8890681a4d5', class: this.getClassName("input-container") }, index$1.h("input", { key: 'e67af61ef75a592acadcfbd14da4527b84b08417', disabled: this.disabledState || this.disableFreeformInput, id: this.id ? `${this.id}-input` : undefined, type: "text", placeholder: this.placeholder, class: {
|
|
10900
|
+
[this.getClassName("input")]: true,
|
|
10901
|
+
[this.inputClass]: !!this.inputClass
|
|
10902
|
+
}, 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 && (index$1.h("button", { key: 'dd9421438de95497d2e7037cfc927bb0f27cd3c0', type: "button", ref: (r) => (this.calendarButtonRef = r), onClick: this.handleCalendarButtonClick, class: this.getClassName("calendar-button"), disabled: this.disabledState }, this.calendarButtonContent ? (index$1.h("span", { innerHTML: this.calendarButtonContent })) : (this.datesLabels.openCalendar)))), index$1.h("tabworthy-dates-modal", { key: 'b8a3278a07bc1ddc36eac5a0c9808595c4bcdde5', label: this.datesLabels.calendar, ref: (el) => (this.modalRef = el), onOpened: () => {
|
|
10899
10903
|
if (!this.pickerRef)
|
|
10900
10904
|
return;
|
|
10901
10905
|
this.pickerRef.modalIsOpen = true;
|
|
@@ -10903,11 +10907,11 @@ const TabworthyDates = class {
|
|
|
10903
10907
|
if (!this.pickerRef)
|
|
10904
10908
|
return;
|
|
10905
10909
|
this.pickerRef.modalIsOpen = false;
|
|
10906
|
-
}, inline: this.inline }, index$1.h("tabworthy-dates-calendar", { key: '
|
|
10910
|
+
}, inline: this.inline }, index$1.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 &&
|
|
10907
10911
|
((_a = this.quickButtons) === null || _a === void 0 ? void 0 : _a.length) > 0 &&
|
|
10908
|
-
this.chronoSupportedLocale && (index$1.h("div", { key: '
|
|
10912
|
+
this.chronoSupportedLocale && (index$1.h("div", { key: '1bb09b44a219648203d803c76d17a9b41b0278bf', class: this.getClassName("quick-group"), role: "group", "aria-label": "Quick selection" }, this.quickButtons.map((buttonText) => {
|
|
10909
10913
|
return (index$1.h("button", { class: this.getClassName("quick-button"), onClick: this.handleQuickButtonClick, disabled: this.disabledState, type: "button" }, buttonText));
|
|
10910
|
-
}))), this.errorState && (index$1.h("div", { key: '
|
|
10914
|
+
}))), this.errorState && (index$1.h("div", { key: '92d843bf6d0234568bf41a0fd2fdf281cb48487f', class: this.getClassName("input-error"), id: this.id ? `${this.id}-error` : undefined, role: "status" }, this.errorMessage))));
|
|
10911
10915
|
}
|
|
10912
10916
|
get el() { return index$1.getElement(this); }
|
|
10913
10917
|
static get watchers() { return {
|
|
@@ -20,7 +20,7 @@ const InclusiveTimesPicker = class {
|
|
|
20
20
|
// Current time value (24-hour format)
|
|
21
21
|
this.hours = 12;
|
|
22
22
|
this.minutes = 0;
|
|
23
|
-
this.
|
|
23
|
+
this.useTwelveHourFormat = false;
|
|
24
24
|
// Labels for accessibility and i18n
|
|
25
25
|
this.labels = defaultLabels;
|
|
26
26
|
// Hide labels visually but keep them for screen readers
|
|
@@ -32,7 +32,7 @@ const InclusiveTimesPicker = class {
|
|
|
32
32
|
this.period = this.hours >= 12 ? "PM" : "AM";
|
|
33
33
|
this.handleHourChange = (e) => {
|
|
34
34
|
const value = parseInt(e.target.value, 10);
|
|
35
|
-
if (this.
|
|
35
|
+
if (this.useTwelveHourFormat) {
|
|
36
36
|
// Convert to 24-hour format based on period
|
|
37
37
|
if (this.period === "AM") {
|
|
38
38
|
this.internalHours = value === 12 ? 0 : value;
|
|
@@ -51,7 +51,7 @@ const InclusiveTimesPicker = class {
|
|
|
51
51
|
this.emitTimeChange();
|
|
52
52
|
};
|
|
53
53
|
this.handlePeriodChange = (period) => {
|
|
54
|
-
if (this.period === period || !this.
|
|
54
|
+
if (this.period === period || !this.useTwelveHourFormat)
|
|
55
55
|
return;
|
|
56
56
|
this.period = period;
|
|
57
57
|
// Convert hours based on new period
|
|
@@ -65,7 +65,7 @@ const InclusiveTimesPicker = class {
|
|
|
65
65
|
this.emitTimeChange();
|
|
66
66
|
};
|
|
67
67
|
this.handleHourIncrement = () => {
|
|
68
|
-
if (this.
|
|
68
|
+
if (this.useTwelveHourFormat) {
|
|
69
69
|
const displayHours = this.getDisplayHours();
|
|
70
70
|
const newDisplayHours = displayHours === 12 ? 1 : displayHours + 1;
|
|
71
71
|
if (this.period === "AM") {
|
|
@@ -81,7 +81,7 @@ const InclusiveTimesPicker = class {
|
|
|
81
81
|
this.emitTimeChange();
|
|
82
82
|
};
|
|
83
83
|
this.handleHourDecrement = () => {
|
|
84
|
-
if (this.
|
|
84
|
+
if (this.useTwelveHourFormat) {
|
|
85
85
|
const displayHours = this.getDisplayHours();
|
|
86
86
|
const newDisplayHours = displayHours === 1 ? 12 : displayHours - 1;
|
|
87
87
|
if (this.period === "AM") {
|
|
@@ -120,7 +120,7 @@ const InclusiveTimesPicker = class {
|
|
|
120
120
|
this.period = this.hours >= 12 ? "PM" : "AM";
|
|
121
121
|
}
|
|
122
122
|
getDisplayHours() {
|
|
123
|
-
if (!this.
|
|
123
|
+
if (!this.useTwelveHourFormat) {
|
|
124
124
|
return this.internalHours;
|
|
125
125
|
}
|
|
126
126
|
if (this.internalHours === 0)
|
|
@@ -130,7 +130,7 @@ const InclusiveTimesPicker = class {
|
|
|
130
130
|
return this.internalHours;
|
|
131
131
|
}
|
|
132
132
|
get24HourValue() {
|
|
133
|
-
if (!this.
|
|
133
|
+
if (!this.useTwelveHourFormat) {
|
|
134
134
|
return this.internalHours;
|
|
135
135
|
}
|
|
136
136
|
const displayHours = this.getDisplayHours();
|
|
@@ -145,7 +145,7 @@ const InclusiveTimesPicker = class {
|
|
|
145
145
|
this.timeChanged.emit({
|
|
146
146
|
hours: this.get24HourValue(),
|
|
147
147
|
minutes: this.internalMinutes,
|
|
148
|
-
period: this.
|
|
148
|
+
period: this.useTwelveHourFormat ? this.period : undefined
|
|
149
149
|
});
|
|
150
150
|
}
|
|
151
151
|
padZero(num) {
|
|
@@ -153,18 +153,18 @@ const InclusiveTimesPicker = class {
|
|
|
153
153
|
}
|
|
154
154
|
render() {
|
|
155
155
|
const displayHours = this.getDisplayHours();
|
|
156
|
-
const maxHours = this.
|
|
157
|
-
const minHours = this.
|
|
158
|
-
return (index.h(index.Host, { key: '
|
|
156
|
+
const maxHours = this.useTwelveHourFormat ? 12 : 23;
|
|
157
|
+
const minHours = this.useTwelveHourFormat ? 1 : 0;
|
|
158
|
+
return (index.h(index.Host, { key: '6ccec0415bd1c35275e125355f69e871a2b3dc18', class: this.elementClassName, "aria-label": this.labels.timePicker }, index.h("div", { key: '52849e2d4e8ad6183d3017277f11fbd5bc3643c5', class: `${this.elementClassName}__container` }, index.h("div", { key: '9aa3980e371db20ae4ed4f590a0e9f49aa3d40cd', class: `${this.elementClassName}__field` }, index.h("label", { key: '77ea146e2d05b4bedec83a8d03096a6c51b6fd36', htmlFor: `${this.elementClassName}-hours`, class: {
|
|
159
159
|
[`${this.elementClassName}__label`]: true,
|
|
160
160
|
[`${this.elementClassName}__label--sr-only`]: this.labelsSrOnly
|
|
161
|
-
} }, this.labels.hours), index.h("div", { key: '
|
|
161
|
+
} }, this.labels.hours), index.h("div", { key: 'cf88cc85dce2a2e11e5e0ca61ab23d5bcc71b7be', class: `${this.elementClassName}__control` }, index.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 }, index.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" }, index.h("polyline", { key: '1d2c3fca6e81b9fdaab6f9b9f2c19f55b1af0ef5', points: "18 15 12 9 6 15" }))), index.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 }), index.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 }, index.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" }, index.h("polyline", { key: 'c8c08acec53576456b330c4f40a7879556704d0f', points: "6 9 12 15 18 9" }))))), index.h("div", { key: '3b8c0125c18518463de020682de4620d918a3463', class: `${this.elementClassName}__separator` }, ":"), index.h("div", { key: 'c54430db728d8f48320f4e4983a1d67a1ec8c78e', class: `${this.elementClassName}__field` }, index.h("label", { key: 'b47c7ae65c0b34b70673a8bd60c3b1496acf9540', htmlFor: `${this.elementClassName}-minutes`, class: {
|
|
162
162
|
[`${this.elementClassName}__label`]: true,
|
|
163
163
|
[`${this.elementClassName}__label--sr-only`]: this.labelsSrOnly
|
|
164
|
-
} }, this.labels.minutes), index.h("div", { key: '
|
|
164
|
+
} }, this.labels.minutes), index.h("div", { key: '9a4434d935f34bfd910e2ab7656fc125c05de9ca', class: `${this.elementClassName}__control` }, index.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 }, index.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" }, index.h("polyline", { key: '086fbe45c600657c2f6bf37e8415b87e8d763c3e', points: "18 15 12 9 6 15" }))), index.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 }), index.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 }, index.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" }, index.h("polyline", { key: '3da5561fb1f5bf1b07eb48de6e020047c1956158', points: "6 9 12 15 18 9" }))))), this.useTwelveHourFormat && (index.h("div", { key: '24c87e5e371f8a10816afcebb3dc2f7843fa89f5', class: `${this.elementClassName}__period` }, index.h("button", { key: '014126a0d5470d56ae384e12b2e196c3a9132700', type: "button", class: {
|
|
165
165
|
[`${this.elementClassName}__period-button`]: true,
|
|
166
166
|
[`${this.elementClassName}__period-button--active`]: this.period === "AM"
|
|
167
|
-
}, onClick: () => this.handlePeriodChange("AM"), disabled: this.disabled, "aria-label": this.labels.am, "aria-pressed": this.period === "AM" }, this.labels.am), index.h("button", { key: '
|
|
167
|
+
}, onClick: () => this.handlePeriodChange("AM"), disabled: this.disabled, "aria-label": this.labels.am, "aria-pressed": this.period === "AM" }, this.labels.am), index.h("button", { key: 'cf9f1f261456d7b5f64bf4b7d9ddbbb2e86d4447', type: "button", class: {
|
|
168
168
|
[`${this.elementClassName}__period-button`]: true,
|
|
169
169
|
[`${this.elementClassName}__period-button--active`]: this.period === "PM"
|
|
170
170
|
}, onClick: () => this.handlePeriodChange("PM"), disabled: this.disabled, "aria-label": this.labels.pm, "aria-pressed": this.period === "PM" }, this.labels.pm))))));
|
|
@@ -38,7 +38,7 @@ const InclusiveTimes = class {
|
|
|
38
38
|
// Reference date used for Chrono date parsing. Equals "today"
|
|
39
39
|
this.referenceDate = utils.getISODateString(new Date());
|
|
40
40
|
// Use 12-hour format with AM/PM
|
|
41
|
-
this.
|
|
41
|
+
this.useTwelveHourFormat = true;
|
|
42
42
|
// Labels used for internal translations
|
|
43
43
|
this.timesLabels = defaultLabels;
|
|
44
44
|
// Prevent hiding the calendar
|
|
@@ -64,6 +64,7 @@ const InclusiveTimes = class {
|
|
|
64
64
|
// If true, format input on blur/accept (like dates)
|
|
65
65
|
this.inputShouldFormat = true;
|
|
66
66
|
this.disableFreeformInput = false;
|
|
67
|
+
this.inputClass = "";
|
|
67
68
|
this.selectedHours = 12;
|
|
68
69
|
this.selectedMinutes = 0;
|
|
69
70
|
this.errorState = this.hasError;
|
|
@@ -228,7 +229,10 @@ const InclusiveTimes = class {
|
|
|
228
229
|
}
|
|
229
230
|
render() {
|
|
230
231
|
var _a;
|
|
231
|
-
return (index.h(index.Host, { key: '
|
|
232
|
+
return (index.h(index.Host, { key: 'a2bfc28b058319e0e1c723483c0f98aae766a371', class: this.elementClassName, "has-error": this.errorState, disabled: this.disabledState }, index.h("label", { key: '072b5974746736864e482853198409c969dff6d7', htmlFor: `${this.id}-input`, class: this.getClassName("label") }, this.label), index.h("div", { key: 'bcc38045d990ce22960cdbfbbf43a218b05cdb12', class: this.getClassName("input-container") }, index.h("input", { key: 'e741093da1a37022ad73bd27fc2aecfaa39b5a6c', id: `${this.id}-input`, ref: (r) => (this.inputRef = r), type: "text", class: {
|
|
233
|
+
[this.getClassName("input")]: true,
|
|
234
|
+
[this.inputClass]: !!this.inputClass
|
|
235
|
+
}, 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 && (index.h("button", { key: '9c088d60d8ed20d6e385bd2467766091a0ffab60', type: "button", ref: (r) => (this.calendarButtonRef = r), onClick: this.handleCalendarButtonClick, class: this.getClassName("calendar-button"), disabled: this.disabledState }, this.calendarButtonContent ? (index.h("span", { innerHTML: this.calendarButtonContent })) : (this.timesLabels.openCalendar)))), index.h("tabworthy-dates-modal", { key: 'a2df562a114f9131b8a43d7f226d09b07cd21c63', label: this.timesLabels.calendar, ref: (el) => (this.modalRef = el), onOpened: () => {
|
|
232
236
|
if (this.pickerRef) {
|
|
233
237
|
this.pickerRef.modalIsOpen = true;
|
|
234
238
|
}
|
|
@@ -236,7 +240,7 @@ const InclusiveTimes = class {
|
|
|
236
240
|
if (this.pickerRef) {
|
|
237
241
|
this.pickerRef.modalIsOpen = false;
|
|
238
242
|
}
|
|
239
|
-
}, inline: this.inline }, index.h("div", { key: '
|
|
243
|
+
}, inline: this.inline }, index.h("div", { key: 'c02d2c09cbb10a99d65cdd37723dcb0b30c31800', class: this.getClassName("picker-container") }, index.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 }, index.h("div", { key: '1c2d6e1f290ef75840fd5ea33dd7debbe10d6cf4', slot: "after-calendar", class: this.getClassName("time-section") }, index.h("hr", { key: '34ed116961c27d81a4daf44c5c9325fad4b491fe', class: this.getClassName("divider") }), index.h("tabworthy-times-picker", { key: '5862db463ee502572c6d04bc039ddf8a51455511', hours: this.selectedHours, minutes: this.selectedMinutes, useTwelveHourFormat: this.useTwelveHourFormat, disabled: this.disabledState, onTimeChanged: this.handleTimeChange }))))), this.errorState && (index.h("div", { key: '2dccd8a4b09eed861c3e9c9ee9a02163ef2b0149', class: this.getClassName("input-error"), id: this.id ? `${this.id}-error` : undefined, role: "status" }, this.errorMessage))));
|
|
240
244
|
}
|
|
241
245
|
get el() { return index.getElement(this); }
|
|
242
246
|
static get watchers() { return {
|
|
@@ -70,6 +70,7 @@ export class TabworthyDates {
|
|
|
70
70
|
// Show or hide the quick buttons
|
|
71
71
|
this.showQuickButtons = true;
|
|
72
72
|
this.disableFreeformInput = false;
|
|
73
|
+
this.inputClass = "";
|
|
73
74
|
this.errorState = this.hasError;
|
|
74
75
|
this.disabledState = this.disabled;
|
|
75
76
|
this.chronoSupportedLocale = ["en", "ja", "fr", "nl", "ru", "pt"].includes(this.locale.slice(0, 2));
|
|
@@ -422,7 +423,10 @@ export class TabworthyDates {
|
|
|
422
423
|
}
|
|
423
424
|
render() {
|
|
424
425
|
var _a;
|
|
425
|
-
return (h(Host, { key: '
|
|
426
|
+
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: {
|
|
427
|
+
[this.getClassName("input")]: true,
|
|
428
|
+
[this.inputClass]: !!this.inputClass
|
|
429
|
+
}, 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: () => {
|
|
426
430
|
if (!this.pickerRef)
|
|
427
431
|
return;
|
|
428
432
|
this.pickerRef.modalIsOpen = true;
|
|
@@ -430,11 +434,11 @@ export class TabworthyDates {
|
|
|
430
434
|
if (!this.pickerRef)
|
|
431
435
|
return;
|
|
432
436
|
this.pickerRef.modalIsOpen = false;
|
|
433
|
-
}, inline: this.inline }, h("tabworthy-dates-calendar", { key: '
|
|
437
|
+
}, 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 &&
|
|
434
438
|
((_a = this.quickButtons) === null || _a === void 0 ? void 0 : _a.length) > 0 &&
|
|
435
|
-
this.chronoSupportedLocale && (h("div", { key: '
|
|
439
|
+
this.chronoSupportedLocale && (h("div", { key: '1bb09b44a219648203d803c76d17a9b41b0278bf', class: this.getClassName("quick-group"), role: "group", "aria-label": "Quick selection" }, this.quickButtons.map((buttonText) => {
|
|
436
440
|
return (h("button", { class: this.getClassName("quick-button"), onClick: this.handleQuickButtonClick, disabled: this.disabledState, type: "button" }, buttonText));
|
|
437
|
-
}))), this.errorState && (h("div", { key: '
|
|
441
|
+
}))), this.errorState && (h("div", { key: '92d843bf6d0234568bf41a0fd2fdf281cb48487f', class: this.getClassName("input-error"), id: this.id ? `${this.id}-error` : undefined, role: "status" }, this.errorMessage))));
|
|
438
442
|
}
|
|
439
443
|
static get is() { return "tabworthy-dates"; }
|
|
440
444
|
static get encapsulation() { return "scoped"; }
|
|
@@ -964,7 +968,7 @@ export class TabworthyDates {
|
|
|
964
968
|
"references": {}
|
|
965
969
|
},
|
|
966
970
|
"required": false,
|
|
967
|
-
"optional":
|
|
971
|
+
"optional": false,
|
|
968
972
|
"docs": {
|
|
969
973
|
"tags": [],
|
|
970
974
|
"text": ""
|
|
@@ -1110,6 +1114,26 @@ export class TabworthyDates {
|
|
|
1110
1114
|
"reflect": false,
|
|
1111
1115
|
"attribute": "disable-freeform-input",
|
|
1112
1116
|
"defaultValue": "false"
|
|
1117
|
+
},
|
|
1118
|
+
"inputClass": {
|
|
1119
|
+
"type": "string",
|
|
1120
|
+
"mutable": false,
|
|
1121
|
+
"complexType": {
|
|
1122
|
+
"original": "string",
|
|
1123
|
+
"resolved": "string",
|
|
1124
|
+
"references": {}
|
|
1125
|
+
},
|
|
1126
|
+
"required": false,
|
|
1127
|
+
"optional": false,
|
|
1128
|
+
"docs": {
|
|
1129
|
+
"tags": [],
|
|
1130
|
+
"text": ""
|
|
1131
|
+
},
|
|
1132
|
+
"getter": false,
|
|
1133
|
+
"setter": false,
|
|
1134
|
+
"reflect": false,
|
|
1135
|
+
"attribute": "input-class",
|
|
1136
|
+
"defaultValue": "\"\""
|
|
1113
1137
|
}
|
|
1114
1138
|
};
|
|
1115
1139
|
}
|
|
@@ -31,7 +31,7 @@ export class InclusiveTimes {
|
|
|
31
31
|
// Reference date used for Chrono date parsing. Equals "today"
|
|
32
32
|
this.referenceDate = getISODateString(new Date());
|
|
33
33
|
// Use 12-hour format with AM/PM
|
|
34
|
-
this.
|
|
34
|
+
this.useTwelveHourFormat = true;
|
|
35
35
|
// Labels used for internal translations
|
|
36
36
|
this.timesLabels = defaultLabels;
|
|
37
37
|
// Prevent hiding the calendar
|
|
@@ -57,6 +57,7 @@ export class InclusiveTimes {
|
|
|
57
57
|
// If true, format input on blur/accept (like dates)
|
|
58
58
|
this.inputShouldFormat = true;
|
|
59
59
|
this.disableFreeformInput = false;
|
|
60
|
+
this.inputClass = "";
|
|
60
61
|
this.selectedHours = 12;
|
|
61
62
|
this.selectedMinutes = 0;
|
|
62
63
|
this.errorState = this.hasError;
|
|
@@ -221,7 +222,10 @@ export class InclusiveTimes {
|
|
|
221
222
|
}
|
|
222
223
|
render() {
|
|
223
224
|
var _a;
|
|
224
|
-
return (h(Host, { key: '
|
|
225
|
+
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: {
|
|
226
|
+
[this.getClassName("input")]: true,
|
|
227
|
+
[this.inputClass]: !!this.inputClass
|
|
228
|
+
}, 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: () => {
|
|
225
229
|
if (this.pickerRef) {
|
|
226
230
|
this.pickerRef.modalIsOpen = true;
|
|
227
231
|
}
|
|
@@ -229,7 +233,7 @@ export class InclusiveTimes {
|
|
|
229
233
|
if (this.pickerRef) {
|
|
230
234
|
this.pickerRef.modalIsOpen = false;
|
|
231
235
|
}
|
|
232
|
-
}, inline: this.inline }, h("div", { key: '
|
|
236
|
+
}, 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))));
|
|
233
237
|
}
|
|
234
238
|
static get is() { return "tabworthy-times"; }
|
|
235
239
|
static get encapsulation() { return "scoped"; }
|
|
@@ -451,7 +455,7 @@ export class InclusiveTimes {
|
|
|
451
455
|
"attribute": "reference-date",
|
|
452
456
|
"defaultValue": "getISODateString(new Date())"
|
|
453
457
|
},
|
|
454
|
-
"
|
|
458
|
+
"useTwelveHourFormat": {
|
|
455
459
|
"type": "boolean",
|
|
456
460
|
"mutable": false,
|
|
457
461
|
"complexType": {
|
|
@@ -468,7 +472,7 @@ export class InclusiveTimes {
|
|
|
468
472
|
"getter": false,
|
|
469
473
|
"setter": false,
|
|
470
474
|
"reflect": false,
|
|
471
|
-
"attribute": "use-
|
|
475
|
+
"attribute": "use-twelve-hour-format",
|
|
472
476
|
"defaultValue": "true"
|
|
473
477
|
},
|
|
474
478
|
"timesLabels": {
|
|
@@ -780,6 +784,26 @@ export class InclusiveTimes {
|
|
|
780
784
|
"reflect": false,
|
|
781
785
|
"attribute": "disable-freeform-input",
|
|
782
786
|
"defaultValue": "false"
|
|
787
|
+
},
|
|
788
|
+
"inputClass": {
|
|
789
|
+
"type": "string",
|
|
790
|
+
"mutable": false,
|
|
791
|
+
"complexType": {
|
|
792
|
+
"original": "string",
|
|
793
|
+
"resolved": "string",
|
|
794
|
+
"references": {}
|
|
795
|
+
},
|
|
796
|
+
"required": false,
|
|
797
|
+
"optional": false,
|
|
798
|
+
"docs": {
|
|
799
|
+
"tags": [],
|
|
800
|
+
"text": ""
|
|
801
|
+
},
|
|
802
|
+
"getter": false,
|
|
803
|
+
"setter": false,
|
|
804
|
+
"reflect": false,
|
|
805
|
+
"attribute": "input-class",
|
|
806
|
+
"defaultValue": "\"\""
|
|
783
807
|
}
|
|
784
808
|
};
|
|
785
809
|
}
|
|
@@ -15,7 +15,7 @@ export class InclusiveTimesPicker {
|
|
|
15
15
|
// Current time value (24-hour format)
|
|
16
16
|
this.hours = 12;
|
|
17
17
|
this.minutes = 0;
|
|
18
|
-
this.
|
|
18
|
+
this.useTwelveHourFormat = false;
|
|
19
19
|
// Labels for accessibility and i18n
|
|
20
20
|
this.labels = defaultLabels;
|
|
21
21
|
// Hide labels visually but keep them for screen readers
|
|
@@ -27,7 +27,7 @@ export class InclusiveTimesPicker {
|
|
|
27
27
|
this.period = this.hours >= 12 ? "PM" : "AM";
|
|
28
28
|
this.handleHourChange = (e) => {
|
|
29
29
|
const value = parseInt(e.target.value, 10);
|
|
30
|
-
if (this.
|
|
30
|
+
if (this.useTwelveHourFormat) {
|
|
31
31
|
// Convert to 24-hour format based on period
|
|
32
32
|
if (this.period === "AM") {
|
|
33
33
|
this.internalHours = value === 12 ? 0 : value;
|
|
@@ -46,7 +46,7 @@ export class InclusiveTimesPicker {
|
|
|
46
46
|
this.emitTimeChange();
|
|
47
47
|
};
|
|
48
48
|
this.handlePeriodChange = (period) => {
|
|
49
|
-
if (this.period === period || !this.
|
|
49
|
+
if (this.period === period || !this.useTwelveHourFormat)
|
|
50
50
|
return;
|
|
51
51
|
this.period = period;
|
|
52
52
|
// Convert hours based on new period
|
|
@@ -60,7 +60,7 @@ export class InclusiveTimesPicker {
|
|
|
60
60
|
this.emitTimeChange();
|
|
61
61
|
};
|
|
62
62
|
this.handleHourIncrement = () => {
|
|
63
|
-
if (this.
|
|
63
|
+
if (this.useTwelveHourFormat) {
|
|
64
64
|
const displayHours = this.getDisplayHours();
|
|
65
65
|
const newDisplayHours = displayHours === 12 ? 1 : displayHours + 1;
|
|
66
66
|
if (this.period === "AM") {
|
|
@@ -76,7 +76,7 @@ export class InclusiveTimesPicker {
|
|
|
76
76
|
this.emitTimeChange();
|
|
77
77
|
};
|
|
78
78
|
this.handleHourDecrement = () => {
|
|
79
|
-
if (this.
|
|
79
|
+
if (this.useTwelveHourFormat) {
|
|
80
80
|
const displayHours = this.getDisplayHours();
|
|
81
81
|
const newDisplayHours = displayHours === 1 ? 12 : displayHours - 1;
|
|
82
82
|
if (this.period === "AM") {
|
|
@@ -115,7 +115,7 @@ export class InclusiveTimesPicker {
|
|
|
115
115
|
this.period = this.hours >= 12 ? "PM" : "AM";
|
|
116
116
|
}
|
|
117
117
|
getDisplayHours() {
|
|
118
|
-
if (!this.
|
|
118
|
+
if (!this.useTwelveHourFormat) {
|
|
119
119
|
return this.internalHours;
|
|
120
120
|
}
|
|
121
121
|
if (this.internalHours === 0)
|
|
@@ -125,7 +125,7 @@ export class InclusiveTimesPicker {
|
|
|
125
125
|
return this.internalHours;
|
|
126
126
|
}
|
|
127
127
|
get24HourValue() {
|
|
128
|
-
if (!this.
|
|
128
|
+
if (!this.useTwelveHourFormat) {
|
|
129
129
|
return this.internalHours;
|
|
130
130
|
}
|
|
131
131
|
const displayHours = this.getDisplayHours();
|
|
@@ -140,7 +140,7 @@ export class InclusiveTimesPicker {
|
|
|
140
140
|
this.timeChanged.emit({
|
|
141
141
|
hours: this.get24HourValue(),
|
|
142
142
|
minutes: this.internalMinutes,
|
|
143
|
-
period: this.
|
|
143
|
+
period: this.useTwelveHourFormat ? this.period : undefined
|
|
144
144
|
});
|
|
145
145
|
}
|
|
146
146
|
padZero(num) {
|
|
@@ -148,18 +148,18 @@ export class InclusiveTimesPicker {
|
|
|
148
148
|
}
|
|
149
149
|
render() {
|
|
150
150
|
const displayHours = this.getDisplayHours();
|
|
151
|
-
const maxHours = this.
|
|
152
|
-
const minHours = this.
|
|
153
|
-
return (h(Host, { key: '
|
|
151
|
+
const maxHours = this.useTwelveHourFormat ? 12 : 23;
|
|
152
|
+
const minHours = this.useTwelveHourFormat ? 1 : 0;
|
|
153
|
+
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: {
|
|
154
154
|
[`${this.elementClassName}__label`]: true,
|
|
155
155
|
[`${this.elementClassName}__label--sr-only`]: this.labelsSrOnly
|
|
156
|
-
} }, this.labels.hours), h("div", { key: '
|
|
156
|
+
} }, 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: {
|
|
157
157
|
[`${this.elementClassName}__label`]: true,
|
|
158
158
|
[`${this.elementClassName}__label--sr-only`]: this.labelsSrOnly
|
|
159
|
-
} }, this.labels.minutes), h("div", { key: '
|
|
159
|
+
} }, 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: {
|
|
160
160
|
[`${this.elementClassName}__period-button`]: true,
|
|
161
161
|
[`${this.elementClassName}__period-button--active`]: this.period === "AM"
|
|
162
|
-
}, onClick: () => this.handlePeriodChange("AM"), disabled: this.disabled, "aria-label": this.labels.am, "aria-pressed": this.period === "AM" }, this.labels.am), h("button", { key: '
|
|
162
|
+
}, 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: {
|
|
163
163
|
[`${this.elementClassName}__period-button`]: true,
|
|
164
164
|
[`${this.elementClassName}__period-button--active`]: this.period === "PM"
|
|
165
165
|
}, onClick: () => this.handlePeriodChange("PM"), disabled: this.disabled, "aria-label": this.labels.pm, "aria-pressed": this.period === "PM" }, this.labels.pm))))));
|
|
@@ -208,7 +208,7 @@ export class InclusiveTimesPicker {
|
|
|
208
208
|
"attribute": "minutes",
|
|
209
209
|
"defaultValue": "0"
|
|
210
210
|
},
|
|
211
|
-
"
|
|
211
|
+
"useTwelveHourFormat": {
|
|
212
212
|
"type": "boolean",
|
|
213
213
|
"mutable": false,
|
|
214
214
|
"complexType": {
|
|
@@ -225,7 +225,7 @@ export class InclusiveTimesPicker {
|
|
|
225
225
|
"getter": false,
|
|
226
226
|
"setter": false,
|
|
227
227
|
"reflect": false,
|
|
228
|
-
"attribute": "use-
|
|
228
|
+
"attribute": "use-twelve-hour-format",
|
|
229
229
|
"defaultValue": "false"
|
|
230
230
|
},
|
|
231
231
|
"labels": {
|