@haiilo/catalyst 1.1.0 → 1.2.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 (66) hide show
  1. package/dist/catalyst/catalyst.css +1 -1
  2. package/dist/catalyst/catalyst.esm.js +1 -1
  3. package/dist/catalyst/p-9044f4d7.entry.js +10 -0
  4. package/dist/catalyst/p-9044f4d7.entry.js.map +1 -0
  5. package/dist/cjs/cat-alert_23.cjs.entry.js +43 -31
  6. package/dist/cjs/cat-alert_23.cjs.entry.js.map +1 -1
  7. package/dist/collection/components/cat-alert/cat-alert.css +2 -2
  8. package/dist/collection/components/cat-alert/cat-alert.js +8 -8
  9. package/dist/collection/components/cat-alert/cat-alert.js.map +1 -1
  10. package/dist/collection/components/cat-avatar/cat-avatar.css +8 -8
  11. package/dist/collection/components/cat-badge/cat-badge.css +27 -33
  12. package/dist/collection/components/cat-badge/cat-badge.js +9 -12
  13. package/dist/collection/components/cat-badge/cat-badge.js.map +1 -1
  14. package/dist/collection/components/cat-button/cat-button.css +14 -30
  15. package/dist/collection/components/cat-button/cat-button.js +2 -2
  16. package/dist/collection/components/cat-button/cat-button.js.map +1 -1
  17. package/dist/collection/components/cat-card/cat-card.js +2 -3
  18. package/dist/collection/components/cat-card/cat-card.js.map +1 -1
  19. package/dist/collection/components/cat-checkbox/cat-checkbox.css +4 -4
  20. package/dist/collection/components/cat-radio/cat-radio.css +2 -2
  21. package/dist/collection/components/cat-select/cat-select.css +5 -0
  22. package/dist/collection/components/cat-select/cat-select.js +6 -1
  23. package/dist/collection/components/cat-select/cat-select.js.map +1 -1
  24. package/dist/collection/components/cat-select-demo/cat-select-demo.js +5 -5
  25. package/dist/collection/components/cat-select-demo/cat-select-demo.js.map +1 -1
  26. package/dist/collection/components/cat-tabs/cat-tabs.css +2 -2
  27. package/dist/collection/components/cat-tabs/cat-tabs.js +1 -1
  28. package/dist/collection/components/cat-tabs/cat-tabs.js.map +1 -1
  29. package/dist/collection/components/cat-toggle/cat-toggle.css +1 -1
  30. package/dist/collection/utils/setDefault.js +9 -0
  31. package/dist/collection/utils/setDefault.js.map +1 -0
  32. package/dist/components/cat-alert.js +8 -8
  33. package/dist/components/cat-alert.js.map +1 -1
  34. package/dist/components/cat-avatar2.js +1 -1
  35. package/dist/components/cat-avatar2.js.map +1 -1
  36. package/dist/components/cat-badge.js +9 -9
  37. package/dist/components/cat-badge.js.map +1 -1
  38. package/dist/components/cat-button2.js +2 -2
  39. package/dist/components/cat-button2.js.map +1 -1
  40. package/dist/components/cat-card.js +2 -2
  41. package/dist/components/cat-card.js.map +1 -1
  42. package/dist/components/cat-checkbox2.js +1 -1
  43. package/dist/components/cat-checkbox2.js.map +1 -1
  44. package/dist/components/cat-radio.js +1 -1
  45. package/dist/components/cat-radio.js.map +1 -1
  46. package/dist/components/cat-select-demo.js +3 -3
  47. package/dist/components/cat-select-demo.js.map +1 -1
  48. package/dist/components/cat-select2.js +7 -2
  49. package/dist/components/cat-select2.js.map +1 -1
  50. package/dist/components/cat-tabs.js +2 -2
  51. package/dist/components/cat-tabs.js.map +1 -1
  52. package/dist/components/cat-toggle.js +1 -1
  53. package/dist/components/cat-toggle.js.map +1 -1
  54. package/dist/components/setDefault.js +12 -0
  55. package/dist/components/setDefault.js.map +1 -0
  56. package/dist/esm/cat-alert_23.entry.js +43 -31
  57. package/dist/esm/cat-alert_23.entry.js.map +1 -1
  58. package/dist/types/components/cat-alert/cat-alert.d.ts +1 -2
  59. package/dist/types/components/cat-badge/cat-badge.d.ts +2 -2
  60. package/dist/types/components/cat-button/cat-button.d.ts +1 -1
  61. package/dist/types/components/cat-select/cat-select.d.ts +2 -0
  62. package/dist/types/components.d.ts +2 -2
  63. package/dist/types/utils/setDefault.d.ts +6 -0
  64. package/package.json +2 -2
  65. package/dist/catalyst/p-78b3fc17.entry.js +0 -10
  66. package/dist/catalyst/p-78b3fc17.entry.js.map +0 -1
