@roadtrip/components 3.41.1 → 3.42.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 (51) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/road-alert.cjs.entry.js +1 -1
  3. package/dist/cjs/road-alert.cjs.entry.js.map +1 -1
  4. package/dist/cjs/road-badge_14.cjs.entry.js +1613 -13
  5. package/dist/cjs/road-badge_14.cjs.entry.js.map +1 -1
  6. package/dist/cjs/road-card.cjs.entry.js +46 -16
  7. package/dist/cjs/road-card.cjs.entry.js.map +1 -1
  8. package/dist/cjs/roadtrip.cjs.js +1 -1
  9. package/dist/collection/components/alert/alert.css +1 -1
  10. package/dist/collection/components/button/button.css +75 -5
  11. package/dist/collection/components/button/button.js +26 -1
  12. package/dist/collection/components/button/button.js.map +1 -1
  13. package/dist/collection/components/button/button.stories.js +67 -0
  14. package/dist/collection/components/card/card.css +58 -11
  15. package/dist/collection/components/card/card.js +90 -20
  16. package/dist/collection/components/card/card.js.map +1 -1
  17. package/dist/collection/components/card/card.stories.js +330 -75
  18. package/dist/collection/components/drawer/drawer.css +0 -3
  19. package/dist/collection/components/drawer/drawer.js +31 -10
  20. package/dist/collection/components/drawer/drawer.js.map +1 -1
  21. package/dist/esm/loader.js +1 -1
  22. package/dist/esm/road-alert.entry.js +1 -1
  23. package/dist/esm/road-alert.entry.js.map +1 -1
  24. package/dist/esm/road-badge_14.entry.js +1613 -13
  25. package/dist/esm/road-badge_14.entry.js.map +1 -1
  26. package/dist/esm/road-card.entry.js +46 -16
  27. package/dist/esm/road-card.entry.js.map +1 -1
  28. package/dist/esm/roadtrip.js +1 -1
  29. package/dist/html.html-data.json +12 -0
  30. package/dist/roadtrip/p-24ea87a9.entry.js +18 -0
  31. package/dist/roadtrip/p-24ea87a9.entry.js.map +1 -0
  32. package/dist/roadtrip/p-294a4a83.entry.js +2 -0
  33. package/dist/roadtrip/p-294a4a83.entry.js.map +1 -0
  34. package/dist/roadtrip/p-d89d49b2.entry.js +2 -0
  35. package/dist/roadtrip/p-d89d49b2.entry.js.map +1 -0
  36. package/dist/roadtrip/roadtrip.css +1 -1
  37. package/dist/roadtrip/roadtrip.esm.js +1 -1
  38. package/dist/roadtrip/roadtrip.esm.js.map +1 -1
  39. package/dist/types/components/button/button.d.ts +4 -0
  40. package/dist/types/components/card/card.d.ts +15 -5
  41. package/dist/types/components/drawer/drawer.d.ts +9 -4
  42. package/dist/types/components.d.ts +28 -4
  43. package/hydrate/index.js +1764 -130
  44. package/hydrate/index.mjs +1764 -130
  45. package/package.json +5 -4
  46. package/dist/roadtrip/p-07db2ee1.entry.js +0 -10
  47. package/dist/roadtrip/p-07db2ee1.entry.js.map +0 -1
  48. package/dist/roadtrip/p-36f8563a.entry.js +0 -2
  49. package/dist/roadtrip/p-36f8563a.entry.js.map +0 -1
  50. package/dist/roadtrip/p-4182495e.entry.js +0 -2
  51. package/dist/roadtrip/p-4182495e.entry.js.map +0 -1
@@ -18,6 +18,7 @@
18
18
  background: var(--road-surface);
19
19
  border: 1px solid var(--road-outline-weak);
20
20
  border-radius: var(--road-spacing-02);
21
+ padding: var(--road-spacing-03);
21
22
  }
22
23
 
23
24
  :host(.card-elevation-none) {
@@ -32,6 +33,63 @@
32
33
  box-shadow: var(--road-elevation-average);
33
34
  }
