@vaadin/dashboard 25.0.0-alpha3 → 25.0.0-alpha5

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/dashboard",
3
- "version": "25.0.0-alpha3",
3
+ "version": "25.0.0-alpha5",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -37,16 +37,16 @@
37
37
  ],
38
38
  "dependencies": {
39
39
  "@open-wc/dedupe-mixin": "^1.3.0",
40
- "@vaadin/a11y-base": "25.0.0-alpha3",
41
- "@vaadin/button": "25.0.0-alpha3",
42
- "@vaadin/component-base": "25.0.0-alpha3",
43
- "@vaadin/vaadin-lumo-styles": "25.0.0-alpha3",
44
- "@vaadin/vaadin-themable-mixin": "25.0.0-alpha3",
40
+ "@vaadin/a11y-base": "25.0.0-alpha5",
41
+ "@vaadin/button": "25.0.0-alpha5",
42
+ "@vaadin/component-base": "25.0.0-alpha5",
43
+ "@vaadin/vaadin-lumo-styles": "25.0.0-alpha5",
44
+ "@vaadin/vaadin-themable-mixin": "25.0.0-alpha5",
45
45
  "lit": "^3.0.0"
46
46
  },
47
47
  "devDependencies": {
48
- "@vaadin/chai-plugins": "25.0.0-alpha3",
49
- "@vaadin/test-runner-commands": "25.0.0-alpha3",
48
+ "@vaadin/chai-plugins": "25.0.0-alpha5",
49
+ "@vaadin/test-runner-commands": "25.0.0-alpha5",
50
50
  "@vaadin/testing-helpers": "^2.0.0"
51
51
  },
52
52
  "cvdlName": "vaadin-dashboard",
@@ -54,5 +54,5 @@
54
54
  "web-types.json",
55
55
  "web-types.lit.json"
56
56
  ],
57
- "gitHead": "8367dd20a47f53ca5589ad349a8e286ec2673055"
57
+ "gitHead": "7dc87bb2a3cae81ed53259fa10b58f990d50c6fd"
58
58
  }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2000 - 2025 Vaadin Ltd.
