@haiilo/catalyst 5.4.0 → 6.0.0

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.
Files changed (169) hide show
  1. package/dist/catalyst/catalyst.css +1071 -0
  2. package/dist/catalyst/catalyst.esm.js +1 -1
  3. package/dist/catalyst/catalyst.esm.js.map +1 -1
  4. package/dist/catalyst/index.cdn.js +6 -0
  5. package/dist/catalyst/index.esm.js +2 -2
  6. package/dist/catalyst/index.esm.js.map +1 -1
  7. package/dist/catalyst/p-ad5fca6b.entry.js +10 -0
  8. package/dist/catalyst/p-ad5fca6b.entry.js.map +1 -0
  9. package/dist/catalyst/p-d7dc291a.js +2 -0
  10. package/dist/catalyst/p-d7dc291a.js.map +1 -0
  11. package/dist/catalyst/scss/index.scss +2 -0
  12. package/dist/catalyst/scss/vendor/_flatpickr.scss +314 -0
  13. package/dist/cjs/{cat-alert_27.cjs.entry.js → cat-alert_25.cjs.entry.js} +2922 -3480
  14. package/dist/cjs/cat-alert_25.cjs.entry.js.map +1 -0
  15. package/dist/cjs/{cat-icon-registry-228164a1.js → cat-icon-registry-6161e2ee.js} +14 -2
  16. package/dist/cjs/cat-icon-registry-6161e2ee.js.map +1 -0
  17. package/dist/cjs/catalyst.cjs.js +1 -1
  18. package/dist/cjs/index.cjs.js +12 -14
  19. package/dist/cjs/index.cjs.js.map +1 -1
  20. package/dist/cjs/loader.cjs.js +1 -1
  21. package/dist/collection/collection-manifest.json +0 -2
  22. package/dist/collection/components/cat-avatar/cat-avatar.js +5 -5
  23. package/dist/collection/components/cat-avatar/cat-avatar.js.map +1 -1
  24. package/dist/collection/components/cat-button/cat-button.js +5 -7
  25. package/dist/collection/components/cat-button/cat-button.js.map +1 -1
  26. package/dist/collection/components/cat-checkbox/cat-checkbox.js +39 -42
  27. package/dist/collection/components/cat-checkbox/cat-checkbox.js.map +1 -1
  28. package/dist/collection/components/cat-datepicker/cat-datepicker.config.js +22 -0
  29. package/dist/collection/components/cat-datepicker/cat-datepicker.config.js.map +1 -0
  30. package/dist/collection/components/cat-datepicker/cat-datepicker.css +6 -369
  31. package/dist/collection/components/cat-datepicker/cat-datepicker.js +110 -314
  32. package/dist/collection/components/cat-datepicker/cat-datepicker.js.map +1 -1
  33. package/dist/collection/components/cat-datepicker/cat-datepicker.locale.js +51 -0
  34. package/dist/collection/components/cat-datepicker/cat-datepicker.locale.js.map +1 -0
  35. package/dist/collection/components/cat-dropdown/cat-dropdown.js +6 -9
  36. package/dist/collection/components/cat-dropdown/cat-dropdown.js.map +1 -1
  37. package/dist/collection/components/cat-form-group/cat-form-group.js +4 -5
  38. package/dist/collection/components/cat-form-group/cat-form-group.js.map +1 -1
  39. package/dist/collection/components/cat-form-hint/cat-form-hint.js +2 -6
  40. package/dist/collection/components/cat-form-hint/cat-form-hint.js.map +1 -1
  41. package/dist/collection/components/cat-i18n/cat-i18n-registry.js +13 -1
  42. package/dist/collection/components/cat-i18n/cat-i18n-registry.js.map +1 -1
  43. package/dist/collection/components/cat-input/cat-input.css +0 -377
  44. package/dist/collection/components/cat-input/cat-input.js +14 -40
  45. package/dist/collection/components/cat-input/cat-input.js.map +1 -1
  46. package/dist/collection/components/cat-input/input-type.js.map +1 -1
  47. package/dist/collection/components/cat-notification/cat-notification.js +11 -13
  48. package/dist/collection/components/cat-notification/cat-notification.js.map +1 -1
  49. package/dist/collection/components/cat-pagination/cat-pagination.js +2 -2
  50. package/dist/collection/components/cat-pagination/cat-pagination.js.map +1 -1
  51. package/dist/collection/components/cat-radio/cat-radio.js +11 -36
  52. package/dist/collection/components/cat-radio/cat-radio.js.map +1 -1
  53. package/dist/collection/components/cat-radio-group/cat-radio-group.js +37 -11
  54. package/dist/collection/components/cat-radio-group/cat-radio-group.js.map +1 -1
  55. package/dist/collection/components/cat-scrollable/cat-scrollable.js +2 -3
  56. package/dist/collection/components/cat-scrollable/cat-scrollable.js.map +1 -1
  57. package/dist/collection/components/cat-select/cat-select.js +42 -53
  58. package/dist/collection/components/cat-select/cat-select.js.map +1 -1
  59. package/dist/collection/components/cat-select-demo/cat-select-demo.js +21 -25
  60. package/dist/collection/components/cat-select-demo/cat-select-demo.js.map +1 -1
  61. package/dist/collection/components/cat-tabs/cat-tabs.js +4 -7
  62. package/dist/collection/components/cat-tabs/cat-tabs.js.map +1 -1
  63. package/dist/collection/components/cat-textarea/cat-textarea.js +17 -21
  64. package/dist/collection/components/cat-textarea/cat-textarea.js.map +1 -1
  65. package/dist/collection/components/cat-toggle/cat-toggle.js +38 -41
  66. package/dist/collection/components/cat-toggle/cat-toggle.js.map +1 -1
  67. package/dist/collection/components/cat-tooltip/cat-tooltip.js +17 -22
  68. package/dist/collection/components/cat-tooltip/cat-tooltip.js.map +1 -1
  69. package/dist/collection/index.cdn.js +6 -0
  70. package/dist/collection/scss/index.scss +2 -0
  71. package/dist/collection/scss/vendor/_flatpickr.scss +314 -0
  72. package/dist/collection/utils/platform.js +1 -1
  73. package/dist/collection/utils/platform.js.map +1 -1
  74. package/dist/components/cat-avatar2.js +5 -5
  75. package/dist/components/cat-avatar2.js.map +1 -1
  76. package/dist/components/cat-button2.js +6 -8
  77. package/dist/components/cat-button2.js.map +1 -1
  78. package/dist/components/cat-checkbox2.js +14 -15
  79. package/dist/components/cat-checkbox2.js.map +1 -1
  80. package/dist/components/cat-datepicker.js +2725 -3028
  81. package/dist/components/cat-datepicker.js.map +1 -1
  82. package/dist/components/cat-dropdown2.js +6 -9
  83. package/dist/components/cat-dropdown2.js.map +1 -1
  84. package/dist/components/cat-form-group.js +4 -5
  85. package/dist/components/cat-form-group.js.map +1 -1
  86. package/dist/components/cat-form-hint.js +2 -6
  87. package/dist/components/cat-form-hint.js.map +1 -1
  88. package/dist/components/cat-i18n-registry.js +13 -1
  89. package/dist/components/cat-i18n-registry.js.map +1 -1
  90. package/dist/components/cat-input2.js +9 -16
  91. package/dist/components/cat-input2.js.map +1 -1
  92. package/dist/components/cat-pagination.js.map +1 -1
  93. package/dist/components/cat-radio-group.js +15 -9
  94. package/dist/components/cat-radio-group.js.map +1 -1
  95. package/dist/components/cat-radio.js +5 -12
  96. package/dist/components/cat-radio.js.map +1 -1
  97. package/dist/components/cat-scrollable2.js +2 -3
  98. package/dist/components/cat-scrollable2.js.map +1 -1
  99. package/dist/components/cat-select-demo.js +21 -25
  100. package/dist/components/cat-select-demo.js.map +1 -1
  101. package/dist/components/cat-select2.js +42 -53
  102. package/dist/components/cat-select2.js.map +1 -1
  103. package/dist/components/cat-tabs.js +4 -7
  104. package/dist/components/cat-tabs.js.map +1 -1
  105. package/dist/components/cat-textarea.js +11 -11
  106. package/dist/components/cat-textarea.js.map +1 -1
  107. package/dist/components/cat-toggle.js +14 -15
  108. package/dist/components/cat-toggle.js.map +1 -1
  109. package/dist/components/cat-tooltip.js +17 -22
  110. package/dist/components/cat-tooltip.js.map +1 -1
  111. package/dist/components/floating-ui.dom.esm.js +55 -68
  112. package/dist/components/floating-ui.dom.esm.js.map +1 -1
  113. package/dist/components/index.js +11 -13
  114. package/dist/components/index.js.map +1 -1
  115. package/dist/esm/{cat-alert_27.entry.js → cat-alert_25.entry.js} +2922 -3478
  116. package/dist/esm/cat-alert_25.entry.js.map +1 -0
  117. package/dist/esm/{cat-icon-registry-4bd597f4.js → cat-icon-registry-f15b29d9.js} +14 -2
  118. package/dist/esm/cat-icon-registry-f15b29d9.js.map +1 -0
  119. package/dist/esm/catalyst.js +1 -1
  120. package/dist/esm/index.js +13 -15
  121. package/dist/esm/index.js.map +1 -1
  122. package/dist/esm/loader.js +1 -1
  123. package/dist/types/@types/Intl.d.ts +3 -0
  124. package/dist/types/components/cat-checkbox/cat-checkbox.d.ts +11 -9
  125. package/dist/types/components/cat-datepicker/cat-datepicker.config.d.ts +1 -0
  126. package/dist/types/components/cat-datepicker/cat-datepicker.d.ts +21 -65
  127. package/dist/types/components/cat-datepicker/cat-datepicker.locale.d.ts +3 -0
  128. package/dist/types/components/cat-i18n/cat-i18n-registry.d.ts +3 -0
  129. package/dist/types/components/cat-input/cat-input.d.ts +2 -6
  130. package/dist/types/components/cat-input/input-type.d.ts +1 -1
  131. package/dist/types/components/cat-pagination/cat-pagination.d.ts +1 -1
  132. package/dist/types/components/cat-radio/cat-radio.d.ts +3 -7
  133. package/dist/types/components/cat-radio-group/cat-radio-group.d.ts +6 -1
  134. package/dist/types/components/cat-textarea/cat-textarea.d.ts +4 -4
  135. package/dist/types/components/cat-toggle/cat-toggle.d.ts +10 -8
  136. package/dist/types/components.d.ts +83 -417
  137. package/package.json +8 -10
  138. package/dist/catalyst/p-34e0cbba.entry.js +0 -10
  139. package/dist/catalyst/p-34e0cbba.entry.js.map +0 -1
  140. package/dist/catalyst/p-cf32399c.js +0 -2
  141. package/dist/catalyst/p-cf32399c.js.map +0 -1
  142. package/dist/cjs/cat-alert_27.cjs.entry.js.map +0 -1
  143. package/dist/cjs/cat-icon-registry-228164a1.js.map +0 -1
  144. package/dist/collection/components/cat-datepicker/datepicker-type.js +0 -8
  145. package/dist/collection/components/cat-datepicker/datepicker-type.js.map +0 -1
  146. package/dist/collection/components/cat-datepicker/dayjs.config.js +0 -8
  147. package/dist/collection/components/cat-datepicker/dayjs.config.js.map +0 -1
  148. package/dist/collection/components/cat-datepicker/vanillajs-datepicker.config.js +0 -46
  149. package/dist/collection/components/cat-datepicker/vanillajs-datepicker.config.js.map +0 -1
  150. package/dist/collection/components/cat-label/cat-label.css +0 -22
  151. package/dist/collection/components/cat-label/cat-label.js +0 -134
  152. package/dist/collection/components/cat-label/cat-label.js.map +0 -1
  153. package/dist/collection/components/cat-timepicker/cat-timepicker.css +0 -5
  154. package/dist/collection/components/cat-timepicker/cat-timepicker.js +0 -668
  155. package/dist/collection/components/cat-timepicker/cat-timepicker.js.map +0 -1
  156. package/dist/components/cat-label.d.ts +0 -11
  157. package/dist/components/cat-label.js +0 -73
  158. package/dist/components/cat-label.js.map +0 -1
  159. package/dist/components/cat-timepicker.d.ts +0 -11
  160. package/dist/components/cat-timepicker.js +0 -258
  161. package/dist/components/cat-timepicker.js.map +0 -1
  162. package/dist/esm/cat-alert_27.entry.js.map +0 -1
  163. package/dist/esm/cat-icon-registry-4bd597f4.js.map +0 -1
  164. package/dist/types/components/cat-datepicker/datepicker-type.d.ts +0 -7
  165. package/dist/types/components/cat-datepicker/datepicker.d.ts +0 -1
  166. package/dist/types/components/cat-datepicker/dayjs.config.d.ts +0 -3
  167. package/dist/types/components/cat-datepicker/vanillajs-datepicker.config.d.ts +0 -4
  168. package/dist/types/components/cat-label/cat-label.d.ts +0 -27
  169. package/dist/types/components/cat-timepicker/cat-timepicker.d.ts +0 -158
