@haiilo/catalyst 2.4.9 → 3.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 (87) hide show
  1. package/dist/catalyst/catalyst.css +2411 -2
  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 +2 -0
  5. package/dist/catalyst/p-52f9fea7.entry.js +2 -0
  6. package/dist/catalyst/{p-5bfc70e3.entry.js.map → p-52f9fea7.entry.js.map} +1 -1
  7. package/dist/catalyst/p-557c8009.entry.js +2 -0
  8. package/dist/catalyst/p-557c8009.entry.js.map +1 -0
  9. package/dist/catalyst/scss/_variables.scss +11 -11
  10. package/dist/catalyst/scss/_variables.tokens.scss +2 -2
  11. package/dist/catalyst/scss/core/_dialog.scss +66 -0
  12. package/dist/catalyst/scss/index.scss +1 -0
  13. package/dist/catalyst/scss/utils/_media.mixins.scss +1 -0
  14. package/dist/cjs/{cat-alert_23.cjs.entry.js → cat-alert_24.cjs.entry.js} +70 -18
  15. package/dist/cjs/cat-alert_24.cjs.entry.js.map +1 -0
  16. package/dist/cjs/cat-modal.cjs.entry.js +1 -1
  17. package/dist/cjs/cat-modal.cjs.entry.js.map +1 -1
  18. package/dist/cjs/catalyst.cjs.js +1 -1
  19. package/dist/cjs/loader.cjs.js +1 -1
  20. package/dist/collection/collection-manifest.json +1 -0
  21. package/dist/collection/components/cat-button/cat-button.js +23 -6
  22. package/dist/collection/components/cat-button/cat-button.js.map +1 -1
  23. package/dist/collection/components/cat-form-group/cat-form-group.css +3 -0
  24. package/dist/collection/components/cat-form-group/cat-form-group.js +66 -0
  25. package/dist/collection/components/cat-form-group/cat-form-group.js.map +1 -0
  26. package/dist/collection/components/cat-icon/cat-icon.js +21 -9
  27. package/dist/collection/components/cat-icon/cat-icon.js.map +1 -1
  28. package/dist/collection/components/cat-input/cat-input.js +27 -1
  29. package/dist/collection/components/cat-input/cat-input.js.map +1 -1
  30. package/dist/collection/components/cat-label/cat-label.js +27 -1
  31. package/dist/collection/components/cat-label/cat-label.js.map +1 -1
  32. package/dist/collection/components/cat-modal/cat-modal.css +1 -1
  33. package/dist/collection/components/cat-select/cat-select.js +47 -4
  34. package/dist/collection/components/cat-select/cat-select.js.map +1 -1
  35. package/dist/collection/components/cat-select-demo/cat-select-demo.js +1 -1
  36. package/dist/collection/components/cat-select-demo/cat-select-demo.js.map +1 -1
  37. package/dist/collection/components/cat-textarea/cat-textarea.js +31 -1
  38. package/dist/collection/components/cat-textarea/cat-textarea.js.map +1 -1
  39. package/dist/collection/index.cdn.js +2 -0
  40. package/dist/collection/scss/_variables.scss +11 -11
  41. package/dist/collection/scss/_variables.tokens.scss +2 -2
  42. package/dist/collection/scss/core/_dialog.scss +66 -0
  43. package/dist/collection/scss/index.scss +1 -0
  44. package/dist/collection/scss/utils/_media.mixins.scss +1 -0
  45. package/dist/components/cat-button2.js +7 -6
  46. package/dist/components/cat-button2.js.map +1 -1
  47. package/dist/components/cat-dropdown2.js.map +1 -1
  48. package/dist/components/cat-form-group.d.ts +11 -0
  49. package/dist/components/cat-form-group.js +64 -0
  50. package/dist/components/cat-form-group.js.map +1 -0
  51. package/dist/components/cat-icon2.js +2 -5
  52. package/dist/components/cat-icon2.js.map +1 -1
  53. package/dist/components/cat-input.js +6 -1
  54. package/dist/components/cat-input.js.map +1 -1
  55. package/dist/components/cat-label.js +6 -1
  56. package/dist/components/cat-label.js.map +1 -1
  57. package/dist/components/cat-modal.js +1 -1
  58. package/dist/components/cat-modal.js.map +1 -1
  59. package/dist/components/cat-select-demo.js +1 -1
  60. package/dist/components/cat-select-demo.js.map +1 -1
  61. package/dist/components/cat-select2.js +8 -2
  62. package/dist/components/cat-select2.js.map +1 -1
  63. package/dist/components/cat-textarea.js +7 -1
  64. package/dist/components/cat-textarea.js.map +1 -1
  65. package/dist/components/index.d.ts +1 -0
  66. package/dist/components/index.js +1 -0
  67. package/dist/components/index.js.map +1 -1
  68. package/dist/esm/{cat-alert_23.entry.js → cat-alert_24.entry.js} +70 -19
  69. package/dist/esm/cat-alert_24.entry.js.map +1 -0
  70. package/dist/esm/cat-modal.entry.js +1 -1
  71. package/dist/esm/cat-modal.entry.js.map +1 -1
  72. package/dist/esm/catalyst.js +1 -1
  73. package/dist/esm/loader.js +1 -1
  74. package/dist/types/components/cat-button/cat-button.d.ts +5 -0
  75. package/dist/types/components/cat-form-group/cat-form-group.d.ts +16 -0
  76. package/dist/types/components/cat-icon/cat-icon.d.ts +5 -1
  77. package/dist/types/components/cat-input/cat-input.d.ts +4 -0
  78. package/dist/types/components/cat-label/cat-label.d.ts +4 -0
  79. package/dist/types/components/cat-select/cat-select.d.ts +13 -5
  80. package/dist/types/components/cat-textarea/cat-textarea.d.ts +4 -0
  81. package/dist/types/components.d.ts +80 -3
  82. package/package.json +2 -2
  83. package/dist/catalyst/p-5bfc70e3.entry.js +0 -2
  84. package/dist/catalyst/p-602c38be.entry.js +0 -2
  85. package/dist/catalyst/p-602c38be.entry.js.map +0 -1
  86. package/dist/cjs/cat-alert_23.cjs.entry.js.map +0 -1
  87. package/dist/esm/cat-alert_23.entry.js.map +0 -1
