@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
@@ -7,10 +7,21 @@ import { Component, h, Host, Prop } from '@stencil/core';
7
7
  */
8
8
  export class CatAlert {
9
9
  constructor() {
10
+ this.mapIcon = new Map([
11
+ ['primary', 'star-circle-filled'],
12
+ ['secondary', 'clock-filled'],
13
+ ['success', 'check-circle-filled'],
14
+ ['warning', 'danger-filled'],
15
+ ['danger', 'cross-circle-filled']
16
+ ]);
10
17
  /**
11
18
  * The color palette of the alert.
12
19
  */
13
20
  this.color = 'primary';
21
+ /**
22
+ * Whether the icon of the alert is deactivated.
23
+ */
24
+ this.noIcon = false;
14
25
  }
15
26
  render() {
16
27
  return (h(Host, { tabindex: "0", role: this.role },
@@ -18,7 +29,9 @@ export class CatAlert {
18
29
  alert: true,
19
30
  [`alert-${this.color}`]: Boolean(this.color)
20
31
  } },
21
- h("slot", null))));
32
+ !this.noIcon && h("cat-icon", { size: "l", icon: this.icon ? this.icon : this.mapIcon.get(this.color) }),
33
+ h("div", { class: "content" },
34
+ h("slot", null)))));
22
35
  }
23
36
  get role() {
24
37
  switch (this.color) {
@@ -55,6 +68,41 @@ export class CatAlert {
55
68
  "attribute": "color",
56
69
  "reflect": false,
57
70
  "defaultValue": "'primary'"
71
+ },
72
+ "icon": {
73
+ "type": "string",
74
+ "mutable": false,
75
+ "complexType": {
76
+ "original": "string",
77
+ "resolved": "string | undefined",
78
+ "references": {}
79
+ },
80
+ "required": false,
81
+ "optional": true,
82
+ "docs": {
83
+ "tags": [],
84
+ "text": "The name of an icon to be displayed in the alert."
85
+ },
86
+ "attribute": "icon",
87
+ "reflect": false
88
+ },
89
+ "noIcon": {
90
+ "type": "boolean",
91
+ "mutable": false,
92
+ "complexType": {
93
+ "original": "boolean",
94
+ "resolved": "boolean",
95
+ "references": {}
96
+ },
97
+ "required": false,
98
+ "optional": false,
99
+ "docs": {
100
+ "tags": [],
101
+ "text": "Whether the icon of the alert is deactivated."
102
+ },
103
+ "attribute": "no-icon",
104
+ "reflect": false,
105
+ "defaultValue": "false"
58
106
  }
59
107
  }; }
60
108
  }
