@haiilo/catalyst 10.25.2 → 10.25.3

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.
@@ -1489,6 +1489,7 @@ const CatDate = class {
1489
1489
  this.catBlur = index.createEvent(this, "catBlur", 7);
1490
1490
  this.language = of.catI18nRegistry.getLocale();
1491
1491
  this.locale = getLocale$2(this.language);
1492
+ this.inputFocused = false;
1492
1493
  this.requiredMarker = 'optional';
1493
1494
  this.horizontal = false;
1494
1495
  this.autoComplete = undefined;
@@ -1568,22 +1569,24 @@ const CatDate = class {
1568
1569
  this.input?.clear();
1569
1570
  }
1570
1571
  render() {
1571
- return (index.h(index.Host, { key: '8e98fa37e7c7a5a5b06e78d4db55a0221ab3c9aa' }, index.h("cat-input", { key: '3bc212816beb5dc6dc077c16aeba37494e726710', class: "cat-date-input", ref: el => (this.input = el), requiredMarker: this.requiredMarker, horizontal: this.horizontal, autoComplete: this.autoComplete, clearable: this.clearable, disabled: this.disabled, hint: this.hint, icon: this.icon, iconRight: this.iconRight, identifier: this.identifier, labelHidden: this.labelHidden, name: this.name, placeholder: this.placeholder, textPrefix: this.textPrefix, textSuffix: this.textSuffix, readonly: this.readonly, required: this.required, errors: this.errors, errorUpdate: this.errorUpdate, nativeAttributes: this.nativeAttributes, value: this.inputValue, onCatFocus: e => {
1572
+ return (index.h(index.Host, { key: '0dddaceee870f7e1d16131988a1c344b22656594' }, index.h("cat-input", { key: '969ebd4ca18452f0eb5550b440666886ddc664ec', class: "cat-date-input", ref: el => (this.input = el), requiredMarker: this.requiredMarker, horizontal: this.horizontal, autoComplete: this.autoComplete, clearable: this.clearable, disabled: this.disabled, hint: this.hint, icon: this.icon, iconRight: this.iconRight, identifier: this.identifier, labelHidden: this.labelHidden, name: this.name, placeholder: this.placeholder, textPrefix: this.textPrefix, textSuffix: this.textSuffix, readonly: this.readonly, required: this.required, errors: this.errors, errorUpdate: this.errorUpdate, nativeAttributes: this.nativeAttributes, value: this.inputValue, onCatFocus: e => {
1573
+ this.inputFocused = e.target === this.input;
1572
1574
  e.stopPropagation();
1573
1575
  this.catFocus.emit(e.detail);
1574
1576
  }, onCatBlur: e => {
1575
1577
  e.stopPropagation();
1576
1578
  this.onInputBlur(e.detail);
1577
- } }, index.h("span", { key: '1108b31cf626f5e1879b5d06e15539a60c103925', slot: "label" }, this.label, index.h("span", { key: '253ac251c4313b1b61381c6b7063ed9c6d87f892', class: "label-aria" }, " (", this.locale.formatStr, ")")), index.h("cat-dropdown", { key: 'a251ebdee91aa19060e03fd22a0b02c3c8af59df', slot: "addon", placement: this.placement, arrowNavigation: "none", noResize: true, onCatOpen: () => this.dateInline?.resetView() }, index.h("cat-button", { key: '5fbcfe990cae800326e686b798b63be2d1783248', slot: "trigger", icon: "$cat:datepicker-calendar", iconOnly: true, class: "cat-date-toggle", disabled: this.disabled, a11yLabel: this.getTriggerA11yLabel() }), index.h("div", { key: '3dd9bc1b62c30e8d8ff63c878e1a141e5eac71e5', slot: "content" }, index.h("cat-date-inline", { key: '871799fce9dda73e5242d3d1ef94c03b8144dcf2', ref: el => (this.dateInline = el), min: this.min, max: this.max, value: this.value, hint: true, weeks: true, noClear: true, onCatChange: this.onDateChange.bind(this) }))))));
1579
+ } }, index.h("span", { key: '7bf41bdd4f7b8f0b69ef43f11fe075d05ac7e959', slot: "label" }, this.label, index.h("span", { key: '0c454cbb586b0e3e45af2a0601bb735836a17105', class: "label-aria" }, " (", this.locale.formatStr, ")")), index.h("cat-dropdown", { key: 'ce4169eb447fb61b1e98da380446aeb744b1e319', slot: "addon", placement: this.placement, arrowNavigation: "none", noResize: true, onCatOpen: () => this.dateInline?.resetView() }, index.h("cat-button", { key: '2c9f064a88a711d38fe5f293764ab963cee71782', slot: "trigger", icon: "$cat:datepicker-calendar", iconOnly: true, class: "cat-date-toggle", disabled: this.disabled, a11yLabel: this.getTriggerA11yLabel() }), index.h("div", { key: 'fe782bbda78ff445f760f80547a0a57252d041ba', slot: "content" }, index.h("cat-date-inline", { key: '8ecfa83e38d2016148e1d970f0142ce62d5d58e4', ref: el => (this.dateInline = el), min: this.min, max: this.max, value: this.value, hint: true, weeks: true, noClear: true, onCatChange: this.onDateChange.bind(this) }))))));
1578
1580
  }
1579
1581
  getTriggerA11yLabel() {
1580
1582
  const date = this.locale.fromLocalISO(this.value);
1581
1583
  return date ? `${this.locale.change}, ${this.locale.toLocalStr(date)}` : this.locale.choose;
1582
1584
  }
1583
1585
  onInputBlur(e) {
1584
- if (!this.input) {
1586
+ if (!this.input || !this.inputFocused) {
1585
1587
  return;
1586
1588
  }
1589
+ this.inputFocused = false;
1587
1590
  const oldValue = this.value;
1588
1591
  const dateParsed = this.parse(this.input.value ?? '');
1589
1592
  const dateMin = this.locale.fromLocalISO(this.min);
@@ -1605,7 +1608,7 @@ const CatDate = class {
1605
1608
  onDateChange(e) {
1606
1609
  e.stopPropagation();
1607
1610
  const oldValue = this.value;
1608
- const date = e.detail ? new Date(e.detail) : null;
1611
+ const date = e.detail ? this.locale.fromLocalISO(e.detail) : null;
1609
1612
  this.value = date ? this.locale.toLocalISO(date) : undefined;
1610
1613
  if (oldValue !== this.value) {
1611
1614
  this.catChange.emit(this.value);