@tabworthy/components 0.8.3 → 0.8.4

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.
@@ -10815,7 +10815,9 @@ const TabworthyDates = class {
10815
10815
  else {
10816
10816
  (_b = this.modalRef) === null || _b === void 0 ? void 0 : _b.close();
10817
10817
  // Convert ISO date to specified format
10818
- const formattedDate = moment.hooks(newValue).format(this.format);
10818
+ const formattedDate = newValue
10819
+ ? moment.hooks(newValue).format(this.format)
10820
+ : "";
10819
10821
  this.inputRef.value = formattedDate;
10820
10822
  this.internalValue = formattedDate;
10821
10823
  this.errorState = false;
@@ -10827,6 +10829,9 @@ const TabworthyDates = class {
10827
10829
  this.selectDate.emit(this.internalValue);
10828
10830
  }
10829
10831
  announceDateChange(newValue) {
10832
+ if (!newValue || (Array.isArray(newValue) && newValue.length === 0)) {
10833
+ return;
10834
+ }
10830
10835
  const newValueInIsoFormat = Array.isArray(newValue)
10831
10836
  ? newValue.map((date) => moment.hooks(date, this.format).toISOString())
10832
10837
  : moment.hooks(newValue, this.format).toISOString();
@@ -10896,10 +10901,10 @@ const TabworthyDates = class {
10896
10901
  }
10897
10902
  render() {
10898
10903
  var _a;
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: {
10904
+ return (index$1.h(index$1.Host, { key: '16c9966e45f0084e805bb11cb1292a47869a2626' }, index$1.h("label", { key: '69d95cfdf481252fb684b8d071af97b26a10f466', htmlFor: this.id ? `${this.id}-input` : undefined, class: this.getClassName("label") }, this.label), index$1.h("br", { key: '0b5c2fff7c26dbfe40d75f8f488ccf39e89b1ca3' }), index$1.h("div", { key: 'ecda94423965415e62da7a973ecf4b197104296f', class: this.getClassName("input-container") }, index$1.h("input", { key: '5c0e5276b82e69d68ebf14983918318fa2c33162', disabled: this.disabledState || this.disableFreeformInput, id: this.id ? `${this.id}-input` : undefined, type: "text", placeholder: this.placeholder, class: {
10900
10905
  [this.getClassName("input")]: true,
10901
10906
  [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: () => {
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: 'b8652ae391a12962aac5eb620ecddf23fed9a47b', 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: '358993a42e0401f33f2bc602f83241c53a0f7ef9', label: this.datesLabels.calendar, ref: (el) => (this.modalRef = el), onOpened: () => {
10903
10908
  if (!this.pickerRef)
10904
10909
  return;
10905
10910
  this.pickerRef.modalIsOpen = true;
@@ -10907,11 +10912,11 @@ const TabworthyDates = class {
10907
10912
  if (!this.pickerRef)
10908
10913
  return;
10909
10914
  this.pickerRef.modalIsOpen = false;
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 &&
10915
+ }, inline: this.inline }, index$1.h("tabworthy-dates-calendar", { key: 'a9a1376d1d0a0f8213d8be3426d333257cc60be7', 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 &&
10911
10916
  ((_a = this.quickButtons) === null || _a === void 0 ? void 0 : _a.length) > 0 &&
10912
- this.chronoSupportedLocale && (index$1.h("div", { key: '1bb09b44a219648203d803c76d17a9b41b0278bf', class: this.getClassName("quick-group"), role: "group", "aria-label": "Quick selection" }, this.quickButtons.map((buttonText) => {
10917
+ this.chronoSupportedLocale && (index$1.h("div", { key: '3130ee18874ab44cb4de0b9c47289ea4de4f51b8', class: this.getClassName("quick-group"), role: "group", "aria-label": "Quick selection" }, this.quickButtons.map((buttonText) => {
10913
10918
  return (index$1.h("button", { class: this.getClassName("quick-button"), onClick: this.handleQuickButtonClick, disabled: this.disabledState, type: "button" }, buttonText));
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))));
10919
+ }))), this.errorState && (index$1.h("div", { key: '62a9c3115a69430c8a6b1f646612c250c527449b', class: this.getClassName("input-error"), id: this.id ? `${this.id}-error` : undefined, role: "status" }, this.errorMessage))));
10915
10920
  }
10916
10921
  get el() { return index$1.getElement(this); }
10917
10922
  static get watchers() { return {
@@ -342,7 +342,9 @@ export class TabworthyDates {
342
342
  else {
343
343
  (_b = this.modalRef) === null || _b === void 0 ? void 0 : _b.close();
344
344
  // Convert ISO date to specified format
345
- const formattedDate = moment(newValue).format(this.format);
345
+ const formattedDate = newValue
346
+ ? moment(newValue).format(this.format)
347
+ : "";
346
348
  this.inputRef.value = formattedDate;
347
349
  this.internalValue = formattedDate;
348
350
  this.errorState = false;
@@ -354,6 +356,9 @@ export class TabworthyDates {
354
356
  this.selectDate.emit(this.internalValue);
355
357
  }
356
358
  announceDateChange(newValue) {
359
+ if (!newValue || (Array.isArray(newValue) && newValue.length === 0)) {
360
+ return;
361
+ }
357
362
  const newValueInIsoFormat = Array.isArray(newValue)
358
363
  ? newValue.map((date) => moment(date, this.format).toISOString())
359
364
  : moment(newValue, this.format).toISOString();
@@ -423,10 +428,10 @@ export class TabworthyDates {
423
428
  }
424
429
  render() {
425
430
  var _a;
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: {
431
+ return (h(Host, { key: '16c9966e45f0084e805bb11cb1292a47869a2626' }, h("label", { key: '69d95cfdf481252fb684b8d071af97b26a10f466', htmlFor: this.id ? `${this.id}-input` : undefined, class: this.getClassName("label") }, this.label), h("br", { key: '0b5c2fff7c26dbfe40d75f8f488ccf39e89b1ca3' }), h("div", { key: 'ecda94423965415e62da7a973ecf4b197104296f', class: this.getClassName("input-container") }, h("input", { key: '5c0e5276b82e69d68ebf14983918318fa2c33162', disabled: this.disabledState || this.disableFreeformInput, id: this.id ? `${this.id}-input` : undefined, type: "text", placeholder: this.placeholder, class: {
427
432
  [this.getClassName("input")]: true,
428
433
  [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: () => {
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: 'b8652ae391a12962aac5eb620ecddf23fed9a47b', 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: '358993a42e0401f33f2bc602f83241c53a0f7ef9', label: this.datesLabels.calendar, ref: (el) => (this.modalRef = el), onOpened: () => {
430
435
  if (!this.pickerRef)
431
436
  return;
432
437
  this.pickerRef.modalIsOpen = true;
@@ -434,11 +439,11 @@ export class TabworthyDates {
434
439
  if (!this.pickerRef)
435
440
  return;
436
441
  this.pickerRef.modalIsOpen = false;
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 &&
442
+ }, inline: this.inline }, h("tabworthy-dates-calendar", { key: 'a9a1376d1d0a0f8213d8be3426d333257cc60be7', 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 &&
438
443
  ((_a = this.quickButtons) === null || _a === void 0 ? void 0 : _a.length) > 0 &&
439
- this.chronoSupportedLocale && (h("div", { key: '1bb09b44a219648203d803c76d17a9b41b0278bf', class: this.getClassName("quick-group"), role: "group", "aria-label": "Quick selection" }, this.quickButtons.map((buttonText) => {
444
+ this.chronoSupportedLocale && (h("div", { key: '3130ee18874ab44cb4de0b9c47289ea4de4f51b8', class: this.getClassName("quick-group"), role: "group", "aria-label": "Quick selection" }, this.quickButtons.map((buttonText) => {
440
445
  return (h("button", { class: this.getClassName("quick-button"), onClick: this.handleQuickButtonClick, disabled: this.disabledState, type: "button" }, buttonText));
441
- }))), this.errorState && (h("div", { key: '92d843bf6d0234568bf41a0fd2fdf281cb48487f', class: this.getClassName("input-error"), id: this.id ? `${this.id}-error` : undefined, role: "status" }, this.errorMessage))));
446
+ }))), this.errorState && (h("div", { key: '62a9c3115a69430c8a6b1f646612c250c527449b', class: this.getClassName("input-error"), id: this.id ? `${this.id}-error` : undefined, role: "status" }, this.errorMessage))));
442
447
  }
443
448
  static get is() { return "tabworthy-dates"; }
444
449
  static get encapsulation() { return "scoped"; }