@haiilo/catalyst 2.0.2 → 2.1.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 (54) hide show
  1. package/dist/catalyst/catalyst.esm.js +1 -1
  2. package/dist/catalyst/catalyst.esm.js.map +1 -1
  3. package/dist/catalyst/p-50031766.entry.js +2 -0
  4. package/dist/catalyst/p-50031766.entry.js.map +1 -0
  5. package/dist/cjs/cat-alert_22.cjs.entry.js +99 -14
  6. package/dist/cjs/cat-alert_22.cjs.entry.js.map +1 -1
  7. package/dist/cjs/catalyst.cjs.js +1 -1
  8. package/dist/cjs/loader.cjs.js +1 -1
  9. package/dist/collection/components/cat-button/cat-button.js +51 -4
  10. package/dist/collection/components/cat-button/cat-button.js.map +1 -1
  11. package/dist/collection/components/cat-checkbox/cat-checkbox.js +50 -4
  12. package/dist/collection/components/cat-checkbox/cat-checkbox.js.map +1 -1
  13. package/dist/collection/components/cat-input/cat-input.js +50 -4
  14. package/dist/collection/components/cat-input/cat-input.js.map +1 -1
  15. package/dist/collection/components/cat-radio/cat-radio.js +50 -4
  16. package/dist/collection/components/cat-radio/cat-radio.js.map +1 -1
  17. package/dist/collection/components/cat-radio-group/cat-radio-group.js +1 -1
  18. package/dist/collection/components/cat-radio-group/cat-radio-group.js.map +1 -1
  19. package/dist/collection/components/cat-tabs/cat-tabs.js +1 -1
  20. package/dist/collection/components/cat-tabs/cat-tabs.js.map +1 -1
  21. package/dist/collection/components/cat-textarea/cat-textarea.js +50 -4
  22. package/dist/collection/components/cat-textarea/cat-textarea.js.map +1 -1
  23. package/dist/collection/components/cat-toggle/cat-toggle.js +50 -4
  24. package/dist/collection/components/cat-toggle/cat-toggle.js.map +1 -1
  25. package/dist/components/cat-button2.js +20 -3
  26. package/dist/components/cat-button2.js.map +1 -1
  27. package/dist/components/cat-checkbox2.js +19 -3
  28. package/dist/components/cat-checkbox2.js.map +1 -1
  29. package/dist/components/cat-input.js +19 -3
  30. package/dist/components/cat-input.js.map +1 -1
  31. package/dist/components/cat-radio-group.js +1 -1
  32. package/dist/components/cat-radio-group.js.map +1 -1
  33. package/dist/components/cat-radio.js +19 -3
  34. package/dist/components/cat-radio.js.map +1 -1
  35. package/dist/components/cat-tabs.js +1 -1
  36. package/dist/components/cat-tabs.js.map +1 -1
  37. package/dist/components/cat-textarea.js +19 -3
  38. package/dist/components/cat-textarea.js.map +1 -1
  39. package/dist/components/cat-toggle.js +19 -3
  40. package/dist/components/cat-toggle.js.map +1 -1
  41. package/dist/esm/cat-alert_22.entry.js +99 -14
  42. package/dist/esm/cat-alert_22.entry.js.map +1 -1
  43. package/dist/esm/catalyst.js +1 -1
  44. package/dist/esm/loader.js +1 -1
  45. package/dist/types/components/cat-button/cat-button.d.ts +12 -2
  46. package/dist/types/components/cat-checkbox/cat-checkbox.d.ts +12 -2
  47. package/dist/types/components/cat-input/cat-input.d.ts +12 -2
  48. package/dist/types/components/cat-radio/cat-radio.d.ts +12 -2
  49. package/dist/types/components/cat-textarea/cat-textarea.d.ts +12 -2
  50. package/dist/types/components/cat-toggle/cat-toggle.d.ts +12 -2
  51. package/dist/types/components.d.ts +78 -30
  52. package/package.json +2 -2
  53. package/dist/catalyst/p-fffa6ca0.entry.js +0 -2
  54. package/dist/catalyst/p-fffa6ca0.entry.js.map +0 -1
@@ -384,19 +384,34 @@ const CatButton = class {
384
384
  }
385
385
  }
386
386
  /**
387
- * Sets focus on the button. Use this method instead of `button.focus()`.
387
+ * Programmatically move focus to the button. Use this method instead of
388
+ * `button.focus()`.
388
389
  *
389
390
  * @param options An optional object providing options to control aspects of
390
391
  * the focusing process.
391
392
  */
