@vaadin/card 25.0.5 → 25.0.8

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.5",
3
+ "version": "25.0.8",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -33,22 +33,22 @@
33
33
  "web-component"
34
34
  ],
35
35
  "dependencies": {
36
- "@vaadin/component-base": "~25.0.5",
37
- "@vaadin/vaadin-themable-mixin": "~25.0.5",
36
+ "@vaadin/component-base": "~25.0.8",
37
+ "@vaadin/vaadin-themable-mixin": "~25.0.8",
38
38
  "lit": "^3.0.0"
39
39
  },
40
40
  "devDependencies": {
41
- "@vaadin/aura": "~25.0.5",
42
- "@vaadin/avatar": "~25.0.5",
43
- "@vaadin/chai-plugins": "~25.0.5",
44
- "@vaadin/test-runner-commands": "~25.0.5",
41
+ "@vaadin/aura": "~25.0.8",
42
+ "@vaadin/avatar": "~25.0.8",
43
+ "@vaadin/chai-plugins": "~25.0.8",
44
+ "@vaadin/test-runner-commands": "~25.0.8",
45
45
  "@vaadin/testing-helpers": "^2.0.0",
46
- "@vaadin/vaadin-lumo-styles": "~25.0.5",
46
+ "@vaadin/vaadin-lumo-styles": "~25.0.8",
47
47
  "sinon": "^21.0.0"
48
48
  },
49
49
  "web-types": [
50
50
  "web-types.json",
51
51
  "web-types.lit.json"
52
52
  ],
53
- "gitHead": "f9de924c232acc7b113e9f7f48368e8ca8105f81"
53
+ "gitHead": "d49b389a8188b9695abc566d7efa163fe9c1b130"
54
54
  }
@@ -229,6 +229,14 @@ export const cardStyles = css`
229
229
  height: 100%;
230
230
  }
231
231
 
232
+ :host([theme~='cover-media']) {
233
+ --_media-width: calc(100% + var(--_padding) * 2);
234
+ }
235
+
236
+ :host([theme~='horizontal'][theme~='cover-media']) {
237
+ --_media-width: calc(100% + var(--_padding));
238
+ }
239
+
232
240
  :host([theme~='cover-media']) ::slotted([slot='media']:is(img, video, svg, vaadin-icon)) {
233
241
  border-radius: inherit;
234
242
  border-end-end-radius: 0;
@@ -236,7 +244,7 @@ export const cardStyles = css`
236
244
  margin-inline: calc(var(--_padding) * -1);
237
245
  margin-top: calc(var(--_padding) * -1);
238
246
  max-width: none;
239
- width: calc(100% + var(--_padding) * 2);
247
+ width: var(--_media-width);
240
248
  }
241
249
 
242
250
  :host([theme~='horizontal'][theme~='cover-media']) ::slotted([slot='media']:is(img, video, svg, vaadin-icon)) {
@@ -245,7 +253,6 @@ export const cardStyles = css`
245
253
  border-start-end-radius: 0;
246
254
  height: calc(100% + var(--_padding) * 2);
247
255
  margin-inline-end: 0;
248
- width: calc(100% + var(--_padding));
249
256
  }
250
257
 
251
258
  /* Scroller in content */
@@ -5,6 +5,7 @@
5
5
  */
6
6
  import { html, LitElement } from 'lit';
7
7
  import { defineCustomElement } from '@vaadin/component-base/src/define.js';
8
+ import { isEmptyTextNode } from '@vaadin/component-base/src/dom-utils.js';
8
9
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
9
10
  import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
10
11
  import { generateUniqueId } from '@vaadin/component-base/src/unique-id-utils.js';
@@ -157,13 +158,19 @@ class Card extends ElementMixin(ThemableMixin(PolylitMixin(LumoInjectionMixin(Li
157
158
  );
158
159
  this.toggleAttribute('_hp', this.querySelector(':scope > [slot="header-prefix"]'));
159
160
  this.toggleAttribute('_hs', this.querySelector(':scope > [slot="header-suffix"]'));
160
- this.toggleAttribute('_c', this.querySelector(':scope > :not([slot])'));
161
+ this.toggleAttribute('_c', this.__hasContent());
161
162
  this.toggleAttribute('_f', this.querySelector(':scope > [slot="footer"]'));
162
163
  if (this.__getCustomTitleElement()) {
163
164
  this.__clearStringTitle();
164
165
  }
165
166
  }
166
167
 
168
+ /** @private */
169
+ __hasContent() {
170
+ const slot = this.shadowRoot.querySelector('slot:not([name])');
171
+ return slot.assignedNodes({ flatten: true }).filter((node) => !isEmptyTextNode(node)).length > 0;
172
+ }
173
+
167
174
  /** @private */
168
175
  __clearStringTitle() {
169
176
  const stringTitleElement = this.__getStringTitleElement();
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.5",
4
+ "version": "25.0.8",
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.5",
4
+ "version": "25.0.8",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {