@haiilo/catalyst 2.3.0 → 2.4.1

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 +5 -4
  7. package/dist/cjs/{cat-alert_22.cjs.entry.js → cat-alert_23.cjs.entry.js} +71 -49
  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 +6 -31
  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 +5 -4
  32. package/dist/collection/utils/setDefault.js +0 -6
  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 -25
  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 -50
  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 -4
  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 +0 -6
  71. package/package.json +2 -2
  72. package/dist/catalyst/p-757cf2e8.entry.js +0 -2
  73. package/dist/catalyst/p-757cf2e8.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 -18
  76. package/dist/components/setDefault.js.map +0 -1
  77. package/dist/esm/cat-alert_22.entry.js.map +0 -1
@@ -160,8 +160,9 @@ dd {
160
160
  }
161
161
 
162
162
  blockquote {
163
- padding: 0.5rem 0 0.5rem calc(2rem - 4px);
164
- 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;
165
166
  @include cat-body('l', null);
166
167
 
167
168
  > :last-child {
@@ -182,8 +183,8 @@ figcaption {
182
183
  }
183
184
 
184
185
  figure {
185
- padding: 0.5rem 0 0.5rem calc(2rem - 4px);
186
- 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');
187
188
 
188
189
  blockquote {
189
190
  margin-bottom: 0;
@@ -11,15 +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
- function setAttribute(host, attr, value) {
18
- host.hostElement.setAttribute(attr, String(value));
19
- }
20
- function setProperty(host, prop) {
21
- setAttribute(host, String(prop), host[prop]);
22
- }
23
14
 
24
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}";
25
16
 
@@ -52,7 +43,6 @@ const CatAlert = class {
52
43
  connectedCallback() {
53
44
  setAttributeDefault(this, 'tabindex', 0);
54
45
  setAttributeDefault(this, 'role', this.mapRole.get(this.color));
55
- setPropertyDefault(this, 'color');
56
46
  }
57
47
  render() {
58
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))));
@@ -172,29 +162,10 @@ const CatBadge = class {
172
162
  */
173
163
  this.pulse = false;
174
164
  }
175
- connectedCallback() {
176
- setPropertyDefault(this, 'variant');
177
- setPropertyDefault(this, 'color');
178
- setPropertyDefault(this, 'size');
179
- }
180
165
  render() {
181
166
  return index.h("slot", null);
182
167
  }
183
- onColorChanged() {
184
- setProperty(this, 'color');
185
- }
186
- onSizeChanged() {
187
- setProperty(this, 'size');
188
- }
189
- onVariantChanged() {
190
- setProperty(this, 'variant');
191
- }
192
168
  get hostElement() { return index.getElement(this); }
193
- static get watchers() { return {
194
- "color": ["onColorChanged"],
195
- "size": ["onSizeChanged"],
196
- "variant": ["onVariantChanged"]
197
- }; }
198
169
  };
199
170
  CatBadge.style = catBadgeCss;
200
171
 
@@ -541,7 +512,7 @@ const CatCheckbox = class {
541
512
  this.catChange = index.createEvent(this, "catChange", 7);
542
513
  this.catFocus = index.createEvent(this, "catFocus", 7);
543
514
  this.catBlur = index.createEvent(this, "catBlur", 7);
544
- this.id = `cat-checkbox-${nextUniqueId$8++}`;
515
+ this._id = `cat-checkbox-${nextUniqueId$8++}`;
545
516
  this.hasSlottedLabel = false;
546
517
  /**
547
518
  * Checked state of the checkbox
@@ -572,6 +543,9 @@ const CatCheckbox = class {
572
543
  */
573
544
  this.labelLeft = false;
574
545
  }