4
+ *
5
+ * This program is available under Vaadin Commercial License and Service Terms.
6
+ *
7
+ *
8
+ * See https://vaadin.com/commercial-license-and-service-terms for the full
9
+ * license.
10
+ */
11
+ import type { CSSResult } from 'lit';
12
+
13
+ export const dashboardStyles: CSSResult;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2000 - 2025 Vaadin Ltd.
4
+ *
5
+ * This program is available under Vaadin Commercial License and Service Terms.
6
+ *
7
+ *
8
+ * See https://vaadin.com/commercial-license-and-service-terms for the full
9
+ * license.
10
+ */
11
+ import { css } from 'lit';
12
+ import { dashboardLayoutStyles } from './vaadin-dashboard-layout-core-styles.js';
13
+
14
+ const dashboard = css`
15
+ #grid[item-resizing] {
16
+ -webkit-user-select: none;
17
+ user-select: none;
18
+ }
19
+
20
+ ::slotted(vaadin-dashboard-widget-wrapper) {
21
+ display: contents;
22
+ }
23
+ `;
24
+
25
+ export const dashboardStyles = [dashboardLayoutStyles, dashboard];
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2000 - 2025 Vaadin Ltd.
4
+ *
5
+ * This program is available under Vaadin Commercial License and Service Terms.
6
+ *
7
+ *
8
+ * See https://vaadin.com/commercial-license-and-service-terms for the full
9
+ * license.
10
+ */
11
+ import type { CSSResult } from 'lit';
12
+
13
+ export const dashboardLayoutStyles: CSSResult;
@@ -0,0 +1,85 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2000 - 2025 Vaadin Ltd.
4
+ *
5
+ * This program is available under Vaadin Commercial License and Service Terms.
6
+ *
7
+ *
8
+ * See https://vaadin.com/commercial-license-and-service-terms for the full
9
+ * license.
10
+ */
11
+ import { css } from 'lit';
12
+
13
+ export const dashboardLayoutStyles = css`
14
+ :host {
15
+ display: block;
16
+ overflow: auto;
17
+ box-sizing: border-box;
18
+ width: 100%;
19
+ }
20
+
21
+ :host([hidden]) {
22
+ display: none !important;
23
+ }
24
+
25
+ :host([dense-layout]) #grid {
26
+ grid-auto-flow: dense;
27
+ }
28
+
29
+ #grid {
30
+ box-sizing: border-box;
31
+
32
+ /* Padding around dashboard edges */
33
+ --_default-padding: 1rem;
34
+ --_padding: max(0px, var(--vaadin-dashboard-padding, var(--_default-padding)));
35
+ padding: var(--_padding);
36
+
37
+ /* Gap between widgets */
38
+ --_default-gap: 1rem;
39
+ --_gap: max(0px, var(--vaadin-dashboard-gap, var(--_default-gap)));
40
+ gap: var(--_gap);
41
+
42
+ /* Default min and max column widths */
43
+ --_default-col-min-width: 25rem;
44
+ --_default-col-max-width: 1fr;
45
+
46
+ /* Effective min and max column widths */
47
+ --_col-min-width: var(--vaadin-dashboard-col-min-width, var(--_default-col-min-width));
48
+ --_col-max-width: var(--vaadin-dashboard-col-max-width, var(--_default-col-max-width));
49
+
50
+ /* Effective max column count */
51
+ --_col-max-count: var(--vaadin-dashboard-col-max-count, var(--_col-count));
52
+
53
+ /* Effective column count */
54
+ --_effective-col-count: min(var(--_col-count), var(--_col-max-count));
55
+
56
+ /* Default row min height */
57
+ --_default-row-min-height: 12rem;
58
+ /* Effective row min height */
59
+ --_row-min-height: var(--vaadin-dashboard-row-min-height, var(--_default-row-min-height));
60
+ /* Effective row height */
61
+ --_row-height: minmax(var(--_row-min-height, auto), auto);
62
+
63
+ display: grid;
64
+ overflow: hidden;
65
+ min-width: calc(var(--_col-min-width) + var(--_padding) * 2);
66
+
67
+ grid-template-columns: repeat(
68
+ var(--_effective-col-count, auto-fill),
69
+ minmax(var(--_col-min-width), var(--_col-max-width))
70
+ );
71
+
72
+ grid-auto-rows: var(--_row-height);
73
+ }
74
+
75
+ ::slotted(*) {
76
+ /* The grid-column value applied to children */
77
+ --_item-column: span min(var(--vaadin-dashboard-widget-colspan, 1), var(--_effective-col-count, var(--_col-count)));
78
+
79
+ grid-column: var(--_item-column);
80
+
81
+ /* The grid-row value applied to children */
82
+ --_item-row: span var(--vaadin-dashboard-widget-rowspan, 1);
83
+ grid-row: var(--_item-row);
84
+ }
85
+ `;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2000 - 2025 Vaadin Ltd.
4
+ *
5
+ * This program is available under Vaadin Commercial License and Service Terms.
6
+ *
7
+ *
8
+ * See https://vaadin.com/commercial-license-and-service-terms for the full
9
+ * license.
10
+ */
11
+ import type { CSSResult } from 'lit';
12
+
13
+ export const dashboardSectionStyles: CSSResult;
@@ -0,0 +1,53 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2000 - 2025 Vaadin Ltd.
4
+ *
5
+ * This program is available under Vaadin Commercial License and Service Terms.
6
+ *
7
+ *
8
+ * See https://vaadin.com/commercial-license-and-service-terms for the full
9
+ * license.
10
+ */
11
+ import { css } from 'lit';
12
+ import { dashboardWidgetAndSectionStyles } from './vaadin-dashboard-widget-section-core-styles.js';
13
+
14
+ const sectionStyles = css`
15
+ :host {
16
+ display: grid;
17
+ position: relative;
18
+ grid-template-columns: subgrid;
19
+ --_section-column: 1 / calc(var(--_effective-col-count) + 1);
20
+ grid-column: var(--_section-column) !important;
21
+ gap: var(--_gap, 1rem);
22
+ /* Dashboard section header height */
23
+ --_section-header-height: minmax(0, auto);
24
+ grid-template-rows: var(--_section-header-height) repeat(auto-fill, var(--_row-height));
25
+ grid-auto-rows: var(--_row-height);
26
+ }
27
+
28
+ :host([hidden]) {
29
+ display: none !important;
30
+ }
31
+
32
+ ::slotted(*) {
33
+ --_item-column: span min(var(--vaadin-dashboard-widget-colspan, 1), var(--_effective-col-count, var(--_col-count)));
34
+
35
+ grid-column: var(--_item-column);
36
+ --_item-row: span var(--vaadin-dashboard-widget-rowspan, 1);
37
+ grid-row: var(--_item-row);
38
+ }
39
+
40
+ header {
41
+ grid-column: var(--_section-column);
42
+ }
43
+
44
+ :host::before {
45
+ z-index: 2 !important;
46
+ }
47
+
48
+ ::slotted(vaadin-dashboard-widget-wrapper) {
49
+ display: contents;
50
+ }
51
+ `;
52
+
53
+ export const dashboardSectionStyles = [sectionStyles, dashboardWidgetAndSectionStyles];
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2000 - 2025 Vaadin Ltd.
4
+ *
5
+ * This program is available under Vaadin Commercial License and Service Terms.
6
+ *
7
+ *
8
+ * See https://vaadin.com/commercial-license-and-service-terms for the full
9
+ * license.
10
+ */
11
+ import type { CSSResult } from 'lit';
12
+
13
+ export const dashboardWidgetStyles: CSSResult;
@@ -0,0 +1,56 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2000 - 2025 Vaadin Ltd.
4
+ *
5
+ * This program is available under Vaadin Commercial License and Service Terms.
6
+ *
7
+ *
8
+ * See https://vaadin.com/commercial-license-and-service-terms for the full
9
+ * license.
10
+ */
11
+ import { css } from 'lit';
12
+ import { dashboardWidgetAndSectionStyles } from './vaadin-dashboard-widget-section-core-styles.js';
13
+
14
+ const widgetStyles = css`
15
+ :host {
16
+ display: flex;
17
+ flex-direction: column;
18
+ grid-column: var(--_item-column);
19
+ grid-row: var(--_item-row);
20
+ position: relative;
21
+ }
22
+
23
+ :host([hidden]) {
24
+ display: none !important;
25
+ }
26
+
27
+ :host(:not([editable])) [part~='resize-button'] {
28
+ display: none;
29
+ }
30
+
31
+ [part~='content'] {
32
+ flex: 1;
33
+ overflow: hidden;
34
+ }
35
+
36
+ [part~='resize-button'] {
37
+ position: absolute;
38
+ bottom: 0;
39
+ inset-inline-end: 0;
40
+ z-index: 1;
41
+ overflow: hidden;
42
+ }
43
+
44
+ :host([resizing])::after {
45
+ content: '';
46
+ z-index: 2;
47
+ position: absolute;
48
+ top: -1px;
49
+ width: var(--_widget-resizer-width, 0);
50
+ height: var(--_widget-resizer-height, 0);
51
+ background: rgba(0, 0, 0, 0.1);
52
+ border-radius: inherit;
53
+ }
54
+ `;
55
+
56
+ export const dashboardWidgetStyles = [widgetStyles, dashboardWidgetAndSectionStyles];
@@ -8,13 +8,7 @@
8
8
  * See https://vaadin.com/commercial-license-and-service-terms for the full