@@ -29,10 +29,10 @@
29
29
  }
30
30
 
31
31
  :host([color=primary]) {
32
- background-color: rgba(var(--cat-primary-bg, 32, 127, 138), 0.1);
32
+ background-color: rgba(var(--cat-primary-bg, 0, 129, 148), 0.1);
33
33
  }
34
34
  :host([color=primary]) cat-icon {
35
- color: #207f8a;
35
+ color: rgb(var(--cat-primary-text, 0, 129, 148));
36
36
  }
37
37
 
38
38
  :host([color=secondary]) {
@@ -1,4 +1,5 @@
1
- import { Component, h, Host, Prop, Element } from '@stencil/core';
1
+ import { Component, Element, h, Host, Prop } from '@stencil/core';
2
+ import { setAttributeDefault, setPropertyDefault } from '../../utils/setDefault';
2
3
  /**
3
4
  * Informs user about important changes or conditions in the interface. Use this
4
5
  * component if you need to capture user’s attention in a prominent way.
@@ -28,18 +29,17 @@ export class CatAlert {
28
29
  */
29
30
  this.noIcon = false;
30
31
  }
32
+ connectedCallback() {
33
+ setAttributeDefault(this, 'tabindex', 0);
34
+ setAttributeDefault(this, 'role', this.mapRole.get(this.color));
35
+ setPropertyDefault(this, 'color');
36
+ }
31
37
  render() {
32
- return (h(Host, { tabindex: this.tabIndex, role: this.role },
38
+ return (h(Host, null,
33
39
  !this.noIcon && h("cat-icon", { size: "l", icon: this.icon ? this.icon : this.mapIcon.get(this.color) }),
34
40
  h("div", { class: "content" },
35
41
  h("slot", null))));
36
42
  }
37
- get tabIndex() {
38
- return this.hostElement.getAttribute('tabindex') || '0';
39
- }
40
- get role() {
41
- return this.hostElement.getAttribute('role') || this.mapRole.get(this.color) || null;
42
- }
43
43
  static get is() { return "cat-alert"; }
44
44
  static get encapsulation() { return "shadow"; }
45
45
  static get originalStyleUrls() { return {
@@ -1 +1 @@
1
- {"version":3,"file":"cat-alert.js","sourceRoot":"","sources":["../../../src/components/cat-alert/cat-alert.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAElE;;;GAGG;AAMH,MAAM,OAAO,QAAQ;EALrB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C,KAAK,CAAC,IAAI,IAAI,CAAC;EACvF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Host, Prop, Element } 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@Component({\n tag: 'cat-alert',\n styleUrl: 'cat-alert.scss',\n shadow: true\n})\nexport class CatAlert {\n private readonly mapIcon: Map<string, string> = new Map([\n ['primary', 'star-circle-filled'],\n ['secondary', 'clock-filled'],\n ['success', 'check-circle-filled'],\n ['warning', 'danger-filled'],\n ['danger', 'cross-circle-filled']\n ]);\n private readonly mapRole: Map<string, string> = new Map([\n ['primary', 'status'],\n ['secondary', 'status'],\n ['success', 'status'],\n ['warning', 'alert'],\n ['danger', 'alert']\n ]);\n\n @Element() hostElement!: HTMLElement;\n\n /**\n * The color palette of the alert.\n */\n @Prop() color: 'primary' | 'secondary' | 'danger' | 'success' | 'warning' = 'primary';\n\n /**\n * The name of an icon to be displayed in the alert.\n */\n @Prop() icon?: string;\n\n /**\n * Whether the icon of the alert is deactivated.\n */\n @Prop() noIcon = false;\n\n render() {\n return (\n <Host tabindex={this.tabIndex} role={this.role}>\n {!this.noIcon && <cat-icon size=\"l\" icon={this.icon ? this.icon : this.mapIcon.get(this.color)}></cat-icon>}\n <div class=\"content\">\n <slot></slot>\n </div>\n </Host>\n );\n }\n\n private get tabIndex() {\n return this.hostElement.getAttribute('tabindex') || '0';\n }\n\n private get role() {\n return this.hostElement.getAttribute('role') || this.mapRole.get(this.color) || null;\n }\n}\n"]}
1
+ {"version":3,"file":"cat-alert.js","sourceRoot":"","sources":["../../../src/components/cat-alert/cat-alert.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,mBA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ACT,CACD,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, h, Host, Prop } from '@stencil/core';\nimport { setAttributeDefault, setPropertyDefault } from '../../utils/setDefault';\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@Component({\n tag: 'cat-alert',\n styleUrl: 'cat-alert.scss',\n shadow: true\n})\nexport class CatAlert {\n private readonly mapIcon: Map<string, string> = new Map([\n ['primary', 'star-circle-filled'],\n ['secondary', 'clock-filled'],\n ['success', 'check-circle-filled'],\n ['warning', 'danger-filled'],\n ['danger', 'cross-circle-filled']\n ]);\n private readonly mapRole: Map<string, string> = new Map([\n ['primary', 'status'],\n ['secondary', 'status'],\n ['success', 'status'],\n ['warning', 'alert'],\n ['danger', 'alert']\n ]);\n\n @Element() hostElement!: HTMLElement;\n\n /**\n * The color palette of the alert.\n */\n @Prop() color: 'primary' | 'secondary' | 'danger' | 'success' | 'warning' = 'primary';\n\n /**\n * The name of an icon to be displayed in the alert.\n */\n @Prop() icon?: string;\n\n /**\n * Whether the icon of the alert is deactivated.\n */\n @Prop() noIcon = false;\n\n connectedCallback() {\n setAttributeDefault(this, 'tabindex', 0);\n setAttributeDefault(this, 'role', this.mapRole.get(this.color));\n setPropertyDefault(this, 'color');\n }\n\n render() {\n return (\n <Host>\n {!this.noIcon && <cat-icon size=\"l\" icon={this.icon ? this.icon : this.mapIcon.get(this.color)}></cat-icon>}\n <div class=\"content\">\n <slot></slot>\n </div>\n </Host>\n );\n }\n}\n"]}
@@ -10,13 +10,7 @@
10
10
  * @prop --cat-avatar-size: The size of the avatar.
11
11
  * @prop --cat-avatar-font-size: The font size of the avatar.
12
12
  */
13
- display: inline-block;
14
- vertical-align: middle;
15
- /* stylelint-disable property-no-vendor-prefix */
16
- -webkit-user-select: none;
17
- -ms-user-select: none;
18
- user-select: none;
19
- /* stylelint-enable property-no-vendor-prefix */
13
+ display: contents;
20
14
  }
21
15
 
22
16
  :host([hidden]) {
@@ -24,7 +18,7 @@
24
18
  }
25
19
 
26
20
  .avatar {
27
- display: flex;
21
+ display: inline-flex;
28
22
  align-items: center;
29
23
  justify-content: center;
30
24
  border-radius: 0.25rem;
@@ -35,6 +29,12 @@
35
29
  background-position: center;
36
30
  white-space: nowrap;
37
31
  overflow: hidden;
32
+ vertical-align: middle;
33
+ /* stylelint-disable property-no-vendor-prefix */
34
+ -webkit-user-select: none;
35
+ -ms-user-select: none;
36
+ user-select: none;
37
+ /* stylelint-enable property-no-vendor-prefix */
38
38
  }
39
39
  .avatar:focus-visible {
40
40
  outline: 2px solid rgb(var(--cat-border-color-focus, 0, 113, 255));
@@ -3,28 +3,21 @@
3
3
  */
4
4
  /* stylelint-disable value-keyword-case */
5
5
  /* stylelint-enable value-keyword-case */
6
- :host {
7
- display: inline-block;
8
- max-width: 100%;
9
- vertical-align: baseline;
10
- }
11
-
12
6
  :host([hidden]) {
13
7
  display: none;
14
8
  }
15
9
 
16
- .badge {
17
- font: inherit;
10
+ :host {
18
11
  display: inline-flex;
12
+ max-width: 100%;
13
+ vertical-align: baseline;
19
14
  align-items: center;
20
15
  justify-content: center;
21
- border-radius: 0.125rem;
16
+ border-radius: 0.25rem;
22
17
  text-decoration: none;
23
- box-sizing: border-box;
24
- width: 100%;
25
- line-height: 1;
18
+ line-height: 1.5;
26
19
  }
27
- .badge slot {
20
+ :host slot {
28
21
  display: inline-block;
29
22
  /* stylelint-disable value-no-vendor-prefix, property-no-vendor-prefix */
30
23
  overflow: hidden;
@@ -33,98 +26,99 @@
33
26
  /* stylelint-enable value-no-vendor-prefix, property-no-vendor-prefix */
34
27
  }
35
28
 
36
- .badge-round {
29
+ :host([round]) {
37
30
  border-radius: 10rem;
38
31
  }
39
32
 
40
- .badge-filled {
41
- background-color: rgb(var(--bg));
42
- color: rgb(var(--fill));
33
+ :host([variant=filled]) {
34
+ background-color: rgba(var(--bg), 0.1);
35
+ color: rgb(var(--text));
43
36
  font-weight: 600;
44
37
  -webkit-font-smoothing: antialiased;
45
38
  -moz-osx-font-smoothing: greyscale;
46
39
  }
47
40
 
48
- .badge-outlined {
41
+ :host([variant=outlined]) {
49
42
  background-color: white;
50
43
  box-shadow: inset 0 0 0 1px rgba(var(--border), 0.2);
51
44
  color: rgb(var(--text));
52
45
  }
53
46
 
54
- .badge-primary {
55
- --bg: var(--cat-primary-bg, 32, 127, 138);
47
+ :host([color=primary]) {
48
+ --bg: var(--cat-primary-bg, 0, 129, 148);
56
49
  --fill: var(--cat-primary-fill, 255, 255, 255);
57
- --text: var(--cat-primary-text, 32, 127, 138);
58
- --border: var(--cat-primary-text, 32, 127, 138);
50
+ --text: var(--cat-primary-text, 0, 129, 148);
51
+ --border: var(--cat-primary-text, 0, 129, 148);
59
52
  }
60
53
 
61
- .badge-secondary {
54
+ :host([color=secondary]) {
62
55
  --bg: 105, 118, 135;
63
56
  --fill: 255, 255, 255;
64
57
  --text: 0, 0, 0;
65
58
  --border: 105, 118, 135;
66
59
  }
67
60
 
68
- .badge-success {
61
+ :host([color=success]) {
69
62
  --bg: 0, 132, 88;
70
63
  --fill: 255, 255, 255;
71
64
  --text: 0, 132, 88;
72
65
  --border: 0, 132, 88;
73
66
  }
74
67
 
75
- .badge-warning {
68
+ :host([color=warning]) {
76
69
  --bg: 255, 206, 128;
77
70
  --fill: 0, 0, 0;
78
71
  --text: 159, 97, 0;
79
72
  --border: 159, 97, 0;
80
73
  }
81
74
 
82
- .badge-danger {
75
+ :host([color=danger]) {
83
76
  --bg: 217, 52, 13;
84
77
  --fill: 255, 255, 255;
85
78
  --text: 217, 52, 13;
86
79
  --border: 217, 52, 13;
87
80
  }
88
81
 
89
- .badge-xs {
82
+ :host([size=xs]) {
90
83
  height: 1rem;
91
84
  min-width: 1rem;
92
85
  font-size: 0.75rem;
93
86
  padding: 0 0.25rem;
94
87
  }
95
88
 
96
- .badge-s {
89
+ :host([size=s]) {
97
90
  height: 1.5rem;
98
91
  min-width: 1.5rem;
99
92
  font-size: 0.75rem;
100
93
  padding: 0 0.5rem;
101
94
  }
102
95
 
103
- .badge-m {
96
+ :host([size=m]) {
104
97
  height: 2rem;
105
98
  min-width: 2rem;
106
99
  font-size: 0.875rem;
107
100
  padding: 0 0.75rem;
108
101
  }
109
102
 
110
- .badge-l {
103
+ :host([size=l]) {
111
104
  height: 2.5rem;
112
105
  min-width: 2.5rem;
113
106
  font-size: 0.9375rem;
114
107
  padding: 0 1rem;
115
108
  }
116
109
 
117
- .badge-xl {
110
+ :host([size=xl]) {
118
111
  height: 3rem;
119
112
  min-width: 3rem;
120
113
  font-size: 1.125rem;
121
114
  padding: 0 1rem;
122
115
  }
123
116
 
124
- .badge-pulse.badge-filled {
117
+ :host([pulse][variant=filled]) {
125
118
  animation: 1.5s ease 0s infinite normal none running pulse;
126
119
  }
127
- .badge-pulse.badge-outlined {
120
+
121
+ :host([pulse][variant=outlined]) {
128
122
  animation: 1.5s ease 0s infinite normal none running pulse-outlined;
129
123
  }
130
124
 
@@ -1,9 +1,8 @@
1
- import { Component, h, Prop } from '@stencil/core';
1
+ import { Component, Element, h, Prop } from '@stencil/core';
2
+ import { setPropertyDefault } from '../../utils/setDefault';
2
3
  /**
3
4
  * Badges are used to inform users of the status of an object or of an action
4
5
  * that’s been taken.
5
- *
6
- * @part badge - The badge element.
7
6
  */
8
7
  export class CatBadge {
9
8
  constructor() {
@@ -28,16 +27,13 @@ export class CatBadge {
28
27
  */
29
28
  this.pulse = false;
30
29
  }
30
+ connectedCallback() {
31
+ setPropertyDefault(this, 'variant');
32
+ setPropertyDefault(this, 'color');
33
+ setPropertyDefault(this, 'size');
34
+ }
31
35
  render() {
32
- return (h("span", { part: "badge", class: {
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
- } },
40
- h("slot", null)));
36
+ return h("slot", null);
41
37
  }
42
38
  static get is() { return "cat-badge"; }
43
39
  static get encapsulation() { return "shadow"; }
@@ -139,5 +135,6 @@ export class CatBadge {
139
135
  "defaultValue": "false"
140
136
  }
141
137
  }; }
138
+ static get elementRef() { return "hostElement"; }
142
139
  }
143
140
  //# sourceMappingURL=cat-badge.js.map
@@ -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;;;;;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"]}
1
+ {"version":3,"file":"cat-badge.js","sourceRoot":"","sources":["../../../src/components/cat-badge/cat-badge.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D;;;GAGG;AAMH,MAAM,OAAO,QAAQ;EALrB;IAQE;;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;GAWvB;EATC,iBAAiB;IACf,kBAAkB,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IACpC,kBAAkB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAClC,kBAAkB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;EACnC,CAAC;EAED,MAAM;IACJ,OAAO,eAAa,CAAC;EACvB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, h, Prop } from '@stencil/core';\nimport { setPropertyDefault } from '../../utils/setDefault';\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@Component({\n tag: 'cat-badge',\n styleUrl: 'cat-badge.scss',\n shadow: true\n})\nexport class CatBadge {\n @Element() hostElement!: HTMLElement;\n\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 connectedCallback() {\n setPropertyDefault(this, 'variant');\n setPropertyDefault(this, 'color');\n setPropertyDefault(this, 'size');\n }\n\n render() {\n return <slot></slot>;\n }\n}\n"]}
@@ -82,7 +82,7 @@
82
82
  box-shadow: inset 0 0 0 1px rgba(var(--base), 0.2);
83
83
  color: rgb(var(--text));
84
84
  }
85
- .cat-button-outlined:hover:not(.cat-button-disabled):not(.cat-button-loading) {
85
+ .cat-button-outlined:hover:not(.cat-button-disabled):not(.cat-button-loading), .cat-button-outlined.cat-button-active:not(.cat-button-disabled):not(.cat-button-loading) {
86
86
  background-color: rgba(var(--base), 0.05);
87
87
  }
88
88
  .cat-button-outlined:active:not(.cat-button-disabled):not(.cat-button-loading) {
@@ -94,26 +94,26 @@
94
94
  color: rgb(var(--text));
95
95
  text-decoration: none;
96
96
  }
97
- .cat-button-text:hover:not(.cat-button-disabled):not(.cat-button-loading) {
97
+ .cat-button-text:hover:not(.cat-button-disabled):not(.cat-button-loading), .cat-button-text.cat-button-active:not(.cat-button-disabled):not(.cat-button-loading) {
98
98
  text-decoration: none;
99
99
  background-color: rgba(var(--base), 0.05);
100
100
  }
101
101
 
102
102
  .cat-button-primary {
103
- --bg: var(--cat-primary-bg, 32, 127, 138);
103
+ --bg: var(--cat-primary-bg, 0, 129, 148);
104
104
  --fill: var(--cat-primary-fill, 255, 255, 255);
105
- --text: var(--cat-primary-text, 32, 127, 138);
106
- --base: var(--cat-primary-text, 32, 127, 138);
105
+ --text: var(--cat-primary-text, 0, 129, 148);
106
+ --base: var(--cat-primary-text, 0, 129, 148);
107
107
  }
108
108
  .cat-button-primary:hover:not(.cat-button-disabled):not(.cat-button-loading) {
109
- --bg: var(--cat-primary-bg-hover, 28, 112, 122);
109
+ --bg: var(--cat-primary-bg-hover, 1, 115, 132);
110
110
  --fill: var(--cat-primary-fill-hover, 255, 255, 255);
111
- --text: var(--cat-primary-text-hover, 28, 112, 122);
111
+ --text: var(--cat-primary-text-hover, 1, 115, 132);
112
112
  }
113
- .cat-button-primary:active:not(.cat-button-disabled):not(.cat-button-loading) {
114
- --bg: var(--cat-primary-bg-active, 25, 101, 110);
113
+ .cat-button-primary.cat-button-active:not(.cat-button-disabled):not(.cat-button-loading), .cat-button-primary:active:not(.cat-button-disabled):not(.cat-button-loading) {
114
+ --bg: var(--cat-primary-bg-active, 2, 83, 113);
115
115
  --fill: var(--cat-primary-fill-active, 255, 255, 255);
116
- --text: var(--cat-primary-text-active, 25, 101, 110);
116
+ --text: var(--cat-primary-text-active, 2, 83, 113);
117
117
  }
118
118
 
119
119
  .cat-button-secondary {
@@ -127,7 +127,7 @@
127
127
  --fill: 255, 255, 255;
128
128
  --text: 0, 0, 0;
129
129
  }
130
- .cat-button-secondary:active:not(.cat-button-disabled):not(.cat-button-loading) {
130
+ .cat-button-secondary.cat-button-active:not(.cat-button-disabled):not(.cat-button-loading), .cat-button-secondary:active:not(.cat-button-disabled):not(.cat-button-loading) {
131
131
  --bg: 105, 118, 135;
132
132
  --fill: 255, 255, 255;
133
133
  --text: 0, 0, 0;
@@ -144,7 +144,7 @@
144
144
  --fill: 255, 255, 255;
145
145
  --text: 0, 117, 78;
146
146
  }
147
- .cat-button-success:active:not(.cat-button-disabled):not(.cat-button-loading) {
147
+ .cat-button-success.cat-button-active:not(.cat-button-disabled):not(.cat-button-loading), .cat-button-success:active:not(.cat-button-disabled):not(.cat-button-loading) {
148
148
  --bg: 0, 105, 70;
149
149
  --fill: 255, 255, 255;
150
150
  --text: 0, 105, 70;
@@ -161,7 +161,7 @@
161
161
  --fill: 0, 0, 0;
162
162
  --text: 159, 97, 0;
163
163
  }
164
- .cat-button-warning:active:not(.cat-button-disabled):not(.cat-button-loading) {
164
+ .cat-button-warning.cat-button-active:not(.cat-button-disabled):not(.cat-button-loading), .cat-button-warning:active:not(.cat-button-disabled):not(.cat-button-loading) {
165
165
  --bg: 255, 222, 168;
166
166
  --fill: 0, 0, 0;
167
167
  --text: 159, 97, 0;
@@ -178,7 +178,7 @@
178
178
  --fill: 255, 255, 255;
179
179
  --text: 194, 46, 11;
180
180
  }
181
- .cat-button-danger:active:not(.cat-button-disabled):not(.cat-button-loading) {
181
+ .cat-button-danger.cat-button-active:not(.cat-button-disabled):not(.cat-button-loading), .cat-button-danger:active:not(.cat-button-disabled):not(.cat-button-loading) {
182
182
  --bg: 174, 42, 10;
183
183
  --fill: 255, 255, 255;
184
184
  --text: 174, 42, 10;
@@ -219,7 +219,6 @@
219
219
  padding: 0.25rem 0.25rem;
220
220
  font-size: 0.875rem;
221
221
  line-height: 1rem;
222
- font-weight: var(--cat-font-weight-body, 400);
223
222
  }
224
223
  .cat-button-xs .cat-button-prefix {
225
224
  margin-right: 0.25rem;
@@ -272,7 +271,6 @@
272
271
  padding: 0.375rem 0.5rem;
273
272
  font-size: 0.9375rem;
274
273
  line-height: 1.25rem;
275
- font-weight: var(--cat-font-weight-body, 400);
276
274
  }
277
275
  .cat-button-s .cat-button-prefix {
278
276
  margin-right: 0.25rem;
@@ -329,7 +327,6 @@
329
327
  padding: 0.625rem 0.75rem;
330
328
  font-size: 0.9375rem;
331
329
  line-height: 1.25rem;
332
- font-weight: var(--cat-font-weight-body, 400);
333
330
  }
334
331
  .cat-button-m .cat-button-prefix {
335
332
  margin-right: 0.25rem;
@@ -386,7 +383,6 @@
386
383
  padding: 0.875rem 1rem;
387
384
  font-size: 0.9375rem;
388
385
  line-height: 1.25rem;
389
- font-weight: var(--cat-font-weight-body, 400);
390
386
  }
391
387
  .cat-button-l .cat-button-prefix {
392
388
  margin-right: 0.25rem;
@@ -443,7 +439,6 @@
443
439
  padding: 1rem 1.25rem;
444
440
  font-size: 1.125rem;
445
441
  line-height: 1.5rem;
446
- font-weight: var(--cat-font-weight-body, 400);
447
442
  }
448
443
  .cat-button-xl .cat-button-prefix {
449
444
  margin-right: 0.25rem;
@@ -491,17 +486,6 @@
491
486
  margin-right: -1.25rem;
492
487
  }
493
488
 
494
- .cat-button-active::before {
495
- content: "";
496
- display: block;
497
- position: absolute;
498
- top: 0;
499
- left: 0;
500
- width: 0.25rem;
501
- height: 100%;
502
- background: rgb(var(--base));
503
- }
504
-
505
489
  :host-context(nav) {
506
490
  width: 100%;
507
491
  }
@@ -23,7 +23,7 @@ export class CatButton {
23
23
  */
24
24
  this.color = 'secondary';
25
25
  /**
26
- * Show an active status indicator on the left side of the button.
26
+ * Set the button into an active state.
27
27
  */
28
28
  this.active = false;
29
29
  /**
@@ -234,7 +234,7 @@ export class CatButton {
234
234
  "optional": false,
235
235
  "docs": {
236
236
  "tags": [],
237
- "text": "Show an active status indicator on the left side of the button."
237
+ "text": "Set the button into an active state."
238
238
  },
239
239
  "attribute": "active",
240
240
  "reflect": false,
@@ -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;;;;;;;;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,eAAU,GAAG,KAAK,CAAC;IAE3B;;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;IAC7E,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC;IAChC,IAAI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, 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 * Disables ellipse overflowing button content.\n */\n @Prop() noEllipsis = false;\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.noEllipsis && !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.noEllipsis && !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"]}
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,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AI,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, 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. 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 * Set the button into an active state.\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 * Disables ellipse overflowing button content.\n */\n @Prop() noEllipsis = false;\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.noEllipsis && !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.noEllipsis && !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"]}
@@ -1,12 +1,11 @@
1
- import { Component, Host, h } from '@stencil/core';
1
+ import { Component, h } from '@stencil/core';
2
2
  /**
3
3
  * Cards are surfaces that display content and actions on a single topic. They
4
4
  * should be easy to scan for relevant and actionable information.
5
5
  */
6
6
  export class CatCard {
7
7
  render() {
8
- return (h(Host, null,
9
- h("slot", null)));
8
+ return h("slot", null);
10
9
  }
11
10
  static get is() { return "cat-card"; }
12
11
  static get encapsulation() { return "shadow"; }
@@ -1 +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"]}
1
+ {"version":3,"file":"cat-card.js","sourceRoot":"","sources":["../../../src/components/cat-card/cat-card.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAE7C;;;GAGG;AAMH,MAAM,OAAO,OAAO;EAClB,MAAM;IACJ,OAAO,eAAa,CAAC;EACvB,CAAC;;;;;;;;;CACF","sourcesContent":["import { Component, 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 <slot></slot>;\n }\n}\n"]}
@@ -93,16 +93,16 @@ input {
93
93
  transform: translate(-50%, -50%) scale(0.99);
94
94
  }
95
95
  :checked + .box {
96
- background-color: rgb(var(--cat-primary-bg, 32, 127, 138));
97
- border-color: rgb(var(--cat-primary-bg, 32, 127, 138));
96
+ background-color: rgb(var(--cat-primary-bg, 0, 129, 148));
97
+ border-color: rgb(var(--cat-primary-bg, 0, 129, 148));
98
98
  stroke: rgb(var(--cat-primary-fill, 255, 255, 255));
99
99
  }
100
100
  :checked + .box .check {
101
101
  stroke-dashoffset: 0;
102
102
  }
103
103
  :indeterminate + .box {
104
- background-color: rgb(var(--cat-primary-bg, 32, 127, 138));
105
- border-color: rgb(var(--cat-primary-bg, 32, 127, 138));
104
+ background-color: rgb(var(--cat-primary-bg, 0, 129, 148));
105
+ border-color: rgb(var(--cat-primary-bg, 0, 129, 148));
106
106
  stroke: rgb(var(--cat-primary-fill, 255, 255, 255));
107
107
  }
108
108
  :indeterminate + .box .dash {
@@ -54,7 +54,7 @@ label {
54
54
  position: absolute;
55
55
  width: 0.75rem;
56
56
  height: 0.75rem;
57
- background-color: rgb(var(--cat-primary-bg, 32, 127, 138));
57
+ background-color: rgb(var(--cat-primary-bg, 0, 129, 148));
58
58
  border-radius: 10rem;
59
59
  top: calc(50% - 0.375rem);
60
60
  left: calc(50% - 0.375rem);
@@ -73,7 +73,7 @@ input {
73
73
  cursor: inherit;
74
74
  }
75
75
  input:checked {
76
- border-color: rgb(var(--cat-primary-bg, 32, 127, 138));
76
+ border-color: rgb(var(--cat-primary-bg, 0, 129, 148));
77
77
  }
78
78
  input:checked + .circle {
79
79
  visibility: visible;
@@ -134,6 +134,7 @@ label.hidden {
134
134
  .pill > span {
135
135
  overflow: hidden;
136
136
  text-overflow: ellipsis;
137
+ flex: 1 1 0%;
137
138
  }
138
139
  .pill > cat-button {
139
140
  margin-right: -0.25rem;
@@ -193,6 +194,10 @@ cat-spinner {
193
194
  --cat-avatar-size: 1.25rem;
194
195
  }
195
196
 
197
+ .select-option-text {
198
+ flex: 1 1 0%;
199
+ }
200
+
196
201
  .select-option-single {
197
202
  cursor: pointer;
198
203
  }
@@ -182,6 +182,11 @@ export class CatSelect {
182
182
  if (this.state.activeSelectionIndex >= 0) {
183
183
  this.deselect(this.state.selection[this.state.activeSelectionIndex].item.id);
184
184
  }
185
+ else if (this.state.selection.length) {
186
+ const selectionClone = [...this.state.selection];
187
+ selectionClone.pop();
188
+ this.patchState({ selection: selectionClone });
189
+ }
185
190
  }
186
191
  }
187
192
  else if (event.key === 'Tab') {
@@ -236,7 +241,7 @@ export class CatSelect {
236
241
  .subscribe(items => {
237
242
  var _a;
238
243
  const options = items === null || items === void 0 ? void 0 : items.map(item => ({
239
- item,
244
+ item: Object.assign(Object.assign({}, item), { id: this.connectorSafe.customId ? this.connectorSafe.customId(item) : item.id }),
240
245
  render: this.connectorSafe.render(item)
241
246
  }));
242
247
  if (this.tags &&