@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.
- package/dist/catalyst/catalyst.css +1 -1
- package/dist/catalyst/catalyst.esm.js +1 -1
- package/dist/catalyst/catalyst.esm.js.map +1 -1
- package/dist/catalyst/index.esm.js +1 -1
- package/dist/catalyst/p-23d54bc6.js +2 -0
- package/dist/catalyst/p-23d54bc6.js.map +1 -0
- package/dist/catalyst/p-84693f87.entry.js +24 -0
- package/dist/catalyst/p-84693f87.entry.js.map +1 -0
- package/dist/catalyst/p-8f5cfa78.js +2 -0
- package/dist/catalyst/p-8f5cfa78.js.map +1 -0
- package/dist/catalyst/{p-ed826597.js → p-fa7da4c6.js} +2 -2
- package/dist/catalyst/p-fa7da4c6.js.map +1 -0
- package/dist/cjs/{app-globals-7f2b1f8e.js → app-globals-50e7504d.js} +9 -2
- package/dist/cjs/app-globals-50e7504d.js.map +1 -0
- package/dist/cjs/{cat-alert_9.cjs.entry.js → cat-alert_15.cjs.entry.js} +449 -354
- package/dist/cjs/cat-alert_15.cjs.entry.js.map +1 -0
- package/dist/cjs/cat-icon-registry-6895750f.js +441 -0
- package/dist/cjs/cat-icon-registry-6895750f.js.map +1 -0
- package/dist/cjs/catalyst.cjs.js +4 -4
- package/dist/cjs/{index-c0881ae0.js → index-2db8e23d.js} +1 -2
- package/dist/cjs/index-2db8e23d.js.map +1 -0
- package/dist/cjs/index.cjs.js +2 -1
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +4 -4
- package/dist/collection/collection-manifest.json +6 -0
- package/dist/collection/components/cat-alert/cat-alert.css +11 -6
- package/dist/collection/components/cat-alert/cat-alert.js +19 -8
- package/dist/collection/components/cat-alert/cat-alert.js.map +1 -1
- package/dist/collection/components/cat-badge/cat-badge.css +17 -17
- package/dist/collection/components/cat-badge/cat-badge.js +9 -8
- package/dist/collection/components/cat-badge/cat-badge.js.map +1 -1
- package/dist/collection/components/cat-button/cat-button.css +18 -8
- package/dist/collection/components/cat-button/cat-button.js +32 -8
- package/dist/collection/components/cat-button/cat-button.js.map +1 -1
- package/dist/collection/components/cat-card/cat-card.css +25 -0
- package/dist/collection/components/cat-card/cat-card.js +20 -0
- package/dist/collection/components/cat-card/cat-card.js.map +1 -0
- package/dist/collection/components/cat-checkbox/cat-checkbox.css +105 -0
- package/dist/collection/components/cat-checkbox/cat-checkbox.js +314 -0
- package/dist/collection/components/cat-checkbox/cat-checkbox.js.map +1 -0
- package/dist/collection/components/cat-i18n/cat-i18n-registry.js +69 -0
- package/dist/collection/components/cat-i18n/cat-i18n-registry.js.map +1 -0
- package/dist/collection/components/cat-icon/cat-icon-registry.js +14 -1
- package/dist/collection/components/cat-icon/cat-icon-registry.js.map +1 -1
- package/dist/collection/components/cat-icon/cat-icon.css +5 -5
- package/dist/collection/components/cat-icon/cat-icon.js +3 -2
- package/dist/collection/components/cat-icon/cat-icon.js.map +1 -1
- package/dist/collection/components/cat-input/cat-input.css +131 -0
- package/dist/collection/components/cat-input/cat-input.js +606 -0
- package/dist/collection/components/cat-input/cat-input.js.map +1 -0
- package/dist/collection/components/cat-menu/cat-menu.css +2 -1
- package/dist/collection/components/cat-radio/cat-radio.css +84 -0
- package/dist/collection/components/cat-radio/cat-radio.js +283 -0
- package/dist/collection/components/cat-radio/cat-radio.js.map +1 -0
- package/dist/collection/components/cat-scrollable/cat-scrollable.js +4 -2
- package/dist/collection/components/cat-scrollable/cat-scrollable.js.map +1 -1
- package/dist/collection/components/cat-skeleton/cat-skeleton.css +30 -30
- package/dist/collection/components/cat-skeleton/cat-skeleton.js +4 -4
- package/dist/collection/components/cat-skeleton/cat-skeleton.js.map +1 -1
- package/dist/collection/components/cat-spinner/cat-spinner.css +7 -7
- package/dist/collection/components/cat-spinner/cat-spinner.js +1 -1
- package/dist/collection/components/cat-spinner/cat-spinner.js.map +1 -1
- package/dist/collection/components/cat-textarea/cat-textarea.css +74 -0
- package/dist/collection/components/cat-textarea/cat-textarea.js +393 -0
- package/dist/collection/components/cat-textarea/cat-textarea.js.map +1 -0
- package/dist/collection/components/cat-toggle/cat-toggle.css +93 -0
- package/dist/collection/components/cat-toggle/cat-toggle.js +283 -0
- package/dist/collection/components/cat-toggle/cat-toggle.js.map +1 -0
- package/dist/collection/components/cat-tooltip/cat-tooltip.css +9 -5
- package/dist/collection/components/cat-tooltip/cat-tooltip.js +2 -2
- package/dist/collection/components/cat-tooltip/cat-tooltip.js.map +1 -1
- package/dist/collection/index.js +1 -0
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/init.js +9 -1
- package/dist/collection/init.js.map +1 -1
- package/dist/components/cat-alert.js +15 -6
- package/dist/components/cat-alert.js.map +1 -1
- package/dist/components/cat-badge.js +7 -7
- package/dist/components/cat-badge.js.map +1 -1
- package/dist/components/cat-button.js +1 -647
- package/dist/components/cat-button.js.map +1 -1
- package/dist/components/cat-button2.js +346 -0
- package/dist/components/cat-button2.js.map +1 -0
- package/dist/components/cat-card.d.ts +11 -0
- package/dist/components/cat-card.js +35 -0
- package/dist/components/cat-card.js.map +1 -0
- package/dist/components/cat-checkbox.d.ts +11 -0
- package/dist/components/cat-checkbox.js +103 -0
- package/dist/components/cat-checkbox.js.map +1 -0
- package/dist/components/cat-i18n-registry.js +73 -0
- package/dist/components/cat-i18n-registry.js.map +1 -0
- package/dist/components/cat-icon-registry.js +15 -1
- package/dist/components/cat-icon-registry.js.map +1 -1
- package/dist/components/cat-icon2.js +3 -2
- package/dist/components/cat-icon2.js.map +1 -1
- package/dist/components/cat-input.d.ts +11 -0
- package/dist/components/cat-input.js +172 -0
- package/dist/components/cat-input.js.map +1 -0
- package/dist/components/cat-menu.js +1 -1
- package/dist/components/cat-menu.js.map +1 -1
- package/dist/components/cat-radio.d.ts +11 -0
- package/dist/components/cat-radio.js +93 -0
- package/dist/components/cat-radio.js.map +1 -0
- package/dist/components/cat-scrollable.js +1 -2
- package/dist/components/cat-scrollable.js.map +1 -1
- package/dist/components/cat-skeleton.js +5 -5
- package/dist/components/cat-skeleton.js.map +1 -1
- package/dist/components/cat-spinner2.js +2 -2
- package/dist/components/cat-spinner2.js.map +1 -1
- package/dist/components/cat-textarea.d.ts +11 -0
- package/dist/components/cat-textarea.js +119 -0
- package/dist/components/cat-textarea.js.map +1 -0
- package/dist/components/cat-toggle.d.ts +11 -0
- package/dist/components/cat-toggle.js +93 -0
- package/dist/components/cat-toggle.js.map +1 -0
- package/dist/components/cat-tooltip.js +2 -2
- package/dist/components/cat-tooltip.js.map +1 -1
- package/dist/components/first-tabbable.js +5 -4
- package/dist/components/first-tabbable.js.map +1 -1
- package/dist/components/index.js +9 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/loglevel.js +315 -0
- package/dist/components/loglevel.js.map +1 -0
- package/dist/esm/{app-globals-8af9b2cf.js → app-globals-6906ac5c.js} +9 -2
- package/dist/esm/app-globals-6906ac5c.js.map +1 -0
- package/dist/esm/{cat-alert_9.entry.js → cat-alert_15.entry.js} +442 -353
- package/dist/esm/cat-alert_15.entry.js.map +1 -0
- package/dist/esm/cat-icon-registry-77963c26.js +437 -0
- package/dist/esm/cat-icon-registry-77963c26.js.map +1 -0
- package/dist/esm/catalyst.js +4 -4
- package/dist/esm/{index-0ff35bca.js → index-1f3ca03b.js} +2 -2
- package/dist/esm/index-1f3ca03b.js.map +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/loader.js +4 -4
- package/dist/types/components/cat-alert/cat-alert.d.ts +4 -2
- package/dist/types/components/cat-badge/cat-badge.d.ts +3 -2
- package/dist/types/components/cat-button/cat-button.d.ts +8 -3
- package/dist/types/components/cat-card/cat-card.d.ts +7 -0
- package/dist/types/components/cat-checkbox/cat-checkbox.d.ts +69 -0
- package/dist/types/components/cat-i18n/cat-i18n-registry.d.ts +18 -0
- package/dist/types/components/cat-icon/cat-icon-registry.d.ts +4 -4
- package/dist/types/components/cat-icon/cat-icon.d.ts +1 -1
- package/dist/types/components/cat-input/cat-input.d.ts +130 -0
- package/dist/types/components/cat-radio/cat-radio.d.ts +63 -0
- package/dist/types/components/cat-scrollable/cat-scrollable.d.ts +3 -1
- package/dist/types/components/cat-textarea/cat-textarea.d.ts +85 -0
- package/dist/types/components/cat-toggle/cat-toggle.d.ts +64 -0
- package/dist/types/components.d.ts +619 -4
- package/dist/types/index.d.ts +1 -0
- package/package.json +5 -3
- package/dist/catalyst/p-89a97b7b.entry.js +0 -10
- package/dist/catalyst/p-89a97b7b.entry.js.map +0 -1
- package/dist/catalyst/p-ed826597.js.map +0 -1
- package/dist/catalyst/p-ef0a8ae9.js +0 -2
- package/dist/catalyst/p-ef0a8ae9.js.map +0 -1
- package/dist/catalyst/p-f151cb13.js +0 -2
- package/dist/catalyst/p-f151cb13.js.map +0 -1
- package/dist/cjs/app-globals-7f2b1f8e.js.map +0 -1
- package/dist/cjs/cat-alert_9.cjs.entry.js.map +0 -1
- package/dist/cjs/cat-icon-registry-850c538c.js +0 -47
- package/dist/cjs/cat-icon-registry-850c538c.js.map +0 -1
- package/dist/cjs/index-c0881ae0.js.map +0 -1
- package/dist/collection/utils/utils.js +0 -4
- package/dist/collection/utils/utils.js.map +0 -1
- package/dist/esm/app-globals-8af9b2cf.js.map +0 -1
- package/dist/esm/cat-alert_9.entry.js.map +0 -1
- package/dist/esm/cat-icon-registry-59da2e37.js +0 -45
- package/dist/esm/cat-icon-registry-59da2e37.js.map +0 -1
- package/dist/esm/index-0ff35bca.js.map +0 -1
- package/dist/types/utils/utils.d.ts +0 -1
|
@@ -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,MAAM,eAAe,CAAC;
|
|
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"]}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
display: none;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
.
|
|
16
|
+
.badge {
|
|
17
17
|
font: inherit;
|
|
18
18
|
flex: 1 1 auto;
|
|
19
19
|
display: inline-flex;
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
line-height: 1;
|
|
27
27
|
white-space: nowrap;
|
|
28
28
|
}
|
|
29
|
-
.
|
|
29
|
+
.badge slot {
|
|
30
30
|
display: inline-block;
|
|
31
31
|
/* stylelint-disable value-no-vendor-prefix, property-no-vendor-prefix */
|
|
32
32
|
overflow: hidden;
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
/* stylelint-enable value-no-vendor-prefix, property-no-vendor-prefix */
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
.
|
|
38
|
+
.badge-round {
|
|
39
39
|
border-radius: 10rem;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
.
|
|
42
|
+
.badge-filled {
|
|
43
43
|
background-color: rgb(var(--bg));
|
|
44
44
|
color: rgb(var(--fill));
|
|
45
45
|
font-weight: 600;
|
|
@@ -47,86 +47,86 @@
|
|
|
47
47
|
-moz-osx-font-smoothing: greyscale;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
.
|
|
50
|
+
.badge-outlined {
|
|
51
51
|
background-color: white;
|
|
52
52
|
box-shadow: inset 0 0 0 1px rgba(var(--border), 0.2);
|
|
53
53
|
color: rgb(var(--text));
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
.
|
|
56
|
+
.badge-primary {
|
|
57
57
|
--bg: var(--cat-primary-bg, 32, 127, 138);
|
|
58
58
|
--fill: var(--cat-primary-fill, 255, 255, 255);
|
|
59
59
|
--text: var(--cat-primary-text, 32, 127, 138);
|
|
60
60
|
--border: var(--cat-primary-text, 32, 127, 138);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
.
|
|
63
|
+
.badge-secondary {
|
|
64
64
|
--bg: 105, 118, 135;
|
|
65
65
|
--fill: 255, 255, 255;
|
|
66
66
|
--text: 0, 0, 0;
|
|
67
67
|
--border: 105, 118, 135;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
.
|
|
70
|
+
.badge-success {
|
|
71
71
|
--bg: 0, 132, 88;
|
|
72
72
|
--fill: 255, 255, 255;
|
|
73
73
|
--text: 0, 132, 88;
|
|
74
74
|
--border: 0, 132, 88;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
.
|
|
77
|
+
.badge-warning {
|
|
78
78
|
--bg: 255, 206, 128;
|
|
79
79
|
--fill: 0, 0, 0;
|
|
80
80
|
--text: 159, 97, 0;
|
|
81
81
|
--border: 159, 97, 0;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
.
|
|
84
|
+
.badge-danger {
|
|
85
85
|
--bg: 217, 52, 13;
|
|
86
86
|
--fill: 255, 255, 255;
|
|
87
87
|
--text: 217, 52, 13;
|
|
88
88
|
--border: 217, 52, 13;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
.
|
|
91
|
+
.badge-xs {
|
|
92
92
|
height: 0.75rem;
|
|
93
93
|
min-width: 0.75rem;
|
|
94
94
|
font-size: 0.75rem;
|
|
95
95
|
padding: 0 0.1875rem;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
.
|
|
98
|
+
.badge-s {
|
|
99
99
|
height: 1rem;
|
|
100
100
|
min-width: 1rem;
|
|
101
101
|
font-size: 0.75rem;
|
|
102
102
|
padding: 0 0.25rem;
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
.
|
|
105
|
+
.badge-m {
|
|
106
106
|
height: 1.25rem;
|
|
107
107
|
min-width: 1.25rem;
|
|
108
108
|
font-size: 0.75rem;
|
|
109
109
|
padding: 0 0.3125rem;
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
.
|
|
112
|
+
.badge-l {
|
|
113
113
|
height: 1.5rem;
|
|
114
114
|
min-width: 1.5rem;
|
|
115
115
|
font-size: 0.875rem;
|
|
116
116
|
padding: 0 0.375rem;
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
.
|
|
119
|
+
.badge-xl {
|
|
120
120
|
height: 1.75rem;
|
|
121
121
|
min-width: 1.75rem;
|
|
122
122
|
font-size: 0.9375rem;
|
|
123
123
|
padding: 0 0.4375rem;
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
.
|
|
126
|
+
.badge-pulse.badge-filled {
|
|
127
127
|
animation: 1.5s ease 0s infinite normal none running pulse;
|
|
128
128
|
}
|
|
129
|
-
.
|
|
129
|
+
.badge-pulse.badge-outlined {
|
|
130
130
|
animation: 1.5s ease 0s infinite normal none running pulse-outlined;
|
|
131
131
|
}
|
|
132
132
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Component, h, Prop } from '@stencil/core';
|
|
2
2
|
/**
|
|
3
|
-
* Badges are used to
|
|
3
|
+
* Badges are used to inform users of the status of an object or of an action
|
|
4
|
+
* that’s been taken.
|
|
4
5
|
*
|
|
5
|
-
* @part badge - The
|
|
6
|
+
* @part badge - The badge element.
|
|
6
7
|
*/
|
|
7
8
|
export class CatBadge {
|
|
8
9
|
constructor() {
|
|
@@ -29,12 +30,12 @@ export class CatBadge {
|
|
|
29
30
|
}
|
|
30
31
|
render() {
|
|
31
32
|
return (h("span", { part: "badge", class: {
|
|
32
|
-
|
|
33
|
-
'
|
|
34
|
-
'
|
|
35
|
-
[`
|
|
36
|
-
[`
|
|
37
|
-
[`
|
|
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)
|
|
38
39
|
} },
|
|
39
40
|
h("slot", null)));
|
|
40
41
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cat-badge.js","sourceRoot":"","sources":["../../../src/components/cat-badge/cat-badge.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAEnD
|
|
1
|
+
{"version":3,"file":"cat-badge.js","sourceRoot":"","sources":["../../../src/components/cat-badge/cat-badge.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAEnD;;;;;GAKG;AAMH,MAAM,OAAO,QAAQ;EALrB;IAME;;OAEG;IACK,YAAO,GAA0B,QAAQ,CAAC;IAElD;;OAEG;IACK,UAAK,GAA+D,SAAS,CAAC;IAEtF;;OAEG;IACK,SAAI,GAAkC,GAAG,CAAC;IAElD;;OAEG;IACK,UAAK,GAAG,KAAK,CAAC;IAEtB;;OAEG;IACK,UAAK,GAAG,KAAK,CAAC;GAmBvB;EAjBC,MAAM;IACJ,OAAO,CACL,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,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC;QAChD,CAAC,SAAS,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;QAC5C,CAAC,SAAS,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;OAC3C;MAED,eAAa,CACR,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["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"]}
|
|
@@ -14,7 +14,12 @@
|
|
|
14
14
|
/* stylelint-enable property-no-vendor-prefix */
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
:host([hidden]) {
|
|
18
|
+
display: none;
|
|
19
|
+
}
|
|
20
|
+
|
|
17
21
|
.cat-button {
|
|
22
|
+
position: relative;
|
|
18
23
|
font: inherit;
|
|
19
24
|
display: flex;
|
|
20
25
|
align-items: center;
|
|
@@ -28,7 +33,7 @@
|
|
|
28
33
|
transition: color 0.13s linear, border-color 0.13s linear, background-color 0.13s linear, box-shadow 0.13s linear;
|
|
29
34
|
}
|
|
30
35
|
.cat-button:focus-visible {
|
|
31
|
-
outline: 2px solid
|
|
36
|
+
outline: 2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));
|
|
32
37
|
outline-offset: 1px;
|
|
33
38
|
}
|
|
34
39
|
|
|
@@ -296,23 +301,28 @@
|
|
|
296
301
|
padding-right: 1rem;
|
|
297
302
|
}
|
|
298
303
|
|
|
304
|
+
.cat-button-active::before {
|
|
305
|
+
content: "";
|
|
306
|
+
display: block;
|
|
307
|
+
position: absolute;
|
|
308
|
+
top: 0;
|
|
309
|
+
left: 0;
|
|
310
|
+
width: 0.25rem;
|
|
311
|
+
height: 100%;
|
|
312
|
+
background: rgb(var(--base));
|
|
313
|
+
}
|
|
314
|
+
|
|
299
315
|
:host-context(nav) {
|
|
300
316
|
width: 100%;
|
|
301
317
|
}
|
|
302
318
|
:host-context(nav) .cat-button {
|
|
303
319
|
box-shadow: none;
|
|
304
320
|
border-radius: 0;
|
|
321
|
+
justify-content: left;
|
|
305
322
|
}
|
|
306
323
|
:host-context(nav) .cat-button:focus-visible {
|
|
307
324
|
outline-offset: -2px;
|
|
308
325
|
}
|
|
309
|
-
:host-context(nav) .cat-button-content {
|
|
310
|
-
text-align: left;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
:host([hidden]) {
|
|
314
|
-
display: none;
|
|
315
|
-
}
|
|
316
326
|
|
|
317
327
|
:host(.cat-text-left) .cat-button {
|
|
318
328
|
justify-content: left;
|
|
@@ -3,7 +3,8 @@ import log from 'loglevel';
|
|
|
3
3
|
import { Breakpoints, isBreakpoint } from '../../utils/breakpoints';
|
|
4
4
|
import { MediaMatcher } from '../../utils/media-matcher';
|
|
5
5
|
/**
|
|
6
|
-
* Buttons are used for interface actions.
|
|
6
|
+
* Buttons are used for interface actions. Primary style should be used only
|
|
7
|
+
* once per view for main call-to-action.
|
|
7
8
|
*
|
|
8
9
|
* @part button - The native anchor or button element.
|
|
9
10
|
* @part content - The textual content of the button.
|
|
@@ -21,6 +22,10 @@ export class CatButton {
|
|
|
21
22
|
* The color palette of the button.
|
|
22
23
|
*/
|
|
23
24
|
this.color = 'secondary';
|
|
25
|
+
/**
|
|
26
|
+
* Show an active status indicator on the left side of the button.
|
|
27
|
+
*/
|
|
28
|
+
this.active = false;
|
|
24
29
|
/**
|
|
25
30
|
* The size of the button.
|
|
26
31
|
*/
|
|
@@ -53,9 +58,9 @@ export class CatButton {
|
|
|
53
58
|
*/
|
|
54
59
|
this.iconOnly = false;
|
|
55
60
|
/**
|
|
56
|
-
* Display the icon
|
|
61
|
+
* Display the icon on the right.
|
|
57
62
|
*/
|
|
58
|
-
this.
|
|
63
|
+
this.iconRight = false;
|
|
59
64
|
}
|
|
60
65
|
onIconOnlyChanged(value) {
|
|
61
66
|
var _a, _b;
|
|
@@ -117,6 +122,7 @@ export class CatButton {
|
|
|
117
122
|
else {
|
|
118
123
|
return (h("button", { ref: el => (this.button = el), type: this.submit ? 'submit' : 'button', name: this.name, value: this.value, disabled: this.disabled, "aria-disabled": this.disabled ? 'true' : null, "aria-label": this.a11yLabel, id: this.buttonId, part: "button", class: {
|
|
119
124
|
'cat-button': true,
|
|
125
|
+
'cat-button-active': this.active,
|
|
120
126
|
'cat-button-icon': this.isIconButton,
|
|
121
127
|
'cat-button-round': (_a = this.round) !== null && _a !== void 0 ? _a : this.isIconButton,
|
|
122
128
|
'cat-button-loading': this.loading,
|
|
@@ -148,10 +154,10 @@ export class CatButton {
|
|
|
148
154
|
return Boolean(this.icon) && this._iconOnly;
|
|
149
155
|
}
|
|
150
156
|
get hasPrefixIcon() {
|
|
151
|
-
return Boolean(this.icon) && !this._iconOnly && !this.
|
|
157
|
+
return Boolean(this.icon) && !this._iconOnly && !this.iconRight;
|
|
152
158
|
}
|
|
153
159
|
get hasSuffixIcon() {
|
|
154
|
-
return Boolean(this.icon) && !this._iconOnly && this.
|
|
160
|
+
return Boolean(this.icon) && !this._iconOnly && this.iconRight;
|
|
155
161
|
}
|
|
156
162
|
get content() {
|
|
157
163
|
return [
|
|
@@ -216,6 +222,24 @@ export class CatButton {
|
|
|
216
222
|
"reflect": false,
|
|
217
223
|
"defaultValue": "'secondary'"
|
|
218
224
|
},
|
|
225
|
+
"active": {
|
|
226
|
+
"type": "boolean",
|
|
227
|
+
"mutable": false,
|
|
228
|
+
"complexType": {
|
|
229
|
+
"original": "boolean",
|
|
230
|
+
"resolved": "boolean",
|
|
231
|
+
"references": {}
|
|
232
|
+
},
|
|
233
|
+
"required": false,
|
|
234
|
+
"optional": false,
|
|
235
|
+
"docs": {
|
|
236
|
+
"tags": [],
|
|
237
|
+
"text": "Show an active status indicator on the left side of the button."
|
|
238
|
+
},
|
|
239
|
+
"attribute": "active",
|
|
240
|
+
"reflect": false,
|
|
241
|
+
"defaultValue": "false"
|
|
242
|
+
},
|
|
219
243
|
"size": {
|
|
220
244
|
"type": "string",
|
|
221
245
|
"mutable": false,
|
|
@@ -432,7 +456,7 @@ export class CatButton {
|
|
|
432
456
|
"reflect": false,
|
|
433
457
|
"defaultValue": "false"
|
|
434
458
|
},
|
|
435
|
-
"
|
|
459
|
+
"iconRight": {
|
|
436
460
|
"type": "boolean",
|
|
437
461
|
"mutable": false,
|
|
438
462
|
"complexType": {
|
|
@@ -444,9 +468,9 @@ export class CatButton {
|
|
|
444
468
|
"optional": false,
|
|
445
469
|
"docs": {
|
|
446
470
|
"tags": [],
|
|
447
|
-
"text": "Display the icon
|
|
471
|
+
"text": "Display the icon on the right."
|
|
448
472
|
},
|
|
449
|
-
"attribute": "icon-
|
|
473
|
+
"attribute": "icon-right",
|
|
450
474
|
"reflect": false,
|
|
451
475
|
"defaultValue": "false"
|
|
452
476
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cat-button.js","sourceRoot":"","sources":["../../../src/components/cat-button/cat-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtG,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,EAAc,WAAW,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD;;;;;;;GAOG;AAMH,MAAM,OAAO,SAAS;EALtB;IAWW,cAAS,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EAC3B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Event, EventEmitter, h, Listen, Method, Prop, State, Watch } from '@stencil/core';\nimport log from 'loglevel';\nimport { Breakpoint, Breakpoints, isBreakpoint } from '../../utils/breakpoints';\nimport { MediaMatcher } from '../../utils/media-matcher';\n\n/**\n * Buttons are used for interface actions.\n *\n * @part button - The native anchor or button element.\n * @part content - The textual content of the button.\n * @part prefix - The prefix icon.\n * @part suffix - The suffix icon.\n */\n@Component({\n tag: 'cat-button',\n styleUrl: 'cat-button.scss',\n shadow: true\n})\nexport class CatButton {\n private button!: HTMLButtonElement | HTMLAnchorElement;\n private mediaMatcher?: MediaMatcher;\n private mediaQueryList?: MediaQueryList;\n private mediaQueryListener?: (event: MediaQueryListEvent) => void;\n\n @State() _iconOnly = true;\n\n /**\n * The rendering style of the button.\n */\n @Prop() variant: 'filled' | 'outlined' | 'text' = 'outlined';\n\n /**\n * The color palette of the button.\n */\n @Prop() color: 'primary' | 'secondary' | 'danger' | 'success' | 'warning' = 'secondary';\n\n /**\n * The size of the button.\n */\n @Prop() size: 'xs' | 's' | 'm' | 'l' | 'xl' = 'm';\n\n /**\n * The name of the button, which gets paired with the button's value when\n * submitted as part of a form. Corresponds with the native HTML name\n * attribute.\n */\n @Prop() name?: string;\n\n /**\n * The value of the button, which gets paired with the button's name when\n * submitted as part of a form. Corresponds with the native HTML value\n * attribute.\n */\n @Prop() value?: string;\n\n /**\n * Specifies that the button should be disabled. A disabled button is unusable\n * and un-clickable. Corresponds with the native HTML disabled attribute.\n */\n @Prop() disabled = false;\n\n /**\n * Displays the button in a loading state with a spinner. Just like a disabled\n * button, an inactive button is unusable and un-clickable. However, it\n * retains the current focus state.\n */\n @Prop() loading = false;\n\n /**\n * Allows the button to submit a form.\n */\n @Prop() submit = false;\n\n /**\n * Ellipse overflowing button content.\n */\n @Prop() ellipsed = true;\n\n /**\n * Use round button edges.\n */\n @Prop() round = 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 * The name of an icon to be displayed in the button.\n */\n @Prop() icon?: string;\n\n /**\n * Hide the actual button content and only display the icon.\n */\n @Prop() iconOnly: boolean | Breakpoint = false;\n\n /**\n * Display the icon as a suffix.\n */\n @Prop() iconSuffix = false;\n\n /**\n * Adds a unique identifier for the button. Please note that with this\n * particular component this ID is added inside the web component. If you need\n * an ID on the HTML element, use the regular `id` attribute instead.\n */\n @Prop() buttonId?: string;\n\n /**\n * Adds accessible label for the button that is only shown for screen\n * readers. Typically, this label text replaces the visible text on the\n * button for users who use assistive technology.\n */\n @Prop({ attribute: 'a11y-label' }) a11yLabel?: string;\n\n @Watch('iconOnly')\n onIconOnlyChanged(value: boolean | Breakpoint): void {\n // teardown\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.mediaQueryList?.removeEventListener('change', this.mediaQueryListener!);\n this.mediaQueryList = undefined;\n this.mediaQueryListener = undefined;\n // setup\n if (isBreakpoint(value)) {\n this.mediaMatcher ??= new MediaMatcher();\n this.mediaQueryList = this.mediaMatcher.matchMedia(Breakpoints[value]);\n this.mediaQueryListener = (event: MediaQueryListEvent) => (this._iconOnly = event.matches);\n this.mediaQueryList.addEventListener('change', this.mediaQueryListener);\n this._iconOnly = this.mediaQueryList.matches;\n } else {\n this._iconOnly = value;\n }\n }\n\n /**\n * Emitted when the button is clicked.\n */\n @Event() catClick!: EventEmitter<MouseEvent>;\n\n /**\n * Emitted when the button received focus.\n */\n @Event() catFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the button loses focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n componentWillLoad(): void {\n this.onIconOnlyChanged(this.iconOnly);\n }\n\n componentWillRender(): void {\n if (this.isIconButton && !this.a11yLabel) {\n log.warn('[A11y] Missing ARIA label on icon button', this);\n }\n }\n\n @Listen('click')\n haltDisabledEvents(event: Event): void {\n if (this.disabled || this.loading) {\n event.preventDefault();\n event.stopImmediatePropagation();\n }\n }\n\n /**\n * Sets focus on the button. Use this method instead of `button.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.button.focus(options);\n }\n\n render() {\n if (this.url) {\n return (\n <a\n ref={el => (this.button = el as HTMLAnchorElement)}\n href={this.disabled ? undefined : this.url}\n target={this.urlTarget}\n aria-disabled={this.disabled ? 'true' : null}\n aria-label={this.a11yLabel}\n id={this.buttonId}\n part=\"button\"\n class={{\n 'cat-button': true,\n 'cat-button-icon': this.isIconButton,\n 'cat-button-round': this.round,\n 'cat-button-loading': this.loading,\n 'cat-button-disabled': this.disabled,\n 'cat-button-ellipsed': this.ellipsed && !this.isIconButton,\n [`cat-button-${this.variant}`]: Boolean(this.variant),\n [`cat-button-${this.color}`]: Boolean(this.color),\n [`cat-button-${this.size}`]: Boolean(this.size)\n }}\n onClick={this.onClick.bind(this)}\n onFocus={this.onFocus.bind(this)}\n onBlur={this.onBlur.bind(this)}\n >\n {this.content}\n </a>\n );\n } else {\n return (\n <button\n ref={el => (this.button = el as HTMLButtonElement)}\n type={this.submit ? 'submit' : 'button'}\n name={this.name}\n value={this.value}\n disabled={this.disabled}\n aria-disabled={this.disabled ? 'true' : null}\n aria-label={this.a11yLabel}\n id={this.buttonId}\n part=\"button\"\n class={{\n 'cat-button': true,\n 'cat-button-icon': this.isIconButton,\n 'cat-button-round': this.round ?? this.isIconButton,\n 'cat-button-loading': this.loading,\n 'cat-button-disabled': this.disabled,\n 'cat-button-ellipsed': this.ellipsed && !this.isIconButton,\n [`cat-button-${this.variant}`]: Boolean(this.variant),\n [`cat-button-${this.color}`]: Boolean(this.color),\n [`cat-button-${this.size}`]: Boolean(this.size)\n }}\n onClick={this.onClick.bind(this)}\n onFocus={this.onFocus.bind(this)}\n onBlur={this.onBlur.bind(this)}\n >\n {this.content}\n </button>\n );\n }\n }\n\n private get iconSize(): 'xs' | 's' | 'm' | 'l' | 'xl' {\n switch (this.size) {\n case 'xs':\n return 's';\n default:\n return 'l';\n }\n }\n\n private get spinnerSize(): 'xs' | 's' | 'm' | 'l' | 'xl' {\n switch (this.size) {\n case 'xs':\n return 'xs';\n default:\n return 'm';\n }\n }\n\n private get isIconButton() {\n return Boolean(this.icon) && this._iconOnly;\n }\n\n private get hasPrefixIcon() {\n return Boolean(this.icon) && !this._iconOnly && !this.iconSuffix;\n }\n\n private get hasSuffixIcon() {\n return Boolean(this.icon) && !this._iconOnly && this.iconSuffix;\n }\n\n private get content() {\n return [\n this.hasPrefixIcon ? (\n <cat-icon icon={this.icon} size={this.iconSize} class=\"cat-button-prefix\" part=\"prefix\"></cat-icon>\n ) : null,\n this.isIconButton ? (\n <cat-icon icon={this.icon} size={this.iconSize}></cat-icon>\n ) : (\n <span class=\"cat-button-content\" part=\"content\">\n <slot></slot>\n </span>\n ),\n this.hasSuffixIcon ? (\n <cat-icon icon={this.icon} size={this.iconSize} class=\"cat-button-suffix\" part=\"suffix\"></cat-icon>\n ) : null,\n this.loading ? <cat-spinner size={this.spinnerSize}></cat-spinner> : null\n ];\n }\n\n private onClick(event: MouseEvent) {\n this.catClick.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-button.js","sourceRoot":"","sources":["../../../src/components/cat-button/cat-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtG,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,EAAc,WAAW,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD;;;;;;;;GAQG;AAMH,MAAM,OAAO,SAAS;EALtB;IAWW,cAAS,GAAG,IAAI,CAAC;IAE1B;;OAEG;IACK,YAAO,GAAmC,UAAU,CAAC;IAE7D;;OAEG;IACK,UAAK,GAA+D,WAAW,CAAC;IAExF;;OAEG;IACK,WAAM,GAAG,KAAK,CAAC;IAEvB;;OAEG;IACK,SAAI,GAAkC,GAAG,CAAC;IAgBlD;;;OAGG;IACK,aAAQ,GAAG,KAAK,CAAC;IAEzB;;;;OAIG;IACK,YAAO,GAAG,KAAK,CAAC;IAExB;;OAEG;IACK,WAAM,GAAG,KAAK,CAAC;IAEvB;;OAEG;IACK,aAAQ,GAAG,IAAI,CAAC;IAExB;;OAEG;IACK,UAAK,GAAG,KAAK,CAAC;IAiBtB;;OAEG;IACK,aAAQ,GAAyB,KAAK,CAAC;IAE/C;;OAEG;IACK,cAAS,GAAG,KAAK,CAAC;GA0M3B;EAzLC,iBAAiB,CAAC,KAA2B;;IAC3C,WAAW;IACX,oEAAoE;IACpE,MAAA,IAAI,CAAC,cAAc,0CAAE,mBAAmB,CAAC,QAAQ,EAAE,IAAI,CAAC,kBAAmB,CAAC,CAAC;IA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ch } from '@stencil/core';\nimport log from 'loglevel';\nimport { Breakpoint, Breakpoints, isBreakpoint } from '../../utils/breakpoints';\nimport { MediaMatcher } from '../../utils/media-matcher';\n\n/**\n * Buttons are used for interface actions. Primary style should be used only\n * once per view for main call-to-action.\n *\n * @part button - The native anchor or button element.\n * @part content - The textual content of the button.\n * @part prefix - The prefix icon.\n * @part suffix - The suffix icon.\n */\n@Component({\n tag: 'cat-button',\n styleUrl: 'cat-button.scss',\n shadow: true\n})\nexport class CatButton {\n private button!: HTMLButtonElement | HTMLAnchorElement;\n private mediaMatcher?: MediaMatcher;\n private mediaQueryList?: MediaQueryList;\n private mediaQueryListener?: (event: MediaQueryListEvent) => void;\n\n @State() _iconOnly = true;\n\n /**\n * The rendering style of the button.\n */\n @Prop() variant: 'filled' | 'outlined' | 'text' = 'outlined';\n\n /**\n * The color palette of the button.\n */\n @Prop() color: 'primary' | 'secondary' | 'danger' | 'success' | 'warning' = 'secondary';\n\n /**\n * Show an active status indicator on the left side of the button.\n */\n @Prop() active = false;\n\n /**\n * The size of the button.\n */\n @Prop() size: 'xs' | 's' | 'm' | 'l' | 'xl' = 'm';\n\n /**\n * The name of the button, which gets paired with the button's value when\n * submitted as part of a form. Corresponds with the native HTML name\n * attribute.\n */\n @Prop() name?: string;\n\n /**\n * The value of the button, which gets paired with the button's name when\n * submitted as part of a form. Corresponds with the native HTML value\n * attribute.\n */\n @Prop() value?: string;\n\n /**\n * Specifies that the button should be disabled. A disabled button is unusable\n * and un-clickable. Corresponds with the native HTML disabled attribute.\n */\n @Prop() disabled = false;\n\n /**\n * Displays the button in a loading state with a spinner. Just like a disabled\n * button, an inactive button is unusable and un-clickable. However, it\n * retains the current focus state.\n */\n @Prop() loading = false;\n\n /**\n * Allows the button to submit a form.\n */\n @Prop() submit = false;\n\n /**\n * Ellipse overflowing button content.\n */\n @Prop() ellipsed = true;\n\n /**\n * Use round button edges.\n */\n @Prop() round = 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 * The name of an icon to be displayed in the button.\n */\n @Prop() icon?: string;\n\n /**\n * Hide the actual button content and only display the icon.\n */\n @Prop() iconOnly: boolean | Breakpoint = false;\n\n /**\n * Display the icon on the right.\n */\n @Prop() iconRight = false;\n\n /**\n * Adds a unique identifier for the button. Please note that with this\n * particular component this ID is added inside the web component. If you need\n * an ID on the HTML element, use the regular `id` attribute instead.\n */\n @Prop() buttonId?: string;\n\n /**\n * Adds accessible label for the button that is only shown for screen\n * readers. Typically, this label text replaces the visible text on the\n * button for users who use assistive technology.\n */\n @Prop({ attribute: 'a11y-label' }) a11yLabel?: string;\n\n @Watch('iconOnly')\n onIconOnlyChanged(value: boolean | Breakpoint): void {\n // teardown\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.mediaQueryList?.removeEventListener('change', this.mediaQueryListener!);\n this.mediaQueryList = undefined;\n this.mediaQueryListener = undefined;\n // setup\n if (isBreakpoint(value)) {\n this.mediaMatcher ??= new MediaMatcher();\n this.mediaQueryList = this.mediaMatcher.matchMedia(Breakpoints[value]);\n this.mediaQueryListener = (event: MediaQueryListEvent) => (this._iconOnly = event.matches);\n this.mediaQueryList.addEventListener('change', this.mediaQueryListener);\n this._iconOnly = this.mediaQueryList.matches;\n } else {\n this._iconOnly = value;\n }\n }\n\n /**\n * Emitted when the button is clicked.\n */\n @Event() catClick!: EventEmitter<MouseEvent>;\n\n /**\n * Emitted when the button received focus.\n */\n @Event() catFocus!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the button loses focus.\n */\n @Event() catBlur!: EventEmitter<FocusEvent>;\n\n componentWillLoad(): void {\n this.onIconOnlyChanged(this.iconOnly);\n }\n\n componentWillRender(): void {\n if (this.isIconButton && !this.a11yLabel) {\n log.warn('[A11y] Missing ARIA label on icon button', this);\n }\n }\n\n @Listen('click')\n haltDisabledEvents(event: Event): void {\n if (this.disabled || this.loading) {\n event.preventDefault();\n event.stopImmediatePropagation();\n }\n }\n\n /**\n * Sets focus on the button. Use this method instead of `button.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.button.focus(options);\n }\n\n render() {\n if (this.url) {\n return (\n <a\n ref={el => (this.button = el as HTMLAnchorElement)}\n href={this.disabled ? undefined : this.url}\n target={this.urlTarget}\n aria-disabled={this.disabled ? 'true' : null}\n aria-label={this.a11yLabel}\n id={this.buttonId}\n part=\"button\"\n class={{\n 'cat-button': true,\n 'cat-button-icon': this.isIconButton,\n 'cat-button-round': this.round,\n 'cat-button-loading': this.loading,\n 'cat-button-disabled': this.disabled,\n 'cat-button-ellipsed': this.ellipsed && !this.isIconButton,\n [`cat-button-${this.variant}`]: Boolean(this.variant),\n [`cat-button-${this.color}`]: Boolean(this.color),\n [`cat-button-${this.size}`]: Boolean(this.size)\n }}\n onClick={this.onClick.bind(this)}\n onFocus={this.onFocus.bind(this)}\n onBlur={this.onBlur.bind(this)}\n >\n {this.content}\n </a>\n );\n } else {\n return (\n <button\n ref={el => (this.button = el as HTMLButtonElement)}\n type={this.submit ? 'submit' : 'button'}\n name={this.name}\n value={this.value}\n disabled={this.disabled}\n aria-disabled={this.disabled ? 'true' : null}\n aria-label={this.a11yLabel}\n id={this.buttonId}\n part=\"button\"\n class={{\n 'cat-button': true,\n 'cat-button-active': this.active,\n 'cat-button-icon': this.isIconButton,\n 'cat-button-round': this.round ?? this.isIconButton,\n 'cat-button-loading': this.loading,\n 'cat-button-disabled': this.disabled,\n 'cat-button-ellipsed': this.ellipsed && !this.isIconButton,\n [`cat-button-${this.variant}`]: Boolean(this.variant),\n [`cat-button-${this.color}`]: Boolean(this.color),\n [`cat-button-${this.size}`]: Boolean(this.size)\n }}\n onClick={this.onClick.bind(this)}\n onFocus={this.onFocus.bind(this)}\n onBlur={this.onBlur.bind(this)}\n >\n {this.content}\n </button>\n );\n }\n }\n\n private get iconSize(): 'xs' | 's' | 'm' | 'l' | 'xl' {\n switch (this.size) {\n case 'xs':\n return 's';\n default:\n return 'l';\n }\n }\n\n private get spinnerSize(): 'xs' | 's' | 'm' | 'l' | 'xl' {\n switch (this.size) {\n case 'xs':\n return 'xs';\n default:\n return 'm';\n }\n }\n\n private get isIconButton() {\n return Boolean(this.icon) && this._iconOnly;\n }\n\n private get hasPrefixIcon() {\n return Boolean(this.icon) && !this._iconOnly && !this.iconRight;\n }\n\n private get hasSuffixIcon() {\n return Boolean(this.icon) && !this._iconOnly && this.iconRight;\n }\n\n private get content() {\n return [\n this.hasPrefixIcon ? (\n <cat-icon icon={this.icon} size={this.iconSize} class=\"cat-button-prefix\" part=\"prefix\"></cat-icon>\n ) : null,\n this.isIconButton ? (\n <cat-icon icon={this.icon} size={this.iconSize}></cat-icon>\n ) : (\n <span class=\"cat-button-content\" part=\"content\">\n <slot></slot>\n </span>\n ),\n this.hasSuffixIcon ? (\n <cat-icon icon={this.icon} size={this.iconSize} class=\"cat-button-suffix\" part=\"suffix\"></cat-icon>\n ) : null,\n this.loading ? <cat-spinner size={this.spinnerSize}></cat-spinner> : null\n ];\n }\n\n private onClick(event: MouseEvent) {\n this.catClick.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,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-generated file. Do not edit directly.
|
|
3
|
+
*/
|
|
4
|
+
/* stylelint-disable value-keyword-case */
|
|
5
|
+
/* stylelint-enable value-keyword-case */
|
|
6
|
+
:host {
|
|
7
|
+
display: block;
|
|
8
|
+
margin-bottom: 1rem;
|
|
9
|
+
border-radius: 0.5rem;
|
|
10
|
+
background-color: white;
|
|
11
|
+
box-shadow: inset 0 0 0 1px #ebecf0;
|
|
12
|
+
padding: 1.5rem;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
:host([hidden]) {
|
|
16
|
+
display: none;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
::slotted(nav) {
|
|
20
|
+
margin: -1rem -1.5rem !important;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
::slotted(:last-child) {
|
|
24
|
+
margin-bottom: 0;
|
|
25
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Component, Host, h } from '@stencil/core';
|
|
2
|
+
/**
|
|
3
|
+
* Cards are surfaces that display content and actions on a single topic. They
|
|
4
|
+
* should be easy to scan for relevant and actionable information.
|
|
5
|
+
*/
|
|
6
|
+
export class CatCard {
|
|
7
|
+
render() {
|
|
8
|
+
return (h(Host, null,
|
|
9
|
+
h("slot", null)));
|
|
10
|
+
}
|
|
11
|
+
static get is() { return "cat-card"; }
|
|
12
|
+
static get encapsulation() { return "shadow"; }
|
|
13
|
+
static get originalStyleUrls() { return {
|
|
14
|
+
"$": ["cat-card.scss"]
|
|
15
|
+
}; }
|
|
16
|
+
static get styleUrls() { return {
|
|
17
|
+
"$": ["cat-card.css"]
|
|
18
|
+
}; }
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=cat-card.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cat-card.js","sourceRoot":"","sources":["../../../src/components/cat-card/cat-card.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAEnD;;;GAGG;AAMH,MAAM,OAAO,OAAO;EAClB,MAAM;IACJ,OAAO,CACL,EAAC,IAAI;MACH,eAAa,CACR,CACR,CAAC;EACJ,CAAC;;;;;;;;;CACF","sourcesContent":["import { Component, Host, h } from '@stencil/core';\n\n/**\n * Cards are surfaces that display content and actions on a single topic. They\n * should be easy to scan for relevant and actionable information.\n */\n@Component({\n tag: 'cat-card',\n styleUrl: 'cat-card.scss',\n shadow: true\n})\nexport class CatCard {\n render() {\n return (\n <Host>\n <slot></slot>\n </Host>\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-generated file. Do not edit directly.
|
|
3
|
+
*/
|
|
4
|
+
/* stylelint-disable value-keyword-case */
|
|
5
|
+
/* stylelint-enable value-keyword-case */
|
|
6
|
+
:host {
|
|
7
|
+
display: flex;
|
|
8
|
+
margin-bottom: 1rem;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
:host([hidden]) {
|
|
12
|
+
display: none;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
label {
|
|
16
|
+
flex: 0 1 auto;
|
|
17
|
+
display: flex;
|
|
18
|
+
gap: 0.5rem;
|
|
19
|
+
font-size: 0.9375rem;
|
|
20
|
+
line-height: 1.25rem;
|
|
21
|
+
/* stylelint-disable property-no-vendor-prefix */
|
|
22
|
+
-webkit-user-select: none;
|
|
23
|
+
-ms-user-select: none;
|
|
24
|
+
user-select: none;
|
|
25
|
+
/* stylelint-enable property-no-vendor-prefix */
|
|
26
|
+
cursor: pointer;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
input {
|
|
30
|
+
position: absolute !important;
|
|
31
|
+
width: 1px !important;
|
|
32
|
+
height: 1px !important;
|
|
33
|
+
padding: 0 !important;
|
|
34
|
+
margin: -1px !important;
|
|
35
|
+
overflow: hidden !important;
|
|
36
|
+
clip: rect(0, 0, 0, 0) !important;
|
|
37
|
+
white-space: nowrap !important;
|
|
38
|
+
border: 0 !important;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.box {
|
|
42
|
+
flex: 0 0 auto;
|
|
43
|
+
display: flex;
|
|
44
|
+
position: relative;
|
|
45
|
+
height: 1.25rem;
|
|
46
|
+
width: 1.25rem;
|
|
47
|
+
background-color: white;
|
|
48
|
+
border: 1px solid #d7dbe0;
|
|
49
|
+
border-radius: 0.125rem;
|
|
50
|
+
transition: background-color 0.13s ease, border-color 0.13s ease;
|
|
51
|
+
}
|
|
52
|
+
.box svg {
|
|
53
|
+
fill: none;
|
|
54
|
+
stroke-width: 2;
|
|
55
|
+
stroke-linecap: round;
|
|
56
|
+
stroke-linejoin: round;
|
|
57
|
+
stroke-dasharray: 16px;
|
|
58
|
+
stroke-dashoffset: 16px;
|
|
59
|
+
transition: all 0.13s ease;
|
|
60
|
+
width: 70%;
|
|
61
|
+
position: absolute;
|
|
62
|
+
top: 50%;
|
|
63
|
+
left: 50%;
|
|
64
|
+
transform: translate(-50%, -50%) scale(0.99);
|
|
65
|
+
}
|
|
66
|
+
:checked + .box {
|
|
67
|
+
background-color: rgb(var(--cat-primary-bg, 32, 127, 138));
|
|
68
|
+
border-color: rgb(var(--cat-primary-bg, 32, 127, 138));
|
|
69
|
+
stroke: rgb(var(--cat-primary-fill, 255, 255, 255));
|
|
70
|
+
}
|
|
71
|
+
:checked + .box .check {
|
|
72
|
+
stroke-dashoffset: 0;
|
|
73
|
+
}
|
|
74
|
+
:indeterminate + .box {
|
|
75
|
+
background-color: rgb(var(--cat-primary-bg, 32, 127, 138));
|
|
76
|
+
border-color: rgb(var(--cat-primary-bg, 32, 127, 138));
|
|
77
|
+
stroke: rgb(var(--cat-primary-fill, 255, 255, 255));
|
|
78
|
+
}
|
|
79
|
+
:indeterminate + .box .dash {
|
|
80
|
+
stroke-dashoffset: 0;
|
|
81
|
+
}
|
|
82
|
+
:focus-visible + .box {
|
|
83
|
+
outline: 2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));
|
|
84
|
+
outline-offset: 1px;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.label {
|
|
88
|
+
flex: 1 1 auto;
|
|
89
|
+
}
|
|
90
|
+
.is-hidden .label {
|
|
91
|
+
position: absolute !important;
|
|
92
|
+
width: 1px !important;
|
|
93
|
+
height: 1px !important;
|
|
94
|
+
padding: 0 !important;
|
|
95
|
+
margin: -1px !important;
|
|
96
|
+
overflow: hidden !important;
|
|
97
|
+
clip: rect(0, 0, 0, 0) !important;
|
|
98
|
+
white-space: nowrap !important;
|
|
99
|
+
border: 0 !important;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.is-disabled {
|
|
103
|
+
cursor: not-allowed;
|
|
104
|
+
color: rgb(var(--cat-font-color-muted, 105, 118, 135));
|
|
105
|
+
}
|