9
9
  * license.
10
10
  */
11
- import { css } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
12
-
13
- export const hasWidgetWrappers = css`
14
- ::slotted(vaadin-dashboard-widget-wrapper) {
15
- display: contents;
16
- }
17
- `;
11
+ import { css } from 'lit';
18
12
 
19
13
  export const dashboardWidgetAndSectionStyles = css`
20
14
  :host {
@@ -9,15 +9,16 @@
9
9
  * license.
10
10
  */
11
11
  import { html, LitElement } from 'lit';
12
- import { buttonStyles } from '@vaadin/button/src/vaadin-button-core-styles.js';
12
+ import { buttonStyles } from '@vaadin/button/src/styles/vaadin-button-core-styles.js';
13
13
  import { ButtonMixin } from '@vaadin/button/src/vaadin-button-mixin.js';
14
14
  import { defineCustomElement } from '@vaadin/component-base/src/define.js';
15
15
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
16
16
  import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
17
17
  import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
18
+ import { CSSInjectionMixin } from '@vaadin/vaadin-themable-mixin/css-injection-mixin.js';
18
19
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
19
20
 
20
- class DashboardButton extends ButtonMixin(ElementMixin(ThemableMixin(PolylitMixin(LitElement)))) {
21
+ class DashboardButton extends ButtonMixin(ElementMixin(ThemableMixin(CSSInjectionMixin(PolylitMixin(LitElement))))) {
21
22
  static get is() {
22
23
  return 'vaadin-dashboard-button';
23
24
  }
@@ -14,7 +14,6 @@ import { FocusTrapController } from '@vaadin/a11y-base/src/focus-trap-controller
14
14
  import { ResizeMixin } from '@vaadin/component-base/src/resize-mixin.js';
15
15
  import { KeyboardController } from './keyboard-controller.js';
16
16
  import { fireMove, fireRemove, fireResize } from './vaadin-dashboard-helpers.js';
17
- import { dashboardWidgetAndSectionStyles } from './vaadin-dashboard-styles.js';
18
17
 
19
18
  const DEFAULT_I18N = {
20
19
  selectWidget: 'Select widget for editing',
@@ -47,10 +46,6 @@ export function getDefaultI18n() {
47
46
  */
48
47
  export const DashboardItemMixin = (superClass) =>
49
48
  class DashboardItemMixinClass extends ResizeMixin(superClass) {
50
- static get styles() {
51
- return dashboardWidgetAndSectionStyles;
52
- }
53
-
54
49
  static get properties() {
55
50
  return {
56
51
  /** @protected */
@@ -9,7 +9,6 @@
9
9
  * license.
10
10
  */
11
11
  import { ResizeMixin } from '@vaadin/component-base/src/resize-mixin.js';
12
- import { css } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
13
12
 
14
13
  /**
15
14
  * A mixin to enable the dashboard layout functionality
@@ -19,83 +18,6 @@ import { css } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
19
18
  */
20
19
  export const DashboardLayoutMixin = (superClass) =>
21
20
  class DashboardLayoutMixinClass extends ResizeMixin(superClass) {
22
- static get styles() {
23
- return css`
24
- :host {
25
- display: block;
26
- overflow: auto;
27
- box-sizing: border-box;
28
- width: 100%;
29
- }
30
-
31
- :host([hidden]) {
32
- display: none !important;
33
- }
34
-
35
- :host([dense-layout]) #grid {
36
- grid-auto-flow: dense;
37
- }
38
-
39
- #grid {
40
- box-sizing: border-box;
41
-
42
- /* Padding around dashboard edges */
43
- --_default-padding: 1rem;
44
- --_padding: max(0px, var(--vaadin-dashboard-padding, var(--_default-padding)));
45
- padding: var(--_padding);
46
-
47
- /* Gap between widgets */
48
- --_default-gap: 1rem;
49
- --_gap: max(0px, var(--vaadin-dashboard-gap, var(--_default-gap)));
50
- gap: var(--_gap);
51
-
52
- /* Default min and max column widths */
53
- --_default-col-min-width: 25rem;
54
- --_default-col-max-width: 1fr;
55
-
56
- /* Effective min and max column widths */
57
- --_col-min-width: var(--vaadin-dashboard-col-min-width, var(--_default-col-min-width));
58
- --_col-max-width: var(--vaadin-dashboard-col-max-width, var(--_default-col-max-width));
59
-
60
- /* Effective max column count */
61
- --_col-max-count: var(--vaadin-dashboard-col-max-count, var(--_col-count));
62
-
63
- /* Effective column count */
64
- --_effective-col-count: min(var(--_col-count), var(--_col-max-count));
65
-
66
- /* Default row min height */
67
- --_default-row-min-height: 12rem;
68
- /* Effective row min height */
69
- --_row-min-height: var(--vaadin-dashboard-row-min-height, var(--_default-row-min-height));
70
- /* Effective row height */
71
- --_row-height: minmax(var(--_row-min-height, auto), auto);
72
-
73
- display: grid;
74
- overflow: hidden;
75
- min-width: calc(var(--_col-min-width) + var(--_padding) * 2);
76
-
77
- grid-template-columns: repeat(
78
- var(--_effective-col-count, auto-fill),
79
- minmax(var(--_col-min-width), var(--_col-max-width))
80
- );
81
-
82
- grid-auto-rows: var(--_row-height);
83
- }
84
-
85
- ::slotted(*) {
86
- /* The grid-column value applied to children */
87
- --_item-column: span
88
- min(var(--vaadin-dashboard-widget-colspan, 1), var(--_effective-col-count, var(--_col-count)));
89
-
90
- grid-column: var(--_item-column);
91
-
92
- /* The grid-row value applied to children */
93
- --_item-row: span var(--vaadin-dashboard-widget-rowspan, 1);
94
- grid-row: var(--_item-row);
95
- }
96
- `;
97
- }
98
-
99
21
  static get properties() {
100
22
  return {
101
23
  /**
@@ -12,7 +12,9 @@ import { html, LitElement } from 'lit';
12
12
  import { defineCustomElement } from '@vaadin/component-base/src/define.js';
13
13
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
14
14
  import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
15
+ import { CSSInjectionMixin } from '@vaadin/vaadin-themable-mixin/css-injection-mixin.js';
15
16
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
17
+ import { dashboardLayoutStyles } from './styles/vaadin-dashboard-layout-core-styles.js';
16
18
  import { DashboardLayoutMixin } from './vaadin-dashboard-layout-mixin.js';
17
19
 
18
20
  /**
@@ -55,7 +57,9 @@ import { DashboardLayoutMixin } from './vaadin-dashboard-layout-mixin.js';
55
57
  * @mixes ElementMixin
56
58
  * @mixes ThemableMixin
57
59
  */
58
- class DashboardLayout extends DashboardLayoutMixin(ElementMixin(ThemableMixin(PolylitMixin(LitElement)))) {
60
+ class DashboardLayout extends DashboardLayoutMixin(
61
+ ElementMixin(ThemableMixin(CSSInjectionMixin(PolylitMixin(LitElement)))),
62
+ ) {
59
63
  static get is() {
60
64
  return 'vaadin-dashboard-layout';
61
65
  }
@@ -64,6 +68,10 @@ class DashboardLayout extends DashboardLayoutMixin(ElementMixin(ThemableMixin(Po
64
68
  return 'vaadin-dashboard';
65
69
  }
66
70
 
71
+ static get styles() {
72
+ return dashboardLayoutStyles;
73
+ }
74
+
67
75
  /** @protected */
68
76
  render() {
69
77
  return html`<div id="grid"><slot></slot></div>`;
@@ -12,10 +12,11 @@ import { html, LitElement } from 'lit';
12
12
  import { defineCustomElement } from '@vaadin/component-base/src/define.js';
13
13
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
14
14
  import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
15
- import { css, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
15
+ import { CSSInjectionMixin } from '@vaadin/vaadin-themable-mixin/css-injection-mixin.js';
16
+ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
17
+ import { dashboardSectionStyles } from './styles/vaadin-dashboard-section-core-styles.js';
16
18
  import { DashboardItemMixin } from './vaadin-dashboard-item-mixin.js';
17
19
  import { getDefaultI18n } from './vaadin-dashboard-item-mixin.js';
18
- import { hasWidgetWrappers } from './vaadin-dashboard-styles.js';
19
20
 
20
21
  /**
21
22
  * A section component for use with the Dashboard component
@@ -69,51 +70,15 @@ import { hasWidgetWrappers } from './vaadin-dashboard-styles.js';
69
70
  * @mixes ThemableMixin
70
71
  * @mixes DashboardItemMixin
71
72
  */
72
- class DashboardSection extends DashboardItemMixin(ElementMixin(ThemableMixin(PolylitMixin(LitElement)))) {
73
+ class DashboardSection extends DashboardItemMixin(
74
+ ElementMixin(ThemableMixin(CSSInjectionMixin(PolylitMixin(LitElement)))),
75
+ ) {
73
76
  static get is() {
74
77
  return 'vaadin-dashboard-section';
75
78
  }
76
79
 
77
80
  static get styles() {
78
- return [
79
- css`
80
- :host {
81
- display: grid;
82
- position: relative;
83
- grid-template-columns: subgrid;
84
- --_section-column: 1 / calc(var(--_effective-col-count) + 1);
85
- grid-column: var(--_section-column) !important;
86
- gap: var(--_gap, 1rem);
87
- /* Dashboard section header height */
88
- --_section-header-height: minmax(0, auto);
89
- grid-template-rows: var(--_section-header-height) repeat(auto-fill, var(--_row-height));
90
- grid-auto-rows: var(--_row-height);
91
- }
92
-
93
- :host([hidden]) {
94
- display: none !important;
95
- }
96
-
97
- ::slotted(*) {
98
- --_item-column: span
99
- min(var(--vaadin-dashboard-widget-colspan, 1), var(--_effective-col-count, var(--_col-count)));
100
-
101
- grid-column: var(--_item-column);
102
- --_item-row: span var(--vaadin-dashboard-widget-rowspan, 1);
103
- grid-row: var(--_item-row);
104
- }
105
-
106
- header {
107
- grid-column: var(--_section-column);
108
- }
109
-
110
- :host::before {
111
- z-index: 2 !important;
112
- }
113
- `,
114
- hasWidgetWrappers,
115
- super.styles,
116
- ];
81
+ return dashboardSectionStyles;
117
82
  }
118
83
 
119
84
  static get properties() {
@@ -12,7 +12,9 @@ import { html, LitElement } from 'lit';
12
12
  import { defineCustomElement } from '@vaadin/component-base/src/define.js';
13
13
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
14
14
  import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
15
- import { css, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
15
+ import { CSSInjectionMixin } from '@vaadin/vaadin-themable-mixin/css-injection-mixin.js';
16
+ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
17
+ import { dashboardWidgetStyles } from './styles/vaadin-dashboard-widget-core-styles.js';
16
18
  import { findAncestorInstance, SYNCHRONIZED_ATTRIBUTES, WRAPPER_LOCAL_NAME } from './vaadin-dashboard-helpers.js';
17
19
  import { DashboardItemMixin } from './vaadin-dashboard-item-mixin.js';
18
20
  import { getDefaultI18n } from './vaadin-dashboard-item-mixin.js';
@@ -102,56 +104,15 @@ import { DashboardSection } from './vaadin-dashboard-section.js';
102
104
  * @mixes ThemableMixin
103
105
  * @mixes DashboardItemMixin
104
106
  */
105
- class DashboardWidget extends DashboardItemMixin(ElementMixin(ThemableMixin(PolylitMixin(LitElement)))) {
107
+ class DashboardWidget extends DashboardItemMixin(
108
+ ElementMixin(ThemableMixin(CSSInjectionMixin(PolylitMixin(LitElement)))),
109
+ ) {
106
110
  static get is() {
107
111
  return 'vaadin-dashboard-widget';
108
112
  }
109
113
 
110
114
  static get styles() {
111
- return [
112
- css`
113
- :host {
114
- display: flex;
115
- flex-direction: column;
116
- grid-column: var(--_item-column);
117
- grid-row: var(--_item-row);
118
- position: relative;
119
- }
120
-
121
- :host([hidden]) {
122
- display: none !important;
123
- }
124
-
125
- :host(:not([editable])) [part~='resize-button'] {
126
- display: none;
127
- }
128
-
129
- [part~='content'] {
130
- flex: 1;
131
- overflow: hidden;
132
- }
133
-
134
- [part~='resize-button'] {
135
- position: absolute;
136
- bottom: 0;
137
- inset-inline-end: 0;
138
- z-index: 1;
139
- overflow: hidden;
140
- }
141
-
142
- :host([resizing])::after {
143
- content: '';
144
- z-index: 2;
145
- position: absolute;
146
- top: -1px;
147
- width: var(--_widget-resizer-width, 0);
148
- height: var(--_widget-resizer-height, 0);
149
- background: rgba(0, 0, 0, 0.1);
150
- border-radius: inherit;
151
- }
152
- `,
153
- super.styles,
154
- ];
115
+ return dashboardWidgetStyles;
155
116
  }
156
117
 
157
118
  static get properties() {
@@ -15,7 +15,9 @@ import { defineCustomElement } from '@vaadin/component-base/src/define.js';
15
15
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
16
16
  import { I18nMixin } from '@vaadin/component-base/src/i18n-mixin.js';
17
17
  import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
18
- import { css, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
18
+ import { CSSInjectionMixin } from '@vaadin/vaadin-themable-mixin/css-injection-mixin.js';
19
+ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
20
+ import { dashboardStyles } from './styles/vaadin-dashboard-core-styles.js';
19
21
  import {
20
22
  getElementItem,
21
23
  getItemsArrayOfItem,
@@ -26,7 +28,6 @@ import {
26
28
  import { getDefaultI18n } from './vaadin-dashboard-item-mixin.js';
27
29
  import { DashboardLayoutMixin } from './vaadin-dashboard-layout-mixin.js';
28
30
  import { DashboardSection } from './vaadin-dashboard-section.js';
29
- import { hasWidgetWrappers } from './vaadin-dashboard-styles.js';
30
31
  import { WidgetReorderController } from './widget-reorder-controller.js';
31
32
  import { WidgetResizeController } from './widget-resize-controller.js';
32
33
 
@@ -105,7 +106,7 @@ import { WidgetResizeController } from './widget-resize-controller.js';
105
106
  * @mixes ThemableMixin
106
107
  */
107
108
  class Dashboard extends DashboardLayoutMixin(
108
- I18nMixin(getDefaultI18n(), ElementMixin(ThemableMixin(PolylitMixin(LitElement)))),
109
+ I18nMixin(getDefaultI18n(), ElementMixin(ThemableMixin(CSSInjectionMixin(PolylitMixin(LitElement))))),
109
110
  ) {
110
111
  static get is() {
111
112
  return 'vaadin-dashboard';
@@ -116,16 +117,7 @@ class Dashboard extends DashboardLayoutMixin(
116
117
  }
117
118
 
118
119
  static get styles() {
119
- return [
120
- super.styles,
121
- css`
122
- #grid[item-resizing] {
123
- -webkit-user-select: none;
124
- user-select: none;
125
- }
126
- `,
127
- hasWidgetWrappers,
128
- ];
120
+ return dashboardStyles;
129
121
  }
130
122
 
131
123
  static get properties() {
@@ -18,8 +18,8 @@ const dashboardWidgetAndSection = css`
18
18
  --_widget-border-color: var(--vaadin-dashboard-widget-border-color, var(--lumo-contrast-20pct));
