@haiilo/catalyst 0.13.0 → 0.14.2

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 (79) 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/index.esm.js +1 -1
  5. package/dist/catalyst/{p-4ced6c7c.entry.js → p-45547af1.entry.js} +3 -3
  6. package/dist/catalyst/p-45547af1.entry.js.map +1 -0
  7. package/dist/catalyst/{p-f88f8914.js → p-933b6a7a.js} +2 -2
  8. package/dist/catalyst/p-933b6a7a.js.map +1 -0
  9. package/dist/catalyst/{p-659073b5.js → p-a255bd64.js} +2 -2
  10. package/dist/catalyst/p-a255bd64.js.map +1 -0
  11. package/dist/catalyst/scss/core/_toast.scss +22 -12
  12. package/dist/cjs/cat-alert_22.cjs.entry.js +56 -12
  13. package/dist/cjs/cat-alert_22.cjs.entry.js.map +1 -1
  14. package/dist/cjs/{cat-notification-444c9ea0.js → cat-notification-6a438ad1.js} +44 -45
  15. package/dist/cjs/cat-notification-6a438ad1.js.map +1 -0
  16. package/dist/cjs/catalyst.cjs.js +2 -2
  17. package/dist/cjs/{index-936b777e.js → index-c7955116.js} +12 -1
  18. package/dist/cjs/index-c7955116.js.map +1 -0
  19. package/dist/cjs/index.cjs.js +1 -1
  20. package/dist/cjs/loader.cjs.js +2 -2
  21. package/dist/collection/components/cat-alert/cat-alert.css +24 -14
  22. package/dist/collection/components/cat-alert/cat-alert.js +49 -1
  23. package/dist/collection/components/cat-alert/cat-alert.js.map +1 -1
  24. package/dist/collection/components/cat-checkbox/cat-checkbox.js +9 -6
  25. package/dist/collection/components/cat-checkbox/cat-checkbox.js.map +1 -1
  26. package/dist/collection/components/cat-input/cat-input.js +17 -12
  27. package/dist/collection/components/cat-input/cat-input.js.map +1 -1
  28. package/dist/collection/components/cat-input/input-type.js +2 -0
  29. package/dist/collection/components/cat-input/input-type.js.map +1 -0
  30. package/dist/collection/components/cat-notification/cat-notification.js +43 -44
  31. package/dist/collection/components/cat-notification/cat-notification.js.map +1 -1
  32. package/dist/collection/components/cat-tab/cat-tab.js +7 -7
  33. package/dist/collection/components/cat-tab/cat-tab.js.map +1 -1
  34. package/dist/collection/components/cat-tabs/cat-tabs.js +19 -2
  35. package/dist/collection/components/cat-tabs/cat-tabs.js.map +1 -1
  36. package/dist/collection/components/cat-toast-demo/cat-toast-demo.js +12 -1
  37. package/dist/collection/components/cat-toast-demo/cat-toast-demo.js.map +1 -1
  38. package/dist/collection/components/cat-toggle/cat-toggle.js +9 -6
  39. package/dist/collection/components/cat-toggle/cat-toggle.js.map +1 -1
  40. package/dist/collection/scss/core/_toast.scss +22 -12
  41. package/dist/components/cat-alert.js +23 -4
  42. package/dist/components/cat-alert.js.map +1 -1
  43. package/dist/components/cat-checkbox.js +7 -4
  44. package/dist/components/cat-checkbox.js.map +1 -1
  45. package/dist/components/cat-input.js +3 -3
  46. package/dist/components/cat-input.js.map +1 -1
  47. package/dist/components/cat-tab.js +7 -7
  48. package/dist/components/cat-tab.js.map +1 -1
  49. package/dist/components/cat-tabs.js +19 -2
  50. package/dist/components/cat-tabs.js.map +1 -1
  51. package/dist/components/cat-toast-demo.js +55 -45
  52. package/dist/components/cat-toast-demo.js.map +1 -1
  53. package/dist/components/cat-toggle.js +7 -4
  54. package/dist/components/cat-toggle.js.map +1 -1
  55. package/dist/esm/cat-alert_22.entry.js +56 -12
  56. package/dist/esm/cat-alert_22.entry.js.map +1 -1
  57. package/dist/esm/{cat-notification-953c785d.js → cat-notification-5b6a2cd9.js} +44 -45
  58. package/dist/esm/cat-notification-5b6a2cd9.js.map +1 -0
  59. package/dist/esm/catalyst.js +2 -2
  60. package/dist/esm/{index-41ceb7da.js → index-17d2bcf3.js} +12 -1
  61. package/dist/esm/index-17d2bcf3.js.map +1 -0
  62. package/dist/esm/index.js +1 -1
  63. package/dist/esm/loader.js +2 -2
  64. package/dist/types/components/cat-alert/cat-alert.d.ts +9 -0
  65. package/dist/types/components/cat-checkbox/cat-checkbox.d.ts +1 -1
  66. package/dist/types/components/cat-input/cat-input.d.ts +6 -5
  67. package/dist/types/components/cat-input/input-type.d.ts +1 -0
  68. package/dist/types/components/cat-notification/cat-notification.d.ts +9 -4
  69. package/dist/types/components/cat-tabs/cat-tabs.d.ts +5 -1
  70. package/dist/types/components/cat-toggle/cat-toggle.d.ts +1 -1
  71. package/dist/types/components.d.ts +31 -14
  72. package/package.json +4 -4
  73. package/dist/catalyst/p-4ced6c7c.entry.js.map +0 -1
  74. package/dist/catalyst/p-659073b5.js.map +0 -1
  75. package/dist/catalyst/p-f88f8914.js.map +0 -1
  76. package/dist/cjs/cat-notification-444c9ea0.js.map +0 -1
  77. package/dist/cjs/index-936b777e.js.map +0 -1
  78. package/dist/esm/cat-notification-953c785d.js.map +0 -1
  79. package/dist/esm/index-41ceb7da.js.map +0 -1