@@ -390,7 +390,7 @@ const CatSelect = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
390
390
  }
391
391
  else {
392
392
  this.errorMapSrc = Array.isArray(value)
393
- ? value.reduce((acc, err) => (Object.assign(Object.assign({}, acc), { [err]: undefined })), {})
393
+ ? value.reduce((acc, err) => ({ ...acc, [err]: undefined }), {})
394
394
  : value === true
395
395
  ? {}
396
396
  : value || undefined;
@@ -398,13 +398,14 @@ const CatSelect = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
398
398
  }
399
399
  }
400
400
  onStateChange(newState, oldState) {
401
- var _a, _b;
402
401
  const changed = (key) => newState[key] !== oldState[key];
403
402
  if (changed('isOpen')) {
404
403
  this.update();
405
404
  }
406
405
  if (changed('activeOptionIndex') && this.state.activeOptionIndex >= 0) {
407
- (_b = (_a = this.dropdown) === null || _a === void 0 ? void 0 : _a.querySelector(`#select-${this.id}-option-${this.state.activeOptionIndex}`)) === null || _b === void 0 ? void 0 : _b.scrollIntoView({ block: 'nearest' });
406
+ this.dropdown
407
+ ?.querySelector(`#select-${this.id}-option-${this.state.activeOptionIndex}`)
408
+ ?.scrollIntoView({ block: 'nearest' });
408
409
  }
409
410
  if (changed('selection')) {
410
411
  let newValue;
@@ -457,7 +458,6 @@ const CatSelect = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
457
458
  }
458
459
  }
