@haiilo/catalyst 2.0.3 → 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 (71) 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/catalyst/p-53a1db22.js +3 -0
  6. package/dist/catalyst/p-53a1db22.js.map +1 -0
  7. package/dist/catalyst/p-5bfc70e3.entry.js +2 -0
  8. package/dist/catalyst/{p-270fd91d.entry.js.map → p-5bfc70e3.entry.js.map} +1 -1
  9. package/dist/cjs/cat-alert_22.cjs.entry.js +99 -15
  10. package/dist/cjs/cat-alert_22.cjs.entry.js.map +1 -1
  11. package/dist/cjs/cat-modal.cjs.entry.js +2 -2
  12. package/dist/cjs/cat-modal.cjs.entry.js.map +1 -1
  13. package/dist/cjs/catalyst.cjs.js +2 -2
  14. package/dist/cjs/{index-b2134f1b.js → index-e540e911.js} +1 -4
  15. package/dist/cjs/index-e540e911.js.map +1 -0
  16. package/dist/cjs/loader.cjs.js +2 -2
  17. package/dist/collection/components/cat-button/cat-button.js +50 -4
  18. package/dist/collection/components/cat-button/cat-button.js.map +1 -1
  19. package/dist/collection/components/cat-checkbox/cat-checkbox.js +50 -4
  20. package/dist/collection/components/cat-checkbox/cat-checkbox.js.map +1 -1
  21. package/dist/collection/components/cat-input/cat-input.js +50 -4
  22. package/dist/collection/components/cat-input/cat-input.js.map +1 -1
  23. package/dist/collection/components/cat-radio/cat-radio.js +50 -4
  24. package/dist/collection/components/cat-radio/cat-radio.js.map +1 -1
  25. package/dist/collection/components/cat-radio-group/cat-radio-group.js +1 -1
  26. package/dist/collection/components/cat-radio-group/cat-radio-group.js.map +1 -1
  27. package/dist/collection/components/cat-tabs/cat-tabs.js +1 -1
  28. package/dist/collection/components/cat-tabs/cat-tabs.js.map +1 -1
  29. package/dist/collection/components/cat-textarea/cat-textarea.js +50 -4
  30. package/dist/collection/components/cat-textarea/cat-textarea.js.map +1 -1
  31. package/dist/collection/components/cat-toggle/cat-toggle.js +50 -4
  32. package/dist/collection/components/cat-toggle/cat-toggle.js.map +1 -1
  33. package/dist/components/cat-button2.js +19 -3
  34. package/dist/components/cat-button2.js.map +1 -1
  35. package/dist/components/cat-checkbox2.js +19 -3
  36. package/dist/components/cat-checkbox2.js.map +1 -1
  37. package/dist/components/cat-input.js +19 -3
  38. package/dist/components/cat-input.js.map +1 -1
  39. package/dist/components/cat-radio-group.js +1 -1
  40. package/dist/components/cat-radio-group.js.map +1 -1
  41. package/dist/components/cat-radio.js +19 -3
  42. package/dist/components/cat-radio.js.map +1 -1
  43. package/dist/components/cat-tabs.js +1 -1
  44. package/dist/components/cat-tabs.js.map +1 -1
  45. package/dist/components/cat-textarea.js +19 -3
  46. package/dist/components/cat-textarea.js.map +1 -1
  47. package/dist/components/cat-toggle.js +19 -3
  48. package/dist/components/cat-toggle.js.map +1 -1
  49. package/dist/esm/cat-alert_22.entry.js +99 -15
  50. package/dist/esm/cat-alert_22.entry.js.map +1 -1
  51. package/dist/esm/cat-modal.entry.js +2 -2
  52. package/dist/esm/cat-modal.entry.js.map +1 -1
  53. package/dist/esm/catalyst.js +2 -2
  54. package/dist/esm/{index-033048ed.js → index-c2a28ebb.js} +2 -4
  55. package/dist/esm/index-c2a28ebb.js.map +1 -0
  56. package/dist/esm/loader.js +2 -2
  57. package/dist/types/components/cat-button/cat-button.d.ts +12 -2
  58. package/dist/types/components/cat-checkbox/cat-checkbox.d.ts +12 -2
  59. package/dist/types/components/cat-input/cat-input.d.ts +12 -2
  60. package/dist/types/components/cat-radio/cat-radio.d.ts +12 -2
  61. package/dist/types/components/cat-textarea/cat-textarea.d.ts +12 -2
  62. package/dist/types/components/cat-toggle/cat-toggle.d.ts +12 -2
  63. package/dist/types/components.d.ts +78 -30
  64. package/package.json +2 -2
  65. package/dist/catalyst/p-270fd91d.entry.js +0 -2
  66. package/dist/catalyst/p-3a489c97.entry.js +0 -2
  67. package/dist/catalyst/p-3a489c97.entry.js.map +0 -1
  68. package/dist/catalyst/p-692e49d6.js +0 -3
  69. package/dist/catalyst/p-692e49d6.js.map +0 -1
  70. package/dist/cjs/index-b2134f1b.js.map +0 -1
  71. package/dist/esm/index-033048ed.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-033048ed.js';