@@ -1,21 +1,32 @@
1
- import { r as registerInstance, h, H as Host, c as createEvent, g as getElement } from './index-41ceb7da.js';
2
- import { l as loglevel, a as CatIconRegistry, C as CatI18nRegistry, c as createCommonjsModule, g as getDefaultExportFromCjs, N as NotificationsService } from './cat-notification-953c785d.js';
1
+ import { r as registerInstance, h, H as Host, c as createEvent, g as getElement } from './index-17d2bcf3.js';
2
+ import { l as loglevel, a as CatIconRegistry, C as CatI18nRegistry, c as createCommonjsModule, g as getDefaultExportFromCjs, N as NotificationsService } from './cat-notification-5b6a2cd9.js';
3
3
 
4
- const catAlertCss = ":host{display:block;margin-bottom:1rem}:host(:focus-visible){outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}:host([hidden]){display:none}.alert{font:inherit;color:rgb(var(--text));background-color:rgba(var(--bg), 0.1);box-shadow:inset 0 0 0 1px rgba(var(--border), 0.2);border-radius:0.25rem;padding:0.75rem 1rem}::slotted(:last-child){margin-bottom:0 !important}.alert-primary{--bg:var(--cat-primary-bg, 32, 127, 138);--text:var(--cat-primary-text, 32, 127, 138);--border:var(--cat-primary-text, 32, 127, 138)}.alert-secondary{--bg:105, 118, 135;--text:0, 0, 0;--border:105, 118, 135}.alert-success{--bg:0, 132, 88;--text:0, 132, 88;--border:0, 132, 88}.alert-warning{--bg:255, 206, 128;--text:159, 97, 0;--border:159, 97, 0}.alert-danger{--bg:217, 52, 13;--text:217, 52, 13;--border:217, 52, 13}";
4
+ const catAlertCss = ":host{display:block;margin-bottom:1rem}:host(:focus-visible){outline:2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));outline-offset:1px}:host([hidden]){display:none}.alert{font:inherit;background-color:rgba(var(--bg), 0.1);border-radius:0.5rem;padding:1.25rem;display:flex;flex-direction:row;gap:0.5rem}.content{align-self:center}::slotted(:last-child){margin-bottom:0 !important}.alert-primary{--bg:var(--cat-primary-bg, 32, 127, 138)}.alert-primary cat-icon{color:#207f8a}.alert-secondary{--bg:105, 118, 135}.alert-secondary cat-icon{color:#697687}.alert-success{--bg:0, 132, 88}.alert-success cat-icon{color:#008458}.alert-warning{--bg:255, 206, 128}.alert-warning cat-icon{color:#ebb663}.alert-danger{--bg:217, 52, 13}.alert-danger cat-icon{color:#d9340d}";
5
5
 