459
460
  onBlur(event) {
460
- var _a;
461
461
  if (!this.multiple && this.state.activeOptionIndex >= 0) {
462
462
  if (this.tags && this.state.options[this.state.activeOptionIndex].item.id === `select-${this.id}-option-tag`) {
463
463
  this.createTag(this.state.term);
@@ -467,7 +467,7 @@ const CatSelect = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
467
467
  }
468
468
  }
469
469
  this.hide();
470
- if (!this.multiple && ((_a = this.state.tempSelection) === null || _a === void 0 ? void 0 : _a.length)) {
470
+ if (!this.multiple && this.state.tempSelection?.length) {
471
471
  this.patchState({
472
472
  activeSelectionIndex: -1,
473
473
  selection: this.state.tempSelection,
@@ -485,8 +485,7 @@ const CatSelect = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
485
485
  }
486
486
  }
487
487
  onKeyDown(event) {
488
- var _a, _b, _c, _d, _e;
489
- const isInputFocused = ((_a = this.hostElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.activeElement) === this.input;
488
+ const isInputFocused = this.hostElement.shadowRoot?.activeElement === this.input;
490
489
  if (['ArrowDown', 'ArrowUp', 'ArrowLeft', 'ArrowRight'].includes(event.key)) {
491
490
  this.onArrowKeyDown(event);
492
491
  }
@@ -519,8 +518,8 @@ const CatSelect = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
519
518
  this.hide();
520
519
  }
521
520
  else if (event.key === 'Backspace' || event.key === 'Delete') {
522
- (_b = this.input) === null || _b === void 0 ? void 0 : _b.focus();
523
- if (!this.multiple || !this.state.term || (((_c = this.input) === null || _c === void 0 ? void 0 : _c.selectionStart) === 0 && event.key === 'Backspace')) {
521
+ this.input?.focus();
522
+ if (!this.multiple || !this.state.term || (this.input?.selectionStart === 0 && event.key === 'Backspace')) {
524
523
  if (this.state.activeSelectionIndex >= 0) {
525
524
  this.deselect(this.state.selection[this.state.activeSelectionIndex].item.id);
526
525
  }
@@ -535,7 +534,7 @@ const CatSelect = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
535
534
  }
536
535
  }
537
536
  else if (event.key === 'Tab') {
538
- (_d = this.trigger) === null || _d === void 0 ? void 0 : _d.setAttribute('tabindex', '-1');
537
+ this.trigger?.setAttribute('tabindex', '-1');
539
538
  if (this.multiple) {
540
539
  this.patchState({ activeSelectionIndex: -1, activeOptionIndex: -1 });
541
540
  }
@@ -549,21 +548,20 @@ const CatSelect = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
549
548
  }
550
549
  }
551
550
  else if (event.key.length === 1) {
552
- (_e = this.input) === null || _e === void 0 ? void 0 : _e.focus();
551
+ this.input?.focus();
553
552
  }
554
553
  }
555
554
  onKeyUp(event) {
556
- var _a, _b, _c, _d, _e;
557
555
  if (event.key === 'Tab' && !event.shiftKey) {
558
- ((_a = this.hostElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.activeElement) === this.trigger && ((_b = this.input) === null || _b === void 0 ? void 0 : _b.focus());
559
- if (((_c = this.hostElement.shadowRoot) === null || _c === void 0 ? void 0 : _c.activeElement) === this.input) {
556
+ this.hostElement.shadowRoot?.activeElement === this.trigger && this.input?.focus();
557
+ if (this.hostElement.shadowRoot?.activeElement === this.input) {
560
558
  this.show();
561
559
  }
562
560
  }
563
561
  else if (event.key === 'Tab' && event.shiftKey) {
564
- const clearButton = (_d = this.trigger) === null || _d === void 0 ? void 0 : _d.querySelector(`#select-clear-btn-${this.id}`);
562
+ const clearButton = this.trigger?.querySelector(`#select-clear-btn-${this.id}`);
565
563
  if (clearButton) {
566
- ((_e = this.hostElement.shadowRoot) === null || _e === void 0 ? void 0 : _e.activeElement) === clearButton && this.show();
564
+ this.hostElement.shadowRoot?.activeElement === clearButton && this.show();
567
565
  }
568
566
  else {
569
567
  this.show();
@@ -576,22 +574,21 @@ const CatSelect = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
576
574
  * @param connector - The {@link CatSelectConnector} of the select.
577
575
  */
578
576
  async connect(connector) {
579
- var _a;
580
577
  this.connector = connector;
581
578
  let number$;
582
- (_a = this.subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
579
+ this.subscription?.unsubscribe();
583
580
  this.subscription = this.term$
584
581
  .asObservable()
585
582
  .pipe(debounce(term => (term ? timer(this.debounce) : of(0))), distinctUntilChanged(), tap(() => (number$ = this.more$.pipe(filter(() => !this.state.isLoading), scan(n => n + 1, 0), startWith(0)))), tap(() => this.patchState({ options: [] })), switchMap(term => number$.pipe(tap(() => this.patchState({ isLoading: true })), switchMap(number => connector.retrieve(term, number)), tap(page => this.patchState({ isLoading: false, totalElements: page.totalElements })), takeWhile(page => !page.last, true), scan((items, page) => [...items, ...page.content], []))))
586
583
  .subscribe(items => {
587
- var _a;
588
584
  const options = this.toSelectItems(connector, items);
589
585
  if (this.tags &&
590
586
  this.state.term.trim().length &&
591
587
  !options.find(value1 => value1.render.label.toLowerCase() === this.state.term.toLowerCase())) {
592
588
  let label;
593
589
  if (this.isTagSelected(this.state.term)) {
594
- label = (_a = this.state.selection.find(item => item.render.label.toLowerCase() === this.state.term.toLowerCase())) === null || _a === void 0 ? void 0 : _a.render.label;
590
+ label = this.state.selection.find(item => item.render.label.toLowerCase() === this.state.term.toLowerCase())
591
+ ?.render.label;
595
592
  }
596
593
  options.unshift({
597
594
  item: { id: `select-${this.id}-option-tag` },
@@ -604,24 +601,23 @@ const CatSelect = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
604
601
  });
605
602
  }
606
603
  render() {
607
- var _a, _b;
608
604
  return (h(Host, null, h("div", { class: {
609
605
  'select-field': true,
610
606
  'select-horizontal': this.horizontal
611
607
  } }, h("div", { class: {
612
608
  hidden: this.labelHidden,
613
609
  'label-container': true
614
- } }, (this.hasSlottedLabel || this.label) && (h("label", { htmlFor: this.id }, h("span", { class: "label-wrapper", part: "label" }, (this.hasSlottedLabel && h("slot", { name: "label" })) || this.label, h("div", { class: "label-metadata" }, !this.required && this.requiredMarker.startsWith('optional') && (h("span", { class: "label-optional", "aria-hidden": "true" }, "(", catI18nRegistry.t('input.optional'), ")")), this.required && this.requiredMarker.startsWith('required') && (h("span", { class: "label-optional", "aria-hidden": "true" }, "(", catI18nRegistry.t('input.required'), ")"))))))), h("div", { class: "select-container" }, h("div", { class: { 'select-wrapper': true, 'select-disabled': this.disabled, 'select-invalid': this.invalid }, ref: el => (this.trigger = el), id: this.id, role: "combobox", "aria-expanded": this.state.isOpen || this.isPillboxActive(), "aria-controls": this.isPillboxActive() ? `select-pillbox-${this.id}` : `select-listbox-${this.id}`, "aria-required": this.required ? 'true' : false, "aria-activedescendant": this.activeDescendant, onClick: e => this.onClick(e) }, h("div", { class: "select-wrapper-inner" }, this.multiple && this.state.selection.length ? (h("div", { id: `select-pillbox-${this.id}`, role: "listbox", "aria-orientation": "horizontal", class: "select-pills" }, this.state.selection.map((item, i) => {
615
- var _a;
616
- return (h("span", { class: {
617
- pill: true,
618
- 'select-no-open': true,
619
- 'select-option-active': this.state.activeSelectionIndex === i
620
- }, role: "option", "aria-selected": "true", id: `select-${this.id}-selection-${i}` }, item.render.avatar ? (h("cat-avatar", { label: item.render.label, round: item.render.avatar.round, src: item.render.avatar.src, icon: item.render.avatar.icon, initials: (_a = item.render.avatar.initials) !== null && _a !== void 0 ? _a : '' })) : null, h("span", null, item.render.label), !this.disabled && (h("cat-button", { size: "xs", variant: "text", icon: "$cat:select-clear", iconOnly: true, a11yLabel: catI18nRegistry.t('select.deselect'), onClick: () => this.deselect(item.item.id), tabIndex: -1 }))));
621
- }))) : this.state.selection.length && this.state.selection[0].render.avatar ? (h("cat-avatar", { label: this.state.selection[0].render.label, round: this.state.selection[0].render.avatar.round, src: this.state.selection[0].render.avatar.src, icon: this.state.selection[0].render.avatar.icon, initials: (_a = this.state.selection[0].render.avatar.initials) !== null && _a !== void 0 ? _a : '' })) : null, h("input", Object.assign({}, this.nativeAttributes, { class: "select-input", ref: el => (this.input = el), "aria-controls": this.isPillboxActive() ? `select-pillbox-${this.id}` : `select-listbox-${this.id}`, "aria-activedescendant": this.activeDescendant, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": ((_b = this.hint) === null || _b === void 0 ? void 0 : _b.length) ? this.id + '-hint' : undefined, onInput: this.onInput.bind(this), value: !this.multiple ? this.state.term : undefined, placeholder: this.placeholder, disabled: this.disabled || this.state.isResolving }))), this.state.isResolving && h("cat-spinner", null), this.invalid && (h("cat-icon", { icon: "$cat:input-error", class: "icon-suffix cat-text-danger", size: "l" })), (this.state.selection.length || this.state.term.length) &&
610
+ } }, (this.hasSlottedLabel || this.label) && (h("label", { htmlFor: this.id }, h("span", { class: "label-wrapper", part: "label" }, (this.hasSlottedLabel && h("slot", { name: "label" })) || this.label, h("div", { class: "label-metadata" }, !this.required && this.requiredMarker.startsWith('optional') && (h("span", { class: "label-optional", "aria-hidden": "true" }, "(", catI18nRegistry.t('input.optional'), ")")), this.required && this.requiredMarker.startsWith('required') && (h("span", { class: "label-optional", "aria-hidden": "true" }, "(", catI18nRegistry.t('input.required'), ")"))))))), h("div", { class: "select-container" }, h("div", { class: { 'select-wrapper': true, 'select-disabled': this.disabled, 'select-invalid': this.invalid }, ref: el => (this.trigger = el), id: this.id, role: "combobox", "aria-expanded": this.state.isOpen || this.isPillboxActive(), "aria-controls": this.isPillboxActive() ? `select-pillbox-${this.id}` : `select-listbox-${this.id}`, "aria-required": this.required ? 'true' : false, "aria-activedescendant": this.activeDescendant, onClick: e => this.onClick(e) }, h("div", { class: "select-wrapper-inner" }, this.multiple && this.state.selection.length ? (h("div", { id: `select-pillbox-${this.id}`, role: "listbox", "aria-orientation": "horizontal", class: "select-pills" }, this.state.selection.map((item, i) => (h("span", { class: {
611
+ pill: true,
612
+ 'select-no-open': true,
613
+ 'select-option-active': this.state.activeSelectionIndex === i
614
+ }, role: "option", "aria-selected": "true", id: `select-${this.id}-selection-${i}` }, item.render.avatar ? (h("cat-avatar", { label: item.render.label, round: item.render.avatar.round, src: item.render.avatar.src, icon: item.render.avatar.icon, initials: item.render.avatar.initials ?? '' })) : null, h("span", null, item.render.label), !this.disabled && (h("cat-button", { size: "xs", variant: "text", icon: "$cat:select-clear", iconOnly: true, a11yLabel: catI18nRegistry.t('select.deselect'), onClick: () => this.deselect(item.item.id), tabIndex: -1, onCatClick: event => event.stopPropagation() }))))))) : this.state.selection.length && this.state.selection[0].render.avatar ? (h("cat-avatar", { label: this.state.selection[0].render.label, round: this.state.selection[0].render.avatar.round, src: this.state.selection[0].render.avatar.src, icon: this.state.selection[0].render.avatar.icon, initials: this.state.selection[0].render.avatar.initials ?? '' })) : null, h("input", { ...this.nativeAttributes, class: "select-input", ref: el => (this.input = el), "aria-controls": this.isPillboxActive() ? `select-pillbox-${this.id}` : `select-listbox-${this.id}`, "aria-activedescendant": this.activeDescendant, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.hint?.length ? this.id + '-hint' : undefined, onInput: this.onInput.bind(this), value: !this.multiple ? this.state.term : undefined, placeholder: this.placeholder, disabled: this.disabled || this.state.isResolving })), this.state.isResolving && h("cat-spinner", null), this.invalid && (h("cat-icon", { icon: "$cat:input-error", class: "icon-suffix cat-text-danger", size: "l" })), (this.state.selection.length || this.state.term.length) &&
622
615
  !this.disabled &&
623
616
  !this.state.isResolving &&
624
- this.clearable ? (h("cat-button", { id: `select-clear-btn-${this.id}`, iconOnly: true, icon: "$cat:input-close", variant: "text", size: "s", a11yLabel: catI18nRegistry.t('input.clear'), onClick: () => this.clear() })) : null, !this.state.isResolving && (h("cat-button", { iconOnly: true, icon: "$cat:select-open", class: { 'select-btn': true, 'select-btn-open': this.state.isOpen }, variant: "text", size: "s", a11yLabel: this.state.isOpen ? catI18nRegistry.t('select.close') : catI18nRegistry.t('select.open'), "aria-controls": `select-listbox-${this.id}`, "aria-expanded": this.state.isOpen, tabIndex: -1, disabled: this.disabled || this.state.isResolving }))), (this.hint || this.hasSlottedHint || !!Object.keys(this.errorMap || {}).length) && (h(CatFormHint, { id: this.id, hint: this.hint, slottedHint: this.hasSlottedHint && h("slot", { name: "hint" }), errorMap: this.errorMap })))), h("div", { class: "select-dropdown", ref: el => (this.dropdown = el), style: { display: this.state.isOpen ? 'block' : undefined } }, this.state.isOpen && (h("cat-scrollable", { class: "select-options-wrapper", scrolledBuffer: 56, noOverflowX: true, noOverscroll: true, noScrolledInit: true, onScrolledBottom: () => this.more$.next() }, h("ul", { class: "select-options", role: "listbox", "aria-multiselectable": this.multiple, "aria-setsize": this.state.totalElements, id: `select-listbox-${this.id}` }, this.optionsList, this.state.isLoading
617
+ this.clearable ? (h("cat-button", { id: `select-clear-btn-${this.id}`, iconOnly: true, icon: "$cat:input-close", variant: "text", size: "s", a11yLabel: catI18nRegistry.t('input.clear'), onCatClick: event => {
618
+ event.stopPropagation();
619
+ this.clear();
620
+ } })) : null, !this.state.isResolving && (h("cat-button", { iconOnly: true, icon: "$cat:select-open", class: { 'select-btn': true, 'select-btn-open': this.state.isOpen }, variant: "text", size: "s", a11yLabel: this.state.isOpen ? catI18nRegistry.t('select.close') : catI18nRegistry.t('select.open'), "aria-controls": `select-listbox-${this.id}`, "aria-expanded": this.state.isOpen, tabIndex: -1, disabled: this.disabled || this.state.isResolving, onCatClick: event => event.stopPropagation() }))), (this.hint || this.hasSlottedHint || !!Object.keys(this.errorMap || {}).length) && (h(CatFormHint, { id: this.id, hint: this.hint, slottedHint: this.hasSlottedHint && h("slot", { name: "hint" }), errorMap: this.errorMap })))), h("div", { class: "select-dropdown", ref: el => (this.dropdown = el), style: { display: this.state.isOpen ? 'block' : undefined } }, this.state.isOpen && (h("cat-scrollable", { class: "select-options-wrapper", scrolledBuffer: 56, noOverflowX: true, noOverscroll: true, noScrolledInit: true, onScrolledBottom: () => this.more$.next() }, h("ul", { class: "select-options", role: "listbox", "aria-multiselectable": this.multiple, "aria-setsize": this.state.totalElements, id: `select-listbox-${this.id}` }, this.optionsList, this.state.isLoading
625
621
  ? Array.from(Array(CatSelect.SKELETON_COUNT)).map(() => (h("li", { class: "select-option-loading" }, h("cat-skeleton", { variant: "body", lines: 1 }), h("cat-skeleton", { variant: "body", lines: 1 }))))
626
622
  : !this.state.options.length &&
627
623
  !this.tags && (h("li", { class: "select-option-empty" }, this.noItems ? this.noItems : catI18nRegistry.t('select.empty')))))))));
@@ -631,7 +627,6 @@ const CatSelect = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
631
627
  }
632
628
  get optionsList() {
633
629
  return this.state.options.map((item, i) => {
634
- var _a, _b;
635
630
  const isTagOption = this.tags && item.item.id === `select-${this.id}-option-tag`;
636
631
  const isOptionSelected = this.isSelected(item.item.id) || (this.tags && this.isTagSelected(item.render.label));
637
632
  const getLabel = () => {
@@ -640,14 +635,14 @@ const CatSelect = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
640
635
  }
641
636
  return item.render.label;
642
637
  };
643
- return (h("li", { role: "option", class: "select-option", id: `select-${this.id}-option-${i}`, "aria-selected": isOptionSelected ? 'true' : 'false' }, this.multiple ? (h("cat-checkbox", { class: { 'select-option-active': this.state.activeOptionIndex === i }, checked: isOptionSelected, tabIndex: -1, labelLeft: true, onFocus: () => { var _a; return (_a = this.input) === null || _a === void 0 ? void 0 : _a.focus(); }, onCatChange: e => {
638
+ return (h("li", { role: "option", class: "select-option", id: `select-${this.id}-option-${i}`, "aria-selected": isOptionSelected ? 'true' : 'false' }, this.multiple ? (h("cat-checkbox", { class: { 'select-option-active': this.state.activeOptionIndex === i }, checked: isOptionSelected, tabIndex: -1, labelLeft: true, onFocus: () => this.input?.focus(), onCatChange: e => {
644
639
  !isTagOption ? this.toggle(item) : this.toggleTag(item);
645
640
  e.stopPropagation();
646
- } }, h("span", { slot: "label", class: "select-option-inner" }, item.render.avatar ? (h("cat-avatar", { label: item.render.label, round: item.render.avatar.round, src: item.render.avatar.src, icon: item.render.avatar.icon, initials: (_a = item.render.avatar.initials) !== null && _a !== void 0 ? _a : '' })) : null, h("span", { class: "select-option-text" }, h("span", { class: "select-option-label" }, getLabel()), h("span", { class: "select-option-description" }, item.render.description))))) : (h("div", { class: {
641
+ } }, h("span", { slot: "label", class: "select-option-inner" }, item.render.avatar ? (h("cat-avatar", { label: item.render.label, round: item.render.avatar.round, src: item.render.avatar.src, icon: item.render.avatar.icon, initials: item.render.avatar.initials ?? '' })) : null, h("span", { class: "select-option-text" }, h("span", { class: "select-option-label" }, getLabel()), h("span", { class: "select-option-description" }, item.render.description))))) : (h("div", { class: {
647
642
  'select-option-inner': true,
648
643
  'select-option-single': true,
649
644
  'select-option-active': this.state.activeOptionIndex === i
650
- }, onFocus: () => { var _a; return (_a = this.input) === null || _a === void 0 ? void 0 : _a.focus(); }, onClick: () => (isTagOption ? this.createTag(item.render.label) : this.select(item)), tabIndex: -1 }, item.render.avatar ? (h("cat-avatar", { label: item.render.label, round: item.render.avatar.round, src: item.render.avatar.src, icon: item.render.avatar.icon, initials: (_b = item.render.avatar.initials) !== null && _b !== void 0 ? _b : '' })) : null, h("span", { class: "select-option-text" }, h("span", { class: "select-option-label" }, getLabel()), h("span", { class: "select-option-description" }, item.render.description))))));
645
+ }, onFocus: () => this.input?.focus(), onClick: () => (isTagOption ? this.createTag(item.render.label) : this.select(item)), tabIndex: -1 }, item.render.avatar ? (h("cat-avatar", { label: item.render.label, round: item.render.avatar.round, src: item.render.avatar.src, icon: item.render.avatar.icon, initials: item.render.avatar.initials ?? '' })) : null, h("span", { class: "select-option-text" }, h("span", { class: "select-option-label" }, getLabel()), h("span", { class: "select-option-description" }, item.render.description))))));
651
646
  });
652
647
  }
653
648
  resolve() {
@@ -681,17 +676,16 @@ const CatSelect = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
681
676
  }
682
677
  toSelectItems(connector, items) {
683
678
  return items.map(item => ({
684
- item: Object.assign(Object.assign({}, item), { id: connector.customId ? connector.customId(item) : item.id }),
679
+ item: { ...item, id: connector.customId ? connector.customId(item) : item.id },
685
680
  render: connector.render(item)
686
681
  }));
687
682
  }
688
683
  show() {
689
- var _a;
690
684
  if (!this.state.isOpen) {
691
685
  this.patchState({ isOpen: true });
692
686
  this.catOpen.emit();
693
687
  this.term$.next('');
694
- (_a = this.input) === null || _a === void 0 ? void 0 : _a.classList.remove('select-input-transparent-caret');
688
+ this.input?.classList.remove('select-input-transparent-caret');
695
689
  }
696
690
  }
697
691
  hide() {
@@ -752,20 +746,18 @@ const CatSelect = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
752
746
  }
753
747
  }
754
748
  reset(connector) {
755
- var _a;
756
- this.connector = connector !== null && connector !== void 0 ? connector : this.connector;
757
- (_a = this.subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
749
+ this.connector = connector ?? this.connector;
750
+ this.subscription?.unsubscribe();
758
751
  this.subscription = undefined;
759
752
  this.state = INIT_STATE;
760
753
  }
761
754
  onClick(event) {
762
- var _a, _b;
763
755
  if (this.disabled) {
764
756
  return;
765
757
  }
766
758
  const elem = event.target;
767
- (_a = this.trigger) === null || _a === void 0 ? void 0 : _a.setAttribute('tabindex', '0');
768
- (_b = this.input) === null || _b === void 0 ? void 0 : _b.focus();
759
+ this.trigger?.setAttribute('tabindex', '0');
760
+ this.input?.focus();
769
761
  if (elem === this.trigger ||
770
762
  elem === this.input ||
771
763
  elem.classList.contains('select-btn') ||
@@ -774,15 +766,14 @@ const CatSelect = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
774
766
  }
775
767
  }
776
768
  onInput() {
777
- var _a, _b;
778
- this.search(((_a = this.input) === null || _a === void 0 ? void 0 : _a.value.trim()) || '');
769
+ this.search(this.input?.value.trim() || '');
779
770
  if (!this.multiple) {
780
771
  if (this.state.selection.length) {
781
772
  const selectionClone = [...this.state.selection];
782
773
  selectionClone.pop();
783
774
  this.patchState({ selection: selectionClone, tempSelection: [...this.state.selection] });
784
775
  }
785
- if (!((_b = this.input) === null || _b === void 0 ? void 0 : _b.value.trim())) {
776
+ if (!this.input?.value.trim()) {
786
777
  this.patchState({ tempSelection: [] });
787
778
  }
788
779
  }
@@ -804,7 +795,7 @@ const CatSelect = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
804
795
  }
805
796
  }
806
797
  patchState(update) {
807
- this.state = Object.assign(Object.assign({}, this.state), update);
798
+ this.state = { ...this.state, ...update };
808
799
  }
809
800
  isPillboxActive() {
810
801
  return this.state.activeSelectionIndex >= 0;
@@ -820,9 +811,8 @@ const CatSelect = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
820
811
  return activeDescendant;
821
812
  }
822
813
  onArrowKeyDown(event) {
823
- var _a, _b;
824
814
  let preventDefault = false;
825
- (_a = this.input) === null || _a === void 0 ? void 0 : _a.focus();
815
+ this.input?.focus();
826
816
  switch (event.key) {
827
817
  case 'ArrowDown':
828
818
  preventDefault = true;
@@ -843,7 +833,7 @@ const CatSelect = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
843
833
  : this.hide();
844
834
  break;
845
835
  case 'ArrowLeft':
846
- if (((_b = this.input) === null || _b === void 0 ? void 0 : _b.selectionStart) === 0) {
836
+ if (this.input?.selectionStart === 0) {
847
837
  preventDefault = true;
848
838
  let index;
849
839
  this.state.activeSelectionIndex > 0
@@ -879,7 +869,7 @@ const CatSelect = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
879
869
  createTag(term) {
880
870
  if (term.trim().length && !this.isTagSelected(term)) {
881
871
  const value = this.value;
882
- const tags = value === null || value === void 0 ? void 0 : value.tags;
872
+ const tags = value?.tags;
883
873
  const tag = { id: `select-${this.id}-tag-${tags ? tags.length : 0}`, name: term };
884
874
  this.select({ item: tag, render: { label: tag.name } });
885
875
  }
@@ -933,10 +923,9 @@ const CatSelect = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
933
923
  return tags;
934
924
  }
935
925
  setTransparentCaret() {
936
- var _a;
937
926
  if (!this.multiple) {
938
927
  this.hide();
939
- (_a = this.input) === null || _a === void 0 ? void 0 : _a.classList.add('select-input-transparent-caret');
928
+ this.input?.classList.add('select-input-transparent-caret');
940
929
  }
941
930
  }
942
931
  showErrors() {