@@ -31,34 +31,34 @@ $cat-elevation: (
31
31
  0: none,
32
32
  1: (
33
33
  0 0 0 1px cat-token('color.ui.border.default'),
34
- 0 1px 2px rgba(27, 31, 38, 0.05)
34
+ 0 1px 2px rgba(27, 31, 38, 5%)
35
35
  ),
36
36
  2: (
37
37
  0 0 0 1px cat-token('color.ui.border.default'),
38
- 0 1px 2px rgba(27, 31, 38, 0.06),
39
- 0 1px 3px rgba(27, 31, 38, 0.1)
38
+ 0 1px 2px rgba(27, 31, 38, 6%),
39
+ 0 1px 3px rgba(27, 31, 38, 10%)
40
40
  ),
41
41
  3: (
42
42
  0 0 0 1px cat-token('color.ui.border.default'),
43
- 0 2px 4px -2px rgba(27, 31, 38, 0.06),
44
- 0 4px 8px -2px rgba(27, 31, 38, 0.1)
43
+ 0 2px 4px -2px rgba(27, 31, 38, 6%),
44
+ 0 4px 8px -2px rgba(27, 31, 38, 10%)
45
45
  ),
46
46
  4: (
47
47
  0 0 0 1px cat-token('color.ui.border.default'),
48
- 0 4px 6px -2px rgba(27, 31, 38, 0.03),
49
- 0 12px 16px -4px rgba(27, 31, 38, 0.08)
48
+ 0 4px 6px -2px rgba(27, 31, 38, 3%),
49
+ 0 12px 16px -4px rgba(27, 31, 38, 8%)
50
50
  ),
51
51
  5: (
52
52
  0 0 0 1px cat-token('color.ui.border.default'),
53
- 0 8px 8px -4px rgba(27, 31, 38, 0.03),
54
- 0 20px 24px -4px rgba(27, 31, 38, 0.08)
53
+ 0 8px 8px -4px rgba(27, 31, 38, 3%),
54
+ 0 20px 24px -4px rgba(27, 31, 38, 8%)
55
55
  ),
56
56
  6: (
57
57
  0 0 0 1px cat-token('color.ui.border.default'),
58
- 0 24px 48px -12px rgba(27, 31, 38, 0.18)
58
+ 0 24px 48px -12px rgba(27, 31, 38, 18%)
59
59
  ),
60
60
  7: (
61
61
  0 0 0 1px cat-token('color.ui.border.default'),
62
- 0 32px 64px -12px rgba(27, 31, 38, 0.14)
62
+ 0 32px 64px -12px rgba(27, 31, 38, 14%)
63
63
  )
64
64
  );
@@ -49,7 +49,7 @@
49
49
 