@@ -1 +1 @@
1
- {"version":3,"file":"cat-alert.js","sourceRoot":"","sources":["../../../src/components/cat-alert/cat-alert.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAEzD;;;;;GAKG;AAMH,MAAM,OAAO,QAAQ;EALrB;IAME;;OAEG;IACK,UAAK,GAA+D,SAAS,CAAC;GA2BvF;EAzBC,MAAM;IACJ,OAAO,CACL,EAAC,IAAI,IAAC,QAAQ,EAAC,GAAG,EAAC,IAAI,EAAE,IAAI,CAAC,IAAI;MAChC,WACE,IAAI,EAAC,OAAO,EACZ,KAAK,EAAE;UACL,KAAK,EAAE,IAAI;UACX,CAAC,SAAS,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;SAC7C;QAED,eAAa,CACT,CACD,CACR,CAAC;EACJ,CAAC;EAED,IAAY,IAAI;IACd,QAAQ,IAAI,CAAC,KAAK,EAAE;MAClB,KAAK,QAAQ,CAAC;MACd,KAAK,SAAS;QACZ,OAAO,OAAO,CAAC;MACjB;QACE,OAAO,QAAQ,CAAC;KACnB;EACH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Host, Prop } from '@stencil/core';\n\n/**\n * Informs user about important changes or conditions in the interface. Use this\n * component if you need to capture user’s attention in a prominent way.\n *\n * @part alert - The alert element.\n */\n@Component({\n tag: 'cat-alert',\n styleUrl: 'cat-alert.scss',\n shadow: true\n})\nexport class CatAlert {\n /**\n * The color palette of the alert.\n */\n @Prop() color: 'primary' | 'secondary' | 'danger' | 'success' | 'warning' = 'primary';\n\n render() {\n return (\n <Host tabindex=\"0\" role={this.role}>\n <div\n part=\"alert\"\n class={{\n alert: true,\n [`alert-${this.color}`]: Boolean(this.color)\n }}\n >\n <slot></slot>\n </div>\n </Host>\n );\n }\n\n private get role() {\n switch (this.color) {\n case 'danger':\n case 'warning':\n return 'alert';\n default:\n return 'status';\n }\n }\n}\n"]}
1
+ {"version":3,"file":"cat-alert.js","sourceRoot":"","sources":["../../../src/components/cat-alert/cat-alert.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAEzD;;;;;GAKG;AAMH,MAAM,OAAO,QAAQ;EALrB;IAMmB,YAAO,GAAwB,IAAI,GAAG,CAAC;MACtD,CAAC,SAAS,EAAE,oBAAoB,CAAC;MACjC,CAAC,WAAW,EAAE,cAAc,CAAC;MAC7B,CAAC,SAAS,EAAE,qBAAqB,CAAC;MAClC,CAAC,SAAS,EAAE,eAAe,CAAC;MAC5B,CAAC,QAAQ,EAAE,qBAAqB,CAAC;KAClC,CAAC,CAAC;IAEH;;OAEG;IACK,UAAK,GAA+D,SAAS,CAAC;IAOtF;;OAEG;IACK,WAAM,GAAG,KAAK,CAAC;GA8BxB;EA5BC,MAAM;IACJ,OAAO,CACL,EAAC,IAAI,IAAC,QAAQ,EAAC,GAAG,EAAC,IAAI,EAAE,IAAI,CAAC,IAAI;MAChC,WACE,IAAI,EAAC,OAAO,EACZ,KAAK,EAAE;UACL,KAAK,EAAE,IAAI;UACX,CAAC,SAAS,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;SAC7C;QAEA,CAAC,IAAI,CAAC,MAAM,IAAI,gBAAU,IAAI,EAAC,GAAG,EAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,GAAa;QAC3G,WAAK,KAAK,EAAC,SAAS;UAClB,eAAa,CACT,CACF,CACD,CACR,CAAC;EACJ,CAAC;EAED,IAAY,IAAI;IACd,QAAQ,IAAI,CAAC,KAAK,EAAE;MAClB,KAAK,QAAQ,CAAC;MACd,KAAK,SAAS;QACZ,OAAO,OAAO,CAAC;MACjB;QACE,OAAO,QAAQ,CAAC;KACnB;EACH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Host, Prop } from '@stencil/core';\n\n/**\n * Informs user about important changes or conditions in the interface. Use this\n * component if you need to capture user’s attention in a prominent way.\n *\n * @part alert - The alert element.\n */\n@Component({\n tag: 'cat-alert',\n styleUrl: 'cat-alert.scss',\n shadow: true\n})\nexport class CatAlert {\n private readonly mapIcon: Map<string, string> = new Map([\n ['primary', 'star-circle-filled'],\n ['secondary', 'clock-filled'],\n ['success', 'check-circle-filled'],\n ['warning', 'danger-filled'],\n ['danger', 'cross-circle-filled']\n ]);\n\n /**\n * The color palette of the alert.\n */\n @Prop() color: 'primary' | 'secondary' | 'danger' | 'success' | 'warning' = 'primary';\n\n /**\n * The name of an icon to be displayed in the alert.\n */\n @Prop() icon?: string;\n\n /**\n * Whether the icon of the alert is deactivated.\n */\n @Prop() noIcon = false;\n\n render() {\n return (\n <Host tabindex=\"0\" role={this.role}>\n <div\n part=\"alert\"\n class={{\n alert: true,\n [`alert-${this.color}`]: Boolean(this.color)\n }}\n >\n {!this.noIcon && <cat-icon size=\"l\" icon={this.icon ? this.icon : this.mapIcon.get(this.color)}></cat-icon>}\n <div class=\"content\">\n <slot></slot>\n </div>\n </div>\n </Host>\n );\n }\n\n private get role() {\n switch (this.color) {\n case 'danger':\n case 'warning':\n return 'alert';\n default:\n return 'status';\n }\n }\n}\n"]}
@@ -67,7 +67,7 @@ export class CatCheckbox {
67
67
  render() {
68
68
  return (h(Host, null,
69
69
  h("label", { htmlFor: this.id, class: { 'is-hidden': this.labelHidden, 'is-disabled': this.disabled, 'label-left': this.labelLeft } },
70
- 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) }),
70
+ 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) }),
71
71
  h("span", { class: "box", "aria-hidden": "true", part: "checkbox" },
72
72
  h("svg", { class: "check", viewBox: "0 0 12 10" },
73
73
  h("polyline", { points: "1.5 6 4.5 9 10.5 1" })),
@@ -81,7 +81,10 @@ export class CatCheckbox {
81
81
  return ((this.hint || hasSlottedHint) && (h(CatFormHint, { hint: this.hint, slottedHint: hasSlottedHint && h("slot", { name: "hint" }) })));
82
82
  }
83
83
  onInput(event) {
84
- this.value = this.input.value;
84
+ this.checked = this.input.checked;
85
+ if (!this.value || typeof this.value === 'boolean') {
86
+ this.value = this.checked;
87
+ }
85
88
  this.catChange.emit(event);
86
89
  }
87
90
  onFocus(event) {
@@ -101,7 +104,7 @@ export class CatCheckbox {
101
104
  static get properties() { return {
102
105
  "checked": {
103
106
  "type": "boolean",
104
- "mutable": false,
107
+ "mutable": true,
105
108
  "complexType": {
106
109
  "original": "boolean",
107
110
  "resolved": "boolean",
@@ -225,11 +228,11 @@ export class CatCheckbox {
225
228
  "defaultValue": "false"
226
229
  },
227
230
  "value": {
228
- "type": "string",
231
+ "type": "any",
229
232
  "mutable": true,
230
233
  "complexType": {
231
- "original": "string",
232
- "resolved": "string | undefined",
234
+ "original": "string | boolean",
235
+ "resolved": "boolean | string | undefined",
233
236
  "references": {}
234
237
  },
235
238
  "required": false,
@@ -1 +1 @@
1
- {"version":3,"file":"cat-checkbox.js","sourceRoot":"","sources":["../../../src/components/cat-checkbox/cat-checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtG,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAE7D,IAAI,YAAY,GAAG,CAAC,CAAC;AAErB;;;;;;;;GAQG;AAMH,MAAM,OAAO,WAAW;EALxB;IAMmB,OAAE,GAAG,gBAAgB,YAAY,EAAE,EAAE,CAAC;IAK9C,oBAAe,GAAG,KAAK,CAAC;IAEjC;;OAEG;IACK,YAAO,GAAG,KAAK,CAAC;IAExB;;OAEG;IACK,aAAQ,GAAG,KAAK,CAAC;IAEzB;;OAEG;IACK,kBAAa,GAAG,KAAK,CAAC;IAE9B;;OAEG;IACK,UAAK,GAAG,EAAE,CAAC;IAEnB;;OAEG;IACK,gBAAW,GAAG,KAAK,CAAC;IAO5B;;OAEG;IACK,aAAQ,GAAG,KAAK,CAAC;IAYzB;;OAEG;IACK,cAA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KAAK,CAAC,CAAC;EAC3B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Host, Method, Prop, State } from '@stencil/core';\nimport log from 'loglevel';\nimport { CatFormHint } from '../cat-form-hint/cat-form-hint';\n\nlet nextUniqueId = 0;\n\n/**\n * Checkboxes are used to let a user choose one or more options from a limited\n * number of options.\n *\n * @slot hint - Optional hint element to be displayed with the checkbox.\n * @slot label - The slotted label. If both the label property and the label slot are present, only the label slot will be displayed.\n * @part checkbox - The checkbox element.\n * @part label - The label content.\n */\n@Component({\n tag: 'cat-checkbox',\n styleUrls: ['cat-checkbox.scss'],\n shadow: true\n})\nexport class CatCheckbox {\n private readonly id = `cat-checkbox-${nextUniqueId++}`;\n private input!: HTMLInputElement;\n\n @Element() hostElement!: HTMLElement;\n\n @State() hasSlottedLabel = false;\n\n /**\n * Checked state of the checkbox\n */\n @Prop() checked = false;\n\n /**\n * Disabled state of the checkbox\n */\n @Prop() disabled = false;\n\n /**\n * Indeterminate state of the checkbox\n */\n @Prop() indeterminate = false;\n\n /**\n * Label of the checkbox which is presented in the UI\n */\n @Prop() label = '';\n\n /**\n * Visually hide the label, but still show it to assistive technologies like screen readers.\n */\n @Prop() labelHidden = false;\n\n /**\n * The name of the input\n */\n @Prop() name?: string;\n\n /**\n * Required state of the checkbox\n */\n @Prop() required = false;\n\n /**\n * The value of the checkbox\n */\n @Prop({ mutable: true }) value?: string;\n\n /**\n * Optional hint text(s) to be displayed with the checkbox.\n */\n @Prop() hint?: string | string[];\n\n /**\n * Whether the label should appear to the left of the checkbox.\n */\n @Prop() labelLeft = false;\n\n /**\n * Emitted when the checked status of the checkbox is changed.\n */\n @Event() catChange!: EventEmitter;\n\n /**\n * Emitted when the checkbox received focus.\n */\n @Event() catFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the checkbox loses focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n componentDidLoad() {\n if (this.input && this.indeterminate) {\n this.input.indeterminate = true;\n }\n }\n\n componentWillRender(): void {\n this.hasSlottedLabel = !!this.hostElement.querySelector('[slot=\"label\"]');\n if (!this.label && !this.hasSlottedLabel) {\n log.error('[A11y] Missing ARIA label on checkbox', this);\n }\n }\n\n /**\n * Sets focus on the checkbox. Use this method instead of `checkbox.focus()`.\n *\n * @param options An optional object providing options to control aspects of\n * the focusing process.\n */\n @Method()\n async setFocus(options?: FocusOptions): Promise<void> {\n this.input.focus(options);\n }\n\n render() {\n return (\n <Host>\n <label\n htmlFor={this.id}\n class={{ 'is-hidden': this.labelHidden, 'is-disabled': this.disabled, 'label-left': this.labelLeft }}\n >\n <input\n ref={el => (this.input = el as HTMLInputElement)}\n id={this.id}\n type=\"checkbox\"\n name={this.name}\n value={this.value}\n checked={this.checked}\n required={this.required}\n disabled={this.disabled}\n onInput={this.onInput.bind(this)}\n onFocus={this.onFocus.bind(this)}\n onBlur={this.onBlur.bind(this)}\n />\n <span class=\"box\" aria-hidden=\"true\" part=\"checkbox\">\n <svg class=\"check\" viewBox=\"0 0 12 10\">\n <polyline points=\"1.5 6 4.5 9 10.5 1\"></polyline>\n </svg>\n <svg class=\"dash\" viewBox=\"0 0 12 10\">\n <polyline points=\"1.5 5 10.5 5\"></polyline>\n </svg>\n </span>\n <span class=\"label\" part=\"label\">\n {(this.hasSlottedLabel && <slot name=\"label\"></slot>) || this.label}\n </span>\n </label>\n {this.hintSection}\n </Host>\n );\n }\n\n private get hintSection() {\n const hasSlottedHint = !!this.hostElement.querySelector('[slot=\"hint\"]');\n return (\n (this.hint || hasSlottedHint) && (\n <CatFormHint hint={this.hint} slottedHint={hasSlottedHint && <slot name=\"hint\"></slot>} />\n )\n );\n }\n\n private onInput(event: Event) {\n this.value = this.input.value;\n this.catChange.emit(event);\n }\n\n private onFocus(event: FocusEvent) {\n this.catFocus.emit(event);\n }\n\n private onBlur(event: FocusEvent) {\n this.catBlur.emit(event);\n }\n}\n"]}
1
+ {"version":3,"file":"cat-checkbox.js","sourceRoot":"","sources":["../../../src/components/cat-checkbox/cat-checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtG,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAE7D,IAAI,YAAY,GAAG,CAAC,CAAC;AAErB;;;;;;;;GAQG;AAMH,MAAM,OAAO,WAAW;EALxB;IAMmB,OAAE,GAAG,gBAAgB,YAAY,EAAE,EAAE,CAAC;IAK9C,oBAAe,GAAG,KAAK,CAAC;IAEjC;;OAEG;IACsB,YAAO,GAAG,KAAK,CAAC;IAEzC;;OAEG;IACK,aAAQ,GAAG,KAAK,CAAC;IAEzB;;OAEG;IACK,kBAAa,GAAG,KAAK,CAAC;IAE9B;;OAEG;IACK,UAAK,GAAG,EAAE,CAAC;IAEnB;;OAEG;IACK,gBAAW,GAAG,KAAK,CAAC;IAO5B;;OAEG;IACK,aAAQ,GAAG,KAAK,CAAC;IAYzB;;OAEG;IACK,cAAS,GAAG,KAAK,CAAC;GAuG3B;EAtFC,gBAAgB;IACd,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,aAAa,EAAE;MACpC,IAAI,CAAC,KAAK,CAAC,aAAa,GAAG,IAAI,CAAC;KACjC;EACH,CAAC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AC;EAEO,MAAM,CAAC,KAAiB;IAC9B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;EAC3B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Host, Method, Prop, State } from '@stencil/core';\nimport log from 'loglevel';\nimport { CatFormHint } from '../cat-form-hint/cat-form-hint';\n\nlet nextUniqueId = 0;\n\n/**\n * Checkboxes are used to let a user choose one or more options from a limited\n * number of options.\n *\n * @slot hint - Optional hint element to be displayed with the checkbox.\n * @slot label - The slotted label. If both the label property and the label slot are present, only the label slot will be displayed.\n * @part checkbox - The checkbox element.\n * @part label - The label content.\n */\n@Component({\n tag: 'cat-checkbox',\n styleUrls: ['cat-checkbox.scss'],\n shadow: true\n})\nexport class CatCheckbox {\n private readonly id = `cat-checkbox-${nextUniqueId++}`;\n private input!: HTMLInputElement;\n\n @Element() hostElement!: HTMLElement;\n\n @State() hasSlottedLabel = false;\n\n /**\n * Checked state of the checkbox\n */\n @Prop({ mutable: true }) checked = false;\n\n /**\n * Disabled state of the checkbox\n */\n @Prop() disabled = false;\n\n /**\n * Indeterminate state of the checkbox\n */\n @Prop() indeterminate = false;\n\n /**\n * Label of the checkbox which is presented in the UI\n */\n @Prop() label = '';\n\n /**\n * Visually hide the label, but still show it to assistive technologies like screen readers.\n */\n @Prop() labelHidden = false;\n\n /**\n * The name of the input\n */\n @Prop() name?: string;\n\n /**\n * Required state of the checkbox\n */\n @Prop() required = false;\n\n /**\n * The value of the checkbox\n */\n @Prop({ mutable: true }) value?: string | boolean;\n\n /**\n * Optional hint text(s) to be displayed with the checkbox.\n */\n @Prop() hint?: string | string[];\n\n /**\n * Whether the label should appear to the left of the checkbox.\n */\n @Prop() labelLeft = false;\n\n /**\n * Emitted when the checked status of the checkbox is changed.\n */\n @Event() catChange!: EventEmitter;\n\n /**\n * Emitted when the checkbox received focus.\n */\n @Event() catFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the checkbox loses focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n componentDidLoad() {\n if (this.input && this.indeterminate) {\n this.input.indeterminate = true;\n }\n }\n\n componentWillRender(): void {\n this.hasSlottedLabel = !!this.hostElement.querySelector('[slot=\"label\"]');\n if (!this.label && !this.hasSlottedLabel) {\n log.error('[A11y] Missing ARIA label on checkbox', this);\n }\n }\n\n /**\n * Sets focus on the checkbox. Use this method instead of `checkbox.focus()`.\n *\n * @param options An optional object providing options to control aspects of\n * the focusing process.\n */\n @Method()\n async setFocus(options?: FocusOptions): Promise<void> {\n this.input.focus(options);\n }\n\n render() {\n return (\n <Host>\n <label\n htmlFor={this.id}\n class={{ 'is-hidden': this.labelHidden, 'is-disabled': this.disabled, 'label-left': this.labelLeft }}\n >\n <input\n ref={el => (this.input = el as HTMLInputElement)}\n id={this.id}\n type=\"checkbox\"\n name={this.name}\n value={this.value !== undefined ? String(this.value) : this.value}\n checked={this.checked}\n required={this.required}\n disabled={this.disabled}\n onInput={this.onInput.bind(this)}\n onFocus={this.onFocus.bind(this)}\n onBlur={this.onBlur.bind(this)}\n />\n <span class=\"box\" aria-hidden=\"true\" part=\"checkbox\">\n <svg class=\"check\" viewBox=\"0 0 12 10\">\n <polyline points=\"1.5 6 4.5 9 10.5 1\"></polyline>\n </svg>\n <svg class=\"dash\" viewBox=\"0 0 12 10\">\n <polyline points=\"1.5 5 10.5 5\"></polyline>\n </svg>\n </span>\n <span class=\"label\" part=\"label\">\n {(this.hasSlottedLabel && <slot name=\"label\"></slot>) || this.label}\n </span>\n </label>\n {this.hintSection}\n </Host>\n );\n }\n\n private get hintSection() {\n const hasSlottedHint = !!this.hostElement.querySelector('[slot=\"hint\"]');\n return (\n (this.hint || hasSlottedHint) && (\n <CatFormHint hint={this.hint} slottedHint={hasSlottedHint && <slot name=\"hint\"></slot>} />\n )\n );\n }\n\n private onInput(event: Event) {\n this.checked = this.input.checked;\n\n if (!this.value || typeof this.value === 'boolean') {\n this.value = this.checked;\n }\n this.catChange.emit(event);\n }\n\n private onFocus(event: FocusEvent) {\n this.catFocus.emit(event);\n }\n\n private onBlur(event: FocusEvent) {\n this.catBlur.emit(event);\n }\n}\n"]}
@@ -100,7 +100,7 @@ export class CatInput {
100
100
  h("div", { class: "input-inner-wrapper" },
101
101
  h("input", { ref: el => (this.input = el), id: this.id, class: {
102
102
  'has-clearable': this.clearable && !this.disabled
103
- }, 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) }),
103
+ }, 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) }),
104
104
  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) }))),
