@vaadin/card 25.0.0-alpha5 → 25.0.0-alpha6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/card",
3
- "version": "25.0.0-alpha5",
3
+ "version": "25.0.0-alpha6",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -21,6 +21,8 @@
21
21
  "type": "module",
22
22
  "files": [
23
23
  "src",
24
+ "!src/styles/*-base-styles.d.ts",
25
+ "!src/styles/*-base-styles.js",
24
26
  "theme",
25
27
  "vaadin-*.d.ts",
26
28
  "vaadin-*.js",
@@ -34,14 +36,14 @@
34
36
  "web-component"
35
37
  ],
36
38
  "dependencies": {
37
- "@vaadin/component-base": "25.0.0-alpha5",
38
- "@vaadin/vaadin-lumo-styles": "25.0.0-alpha5",
39
- "@vaadin/vaadin-themable-mixin": "25.0.0-alpha5",
39
+ "@vaadin/component-base": "25.0.0-alpha6",
40
+ "@vaadin/vaadin-lumo-styles": "25.0.0-alpha6",
41
+ "@vaadin/vaadin-themable-mixin": "25.0.0-alpha6",
40
42
  "lit": "^3.0.0"
41
43
  },
42
44
  "devDependencies": {
43
- "@vaadin/chai-plugins": "25.0.0-alpha5",
44
- "@vaadin/test-runner-commands": "25.0.0-alpha5",
45
+ "@vaadin/chai-plugins": "25.0.0-alpha6",
46
+ "@vaadin/test-runner-commands": "25.0.0-alpha6",
45
47
  "@vaadin/testing-helpers": "^2.0.0",
46
48
  "sinon": "^18.0.0"
47
49
  },
@@ -49,5 +51,5 @@
49
51
  "web-types.json",
50
52
  "web-types.lit.json"
51
53
  ],
52
- "gitHead": "7dc87bb2a3cae81ed53259fa10b58f990d50c6fd"
54
+ "gitHead": "cd1d084198d2b326c58d44bb39fa4845b71ce551"
53
55
  }
@@ -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,272 @@
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 { css } from 'lit';
7
+
8
+ export const cardStyles = css`
9
+ @layer base {
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
+ }
272
+ `;
@@ -8,7 +8,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 { CSSInjectionMixin } from '@vaadin/vaadin-themable-mixin/css-injection-mixin.js';
11
+ import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
12
12
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
13
13
  import { cardStyles } from './styles/vaadin-card-core-styles.js';
14
14
 
@@ -52,7 +52,7 @@ import { cardStyles } from './styles/vaadin-card-core-styles.js';
52
52
  * @mixes ElementMixin
53
53
  * @mixes ThemableMixin
54
54
  */
55
- class Card extends ElementMixin(ThemableMixin(CSSInjectionMixin(PolylitMixin(LitElement)))) {
55
+ class Card extends ElementMixin(ThemableMixin(LumoInjectionMixin(PolylitMixin(LitElement)))) {
56
56
  static get is() {
57
57
  return 'vaadin-card';
58
58
  }
@@ -57,6 +57,12 @@ const card = css`
57
57
  border-radius: var(--lumo-border-radius-m);
58
58
  }
59
59
 
60
+ :host([theme~='elevated'][theme~='cover-media']) ::slotted([slot='media']:is(img, video, svg, vaadin-icon)) {
61
+ margin-top: calc((var(--_padding) + var(--vaadin-card-border-width)) * -1);
62
+ margin-inline: calc((var(--_padding) + var(--vaadin-card-border-width)) * -1);
63
+ width: calc(100% + (var(--_padding) + var(--vaadin-card-border-width)) * 2);
64
+ }
65
+
60
66
  ::slotted([slot='title']) {
61
67
  font-size: var(--lumo-font-size-l);
62
68
  line-height: var(--lumo-line-height-xs);
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-alpha5",
4
+ "version": "25.0.0-alpha6",
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-alpha5",
4
+ "version": "25.0.0-alpha6",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {