@haiilo/catalyst 2.1.3 → 2.4.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 (77) hide show
  1. package/dist/catalyst/catalyst.css +1 -1
  2. package/dist/catalyst/catalyst.esm.js +1 -1
  3. package/dist/catalyst/catalyst.esm.js.map +1 -1
  4. package/dist/catalyst/p-e5f9669a.entry.js +2 -0
  5. package/dist/catalyst/p-e5f9669a.entry.js.map +1 -0
  6. package/dist/catalyst/scss/core/_typography.scss +11 -5
  7. package/dist/cjs/{cat-alert_22.cjs.entry.js → cat-alert_23.cjs.entry.js} +71 -29
  8. package/dist/cjs/cat-alert_23.cjs.entry.js.map +1 -0
  9. package/dist/cjs/catalyst.cjs.js +1 -1
  10. package/dist/cjs/loader.cjs.js +1 -1
  11. package/dist/collection/collection-manifest.json +1 -0
  12. package/dist/collection/components/cat-alert/cat-alert.js +2 -3
  13. package/dist/collection/components/cat-alert/cat-alert.js.map +1 -1
  14. package/dist/collection/components/cat-badge/cat-badge.js +5 -11
  15. package/dist/collection/components/cat-badge/cat-badge.js.map +1 -1
  16. package/dist/collection/components/cat-checkbox/cat-checkbox.js +21 -1
  17. package/dist/collection/components/cat-checkbox/cat-checkbox.js.map +1 -1
  18. package/dist/collection/components/cat-input/cat-input.js +24 -9
  19. package/dist/collection/components/cat-input/cat-input.js.map +1 -1
  20. package/dist/collection/components/cat-label/cat-label.css +16 -0
  21. package/dist/collection/components/cat-label/cat-label.js +96 -0
  22. package/dist/collection/components/cat-label/cat-label.js.map +1 -0
  23. package/dist/collection/components/cat-radio/cat-radio.js +22 -2
  24. package/dist/collection/components/cat-radio/cat-radio.js.map +1 -1
  25. package/dist/collection/components/cat-select/cat-select.js +24 -9
  26. package/dist/collection/components/cat-select/cat-select.js.map +1 -1
  27. package/dist/collection/components/cat-textarea/cat-textarea.js +24 -9
  28. package/dist/collection/components/cat-textarea/cat-textarea.js.map +1 -1
  29. package/dist/collection/components/cat-toggle/cat-toggle.js +21 -1
  30. package/dist/collection/components/cat-toggle/cat-toggle.js.map +1 -1
  31. package/dist/collection/scss/core/_typography.scss +11 -5
  32. package/dist/collection/utils/setDefault.js +2 -2
  33. package/dist/collection/utils/setDefault.js.map +1 -1
  34. package/dist/components/cat-alert.js +7 -3
  35. package/dist/components/cat-alert.js.map +1 -1
  36. package/dist/components/cat-badge.js +5 -11
  37. package/dist/components/cat-badge.js.map +1 -1
  38. package/dist/components/cat-checkbox2.js +5 -1
  39. package/dist/components/cat-checkbox2.js.map +1 -1
  40. package/dist/components/cat-dropdown2.js.map +1 -1
  41. package/dist/components/cat-input.js +5 -5
  42. package/dist/components/cat-input.js.map +1 -1
  43. package/dist/components/cat-label.d.ts +11 -0
  44. package/dist/components/cat-label.js +71 -0
  45. package/dist/components/cat-label.js.map +1 -0
  46. package/dist/components/cat-radio.js +6 -2
  47. package/dist/components/cat-radio.js.map +1 -1
  48. package/dist/components/cat-select2.js +5 -5
  49. package/dist/components/cat-select2.js.map +1 -1
  50. package/dist/components/cat-textarea.js +5 -5
  51. package/dist/components/cat-textarea.js.map +1 -1
  52. package/dist/components/cat-toggle.js +5 -1
  53. package/dist/components/cat-toggle.js.map +1 -1
  54. package/dist/components/index.d.ts +1 -0
  55. package/dist/components/index.js +1 -0
  56. package/dist/components/index.js.map +1 -1
  57. package/dist/esm/{cat-alert_22.entry.js → cat-alert_23.entry.js} +71 -30
  58. package/dist/esm/cat-alert_23.entry.js.map +1 -0
  59. package/dist/esm/catalyst.js +1 -1
  60. package/dist/esm/loader.js +1 -1
  61. package/dist/types/components/cat-badge/cat-badge.d.ts +0 -1
  62. package/dist/types/components/cat-checkbox/cat-checkbox.d.ts +6 -1
  63. package/dist/types/components/cat-input/cat-input.d.ts +7 -2
  64. package/dist/types/components/cat-label/cat-label.d.ts +17 -0
  65. package/dist/types/components/cat-radio/cat-radio.d.ts +6 -1
  66. package/dist/types/components/cat-select/cat-select.d.ts +7 -2
  67. package/dist/types/components/cat-textarea/cat-textarea.d.ts +7 -2
  68. package/dist/types/components/cat-toggle/cat-toggle.d.ts +6 -1
  69. package/dist/types/components.d.ts +80 -3
  70. package/dist/types/utils/setDefault.d.ts +2 -2
  71. package/package.json +2 -2
  72. package/dist/catalyst/p-c0ccf7d1.entry.js +0 -2
  73. package/dist/catalyst/p-c0ccf7d1.entry.js.map +0 -1
  74. package/dist/cjs/cat-alert_22.cjs.entry.js.map +0 -1
  75. package/dist/components/setDefault.js +0 -12
  76. package/dist/components/setDefault.js.map +0 -1
  77. package/dist/esm/cat-alert_22.entry.js.map +0 -1