105
105
  this.icon && this.iconRight && h("cat-icon", { icon: this.icon, class: "icon-suffix", size: "l" }),
106
106
  this.textSuffix && (h("span", { class: "text-suffix", part: "suffix" }, this.textSuffix))),
@@ -271,18 +271,18 @@ export class CatInput {
271
271
  "defaultValue": "false"
272
272
  },
273
273
  "max": {
274
- "type": "number",
274
+ "type": "any",
275
275
  "mutable": false,
276
276
  "complexType": {
277
- "original": "number",
278
- "resolved": "number | undefined",
277
+ "original": "number | string",
278
+ "resolved": "number | string | undefined",
279
279
  "references": {}
280
280
  },
281
281
  "required": false,
282
282
  "optional": true,
283
283
  "docs": {
284
284
  "tags": [],
285
- "text": "A maximum value for numeric values."
285
+ "text": "A maximum value for date, time and numeric values."
286
286
  },
287
287
  "attribute": "max",
288
288
  "reflect": false
@@ -305,18 +305,18 @@ export class CatInput {
305
305
  "reflect": false
306
306
  },
307
307
  "min": {
308
- "type": "number",
308
+ "type": "any",
309
309
  "mutable": false,
310
310
  "complexType": {
311
- "original": "number",
312
- "resolved": "number | undefined",
311
+ "original": "number | string",
312
+ "resolved": "number | string | undefined",
313
313
  "references": {}
314
314
  },
315
315
  "required": false,
316
316
  "optional": true,
317
317
  "docs": {
318
318
  "tags": [],
319
- "text": "A minimum value for numeric values."
319
+ "text": "A minimum value for date, time and numeric values."
320
320
  },
321
321
  "attribute": "min",
322
322
  "reflect": false
@@ -465,9 +465,14 @@ export class CatInput {
465
465
  "type": "string",
466
466
  "mutable": false,
467
467
  "complexType": {
468
- "original": "'text' | 'email' | 'password' | 'tel' | 'url' | 'search' | 'number'",
469
- "resolved": "\"email\" | \"number\" | \"password\" | \"search\" | \"tel\" | \"text\" | \"url\"",
470
- "references": {}
468
+ "original": "InputType",
469
+ "resolved": "\"button\" | \"color\" | \"date\" | \"datetime-local\" | \"email\" | \"file\" | \"month\" | \"number\" | \"password\" | \"range\" | \"reset\" | \"search\" | \"submit\" | \"tel\" | \"text\" | \"time\" | \"url\" | \"week\"",
470
+ "references": {
471
+ "InputType": {
472
+ "location": "import",
473
+ "path": "./input-type"
474
+ }
475
+ }
471
476
  },
472
477
  "required": false,
473
478
  "optional": false,
@@ -1 +1 @@
1
- {"version":3,"file":"cat-input.js","sourceRoot":"","sources":["../../../src/components/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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Host, Method, Prop, State } from '@stencil/core';\nimport log from 'loglevel';\nimport { CatFormHint } from '../cat-form-hint/cat-form-hint';\nimport { CatI18nRegistry } from '../cat-i18n/cat-i18n-registry';\n\nlet nextUniqueId = 0;\n\n/**\n * Inputs are used to allow users to provide text input when the expected input\n * is short. As well as plain text, Input supports various types of text,\n * including passwords and numbers.\n *\n * @slot hint - Optional hint element to be displayed with the input.\n * @slot label - The slotted label. If both the label property and the label slot are present, only the label slot will be displayed.\n * @part label - The label content.\n * @part prefix - The text prefix.\n * @part suffix - The text suffix.\n */\n@Component({\n tag: 'cat-input',\n styleUrl: 'cat-input.scss',\n shadow: true\n})\nexport class CatInput {\n private readonly i18n = CatI18nRegistry.getInstance();\n private readonly id = `cat-input-${nextUniqueId++}`;\n private input!: HTMLInputElement;\n\n @Element() hostElement!: HTMLElement;\n\n @State() hasSlottedLabel = false;\n\n /**\n * Hint for form autofill feature.\n */\n @Prop() autoComplete?: string;\n\n /**\n * Whether the input should show a clear button.\n */\n @Prop() clearable = false;\n\n /**\n * Whether the input is disabled.\n */\n @Prop() disabled = false;\n\n /**\n * Optional hint text(s) to be displayed with the input.\n */\n @Prop() hint?: string | string[];\n\n /**\n * The name of an icon to be displayed in the input.\n */\n @Prop() icon?: string;\n\n /**\n * Display the icon on the right.\n */\n @Prop() iconRight = false;\n\n /**\n * The label for the input.\n */\n @Prop() label = '';\n\n /**\n * Visually hide the label, but still show it to assistive technologies like screen readers.\n */\n @Prop() labelHidden = false;\n\n /**\n * A maximum value for numeric values.\n */\n @Prop() max?: number;\n\n /**\n * A maximum length (number of characters) for textual values.\n */\n @Prop() maxLength?: number;\n\n /**\n * A minimum value for numeric values.\n */\n @Prop() min?: number;\n\n /**\n * A minimum length (number of characters) for textual values.\n */\n @Prop() minLength?: number;\n\n /**\n * The name of the form control. Submitted with the form as part of a name/value pair.\n */\n @Prop() name = '';\n\n /**\n * The placeholder text to display within the input.\n */\n @Prop() placeholder?: string;\n\n /**\n * A textual prefix to be displayed in the input.\n */\n @Prop() textPrefix?: string;\n\n /**\n * A textual suffix to be displayed in the input.\n */\n @Prop() textSuffix?: string;\n\n /**\n * The value is not editable.\n */\n @Prop() readonly = false;\n\n /**\n * A value is required or must be check for the form to be submittable.\n */\n @Prop() required = false;\n\n /**\n * Use round input edges.\n */\n @Prop() round = false;\n\n /**\n * Type of form control.\n */\n @Prop() type: 'text' | 'email' | 'password' | 'tel' | 'url' | 'search' | 'number' = 'text';\n\n /**\n * The value of the control.\n */\n @Prop({ mutable: true }) value?: string | number;\n\n /**\n * Emitted when the value is changed.\n */\n @Event() catChange!: EventEmitter;\n\n /**\n * Emitted when the input received focus.\n */\n @Event() catFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the input loses focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n componentWillRender(): void {\n this.hasSlottedLabel = !!this.hostElement.querySelector('[slot=\"label\"]');\n if (!this.label && !this.hasSlottedLabel) {\n log.error('[A11y] Missing ARIA label on input', this);\n }\n }\n\n /**\n * Sets focus on the input. Use this method instead of `input.focus()`.\n *\n * @param options An optional object providing options to control aspects of\n * the focusing process.\n */\n @Method()\n async setFocus(options?: FocusOptions): Promise<void> {\n this.input.focus(options);\n }\n\n /**\n * Clear the input.\n */\n @Method()\n async clear(): Promise<void> {\n this.value = '';\n }\n\n render() {\n return (\n <Host>\n {(this.hasSlottedLabel || this.label) && (\n <label htmlFor={this.id} class={{ hidden: this.labelHidden }}>\n <span part=\"label\">\n {(this.hasSlottedLabel && <slot name=\"label\"></slot>) || this.label}\n {!this.required && (\n <span class=\"input-optional\" aria-hidden=\"true\">\n ({this.i18n.t('input.optional')})\n </span>\n )}\n </span>\n </label>\n )}\n <div\n class={{\n 'input-wrapper': true,\n 'input-round': this.round,\n 'input-disabled': this.disabled\n }}\n onClick={() => this.input.focus()}\n >\n {this.textPrefix && (\n <span class=\"text-prefix\" part=\"prefix\">\n {this.textPrefix}\n </span>\n )}\n {this.icon && !this.iconRight && <cat-icon icon={this.icon} class=\"icon-prefix\" size=\"l\"></cat-icon>}\n <div class=\"input-inner-wrapper\">\n <input\n ref={el => (this.input = el as HTMLInputElement)}\n id={this.id}\n class={{\n 'has-clearable': this.clearable && !this.disabled\n }}\n autocomplete={this.autoComplete}\n disabled={this.disabled}\n max={this.max}\n maxlength={this.maxLength}\n min={this.max}\n minlength={this.minLength}\n name={this.name}\n placeholder={this.placeholder}\n readonly={this.readonly}\n required={this.required}\n type={this.type}\n value={this.value}\n onInput={this.onInput.bind(this)}\n onFocus={this.onFocus.bind(this)}\n onBlur={this.onBlur.bind(this)}\n ></input>\n {this.clearable && !this.disabled && this.value && (\n <cat-button\n class=\"clearable\"\n icon=\"cross-circle-outlined\"\n icon-only=\"true\"\n size=\"s\"\n variant=\"text\"\n a11y-label={this.i18n.t('input.clear')}\n onClick={this.clear.bind(this)}\n ></cat-button>\n )}\n </div>\n {this.icon && this.iconRight && <cat-icon icon={this.icon} class=\"icon-suffix\" size=\"l\"></cat-icon>}\n {this.textSuffix && (\n <span class=\"text-suffix\" part=\"suffix\">\n {this.textSuffix}\n </span>\n )}\n </div>\n {this.hintSection}\n </Host>\n );\n }\n\n private get hintSection() {\n const hasSlottedHint = !!this.hostElement.querySelector('[slot=\"hint\"]');\n return (\n (this.hint || hasSlottedHint) && (\n <CatFormHint hint={this.hint} slottedHint={hasSlottedHint && <slot name=\"hint\"></slot>} />\n )\n );\n }\n\n private onInput(event: Event) {\n this.value = this.input.value;\n this.catChange.emit(event);\n }\n\n private onFocus(event: FocusEvent) {\n this.catFocus.emit(event);\n }\n\n private onBlur(event: FocusEvent) {\n this.catBlur.emit(event);\n }\n}\n"]}
1
+ {"version":3,"file":"cat-input.js","sourceRoot":"","sources":["../../../src/components/cat-input/cat-input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtG,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAGhE,IAAI,YAAY,GAAG,CAAC,CAAC;AAErB;;;;;;;;;;GAUG;AAMH,MAAM,OAAO,QAAQ;EALrB;IAMmB,SAAI,GAAG,eAAe,CAAC,WAAW,EAAE,CAAC;IACrC,OAAE,GAAG,aAAa,YAAY,EAAE,EAAE,CAAC;IAK3C,oBAAe,GAAG,KAAK,CAAC;IAOjC;;OAEG;IACK,cAAS,GAAG,KAAK,CAAC;IAE1B;;OAEG;IACK,aAAQ,GAAG,KAAK,CAAC;IAYzB;;OAEG;IACK,cAAS,GAAG,KAAK,CAAC;IAE1B;;OAEG;IACK,UAAK,GAAG,EAAE,CAAC;IAEnB;;OAEG;IACK,gBAAW,GAAG,KAAK,CAAC;IAsB5B;;OAEG;IACK,SAAI,GAAG,EAAE,CAAC;IAiBlB;;OAEG;IACK,aAAQ,GAAG,KAAK,CAAC;IAEzB;;OAEG;IACK,aAAQ,GAAG,KAAK,CAAC;IAEzB;;OAEG;IACK,UAAK,GAAG,KAAK,CAAC;IAEtB;;OAEG;IACK,SAAI,GAAc,MAAM,CAAC;GAiJlC;EA3HC,mBAAmB;IACjB,IAAI,CAAC,eAAe,GAAG,C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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Host, Method, Prop, State } from '@stencil/core';\nimport log from 'loglevel';\nimport { CatFormHint } from '../cat-form-hint/cat-form-hint';\nimport { CatI18nRegistry } from '../cat-i18n/cat-i18n-registry';\nimport { InputType } from './input-type';\n\nlet nextUniqueId = 0;\n\n/**\n * Inputs are used to allow users to provide text input when the expected input\n * is short. As well as plain text, Input supports various types of text,\n * including passwords and numbers.\n *\n * @slot hint - Optional hint element to be displayed with the input.\n * @slot label - The slotted label. If both the label property and the label slot are present, only the label slot will be displayed.\n * @part label - The label content.\n * @part prefix - The text prefix.\n * @part suffix - The text suffix.\n */\n@Component({\n tag: 'cat-input',\n styleUrl: 'cat-input.scss',\n shadow: true\n})\nexport class CatInput {\n private readonly i18n = CatI18nRegistry.getInstance();\n private readonly id = `cat-input-${nextUniqueId++}`;\n private input!: HTMLInputElement;\n\n @Element() hostElement!: HTMLElement;\n\n @State() hasSlottedLabel = false;\n\n /**\n * Hint for form autofill feature.\n */\n @Prop() autoComplete?: string;\n\n /**\n * Whether the input should show a clear button.\n */\n @Prop() clearable = false;\n\n /**\n * Whether the input is disabled.\n */\n @Prop() disabled = false;\n\n /**\n * Optional hint text(s) to be displayed with the input.\n */\n @Prop() hint?: string | string[];\n\n /**\n * The name of an icon to be displayed in the input.\n */\n @Prop() icon?: string;\n\n /**\n * Display the icon on the right.\n */\n @Prop() iconRight = false;\n\n /**\n * The label for the input.\n */\n @Prop() label = '';\n\n /**\n * Visually hide the label, but still show it to assistive technologies like screen readers.\n */\n @Prop() labelHidden = false;\n\n /**\n * A maximum value for date, time and numeric values.\n */\n @Prop() max?: number | string;\n\n /**\n * A maximum length (number of characters) for textual values.\n */\n @Prop() maxLength?: number;\n\n /**\n * A minimum value for date, time and numeric values.\n */\n @Prop() min?: number | string;\n\n /**\n * A minimum length (number of characters) for textual values.\n */\n @Prop() minLength?: number;\n\n /**\n * The name of the form control. Submitted with the form as part of a name/value pair.\n */\n @Prop() name = '';\n\n /**\n * The placeholder text to display within the input.\n */\n @Prop() placeholder?: string;\n\n /**\n * A textual prefix to be displayed in the input.\n */\n @Prop() textPrefix?: string;\n\n /**\n * A textual suffix to be displayed in the input.\n */\n @Prop() textSuffix?: string;\n\n /**\n * The value is not editable.\n */\n @Prop() readonly = false;\n\n /**\n * A value is required or must be check for the form to be submittable.\n */\n @Prop() required = false;\n\n /**\n * Use round input edges.\n */\n @Prop() round = false;\n\n /**\n * Type of form control.\n */\n @Prop() type: InputType = 'text';\n\n /**\n * The value of the control.\n */\n @Prop({ mutable: true }) value?: string | number;\n\n /**\n * Emitted when the value is changed.\n */\n @Event() catChange!: EventEmitter;\n\n /**\n * Emitted when the input received focus.\n */\n @Event() catFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the input loses focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n componentWillRender(): void {\n this.hasSlottedLabel = !!this.hostElement.querySelector('[slot=\"label\"]');\n if (!this.label && !this.hasSlottedLabel) {\n log.error('[A11y] Missing ARIA label on input', this);\n }\n }\n\n /**\n * Sets focus on the input. Use this method instead of `input.focus()`.\n *\n * @param options An optional object providing options to control aspects of\n * the focusing process.\n */\n @Method()\n async setFocus(options?: FocusOptions): Promise<void> {\n this.input.focus(options);\n }\n\n /**\n * Clear the input.\n */\n @Method()\n async clear(): Promise<void> {\n this.value = '';\n }\n\n render() {\n return (\n <Host>\n {(this.hasSlottedLabel || this.label) && (\n <label htmlFor={this.id} class={{ hidden: this.labelHidden }}>\n <span part=\"label\">\n {(this.hasSlottedLabel && <slot name=\"label\"></slot>) || this.label}\n {!this.required && (\n <span class=\"input-optional\" aria-hidden=\"true\">\n ({this.i18n.t('input.optional')})\n </span>\n )}\n </span>\n </label>\n )}\n <div\n class={{\n 'input-wrapper': true,\n 'input-round': this.round,\n 'input-disabled': this.disabled\n }}\n onClick={() => this.input.focus()}\n >\n {this.textPrefix && (\n <span class=\"text-prefix\" part=\"prefix\">\n {this.textPrefix}\n </span>\n )}\n {this.icon && !this.iconRight && <cat-icon icon={this.icon} class=\"icon-prefix\" size=\"l\"></cat-icon>}\n <div class=\"input-inner-wrapper\">\n <input\n ref={el => (this.input = el as HTMLInputElement)}\n id={this.id}\n class={{\n 'has-clearable': this.clearable && !this.disabled\n }}\n autocomplete={this.autoComplete}\n disabled={this.disabled}\n max={this.max}\n maxlength={this.maxLength}\n min={this.min}\n minlength={this.minLength}\n name={this.name}\n placeholder={this.placeholder}\n readonly={this.readonly}\n required={this.required}\n type={this.type}\n value={this.value}\n onInput={this.onInput.bind(this)}\n onFocus={this.onFocus.bind(this)}\n onBlur={this.onBlur.bind(this)}\n ></input>\n {this.clearable && !this.disabled && this.value && (\n <cat-button\n class=\"clearable\"\n icon=\"cross-circle-outlined\"\n icon-only=\"true\"\n size=\"s\"\n variant=\"text\"\n a11y-label={this.i18n.t('input.clear')}\n onClick={this.clear.bind(this)}\n ></cat-button>\n )}\n </div>\n {this.icon && this.iconRight && <cat-icon icon={this.icon} class=\"icon-suffix\" size=\"l\"></cat-icon>}\n {this.textSuffix && (\n <span class=\"text-suffix\" part=\"suffix\">\n {this.textSuffix}\n </span>\n )}\n </div>\n {this.hintSection}\n </Host>\n );\n }\n\n private get hintSection() {\n const hasSlottedHint = !!this.hostElement.querySelector('[slot=\"hint\"]');\n return (\n (this.hint || hasSlottedHint) && (\n <CatFormHint hint={this.hint} slottedHint={hasSlottedHint && <slot name=\"hint\"></slot>} />\n )\n );\n }\n\n private onInput(event: Event) {\n this.value = this.input.value;\n this.catChange.emit(event);\n }\n\n private onFocus(event: FocusEvent) {\n this.catFocus.emit(event);\n }\n\n private onBlur(event: FocusEvent) {\n this.catBlur.emit(event);\n }\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=input-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input-type.js","sourceRoot":"","sources":["../../../src/components/cat-input/input-type.ts"],"names":[],"mappings":"","sourcesContent":["export type InputType =\n | 'button'\n | 'color'\n | 'date'\n | 'datetime-local'\n | 'email'\n | 'file'\n | 'month'\n | 'number'\n | 'password'\n | 'range'\n | 'reset'\n | 'search'\n | 'submit'\n | 'tel'\n | 'text'\n | 'time'\n | 'url'\n | 'week';\n"]}
@@ -2,8 +2,10 @@ import Toastify from 'toastify-js';
2
2
  export var TypeIcons;
3
3
  (function (TypeIcons) {
4
4
  TypeIcons["success"] = "check-circle-filled";
5
- TypeIcons["error"] = "sparkle-filled";
6
- TypeIcons["info"] = "sparkle-filled";
5
+ TypeIcons["error"] = "cross-circle-filled";
6
+ TypeIcons["info"] = "danger-filled";
7
+ TypeIcons["primary"] = "star-circle-filled";
8
+ TypeIcons["secondary"] = "info-circle-filled";
7
9
  })(TypeIcons || (TypeIcons = {}));
8
10
  export const ToastPositions = {
9
11
  'top-left': {
@@ -32,16 +34,36 @@ export const ToastPositions = {
32
34
  }
33
35
  };
34
36
  class CatNotificationService {
37
+ error(title, message = ' ', options) {
38
+ const toastOptions = this.extractOptions(title, message, options);
39
+ Toastify(toastOptions).showToast();
40
+ }
41
+ success(title, message = ' ', options) {
42
+ const toastOptions = this.extractOptions(title, message, options);
43
+ Toastify(toastOptions).showToast();
44
+ }
45
+ info(title, message = ' ', options) {
46
+ const toastOptions = this.extractOptions(title, message, options);
47
+ Toastify(toastOptions).showToast();
48
+ }
49
+ primary(title, message = ' ', options) {
50
+ const toastOptions = this.extractOptions(title, message, options);
51
+ Toastify(toastOptions).showToast();
52
+ }
53
+ secondary(title, message = ' ', options) {
54
+ const toastOptions = this.extractOptions(title, message, options);
55
+ Toastify(toastOptions).showToast();
56
+ }
35
57
  toastHTMLTemplate(title, message = ' ', options) {
36
58
  var _a;
37
59
  const template = document.createElement('template');
38
- const typeIcon = (options === null || options === void 0 ? void 0 : options.type) ? TypeIcons[options.type] : TypeIcons.info;
60
+ const typeIcon = (options === null || options === void 0 ? void 0 : options.type) ? TypeIcons[options.type] : TypeIcons.secondary;
39
61
  title = title.trim();
40
62
  message = message.trim();
41
63
  const hasMessage = message && message !== '';
42
64
  const hasMessageClass = hasMessage ? 'has-message' : '';
43
65
  template.innerHTML = `<div class="cat-toastify-wrapper">
44
- <div class="cat-toastify-icon-wrapper ${(_a = options === null || options === void 0 ? void 0 : options.type) !== null && _a !== void 0 ? _a : 'info'}">
66
+ <div class="cat-toastify-icon-wrapper ${(_a = options === null || options === void 0 ? void 0 : options.type) !== null && _a !== void 0 ? _a : 'secondary'}">
45
67
  <cat-icon icon="${typeIcon}"></cat-icon>
46
68
  </div>
47
69
  <div class="cat-toastify-title-wrapper ${hasMessageClass}">
@@ -50,57 +72,34 @@ class CatNotificationService {
50
72
  </div>`;
51
73
  return template.content.firstChild;
52
74
  }
53
- error(title, message = ' ', options) {
54
- const position = this.getPosition(options);
55
- const toastOptions = {
56
- node: (options === null || options === void 0 ? void 0 : options.content) ? options.content : this.toastHTMLTemplate(title, message, options),
57
- duration: CatNotificationService.DURATION,
58
- close: true,
59
- className: 'cat-toastify',
60
- gravity: position.gravity,
61
- position: position.position,
62
- stopOnFocus: true
63
- };
64
- Toastify(toastOptions).showToast();
65
- }
66
- success(title, message = ' ', options) {
67
- const position = this.getPosition(options);
68
- const toastOptions = {
69
- node: (options === null || options === void 0 ? void 0 : options.content) ? options.content : this.toastHTMLTemplate(title, message, options),
70
- duration: CatNotificationService.DURATION,
71
- close: true,
72
- className: 'cat-toastify',
73
- gravity: position.gravity,
74
- position: position.position,
75
- stopOnFocus: true
75
+ getPosition(options) {
76
+ const position = {
77
+ gravity: 'bottom',
78
+ position: 'left'
76
79
  };
77
- Toastify(toastOptions).showToast();
80
+ if ((options === null || options === void 0 ? void 0 : options.position) && ToastPositions[options.position]) {
81
+ position.position = ToastPositions[options.position].position;
82
+ position.gravity = ToastPositions[options.position].gravity;
83
+ }
84
+ return position;
78
85
  }
79
- info(title, message = ' ', options) {
86
+ extractOptions(title, message = ' ', options) {
80
87
  const position = this.getPosition(options);
81
- const toastOptions = {
88
+ return {
82
89
  node: (options === null || options === void 0 ? void 0 : options.content) ? options.content : this.toastHTMLTemplate(title, message, options),
83
90
  duration: CatNotificationService.DURATION,
84
91
  close: true,
85
92
  className: 'cat-toastify',
86
93
  gravity: position.gravity,
87
94
  position: position.position,
88
- stopOnFocus: true
95
+ stopOnFocus: true,
96
+ offset: {
97
+ x: '1.5rem',
98
+ y: '1.5rem'
99
+ }
89
100
  };
90
- Toastify(toastOptions).showToast();
91
- }
92
- getPosition(options) {
93
- const position = {
94
- gravity: 'bottom',
95
- position: 'right'
96
- };
97
- if ((options === null || options === void 0 ? void 0 : options.position) && ToastPositions[options.position]) {
98
- position.position = ToastPositions[options.position].position;
99
- position.gravity = ToastPositions[options.position].gravity;
100
- }
101
- return position;
102
101
  }
103
102
  }
104
- CatNotificationService.DURATION = 8000;
103
+ CatNotificationService.DURATION = 80000;
105
104
  export const NotificationsService = new CatNotificationService();
106
105
  //# sourceMappingURL=cat-notification.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cat-notification.js","sourceRoot":"","sources":["../../../src/components/cat-notification/cat-notification.tsx"],"names":[],"mappings":"AAAA,OAA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AG,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC;KAC7D;IACD,OAAO,QAAQ,CAAC;EAClB,CAAC;;AAxEc,+BAAQ,GAAG,IAAI,CAAC;AA2EjC,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,sBAAsB,EAAE,CAAC","sourcesContent":["import Toastify, { Options } from 'toastify-js';\n\nexport enum TypeIcons {\n 'success' = 'check-circle-filled',\n 'error' = 'sparkle-filled',\n 'info' = 'sparkle-filled'\n}\n\nexport const ToastPositions: { [key: string]: { gravity: 'top' | 'bottom'; position: 'left' | 'center' | 'right' } } = {\n 'top-left': {\n gravity: 'top',\n position: 'left'\n },\n 'top-center': {\n gravity: 'top',\n position: 'center'\n },\n 'top-right': {\n gravity: 'top',\n position: 'right'\n },\n 'bottom-left': {\n gravity: 'bottom',\n position: 'left'\n },\n 'bottom-center': {\n gravity: 'bottom',\n position: 'center'\n },\n 'bottom-right': {\n gravity: 'bottom',\n position: 'right'\n }\n};\n\nexport interface ToastPosition {\n gravity: 'top' | 'bottom';\n position: 'left' | 'center' | 'right';\n}\n\nexport interface ToastOptions {\n /**\n * HTML content of the toast\n */\n content: Node;\n /**\n * Show close button\n */\n close: boolean;\n /**\n * Toast position\n */\n position: 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';\n /**\n * Type of toast\n */\n type: 'success' | 'info' | 'error';\n /**\n * Invoked when the toast is clicked\n */\n onClick: () => void;\n /**\n * Toggle the default behavior of escaping HTML markup\n */\n escapeMarkup: boolean;\n}\n\nclass CatNotificationService {\n private static DURATION = 8000;\n\n toastHTMLTemplate(title: string, message = ' ', options?: Partial<ToastOptions>): HTMLElement {\n const template = document.createElement('template');\n const typeIcon = options?.type ? TypeIcons[options.type] : TypeIcons.info;\n title = title.trim();\n message = message.trim();\n const hasMessage = message && message !== '';\n const hasMessageClass = hasMessage ? 'has-message' : '';\n template.innerHTML = `<div class=\"cat-toastify-wrapper\">\n <div class=\"cat-toastify-icon-wrapper ${options?.type ?? 'info'}\">\n <cat-icon icon=\"${typeIcon}\"></cat-icon>\n </div>\n <div class=\"cat-toastify-title-wrapper ${hasMessageClass}\">\n <div class=\"cat-toastify-title\">${title}</div></div>\n ${hasMessage ? `<div class=\"cat-toastify-message\">${message}</div>` : ''}\n </div>`;\n return template.content.firstChild as HTMLElement;\n }\n\n error(title: string, message = ' ', options?: Partial<ToastOptions>): void {\n const position: ToastPosition = this.getPosition(options);\n const toastOptions: Options = {\n node: options?.content ? options.content : this.toastHTMLTemplate(title, message, options),\n duration: CatNotificationService.DURATION,\n close: true,\n className: 'cat-toastify',\n gravity: position.gravity,\n position: position.position,\n stopOnFocus: true\n };\n Toastify(toastOptions).showToast();\n }\n\n success(title: string, message = ' ', options?: Partial<ToastOptions>): void {\n const position: ToastPosition = this.getPosition(options);\n const toastOptions: Options = {\n node: options?.content ? options.content : this.toastHTMLTemplate(title, message, options),\n duration: CatNotificationService.DURATION,\n close: true,\n className: 'cat-toastify',\n gravity: position.gravity,\n position: position.position,\n stopOnFocus: true\n };\n Toastify(toastOptions).showToast();\n }\n\n info(title: string, message = ' ', options?: Partial<ToastOptions>): void {\n const position: ToastPosition = this.getPosition(options);\n const toastOptions: Options = {\n node: options?.content ? options.content : this.toastHTMLTemplate(title, message, options),\n duration: CatNotificationService.DURATION,\n close: true,\n className: 'cat-toastify',\n gravity: position.gravity,\n position: position.position,\n stopOnFocus: true\n };\n Toastify(toastOptions).showToast();\n }\n\n private getPosition(options?: Partial<ToastOptions>): ToastPosition {\n const position: ToastPosition = {\n gravity: 'bottom',\n position: 'right'\n };\n if (options?.position && ToastPositions[options.position]) {\n position.position = ToastPositions[options.position].position;\n position.gravity = ToastPositions[options.position].gravity;\n }\n return position;\n }\n}\n\nexport const NotificationsService = new CatNotificationService();\n"]}
1
+ {"version":3,"file":"cat-notification.js","sourceRoot":"","sources":["../../../src/components/cat-notification/cat-notification.tsx"],"names":[],"mappings":"AAAA,OAA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ACF,CAAC;EACJ,CAAC;;AAxEc,+BAAQ,GAAG,KAAK,CAAC;AA2ElC,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,sBAAsB,EAAE,CAAC","sourcesContent":["import Toastify, { Options } from 'toastify-js';\n\nexport enum TypeIcons {\n 'success' = 'check-circle-filled',\n 'error' = 'cross-circle-filled',\n 'info' = 'danger-filled',\n 'primary' = 'star-circle-filled',\n 'secondary' = 'info-circle-filled'\n}\n\nexport const ToastPositions: { [key: string]: { gravity: 'top' | 'bottom'; position: 'left' | 'center' | 'right' } } = {\n 'top-left': {\n gravity: 'top',\n position: 'left'\n },\n 'top-center': {\n gravity: 'top',\n position: 'center'\n },\n 'top-right': {\n gravity: 'top',\n position: 'right'\n },\n 'bottom-left': {\n gravity: 'bottom',\n position: 'left'\n },\n 'bottom-center': {\n gravity: 'bottom',\n position: 'center'\n },\n 'bottom-right': {\n gravity: 'bottom',\n position: 'right'\n }\n};\n\nexport interface ToastPosition {\n gravity: 'top' | 'bottom';\n position: 'left' | 'center' | 'right';\n}\n\nexport interface ToastOptions {\n /**\n * HTML content of the toast\n */\n content: Node;\n /**\n * Show close button\n */\n close: boolean;\n /**\n * Toast position\n */\n position: 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';\n /**\n * Type of toast\n */\n type: 'success' | 'info' | 'error' | 'primary' | 'secondary';\n /**\n * Invoked when the toast is clicked\n */\n onClick: () => void;\n /**\n * Toggle the default behavior of escaping HTML markup\n */\n escapeMarkup: boolean;\n}\n\nclass CatNotificationService {\n private static DURATION = 80000;\n\n error(title: string, message = ' ', options?: Partial<ToastOptions>): void {\n const toastOptions: Options = this.extractOptions(title, message, options);\n Toastify(toastOptions).showToast();\n }\n\n success(title: string, message = ' ', options?: Partial<ToastOptions>): void {\n const toastOptions: Options = this.extractOptions(title, message, options);\n Toastify(toastOptions).showToast();\n }\n\n info(title: string, message = ' ', options?: Partial<ToastOptions>): void {\n const toastOptions: Options = this.extractOptions(title, message, options);\n Toastify(toastOptions).showToast();\n }\n\n primary(title: string, message = ' ', options?: Partial<ToastOptions>): void {\n const toastOptions: Options = this.extractOptions(title, message, options);\n Toastify(toastOptions).showToast();\n }\n\n secondary(title: string, message = ' ', options?: Partial<ToastOptions>): void {\n const toastOptions: Options = this.extractOptions(title, message, options);\n Toastify(toastOptions).showToast();\n }\n\n private toastHTMLTemplate(title: string, message = ' ', options?: Partial<ToastOptions>): HTMLElement {\n const template = document.createElement('template');\n const typeIcon = options?.type ? TypeIcons[options.type] : TypeIcons.secondary;\n title = title.trim();\n message = message.trim();\n const hasMessage = message && message !== '';\n const hasMessageClass = hasMessage ? 'has-message' : '';\n template.innerHTML = `<div class=\"cat-toastify-wrapper\">\n <div class=\"cat-toastify-icon-wrapper ${options?.type ?? 'secondary'}\">\n <cat-icon icon=\"${typeIcon}\"></cat-icon>\n </div>\n <div class=\"cat-toastify-title-wrapper ${hasMessageClass}\">\n <div class=\"cat-toastify-title\">${title}</div></div>\n ${hasMessage ? `<div class=\"cat-toastify-message\">${message}</div>` : ''}\n </div>`;\n return template.content.firstChild as HTMLElement;\n }\n\n private getPosition(options?: Partial<ToastOptions>): ToastPosition {\n const position: ToastPosition = {\n gravity: 'bottom',\n position: 'left'\n };\n if (options?.position && ToastPositions[options.position]) {\n position.position = ToastPositions[options.position].position;\n position.gravity = ToastPositions[options.position].gravity;\n }\n return position;\n }\n\n private extractOptions(title: string, message = ' ', options?: Partial<ToastOptions>): Options {\n const position: ToastPosition = this.getPosition(options);\n return {\n node: options?.content ? options.content : this.toastHTMLTemplate(title, message, options),\n duration: CatNotificationService.DURATION,\n close: true,\n className: 'cat-toastify',\n gravity: position.gravity,\n position: position.position,\n stopOnFocus: true,\n offset: {\n x: '1.5rem',\n y: '1.5rem'\n }\n };\n }\n}\n\nexport const NotificationsService = new CatNotificationService();\n"]}
@@ -57,7 +57,7 @@ export class CatTab {
57
57
  "text": "The label of the tab."
58
58
  },
59
59
  "attribute": "label",
60
- "reflect": false,
60
+ "reflect": true,
61
61
  "defaultValue": "''"
62
62
  },
63
63
  "icon": {
@@ -75,7 +75,7 @@ export class CatTab {
75
75
  "text": "The name of an icon to be displayed in the tab."
76
76
  },
77
77
  "attribute": "icon",
78
- "reflect": false
78
+ "reflect": true
79
79
  },
80
80
  "iconOnly": {
81
81
  "type": "any",
@@ -97,7 +97,7 @@ export class CatTab {
97
97
  "text": "Hide the actual button content and only display the tab."
98
98
  },
99
99
  "attribute": "icon-only",
100
- "reflect": false,
100
+ "reflect": true,
101
101
  "defaultValue": "false"
102
102
  },
103
103
  "iconRight": {
@@ -115,7 +115,7 @@ export class CatTab {
115
115
  "text": "Display the icon on the right."
116
116
  },
117
117
  "attribute": "icon-right",
118
- "reflect": false,
118
+ "reflect": true,
119
119
  "defaultValue": "false"
120
120
  },
121
121
  "url": {
@@ -133,7 +133,7 @@ export class CatTab {
133
133
  "text": "A destination to link to, rendered in the href attribute of a link."
134
134
  },
135
135
  "attribute": "url",
136
- "reflect": false
136
+ "reflect": true
137
137
  },
138
138
  "urlTarget": {
139
139
  "type": "string",
@@ -150,7 +150,7 @@ export class CatTab {
150
150
  "text": "Specifies where to open the linked document."
151
151
  },
152
152
  "attribute": "url-target",
153
- "reflect": false
153
+ "reflect": true
154
154
  },
155
155
  "deactivated": {
156
156
  "type": "boolean",
@@ -167,7 +167,7 @@ export class CatTab {
167
167
  "text": "Specifies that the tab should be deactivated."
168
168
  },
169
169
  "attribute": "deactivated",
170
- "reflect": false,
170
+ "reflect": true,
171
171
  "defaultValue": "false"
172
172
  }
173
173
  }; }
@@ -1 +1 @@
1
- {"version":3,"file":"cat-tab.js","sourceRoot":"","sources":["../../../src/components/cat-tab/cat-tab.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAgB,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAG/F,IAAI,YAAY,GAAG,CAAC,CAAC;AAErB;;GAEG;AAMH,MAAM,OAAO,MAAM;EALnB;IAQE;;OAEG;IACK,UAAK,GAAG,EAAE,CAAC;IAOnB;;OAEG;IACK,aAAQ,GAAyB,KAAK,CAAC;IAE/C;;OAEG;IACK,cAAS,GAAG,KAAK,CAAC;IAY1B;;OAEG;IACK,gBAAW,GAAG,KAAK,CAAC;GAqB7B;EAdC,iBAAiB;IACf,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,EAAE;MACxB,IAAI,CAAC,WAAW,CAAC,EAAE,GAAG,WAAW,YAAY,EAAE,EAAE,CAAC;KACnD;EACH,CAAC;EAGD,OAAO,CAAC,KAAiB;IACvB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;EAC5B,CAAC;EAED,MAAM;IACJ,OAAO,EAAC,IAAI,OAAQ,CAAC;EACvB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, Event, EventEmitter, Listen, Host, Element } from '@stencil/core';\nimport { Breakpoint } from '../../utils/breakpoints';\n\nlet nextUniqueId = 0;\n\n/**\n * A single tab inside a tabs component.\n */\n@Component({\n tag: 'cat-tab',\n styleUrl: 'cat-tab.scss',\n shadow: true\n})\nexport class CatTab {\n @Element() hostElement!: HTMLElement;\n\n /**\n * The label of the tab.\n */\n @Prop() label = '';\n\n /**\n * The name of an icon to be displayed in the tab.\n */\n @Prop() icon?: string;\n\n /**\n * Hide the actual button content and only display the tab.\n */\n @Prop() iconOnly: boolean | Breakpoint = false;\n\n /**\n * Display the icon on the right.\n */\n @Prop() iconRight = false;\n\n /**\n * A destination to link to, rendered in the href attribute of a link.\n */\n @Prop() url?: string;\n\n /**\n * Specifies where to open the linked document.\n */\n @Prop() urlTarget?: '_blank' | '_self';\n\n /**\n * Specifies that the tab should be deactivated.\n */\n @Prop() deactivated = false;\n\n /**\n * Emitted when tab is clicked.\n */\n @Event() tabClick!: EventEmitter<MouseEvent>;\n\n connectedCallback() {\n if (!this.hostElement.id) {\n this.hostElement.id = `cat-tab-${nextUniqueId++}`;\n }\n }\n\n @Listen('click')\n onClick(event: MouseEvent) {\n this.tabClick.emit(event);\n }\n\n render() {\n return <Host></Host>;\n }\n}\n"]}
1
+ {"version":3,"file":"cat-tab.js","sourceRoot":"","sources":["../../../src/components/cat-tab/cat-tab.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAgB,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAG/F,IAAI,YAAY,GAAG,CAAC,CAAC;AAErB;;GAEG;AAMH,MAAM,OAAO,MAAM;EALnB;IAQE;;OAEG;IACsB,UAAK,GAAG,EAAE,CAAC;IAOpC;;OAEG;IACsB,aAAQ,GAAyB,KAAK,CAAC;IAEhE;;OAEG;IACsB,cAAS,GAAG,KAAK,CAAC;IAY3C;;OAEG;IACsB,gBAAW,GAAG,KAAK,CAAC;GAqB9C;EAdC,iBAAiB;IACf,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,EAAE;MACxB,IAAI,CAAC,WAAW,CAAC,EAAE,GAAG,WAAW,YAAY,EAAE,EAAE,CAAC;KACnD;EACH,CAAC;EAGD,OAAO,CAAC,KAAiB;IACvB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;EAC5B,CAAC;EAED,MAAM;IACJ,OAAO,EAAC,IAAI,OAAQ,CAAC;EACvB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Prop, Event, EventEmitter, Listen, Host, Element } from '@stencil/core';\nimport { Breakpoint } from '../../utils/breakpoints';\n\nlet nextUniqueId = 0;\n\n/**\n * A single tab inside a tabs component.\n */\n@Component({\n tag: 'cat-tab',\n styleUrl: 'cat-tab.scss',\n shadow: true\n})\nexport class CatTab {\n @Element() hostElement!: HTMLElement;\n\n /**\n * The label of the tab.\n */\n @Prop({ reflect: true }) label = '';\n\n /**\n * The name of an icon to be displayed in the tab.\n */\n @Prop({ reflect: true }) icon?: string;\n\n /**\n * Hide the actual button content and only display the tab.\n */\n @Prop({ reflect: true }) iconOnly: boolean | Breakpoint = false;\n\n /**\n * Display the icon on the right.\n */\n @Prop({ reflect: true }) iconRight = false;\n\n /**\n * A destination to link to, rendered in the href attribute of a link.\n */\n @Prop({ reflect: true }) url?: string;\n\n /**\n * Specifies where to open the linked document.\n */\n @Prop({ reflect: true }) urlTarget?: '_blank' | '_self';\n\n /**\n * Specifies that the tab should be deactivated.\n */\n @Prop({ reflect: true }) deactivated = false;\n\n /**\n * Emitted when tab is clicked.\n */\n @Event() tabClick!: EventEmitter<MouseEvent>;\n\n connectedCallback() {\n if (!this.hostElement.id) {\n this.hostElement.id = `cat-tab-${nextUniqueId++}`;\n }\n }\n\n @Listen('click')\n onClick(event: MouseEvent) {\n this.tabClick.emit(event);\n }\n\n render() {\n return <Host></Host>;\n }\n}\n"]}