392
- async setFocus(options) {
393
+ async doFocus(options) {
393
394
  this.button.focus(options);
394
395
  }
396
+ /**
397
+ * Programmatically remove focus from the button. Use this method instead of
398
+ * `button.blur()`.
399
+ */
400
+ async doBlur() {
401
+ this.button.blur();
402
+ }
403
+ /**
404
+ * Programmatically simulate a click on the button.
405
+ */
406
+ async doClick() {
407
+ this.button.click();
408
+ }
395
409
  render() {
396
410
  var _a;
397
411
  if (this.url) {
398
412
  return (index.h("a", { ref: el => (this.button = el), href: this.disabled ? undefined : this.url, target: this.urlTarget, "aria-disabled": this.disabled ? 'true' : null, "aria-label": this.a11yLabel, "aria-current": this.a11yCurrent, id: this.buttonId, part: "button", class: {
399
413
  'cat-button': true,
414
+ 'cat-button-active': this.active,
400
415
  'cat-button-icon': this.isIconButton,
401
416
  'cat-button-round': this.round,
402
417
  'cat-button-loading': this.loading,
@@ -549,14 +564,28 @@ const CatCheckbox = class {
549
564
  }
550
565
  }
551
566
  /**
552
- * Sets focus on the checkbox. Use this method instead of `checkbox.focus()`.
567
+ * Programmatically move focus to the checkbox. Use this method instead of
568
+ * `input.focus()`.
553
569
  *
554
570
  * @param options An optional object providing options to control aspects of
555
571
  * the focusing process.
556
572
  */
557
- async setFocus(options) {
573
+ async doFocus(options) {
558
574
  this.input.focus(options);
559
575
  }
576
+ /**
577
+ * Programmatically remove focus from the checkbox. Use this method instead of
578
+ * `input.blur()`.
579
+ */
580
+ async doBlur() {
581
+ this.input.blur();
582
+ }
583
+ /**
584
+ * Programmatically simulate a click on the checkbox.
585
+ */
586
+ async doClick() {
587
+ this.input.click();
588
+ }
560
589
  render() {
561
590
  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 } }, index.h("input", { ref: el => (this.input = el), id: this.id, type: "checkbox", name: this.name, value: this.value !== undefined ? String(this.value) : this.value, checked: this.checked, required: this.required, disabled: this.disabled, onInput: this.onInput.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this) }), index.h("span", { class: "box", "aria-hidden": "true", part: "checkbox" }, index.h("svg", { class: "check", viewBox: "0 0 12 10" }, index.h("polyline", { points: "1.5 6 4.5 9 10.5 1" })), index.h("svg", { class: "dash", viewBox: "0 0 12 10" }, index.h("polyline", { points: "1.5 5 10.5 5" }))), index.h("span", { class: "label", part: "label" }, (this.hasSlottedLabel && index.h("slot", { name: "label" })) || this.label)), this.hintSection));
562
591
  }
@@ -1947,14 +1976,28 @@ const CatInput = class {
1947
1976
  }
1948
1977
  }
1949
1978
  /**
1950
- * Sets focus on the input. Use this method instead of `input.focus()`.
1979
+ * Programmatically move focus to the input. Use this method instead of
1980
+ * `input.focus()`.
1951
1981
  *
1952
1982
  * @param options An optional object providing options to control aspects of
1953
1983
  * the focusing process.
1954
1984
  */
1955
- async setFocus(options) {
1985
+ async doFocus(options) {
1956
1986
  this.input.focus(options);
1957
1987
  }
1988
+ /**
1989
+ * Programmatically remove focus from the input. Use this method instead of
1990
+ * `input.blur()`.
1991
+ */
1992
+ async doBlur() {
1993
+ this.input.blur();
1994
+ }
1995
+ /**
1996
+ * Programmatically simulate a click on the input.
1997
+ */
1998
+ async doClick() {
1999
+ this.input.click();
2000
+ }
1958
2001
  /**
1959
2002
  * Clear the input.
1960
2003
  */
@@ -2128,14 +2171,28 @@ const CatRadio = class {
2128
2171
  }
2129
2172
  }
2130
2173
  /**
2131
- * Sets focus on the radio. Use this method instead of `radio.focus()`.
2174
+ * Programmatically move focus to the radio button. Use this method instead of
2175
+ * `input.focus()`.
2132
2176
  *
2133
2177
  * @param options An optional object providing options to control aspects of
2134
2178
  * the focusing process.
2135
2179
  */