34
35
 
36
+ /*
37
+ * Card as a button (interactivity in Figma)
38
+ */
39
+
40
+ :host(.is-button) {
41
+ border: 1px solid var(--road-outline);
42
+ }
43
+
44
+ :host(.is-button:hover) {
45
+ border: 1px solid var(--road-outline-variant);
46
+ outline: 2px solid var(--road-button-ghost-variant);
47
+ }
48
+
49
+ :host(.is-button:focus-visible),
50
+ :host(.is-button:focus) {
51
+ border: 1px solid var(--road-outline);
52
+ outline-offset: 1px;
53
+ outline: 2px solid var(--road-outline-variant);
54
+ }
55
+
56
+ :host(.is-button.is-disabled) {
57
+ cursor: not-allowed;
58
+ pointer-events: none;
59
+ border: 1px solid var(--road-surface-disabled);
60
+ background: var(--road-surface-disabled);
61
+ }
62
+
63
+ :host(.is-button.is-disabled) .card-native,
64
+ :host(.is-button.selected.is-disabled) .card-native {
65
+ background: none;
66
+ }
67
+
68
+ :host(.is-button.selected) {
69
+ border: 2px solid var(--road-primary);
70
+ outline: none;
71
+ }
72
+
73
+ :host(.is-button.selected:hover) {
74
+ border: 2px solid var(--road-outline-variant);
75
+ outline: 2px solid var(--road-button-ghost-variant);
76
+ }
77
+
78
+ :host(.is-button.selected:focus-visible),
79
+ :host(.is-button.selected:focus) {
80
+ border: 2px solid var(--road-outline-variant);
81
+ outline-offset: 1px;
82
+ outline: 2px solid var(--road-outline-variant);
83
+ }
84
+
85
+ :host(.is-button.selected.is-disabled) {
86
+ cursor: not-allowed;
87
+ pointer-events: none;
88
+ outline: none;
89
+ background: var(--road-surface-disabled);
90
+ border: 2px solid var(--road-surface-disabled);
91
+ }
92
+
35
93
  /* NATIVE
36
94
  -------------------- */
37
95
 
@@ -61,17 +119,6 @@
61
119
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
62
120
  }
63
121
 
64
- .card-native:focus{
65
- border: 1px solid var(--road-primary);
66
- }
67
-
68
- /* @media (min-width: 768px) {
69
-
70
- .card-native {
71
- padding: var(--road-spacing-06);
72
- }
73
- } */
74
-
75
122
  a,
