@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
@@ -2,24 +2,35 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-936b777e.js');
6
- const catNotification = require('./cat-notification-444c9ea0.js');
5
+ const index = require('./index-c7955116.js');
6
+ const catNotification = require('./cat-notification-6a438ad1.js');
7
7
 
8
- 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}";
8
+ 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}";
9
9
 
10
10
  const CatAlert = class {
11
11
  constructor(hostRef) {
12
12
  index.registerInstance(this, hostRef);
13
+ this.mapIcon = new Map([
14
+ ['primary', 'star-circle-filled'],
15
+ ['secondary', 'clock-filled'],
16
+ ['success', 'check-circle-filled'],
17
+ ['warning', 'danger-filled'],
18
+ ['danger', 'cross-circle-filled']
19
+ ]);
13
20
  /**
14
21
  * The color palette of the alert.
15
22
  */
16
23
  this.color = 'primary';
24
+ /**
25
+ * Whether the icon of the alert is deactivated.
26
+ */
27
+ this.noIcon = false;
17
28
  }
18
29
  render() {
19
30
  return (index.h(index.Host, { tabindex: "0", role: this.role }, index.h("div", { part: "alert", class: {
20
31
  alert: true,
21
32
  [`alert-${this.color}`]: Boolean(this.color)
22
- } }, index.h("slot", null))));
33
+ } }, !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)))));
23
34
  }
24
35
  get role() {
25
36
  switch (this.color) {
@@ -537,14 +548,17 @@ const CatCheckbox = class {
537
548
  this.input.focus(options);
538
549
  }
539
550
  render() {
540
- 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, 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));
551
+ 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));
541
552
  }
542
553
  get hintSection() {
543
554
  const hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
544
555
  return ((this.hint || hasSlottedHint) && (index.h(CatFormHint, { hint: this.hint, slottedHint: hasSlottedHint && index.h("slot", { name: "hint" }) })));
545
556
  }
546
557
  onInput(event) {
547
- this.value = this.input.value;
558
+ this.checked = this.input.checked;
559
+ if (!this.value || typeof this.value === 'boolean') {
560
+ this.value = this.checked;
561
+ }
548
562
  this.catChange.emit(event);
549
563
  }
550
564
  onFocus(event) {
@@ -662,7 +676,7 @@ const CatInput = class {
662
676
  'input-disabled': this.disabled
663
677
  }, onClick: () => this.input.focus() }, this.textPrefix && (index.h("span", { class: "text-prefix", part: "prefix" }, this.textPrefix)), this.icon && !this.iconRight && index.h("cat-icon", { icon: this.icon, class: "icon-prefix", size: "l" }), index.h("div", { class: "input-inner-wrapper" }, index.h("input", { ref: el => (this.input = el), id: this.id, class: {
664
678
  'has-clearable': this.clearable && !this.disabled
665
- }, 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 && (index.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 && index.h("cat-icon", { icon: this.icon, class: "icon-suffix", size: "l" }), this.textSuffix && (index.h("span", { class: "text-suffix", part: "suffix" }, this.textSuffix))), this.hintSection));
679
+ }, 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 && (index.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 && index.h("cat-icon", { icon: this.icon, class: "icon-suffix", size: "l" }), this.textSuffix && (index.h("span", { class: "text-suffix", part: "suffix" }, this.textSuffix))), this.hintSection));
666
680
  }