546
+ get id() {
547
+ return this.identifier || this._id;
548
+ }
575
549
  componentDidLoad() {
576
550
  if (this.input && this.indeterminate) {
577
551
  this.input.indeterminate = true;
@@ -1946,7 +1920,7 @@ const CatInput = class {
1946
1920
  this.catChange = index.createEvent(this, "catChange", 7);
1947
1921
  this.catFocus = index.createEvent(this, "catFocus", 7);
1948
1922
  this.catBlur = index.createEvent(this, "catBlur", 7);
1949
- this.id = `cat-input-${nextUniqueId$6++}`;
1923
+ this._id = `cat-input-${nextUniqueId$6++}`;
1950
1924
  this.hasSlottedLabel = false;
1951
1925
  /**
1952
1926
  * Whether the input should show a clear button.
@@ -1968,10 +1942,6 @@ const CatInput = class {
1968
1942
  * Visually hide the label, but still show it to assistive technologies like screen readers.
1969
1943
  */
1970
1944
  this.labelHidden = false;
1971
- /**
1972
- * The name of the form control. Submitted with the form as part of a name/value pair.
1973
- */
1974
- this.name = '';
1975
1945
  /**
1976
1946
  * The value is not editable.
1977
1947
  */
@@ -1989,6 +1959,9 @@ const CatInput = class {
1989
1959
  */
1990
1960
  this.type = 'text';
1991
1961
  }
1962
+ get id() {
1963
+ return this.identifier || this._id;
1964
+ }
1992
1965
  componentWillRender() {
1993
1966
  this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
1994
1967
  if (!this.label && !this.hasSlottedLabel) {
@@ -2051,6 +2024,50 @@ const CatInput = class {
2051
2024
  };
2052
2025
  CatInput.style = catInputCss;
2053
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
+
2054
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}";
2055
2072
 
2056
2073
  const CatPagination = class {
@@ -2157,7 +2174,7 @@ const CatRadio = class {
2157
2174
  this.catChange = index.createEvent(this, "catChange", 7);
2158
2175
  this.catFocus = index.createEvent(this, "catFocus", 7);
2159
2176
  this.catBlur = index.createEvent(this, "catBlur", 7);
2160
- this.id = `cat-radio-${++nextUniqueId$5}`;
2177
+ this._id = `cat-radio-${++nextUniqueId$5}`;
2161
2178
  this.hasSlottedLabel = false;
2162
2179
  /**
2163
2180
  * Whether this radio is checked.
@@ -2184,6 +2201,9 @@ const CatRadio = class {
2184
2201
  */
2185
2202
  this.labelLeft = false;
2186
2203
  }
2204
+ get id() {
2205
+ return this.identifier || this._id;
2206
+ }
2187
2207
  componentWillRender() {
2188
2208
  this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
2189
2209
  if (!this.label && !this.hasSlottedLabel) {
@@ -2214,7 +2234,7 @@ const CatRadio = class {
2214
2234
  this.input.click();
2215
2235
  }
2216
2236
  render() {
2217
- 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));
2218
2238
  }
2219
2239
  get hintSection() {
2220
2240
  const hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
@@ -4186,7 +4206,7 @@ const CatSelect = class {
4186
4206
  this.catClose = index.createEvent(this, "catClose", 7);
4187
4207
  this.catChange = index.createEvent(this, "catChange", 7);
4188
4208
  this.catBlur = index.createEvent(this, "catBlur", 7);
4189
- this.id = `cat-input-${nextUniqueId$4++}`;
4209
+ this._id = `cat-input-${nextUniqueId$4++}`;
4190
4210
  this.term$ = new Subject();
4191
4211
  this.more$ = new Subject();
4192
4212
  this.state = INIT_STATE;
@@ -4211,10 +4231,6 @@ const CatSelect = class {
4211
4231
  * The label for the select.
4212
4232
  */
4213
4233
  this.label = '';
4214
- /**
4215
- * The name of the form control. Submitted with the form as part of a name/value pair.
4216
- */
4217
- this.name = '';
4218
4234
  /**
4219
4235
  * Visually hide the label, but still show it to assistive technologies like screen readers.
4220
4236
  */
@@ -4232,6 +4248,9 @@ const CatSelect = class {
4232
4248
  */
4233
4249
  this.tags = false;
4234
4250
  }
4251
+ get id() {
4252
+ return this.identifier || this._id;
4253
+ }
4235
4254
  onConnectorChange(connector) {
4236
4255
  this.reset(connector);
4237
4256
  this.resolve();
@@ -6297,7 +6316,7 @@ const CatTextarea = class {
6297
6316
  this.catChange = index.createEvent(this, "catChange", 7);
6298
6317
  this.catFocus = index.createEvent(this, "catFocus", 7);
6299
6318
  this.catBlur = index.createEvent(this, "catBlur", 7);
6300
- this.id = `cat-textarea-${nextUniqueId$2++}`;
6319
+ this._id = `cat-textarea-${nextUniqueId$2++}`;
6301
6320
  this.hasSlottedLabel = false;
6302
6321
  /**
6303
6322
  * Whether the textarea is disabled.
@@ -6311,10 +6330,6 @@ const CatTextarea = class {
6311
6330
  * Visually hide the label, but still show it to assistive technologies like screen readers.
6312
6331
  */
6313
6332
  this.labelHidden = false;
6314
- /**
6315
- * The name of the form control. Submitted with the form as part of a name/value pair.
6316
- */
6317
- this.name = '';
6318
6333
  /**
6319
6334
  * The value is not editable.
6320
6335
  */
@@ -6328,6 +6343,9 @@ const CatTextarea = class {
6328
6343
  */
6329
6344
  this.rows = 3;
6330
6345
  }
6346
+ get id() {
6347
+ return this.identifier || this._id;
6348
+ }
6331
6349
  componentWillRender() {
6332
6350
  this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
6333
6351
  if (!this.label && !this.hasSlottedLabel) {
@@ -6390,7 +6408,7 @@ const CatToggle = class {
6390
6408
  this.catChange = index.createEvent(this, "catChange", 7);
6391
6409
  this.catFocus = index.createEvent(this, "catFocus", 7);
6392
6410
  this.catBlur = index.createEvent(this, "catBlur", 7);
6393
- this.id = `cat-toggle-${nextUniqueId$1++}`;
6411
+ this._id = `cat-toggle-${nextUniqueId$1++}`;
6394
6412
  this.hasSlottedLabel = false;
6395
6413
  /**
6396
6414
  * Checked state of the toggle.
@@ -6417,6 +6435,9 @@ const CatToggle = class {
6417
6435
  */
6418
6436
  this.labelLeft = false;
6419
6437
  }
6438
+ get id() {
6439
+ return this.identifier || this._id;
6440
+ }
6420
6441
  componentWillRender() {
6421
6442
  this.hasSlottedLabel = !!this.hostElement.querySelector('[slot="label"]');
6422
6443
  if (!this.label && !this.hasSlottedLabel) {
@@ -6626,6 +6647,7 @@ exports.cat_checkbox = CatCheckbox;
6626
6647
  exports.cat_dropdown = CatDropdown;
6627
6648
  exports.cat_icon = CatIcon;
6628
6649
  exports.cat_input = CatInput;
6650
+ exports.cat_label = CatLabel;
6629
6651
  exports.cat_pagination = CatPagination;
6630
6652
  exports.cat_radio = CatRadio;
6631
6653
  exports.cat_radio_group = CatRadioGroup;
@@ -6640,4 +6662,4 @@ exports.cat_textarea = CatTextarea;
6640
6662
  exports.cat_toggle = CatToggle;
6641
6663
  exports.cat_tooltip = CatTooltip;
6642
6664
 
6643
- //# sourceMappingURL=cat-alert_22.cjs.entry.js.map
6665
+ //# sourceMappingURL=cat-alert_23.cjs.entry.js.map