50
50
  @function cat-token-wrap($value, $alpha: 1) {
51
51
  @if meta.type-of($value) == 'string' {
52
- @if $alpha < 1 {
52
+ @if meta.type-of($alpha) != 'number' or $alpha < 1 {
53
53
  @return rgba($value, $alpha);
54
54
  } @else {
55
55
  @return rgb($value);
@@ -80,7 +80,7 @@
80
80
  @if string.index($key, 'color.') == 1 {
81
81
  @if $wrap {
82
82
  @return cat-token-wrap($value, $alpha);
83
- } @else if $alpha < 1 {
83
+ } @else if meta.type-of($alpha) != 'number' or $alpha < 1 {
84
84
  @return $value, $alpha;
85
85
  }
86
86
  }
@@ -0,0 +1,66 @@
1
+ @use '../variables' as *;
2
+ @use '../mixins' as *;
3
+
4
+ /**
5
+ * Dialog makes assumptions about the DOM structure of the dialog content.
6
+ * The following selectors are used to style the dialog content based on its
7
+ * position in the DOM hierarchy.
8
+ *
9
+ * .cat-backdrop
10
+ * |- .cat-dialog
11
+ * |- .cat-dialog-header
12
+ * |- .cat-dialog-header-content
13
+ * |- .cat-dialog-content
14
+ * |- .cat-dialog-actions
15
+ **/
16
+
17
+ $-dialog-padding: 1.5rem;
18
+
19
+ .cat-backdrop {
20
+ background-color: cat-token('color.ui.background.backdrop', cat-token('opacity.backdrop'));
21
+ }
22
+
23
+ .cat-dialog {
24
+ background-color: cat-token('color.ui.background.body');
25
+ border-radius: cat-border-radius('l');
26
+ @include cat-elevation(7);
27
+ container: dialog / inline-size;
28
+ }
29
+
30
+ .cat-dialog-header {
31
+ display: flex;
32
+ align-items: center;
33
+ gap: 1rem;
34
+ padding: $-dialog-padding;
35
+ }
36
+
37
+ .cat-dialog-header-content {
38
+ flex: 1 1 auto;
39
+ display: flex;
40
+ flex-direction: column;
41
+ gap: 0.5rem;
42
+ word-wrap: break-word;
43
+ word-break: break-word;
44
+ }
45
+
46
+ .cat-dialog-content {
47
+ overflow: auto;
48
+ padding: 0 $-dialog-padding;
49
+
50
+ > *:last-child {
51
+ margin-bottom: 0;
52
+ }
53
+ }
54
+
55
+ .cat-dialog-actions {
56
+ display: flex;
57
+ padding: $-dialog-padding;
58
+ gap: 0.5rem;
59
+ flex-wrap: wrap;
60
+
61
+ @container dialog (max-width: 360px) {
62
+ cat-button {
63
+ width: 100%;
64
+ }
65
+ }
66
+ }
@@ -10,6 +10,7 @@
10
10
 
11
11
  // -- Core
12
12
  @import 'core/base';
13
+ @import 'core/dialog';
13
14
  @import 'core/form';
14
15
  @import 'core/nav';
15
16
  @import 'core/notification';
@@ -3,6 +3,7 @@
3
3
  // ---- Responsive
4
4
 
5
5
  @mixin until($size, $media-type: screen) {
6
+ @debug 'until', $size;
6
7
  @media #{$media-type} and (max-width: #{cat-token('size.screen.#{$size}') - 1px}) {
7
8
  @content;
8
9
  }
@@ -445,19 +445,19 @@ const CatButton = class {
445
445
  }
446
446
  }
447
447
  get isIconButton() {
448
- return Boolean(this.icon) && this._iconOnly;
448
+ return (Boolean(this.icon) || Boolean(this.iconSrc)) && this._iconOnly;
449
449
  }
450
450
  get hasPrefixIcon() {
451
- return Boolean(this.icon) && !this._iconOnly && !this.iconRight;
451
+ return (Boolean(this.icon) || Boolean(this.iconSrc)) && !this._iconOnly && !this.iconRight;
452
452
  }
453
453
  get hasSuffixIcon() {
454
- return Boolean(this.icon) && !this._iconOnly && this.iconRight;
454
+ return (Boolean(this.icon) || Boolean(this.iconSrc)) && !this._iconOnly && this.iconRight;
455
455
  }
456
456
  get content() {
457
457
  return [
458
- this.hasPrefixIcon ? index.h("cat-icon", { icon: this.icon, size: this.iconSize, part: "prefix" }) : null,
459
- this.isIconButton ? (index.h("cat-icon", { icon: this.icon, size: this.iconSize })) : (index.h("span", { class: "cat-button-content", part: "content" }, index.h("slot", null))),
460
- this.hasSuffixIcon ? index.h("cat-icon", { icon: this.icon, size: this.iconSize, part: "suffix" }) : null,
458
+ this.hasPrefixIcon ? (index.h("cat-icon", { icon: this.icon, iconSrc: this.iconSrc, size: this.iconSize, part: "prefix" })) : null,
459
+ this.isIconButton ? (index.h("cat-icon", { icon: this.icon, iconSrc: this.iconSrc, size: this.iconSize })) : (index.h("span", { class: "cat-button-content", part: "content" }, index.h("slot", null))),
460
+ this.hasSuffixIcon ? (index.h("cat-icon", { icon: this.icon, iconSrc: this.iconSrc, size: this.iconSize, part: "suffix" })) : null,
461
461
  this.loading ? index.h("cat-spinner", { size: this.spinnerSize }) : null
462
462
  ];
463
463
  }
@@ -1887,22 +1887,57 @@ const CatDropdown = class {
1887
1887
  CatDropdown.OFFSET = 4;
1888
1888
  CatDropdown.style = catDropdownCss;
1889
1889
 
1890
- const catIconCss = ":host{display:inline-flex;vertical-align:middle;-webkit-user-select:none;-ms-user-select:none;user-select:none;}:host([hidden]){display:none}span{display:inline-flex}svg{fill:currentColor;stroke:none;transform-origin:center center;height:1em;width:calc(var(--cat-icon-ratio, 1) * 1em)}.icon-xs svg{font-size:0.75rem}.icon-s svg{font-size:1rem}.icon-m svg{font-size:1.25rem}.icon-l svg{font-size:1.5rem}.icon-xl svg{font-size:1.75rem}";
1890
+ const catFormGroupCss = ":host{display:block}";
1891
1891
 
1892
- const CatIcon = class {
1892
+ const CatFormGroup = class {
1893
1893
  constructor(hostRef) {
1894
1894
  index.registerInstance(this, hostRef);
1895
+ this.formElements = [];
1895
1896
  /**
1896
- * The name of the icon.
1897
+ * Whether the labels need a marker to shown if the forms fields are required or optional.<br /><br />
1898
+ * By default, it is set to auto, it will display the mark depending on the number of required and optional fields: <br />
1899
+ * - If there are more required, the optional will be marked.<br />
1900
+ * - If there are less required, it will mark the required.<br /><br />
1901
+ * If a form field had "!", the requiredMarked of the field would not change.
1897
1902
  */
1898
- this.icon = '';
1903
+ this.requiredMarker = 'auto';
1904
+ }
1905
+ onRequiredMarker(newRequiredMarker) {
1906
+ const updateMarker = newRequiredMarker === 'auto' ? this.calculate(this.formElements) : newRequiredMarker;
1907
+ this.formElements.forEach(element => { var _a; return !((_a = element.requiredMarker) === null || _a === void 0 ? void 0 : _a.endsWith('!')) && (element.requiredMarker = updateMarker); });
1908
+ }
1909
+ render() {
1910
+ return (index.h(index.Host, null, index.h("slot", { onSlotchange: this.onSlotChange.bind(this) })));
1911
+ }
1912
+ onSlotChange() {
1913
+ this.formElements = Array.from(this.hostElement.querySelectorAll('cat-textarea, cat-input, cat-select, cat-label'));
1914
+ this.onRequiredMarker(this.requiredMarker);
1915
+ }
1916
+ calculate(elements) {
1917
+ const formFields = elements.filter(value => value.tagName !== 'CAT-LABEL');
1918
+ const optionalFields = formFields.filter(value => !value.required).length;
1919
+ const requiredFields = formFields.length - optionalFields;
1920
+ return requiredFields >= optionalFields ? 'optional' : 'required';
1921
+ }
1922
+ get hostElement() { return index.getElement(this); }
1923
+ static get watchers() { return {
1924
+ "requiredMarker": ["onRequiredMarker"]
1925
+ }; }
1926
+ };
1927
+ CatFormGroup.style = catFormGroupCss;
1928
+
1929
+ const catIconCss = ":host{display:inline-flex;vertical-align:middle;-webkit-user-select:none;-ms-user-select:none;user-select:none;}:host([hidden]){display:none}span{display:inline-flex}svg{fill:currentColor;stroke:none;transform-origin:center center;height:1em;width:calc(var(--cat-icon-ratio, 1) * 1em)}.icon-xs svg{font-size:0.75rem}.icon-s svg{font-size:1rem}.icon-m svg{font-size:1.25rem}.icon-l svg{font-size:1.5rem}.icon-xl svg{font-size:1.75rem}";
1930
+
1931
+ const CatIcon = class {
1932
+ constructor(hostRef) {
1933
+ index.registerInstance(this, hostRef);
1899
1934
  /**
1900
1935
  * The size of the icon.
1901
1936
  */
1902
1937
  this.size = 'm';
1903
1938
  }
1904
1939
  render() {
1905
- return (index.h("span", { innerHTML: catIconRegistry.catIconRegistry.getIcon(this.icon), "aria-label": this.a11yLabel, "aria-hidden": this.a11yLabel ? null : 'true', part: "icon", class: {
1940
+ return (index.h("span", { innerHTML: this.iconSrc || (this.icon ? catIconRegistry.catIconRegistry.getIcon(this.icon) : ''), "aria-label": this.a11yLabel, "aria-hidden": this.a11yLabel ? null : 'true', part: "icon", class: {
1906
1941
  icon: true,
1907
1942
  [`icon-${this.size}`]: this.size !== 'inline'
1908
1943
  } }));
@@ -1921,6 +1956,10 @@ const CatInput = class {
1921
1956
  this.catBlur = index.createEvent(this, "catBlur", 7);
1922
1957
  this._id = `cat-input-${nextUniqueId$6++}`;
1923
1958
  this.hasSlottedLabel = false;
1959
+ /**
1960
+ * Whether the label need a marker to shown if the input is required or optional.
1961
+ */
1962
+ this.requiredMarker = 'optional';
1924
1963
  /**
1925
1964
  * Whether the input should show a clear button.
1926
1965
  */
@@ -1997,7 +2036,7 @@ const CatInput = class {
1997
2036
  this.value = '';
1998
2037
  }
1999
2038
  render() {
2000
- return (index.h(index.Host, null, (this.hasSlottedLabel || this.label) && (index.h("label", { htmlFor: this.id, class: { hidden: this.labelHidden } }, index.h("span", { part: "label" }, (this.hasSlottedLabel && index.h("slot", { name: "label" })) || this.label, !this.required && (index.h("span", { class: "input-optional", "aria-hidden": "true" }, "(", catIconRegistry.catI18nRegistry.t('input.optional'), ")"))))), index.h("div", { class: {
2039
+ return (index.h(index.Host, null, (this.hasSlottedLabel || this.label) && (index.h("label", { htmlFor: this.id, class: { hidden: this.labelHidden } }, index.h("span", { part: "label" }, (this.hasSlottedLabel && index.h("slot", { name: "label" })) || this.label, !this.required && this.requiredMarker.startsWith('optional') && (index.h("span", { class: "input-optional", "aria-hidden": "true" }, "(", catIconRegistry.catI18nRegistry.t('input.optional'), ")")), this.required && this.requiredMarker.startsWith('required') && (index.h("span", { class: "input-optional", "aria-hidden": "true" }, "(", catIconRegistry.catI18nRegistry.t('input.required'), ")"))))), index.h("div", { class: {
2001
2040
  'input-wrapper': true,
2002
2041
  'input-round': this.round,
2003
2042
  'input-disabled': this.disabled
@@ -2028,6 +2067,10 @@ const catLabelCss = ":host{display:inline-flex;align-items:center;min-height:2.5
2028
2067
  const CatLabel = class {
2029
2068
  constructor(hostRef) {
2030
2069
  index.registerInstance(this, hostRef);
2070
+ /**
2071
+ * Whether the label need a marker to shown if the input is required or optional.
2072
+ */
2073
+ this.requiredMarker = 'optional';
2031
2074
  /**
2032
2075
  * A value is required or must be check for the form to be submittable.
2033
2076
  */
@@ -2041,7 +2084,7 @@ const CatLabel = class {
2041
2084
  }
2042
2085
  }
2043
2086
  render() {
2044
- return (index.h(index.Host, null, index.h("label", { htmlFor: this.for, onClick: this.onClick.bind(this) }, index.h("slot", null), !this.required && (index.h("span", { class: "input-optional", "aria-hidden": "true" }, "(", catIconRegistry.catI18nRegistry.t('input.optional'), ")")))));
2087
+ return (index.h(index.Host, null, index.h("label", { htmlFor: this.for, onClick: this.onClick.bind(this) }, index.h("slot", null), !this.required && this.requiredMarker.startsWith('optional') && (index.h("span", { class: "input-optional", "aria-hidden": "true" }, "(", catIconRegistry.catI18nRegistry.t('input.optional'), ")")), this.required && this.requiredMarker.startsWith('required') && (index.h("span", { class: "input-optional", "aria-hidden": "true" }, "(", catIconRegistry.catI18nRegistry.t('input.required'), ")")))));
2045
2088
  }
2046
2089
  findShadowTarget(id) {
2047
2090
  var _a;
@@ -4211,6 +4254,10 @@ const CatSelect = class {
4211
4254
  this.valueChangedBySelection = false;
4212
4255
  this.state = INIT_STATE;
4213
4256
  this.hasSlottedLabel = false;
4257
+ /**
4258
+ * Whether the label need a marker to shown if the select is required or optional.
4259
+ */
4260
+ this.requiredMarker = 'optional';
4214
4261
  /**
4215
4262
  * Enable multiple selection.
4216
4263
  */
@@ -4444,7 +4491,7 @@ const CatSelect = class {
4444
4491
  });
4445
4492
  }
4446
4493
  render() {
4447
- return (index.h(index.Host, null, (this.hasSlottedLabel || this.label) && (index.h("label", { htmlFor: this.id, class: { hidden: this.labelHidden } }, index.h("span", { part: "label" }, (this.hasSlottedLabel && index.h("slot", { name: "label" })) || this.label, !this.required && (index.h("span", { class: "input-optional", "aria-hidden": "true" }, "(", catIconRegistry.catI18nRegistry.t('input.optional'), ")"))))), index.h("div", { class: { 'select-wrapper': true, 'select-disabled': this.disabled }, 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, "aria-activedescendant": this.activeDescendant, onClick: e => this.onClick(e) }, index.h("div", { class: "select-wrapper-inner" }, this.multiple && this.state.selection.length ? (index.h("div", { id: `select-pillbox-${this.id}`, role: "listbox", "aria-orientation": "horizontal", class: "select-pills" }, this.state.selection.map((item, i) => (index.h("span", { class: {
4494
+ return (index.h(index.Host, null, (this.hasSlottedLabel || this.label) && (index.h("label", { htmlFor: this.id, class: { hidden: this.labelHidden } }, index.h("span", { part: "label" }, (this.hasSlottedLabel && index.h("slot", { name: "label" })) || this.label, !this.required && this.requiredMarker.startsWith('optional') && (index.h("span", { class: "input-optional", "aria-hidden": "true" }, "(", catIconRegistry.catI18nRegistry.t('input.optional'), ")")), this.required && this.requiredMarker.startsWith('required') && (index.h("span", { class: "input-optional", "aria-hidden": "true" }, "(", catIconRegistry.catI18nRegistry.t('input.required'), ")"))))), index.h("div", { class: { 'select-wrapper': true, 'select-disabled': this.disabled }, 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) }, index.h("div", { class: "select-wrapper-inner" }, this.multiple && this.state.selection.length ? (index.h("div", { id: `select-pillbox-${this.id}`, role: "listbox", "aria-orientation": "horizontal", class: "select-pills" }, this.state.selection.map((item, i) => (index.h("span", { class: {
4448
4495
  pill: true,
4449
4496
  'select-no-open': true,
4450
4497
  'select-option-active': this.state.activeSelectionIndex === i
@@ -4454,7 +4501,7 @@ const CatSelect = class {
4454
4501
  this.clearable ? (index.h("cat-button", { id: `select-clear-btn-${this.id}`, iconOnly: true, icon: "cross-circle-outlined", variant: "text", size: "s", a11yLabel: catIconRegistry.catI18nRegistry.t('input.clear'), onClick: () => this.clear() })) : null, !this.state.isResolving && (index.h("cat-button", { iconOnly: true, icon: "chevron-down-outlined", class: { 'select-btn': true, 'select-btn-open': this.state.isOpen }, variant: "text", size: "s", a11yLabel: this.state.isOpen ? catIconRegistry.catI18nRegistry.t('select.close') : catIconRegistry.catI18nRegistry.t('select.open'), "aria-controls": `select-listbox-${this.id}`, "aria-expanded": this.state.isOpen, tabIndex: -1, disabled: this.disabled || this.state.isResolving }))), this.hintSection, index.h("div", { class: "select-dropdown", ref: el => (this.dropdown = el), style: { display: this.state.isOpen ? 'block' : undefined } }, this.state.isOpen && (index.h("cat-scrollable", { class: "select-options-wrapper", scrolledBuffer: 56, noOverflowX: true, noOverscroll: true, noScrolledInit: true, onScrolledBottom: () => this.more$.next() }, index.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
4455
4502
  ? Array.from(Array(CatSelect.SKELETON_COUNT)).map(() => (index.h("li", { class: "select-option-loading" }, index.h("cat-skeleton", { variant: "body", lines: 1 }), index.h("cat-skeleton", { variant: "body", lines: 1 }))))
4456
4503
  : !this.state.options.length &&
4457
- !this.tags && index.h("li", { class: "select-option-empty" }, catIconRegistry.catI18nRegistry.t('select.empty'))))))));
4504
+ !this.tags && (index.h("li", { class: "select-option-empty" }, this.noItems ? this.noItems : catIconRegistry.catI18nRegistry.t('select.empty')))))))));
4458
4505
  }
4459
4506
  get optionsList() {
4460
4507
  return this.state.options.map((item, i) => {
@@ -4881,7 +4928,7 @@ const CatSelectTest = class {
4881
4928
  setTimeout(() => this.multipleSelect && (this.multipleSelect.value = []), 5000);
4882
4929
  }
4883
4930
  render() {
4884
- return (index.h(index.Host, { style: { display: 'flex', flexDirection: 'column' } }, index.h("cat-select", { label: "Multiple Select", hint: "This is a hint!", ref: el => (this.multipleSelect = el), value: ['1'], placeholder: "Hello World", onCatChange: () => { var _a; return console.log((_a = this.multipleSelect) === null || _a === void 0 ? void 0 : _a.value); }, onCatBlur: e => console.log('Multiple blur', e), multiple: true, clearable: true }, index.h("span", { slot: "hint" }, "Searching for \"no\" -", '>', " no options are returned!")), index.h("cat-select", { label: "Multiple with img", ref: el => (this.multipleSelectAvatar = el), value: ['1'], placeholder: "Hello World", multiple: true, clearable: true }), index.h("cat-select", { label: "Multiple with tagging support", hint: "This is a hint!", ref: el => (this.multipleSelectTagging = el), value: { ids: ['1'], tags: ['Test', 'Albania', 'Algeria'] }, placeholder: "Select country", onCatChange: () => { var _a; return console.log((_a = this.multipleSelectTagging) === null || _a === void 0 ? void 0 : _a.value); }, multiple: true, tags: true, clearable: true }), index.h("cat-select", { label: "Single Select", hint: "This is a hint!", ref: el => (this.singleSelect = el), placeholder: "Search for a country or capital", onCatBlur: e => console.log('Single blur', e), clearable: true }), index.h("cat-select", { label: "Single with img", ref: el => (this.singleSelectAvatar = el), value: '1', onCatChange: () => { var _a; return console.log((_a = this.singleSelectAvatar) === null || _a === void 0 ? void 0 : _a.value); }, placeholder: "Search for a country or capital", clearable: true }), index.h("cat-dropdown", { overflow: true, noAutoClose: true }, index.h("cat-button", { slot: "trigger", style: { width: '50%' } }, "Open select"), index.h("div", { slot: "content", style: { width: '400px' } }, index.h("cat-select", { label: "Single with tagging support", ref: el => (this.singleSelectTagging = el), value: { id: '', tag: 'Albania' }, placeholder: "Search for a country or capital", onCatChange: () => { var _a; return console.log('Single', (_a = this.singleSelectTagging) === null || _a === void 0 ? void 0 : _a.value); }, tagHint: "new country", tags: true, clearable: true, style: { width: '90%' } })))));
4931
+ return (index.h(index.Host, { style: { display: 'flex', flexDirection: 'column' } }, index.h("cat-select", { label: "Multiple Select", hint: "This is a hint!", ref: el => (this.multipleSelect = el), value: ['1'], placeholder: "Hello World", onCatChange: () => { var _a; return console.log((_a = this.multipleSelect) === null || _a === void 0 ? void 0 : _a.value); }, onCatBlur: e => console.log('Multiple blur', e), multiple: true, noItems: "No results", clearable: true }, index.h("span", { slot: "hint" }, "Searching for \"no\" -", '>', " no options are returned!")), index.h("cat-select", { label: "Multiple with img", ref: el => (this.multipleSelectAvatar = el), value: ['1'], placeholder: "Hello World", multiple: true, clearable: true }), index.h("cat-select", { label: "Multiple with tagging support", hint: "This is a hint!", ref: el => (this.multipleSelectTagging = el), value: { ids: ['1'], tags: ['Test', 'Albania', 'Algeria'] }, placeholder: "Select country", onCatChange: () => { var _a; return console.log((_a = this.multipleSelectTagging) === null || _a === void 0 ? void 0 : _a.value); }, multiple: true, tags: true, clearable: true }), index.h("cat-select", { label: "Single Select", hint: "This is a hint!", ref: el => (this.singleSelect = el), placeholder: "Search for a country or capital", onCatBlur: e => console.log('Single blur', e), clearable: true }), index.h("cat-select", { label: "Single with img", ref: el => (this.singleSelectAvatar = el), value: '1', onCatChange: () => { var _a; return console.log((_a = this.singleSelectAvatar) === null || _a === void 0 ? void 0 : _a.value); }, placeholder: "Search for a country or capital", clearable: true }), index.h("cat-dropdown", { overflow: true, noAutoClose: true }, index.h("cat-button", { slot: "trigger", style: { width: '50%' } }, "Open select"), index.h("div", { slot: "content", style: { width: '400px' } }, index.h("cat-select", { label: "Single with tagging support", ref: el => (this.singleSelectTagging = el), value: { id: '', tag: 'Albania' }, placeholder: "Search for a country or capital", onCatChange: () => { var _a; return console.log('Single', (_a = this.singleSelectTagging) === null || _a === void 0 ? void 0 : _a.value); }, tagHint: "new country", tags: true, clearable: true, style: { width: '90%' } })))));
4885
4932
  }
4886
4933
  get countryConnector() {
4887
4934
  return {
@@ -6328,6 +6375,10 @@ const CatTextarea = class {
6328
6375
  this.catBlur = index.createEvent(this, "catBlur", 7);
6329
6376
  this._id = `cat-textarea-${nextUniqueId$2++}`;
6330
6377
  this.hasSlottedLabel = false;
6378
+ /**
6379
+ * Whether the label need a marker to shown if the textarea is required or optional.
6380
+ */
6381
+ this.requiredMarker = 'optional';
6331
6382
  /**
6332
6383
  * Whether the textarea is disabled.
6333
6384
  */
@@ -6389,7 +6440,7 @@ const CatTextarea = class {
6389
6440
  this.textarea.click();
6390
6441
  }
6391
6442
  render() {
6392
- return (index.h(index.Host, null, (this.hasSlottedLabel || this.label) && (index.h("label", { htmlFor: this.id, class: { hidden: this.labelHidden } }, index.h("span", { part: "label" }, (this.hasSlottedLabel && index.h("slot", { name: "label" })) || this.label, !this.required && (index.h("span", { class: "input-optional", "aria-hidden": "true" }, "(Optional)"))))), index.h("textarea", { ref: el => (this.textarea = el), id: this.id, disabled: this.disabled, maxlength: this.maxLength, minlength: this.minLength, name: this.name, placeholder: this.placeholder, readonly: this.readonly, required: this.required, rows: this.rows, value: this.value, onInput: this.onInput.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this) }), this.hintSection));
6443
+ return (index.h(index.Host, null, (this.hasSlottedLabel || this.label) && (index.h("label", { htmlFor: this.id, class: { hidden: this.labelHidden } }, index.h("span", { part: "label" }, (this.hasSlottedLabel && index.h("slot", { name: "label" })) || this.label, !this.required && this.requiredMarker.startsWith('optional') && (index.h("span", { class: "input-optional", "aria-hidden": "true" }, "(", catIconRegistry.catI18nRegistry.t('input.optional'), ")")), this.required && this.requiredMarker.startsWith('required') && (index.h("span", { class: "input-optional", "aria-hidden": "true" }, "(", catIconRegistry.catI18nRegistry.t('input.required'), ")"))))), index.h("textarea", { ref: el => (this.textarea = el), id: this.id, disabled: this.disabled, maxlength: this.maxLength, minlength: this.minLength, name: this.name, placeholder: this.placeholder, readonly: this.readonly, required: this.required, rows: this.rows, value: this.value, onInput: this.onInput.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this) }), this.hintSection));
6393
6444
  }
6394
6445
  get hintSection() {
6395
6446
  const hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
@@ -6655,6 +6706,7 @@ exports.cat_button = CatButton;
6655
6706
  exports.cat_card = CatCard;
6656
6707
  exports.cat_checkbox = CatCheckbox;
6657
6708
  exports.cat_dropdown = CatDropdown;
6709
+ exports.cat_form_group = CatFormGroup;
6658
6710
  exports.cat_icon = CatIcon;
6659
6711
  exports.cat_input = CatInput;
6660
6712
  exports.cat_label = CatLabel;
@@ -6672,4 +6724,4 @@ exports.cat_textarea = CatTextarea;
6672
6724
  exports.cat_toggle = CatToggle;
6673
6725
  exports.cat_tooltip = CatTooltip;
6674
6726
 
6675
- //# sourceMappingURL=cat-alert_23.cjs.entry.js.map
6727
+ //# sourceMappingURL=cat-alert_24.cjs.entry.js.map