@tabworthy/components 0.8.4 → 0.8.5
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/tabworthy-dates.cjs.entry.js +23 -14
- package/dist/collection/components/tabworthy-dates/tabworthy-dates.js +23 -14
- package/dist/components/tabworthy-dates.js +1 -1
- package/dist/esm/tabworthy-dates.entry.js +23 -14
- package/dist/tabworthy-components/{p-d3ca80db.entry.js → p-4de237aa.entry.js} +1 -1
- package/dist/tabworthy-components/tabworthy-components.esm.js +1 -1
- package/package.json +1 -1
|
@@ -10605,6 +10605,7 @@ const TabworthyDates = class {
|
|
|
10605
10605
|
if (this.pickerRef) {
|
|
10606
10606
|
this.pickerRef.value = null;
|
|
10607
10607
|
}
|
|
10608
|
+
this.value = this.internalValue;
|
|
10608
10609
|
return this.selectDate.emit(this.internalValue);
|
|
10609
10610
|
}
|
|
10610
10611
|
const parsedRange = await chronoParseRange(value, {
|
|
@@ -10639,6 +10640,7 @@ const TabworthyDates = class {
|
|
|
10639
10640
|
if (this.pickerRef) {
|
|
10640
10641
|
this.pickerRef.value = null;
|
|
10641
10642
|
}
|
|
10643
|
+
this.value = this.internalValue;
|
|
10642
10644
|
return this.selectDate.emit(this.internalValue);
|
|
10643
10645
|
}
|
|
10644
10646
|
const parsedDate = await chronoParseDate(value, {
|
|
@@ -10706,7 +10708,7 @@ const TabworthyDates = class {
|
|
|
10706
10708
|
return !!this.inputShouldFormat;
|
|
10707
10709
|
}
|
|
10708
10710
|
componentDidLoad() {
|
|
10709
|
-
this.syncFromValueProp();
|
|
10711
|
+
this.syncFromValueProp(this.value);
|
|
10710
10712
|
this.componentReady.emit();
|
|
10711
10713
|
if (!this.id) {
|
|
10712
10714
|
console.error('tabworthy-dates: The "id" prop is required for accessibility');
|
|
@@ -10751,6 +10753,7 @@ const TabworthyDates = class {
|
|
|
10751
10753
|
this.pickerRef.value = newValue;
|
|
10752
10754
|
}
|
|
10753
10755
|
this.errorState = false;
|
|
10756
|
+
this.value = this.internalValue;
|
|
10754
10757
|
this.selectDate.emit(this.internalValue);
|
|
10755
10758
|
this.announceDateChange(this.internalValue);
|
|
10756
10759
|
}
|
|
@@ -10826,6 +10829,7 @@ const TabworthyDates = class {
|
|
|
10826
10829
|
}
|
|
10827
10830
|
this.announceDateChange(this.internalValue);
|
|
10828
10831
|
}
|
|
10832
|
+
this.value = this.internalValue;
|
|
10829
10833
|
this.selectDate.emit(this.internalValue);
|
|
10830
10834
|
}
|
|
10831
10835
|
announceDateChange(newValue) {
|
|
@@ -10871,10 +10875,7 @@ const TabworthyDates = class {
|
|
|
10871
10875
|
? `${this.elementClassName}__${element}`
|
|
10872
10876
|
: this.elementClassName;
|
|
10873
10877
|
}
|
|
10874
|
-
syncFromValueProp(value
|
|
10875
|
-
if (!value)
|
|
10876
|
-
return;
|
|
10877
|
-
// store
|
|
10878
|
+
syncFromValueProp(value) {
|
|
10878
10879
|
this.internalValue = value;
|
|
10879
10880
|
// update calendar (expects Date or Date[])
|
|
10880
10881
|
if (this.pickerRef) {
|
|
@@ -10888,23 +10889,31 @@ const TabworthyDates = class {
|
|
|
10888
10889
|
this.pickerRef.value = dates.length ? dates : null;
|
|
10889
10890
|
}
|
|
10890
10891
|
else {
|
|
10891
|
-
|
|
10892
|
-
|
|
10893
|
-
|
|
10892
|
+
if (value) {
|
|
10893
|
+
const parsedDate = moment.hooks(value, this.format, true);
|
|
10894
|
+
if (parsedDate.isValid()) {
|
|
10895
|
+
this.pickerRef.value = parsedDate.toDate();
|
|
10896
|
+
}
|
|
10897
|
+
}
|
|
10898
|
+
else {
|
|
10899
|
+
this.pickerRef.value = null;
|
|
10894
10900
|
}
|
|
10895
10901
|
}
|
|
10896
10902
|
}
|
|
10903
|
+
if (!value) {
|
|
10904
|
+
this.inputRef.value = "";
|
|
10905
|
+
}
|
|
10897
10906
|
// update text input (useInputValue=false so it formats from internalValue, not from input's current text)
|
|
10898
|
-
if (this.inputRef) {
|
|
10907
|
+
if (this.inputRef && value) {
|
|
10899
10908
|
this.formatInput(!!this.shouldInputFormat(), false);
|
|
10900
10909
|
}
|
|
10901
10910
|
}
|
|
10902
10911
|
render() {
|
|
10903
10912
|
var _a;
|
|
10904
|
-
return (index$1.h(index$1.Host, { key: '
|
|
10913
|
+
return (index$1.h(index$1.Host, { key: '180697843c3ae05f69acb3d43ab227cfbcdc16f2' }, index$1.h("label", { key: '1134bf0bd018c2f0c65beb8337bbff9e345a50de', htmlFor: this.id ? `${this.id}-input` : undefined, class: this.getClassName("label") }, this.label), index$1.h("br", { key: '73469d03cd691e6c7ac41bef60ab99b8eb498b2e' }), index$1.h("div", { key: '3fc51e7291ec6458d7cb6807cb67f0c6852e6f08', class: this.getClassName("input-container") }, index$1.h("input", { key: '041ccffdc7911349b03f5f9764285b08af0495c1', disabled: this.disabledState || this.disableFreeformInput, id: this.id ? `${this.id}-input` : undefined, type: "text", placeholder: this.placeholder, class: {
|
|
10905
10914
|
[this.getClassName("input")]: true,
|
|
10906
10915
|
[this.inputClass]: !!this.inputClass
|
|
10907
|
-
}, 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: '
|
|
10916
|
+
}, 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: '8429dbfd6cc12eee026a9b2cb1d5eefc1837b260', 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: '1d1e63573957850ac97b2a26642aead2a660b150', label: this.datesLabels.calendar, ref: (el) => (this.modalRef = el), onOpened: () => {
|
|
10908
10917
|
if (!this.pickerRef)
|
|
10909
10918
|
return;
|
|
10910
10919
|
this.pickerRef.modalIsOpen = true;
|
|
@@ -10912,11 +10921,11 @@ const TabworthyDates = class {
|
|
|
10912
10921
|
if (!this.pickerRef)
|
|
10913
10922
|
return;
|
|
10914
10923
|
this.pickerRef.modalIsOpen = false;
|
|
10915
|
-
}, inline: this.inline }, index$1.h("tabworthy-dates-calendar", { key: '
|
|
10924
|
+
}, inline: this.inline }, index$1.h("tabworthy-dates-calendar", { key: '67bde6b757985896a954944e4cbd984e86d157df', 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 &&
|
|
10916
10925
|
((_a = this.quickButtons) === null || _a === void 0 ? void 0 : _a.length) > 0 &&
|
|
10917
|
-
this.chronoSupportedLocale && (index$1.h("div", { key: '
|
|
10926
|
+
this.chronoSupportedLocale && (index$1.h("div", { key: '436491da4225bde4b5b1a8ebca90bd873d947db4', class: this.getClassName("quick-group"), role: "group", "aria-label": "Quick selection" }, this.quickButtons.map((buttonText) => {
|
|
10918
10927
|
return (index$1.h("button", { class: this.getClassName("quick-button"), onClick: this.handleQuickButtonClick, disabled: this.disabledState, type: "button" }, buttonText));
|
|
10919
|
-
}))), this.errorState && (index$1.h("div", { key: '
|
|
10928
|
+
}))), this.errorState && (index$1.h("div", { key: 'd01c5419b306c0ea01e8c86f6a3c067ba03cff24', class: this.getClassName("input-error"), id: this.id ? `${this.id}-error` : undefined, role: "status" }, this.errorMessage))));
|
|
10920
10929
|
}
|
|
10921
10930
|
get el() { return index$1.getElement(this); }
|
|
10922
10931
|
static get watchers() { return {
|
|
@@ -132,6 +132,7 @@ export class TabworthyDates {
|
|
|
132
132
|
if (this.pickerRef) {
|
|
133
133
|
this.pickerRef.value = null;
|
|
134
134
|
}
|
|
135
|
+
this.value = this.internalValue;
|
|
135
136
|
return this.selectDate.emit(this.internalValue);
|
|
136
137
|
}
|
|
137
138
|
const parsedRange = await chronoParseRange(value, {
|
|
@@ -166,6 +167,7 @@ export class TabworthyDates {
|
|
|
166
167
|
if (this.pickerRef) {
|
|
167
168
|
this.pickerRef.value = null;
|
|
168
169
|
}
|
|
170
|
+
this.value = this.internalValue;
|
|
169
171
|
return this.selectDate.emit(this.internalValue);
|
|
170
172
|
}
|
|
171
173
|
const parsedDate = await chronoParseDate(value, {
|
|
@@ -233,7 +235,7 @@ export class TabworthyDates {
|
|
|
233
235
|
return !!this.inputShouldFormat;
|
|
234
236
|
}
|
|
235
237
|
componentDidLoad() {
|
|
236
|
-
this.syncFromValueProp();
|
|
238
|
+
this.syncFromValueProp(this.value);
|
|
237
239
|
this.componentReady.emit();
|
|
238
240
|
if (!this.id) {
|
|
239
241
|
console.error('tabworthy-dates: The "id" prop is required for accessibility');
|
|
@@ -278,6 +280,7 @@ export class TabworthyDates {
|
|
|
278
280
|
this.pickerRef.value = newValue;
|
|
279
281
|
}
|
|
280
282
|
this.errorState = false;
|
|
283
|
+
this.value = this.internalValue;
|
|
281
284
|
this.selectDate.emit(this.internalValue);
|
|
282
285
|
this.announceDateChange(this.internalValue);
|
|
283
286
|
}
|
|
@@ -353,6 +356,7 @@ export class TabworthyDates {
|
|
|
353
356
|
}
|
|
354
357
|
this.announceDateChange(this.internalValue);
|
|
355
358
|
}
|
|
359
|
+
this.value = this.internalValue;
|
|
356
360
|
this.selectDate.emit(this.internalValue);
|
|
357
361
|
}
|
|
358
362
|
announceDateChange(newValue) {
|
|
@@ -398,10 +402,7 @@ export class TabworthyDates {
|
|
|
398
402
|
? `${this.elementClassName}__${element}`
|
|
399
403
|
: this.elementClassName;
|
|
400
404
|
}
|
|
401
|
-
syncFromValueProp(value
|
|
402
|
-
if (!value)
|
|
403
|
-
return;
|
|
404
|
-
// store
|
|
405
|
+
syncFromValueProp(value) {
|
|
405
406
|
this.internalValue = value;
|
|
406
407
|
// update calendar (expects Date or Date[])
|
|
407
408
|
if (this.pickerRef) {
|
|
@@ -415,23 +416,31 @@ export class TabworthyDates {
|
|
|
415
416
|
this.pickerRef.value = dates.length ? dates : null;
|
|
416
417
|
}
|
|
417
418
|
else {
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
419
|
+
if (value) {
|
|
420
|
+
const parsedDate = moment(value, this.format, true);
|
|
421
|
+
if (parsedDate.isValid()) {
|
|
422
|
+
this.pickerRef.value = parsedDate.toDate();
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
else {
|
|
426
|
+
this.pickerRef.value = null;
|
|
421
427
|
}
|
|
422
428
|
}
|
|
423
429
|
}
|
|
430
|
+
if (!value) {
|
|
431
|
+
this.inputRef.value = "";
|
|
432
|
+
}
|
|
424
433
|
// update text input (useInputValue=false so it formats from internalValue, not from input's current text)
|
|
425
|
-
if (this.inputRef) {
|
|
434
|
+
if (this.inputRef && value) {
|
|
426
435
|
this.formatInput(!!this.shouldInputFormat(), false);
|
|
427
436
|
}
|
|
428
437
|
}
|
|
429
438
|
render() {
|
|
430
439
|
var _a;
|
|
431
|
-
return (h(Host, { key: '
|
|
440
|
+
return (h(Host, { key: '180697843c3ae05f69acb3d43ab227cfbcdc16f2' }, h("label", { key: '1134bf0bd018c2f0c65beb8337bbff9e345a50de', htmlFor: this.id ? `${this.id}-input` : undefined, class: this.getClassName("label") }, this.label), h("br", { key: '73469d03cd691e6c7ac41bef60ab99b8eb498b2e' }), h("div", { key: '3fc51e7291ec6458d7cb6807cb67f0c6852e6f08', class: this.getClassName("input-container") }, h("input", { key: '041ccffdc7911349b03f5f9764285b08af0495c1', disabled: this.disabledState || this.disableFreeformInput, id: this.id ? `${this.id}-input` : undefined, type: "text", placeholder: this.placeholder, class: {
|
|
432
441
|
[this.getClassName("input")]: true,
|
|
433
442
|
[this.inputClass]: !!this.inputClass
|
|
434
|
-
}, 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: '
|
|
443
|
+
}, 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: '8429dbfd6cc12eee026a9b2cb1d5eefc1837b260', 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: '1d1e63573957850ac97b2a26642aead2a660b150', label: this.datesLabels.calendar, ref: (el) => (this.modalRef = el), onOpened: () => {
|
|
435
444
|
if (!this.pickerRef)
|
|
436
445
|
return;
|
|
437
446
|
this.pickerRef.modalIsOpen = true;
|
|
@@ -439,11 +448,11 @@ export class TabworthyDates {
|
|
|
439
448
|
if (!this.pickerRef)
|
|
440
449
|
return;
|
|
441
450
|
this.pickerRef.modalIsOpen = false;
|
|
442
|
-
}, inline: this.inline }, h("tabworthy-dates-calendar", { key: '
|
|
451
|
+
}, inline: this.inline }, h("tabworthy-dates-calendar", { key: '67bde6b757985896a954944e4cbd984e86d157df', 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 &&
|
|
443
452
|
((_a = this.quickButtons) === null || _a === void 0 ? void 0 : _a.length) > 0 &&
|
|
444
|
-
this.chronoSupportedLocale && (h("div", { key: '
|
|
453
|
+
this.chronoSupportedLocale && (h("div", { key: '436491da4225bde4b5b1a8ebca90bd873d947db4', class: this.getClassName("quick-group"), role: "group", "aria-label": "Quick selection" }, this.quickButtons.map((buttonText) => {
|
|
445
454
|
return (h("button", { class: this.getClassName("quick-button"), onClick: this.handleQuickButtonClick, disabled: this.disabledState, type: "button" }, buttonText));
|
|
446
|
-
}))), this.errorState && (h("div", { key: '
|
|
455
|
+
}))), this.errorState && (h("div", { key: 'd01c5419b306c0ea01e8c86f6a3c067ba03cff24', class: this.getClassName("input-error"), id: this.id ? `${this.id}-error` : undefined, role: "status" }, this.errorMessage))));
|
|
447
456
|
}
|
|
448
457
|
static get is() { return "tabworthy-dates"; }
|
|
449
458
|
static get encapsulation() { return "scoped"; }
|