@haiilo/catalyst 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) 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-23d54bc6.js +2 -0
  6. package/dist/catalyst/p-23d54bc6.js.map +1 -0
  7. package/dist/catalyst/p-84693f87.entry.js +24 -0
  8. package/dist/catalyst/p-84693f87.entry.js.map +1 -0
  9. package/dist/catalyst/p-8f5cfa78.js +2 -0
  10. package/dist/catalyst/p-8f5cfa78.js.map +1 -0
  11. package/dist/catalyst/{p-ed826597.js → p-fa7da4c6.js} +2 -2
  12. package/dist/catalyst/p-fa7da4c6.js.map +1 -0
  13. package/dist/cjs/{app-globals-7f2b1f8e.js → app-globals-50e7504d.js} +9 -2
  14. package/dist/cjs/app-globals-50e7504d.js.map +1 -0
  15. package/dist/cjs/{cat-alert_9.cjs.entry.js → cat-alert_15.cjs.entry.js} +449 -354
  16. package/dist/cjs/cat-alert_15.cjs.entry.js.map +1 -0
  17. package/dist/cjs/cat-icon-registry-6895750f.js +441 -0
  18. package/dist/cjs/cat-icon-registry-6895750f.js.map +1 -0
  19. package/dist/cjs/catalyst.cjs.js +4 -4
  20. package/dist/cjs/{index-c0881ae0.js → index-2db8e23d.js} +1 -2
  21. package/dist/cjs/index-2db8e23d.js.map +1 -0
  22. package/dist/cjs/index.cjs.js +2 -1
  23. package/dist/cjs/index.cjs.js.map +1 -1
  24. package/dist/cjs/loader.cjs.js +4 -4
  25. package/dist/collection/collection-manifest.json +6 -0
  26. package/dist/collection/components/cat-alert/cat-alert.css +11 -6
  27. package/dist/collection/components/cat-alert/cat-alert.js +19 -8
  28. package/dist/collection/components/cat-alert/cat-alert.js.map +1 -1
  29. package/dist/collection/components/cat-badge/cat-badge.css +17 -17
  30. package/dist/collection/components/cat-badge/cat-badge.js +9 -8
  31. package/dist/collection/components/cat-badge/cat-badge.js.map +1 -1
  32. package/dist/collection/components/cat-button/cat-button.css +18 -8
  33. package/dist/collection/components/cat-button/cat-button.js +32 -8
  34. package/dist/collection/components/cat-button/cat-button.js.map +1 -1
  35. package/dist/collection/components/cat-card/cat-card.css +25 -0
  36. package/dist/collection/components/cat-card/cat-card.js +20 -0
  37. package/dist/collection/components/cat-card/cat-card.js.map +1 -0
  38. package/dist/collection/components/cat-checkbox/cat-checkbox.css +105 -0
  39. package/dist/collection/components/cat-checkbox/cat-checkbox.js +314 -0
  40. package/dist/collection/components/cat-checkbox/cat-checkbox.js.map +1 -0
  41. package/dist/collection/components/cat-i18n/cat-i18n-registry.js +69 -0
  42. package/dist/collection/components/cat-i18n/cat-i18n-registry.js.map +1 -0
  43. package/dist/collection/components/cat-icon/cat-icon-registry.js +14 -1
  44. package/dist/collection/components/cat-icon/cat-icon-registry.js.map +1 -1
  45. package/dist/collection/components/cat-icon/cat-icon.css +5 -5
  46. package/dist/collection/components/cat-icon/cat-icon.js +3 -2
  47. package/dist/collection/components/cat-icon/cat-icon.js.map +1 -1
  48. package/dist/collection/components/cat-input/cat-input.css +131 -0
  49. package/dist/collection/components/cat-input/cat-input.js +606 -0
  50. package/dist/collection/components/cat-input/cat-input.js.map +1 -0
  51. package/dist/collection/components/cat-menu/cat-menu.css +2 -1
  52. package/dist/collection/components/cat-radio/cat-radio.css +84 -0
  53. package/dist/collection/components/cat-radio/cat-radio.js +283 -0
  54. package/dist/collection/components/cat-radio/cat-radio.js.map +1 -0
  55. package/dist/collection/components/cat-scrollable/cat-scrollable.js +4 -2
  56. package/dist/collection/components/cat-scrollable/cat-scrollable.js.map +1 -1
  57. package/dist/collection/components/cat-skeleton/cat-skeleton.css +30 -30
  58. package/dist/collection/components/cat-skeleton/cat-skeleton.js +4 -4
  59. package/dist/collection/components/cat-skeleton/cat-skeleton.js.map +1 -1
  60. package/dist/collection/components/cat-spinner/cat-spinner.css +7 -7
  61. package/dist/collection/components/cat-spinner/cat-spinner.js +1 -1
  62. package/dist/collection/components/cat-spinner/cat-spinner.js.map +1 -1
  63. package/dist/collection/components/cat-textarea/cat-textarea.css +74 -0
  64. package/dist/collection/components/cat-textarea/cat-textarea.js +393 -0
  65. package/dist/collection/components/cat-textarea/cat-textarea.js.map +1 -0
  66. package/dist/collection/components/cat-toggle/cat-toggle.css +93 -0
  67. package/dist/collection/components/cat-toggle/cat-toggle.js +283 -0
  68. package/dist/collection/components/cat-toggle/cat-toggle.js.map +1 -0
  69. package/dist/collection/components/cat-tooltip/cat-tooltip.css +9 -5
  70. package/dist/collection/components/cat-tooltip/cat-tooltip.js +2 -2
  71. package/dist/collection/components/cat-tooltip/cat-tooltip.js.map +1 -1
  72. package/dist/collection/index.js +1 -0
  73. package/dist/collection/index.js.map +1 -1
  74. package/dist/collection/init.js +9 -1
  75. package/dist/collection/init.js.map +1 -1
  76. package/dist/components/cat-alert.js +15 -6
  77. package/dist/components/cat-alert.js.map +1 -1
  78. package/dist/components/cat-badge.js +7 -7
  79. package/dist/components/cat-badge.js.map +1 -1
  80. package/dist/components/cat-button.js +1 -647
  81. package/dist/components/cat-button.js.map +1 -1
  82. package/dist/components/cat-button2.js +346 -0
  83. package/dist/components/cat-button2.js.map +1 -0
  84. package/dist/components/cat-card.d.ts +11 -0
  85. package/dist/components/cat-card.js +35 -0
  86. package/dist/components/cat-card.js.map +1 -0
  87. package/dist/components/cat-checkbox.d.ts +11 -0
  88. package/dist/components/cat-checkbox.js +103 -0
  89. package/dist/components/cat-checkbox.js.map +1 -0
  90. package/dist/components/cat-i18n-registry.js +73 -0
  91. package/dist/components/cat-i18n-registry.js.map +1 -0
  92. package/dist/components/cat-icon-registry.js +15 -1
  93. package/dist/components/cat-icon-registry.js.map +1 -1
  94. package/dist/components/cat-icon2.js +3 -2
  95. package/dist/components/cat-icon2.js.map +1 -1
  96. package/dist/components/cat-input.d.ts +11 -0
  97. package/dist/components/cat-input.js +172 -0
  98. package/dist/components/cat-input.js.map +1 -0
  99. package/dist/components/cat-menu.js +1 -1
  100. package/dist/components/cat-menu.js.map +1 -1
  101. package/dist/components/cat-radio.d.ts +11 -0
  102. package/dist/components/cat-radio.js +93 -0
  103. package/dist/components/cat-radio.js.map +1 -0
  104. package/dist/components/cat-scrollable.js +1 -2
  105. package/dist/components/cat-scrollable.js.map +1 -1
  106. package/dist/components/cat-skeleton.js +5 -5
  107. package/dist/components/cat-skeleton.js.map +1 -1
  108. package/dist/components/cat-spinner2.js +2 -2
  109. package/dist/components/cat-spinner2.js.map +1 -1
  110. package/dist/components/cat-textarea.d.ts +11 -0
  111. package/dist/components/cat-textarea.js +119 -0
  112. package/dist/components/cat-textarea.js.map +1 -0
  113. package/dist/components/cat-toggle.d.ts +11 -0
  114. package/dist/components/cat-toggle.js +93 -0
  115. package/dist/components/cat-toggle.js.map +1 -0
  116. package/dist/components/cat-tooltip.js +2 -2
  117. package/dist/components/cat-tooltip.js.map +1 -1
  118. package/dist/components/first-tabbable.js +5 -4
  119. package/dist/components/first-tabbable.js.map +1 -1
  120. package/dist/components/index.js +9 -0
  121. package/dist/components/index.js.map +1 -1
  122. package/dist/components/loglevel.js +315 -0
  123. package/dist/components/loglevel.js.map +1 -0
  124. package/dist/esm/{app-globals-8af9b2cf.js → app-globals-6906ac5c.js} +9 -2
  125. package/dist/esm/app-globals-6906ac5c.js.map +1 -0
  126. package/dist/esm/{cat-alert_9.entry.js → cat-alert_15.entry.js} +442 -353
  127. package/dist/esm/cat-alert_15.entry.js.map +1 -0
  128. package/dist/esm/cat-icon-registry-77963c26.js +437 -0
  129. package/dist/esm/cat-icon-registry-77963c26.js.map +1 -0
  130. package/dist/esm/catalyst.js +4 -4
  131. package/dist/esm/{index-0ff35bca.js → index-1f3ca03b.js} +2 -2
  132. package/dist/esm/index-1f3ca03b.js.map +1 -0
  133. package/dist/esm/index.js +1 -1
  134. package/dist/esm/loader.js +4 -4
  135. package/dist/types/components/cat-alert/cat-alert.d.ts +4 -2
  136. package/dist/types/components/cat-badge/cat-badge.d.ts +3 -2
  137. package/dist/types/components/cat-button/cat-button.d.ts +8 -3
  138. package/dist/types/components/cat-card/cat-card.d.ts +7 -0
  139. package/dist/types/components/cat-checkbox/cat-checkbox.d.ts +69 -0
  140. package/dist/types/components/cat-i18n/cat-i18n-registry.d.ts +18 -0
  141. package/dist/types/components/cat-icon/cat-icon-registry.d.ts +4 -4
  142. package/dist/types/components/cat-icon/cat-icon.d.ts +1 -1
  143. package/dist/types/components/cat-input/cat-input.d.ts +130 -0
  144. package/dist/types/components/cat-radio/cat-radio.d.ts +63 -0
  145. package/dist/types/components/cat-scrollable/cat-scrollable.d.ts +3 -1
  146. package/dist/types/components/cat-textarea/cat-textarea.d.ts +85 -0
  147. package/dist/types/components/cat-toggle/cat-toggle.d.ts +64 -0
  148. package/dist/types/components.d.ts +619 -4
  149. package/dist/types/index.d.ts +1 -0
  150. package/package.json +5 -3
  151. package/dist/catalyst/p-89a97b7b.entry.js +0 -10
  152. package/dist/catalyst/p-89a97b7b.entry.js.map +0 -1
  153. package/dist/catalyst/p-ed826597.js.map +0 -1
  154. package/dist/catalyst/p-ef0a8ae9.js +0 -2
  155. package/dist/catalyst/p-ef0a8ae9.js.map +0 -1
  156. package/dist/catalyst/p-f151cb13.js +0 -2
  157. package/dist/catalyst/p-f151cb13.js.map +0 -1
  158. package/dist/cjs/app-globals-7f2b1f8e.js.map +0 -1
  159. package/dist/cjs/cat-alert_9.cjs.entry.js.map +0 -1
  160. package/dist/cjs/cat-icon-registry-850c538c.js +0 -47
  161. package/dist/cjs/cat-icon-registry-850c538c.js.map +0 -1
  162. package/dist/cjs/index-c0881ae0.js.map +0 -1
  163. package/dist/collection/utils/utils.js +0 -4
  164. package/dist/collection/utils/utils.js.map +0 -1
  165. package/dist/esm/app-globals-8af9b2cf.js.map +0 -1
  166. package/dist/esm/cat-alert_9.entry.js.map +0 -1
  167. package/dist/esm/cat-icon-registry-59da2e37.js +0 -45
  168. package/dist/esm/cat-icon-registry-59da2e37.js.map +0 -1
  169. package/dist/esm/index-0ff35bca.js.map +0 -1
  170. package/dist/types/utils/utils.d.ts +0 -1