6
6
  const CatAlert = class {
7
7
  constructor(hostRef) {
8
8
  registerInstance(this, hostRef);
9
+ this.mapIcon = new Map([
10
+ ['primary', 'star-circle-filled'],
11
+ ['secondary', 'clock-filled'],
12
+ ['success', 'check-circle-filled'],
13
+ ['warning', 'danger-filled'],
14
+ ['danger', 'cross-circle-filled']
15
+ ]);
9
16
  /**
10
17
  * The color palette of the alert.
11
18
  */
12
19
  this.color = 'primary';
20
+ /**
21
+ * Whether the icon of the alert is deactivated.
22
+ */
23
+ this.noIcon = false;
13
24
  }
14
25
  render() {
15
26
  return (h(Host, { tabindex: "0", role: this.role }, h("div", { part: "alert", class: {
16
27
  alert: true,
17
28
  [`alert-${this.color}`]: Boolean(this.color)
18
- } }, h("slot", null))));
29
+ } }, !this.noIcon && h("cat-icon", { size: "l", icon: this.icon ? this.icon : this.mapIcon.get(this.color) }), h("div", { class: "content" }, h("slot", null)))));
19
30
  }
20
31
  get role() {
21
32
  switch (this.color) {
@@ -533,14 +544,17 @@ const CatCheckbox = class {
533
544
  this.input.focus(options);
534
545
  }
535
546
  render() {
536
- 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, 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));
547
+ 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));
537
548
  }
538
549
  get hintSection() {
539
550
  const hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
540
551
  return ((this.hint || hasSlottedHint) && (h(CatFormHint, { hint: this.hint, slottedHint: hasSlottedHint && h("slot", { name: "hint" }) })));
541
552
  }
542
553
  onInput(event) {
543
- this.value = this.input.value;
554
+ this.checked = this.input.checked;
555
+ if (!this.value || typeof this.value === 'boolean') {
556
+ this.value = this.checked;
557
+ }
544
558
  this.catChange.emit(event);
545
559
  }
546
560
  onFocus(event) {
@@ -658,7 +672,7 @@ const CatInput = class {
658
672
  'input-disabled': this.disabled
659
673
  }, onClick: () => this.input.focus() }, this.textPrefix && (h("span", { class: "text-prefix", part: "prefix" }, this.textPrefix)), this.icon && !this.iconRight && h("cat-icon", { icon: this.icon, class: "icon-prefix", size: "l" }), h("div", { class: "input-inner-wrapper" }, h("input", { ref: el => (this.input = el), id: this.id, class: {
660
674
  'has-clearable': this.clearable && !this.disabled
661
- }, autocomplete: this.autoComplete, disabled: this.disabled, max: this.max, maxlength: this.maxLength, min: this.max, minlength: this.minLength, name: this.name, placeholder: this.placeholder, readonly: this.readonly, required: this.required, type: this.type, value: this.value, onInput: this.onInput.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this) }), this.clearable && !this.disabled && this.value && (h("cat-button", { class: "clearable", icon: "cross-circle-outlined", "icon-only": "true", size: "s", variant: "text", "a11y-label": this.i18n.t('input.clear'), onClick: this.clear.bind(this) }))), this.icon && this.iconRight && h("cat-icon", { icon: this.icon, class: "icon-suffix", size: "l" }), this.textSuffix && (h("span", { class: "text-suffix", part: "suffix" }, this.textSuffix))), this.hintSection));
675
+ }, autocomplete: this.autoComplete, disabled: this.disabled, max: this.max, maxlength: this.maxLength, min: this.min, minlength: this.minLength, name: this.name, placeholder: this.placeholder, readonly: this.readonly, required: this.required, type: this.type, value: this.value, onInput: this.onInput.bind(this), onFocus: this.onFocus.bind(this), onBlur: this.onBlur.bind(this) }), this.clearable && !this.disabled && this.value && (h("cat-button", { class: "clearable", icon: "cross-circle-outlined", "icon-only": "true", size: "s", variant: "text", "a11y-label": this.i18n.t('input.clear'), onClick: this.clear.bind(this) }))), this.icon && this.iconRight && h("cat-icon", { icon: this.icon, class: "icon-suffix", size: "l" }), this.textSuffix && (h("span", { class: "text-suffix", part: "suffix" }, this.textSuffix))), this.hintSection));
662
676
  }