1
+ import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-c2a28ebb.js';
2
2
  import { l as loglevel, e as CatIconRegistry, b as catI18nRegistry } from './cat-icon-registry-d537b18b.js';
3
3
  import { c as createFocusTrap, t as tabbable, f as firstTabbable } from './first-tabbable-4a00de61.js';
4
4
 
@@ -380,14 +380,28 @@ const CatButton = class {
380
380
  }
381
381
  }
382
382
  /**
383
- * Sets focus on the button. Use this method instead of `button.focus()`.
383
+ * Programmatically move focus to the button. Use this method instead of
384
+ * `button.focus()`.
384
385
  *
385
386
  * @param options An optional object providing options to control aspects of
386
387
  * the focusing process.
387
388
  */
388
- async setFocus(options) {
389
+ async doFocus(options) {
389
390
  this.button.focus(options);
390
391
  }
392
+ /**
393
+ * Programmatically remove focus from the button. Use this method instead of
394
+ * `button.blur()`.
395
+ */
396
+ async doBlur() {
397
+ this.button.blur();
398
+ }
399
+ /**
400
+ * Programmatically simulate a click on the button.
401
+ */
402
+ async doClick() {
403
+ this.button.click();
404
+ }
391
405
  render() {
392
406
  var _a;
393
407
  if (this.url) {
@@ -546,14 +560,28 @@ const CatCheckbox = class {
546
560
  }
547
561
  }
548
562
  /**
549
- * Sets focus on the checkbox. Use this method instead of `checkbox.focus()`.
563
+ * Programmatically move focus to the checkbox. Use this method instead of
564
+ * `input.focus()`.
550
565
  *
551
566
  * @param options An optional object providing options to control aspects of
552
567
  * the focusing process.
553
568
  */
554
- async setFocus(options) {
569
+ async doFocus(options) {
555
570
  this.input.focus(options);
556
571
  }
572
+ /**
573
+ * Programmatically remove focus from the checkbox. Use this method instead of
574
+ * `input.blur()`.
575
+ */
576
+ async doBlur() {
577
+ this.input.blur();
578
+ }
579
+ /**
580
+ * Programmatically simulate a click on the checkbox.
581
+ */
582
+ async doClick() {
583
+ this.input.click();
584
+ }
557
585
  render() {
558
586
  return (h(Host, null, h("label", { htmlFor: this.id, class: { 'is-hidden': this.labelHidden, 'is-disabled': this.disabled, 'label-left': this.labelLeft } }, 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) }), h("span", { class: "box", "aria-hidden": "true", part: "checkbox" }, h("svg", { class: "check", viewBox: "0 0 12 10" }, h("polyline", { points: "1.5 6 4.5 9 10.5 1" })), h("svg", { class: "dash", viewBox: "0 0 12 10" }, h("polyline", { points: "1.5 5 10.5 5" }))), h("span", { class: "label", part: "label" }, (this.hasSlottedLabel && h("slot", { name: "label" })) || this.label)), this.hintSection));
559
587
  }
@@ -1944,14 +1972,28 @@ const CatInput = class {
1944
1972
  }
1945
1973
  }
1946
1974
  /**
1947
- * Sets focus on the input. Use this method instead of `input.focus()`.
1975
+ * Programmatically move focus to the input. Use this method instead of
1976
+ * `input.focus()`.
1948
1977
  *
1949
1978
  * @param options An optional object providing options to control aspects of
1950
1979
  * the focusing process.
1951
1980
  */
1952
- async setFocus(options) {
1981
+ async doFocus(options) {
1953
1982
  this.input.focus(options);
1954
1983
  }
1984
+ /**
1985
+ * Programmatically remove focus from the input. Use this method instead of
1986
+ * `input.blur()`.
1987
+ */
1988
+ async doBlur() {
1989
+ this.input.blur();
1990
+ }
1991
+ /**
1992
+ * Programmatically simulate a click on the input.
1993
+ */
1994
+ async doClick() {
1995
+ this.input.click();
1996
+ }
1955
1997
  /**
1956
1998
  * Clear the input.
1957
1999
  */
@@ -2125,14 +2167,28 @@ const CatRadio = class {
2125
2167
  }
2126
2168
  }
2127
2169
  /**
2128
- * Sets focus on the radio. Use this method instead of `radio.focus()`.
2170
+ * Programmatically move focus to the radio button. Use this method instead of
2171
+ * `input.focus()`.
2129
2172
  *
2130
2173
  * @param options An optional object providing options to control aspects of
2131
2174
  * the focusing process.
2132
2175
  */