@@ -0,0 +1,283 @@
1
+ import { Component, Event, h, Prop, Method } from '@stencil/core';
2
+ import log from 'loglevel';
3
+ let nextUniqueId = 0;
4
+ /**
5
+ * Toggles are graphical interface switches that give user control over a
6
+ * feature or option that can be turned on or off.
7
+ *
8
+ * @part toggle - The toggle element.
9
+ * @part label - The label content.
10
+ */
11
+ export class CatToggle {
12
+ constructor() {
13
+ this.id = `cat-toggle-${nextUniqueId++}`;
14
+ /**
15
+ * Checked state of the toggle.
16
+ */
17
+ this.checked = false;
18
+ /**
19
+ * Disabled state of the toggle.
20
+ */
21
+ this.disabled = false;
22
+ /**
23
+ * The label of the toggle that is visible.
24
+ */
25
+ this.label = '';
26
+ /**
27
+ * Visually hide the label, but still show it to assistive technologies like screen readers.
28
+ */
29
+ this.labelHidden = false;
30
+ /**
31
+ * Required state of the toggle
32
+ */
33
+ this.required = false;
34
+ }
35
+ componentWillRender() {
36
+ if (!this.label) {
37
+ log.error('[A11y] Missing ARIA label on toggle', this);
38
+ }
39
+ }
40
+ /**
41
+ * Sets focus on the toggle. Use this method instead of `toggle.focus()`.
42
+ *
43
+ * @param options An optional object providing options to control aspects of
44
+ * the focusing process.
45
+ */
46
+ async setFocus(options) {
47
+ this.input.focus(options);
48
+ }
49
+ render() {
50
+ return (h("label", { htmlFor: this.id, class: { 'is-hidden': this.labelHidden, 'is-disabled': this.disabled } },
51
+ 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) }),
52
+ h("span", { class: "toggle", part: "toggle" }),
53
+ h("span", { class: "label", part: "label" }, this.label)));
54
+ }
55
+ onInput(event) {
56
+ this.catChange.emit(event);
57
+ }
58
+ onFocus(event) {
59
+ this.catFocus.emit(event);
60
+ }
61
+ onBlur(event) {
62
+ this.catBlur.emit(event);
63
+ }
64
+ static get is() { return "cat-toggle"; }
65
+ static get encapsulation() { return "shadow"; }
66
+ static get originalStyleUrls() { return {
67
+ "$": ["cat-toggle.scss"]
68
+ }; }
69
+ static get styleUrls() { return {
70
+ "$": ["cat-toggle.css"]
71
+ }; }
72
+ static get properties() { return {
73
+ "checked": {
74
+ "type": "boolean",
75
+ "mutable": false,
76
+ "complexType": {
77
+ "original": "boolean",
78
+ "resolved": "boolean",
79
+ "references": {}
80
+ },
81
+ "required": false,
82
+ "optional": false,
83
+ "docs": {
84
+ "tags": [],
85
+ "text": "Checked state of the toggle."
86
+ },
87
+ "attribute": "checked",
88
+ "reflect": false,
89
+ "defaultValue": "false"
90
+ },
91
+ "disabled": {
92
+ "type": "boolean",
93
+ "mutable": false,
94
+ "complexType": {
95
+ "original": "boolean",
96
+ "resolved": "boolean",
97
+ "references": {}
98
+ },
99
+ "required": false,
100
+ "optional": false,
101
+ "docs": {
102
+ "tags": [],
103
+ "text": "Disabled state of the toggle."
104
+ },
105
+ "attribute": "disabled",
106
+ "reflect": false,
107
+ "defaultValue": "false"
108
+ },
109
+ "label": {
110
+ "type": "string",
111
+ "mutable": false,
112
+ "complexType": {
113
+ "original": "string",
114
+ "resolved": "string",
115
+ "references": {}
116
+ },
117
+ "required": false,
118
+ "optional": false,
119
+ "docs": {
120
+ "tags": [],
121
+ "text": "The label of the toggle that is visible."
122
+ },
123
+ "attribute": "label",
124
+ "reflect": false,
125
+ "defaultValue": "''"
126
+ },
127
+ "labelHidden": {
128
+ "type": "boolean",
129
+ "mutable": false,
130
+ "complexType": {
131
+ "original": "boolean",
132
+ "resolved": "boolean",
133
+ "references": {}
134
+ },
135
+ "required": false,
136
+ "optional": false,
137
+ "docs": {
138
+ "tags": [],
139
+ "text": "Visually hide the label, but still show it to assistive technologies like screen readers."
140
+ },
141
+ "attribute": "label-hidden",
142
+ "reflect": false,
143
+ "defaultValue": "false"
144
+ },
145
+ "name": {
146
+ "type": "string",
147
+ "mutable": false,
148
+ "complexType": {
149
+ "original": "string",
150
+ "resolved": "string | undefined",
151
+ "references": {}
152
+ },
153
+ "required": false,
154
+ "optional": true,
155
+ "docs": {
156
+ "tags": [],
157
+ "text": "The name of the input"
158
+ },
159
+ "attribute": "name",
160
+ "reflect": false
161
+ },
162
+ "required": {
163
+ "type": "boolean",
164
+ "mutable": false,
165
+ "complexType": {
166
+ "original": "boolean",
167
+ "resolved": "boolean",
168
+ "references": {}
169
+ },
170
+ "required": false,
171
+ "optional": false,
172
+ "docs": {
173
+ "tags": [],
174
+ "text": "Required state of the toggle"
175
+ },
176
+ "attribute": "required",
177
+ "reflect": false,
178
+ "defaultValue": "false"
179
+ },
180
+ "value": {
181
+ "type": "string",
182
+ "mutable": false,
183
+ "complexType": {
184
+ "original": "string",
185
+ "resolved": "string | undefined",
186
+ "references": {}
187
+ },
188
+ "required": false,
189
+ "optional": true,
190
+ "docs": {
191
+ "tags": [],
192
+ "text": "The value of the toggle"
193
+ },
194
+ "attribute": "value",
195
+ "reflect": false
196
+ }
197
+ }; }
198
+ static get events() { return [{
199
+ "method": "catChange",
200
+ "name": "catChange",
201
+ "bubbles": true,
202
+ "cancelable": true,
203
+ "composed": true,
204
+ "docs": {
205
+ "tags": [],
206
+ "text": "Emitted when the checked status of the toggle is changed."
207
+ },
208
+ "complexType": {
209
+ "original": "any",
210
+ "resolved": "any",
211
+ "references": {}
212
+ }
213
+ }, {
214
+ "method": "catFocus",
215
+ "name": "catFocus",
216
+ "bubbles": true,
217
+ "cancelable": true,
218
+ "composed": true,
219
+ "docs": {
220
+ "tags": [],
221
+ "text": "Emitted when the toggle received focus."
222
+ },
223
+ "complexType": {
224
+ "original": "FocusEvent",
225
+ "resolved": "FocusEvent",
226
+ "references": {
227
+ "FocusEvent": {
228
+ "location": "global"
229
+ }
230
+ }
231
+ }
232
+ }, {
233
+ "method": "catBlur",
234
+ "name": "catBlur",
235
+ "bubbles": true,
236
+ "cancelable": true,
237
+ "composed": true,
238
+ "docs": {
239
+ "tags": [],
240
+ "text": "Emitted when the toggle loses focus."
241
+ },
242
+ "complexType": {
243
+ "original": "FocusEvent",
244
+ "resolved": "FocusEvent",
245
+ "references": {
246
+ "FocusEvent": {
247
+ "location": "global"
248
+ }
249
+ }
250
+ }
251
+ }]; }
252
+ static get methods() { return {
253
+ "setFocus": {
254
+ "complexType": {
255
+ "signature": "(options?: FocusOptions | undefined) => Promise<void>",
256
+ "parameters": [{
257
+ "tags": [{
258
+ "name": "param",
259
+ "text": "options An optional object providing options to control aspects of\nthe focusing process."
260
+ }],
261
+ "text": "An optional object providing options to control aspects of\nthe focusing process."
262
+ }],
263
+ "references": {
264
+ "Promise": {
265
+ "location": "global"
266
+ },
267
+ "FocusOptions": {
268
+ "location": "global"
269
+ }
270
+ },
271
+ "return": "Promise<void>"
272
+ },
273
+ "docs": {
274
+ "text": "Sets focus on the toggle. Use this method instead of `toggle.focus()`.",
275
+ "tags": [{
276
+ "name": "param",
277
+ "text": "options An optional object providing options to control aspects of\nthe focusing process."
278
+ }]
279
+ }
280
+ }
281
+ }; }
282
+ }
283
+ //# sourceMappingURL=cat-toggle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cat-toggle.js","sourceRoot":"","sources":["../../../src/components/cat-toggle/cat-toggle.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,GAAG,MAAM,UAAU,CAAC;AAE3B,IAAI,YAAY,GAAG,CAAC,CAAC;AAErB;;;;;;GAMG;AAMH,MAAM,OAAO,SAAS;EALtB;IAMmB,OAAE,GAAG,cAAc,YAAY,EAAE,EAAE,CAAC;IAGrD;;OAEG;IACK,YAAO,GAAG,KAAK,CAAC;I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,IAAI,EAAC,QAAQ,GAAQ;MAC1C,YAAM,KAAK,EAAC,OAAO,EAAC,IAAI,EAAC,OAAO,IAC7B,IAAI,CAAC,KAAK,CACN,CACD,CACT,CAAC;EACJ,CAAC;EAEO,OAAO,CAAC,KAAY;IAC1B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;EAC7B,CAAC;EAEO,OAAO,CAAC,KAAiB;IAC/B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;EAC5B,CAAC;EAEO,MAAM,CAAC,KAAiB;IAC9B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;EAC3B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Event, EventEmitter, h, Prop, Method } from '@stencil/core';\nimport log from 'loglevel';\n\nlet nextUniqueId = 0;\n\n/**\n * Toggles are graphical interface switches that give user control over a\n * feature or option that can be turned on or off.\n *\n * @part toggle - The toggle element.\n * @part label - The label content.\n */\n@Component({\n tag: 'cat-toggle',\n styleUrls: ['cat-toggle.scss'],\n shadow: true\n})\nexport class CatToggle {\n private readonly id = `cat-toggle-${nextUniqueId++}`;\n private input!: HTMLInputElement;\n\n /**\n * Checked state of the toggle.\n */\n @Prop() checked = false;\n\n /**\n * Disabled state of the toggle.\n */\n @Prop() disabled = false;\n\n /**\n * The label of the toggle that is visible.\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 toggle\n */\n @Prop() required = false;\n\n /**\n * The value of the toggle\n */\n @Prop() value?: string;\n\n /**\n * Emitted when the checked status of the toggle is changed.\n */\n @Event() catChange!: EventEmitter;\n\n /**\n * Emitted when the toggle received focus.\n */\n @Event() catFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the toggle loses focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n componentWillRender(): void {\n if (!this.label) {\n log.error('[A11y] Missing ARIA label on toggle', this);\n }\n }\n\n /**\n * Sets focus on the toggle. Use this method instead of `toggle.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 <label htmlFor={this.id} class={{ 'is-hidden': this.labelHidden, 'is-disabled': this.disabled }}>\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 class=\"form-check-input\"\n role=\"switch\"\n onInput={this.onInput.bind(this)}\n onFocus={this.onFocus.bind(this)}\n onBlur={this.onBlur.bind(this)}\n />\n <span class=\"toggle\" part=\"toggle\"></span>\n <span class=\"label\" part=\"label\">\n {this.label}\n </span>\n </label>\n );\n }\n\n private onInput(event: Event) {\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"]}
@@ -15,14 +15,18 @@
15
15
  position: absolute;