2136
- async setFocus(options) {
2180
+ async doFocus(options) {
2137
2181
  this.input.focus(options);
2138
2182
  }
2183
+ /**
2184
+ * Programmatically remove focus from the radio button. Use this method
2185
+ * instead of `input.blur()`.
2186
+ */
2187
+ async doBlur() {
2188
+ this.input.blur();
2189
+ }
2190
+ /**
2191
+ * Programmatically simulate a click on the radio button.
2192
+ */
2193
+ async doClick() {
2194
+ this.input.click();
2195
+ }
2139
2196
  render() {
2140
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));
2141
2198
  }
@@ -2206,7 +2263,7 @@ const CatRadioGroup = class {
2206
2263
  const activeIdx = this.catRadioGroup.findIndex(catRadio => catRadio === activeElement);
2207
2264
  const activeOff = ['ArrowDown', 'ArrowRight'].includes(event.key) ? 1 : -1;
2208
2265
  const targetIdx = activeIdx < 0 ? 0 : (activeIdx + activeOff + targetElements.length) % targetElements.length;
2209
- targetElements[targetIdx].setFocus();
2266
+ targetElements[targetIdx].doFocus();
2210
2267
  (_b = (_a = targetElements[targetIdx].shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('input')) === null || _b === void 0 ? void 0 : _b.click();
2211
2268
  this.updateTabIndex();
2212
2269
  event.preventDefault();
@@ -6178,7 +6235,7 @@ const CatTabs = class {
6178
6235
  const activeIdx = activeElement ? targetElements.indexOf(activeElement) : -1;
6179
6236
  const activeOff = ['ArrowDown', 'ArrowRight'].includes(event.key) ? 1 : -1;
6180
6237
  const targetIdx = activeIdx < 0 ? 0 : (activeIdx + activeOff + targetElements.length) % targetElements.length;
6181
- targetElements[targetIdx].setFocus();
6238
+ targetElements[targetIdx].doFocus();
6182
6239
  event.preventDefault();
6183
6240
  }
6184
6241
  }
@@ -6261,14 +6318,28 @@ const CatTextarea = class {
6261
6318
  d(this.textarea);
6262
6319
  }
6263
6320
  /**
6264
- * Sets focus on the textarea. Use this method instead of `textarea.focus()`.
6321
+ * Programmatically move focus to the textarea. Use this method instead of
6322
+ * `textarea.focus()`.
6265
6323
  *
6266
6324
  * @param options An optional object providing options to control aspects of
6267
6325
  * the focusing process.
6268
6326
  */
6269
- async setFocus(options) {
6327
+ async doFocus(options) {
6270
6328
  this.textarea.focus(options);
6271
6329
  }
6330
+ /**
6331
+ * Programmatically remove focus from the textarea. Use this method instead of
6332
+ * `textarea.blur()`.
6333
+ */
6334
+ async doBlur() {
6335
+ this.textarea.blur();
6336
+ }
6337
+ /**
6338
+ * Programmatically simulate a click on the textarea.
6339
+ */
6340
+ async doClick() {
6341
+ this.textarea.click();
6342
+ }
6272
6343
  render() {
6273
6344
  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));
6274
6345
  }
@@ -6333,14 +6404,28 @@ const CatToggle = class {
6333
6404
  }
6334
6405
  }
6335
6406
  /**
6336
- * Sets focus on the toggle. Use this method instead of `toggle.focus()`.
6407
+ * Programmatically move focus to the toggle. Use this method instead of
6408
+ * `input.focus()`.
6337
6409
  *
6338
6410
  * @param options An optional object providing options to control aspects of
6339
6411
  * the focusing process.
6340
6412
  */
6341
- async setFocus(options) {
6413
+ async doFocus(options) {
6342
6414
  this.input.focus(options);
6343
6415
  }
6416
+ /**
6417
+ * Programmatically remove focus from the toggle. Use this method instead of
6418
+ * `input.blur()`.
6419
+ */
6420
+ async doBlur() {
6421
+ this.input.blur();
6422
+ }
6423
+ /**
6424
+ * Programmatically simulate a click on the toggle.
6425
+ */
6426
+ async doClick() {
6427
+ this.input.click();
6428
+ }
6344
6429
  render() {
6345
6430
  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 } }, index.h("input", { ref: el => (this.input = el), id: this.id, type: "checkbox", name: this.name, value: this.value !== undefined ? String(this.value) : this.value, checked: this.checked, required: this.required, disabled: this.disabled, class: "form-check-input", role: "switch", onInput: this.onInput.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this) }), index.h("span", { class: "toggle", part: "toggle" }), index.h("span", { class: "label", part: "label" }, (this.hasSlottedLabel && index.h("slot", { name: "label" })) || this.label)), this.hintSection));
6346
6431
  }