19
19
  --_widget-shadow: var(--vaadin-dashboard-widget-shadow, 0 0 0 0 transparent);
20
20
  --_widget-editable-shadow: var(--lumo-box-shadow-s);
21
- --_widget-selected-shadow: 0 2px 4px -1px var(--lumo-primary-color-10pct),
22
- 0 3px 12px -1px var(--lumo-primary-color-50pct);
21
+ --_widget-selected-shadow:
22
+ 0 2px 4px -1px var(--lumo-primary-color-10pct), 0 3px 12px -1px var(--lumo-primary-color-50pct);
23
23
  --_drop-target-background-color: var(
24
24
  --vaadin-dashboard-drop-target-background-color,
25
25
  var(--lumo-primary-color-10pct)
@@ -37,11 +37,6 @@ const dashboardWidgetAndSection = css`
37
37
  filter: var(--_widget-filter);
38
38
  }
39
39
 
40
- :host([selected]) {
41
- opacity: 1;
42
- z-index: 1;
43
- }
44
-
45
40
  :host([focused]) {
46
41
  z-index: 1;
47
42
  }
@@ -86,6 +81,8 @@ const dashboardWidgetAndSection = css`
86
81
  --_icon-color: var(--lumo-primary-text-color);
87
82
  }
88
83
  :host([selected]) {
84
+ opacity: 1;
85
+ z-index: 1;
89
86
  --_icon-color: var(--lumo-primary-text-color);
90
87
  }