76
123
  button {
77
124
  cursor: pointer;
@@ -1,4 +1,4 @@
1
- import { h, Host } from "@stencil/core";
1
+ import { h, Host, } from "@stencil/core";
2
2
  /**
3
3
  * @slot - Content of the card.
4
4
  *
@@ -7,45 +7,71 @@ import { h, Host } from "@stencil/core";
7
7
  export class Card {
8
8
  constructor() {
9
9
  /**
10
- * The elevation.
11
- */
12
- this.elevation = 'none';
10
+ * The elevation.
11
+ */
12
+ this.elevation = "none";
13
13
  /**
14
14
  * If `true`, a button tag will be rendered and the card will be tappable.
15
15
  */
16
16
  this.button = false;
17
+ /**
18
+ * If `true`, the card has the `selected` state and the `selected` class is applied on the host.
19
+ * Toggled automatically when the card is clicked (when clickable).
20
+ */
21
+ this.selected = false;
22
+ /**
23
+ * If `true`, the card is disabled and cannot be clicked.
24
+ * Only applies when in button mode (button=true and no href).
25
+ */
26
+ this.disabled = false;
17
27
  /**
18
28
  * The type of the button. Only used when an `onclick` or `button` property is present.
19
29
  */
20
- this.type = 'button';
21
- this.onClick = () => {
30
+ this.type = "button";
31
+ this.onClick = (e) => {
22
32
  var _a, _b;
33
+ // If disabled in button mode, prevent all interactions
34
+ const isButtonMode = this.button && this.href === undefined;
35
+ if (isButtonMode && this.disabled) {
36
+ e.preventDefault();
37
+ e.stopPropagation();
38
+ return;
39
+ }
40
+ // Toggle selected state on click for clickable cards
41
+ this.selected = !this.selected;
23
42
  if (this.value !== undefined) {
24
43
  this.roadcardclick.emit({
25
44
  value: this.value,
26
- label: (_a = this.el.querySelector('road-label')) === null || _a === void 0 ? void 0 : _a.textContent,
45
+ label: (_a = this.el.querySelector("road-label")) === null || _a === void 0 ? void 0 : _a.textContent,
27
46
  });
28
47
  this.roadCardClick.emit({
29
48
  value: this.value,
30
- label: (_b = this.el.querySelector('road-label')) === null || _b === void 0 ? void 0 : _b.textContent,
49
+ label: (_b = this.el.querySelector("road-label")) === null || _b === void 0 ? void 0 : _b.textContent,
31
50
  });
32
51
  }
33
52
  };
34
53
  }
35
54
  isClickable() {
36
- return (this.href !== undefined || this.button);
55
+ return this.href !== undefined || this.button;
37
56
  }
38
57
  renderCard() {
39
58
  const clickable = this.isClickable();
40
59
  if (!clickable) {
41
- return [
42
- h("slot", null)
43
- ];
60
+ return [h("slot", null)];
44
61
  }
45
62
  const { href } = this;
46
- const TagType = clickable ? (href === undefined ? 'button' : 'a') : 'div';
47
- const attrs = (TagType === 'button')
48
- ? { type: this.type }
63
+ const TagType = clickable
64
+ ? href === undefined
65
+ ? "button"
66
+ : "a"
67
+ : "div";
68
+ const isButtonMode = this.button && href === undefined;
69
+ const attrs = TagType === "button"
70
+ ? {
71
+ type: this.type,
72
+ disabled: isButtonMode && this.disabled,
73
+ "aria-disabled": isButtonMode && this.disabled ? "true" : undefined,
74
+ }
49
75
  : {
50
76
  download: this.download,
51
77
  href: this.href,
@@ -56,8 +82,12 @@ export class Card {
56
82
  }
57
83
  render() {
58
84
  const { elevation } = this;
85
+ const isButtonMode = this.button && this.href === undefined;
59
86
  const elevationClass = this.elevation ? `card-elevation-${elevation}` : ``;
60
- return (h(Host, { key: 'f5bd5b9245b805dbd174a96b76b349af87e4e938', class: `${elevationClass}` }, this.renderCard()));
87
+ const selectedClass = this.selected ? "selected" : "";
88
+ const isButtonClass = isButtonMode ? "is-button" : "";
89
+ const disabledClass = isButtonMode && this.disabled ? "is-disabled" : "";
90
+ return (h(Host, { key: '5ef381ca3d9d8028cc1e3a10cc06511602964437', class: `${elevationClass} ${selectedClass} ${isButtonClass} ${disabledClass}` }, this.renderCard()));
61
91
  }
62
92
  static get is() { return "road-card"; }
63
93
  static get encapsulation() { return "shadow"; }
@@ -77,7 +107,7 @@ export class Card {
77
107
  "type": "string",
78
108
  "mutable": false,
79
109
  "complexType": {
80
- "original": "'none' | 'lowest' | 'average'",
110
+ "original": "\"none\" | \"lowest\" | \"average\"",
81
111
  "resolved": "\"average\" | \"lowest\" | \"none\" | undefined",
82
112
  "references": {}
83
113
  },
@@ -91,7 +121,7 @@ export class Card {
91
121
  "setter": false,
92
122
  "attribute": "elevation",
93
123
  "reflect": false,
94
- "defaultValue": "'none'"
124
+ "defaultValue": "\"none\""
95
125
  },
96
126
  "button": {
97
127
  "type": "boolean",
@@ -132,11 +162,51 @@ export class Card {
132
162
  "attribute": "value",
133
163
  "reflect": false
134
164
  },
165
+ "selected": {
166
+ "type": "boolean",
167
+ "mutable": false,
168
+ "complexType": {
169
+ "original": "boolean",
170
+ "resolved": "boolean",
171
+ "references": {}
172
+ },
173
+ "required": false,
174
+ "optional": false,
175
+ "docs": {
176
+ "tags": [],
177
+ "text": "If `true`, the card has the `selected` state and the `selected` class is applied on the host.\nToggled automatically when the card is clicked (when clickable)."
178
+ },
179
+ "getter": false,
180
+ "setter": false,
181
+ "attribute": "selected",
182
+ "reflect": true,
183
+ "defaultValue": "false"
184
+ },
185
+ "disabled": {
186
+ "type": "boolean",
187
+ "mutable": false,
188
+ "complexType": {
189
+ "original": "boolean",
190
+ "resolved": "boolean",
191
+ "references": {}
192
+ },
193
+ "required": false,
194
+ "optional": false,
195
+ "docs": {
196
+ "tags": [],
197
+ "text": "If `true`, the card is disabled and cannot be clicked.\nOnly applies when in button mode (button=true and no href)."
198
+ },
199
+ "getter": false,
200
+ "setter": false,
201
+ "attribute": "disabled",
202
+ "reflect": true,
203
+ "defaultValue": "false"
204
+ },
135
205
  "type": {
136
206
  "type": "string",
137
207
  "mutable": false,
138
208
  "complexType": {
139
- "original": "'submit' | 'reset' | 'button'",
209
+ "original": "\"submit\" | \"reset\" | \"button\"",
140
210
  "resolved": "\"button\" | \"reset\" | \"submit\"",
141
211
  "references": {}
142
212
  },
@@ -150,7 +220,7 @@ export class Card {
150
220
  "setter": false,
151
221
  "attribute": "type",
152
222
  "reflect": false,
153
- "defaultValue": "'button'"
223
+ "defaultValue": "\"button\""
154
224
  },
155
225
  "download": {
156
226
  "type": "string",
@@ -1 +1 @@
1
- {"version":3,"file":"card.js","sourceRoot":"","sources":["../../../src/components/card/card.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAgB,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAEvF;;;;GAIG;AAOH,MAAM,OAAO,IAAI;IALjB;QASI;;SAEC;QACO,cAAS,GAAmC,MAAM,CAAC;QAE7D;;WAEG;QACK,WAAM,GAAY,KAAK,CAAC;QAOhC;;WAEG;QACK,SAAI,GAAkC,QAAQ,CAAC;QA8C/C,YAAO,GAAG,GAAG,EAAE;;YACrB,IAAG,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;gBAC5B,IAAI,CAAC,aAAa,CA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,OAAO,EAAE,IAAI,CAAC,OAAO;YAErB,eAAO,CACC,CACX,CAAC;IACJ,CAAC;IAED,MAAM;QACJ,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;QAC3B,MAAM,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,kBAAkB,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3E,OAAO,CACL,EAAC,IAAI,qDAAC,KAAK,EAAE,GAAG,cAAc,EAAE,IAC/B,IAAI,CAAC,UAAU,EAAE,CACX,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEF","sourcesContent":["import { Component, h, Prop, Event, EventEmitter, Element, Host } from '@stencil/core';\n\n/**\n * @slot - Content of the card.\n *\n * @part native - The native HTML button, anchor, or div element that wraps all child elements.\n */\n\n@Component({\n tag: 'road-card',\n styleUrl: 'card.css',\n shadow: true,\n})\nexport class Card {\n\n @Element() el!: HTMLRoadCardElement;\n\n /**\n * The elevation.\n */\n @Prop() elevation?: 'none' | 'lowest' | 'average' = 'none';\n\n /**\n * If `true`, a button tag will be rendered and the card will be tappable.\n */\n @Prop() button: boolean = false;\n\n /**\n * value of the card\n */\n @Prop() value?: string;\n\n /**\n * The type of the button. Only used when an `onclick` or `button` property is present.\n */\n @Prop() type: 'submit' | 'reset' | 'button' = 'button';\n\n /**\n * This attribute instructs browsers to download a URL instead of navigating to\n * it, so the user will be prompted to save it as a local file. If the attribute\n * has a value, it is used as the pre-filled file name in the Save prompt\n * (the user can still change the file name if they want).\n */\n @Prop() download?: string;\n\n /**\n * Contains a URL or a URL fragment that the hyperlink points to.\n * If this property is set, an anchor tag will be rendered.\n */\n @Prop() href?: string;\n\n /**\n * Specifies the relationship of the target object to the link object.\n * The value is a space-separated list of [link types](https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types).\n */\n @Prop() rel?: string;\n\n /**\n * Specifies where to display the linked URL.\n * Only applies when an `href` is provided.\n * Special keywords: `\"_blank\"`, `\"_self\"`, `\"_parent\"`, `\"_top\"`.\n */\n @Prop() target?: string;\n\n /**\n * Emitted when the card is clicked and send the `value` of the card\n */\n @Event() roadcardclick!: EventEmitter<{\n value: string | undefined | null;\n label: string | undefined | null;\n }>;\n /** @internal */\n @Event() roadCardClick!: EventEmitter<{\n value: string | undefined | null;\n label: string | undefined | null;\n }>;\n\n private isClickable(): boolean {\n return (this.href !== undefined || this.button);\n }\n\n private onClick = () => {\n if(this.value !== undefined) {\n this.roadcardclick.emit({\n value: this.value,\n label: this.el.querySelector('road-label')?.textContent,\n });\n this.roadCardClick.emit({\n value: this.value,\n label: this.el.querySelector('road-label')?.textContent,\n });\n }\n };\n\n private renderCard() {\n const clickable = this.isClickable();\n\n if (!clickable) {\n \n \n return [\n <slot/>\n ];\n \n }\n const { href } = this;\n const TagType = clickable ? (href === undefined ? 'button' : 'a') : 'div' as any;\n const attrs = (TagType === 'button')\n ? { type: this.type }\n : {\n download: this.download,\n href: this.href,\n rel: this.rel,\n target: this.target,\n };\n\n return (\n \n <TagType\n {...attrs}\n class=\"card-native\"\n part=\"native\"\n onClick={this.onClick}\n >\n <slot/>\n </TagType>\n );\n }\n\n render() {\n const { elevation } = this;\n const elevationClass = this.elevation ? `card-elevation-${elevation}` : ``;\n return (\n <Host class={`${elevationClass}`}>\n {this.renderCard()}\n </Host>\n );\n }\n\n}\n"]}
1
+ {"version":3,"file":"card.js","sourceRoot":"","sources":["../../../src/components/card/card.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,CAAC,EACD,IAAI,EACJ,KAAK,EAEL,OAAO,EACP,IAAI,GACL,MAAM,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CAAC,CAAC,EAAE,CAAC;QAC3E,MAAM,aAAa,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;QACtD,MAAM,aAAa,GAAG,YAAY,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;QACtD,MAAM,aAAa,GAAG,YAAY,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC;QACzE,OAAO,CACL,EAAC,IAAI,qDACH,KAAK,EAAE,GAAG,cAAc,IAAI,aAAa,IAAI,aAAa,IAAI,aAAa,EAAE,IAE5E,IAAI,CAAC,UAAU,EAAE,CACb,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n h,\n Prop,\n Event,\n EventEmitter,\n Element,\n Host,\n} from \"@stencil/core\";\n\n/**\n * @slot - Content of the card.\n *\n * @part native - The native HTML button, anchor, or div element that wraps all child elements.\n */\n\n@Component({\n tag: \"road-card\",\n styleUrl: \"card.css\",\n shadow: true,\n})\nexport class Card {\n @Element() el!: HTMLRoadCardElement;\n\n /**\n * The elevation.\n */\n @Prop() elevation?: \"none\" | \"lowest\" | \"average\" = \"none\";\n\n /**\n * If `true`, a button tag will be rendered and the card will be tappable.\n */\n @Prop() button: boolean = false;\n\n /**\n * value of the card\n */\n @Prop() value?: string;\n\n /**\n * If `true`, the card has the `selected` state and the `selected` class is applied on the host.\n * Toggled automatically when the card is clicked (when clickable).\n */\n @Prop({ reflect: true }) selected: boolean = false;\n\n /**\n * If `true`, the card is disabled and cannot be clicked.\n * Only applies when in button mode (button=true and no href).\n */\n @Prop({ reflect: true }) disabled: boolean = false;\n\n /**\n * The type of the button. Only used when an `onclick` or `button` property is present.\n */\n @Prop() type: \"submit\" | \"reset\" | \"button\" = \"button\";\n\n /**\n * This attribute instructs browsers to download a URL instead of navigating to\n * it, so the user will be prompted to save it as a local file. If the attribute\n * has a value, it is used as the pre-filled file name in the Save prompt\n * (the user can still change the file name if they want).\n */\n @Prop() download?: string;\n\n /**\n * Contains a URL or a URL fragment that the hyperlink points to.\n * If this property is set, an anchor tag will be rendered.\n */\n @Prop() href?: string;\n\n /**\n * Specifies the relationship of the target object to the link object.\n * The value is a space-separated list of [link types](https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types).\n */\n @Prop() rel?: string;\n\n /**\n * Specifies where to display the linked URL.\n * Only applies when an `href` is provided.\n * Special keywords: `\"_blank\"`, `\"_self\"`, `\"_parent\"`, `\"_top\"`.\n */\n @Prop() target?: string;\n\n /**\n * Emitted when the card is clicked and send the `value` of the card\n */\n @Event() roadcardclick!: EventEmitter<{\n value: string | undefined | null;\n label: string | undefined | null;\n }>;\n /** @internal */\n @Event() roadCardClick!: EventEmitter<{\n value: string | undefined | null;\n label: string | undefined | null;\n }>;\n\n private isClickable(): boolean {\n return this.href !== undefined || this.button;\n }\n\n private onClick = (e: Event) => {\n // If disabled in button mode, prevent all interactions\n const isButtonMode = this.button && this.href === undefined;\n if (isButtonMode && this.disabled) {\n e.preventDefault();\n e.stopPropagation();\n return;\n }\n\n // Toggle selected state on click for clickable cards\n this.selected = !this.selected;\n\n if (this.value !== undefined) {\n this.roadcardclick.emit({\n value: this.value,\n label: this.el.querySelector(\"road-label\")?.textContent,\n });\n this.roadCardClick.emit({\n value: this.value,\n label: this.el.querySelector(\"road-label\")?.textContent,\n });\n }\n };\n\n private renderCard() {\n const clickable = this.isClickable();\n\n if (!clickable) {\n return [<slot />];\n }\n const { href } = this;\n const TagType = clickable\n ? href === undefined\n ? \"button\"\n : \"a\"\n : (\"div\" as any);\n const isButtonMode = this.button && href === undefined;\n const attrs =\n TagType === \"button\"\n ? {\n type: this.type,\n disabled: isButtonMode && this.disabled,\n \"aria-disabled\": isButtonMode && this.disabled ? \"true\" : undefined,\n }\n : {\n download: this.download,\n href: this.href,\n rel: this.rel,\n target: this.target,\n };\n\n return (\n <TagType\n {...attrs}\n class=\"card-native\"\n part=\"native\"\n onClick={this.onClick}\n >\n <slot />\n </TagType>\n );\n }\n\n render() {\n const { elevation } = this;\n const isButtonMode = this.button && this.href === undefined;\n const elevationClass = this.elevation ? `card-elevation-${elevation}` : ``;\n const selectedClass = this.selected ? \"selected\" : \"\";\n const isButtonClass = isButtonMode ? \"is-button\" : \"\";\n const disabledClass = isButtonMode && this.disabled ? \"is-disabled\" : \"\";\n return (\n <Host\n class={`${elevationClass} ${selectedClass} ${isButtonClass} ${disabledClass}`}\n >\n {this.renderCard()}\n </Host>\n );\n }\n}\n"]}