2133
- async setFocus(options) {
2176
+ async doFocus(options) {
2134
2177
  this.input.focus(options);
2135
2178
  }
2179
+ /**
2180
+ * Programmatically remove focus from the radio button. Use this method
2181
+ * instead of `input.blur()`.
2182
+ */
2183
+ async doBlur() {
2184
+ this.input.blur();
2185
+ }
2186
+ /**
2187
+ * Programmatically simulate a click on the radio button.
2188
+ */
2189
+ async doClick() {
2190
+ this.input.click();
2191
+ }
2136
2192
  render() {
2137
2193
  return (h(Host, null, 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' }, h("span", { class: "radio" }, 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) }), h("span", { class: "circle" })), h("span", { class: "label", part: "label" }, (this.hasSlottedLabel && h("slot", { name: "label" })) || this.label)), this.hintSection));
2138
2194
  }
@@ -2203,7 +2259,7 @@ const CatRadioGroup = class {
2203
2259
  const activeIdx = this.catRadioGroup.findIndex(catRadio => catRadio === activeElement);
2204
2260
  const activeOff = ['ArrowDown', 'ArrowRight'].includes(event.key) ? 1 : -1;
2205
2261
  const targetIdx = activeIdx < 0 ? 0 : (activeIdx + activeOff + targetElements.length) % targetElements.length;
2206
- targetElements[targetIdx].setFocus();
2262
+ targetElements[targetIdx].doFocus();
2207
2263
  (_b = (_a = targetElements[targetIdx].shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('input')) === null || _b === void 0 ? void 0 : _b.click();
2208
2264
  this.updateTabIndex();
2209
2265
  event.preventDefault();
@@ -6175,7 +6231,7 @@ const CatTabs = class {
6175
6231
  const activeIdx = activeElement ? targetElements.indexOf(activeElement) : -1;
6176
6232
  const activeOff = ['ArrowDown', 'ArrowRight'].includes(event.key) ? 1 : -1;
6177
6233
  const targetIdx = activeIdx < 0 ? 0 : (activeIdx + activeOff + targetElements.length) % targetElements.length;
6178
- targetElements[targetIdx].setFocus();
6234
+ targetElements[targetIdx].doFocus();
6179
6235
  event.preventDefault();
6180
6236
  }
6181
6237
  }
@@ -6258,14 +6314,28 @@ const CatTextarea = class {
6258
6314
  d(this.textarea);
6259
6315
  }
6260
6316
  /**
6261
- * Sets focus on the textarea. Use this method instead of `textarea.focus()`.
6317
+ * Programmatically move focus to the textarea. Use this method instead of
6318
+ * `textarea.focus()`.
6262
6319
  *
6263
6320
  * @param options An optional object providing options to control aspects of
6264
6321
  * the focusing process.
6265
6322
  */
6266
- async setFocus(options) {
6323
+ async doFocus(options) {
6267
6324
  this.textarea.focus(options);
6268
6325
  }
6326
+ /**
6327
+ * Programmatically remove focus from the textarea. Use this method instead of
6328
+ * `textarea.blur()`.
6329
+ */
6330
+ async doBlur() {
6331
+ this.textarea.blur();
6332
+ }
6333
+ /**
6334
+ * Programmatically simulate a click on the textarea.
6335
+ */
6336
+ async doClick() {
6337
+ this.textarea.click();
6338
+ }
6269
6339
  render() {
6270
6340
  return (h(Host, null, (this.hasSlottedLabel || this.label) && (h("label", { htmlFor: this.id, class: { hidden: this.labelHidden } }, h("span", { part: "label" }, (this.hasSlottedLabel && h("slot", { name: "label" })) || this.label, !this.required && (h("span", { class: "input-optional", "aria-hidden": "true" }, "(Optional)"))))), 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));
6271
6341
  }
@@ -6330,14 +6400,28 @@ const CatToggle = class {
6330
6400
  }
6331
6401
  }
6332
6402
  /**
6333
- * Sets focus on the toggle. Use this method instead of `toggle.focus()`.
6403
+ * Programmatically move focus to the toggle. Use this method instead of
6404
+ * `input.focus()`.
6334
6405
  *
6335
6406
  * @param options An optional object providing options to control aspects of
6336
6407
  * the focusing process.
6337
6408
  */
6338
- async setFocus(options) {
6409
+ async doFocus(options) {
6339
6410
  this.input.focus(options);
6340
6411
  }
6412
+ /**
6413
+ * Programmatically remove focus from the toggle. Use this method instead of
6414
+ * `input.blur()`.
6415
+ */
6416
+ async doBlur() {
6417
+ this.input.blur();
6418
+ }
6419
+ /**
6420
+ * Programmatically simulate a click on the toggle.
6421
+ */
6422
+ async doClick() {
6423
+ this.input.click();
6424
+ }
6341
6425
  render() {
6342
6426
  return (h(Host, null, h("label", { htmlFor: this.id, class: { 'is-hidden': this.labelHidden, 'is-disabled': this.disabled, 'label-left': this.labelLeft } }, 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) }), h("span", { class: "toggle", part: "toggle" }), h("span", { class: "label", part: "label" }, (this.hasSlottedLabel && h("slot", { name: "label" })) || this.label)), this.hintSection));
6343
6427
  }