91
88
  :host(:is([move-mode], [resize-mode])) {
@@ -257,6 +254,13 @@ const dashboardWidget = css`
257
254
  height: var(--lumo-size-s);
258
255
  padding-right: 0;
259
256
  padding-left: 0;
257
+ border-bottom-left-radius: 0;
258
+ border-bottom-right-radius: 0;
259
+ }
260
+
261
+ [part~='resize-shrink-height-button']:not([hidden]) + [part~='resize-grow-height-button'] {
262
+ border-top-left-radius: 0;
263
+ border-top-right-radius: 0;
260
264
  }
261
265
 
262
266
  [part~='resize-shrink-height-button'] + [part~='resize-grow-height-button'] {
@@ -295,17 +299,6 @@ const dashboardWidget = css`
295
299
  --icon: var(--lumo-icons-minus);
296
300
  }
297
301
 
298
- [part~='resize-grow-height-button'],
299
- [part~='resize-shrink-height-button'] {
300
- border-bottom-left-radius: 0;
301
- border-bottom-right-radius: 0;
302
- }
303
-
304
- [part~='resize-shrink-height-button']:not([hidden]) + [part~='resize-grow-height-button'] {
305
- border-top-left-radius: 0;
306
- border-top-right-radius: 0;
307
- }
308
-
309
302
  /* Windows High Contrast Mode */