663
677
  get hintSection() {
664
678
  const hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
@@ -12501,8 +12515,8 @@ const catTabsCss = ":host{display:flex;flex-direction:row;box-shadow:inset 0 -1p
12501
12515
  const CatTabs = class {
12502
12516
  constructor(hostRef) {
12503
12517
  registerInstance(this, hostRef);
12504
- this.tabs = [];
12505
12518
  this.buttons = [];
12519
+ this.tabs = [];
12506
12520
  /**
12507
12521
  * The ID of the active tab.
12508
12522
  */
@@ -12517,11 +12531,24 @@ const CatTabs = class {
12517
12531
  activeTab === null || activeTab === void 0 ? void 0 : activeTab.click();
12518
12532
  }
12519
12533
  componentWillLoad() {
12520
- this.tabs = Array.from(this.hostElement.querySelectorAll('cat-tab'));
12534
+ this.syncTabs();
12521
12535
  if (this.tabs.length) {
12522
12536
  this.activeTabId = this.activeTab;
12523
12537
  }
12524
12538
  }
12539
+ componentDidLoad() {
12540
+ var _a;
12541
+ this.mutationObserver = new MutationObserver(mutations => mutations.some(value => value.target.nodeName === 'CAT-TAB') && this.syncTabs());
12542
+ (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.hostElement, {
12543
+ childList: true,
12544
+ attributes: true,
12545
+ subtree: true
12546
+ });
12547
+ }
12548
+ disconnectedCallback() {
12549
+ var _a;
12550
+ (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
12551
+ }
12525
12552
  onKeydown(event) {
12526
12553
  var _a;
12527
12554
  if (['ArrowDown', 'ArrowUp', 'ArrowRight', 'ArrowLeft'].includes(event.key)) {
@@ -12551,6 +12578,9 @@ const CatTabs = class {
12551
12578
  this.buttons.push(button);
12552
12579
  }
12553
12580
  }
12581
+ syncTabs() {
12582
+ this.tabs = Array.from(this.hostElement.querySelectorAll('cat-tab'));
12583
+ }
12554
12584
  get hostElement() { return getElement(this); }
12555
12585
  static get watchers() { return {
12556
12586
  "activeTabId": ["onActiveTabChanged"]
@@ -12650,7 +12680,8 @@ const CatToastDemo = class {
12650
12680
  }
12651
12681
  onClick() {
12652
12682
  const infoOptions = {
12653
- position: 'top-left'
12683
+ position: 'top-left',
12684
+ type: 'info'
12654
12685
  };
12655
12686
  const errorOptions = {
12656
12687
  position: 'top-center',
@@ -12671,6 +12702,16 @@ const CatToastDemo = class {
12671
12702
  type: 'success',
12672
12703
  content: template.content.firstChild
12673
12704
  };
12705
+ const primaryOptions = {
12706
+ position: 'bottom-right',
12707
+ type: 'primary'
12708
+ };
12709
+ const secondaryOptions = {
12710
+ position: 'bottom-right',
12711
+ type: 'secondary'
12712
+ };
12713
+ NotificationsService.secondary('Secondary Click', 'secondary info', secondaryOptions);
12714
+ NotificationsService.primary('primary Click', 'secondary info', primaryOptions);
12674
12715
  NotificationsService.error('Default Click');
12675
12716
  NotificationsService.error('Long default title, long default title, long default title, long default title');
12676
12717
  NotificationsService.info('Info Click', 'Info message', infoOptions);
@@ -12734,14 +12775,17 @@ const CatToggle = class {
12734
12775
  this.input.focus(options);
12735
12776
  }
12736
12777
  render() {
12737
- 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, 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));
12778
+ 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));
12738
12779
  }
12739
12780
  get hintSection() {
12740
12781
  const hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
12741
12782
  return ((this.hint || hasSlottedHint) && (h(CatFormHint, { hint: this.hint, slottedHint: hasSlottedHint && h("slot", { name: "hint" }) })));
12742
12783
  }
12743
12784
  onInput(event) {
12744
- this.value = this.input.value;
12785
+ this.checked = this.input.checked;
12786
+ if (!this.value || typeof this.value === 'boolean') {
12787
+ this.value = this.checked;
12788
+ }
12745
12789
  this.catChange.emit(event);
12746
12790
  }
12747
12791
  onFocus(event) {