667
681
  get hintSection() {
668
682
  const hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
@@ -12505,8 +12519,8 @@ const catTabsCss = ":host{display:flex;flex-direction:row;box-shadow:inset 0 -1p
12505
12519
  const CatTabs = class {
12506
12520
  constructor(hostRef) {
12507
12521
  index.registerInstance(this, hostRef);
12508
- this.tabs = [];
12509
12522
  this.buttons = [];
12523
+ this.tabs = [];
12510
12524
  /**
12511
12525
  * The ID of the active tab.
12512
12526
  */
@@ -12521,11 +12535,24 @@ const CatTabs = class {
12521
12535
  activeTab === null || activeTab === void 0 ? void 0 : activeTab.click();
12522
12536
  }
12523
12537
  componentWillLoad() {
12524
- this.tabs = Array.from(this.hostElement.querySelectorAll('cat-tab'));
12538
+ this.syncTabs();
12525
12539
  if (this.tabs.length) {
12526
12540
  this.activeTabId = this.activeTab;
12527
12541
  }
12528
12542
  }
12543
+ componentDidLoad() {
12544
+ var _a;
12545
+ this.mutationObserver = new MutationObserver(mutations => mutations.some(value => value.target.nodeName === 'CAT-TAB') && this.syncTabs());
12546
+ (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.hostElement, {
12547
+ childList: true,
12548
+ attributes: true,
12549
+ subtree: true
12550
+ });
12551
+ }
12552
+ disconnectedCallback() {
12553
+ var _a;
12554
+ (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
12555
+ }
12529
12556
  onKeydown(event) {
12530
12557
  var _a;
12531
12558
  if (['ArrowDown', 'ArrowUp', 'ArrowRight', 'ArrowLeft'].includes(event.key)) {
@@ -12555,6 +12582,9 @@ const CatTabs = class {
12555
12582
  this.buttons.push(button);
12556
12583
  }
12557
12584
  }
12585
+ syncTabs() {
12586
+ this.tabs = Array.from(this.hostElement.querySelectorAll('cat-tab'));
12587
+ }
12558
12588
  get hostElement() { return index.getElement(this); }
12559
12589
  static get watchers() { return {
12560
12590
  "activeTabId": ["onActiveTabChanged"]
@@ -12654,7 +12684,8 @@ const CatToastDemo = class {
12654
12684
  }
12655
12685
  onClick() {
12656
12686
  const infoOptions = {
12657
- position: 'top-left'
12687
+ position: 'top-left',
12688
+ type: 'info'
12658
12689
  };
12659
12690
  const errorOptions = {
12660
12691
  position: 'top-center',
@@ -12675,6 +12706,16 @@ const CatToastDemo = class {
12675
12706
  type: 'success',
12676
12707
  content: template.content.firstChild
12677
12708
  };
12709
+ const primaryOptions = {
12710
+ position: 'bottom-right',
12711
+ type: 'primary'
12712
+ };
12713
+ const secondaryOptions = {
12714
+ position: 'bottom-right',
12715
+ type: 'secondary'
12716
+ };
12717
+ catNotification.NotificationsService.secondary('Secondary Click', 'secondary info', secondaryOptions);
12718
+ catNotification.NotificationsService.primary('primary Click', 'secondary info', primaryOptions);
12678
12719
  catNotification.NotificationsService.error('Default Click');
12679
12720
  catNotification.NotificationsService.error('Long default title, long default title, long default title, long default title');
12680
12721
  catNotification.NotificationsService.info('Info Click', 'Info message', infoOptions);
@@ -12738,14 +12779,17 @@ const CatToggle = class {
12738
12779
  this.input.focus(options);
12739
12780
  }
12740
12781
  render() {
12741
- 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, 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));
12782
+ 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));
12742
12783
  }
12743
12784
  get hintSection() {
12744
12785
  const hasSlottedHint = !!this.hostElement.querySelector('[slot="hint"]');
12745
12786
  return ((this.hint || hasSlottedHint) && (index.h(CatFormHint, { hint: this.hint, slottedHint: hasSlottedHint && index.h("slot", { name: "hint" }) })));
12746
12787
  }
12747
12788
  onInput(event) {
12748
- this.value = this.input.value;
12789
+ this.checked = this.input.checked;
12790
+ if (!this.value || typeof this.value === 'boolean') {
12791
+ this.value = this.checked;
12792
+ }
12749
12793
  this.catChange.emit(event);
12750
12794
  }
12751
12795
  onFocus(event) {