310
303
  @media (forced-colors: active) {
311
304
  :host {
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/dashboard",
4
- "version": "25.0.0-alpha3",
4
+ "version": "25.0.0-alpha5",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -136,7 +136,7 @@
136
136
  },
137
137
  {
138
138
  "name": "vaadin-dashboard",
139
- "description": "A responsive, grid-based dashboard layout component\n\n### Quick Start\n\nAssign an array to the [`items`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha3/#/elements/vaadin-dashboard#property-items) property.\nSet a renderer function to the [`renderer`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha3/#/elements/vaadin-dashboard#property-renderer) property.\n\nThe widgets and the sections will be generated and configured based on the renderer and the items provided.\n\n```html\n<vaadin-dashboard></vaadin-dashboard>\n```\n```js\nconst dashboard = document.querySelector('vaadin-dashboard');\n\ndashboard.items = [\n { title: 'Widget 1 title', content: 'Text 1', rowspan: 2 },\n { title: 'Widget 2 title', content: 'Text 2', colspan: 2 },\n {\n title: 'Section title',\n items: [{ title: 'Widget in section title', content: 'Text 3' }]\n },\n // ... more items\n];\n\ndashboard.renderer = (root, _dashboard, { item }) => {\n const widget = root.firstElementChild || document.createElement('vaadin-dashboard-widget');\n if (!root.contains(widget)) {\n root.appendChild(widget);\n }\n widget.widgetTitle = item.title;\n widget.textContent = item.content;\n};\n```\n\n### Styling\n\nThe following custom properties are available:\n\nCustom Property | Description\n------------------------------------|-------------\n`--vaadin-dashboard-col-min-width` | minimum column width of the dashboard\n`--vaadin-dashboard-col-max-width` | maximum column width of the dashboard\n`--vaadin-dashboard-row-min-height` | minimum row height of the dashboard\n`--vaadin-dashboard-col-max-count` | maximum column count of the dashboard\n`--vaadin-dashboard-gap` | gap between child elements. Must be in length units (0 is not allowed, 0px is)\n`--vaadin-dashboard-padding` | space around the dashboard's outer edges. Must be in length units (0 is not allowed, 0px is)\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------------|-------------\n`editable` | Set when the dashboard is editable.\n`dense-layout` | Set when the dashboard is in dense mode.\n`item-selected` | Set when an item is selected.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
139
+ "description": "A responsive, grid-based dashboard layout component\n\n### Quick Start\n\nAssign an array to the [`items`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha5/#/elements/vaadin-dashboard#property-items) property.\nSet a renderer function to the [`renderer`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha5/#/elements/vaadin-dashboard#property-renderer) property.\n\nThe widgets and the sections will be generated and configured based on the renderer and the items provided.\n\n```html\n<vaadin-dashboard></vaadin-dashboard>\n```\n```js\nconst dashboard = document.querySelector('vaadin-dashboard');\n\ndashboard.items = [\n { title: 'Widget 1 title', content: 'Text 1', rowspan: 2 },\n { title: 'Widget 2 title', content: 'Text 2', colspan: 2 },\n {\n title: 'Section title',\n items: [{ title: 'Widget in section title', content: 'Text 3' }]\n },\n // ... more items\n];\n\ndashboard.renderer = (root, _dashboard, { item }) => {\n const widget = root.firstElementChild || document.createElement('vaadin-dashboard-widget');\n if (!root.contains(widget)) {\n root.appendChild(widget);\n }\n widget.widgetTitle = item.title;\n widget.textContent = item.content;\n};\n```\n\n### Styling\n\nThe following custom properties are available:\n\nCustom Property | Description\n------------------------------------|-------------\n`--vaadin-dashboard-col-min-width` | minimum column width of the dashboard\n`--vaadin-dashboard-col-max-width` | maximum column width of the dashboard\n`--vaadin-dashboard-row-min-height` | minimum row height of the dashboard\n`--vaadin-dashboard-col-max-count` | maximum column count of the dashboard\n`--vaadin-dashboard-gap` | gap between child elements. Must be in length units (0 is not allowed, 0px is)\n`--vaadin-dashboard-padding` | space around the dashboard's outer edges. Must be in length units (0 is not allowed, 0px is)\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------------|-------------\n`editable` | Set when the dashboard is editable.\n`dense-layout` | Set when the dashboard is in dense mode.\n`item-selected` | Set when an item is selected.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
140
140
  "attributes": [
141
141
  {
142
142
  "name": "dense-layout",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/dashboard",
4
- "version": "25.0.0-alpha3",
4
+ "version": "25.0.0-alpha5",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -58,7 +58,7 @@
58
58
  },
59
59
  {
60
60
  "name": "vaadin-dashboard",
61
- "description": "A responsive, grid-based dashboard layout component\n\n### Quick Start\n\nAssign an array to the [`items`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha3/#/elements/vaadin-dashboard#property-items) property.\nSet a renderer function to the [`renderer`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha3/#/elements/vaadin-dashboard#property-renderer) property.\n\nThe widgets and the sections will be generated and configured based on the renderer and the items provided.\n\n```html\n<vaadin-dashboard></vaadin-dashboard>\n```\n```js\nconst dashboard = document.querySelector('vaadin-dashboard');\n\ndashboard.items = [\n { title: 'Widget 1 title', content: 'Text 1', rowspan: 2 },\n { title: 'Widget 2 title', content: 'Text 2', colspan: 2 },\n {\n title: 'Section title',\n items: [{ title: 'Widget in section title', content: 'Text 3' }]\n },\n // ... more items\n];\n\ndashboard.renderer = (root, _dashboard, { item }) => {\n const widget = root.firstElementChild || document.createElement('vaadin-dashboard-widget');\n if (!root.contains(widget)) {\n root.appendChild(widget);\n }\n widget.widgetTitle = item.title;\n widget.textContent = item.content;\n};\n```\n\n### Styling\n\nThe following custom properties are available:\n\nCustom Property | Description\n------------------------------------|-------------\n`--vaadin-dashboard-col-min-width` | minimum column width of the dashboard\n`--vaadin-dashboard-col-max-width` | maximum column width of the dashboard\n`--vaadin-dashboard-row-min-height` | minimum row height of the dashboard\n`--vaadin-dashboard-col-max-count` | maximum column count of the dashboard\n`--vaadin-dashboard-gap` | gap between child elements. Must be in length units (0 is not allowed, 0px is)\n`--vaadin-dashboard-padding` | space around the dashboard's outer edges. Must be in length units (0 is not allowed, 0px is)\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------------|-------------\n`editable` | Set when the dashboard is editable.\n`dense-layout` | Set when the dashboard is in dense mode.\n`item-selected` | Set when an item is selected.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
61
+ "description": "A responsive, grid-based dashboard layout component\n\n### Quick Start\n\nAssign an array to the [`items`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha5/#/elements/vaadin-dashboard#property-items) property.\nSet a renderer function to the [`renderer`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha5/#/elements/vaadin-dashboard#property-renderer) property.\n\nThe widgets and the sections will be generated and configured based on the renderer and the items provided.\n\n```html\n<vaadin-dashboard></vaadin-dashboard>\n```\n```js\nconst dashboard = document.querySelector('vaadin-dashboard');\n\ndashboard.items = [\n { title: 'Widget 1 title', content: 'Text 1', rowspan: 2 },\n { title: 'Widget 2 title', content: 'Text 2', colspan: 2 },\n {\n title: 'Section title',\n items: [{ title: 'Widget in section title', content: 'Text 3' }]\n },\n // ... more items\n];\n\ndashboard.renderer = (root, _dashboard, { item }) => {\n const widget = root.firstElementChild || document.createElement('vaadin-dashboard-widget');\n if (!root.contains(widget)) {\n root.appendChild(widget);\n }\n widget.widgetTitle = item.title;\n widget.textContent = item.content;\n};\n```\n\n### Styling\n\nThe following custom properties are available:\n\nCustom Property | Description\n------------------------------------|-------------\n`--vaadin-dashboard-col-min-width` | minimum column width of the dashboard\n`--vaadin-dashboard-col-max-width` | maximum column width of the dashboard\n`--vaadin-dashboard-row-min-height` | minimum row height of the dashboard\n`--vaadin-dashboard-col-max-count` | maximum column count of the dashboard\n`--vaadin-dashboard-gap` | gap between child elements. Must be in length units (0 is not allowed, 0px is)\n`--vaadin-dashboard-padding` | space around the dashboard's outer edges. Must be in length units (0 is not allowed, 0px is)\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------------|-------------\n`editable` | Set when the dashboard is editable.\n`dense-layout` | Set when the dashboard is in dense mode.\n`item-selected` | Set when an item is selected.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
62
62
  "extension": true,
63
63
  "attributes": [
64
64
  {