@@ -2,7 +2,12 @@
2
2
  @use '../mixins' as *;
3
3
 
4
4
  :where(h1, h2, h3, h4, h5, h6),
5
- .cat-h1, .cat-h2, .cat-h3, .cat-h4, .cat-h5, .cat-h6 {
5
+ .cat-h1,
6
+ .cat-h2,
7
+ .cat-h3,
8
+ .cat-h4,
9
+ .cat-h5,
10
+ .cat-h6 {
6
11
  margin-top: 0;
7
12
  margin-bottom: $cat-head-margin-bottom;
8
13
  }
@@ -155,8 +160,9 @@ dd {
155
160
  }
156
161
 
157
162
  blockquote {
158
- padding: 0.5rem 0 0.5rem calc(2rem - 4px);
159
- border-left: 4px solid cat-token('color.ui.border.default');
163
+ padding: 0.75rem 0 0.75rem calc(1.5rem - 2px);
164
+ border-left: 2px solid cat-token('color.ui.border.quote');
165
+ font-style: italic;
160
166
  @include cat-body('l', null);
161
167
 
162
168
  > :last-child {
@@ -177,8 +183,8 @@ figcaption {
177
183
  }
178
184
 
179
185
  figure {
180
- padding: 0.5rem 0 0.5rem calc(2rem - 4px);
181
- border-left: 4px solid cat-token('color.ui.border.default');
186
+ padding: 0.75rem 0 0.75rem calc(1.5rem - 2px);
187
+ border-left: 2px solid cat-token('color.ui.border.quote');
182
188
 
183
189
  blockquote {
184
190
  margin-bottom: 0;
@@ -11,9 +11,6 @@ function setAttributeDefault(host, attr, value) {
11
11
  host.hostElement.setAttribute(attr, String(value));
12
12
  }
13
13
  }
14
- function setPropertyDefault(host, prop) {
15
- setAttributeDefault(host, String(prop), host[prop]);
16
- }
17
14
 
18
15
  const catAlertCss = ":host{display:flex;gap:0.5rem;padding:1.25rem;border-radius:var(--cat-border-radius-l, 0.5rem);margin-bottom:1rem}:host([hidden]){display:none}:host(:focus-visible){outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}.content{align-self:center}::slotted(:last-child){margin-bottom:0 !important}:host([color=primary]){background-color:rgba(var(--cat-primary-bg, 0, 129, 148), 0.1)}:host([color=primary]) cat-icon{color:rgb(var(--cat-primary-text, 0, 129, 148))}:host([color=secondary]){background-color:rgba(var(--cat-secondary-bg, 105, 118, 135), 0.1)}:host([color=secondary]) cat-icon{color:#697687}:host([color=success]){background-color:rgba(var(--cat-success-bg-, 0, 132, 88), 0.1)}:host([color=success]) cat-icon{color:#008458}:host([color=warning]){background-color:rgba(var(--cat-warning-bg, 255, 206, 128), 0.1)}:host([color=warning]) cat-icon{color:#ebb663}:host([color=danger]){background-color:rgba(var(--cat-danger-bg, 217, 52, 13), 0.1)}:host([color=danger]) cat-icon{color:#d9340d}";
19
16
 
@@ -46,7 +43,6 @@ const CatAlert = class {
46
43
  connectedCallback() {
47
44
  setAttributeDefault(this, 'tabindex', 0);
48
45
  setAttributeDefault(this, 'role', this.mapRole.get(this.color));
49
- setPropertyDefault(this, 'color');
50
46
  }
51
47
  render() {
52
48
  return (index.h(index.Host, null, !this.noIcon && index.h("cat-icon", { size: "l", icon: this.icon ? this.icon : this.mapIcon.get(this.color) }), index.h("div", { class: "content" }, index.h("slot", null))));
@@ -166,11 +162,6 @@ const CatBadge = class {
166
162
  */
167
163
  this.pulse = false;
168
164
  }
169
- connectedCallback() {
170
- setPropertyDefault(this, 'variant');
171
- setPropertyDefault(this, 'color');
172
- setPropertyDefault(this, 'size');
173
- }
174
165
  render() {
175
166
  return index.h("slot", null);
176
167
  }
@@ -521,7 +512,7 @@ const CatCheckbox = class {
521
512
  this.catChange = index.createEvent(this, "catChange", 7);
522
513
  this.catFocus = index.createEvent(this, "catFocus", 7);
523
514
  this.catBlur = index.createEvent(this, "catBlur", 7);
524
- this.id = `cat-checkbox-${nextUniqueId$8++}`;
515
+ this._id = `cat-checkbox-${nextUniqueId$8++}`;
525
516
  this.hasSlottedLabel = false;
526
517
  /**
527
518
  * Checked state of the checkbox
@@ -552,6 +543,9 @@ const CatCheckbox = class {
552
543
  */
553
544
  this.labelLeft = false;
554
545
  }
546
+ get id() {
547
+ return this.identifier || this._id;
548
+ }
555
549
  componentDidLoad() {
556
550
  if (this.input && this.indeterminate) {
557
551
  this.input.indeterminate = true;
@@ -1926,7 +1920,7 @@ const CatInput = class {
1926
1920
  this.catChange = index.createEvent(this, "catChange", 7);
1927
1921
  this.catFocus = index.createEvent(this, "catFocus", 7);
1928
1922
  this.catBlur = index.createEvent(this, "catBlur", 7);
1929
- this.id = `cat-input-${nextUniqueId$6++}`;
1923
+ this._id = `cat-input-${nextUniqueId$6++}`;
1930
1924
  this.hasSlottedLabel = false;
1931
1925
  /**
1932
1926
  * Whether the input should show a clear button.
@@ -1948,10 +1942,6 @@ const CatInput = class {
1948
1942
  * Visually hide the label, but still show it to assistive technologies like screen readers.
1949
1943
  */
1950
1944
  this.labelHidden = false;
1951
- /**
1952
- * The name of the form control. Submitted with the form as part of a name/value pair.
1953
- */
1954
- this.name = '';
1955
1945
  /**
1956
1946
  * The value is not editable.
1957
1947
  */
@@ -1969,6 +1959,9 @@ const CatInput = class {
1969
1959
  */
1970
1960
  this.type = 'text';
1971
1961
  }
1962
+ get id() {
1963
+ return this.identifier || this._id;
1964
+ }
1972
1965
  componentWillRender() {
1973
1966
  this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
1974
1967
  if (!this.label && !this.hasSlottedLabel) {
@@ -2031,6 +2024,50 @@ const CatInput = class {
2031
2024
  };
2032
2025
  CatInput.style = catInputCss;
2033
2026
 
2027
+ const catLabelCss = ":host{display:block}.input-optional{margin-left:0.25rem;font-size:0.75rem;line-height:1rem;font-weight:var(--cat-font-weight-body, 400);color:rgb(var(--cat-font-color-muted, 105, 118, 135))}";
2028
+
2029
+ const CatLabel = class {
2030
+ constructor(hostRef) {
2031
+ index.registerInstance(this, hostRef);
2032
+ /**
2033
+ * A value is required or must be check for the form to be submittable.
2034
+ */
2035
+ this.required = false;
2036
+ }
2037
+ onClick() {
2038
+ var _a;
2039
+ if (this.for) {
2040
+ // focus target that is possibly hidden inside a shadow root
2041
+ (_a = (document.getElementById(this.for) || this.findShadowTarget(this.for))) === null || _a === void 0 ? void 0 : _a.focus();
2042
+ }
2043
+ }
2044
+ render() {
2045
+ 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'), ")")))));
2046
+ }
2047
+ findShadowTarget(id) {
2048
+ var _a;
2049
+ for (let i = 0; i < CatLabel.SHADOW_TARGETS.length; i++) {
2050
+ const elems = document.getElementsByTagName(CatLabel.SHADOW_TARGETS[i]);
2051
+ for (let i = 0; i < elems.length; i++) {
2052
+ const target = (_a = elems[i].shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById(id);
2053
+ if (target) {
2054
+ return target;
2055
+ }
2056
+ }
2057
+ }
2058
+ return null;
2059
+ }
2060
+ };
2061
+ CatLabel.SHADOW_TARGETS = [
2062
+ 'CAT-INPUT',
2063
+ 'CAT-TEXTAREA',
2064
+ 'CAT-CHECKBOX',
2065
+ 'CAT-TOGGLE',
2066
+ 'CAT-RADIO',
2067
+ 'CAT-SELECT'
2068
+ ];
2069
+ CatLabel.style = catLabelCss;
2070
+
2034
2071
  const catPaginationCss = ":host{display:inline-block}:host([hidden]){display:none}ol{display:flex;flex-wrap:wrap;list-style:none;margin:0;padding:0}li{display:inline-flex;justify-content:center}li.dots{-webkit-user-select:none;-ms-user-select:none;user-select:none;}:host([variant=outlined]) ol{gap:0.75rem}.cat-pagination-xs li.dots,.cat-pagination-xs li.text{height:1.5rem;line-height:1.5rem;font-size:0.875rem}.cat-pagination-xs li.dots{width:1.5rem}:host([variant=outlined]) .cat-pagination-xs{gap:0.375rem}.cat-pagination-s li.dots,.cat-pagination-s li.text{height:2rem;line-height:2rem;font-size:0.9375rem}.cat-pagination-s li.dots{width:2rem}:host([variant=outlined]) .cat-pagination-s{gap:0.5rem}.cat-pagination-m li.dots,.cat-pagination-m li.text{height:2.5rem;line-height:2.5rem;font-size:0.9375rem}.cat-pagination-m li.dots{width:2.5rem}:host([variant=outlined]) .cat-pagination-m{gap:0.625rem}.cat-pagination-l li.dots,.cat-pagination-l li.text{height:3rem;line-height:3rem;font-size:0.9375rem}.cat-pagination-l li.dots{width:3rem}:host([variant=outlined]) .cat-pagination-l{gap:0.75rem}.cat-pagination-xl li.dots,.cat-pagination-xl li.text{height:3.5rem;line-height:3.5rem;font-size:1.125rem}.cat-pagination-xl li.dots{width:3.5rem}:host([variant=outlined]) .cat-pagination-xl{gap:0.875rem}";
2035
2072
 
2036
2073
  const CatPagination = class {
@@ -2137,7 +2174,7 @@ const CatRadio = class {
2137
2174
  this.catChange = index.createEvent(this, "catChange", 7);
2138
2175
  this.catFocus = index.createEvent(this, "catFocus", 7);
2139
2176
  this.catBlur = index.createEvent(this, "catBlur", 7);
2140
- this.id = `cat-radio-${++nextUniqueId$5}`;
2177
+ this._id = `cat-radio-${++nextUniqueId$5}`;
2141
2178
  this.hasSlottedLabel = false;
2142
2179
  /**
2143
2180
  * Whether this radio is checked.
@@ -2164,6 +2201,9 @@ const CatRadio = class {
2164
2201
  */
2165
2202
  this.labelLeft = false;
2166
2203
  }
2204
+ get id() {
2205
+ return this.identifier || this._id;
2206
+ }
2167
2207
  componentWillRender() {
2168
2208
  this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
2169
2209
  if (!this.label && !this.hasSlottedLabel) {
@@ -2194,7 +2234,7 @@ const CatRadio = class {
2194
2234
  this.input.click();
2195
2235
  }
2196
2236
  render() {
2197
- return (index.h(index.Host, null, index.h("label", { htmlFor: this.id, class: { 'is-hidden': this.labelHidden, 'is-disabled': this.disabled, 'label-left': this.labelLeft }, role: "radio", "aria-checked": this.checked ? 'true' : 'false' }, index.h("span", { class: "radio" }, index.h("input", { ref: el => (this.input = el), id: this.id, type: "radio", name: this.name, value: this.value, checked: this.checked, required: this.required, disabled: this.disabled, onInput: this.onChange.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this) }), index.h("span", { class: "circle" })), index.h("span", { class: "label", part: "label" }, (this.hasSlottedLabel && index.h("slot", { name: "label" })) || this.label)), this.hintSection));
2237
+ return (index.h(index.Host, null, index.h("label", { htmlFor: this.id, class: { 'is-hidden': this.labelHidden, 'is-disabled': this.disabled, 'label-left': this.labelLeft }, role: "radio", "aria-checked": this.checked ? 'true' : 'false' }, index.h("span", { class: "radio" }, index.h("input", { ref: el => (this.input = el), id: this.identifier || this.id, type: "radio", name: this.name, value: this.value, checked: this.checked, required: this.required, disabled: this.disabled, onInput: this.onChange.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this) }), index.h("span", { class: "circle" })), index.h("span", { class: "label", part: "label" }, (this.hasSlottedLabel && index.h("slot", { name: "label" })) || this.label)), this.hintSection));
2198
2238
  }
2199
2239
  get hintSection() {
2200
2240
  const hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
@@ -4166,7 +4206,7 @@ const CatSelect = class {
4166
4206
  this.catClose = index.createEvent(this, "catClose", 7);
4167
4207
  this.catChange = index.createEvent(this, "catChange", 7);
4168
4208
  this.catBlur = index.createEvent(this, "catBlur", 7);
4169
- this.id = `cat-input-${nextUniqueId$4++}`;
4209
+ this._id = `cat-input-${nextUniqueId$4++}`;
4170
4210
  this.term$ = new Subject();
4171
4211
  this.more$ = new Subject();
4172
4212
  this.state = INIT_STATE;
@@ -4191,10 +4231,6 @@ const CatSelect = class {
4191
4231
  * The label for the select.
4192
4232
  */
4193
4233
  this.label = '';
4194
- /**
4195
- * The name of the form control. Submitted with the form as part of a name/value pair.
4196
- */
4197
- this.name = '';
4198
4234
  /**
4199
4235
  * Visually hide the label, but still show it to assistive technologies like screen readers.
4200
4236
  */
@@ -4212,6 +4248,9 @@ const CatSelect = class {
4212
4248
  */
4213
4249
  this.tags = false;
4214
4250
  }
4251
+ get id() {
4252
+ return this.identifier || this._id;
4253
+ }
4215
4254
  onConnectorChange(connector) {
4216
4255
  this.reset(connector);
4217
4256
  this.resolve();
@@ -6277,7 +6316,7 @@ const CatTextarea = class {
6277
6316
  this.catChange = index.createEvent(this, "catChange", 7);
6278
6317
  this.catFocus = index.createEvent(this, "catFocus", 7);
6279
6318
  this.catBlur = index.createEvent(this, "catBlur", 7);
6280
- this.id = `cat-textarea-${nextUniqueId$2++}`;
6319
+ this._id = `cat-textarea-${nextUniqueId$2++}`;
6281
6320
  this.hasSlottedLabel = false;
6282
6321
  /**
6283
6322
  * Whether the textarea is disabled.
@@ -6291,10 +6330,6 @@ const CatTextarea = class {
6291
6330
  * Visually hide the label, but still show it to assistive technologies like screen readers.
6292
6331
  */
6293
6332
  this.labelHidden = false;
6294
- /**
6295
- * The name of the form control. Submitted with the form as part of a name/value pair.
6296
- */
6297
- this.name = '';
6298
6333
  /**
6299
6334
  * The value is not editable.
6300
6335
  */
@@ -6308,6 +6343,9 @@ const CatTextarea = class {
6308
6343
  */
6309
6344
  this.rows = 3;
6310
6345
  }
6346
+ get id() {
6347
+ return this.identifier || this._id;
6348
+ }
6311
6349
  componentWillRender() {
6312
6350
  this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
6313
6351
  if (!this.label && !this.hasSlottedLabel) {
@@ -6370,7 +6408,7 @@ const CatToggle = class {
6370
6408
  this.catChange = index.createEvent(this, "catChange", 7);
6371
6409
  this.catFocus = index.createEvent(this, "catFocus", 7);
6372
6410
  this.catBlur = index.createEvent(this, "catBlur", 7);
6373
- this.id = `cat-toggle-${nextUniqueId$1++}`;
6411
+ this._id = `cat-toggle-${nextUniqueId$1++}`;
6374
6412
  this.hasSlottedLabel = false;
6375
6413
  /**
6376
6414
  * Checked state of the toggle.
@@ -6397,6 +6435,9 @@ const CatToggle = class {
6397
6435
  */
6398
6436
  this.labelLeft = false;
6399
6437
  }
6438
+ get id() {
6439
+ return this.identifier || this._id;
6440
+ }
6400
6441
  componentWillRender() {
6401
6442
  this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
6402
6443
  if (!this.label && !this.hasSlottedLabel) {
@@ -6606,6 +6647,7 @@ exports.cat_checkbox = CatCheckbox;
6606
6647
  exports.cat_dropdown = CatDropdown;
6607
6648
  exports.cat_icon = CatIcon;
6608
6649
  exports.cat_input = CatInput;
6650
+ exports.cat_label = CatLabel;
6609
6651
  exports.cat_pagination = CatPagination;
6610
6652
  exports.cat_radio = CatRadio;
6611
6653
  exports.cat_radio_group = CatRadioGroup;
@@ -6620,4 +6662,4 @@ exports.cat_textarea = CatTextarea;
6620
6662
  exports.cat_toggle = CatToggle;
6621
6663
  exports.cat_tooltip = CatTooltip;
6622
6664
 
6623
- //# sourceMappingURL=cat-alert_22.cjs.entry.js.map
6665
+ //# sourceMappingURL=cat-alert_23.cjs.entry.js.map