@vaadin/card 25.0.0-alpha1 → 25.0.0-alpha11

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/README.md CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  A visual content container.
4
4
 
5
- > ⚠️ This component is experimental and the API may change. In order to use it, enable the feature flag by setting `window.Vaadin.featureFlags.cardComponent = true`.
6
-
7
5
  [Documentation + Live Demo ↗](https://vaadin.com/docs/latest/components/card)
8
6
 
9
7
  [![npm version](https://badgen.net/npm/v/@vaadin/card)](https://www.npmjs.com/package/@vaadin/card)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/card",
3
- "version": "25.0.0-alpha1",
3
+ "version": "25.0.0-alpha11",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -21,7 +21,6 @@
21
21
  "type": "module",
22
22
  "files": [
23
23
  "src",
24
- "theme",
25
24
  "vaadin-*.d.ts",
26
25
  "vaadin-*.js",
27
26
  "web-types.json",
@@ -34,20 +33,20 @@
34
33
  "web-component"
35
34
  ],
36
35
  "dependencies": {
37
- "@vaadin/component-base": "25.0.0-alpha1",
38
- "@vaadin/vaadin-lumo-styles": "25.0.0-alpha1",
39
- "@vaadin/vaadin-themable-mixin": "25.0.0-alpha1",
36
+ "@vaadin/component-base": "25.0.0-alpha11",
37
+ "@vaadin/vaadin-themable-mixin": "25.0.0-alpha11",
40
38
  "lit": "^3.0.0"
41
39
  },
42
40
  "devDependencies": {
43
- "@vaadin/chai-plugins": "25.0.0-alpha1",
44
- "@vaadin/test-runner-commands": "25.0.0-alpha1",
45
- "@vaadin/testing-helpers": "^1.1.0",
41
+ "@vaadin/chai-plugins": "25.0.0-alpha11",
42
+ "@vaadin/test-runner-commands": "25.0.0-alpha11",
43
+ "@vaadin/testing-helpers": "^2.0.0",
44
+ "@vaadin/vaadin-lumo-styles": "25.0.0-alpha11",
46
45
  "sinon": "^18.0.0"
47
46
  },
48
47
  "web-types": [
49
48
  "web-types.json",
50
49
  "web-types.lit.json"
51
50
  ],
52
- "gitHead": "b8c22a4a0c64156210d0daac96b43ae4e5526d49"
51
+ "gitHead": "abfd315ba5a7484a613e0768635a4e8fe945a44b"
53
52
  }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2024 - 2025 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import type { CSSResult } from 'lit';
7
+
8
+ export const cardStyles: CSSResult;
@@ -0,0 +1,271 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2024 - 2025 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import '@vaadin/component-base/src/styles/style-props.js';
7
+ import { css } from 'lit';
8
+
9
+ export const cardStyles = css`
10
+ :host {
11
+ --_content: 0;
12
+ --_footer: 0;
13
+ --_gap: var(--vaadin-card-gap, var(--vaadin-gap-container-block) var(--vaadin-gap-container-inline));
14
+ --_header: max(var(--_header-prefix), var(--_title), var(--_subtitle), var(--_header-suffix));
15
+ --_header-prefix: 0;
16
+ --_header-suffix: 0;
17
+ --_media: 0;
18
+ --_padding: var(--vaadin-card-padding, var(--vaadin-padding));
19
+ --_subtitle: 0;
20
+ --_title: 0;
21
+ background: var(--vaadin-card-background, var(--vaadin-background-container));
22
+ border-radius: var(--vaadin-card-border-radius, var(--vaadin-radius-m));
23
+ box-shadow: var(--vaadin-card-shadow, none);
24
+ box-sizing: border-box;
25
+ display: flex;
26
+ flex-direction: column;
27
+ gap: var(--_gap);
28
+ padding: var(--_padding);
29
+ position: relative;
30
+ }
31
+
32
+ /* Could be an inset outline on the host as well, but let's reserve that for a potential focus outline */
33
+ :host::before {
34
+ border: var(--vaadin-card-border-width, 0) solid var(--vaadin-card-border-color, var(--vaadin-border-color));
35
+ border-radius: inherit;
36
+ content: '';
37
+ inset: 0;
38
+ pointer-events: none;
39
+ position: absolute;
40
+ }
41
+
42
+ :host([hidden]) {
43
+ display: none !important;
44
+ }
45
+
46
+ :host(:not([theme~='horizontal'])) {
47
+ justify-content: space-between;
48
+ }
49
+
50
+ :host([_m]) {
51
+ --_media: 1;
52
+ }
53
+
54
+ :host([_t]) {
55
+ --_title: 1;
56
+ }
57
+
58
+ :host([_st]) {
59
+ --_subtitle: 1;
60
+ }
61
+
62
+ :host([_h]) {
63
+ --_header: 1;
64
+ --_title: 0;
65
+ --_subtitle: 0;
66
+ }
67
+
68
+ :host([_hp]) {
69
+ --_header-prefix: 1;
70
+ }
71
+
72
+ :host([_hs]) {
73
+ --_header-suffix: 1;
74
+ }
75
+
76
+ :host([_c]) {
77
+ --_content: 1;
78
+ }
79
+
80
+ :host([_f]) {
81
+ --_footer: 1;
82
+ }
83
+
84
+ [part='media'],
85
+ [part='header'],
86
+ [part='content'],
87
+ [part='footer'] {
88
+ display: none;
89
+ }
90
+
91
+ :host([_m]) [part='media'] {
92
+ display: block;
93
+ }
94
+
95
+ :host(:is([_h], [_t], [_st], [_hp], [_hs])) [part='header'] {
96
+ align-items: center;
97
+ display: grid;
98
+ gap: var(--_gap);
99
+ row-gap: 0;
100
+ }
101
+
102
+ :host([_hs]) [part='header'] {
103
+ grid-template-columns: 1fr auto;
104
+ }
105
+
106
+ :host([_hp]) [part='header'] {
107
+ grid-template-columns: repeat(var(--_header-prefix), auto) 1fr;
108
+ }
109
+
110
+ :host([_c]) [part='content'] {
111
+ display: block;
112
+ }
113
+
114
+ :host([_f]) [part='footer'] {
115
+ display: flex;
116
+ flex-wrap: wrap;
117
+ gap: var(--_gap);
118
+ }
119
+
120
+ slot {
121
+ border-radius: inherit;
122
+ }
123
+
124
+ ::slotted([slot='header-prefix']) {
125
+ grid-column: 1;
126
+ grid-row: 1 / span calc(var(--_title) + var(--_subtitle));
127
+ }
128
+
129
+ ::slotted([slot='header']),
130
+ ::slotted([slot='title']) {
131
+ grid-column: calc(1 + var(--_header-prefix));
132
+ grid-row: 1;
133
+ }
134
+
135
+ ::slotted([slot='title']) {
136
+ color: var(--vaadin-card-title-color, var(--vaadin-color)) !important;
137
+ font-size: var(--vaadin-card-title-font-size, inherit) !important;
138
+ font-weight: var(--vaadin-card-title-font-weight, 500) !important;
139
+ line-height: var(--vaadin-card-title-line-height, inherit) !important;
140
+ margin: 0 !important;
141
+ }
142
+
143
+ ::slotted([slot='subtitle']) {
144
+ color: var(--vaadin-card-subtitle-color, var(--vaadin-color-subtle)) !important;
145
+ font-size: var(--vaadin-card-subtitle-font-size, inherit) !important;
146
+ font-weight: var(--vaadin-card-subtitle-font-weight, 400) !important;
147
+ line-height: var(--vaadin-card-subtitle-line-height, inherit) !important;
148
+ margin: 0 !important;
149
+ grid-column: calc(1 + var(--_header-prefix));
150
+ grid-row: calc(1 + var(--_title));
151
+ }
152
+
153
+ ::slotted([slot='header-suffix']) {
154
+ grid-column: calc(2 + var(--_header-prefix));
155
+ grid-row: 1 / span calc(var(--_title) + var(--_subtitle));
156
+ }
157
+
158
+ /* Horizontal */
159
+ :host([theme~='horizontal']) {
160
+ align-items: start;
161
+ display: grid;
162
+ grid-template-columns: repeat(var(--_media), minmax(auto, max-content)) 1fr;
163
+ }
164
+
165
+ :host([theme~='horizontal'][_f]) {
166
+ grid-template-rows: 1fr auto;
167
+ }
168
+
169
+ :host([theme~='horizontal'][_c]) {
170
+ grid-template-rows: repeat(var(--_header), auto) 1fr;
171
+ }
172
+
173
+ [part='media'] {
174
+ align-self: stretch;
175
+ border-radius: inherit;
176
+ grid-column: 1;
177
+ grid-row: 1 / span calc(var(--_header) + var(--_content) + var(--_footer));
178
+ }
179
+
180
+ [part='header'] {
181
+ margin-bottom: auto;
182
+ grid-column: calc(1 + var(--_media));
183
+ grid-row: 1;
184
+ }
185
+
186
+ [part='content'] {
187
+ grid-column: calc(1 + var(--_media));
188
+ grid-row: calc(1 + var(--_header));
189
+ flex: auto;
190
+ min-height: 0;
191
+ }
192
+
193
+ [part='footer'] {
194
+ border-radius: inherit;
195
+ grid-column: calc(1 + var(--_media));
196
+ grid-row: calc(1 + var(--_header) + var(--_content));
197
+ }
198
+
199
+ :host([theme~='horizontal']) [part='footer'] {
200
+ align-self: end;
201
+ }
202
+
203
+ :host(:not([theme~='horizontal'])) ::slotted([slot='media']:is(img, video, svg)) {
204
+ max-width: 100%;
205
+ }
206
+
207
+ ::slotted([slot='media']) {
208
+ vertical-align: middle;
209
+ }
210
+
211
+ :host(:is([theme~='cover-media'], [theme~='stretch-media']))
212
+ ::slotted([slot='media']:is(img, video, svg, vaadin-icon)) {
213
+ aspect-ratio: var(--vaadin-card-media-aspect-ratio, 16/9);
214
+ height: auto;
215
+ object-fit: cover;
216
+ /* Fixes an issue where an icon overflows the card boundaries on Firefox: https://github.com/vaadin/web-components/issues/8641 */
217
+ overflow: hidden;
218
+ width: 100%;
219
+ }
220
+
221
+ :host([theme~='horizontal']:is([theme~='cover-media'], [theme~='stretch-media'])) {
222
+ grid-template-columns: repeat(var(--_media), minmax(auto, 0.5fr)) 1fr;
223
+ }
224
+
225
+ :host([theme~='horizontal']:is([theme~='cover-media'], [theme~='stretch-media']))
226
+ ::slotted([slot='media']:is(img, video, svg, vaadin-icon)) {
227
+ aspect-ratio: auto;
228
+ height: 100%;
229
+ }
230
+
231
+ :host([theme~='cover-media']) ::slotted([slot='media']:is(img, video, svg, vaadin-icon)) {
232
+ border-radius: inherit;
233
+ border-end-end-radius: 0;
234
+ border-end-start-radius: 0;
235
+ margin-inline: calc(var(--_padding) * -1);
236
+ margin-top: calc(var(--_padding) * -1);
237
+ max-width: none;
238
+ width: calc(100% + var(--_padding) * 2);
239
+ }
240
+
241
+ :host([theme~='horizontal'][theme~='cover-media']) ::slotted([slot='media']:is(img, video, svg, vaadin-icon)) {
242
+ border-radius: inherit;
243
+ border-end-end-radius: 0;
244
+ border-start-end-radius: 0;
245
+ height: calc(100% + var(--_padding) * 2);
246
+ margin-inline-end: 0;
247
+ width: calc(100% + var(--_padding));
248
+ }
249
+
250
+ /* Scroller in content */
251
+ [part='content'] ::slotted(vaadin-scroller) {
252
+ margin-inline: calc(var(--_padding) * -1);
253
+ padding-inline: var(--_padding);
254
+ }
255
+
256
+ [part='content'] ::slotted(vaadin-scroller)::before,
257
+ [part='content'] ::slotted(vaadin-scroller)::after {
258
+ margin-inline: calc(var(--_padding) * -1);
259
+ }
260
+
261
+ /* Outlined */
262
+ :host([theme~='outlined']) {
263
+ --vaadin-card-border-width: 1px;
264
+ }
265
+
266
+ /* Elevated */
267
+ :host([theme~='elevated']) {
268
+ --vaadin-card-background: var(--vaadin-background-color);
269
+ box-shadow: var(--vaadin-card-shadow, 0 1px 4px -1px rgba(0, 0, 0, 0.3));
270
+ }
271
+ `;
@@ -3,12 +3,14 @@
3
3
  * Copyright (c) 2024 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import { css, html, LitElement } from 'lit';
6
+ import { html, LitElement } from 'lit';
7
7
  import { defineCustomElement } from '@vaadin/component-base/src/define.js';
8
8
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
9
9
  import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
10
10
  import { generateUniqueId } from '@vaadin/component-base/src/unique-id-utils.js';
11
+ import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
11
12
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
13
+ import { cardStyles } from './styles/vaadin-card-base-styles.js';
12
14
 
13
15
  /**
14
16
  * `<vaadin-card>` is a versatile container for grouping related content and actions.
@@ -50,236 +52,19 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
50
52
  * @mixes ElementMixin
51
53
  * @mixes ThemableMixin
52
54
  */
53
- class Card extends ElementMixin(ThemableMixin(PolylitMixin(LitElement))) {
55
+ class Card extends ElementMixin(ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement)))) {
54
56
  static get is() {
55
57
  return 'vaadin-card';
56
58
  }
57
59
 
58
60
  static get styles() {
59
- return css`
60
- :host {
61
- display: flex;
62
- flex-direction: column;
63
- box-sizing: border-box;
64
- padding: var(--_padding);
65
- gap: var(--_gap);
66
- --_padding: var(--vaadin-card-padding, 1em);
67
- --_gap: var(--vaadin-card-gap, 1em);
68
- --_media: 0;
69
- --_title: 0;
70
- --_subtitle: 0;
71
- --_header: max(var(--_header-prefix), var(--_title), var(--_subtitle), var(--_header-suffix));
72
- --_header-prefix: 0;
73
- --_header-suffix: 0;
74
- --_content: 0;
75
- --_footer: 0;
76
- }
77
-
78
- :host([hidden]) {
79
- display: none !important;
80
- }
81
-
82
- :host(:not([theme~='horizontal'])) {
83
- justify-content: space-between;
84
- }
85
-
86
- :host([_m]) {
87
- --_media: 1;
88
- }
89
-
90
- :host([_t]) {
91
- --_title: 1;
92
- }
93
-
94
- :host([_st]) {
95
- --_subtitle: 1;
96
- }
97
-
98
- :host([_h]) {
99
- --_header: 1;
100
- --_title: 0;
101
- --_subtitle: 0;
102
- }
103
-
104
- :host([_hp]) {
105
- --_header-prefix: 1;
106
- }
107
-
108
- :host([_hs]) {
109
- --_header-suffix: 1;
110
- }
111
-
112
- :host([_c]) {
113
- --_content: 1;
114
- }
115
-
116
- :host([_f]) {
117
- --_footer: 1;
118
- }
119
-
120
- [part='media'],
121
- [part='header'],
122
- [part='content'],
123
- [part='footer'] {
124
- display: none;
125
- }
126
-
127
- :host([_m]) [part='media'],
128
- :host([_c]) [part='content'] {
129
- display: block;
130
- }
131
-
132
- :host([_f]) [part='footer'] {
133
- display: flex;
134
- gap: var(--_gap);
135
- }
136
-
137
- :host(:is([_h], [_t], [_st], [_hp], [_hs])) [part='header'] {
138
- display: grid;
139
- align-items: center;
140
- gap: var(--_gap);
141
- row-gap: 0;
142
- }
143
-
144
- [part='header'] {
145
- margin-bottom: auto;
146
- }
147
-
148
- :host([_hs]) [part='header'] {
149
- grid-template-columns: 1fr auto;
150
- }
151
-
152
- :host([_hp]) [part='header'] {
153
- grid-template-columns: repeat(var(--_header-prefix), auto) 1fr;
154
- }
155
-
156
- slot {
157
- border-radius: inherit;
158
- }
159
-
160
- ::slotted([slot='header-prefix']) {
161
- grid-column: 1;
162
- grid-row: 1 / span calc(var(--_title) + var(--_subtitle));
163
- }
164
-
165
- ::slotted([slot='header']),
166
- ::slotted([slot='title']) {
167
- grid-column: calc(1 + var(--_header-prefix));
168
- grid-row: 1;
169
- }
170
-
171
- ::slotted([slot='subtitle']) {
172
- grid-column: calc(1 + var(--_header-prefix));
173
- grid-row: calc(1 + var(--_title));
174
- }
175
-
176
- ::slotted([slot='header-suffix']) {
177
- grid-column: calc(2 + var(--_header-prefix));
178
- grid-row: 1 / span calc(var(--_title) + var(--_subtitle));
179
- }
180
-
181
- /* Horizontal */
182
- :host([theme~='horizontal']) {
183
- display: grid;
184
- grid-template-columns: repeat(var(--_media), minmax(auto, max-content)) 1fr;
185
- align-items: start;
186
- }
187
-
188
- :host([theme~='horizontal'][_f]) {
189
- grid-template-rows: 1fr auto;
190
- }
191
-
192
- :host([theme~='horizontal'][_c]) {
193
- grid-template-rows: repeat(var(--_header), auto) 1fr;
194
- }
195
-
196
- [part='media'] {
197
- grid-column: 1;
198
- grid-row: 1 / span calc(var(--_header) + var(--_content) + var(--_footer));
199
- align-self: stretch;
200
- border-radius: inherit;
201
- }
202
-
203
- [part='header'] {
204
- grid-column: calc(1 + var(--_media));
205
- grid-row: 1;
206
- }
207
-
208
- [part='content'] {
209
- grid-column: calc(1 + var(--_media));
210
- grid-row: calc(1 + var(--_header));
211
- flex: auto;
212
- min-height: 0;
213
- }
214
-
215
- [part='footer'] {
216
- grid-column: calc(1 + var(--_media));
217
- grid-row: calc(1 + var(--_header) + var(--_content));
218
- border-radius: inherit;
219
- }
220
-
221
- :host([theme~='horizontal']) [part='footer'] {
222
- align-self: end;
223
- }
224
-
225
- :host(:not([theme~='horizontal'])) ::slotted([slot='media']:is(img, video, svg)) {
226
- max-width: 100%;
227
- }
228
-
229
- ::slotted([slot='media']) {
230
- vertical-align: middle;
231
- }
232
-
233
- :host(:is([theme~='cover-media'], [theme~='stretch-media']))
234
- ::slotted([slot='media']:is(img, video, svg, vaadin-icon)) {
235
- width: 100%;
236
- height: auto;
237
- aspect-ratio: var(--vaadin-card-media-aspect-ratio, 16/9);
238
- object-fit: cover;
239
- /* Fixes an issue where an icon overflows the card boundaries on Firefox: https://github.com/vaadin/web-components/issues/8641 */
240
- overflow: hidden;
241
- }
242
-
243
- :host([theme~='horizontal']:is([theme~='cover-media'], [theme~='stretch-media'])) {
244
- grid-template-columns: repeat(var(--_media), minmax(auto, 0.5fr)) 1fr;
245
- }
246
-
247
- :host([theme~='horizontal']:is([theme~='cover-media'], [theme~='stretch-media']))
248
- ::slotted([slot='media']:is(img, video, svg, vaadin-icon)) {
249
- height: 100%;
250
- aspect-ratio: auto;
251
- }
252
-
253
- :host([theme~='cover-media']) ::slotted([slot='media']:is(img, video, svg, vaadin-icon)) {
254
- margin-top: calc(var(--_padding) * -1);
255
- margin-inline: calc(var(--_padding) * -1);
256
- width: calc(100% + var(--_padding) * 2);
257
- max-width: none;
258
- border-radius: inherit;
259
- border-end-end-radius: 0;
260
- border-end-start-radius: 0;
261
- }
262
-
263
- :host([theme~='horizontal'][theme~='cover-media']) ::slotted([slot='media']:is(img, video, svg, vaadin-icon)) {
264
- margin-inline-end: 0;
265
- width: calc(100% + var(--_padding));
266
- height: calc(100% + var(--_padding) * 2);
267
- border-radius: inherit;
268
- border-start-end-radius: 0;
269
- border-end-end-radius: 0;
270
- }
271
-
272
- /* Scroller in content */
273
- [part='content'] ::slotted(vaadin-scroller) {
274
- margin-inline: calc(var(--_padding) * -1);
275
- padding-inline: var(--_padding);
276
- }
61
+ return cardStyles;
62
+ }
277
63
 
278
- [part='content'] ::slotted(vaadin-scroller)::before,
279
- [part='content'] ::slotted(vaadin-scroller)::after {
280
- margin-inline: calc(var(--_padding) * -1);
281
- }
282
- `;
64
+ static get lumoInjector() {
65
+ return {
66
+ includeBaseStyles: true,
67
+ };
283
68
  }
284
69
 
285
70
  static get properties() {
@@ -307,10 +92,6 @@ class Card extends ElementMixin(ThemableMixin(PolylitMixin(LitElement))) {
307
92
  };
308
93
  }
309
94
 
310
- static get experimental() {
311
- return true;
312
- }
313
-
314
95
  /** @protected */
315
96
  ready() {
316
97
  super.ready();
package/vaadin-card.js CHANGED
@@ -1,3 +1,3 @@
1
- import './theme/lumo/vaadin-card.js';
1
+ import './src/vaadin-card.js';
2
2
 
3
3
  export * from './src/vaadin-card.js';
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/card",
4
- "version": "25.0.0-alpha1",
4
+ "version": "25.0.0-alpha11",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/card",
4
- "version": "25.0.0-alpha1",
4
+ "version": "25.0.0-alpha11",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -1,6 +0,0 @@
1
- import '@vaadin/vaadin-lumo-styles/color.js';
2
- import '@vaadin/vaadin-lumo-styles/style.js';
3
- import '@vaadin/vaadin-lumo-styles/spacing.js';
4
- import '@vaadin/vaadin-lumo-styles/typography.js';
5
- declare const card: import("lit").CSSResult;
6
- export { card };
@@ -1,76 +0,0 @@
1
- import '@vaadin/vaadin-lumo-styles/color.js';
2
- import '@vaadin/vaadin-lumo-styles/style.js';
3
- import '@vaadin/vaadin-lumo-styles/spacing.js';
4
- import '@vaadin/vaadin-lumo-styles/typography.js';
5
- import { addGlobalThemeStyles, css, registerStyles } from '@vaadin/vaadin-themable-mixin/register-styles.js';
6
-
7
- const cardProps = css`
8
- html {
9
- --vaadin-card-background: var(--lumo-contrast-5pct);
10
- --vaadin-card-border-radius: var(--lumo-border-radius-l);
11
- --vaadin-card-border-width: 0;
12
- --vaadin-card-border-color: var(--lumo-contrast-20pct);
13
- --vaadin-card-padding: var(--lumo-space-m);
14
- --vaadin-card-gap: var(--lumo-space-m);
15
- --vaadin-card-shadow: none;
16
- }
17
- `;
18
-
19
- addGlobalThemeStyles('card-props', cardProps);
20
-
21
- const card = css`
22
- :host {
23
- background: var(--vaadin-card-background);
24
- border-radius: var(--vaadin-card-border-radius);
25
- box-shadow: var(--vaadin-card-shadow);
26
- position: relative;
27
- }
28
-
29
- /* Could be an inset outline on the host as well, but rounded outlines only work since Safari 16.4 */
30
- :host::before {
31
- content: '';
32
- position: absolute;
33
- inset: var(--_card-border-inset, 0);
34
- border-radius: var(--_card-border-pseudo-radius, inherit);
35
- border: var(--vaadin-card-border, var(--vaadin-card-border-width) solid var(--vaadin-card-border-color));
36
- pointer-events: none;
37
- }
38
-
39
- :host([theme~='outlined']) {
40
- --vaadin-card-border-width: 1px;
41
- --vaadin-card-background: var(--lumo-base-color);
42
- }
43
-
44
- :host([theme~='elevated']) {
45
- --vaadin-card-background: linear-gradient(var(--lumo-tint-5pct), var(--lumo-tint-5pct)) var(--lumo-base-color);
46
- --vaadin-card-shadow: var(--lumo-box-shadow-xs);
47
- --vaadin-card-border-width: 1px;
48
- --_card-border-inset: calc(-1 * var(--vaadin-card-border-width));
49
- --_card-border-pseudo-radius: calc(var(--vaadin-card-border-radius) + var(--vaadin-card-border-width));
50
- }
51
-
52
- :host([theme~='elevated']:not([theme~='outlined'])) {
53
- --vaadin-card-border-color: var(--lumo-contrast-10pct);
54
- }
55
-
56
- :host(:where([theme~='stretch-media'])) ::slotted([slot='media']:is(img, video, svg, vaadin-icon)) {
57
- border-radius: var(--lumo-border-radius-m);
58
- }
59
-
60
- ::slotted([slot='title']) {
61
- font-size: var(--lumo-font-size-l);
62
- line-height: var(--lumo-line-height-xs);
63
- font-weight: 600;
64
- color: var(--lumo-header-text-color);
65
- }
66
-
67
- ::slotted([slot='subtitle']) {
68
- font-size: var(--lumo-font-size-m);
69
- line-height: var(--lumo-line-height-xs);
70
- color: var(--lumo-secondary-text-color);
71
- }
72
- `;
73
-
74
- registerStyles('vaadin-card', card, { moduleId: 'lumo-card' });
75
-
76
- export { card };
@@ -1,2 +0,0 @@
1
- import './vaadin-card-styles.js';
2
- import '../../src/vaadin-card.js';
@@ -1,2 +0,0 @@
1
- import './vaadin-card-styles.js';
2
- import '../../src/vaadin-card.js';