16
16
  font-size: 0.875rem;
17
17
  line-height: 1rem;
18
- padding: 0.25rem;
19
- background-color: rgba(0, 0, 0, 0.7);
20
- border-radius: 0.125rem;
21
- color: white;
18
+ font-weight: 500;
19
+ padding: 0.5rem 0.75rem;
20
+ background-color: white;
21
+ border-radius: 0.25rem;
22
+ color: black;
22
23
  white-space: nowrap;
23
- transition: 0.13s linear;
24
+ transition: all 0.25s linear 0s;
24
25
  visibility: hidden;
25
26
  opacity: 0;
27
+ box-shadow: rgba(0, 0, 0, 0.08) 0 1px 8px 0;
28
+ border: 1px solid #ebecf0;
29
+ z-index: 200;
26
30
  }
27
31
  .tooltip-show {
28
32
  opacity: 1;
@@ -22,7 +22,7 @@ export class CatTooltip {
22
22
  /**
23
23
  * The delay time for showing tooltip in ms.
24
24
  */
25
- this.showDelay = 1000;
25
+ this.showDelay = 500;
26
26
  /**
27
27
  * The delay time for hiding tooltip in ms.
28
28
  */
@@ -203,7 +203,7 @@ export class CatTooltip {
203
203
  },
204
204
  "attribute": "show-delay",
205
205
  "reflect": false,
206
- "defaultValue": "1000"
206
+ "defaultValue": "500"
207
207
  },
208
208
  "hideDelay": {
209
209
  "type": "number",
@@ -1 +1 @@
1
- {"version":3,"file":"cat-tooltip.js","sourceRoot":"","sources":["../../../src/components/cat-tooltip/cat-tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,EAAa,MAAM,kBAAkB,CAAC;AACxF,OAAO,aAAa,MAAM,6BAA6B,CAAC;AACxD,OAAO,aAAa,MAAM,4BAA4B,CAAC;AAGvD,IAAI,YAAY,GAAG,CAAC,CAAC;AAOrB,MAAM,OAAO,UAAU;EALvB;IAOmB,OAAE,GAAG,eAAe,YAAY,EAAE,EAAE,CAAC;IAQtD;;OAEG;IACK,YAAO,GAAG,EAAE,CAAC;IAErB;;;OAGG;IACK,aAAQ,GAAG,KAAK,CAAC;IAEzB;;OAEG;IACK,cAAS,GAAc,KAAK,CAAC;IAErC;;OAEG;IACK,cAAS,GAAG,IAAI,CAAC;IAEzB;;OAEG;IACK,cAAS,GAAG,CAAC,CAAC;IAEtB;;OAEG;IACK,sBAAiB,GAAG,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O,YAAY;IAClB,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACtC,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE;;MACxC,MAAA,IAAI,CAAC,OAAO,0CAAE,IAAI,EAAE,CAAC;MACrB,MAAA,IAAI,CAAC,OAAO,0CAAE,SAAS,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IACjD,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;EACrB,CAAC;EAEO,kBAAkB;IACxB,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE;;MACzC,MAAA,IAAI,CAAC,OAAO,0CAAE,SAAS,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAC9C,CAAC,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;EAC7B,CAAC;EAEO,gBAAgB;;IACtB,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACvC,MAAA,IAAI,CAAC,OAAO,0CAAE,SAAS,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;EACjD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAzIuB,iBAAM,GAAG,CAAE,CAAA","sourcesContent":["import { Component, h, Host, Listen, Prop } from '@stencil/core';\nimport { autoUpdate, computePosition, flip, offset, Placement } from '@floating-ui/dom';\nimport isTouchScreen from '../../utils/is-touch-screen';\nimport firstTabbable from '../../utils/first-tabbable';\nimport { FocusableElement } from 'tabbable';\n\nlet nextUniqueId = 0;\n\n@Component({\n tag: 'cat-tooltip',\n styleUrl: 'cat-tooltip.scss',\n shadow: true\n})\nexport class CatTooltip {\n private static readonly OFFSET = 4;\n private readonly id = `cat-tooltip-${nextUniqueId++}`;\n private tooltip?: HTMLElement;\n private triggerElement?: HTMLElement;\n private trigger?: FocusableElement;\n private showTimeout?: number;\n private hideTimeout?: number;\n private touchTimeout?: number;\n\n /**\n * The content of the tooltip.\n */\n @Prop() content = '';\n\n /**\n * Specifies that the tooltip should be disabled. A disabled tooltip is unusable,\n * and invisible. Corresponds with the native HTML disabled attribute.\n */\n @Prop() disabled = false;\n\n /**\n * The placement of the tooltip.\n */\n @Prop() placement: Placement = 'top';\n\n /**\n * The delay time for showing tooltip in ms.\n */\n @Prop() showDelay = 1000;\n\n /**\n * The delay time for hiding tooltip in ms.\n */\n @Prop() hideDelay = 0;\n\n /**\n * The duration of tap to show the tooltip.\n */\n @Prop() longTouchDuration = 1000;\n\n @Listen('keydown')\n handleKeyDown({ key }: KeyboardEvent) {\n key === 'Escape' && this.hideListener();\n }\n\n componentDidLoad(): void {\n this.trigger = firstTabbable(this.triggerElement) || this.triggerElement;\n if (!this.isTabbable) {\n this.trigger?.setAttribute('tabindex', '0');\n }\n if (this.trigger && this.tooltip) {\n autoUpdate(this.trigger, this.tooltip, () => this.update());\n }\n\n if (isTouchScreen) {\n this.trigger?.addEventListener('touchstart', this.touchStartListener.bind(this));\n this.trigger?.addEventListener('touchend', this.touchEndListener.bind(this));\n } else {\n this.trigger?.addEventListener('focusin', this.showListener.bind(this));\n this.trigger?.addEventListener('focusout', this.hideListener.bind(this));\n this.trigger?.addEventListener('mouseenter', this.showListener.bind(this));\n this.trigger?.addEventListener('mouseleave', this.hideListener.bind(this));\n }\n }\n\n disconnectedCallback(): void {\n if (isTouchScreen) {\n this.trigger?.removeEventListener('touchstart', this.touchStartListener.bind(this));\n this.trigger?.removeEventListener('touchend', this.touchEndListener.bind(this));\n } else {\n this.trigger?.removeEventListener('mouseenter', this.showListener.bind(this));\n this.trigger?.removeEventListener('mouseleave', this.hideListener.bind(this));\n this.trigger?.removeEventListener('focusin', this.showListener.bind(this));\n this.trigger?.removeEventListener('focusout', this.hideListener.bind(this));\n }\n }\n\n render() {\n return (\n <Host>\n <div ref={el => (this.triggerElement = el)} aria-describedby={this.id} class=\"tooltip-trigger\">\n <slot />\n </div>\n {this.content && !this.disabled && (\n <div ref={el => (this.tooltip = el)} id={this.id} class=\"tooltip\">\n {this.content}\n </div>\n )}\n </Host>\n );\n }\n\n private get isTabbable() {\n return firstTabbable(this.trigger);\n }\n\n private update() {\n if (this.trigger && this.tooltip) {\n computePosition(this.trigger, this.tooltip, {\n placement: this.placement,\n middleware: [offset(CatTooltip.OFFSET), flip()]\n }).then(({ x, y }) => {\n if (this.tooltip) {\n Object.assign(this.tooltip.style, {\n left: `${Math.max(0, x)}px`,\n top: `${y}px`\n });\n }\n });\n }\n }\n\n private showListener() {\n window.clearTimeout(this.hideTimeout);\n this.showTimeout = window.setTimeout(() => {\n this.trigger?.focus();\n this.tooltip?.classList.add('tooltip-show');\n }, this.showDelay);\n }\n\n private hideListener() {\n window.clearTimeout(this.showTimeout);\n this.hideTimeout = window.setTimeout(() => {\n this.trigger?.blur();\n this.tooltip?.classList.remove('tooltip-show');\n }, this.hideDelay);\n }\n\n private touchStartListener() {\n this.touchTimeout = window.setTimeout(() => {\n this.tooltip?.classList.add('tooltip-show');\n }, this.longTouchDuration);\n }\n\n private touchEndListener() {\n window.clearTimeout(this.touchTimeout);\n this.tooltip?.classList.remove('tooltip-show');\n }\n}\n"]}
1
+ {"version":3,"file":"cat-tooltip.js","sourceRoot":"","sources":["../../../src/components/cat-tooltip/cat-tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,EAAa,MAAM,kBAAkB,CAAC;AACxF,OAAO,aAAa,MAAM,6BAA6B,CAAC;AACxD,OAAO,aAAa,MAAM,4BAA4B,CAAC;AAGvD,IAAI,YAAY,GAAG,CAA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AM,GAAG,CAAE,CAAA","sourcesContent":["import { Component, h, Host, Listen, Prop } from '@stencil/core';\nimport { autoUpdate, computePosition, flip, offset, Placement } from '@floating-ui/dom';\nimport isTouchScreen from '../../utils/is-touch-screen';\nimport firstTabbable from '../../utils/first-tabbable';\nimport { FocusableElement } from 'tabbable';\n\nlet nextUniqueId = 0;\n\n@Component({\n tag: 'cat-tooltip',\n styleUrl: 'cat-tooltip.scss',\n shadow: true\n})\nexport class CatTooltip {\n private static readonly OFFSET = 4;\n private readonly id = `cat-tooltip-${nextUniqueId++}`;\n private tooltip?: HTMLElement;\n private triggerElement?: HTMLElement;\n private trigger?: FocusableElement;\n private showTimeout?: number;\n private hideTimeout?: number;\n private touchTimeout?: number;\n\n /**\n * The content of the tooltip.\n */\n @Prop() content = '';\n\n /**\n * Specifies that the tooltip should be disabled. A disabled tooltip is unusable,\n * and invisible. Corresponds with the native HTML disabled attribute.\n */\n @Prop() disabled = false;\n\n /**\n * The placement of the tooltip.\n */\n @Prop() placement: Placement = 'top';\n\n /**\n * The delay time for showing tooltip in ms.\n */\n @Prop() showDelay = 500;\n\n /**\n * The delay time for hiding tooltip in ms.\n */\n @Prop() hideDelay = 0;\n\n /**\n * The duration of tap to show the tooltip.\n */\n @Prop() longTouchDuration = 1000;\n\n @Listen('keydown')\n handleKeyDown({ key }: KeyboardEvent) {\n key === 'Escape' && this.hideListener();\n }\n\n componentDidLoad(): void {\n this.trigger = firstTabbable(this.triggerElement) || this.triggerElement;\n if (!this.isTabbable) {\n this.trigger?.setAttribute('tabindex', '0');\n }\n if (this.trigger && this.tooltip) {\n autoUpdate(this.trigger, this.tooltip, () => this.update());\n }\n\n if (isTouchScreen) {\n this.trigger?.addEventListener('touchstart', this.touchStartListener.bind(this));\n this.trigger?.addEventListener('touchend', this.touchEndListener.bind(this));\n } else {\n this.trigger?.addEventListener('focusin', this.showListener.bind(this));\n this.trigger?.addEventListener('focusout', this.hideListener.bind(this));\n this.trigger?.addEventListener('mouseenter', this.showListener.bind(this));\n this.trigger?.addEventListener('mouseleave', this.hideListener.bind(this));\n }\n }\n\n disconnectedCallback(): void {\n if (isTouchScreen) {\n this.trigger?.removeEventListener('touchstart', this.touchStartListener.bind(this));\n this.trigger?.removeEventListener('touchend', this.touchEndListener.bind(this));\n } else {\n this.trigger?.removeEventListener('mouseenter', this.showListener.bind(this));\n this.trigger?.removeEventListener('mouseleave', this.hideListener.bind(this));\n this.trigger?.removeEventListener('focusin', this.showListener.bind(this));\n this.trigger?.removeEventListener('focusout', this.hideListener.bind(this));\n }\n }\n\n render() {\n return (\n <Host>\n <div ref={el => (this.triggerElement = el)} aria-describedby={this.id} class=\"tooltip-trigger\">\n <slot />\n </div>\n {this.content && !this.disabled && (\n <div ref={el => (this.tooltip = el)} id={this.id} class=\"tooltip\">\n {this.content}\n </div>\n )}\n </Host>\n );\n }\n\n private get isTabbable() {\n return firstTabbable(this.trigger);\n }\n\n private update() {\n if (this.trigger && this.tooltip) {\n computePosition(this.trigger, this.tooltip, {\n placement: this.placement,\n middleware: [offset(CatTooltip.OFFSET), flip()]\n }).then(({ x, y }) => {\n if (this.tooltip) {\n Object.assign(this.tooltip.style, {\n left: `${Math.max(0, x)}px`,\n top: `${y}px`\n });\n }\n });\n }\n }\n\n private showListener() {\n window.clearTimeout(this.hideTimeout);\n this.showTimeout = window.setTimeout(() => {\n this.trigger?.focus();\n this.tooltip?.classList.add('tooltip-show');\n }, this.showDelay);\n }\n\n private hideListener() {\n window.clearTimeout(this.showTimeout);\n this.hideTimeout = window.setTimeout(() => {\n this.trigger?.blur();\n this.tooltip?.classList.remove('tooltip-show');\n }, this.hideDelay);\n }\n\n private touchStartListener() {\n this.touchTimeout = window.setTimeout(() => {\n this.tooltip?.classList.add('tooltip-show');\n }, this.longTouchDuration);\n }\n\n private touchEndListener() {\n window.clearTimeout(this.touchTimeout);\n this.tooltip?.classList.remove('tooltip-show');\n }\n}\n"]}
@@ -1,2 +1,3 @@
1
+ export { CatI18nRegistry } from './components/cat-i18n/cat-i18n-registry';
1
2
  export { CatIconRegistry } from './components/cat-icon/cat-icon-registry';
2
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC","sourcesContent":["export { Components, JSX } from './components';\nexport { CatIconRegistry } from './components/cat-icon/cat-icon-registry';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC","sourcesContent":["export { Components, JSX } from './components';\nexport { CatI18nRegistry } from './components/cat-i18n/cat-i18n-registry';\nexport { CatIconRegistry } from './components/cat-icon/cat-icon-registry';\n"]}
@@ -1,9 +1,17 @@
1
- import { CatIconRegistry } from './components/cat-icon/cat-icon-registry';
2
1
  import { ci } from '@haiilo/catalyst-icons';
2
+ import { CatI18nRegistry } from './components/cat-i18n/cat-i18n-registry';
3
+ import { CatIconRegistry } from './components/cat-icon/cat-icon-registry';
3
4
  function registerIcons() {
4
5
  CatIconRegistry.getInstance().addIcons(ci);
5
6
  }
7
+ function registerTranslations() {
8
+ CatI18nRegistry.getInstance().addMessages('en', {
9
+ 'input.clear': 'Clear',
10
+ 'input.optional': 'Optional'
11
+ });
12
+ }
6
13
  export default function () {
7
14
  registerIcons();
15
+ registerTranslations();
8
16
  }
9
17
  //# sourceMappingURL=init.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAC;AAE5C,SAAS,aAAa;EACpB,eAAe,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;AAC7C,CAAC;AAED,MAAM,CAAC,OAAO;EACZ,aAAa,EAAE,CAAC;AAClB,CAAC","sourcesContent":["import { CatIconRegistry } from './components/cat-icon/cat-icon-registry';\nimport { ci } from '@haiilo/catalyst-icons';\n\nfunction registerIcons() {\n CatIconRegistry.getInstance().addIcons(ci);\n}\n\nexport default function () {\n registerIcons();\n}\n"]}
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAE1E,SAAS,aAAa;EACpB,eAAe,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;AAC7C,CAAC;AAED,SAAS,oBAAoB;EAC3B,eAAe,CAAC,WAAW,EAAE,CAAC,WAAW,CAAC,IAAI,EAAE;IAC9C,aAAa,EAAE,OAAO;IACtB,gBAAgB,EAAE,UAAU;GAC7B,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,OAAO;EACZ,aAAa,EAAE,CAAC;EAChB,oBAAoB,EAAE,CAAC;AACzB,CAAC","sourcesContent":["import { ci } from '@haiilo/catalyst-icons';\nimport { CatI18nRegistry } from './components/cat-i18n/cat-i18n-registry';\nimport { CatIconRegistry } from './components/cat-icon/cat-icon-registry';\n\nfunction registerIcons() {\n CatIconRegistry.getInstance().addIcons(ci);\n}\n\nfunction registerTranslations() {\n CatI18nRegistry.getInstance().addMessages('en', {\n 'input.clear': 'Clear',\n 'input.optional': 'Optional'\n });\n}\n\nexport default function () {\n registerIcons();\n registerTranslations();\n}\n"]}
@@ -1,6 +1,6 @@
1
- import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
1
+ import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
2
 
3
- const catAlertCss = ":host{display:block;margin-bottom:1rem}:host([hidden]){display:none}.cat-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;width:100%}::slotted(:last-child){margin-bottom:0 !important}.cat-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)}.cat-alert-secondary{--bg:105, 118, 135;--text:0, 0, 0;--border:105, 118, 135}.cat-alert-success{--bg:0, 132, 88;--text:0, 132, 88;--border:0, 132, 88}.cat-alert-warning{--bg:255, 206, 128;--text:159, 97, 0;--border:159, 97, 0}.cat-alert-danger{--bg:217, 52, 13;--text:217, 52, 13;--border:217, 52, 13}";
3
+ 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;width:100%}::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
4
 
5
5
  const CatAlert$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
6
6
  constructor() {
@@ -13,10 +13,19 @@ const CatAlert$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
13
13
  this.color = 'primary';
14
14
  }
15
15
  render() {
16
- return (h("div", { part: "alert", class: {
17
- 'cat-alert': true,
18
- [`cat-alert-${this.color}`]: Boolean(this.color)
19
- } }, h("slot", null)));
16
+ return (h(Host, { tabindex: "0", role: this.role }, h("div", { part: "alert", class: {
17
+ alert: true,
18
+ [`alert-${this.color}`]: Boolean(this.color)
19
+ } }, h("slot", null))));
20
+ }
21
+ get role() {
22
+ switch (this.color) {
23
+ case 'danger':
24
+ case 'warning':
25
+ return 'alert';
26
+ default:
27
+ return 'status';
28
+ }
20
29
  }
21
30
  static get style() { return catAlertCss; }
22
31
  }, [1, "cat-alert", {
@@ -1 +1 @@
1
- {"file":"cat-alert.js","mappings":";;AAAA,MAAM,WAAW,GAAG,6vBAA6vB;;MCYpwBA,UAAQ;EALrB;;;;;;;IASU,UAAK,GAA+D,SAAS,CAAC;GAevF;EAbC,MAAM;IACJ,QACE,WACE,IAAI,EAAC,OAAO,EACZ,KAAK,EAAE;QACL,WAAW,EAAE,IAAI;QACjB,CAAC,aAAa,IAAI,CAAC,KAAK,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;OACjD,IAED,eAAa,CACT,EACN;GACH;;;;;;;;;;;;;;;;;;;;;;;;","names":["CatAlert"],"sources":["./src/components/cat-alert/cat-alert.scss?tag=cat-alert&encapsulation=shadow","./src/components/cat-alert/cat-alert.tsx"],"sourcesContent":["@use 'variables' as *;\n@use 'mixins' as *;\n\n:host {\n display: block;\n margin-bottom: $cat-body-margin-bottom;\n}\n\n:host([hidden]) {\n display: none;\n}\n\n.cat-alert {\n font: inherit;\n color: cat-token-wrap(var(--text));\n background-color: cat-token-wrap(var(--bg), $alpha: 0.1);\n box-shadow: inset 0 0 0 1px cat-token-wrap(var(--border), $alpha: 0.2);\n border-radius: cat-border-radius('m');\n padding: cat-size('xs') * 0.5 cat-size('s') * 0.5;\n width: 100%;\n}\n\n::slotted(:last-child) {\n margin-bottom: 0 !important;\n}\n\n// ----- theme\n\n@mixin theme($theme) {\n .cat-alert-#{$theme} {\n --bg: #{cat-token('color.theme.#{$theme}.bg', $wrap: false)};\n --text: #{cat-token('color.theme.#{$theme}.text', $wrap: false)};\n @if $theme == 'secondary' {\n --border: #{cat-token('color.theme.#{$theme}.bg', $wrap: false)};\n } @else {\n --border: #{cat-token('color.theme.#{$theme}.text', $wrap: false)};\n }\n }\n}\n\n@include theme('primary');\n@include theme('secondary');\n@include theme('success');\n@include theme('warning');\n@include theme('danger');\n","import { Component, h, Prop } from '@stencil/core';\n\n/**\n * Alerts are used to display important messages inline.\n *\n * @part alert - The content of the alert.\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 <div\n part=\"alert\"\n class={{\n 'cat-alert': true,\n [`cat-alert-${this.color}`]: Boolean(this.color)\n }}\n >\n <slot></slot>\n </div>\n );\n }\n}\n"],"version":3}
1
+ {"file":"cat-alert.js","mappings":";;AAAA,MAAM,WAAW,GAAG,g1BAAg1B;;MCav1BA,UAAQ;EALrB;;;;;;;IASU,UAAK,GAA+D,SAAS,CAAC;GA2BvF;EAzBC,MAAM;IACJ,QACE,EAAC,IAAI,IAAC,QAAQ,EAAC,GAAG,EAAC,IAAI,EAAE,IAAI,CAAC,IAAI,IAChC,WACE,IAAI,EAAC,OAAO,EACZ,KAAK,EAAE;QACL,KAAK,EAAE,IAAI;QACX,CAAC,SAAS,IAAI,CAAC,KAAK,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;OAC7C,IAED,eAAa,CACT,CACD,EACP;GACH;EAED,IAAY,IAAI;IACd,QAAQ,IAAI,CAAC,KAAK;MAChB,KAAK,QAAQ,CAAC;MACd,KAAK,SAAS;QACZ,OAAO,OAAO,CAAC;MACjB;QACE,OAAO,QAAQ,CAAC;KACnB;GACF;;;;;;;;;;;;;;;;;;;;;;;;","names":["CatAlert"],"sources":["./src/components/cat-alert/cat-alert.scss?tag=cat-alert&encapsulation=shadow","./src/components/cat-alert/cat-alert.tsx"],"sourcesContent":["@use 'variables' as *;\n@use 'mixins' as *;\n\n:host {\n display: block;\n margin-bottom: $cat-body-margin-bottom;\n}\n\n:host(:focus-visible) {\n outline: 2px solid cat-token('color.ui.border.focus');\n outline-offset: 1px;\n}\n\n:host([hidden]) {\n display: none;\n}\n\n.alert {\n font: inherit;\n color: cat-token-wrap(var(--text));\n background-color: cat-token-wrap(var(--bg), $alpha: 0.1);\n box-shadow: inset 0 0 0 1px cat-token-wrap(var(--border), $alpha: 0.2);\n border-radius: cat-border-radius('m');\n padding: 0.75rem 1rem;\n width: 100%;\n}\n\n::slotted(:last-child) {\n margin-bottom: 0 !important;\n}\n\n// ----- theme\n\n@mixin theme($theme) {\n .alert-#{$theme} {\n --bg: #{cat-token('color.theme.#{$theme}.bg', $wrap: false)};\n --text: #{cat-token('color.theme.#{$theme}.text', $wrap: false)};\n @if $theme == 'secondary' {\n --border: #{cat-token('color.theme.#{$theme}.bg', $wrap: false)};\n } @else {\n --border: #{cat-token('color.theme.#{$theme}.text', $wrap: false)};\n }\n }\n}\n\n@include theme('primary');\n@include theme('secondary');\n@include theme('success');\n@include theme('warning');\n@include theme('danger');\n","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"],"version":3}
@@ -1,6 +1,6 @@
1
1
  import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
2
2
 
3
- const catBadgeCss = ":host{display:inline-flex;max-width:100%;vertical-align:baseline}:host([hidden]){display:none}.cat-badge{font:inherit;flex:1 1 auto;display:inline-flex;align-items:center;justify-content:center;border-radius:0.125rem;text-decoration:none;width:100%;box-sizing:border-box;line-height:1;white-space:nowrap}.cat-badge slot{display:inline-block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.cat-badge-round{border-radius:10rem}.cat-badge-filled{background-color:rgb(var(--bg));color:rgb(var(--fill));font-weight:600;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:greyscale}.cat-badge-outlined{background-color:white;box-shadow:inset 0 0 0 1px rgba(var(--border), 0.2);color:rgb(var(--text))}.cat-badge-primary{--bg:var(--cat-primary-bg, 32, 127, 138);--fill:var(--cat-primary-fill, 255, 255, 255);--text:var(--cat-primary-text, 32, 127, 138);--border:var(--cat-primary-text, 32, 127, 138)}.cat-badge-secondary{--bg:105, 118, 135;--fill:255, 255, 255;--text:0, 0, 0;--border:105, 118, 135}.cat-badge-success{--bg:0, 132, 88;--fill:255, 255, 255;--text:0, 132, 88;--border:0, 132, 88}.cat-badge-warning{--bg:255, 206, 128;--fill:0, 0, 0;--text:159, 97, 0;--border:159, 97, 0}.cat-badge-danger{--bg:217, 52, 13;--fill:255, 255, 255;--text:217, 52, 13;--border:217, 52, 13}.cat-badge-xs{height:0.75rem;min-width:0.75rem;font-size:0.75rem;padding:0 0.1875rem}.cat-badge-s{height:1rem;min-width:1rem;font-size:0.75rem;padding:0 0.25rem}.cat-badge-m{height:1.25rem;min-width:1.25rem;font-size:0.75rem;padding:0 0.3125rem}.cat-badge-l{height:1.5rem;min-width:1.5rem;font-size:0.875rem;padding:0 0.375rem}.cat-badge-xl{height:1.75rem;min-width:1.75rem;font-size:0.9375rem;padding:0 0.4375rem}.cat-badge-pulse.cat-badge-filled{animation:1.5s ease 0s infinite normal none running pulse}.cat-badge-pulse.cat-badge-outlined{animation:1.5s ease 0s infinite normal none running pulse-outlined}@keyframes pulse{0%{box-shadow:0 0 0 0 rgb(var(--bg))}70%{box-shadow:transparent 0 0 0 0.5rem}100%{box-shadow:transparent 0 0 0 0}}@keyframes pulse-outlined{0%{box-shadow:0 0 0 0 rgb(var(--bg)), inset 0 0 0 1px rgba(var(--border), 0.2)}70%{box-shadow:transparent 0 0 0 0.5rem, inset 0 0 0 1px rgba(var(--border), 0.2)}100%{box-shadow:transparent 0 0 0 0, inset 0 0 0 1px rgba(var(--border), 0.2)}}";
3
+ const catBadgeCss = ":host{display:inline-flex;max-width:100%;vertical-align:baseline}:host([hidden]){display:none}.badge{font:inherit;flex:1 1 auto;display:inline-flex;align-items:center;justify-content:center;border-radius:0.125rem;text-decoration:none;width:100%;box-sizing:border-box;line-height:1;white-space:nowrap}.badge slot{display:inline-block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.badge-round{border-radius:10rem}.badge-filled{background-color:rgb(var(--bg));color:rgb(var(--fill));font-weight:600;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:greyscale}.badge-outlined{background-color:white;box-shadow:inset 0 0 0 1px rgba(var(--border), 0.2);color:rgb(var(--text))}.badge-primary{--bg:var(--cat-primary-bg, 32, 127, 138);--fill:var(--cat-primary-fill, 255, 255, 255);--text:var(--cat-primary-text, 32, 127, 138);--border:var(--cat-primary-text, 32, 127, 138)}.badge-secondary{--bg:105, 118, 135;--fill:255, 255, 255;--text:0, 0, 0;--border:105, 118, 135}.badge-success{--bg:0, 132, 88;--fill:255, 255, 255;--text:0, 132, 88;--border:0, 132, 88}.badge-warning{--bg:255, 206, 128;--fill:0, 0, 0;--text:159, 97, 0;--border:159, 97, 0}.badge-danger{--bg:217, 52, 13;--fill:255, 255, 255;--text:217, 52, 13;--border:217, 52, 13}.badge-xs{height:0.75rem;min-width:0.75rem;font-size:0.75rem;padding:0 0.1875rem}.badge-s{height:1rem;min-width:1rem;font-size:0.75rem;padding:0 0.25rem}.badge-m{height:1.25rem;min-width:1.25rem;font-size:0.75rem;padding:0 0.3125rem}.badge-l{height:1.5rem;min-width:1.5rem;font-size:0.875rem;padding:0 0.375rem}.badge-xl{height:1.75rem;min-width:1.75rem;font-size:0.9375rem;padding:0 0.4375rem}.badge-pulse.badge-filled{animation:1.5s ease 0s infinite normal none running pulse}.badge-pulse.badge-outlined{animation:1.5s ease 0s infinite normal none running pulse-outlined}@keyframes pulse{0%{box-shadow:0 0 0 0 rgb(var(--bg))}70%{box-shadow:transparent 0 0 0 0.5rem}100%{box-shadow:transparent 0 0 0 0}}@keyframes pulse-outlined{0%{box-shadow:0 0 0 0 rgb(var(--bg)), inset 0 0 0 1px rgba(var(--border), 0.2)}70%{box-shadow:transparent 0 0 0 0.5rem, inset 0 0 0 1px rgba(var(--border), 0.2)}100%{box-shadow:transparent 0 0 0 0, inset 0 0 0 1px rgba(var(--border), 0.2)}}";
4
4
 
5
5
  const CatBadge$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
6
6
  constructor() {
@@ -30,12 +30,12 @@ const CatBadge$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
30
30
  }
31
31
  render() {
32
32
  return (h("span", { part: "badge", class: {
33
- 'cat-badge': true,
34
- 'cat-badge-round': this.round,
35
- 'cat-badge-pulse': this.pulse,
36
- [`cat-badge-${this.variant}`]: Boolean(this.variant),
37
- [`cat-badge-${this.color}`]: Boolean(this.color),
38
- [`cat-badge-${this.size}`]: Boolean(this.size)
33
+ badge: true,
34
+ 'badge-round': this.round,
35
+ 'badge-pulse': this.pulse,
36
+ [`badge-${this.variant}`]: Boolean(this.variant),
37
+ [`badge-${this.color}`]: Boolean(this.color),
38
+ [`badge-${this.size}`]: Boolean(this.size)
39
39
  } }, h("slot", null)));
40
40
  }
41
41
  static get style() { return catBadgeCss; }
@@ -1 +1 @@
1
- {"file":"cat-badge.js","mappings":";;AAAA,MAAM,WAAW,GAAG,2vEAA2vE;;MCYlwEA,UAAQ;EALrB;;;;;;;IASU,YAAO,GAA0B,QAAQ,CAAC;;;;IAK1C,UAAK,GAA+D,SAAS,CAAC;;;;IAK9E,SAAI,GAAkC,GAAG,CAAC;;;;IAK1C,UAAK,GAAG,KAAK,CAAC;;;;IAKd,UAAK,GAAG,KAAK,CAAC;GAmBvB;EAjBC,MAAM;IACJ,QACE,YACE,IAAI,EAAC,OAAO,EACZ,KAAK,EAAE;QACL,WAAW,EAAE,IAAI;QACjB,iBAAiB,EAAE,IAAI,CAAC,KAAK;QAC7B,iBAAiB,EAAE,IAAI,CAAC,KAAK;QAC7B,CAAC,aAAa,IAAI,CAAC,OAAO,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC;QACpD,CAAC,aAAa,IAAI,CAAC,KAAK,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;QAChD,CAAC,aAAa,IAAI,CAAC,IAAI,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;OAC/C,IAED,eAAa,CACR,EACP;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["CatBadge"],"sources":["./src/components/cat-badge/cat-badge.scss?tag=cat-badge&encapsulation=shadow","./src/components/cat-badge/cat-badge.tsx"],"sourcesContent":["@use 'variables' as *;\n@use 'mixins' as *;\n\n:host {\n display: inline-flex;\n max-width: 100%;\n vertical-align: baseline;\n}\n\n:host([hidden]) {\n display: none;\n}\n\n.cat-badge {\n font: inherit;\n flex: 1 1 auto;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n border-radius: cat-border-radius('s');\n text-decoration: none;\n width: 100%;\n box-sizing: border-box;\n line-height: 1;\n white-space: nowrap;\n\n slot {\n display: inline-block;\n @include cat-ellipsis;\n }\n}\n\n// ----- round\n\n.cat-badge-round {\n border-radius: 10rem;\n}\n\n// ----- theme\n\n.cat-badge-filled {\n background-color: cat-token-wrap(var(--bg));\n color: cat-token-wrap(var(--fill));\n font-weight: 600;\n @include cat-font-smooth;\n}\n\n$-outline: inset 0 0 0 1px cat-token-wrap(var(--border), $alpha: 0.2);\n\n.cat-badge-outlined {\n background-color: cat-token('color.ui.background.body');\n box-shadow: $-outline;\n color: cat-token-wrap(var(--text));\n}\n\n@mixin theme($theme) {\n .cat-badge-#{$theme} {\n --bg: #{cat-token('color.theme.#{$theme}.bg', $wrap: false)};\n --fill: #{cat-token('color.theme.#{$theme}.fill', $wrap: false)};\n --text: #{cat-token('color.theme.#{$theme}.text', $wrap: false)};\n @if $theme == 'secondary' {\n --border: #{cat-token('color.theme.#{$theme}.bg', $wrap: false)};\n } @else {\n --border: #{cat-token('color.theme.#{$theme}.text', $wrap: false)};\n }\n }\n}\n\n@include theme('primary');\n@include theme('secondary');\n@include theme('success');\n@include theme('warning');\n@include theme('danger');\n\n// ----- size\n\n@mixin size($size, $fontSize) {\n .cat-badge-#{$size} {\n height: cat-size($size) * 0.5;\n min-width: cat-size($size) * 0.5;\n font-size: cat-body-font-size($fontSize);\n padding: 0 cat-size($size) * 0.125;\n }\n}\n\n@include size('xs', 'xs');\n@include size('s', 'xs');\n@include size('m', 'xs');\n@include size('l', 's');\n@include size('xl', 'm');\n\n// ----- pulse\n\n$-pulse-0: 0 0 0 0 cat-token-wrap(var(--bg));\n$-pulse-70: transparent 0 0 0 0.5rem;\n$-pulse-100: transparent 0 0 0 0;\n\n.cat-badge-pulse {\n &.cat-badge-filled {\n animation: 1.5s ease 0s infinite normal none running pulse;\n }\n\n &.cat-badge-outlined {\n animation: 1.5s ease 0s infinite normal none running pulse-outlined;\n }\n}\n\n@keyframes pulse {\n 0% {\n box-shadow: $-pulse-0;\n }\n\n 70% {\n box-shadow: $-pulse-70;\n }\n\n 100% {\n box-shadow: $-pulse-100;\n }\n}\n\n@keyframes pulse-outlined {\n 0% {\n box-shadow: $-pulse-0, $-outline;\n }\n\n 70% {\n box-shadow: $-pulse-70, $-outline;\n }\n\n 100% {\n box-shadow: $-pulse-100, $-outline;\n }\n}\n","import { Component, h, Prop } from '@stencil/core';\n\n/**\n * Badges are used to draw attention and display statuses or counts.\n *\n * @part badge - The content of the badge.\n */\n@Component({\n tag: 'cat-badge',\n styleUrl: 'cat-badge.scss',\n shadow: true\n})\nexport class CatBadge {\n /**\n * The rendering style of the badge.\n */\n @Prop() variant: 'filled' | 'outlined' = 'filled';\n\n /**\n * The color palette of the badge.\n */\n @Prop() color: 'primary' | 'secondary' | 'danger' | 'success' | 'warning' = 'primary';\n\n /**\n * The size of the badge.\n */\n @Prop() size: 'xs' | 's' | 'm' | 'l' | 'xl' = 'm';\n\n /**\n * Use round badge edges.\n */\n @Prop() round = false;\n\n /**\n * Draw attention to the badge with a subtle animation.\n */\n @Prop() pulse = false;\n\n render() {\n return (\n <span\n part=\"badge\"\n class={{\n 'cat-badge': true,\n 'cat-badge-round': this.round,\n 'cat-badge-pulse': this.pulse,\n [`cat-badge-${this.variant}`]: Boolean(this.variant),\n [`cat-badge-${this.color}`]: Boolean(this.color),\n [`cat-badge-${this.size}`]: Boolean(this.size)\n }}\n >\n <slot></slot>\n </span>\n );\n }\n}\n"],"version":3}
1
+ {"file":"cat-badge.js","mappings":";;AAAA,MAAM,WAAW,GAAG,+qEAA+qE;;MCatrEA,UAAQ;EALrB;;;;;;;IASU,YAAO,GAA0B,QAAQ,CAAC;;;;IAK1C,UAAK,GAA+D,SAAS,CAAC;;;;IAK9E,SAAI,GAAkC,GAAG,CAAC;;;;IAK1C,UAAK,GAAG,KAAK,CAAC;;;;IAKd,UAAK,GAAG,KAAK,CAAC;GAmBvB;EAjBC,MAAM;IACJ,QACE,YACE,IAAI,EAAC,OAAO,EACZ,KAAK,EAAE;QACL,KAAK,EAAE,IAAI;QACX,aAAa,EAAE,IAAI,CAAC,KAAK;QACzB,aAAa,EAAE,IAAI,CAAC,KAAK;QACzB,CAAC,SAAS,IAAI,CAAC,OAAO,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC;QAChD,CAAC,SAAS,IAAI,CAAC,KAAK,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;QAC5C,CAAC,SAAS,IAAI,CAAC,IAAI,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;OAC3C,IAED,eAAa,CACR,EACP;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["CatBadge"],"sources":["./src/components/cat-badge/cat-badge.scss?tag=cat-badge&encapsulation=shadow","./src/components/cat-badge/cat-badge.tsx"],"sourcesContent":["@use 'variables' as *;\n@use 'mixins' as *;\n\n:host {\n display: inline-flex;\n max-width: 100%;\n vertical-align: baseline;\n}\n\n:host([hidden]) {\n display: none;\n}\n\n.badge {\n font: inherit;\n flex: 1 1 auto;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n border-radius: cat-border-radius('s');\n text-decoration: none;\n width: 100%;\n box-sizing: border-box;\n line-height: 1;\n white-space: nowrap;\n\n slot {\n display: inline-block;\n @include cat-ellipsis;\n }\n}\n\n// ----- round\n\n.badge-round {\n border-radius: 10rem;\n}\n\n// ----- theme\n\n.badge-filled {\n background-color: cat-token-wrap(var(--bg));\n color: cat-token-wrap(var(--fill));\n font-weight: 600;\n @include cat-font-smooth;\n}\n\n$-outline: inset 0 0 0 1px cat-token-wrap(var(--border), $alpha: 0.2);\n\n.badge-outlined {\n background-color: cat-token('color.ui.background.body');\n box-shadow: $-outline;\n color: cat-token-wrap(var(--text));\n}\n\n@mixin theme($theme) {\n .badge-#{$theme} {\n --bg: #{cat-token('color.theme.#{$theme}.bg', $wrap: false)};\n --fill: #{cat-token('color.theme.#{$theme}.fill', $wrap: false)};\n --text: #{cat-token('color.theme.#{$theme}.text', $wrap: false)};\n @if $theme == 'secondary' {\n --border: #{cat-token('color.theme.#{$theme}.bg', $wrap: false)};\n } @else {\n --border: #{cat-token('color.theme.#{$theme}.text', $wrap: false)};\n }\n }\n}\n\n@include theme('primary');\n@include theme('secondary');\n@include theme('success');\n@include theme('warning');\n@include theme('danger');\n\n// ----- size\n\n@mixin size($size, $fontSize) {\n .badge-#{$size} {\n height: cat-size($size) * 0.5;\n min-width: cat-size($size) * 0.5;\n font-size: cat-body-font-size($fontSize);\n padding: 0 cat-size($size) * 0.125;\n }\n}\n\n@include size('xs', 'xs');\n@include size('s', 'xs');\n@include size('m', 'xs');\n@include size('l', 's');\n@include size('xl', 'm');\n\n// ----- pulse\n\n$-pulse-0: 0 0 0 0 cat-token-wrap(var(--bg));\n$-pulse-70: transparent 0 0 0 0.5rem;\n$-pulse-100: transparent 0 0 0 0;\n\n.badge-pulse {\n &.badge-filled {\n animation: 1.5s ease 0s infinite normal none running pulse;\n }\n\n &.badge-outlined {\n animation: 1.5s ease 0s infinite normal none running pulse-outlined;\n }\n}\n\n@keyframes pulse {\n 0% {\n box-shadow: $-pulse-0;\n }\n\n 70% {\n box-shadow: $-pulse-70;\n }\n\n 100% {\n box-shadow: $-pulse-100;\n }\n}\n\n@keyframes pulse-outlined {\n 0% {\n box-shadow: $-pulse-0, $-outline;\n }\n\n 70% {\n box-shadow: $-pulse-70, $-outline;\n }\n\n 100% {\n box-shadow: $-pulse-100, $-outline;\n }\n}\n","import { Component, h, Prop } from '@stencil/core';\n\n/**\n * Badges are used to inform users of the status of an object or of an action\n * that’s been taken.\n *\n * @part badge - The badge element.\n */\n@Component({\n tag: 'cat-badge',\n styleUrl: 'cat-badge.scss',\n shadow: true\n})\nexport class CatBadge {\n /**\n * The rendering style of the badge.\n */\n @Prop() variant: 'filled' | 'outlined' = 'filled';\n\n /**\n * The color palette of the badge.\n */\n @Prop() color: 'primary' | 'secondary' | 'danger' | 'success' | 'warning' = 'primary';\n\n /**\n * The size of the badge.\n */\n @Prop() size: 'xs' | 's' | 'm' | 'l' | 'xl' = 'm';\n\n /**\n * Use round badge edges.\n */\n @Prop() round = false;\n\n /**\n * Draw attention to the badge with a subtle animation.\n */\n @Prop() pulse = false;\n\n render() {\n return (\n <span\n part=\"badge\"\n class={{\n badge: true,\n 'badge-round': this.round,\n 'badge-pulse': this.pulse,\n [`badge-${this.variant}`]: Boolean(this.variant),\n [`badge-${this.color}`]: Boolean(this.color),\n [`badge-${this.size}`]: Boolean(this.size)\n }}\n >\n <slot></slot>\n </span>\n );\n }\n}\n"],"version":3}