@vaadin/dashboard 25.0.0-alpha2 → 25.0.0-alpha20

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 (48) hide show
  1. package/package.json +10 -11
  2. package/src/styles/vaadin-dashboard-base-styles.d.ts +13 -0
  3. package/src/styles/vaadin-dashboard-base-styles.js +25 -0
  4. package/src/styles/vaadin-dashboard-button-base-styles.d.ts +13 -0
  5. package/src/styles/vaadin-dashboard-button-base-styles.js +24 -0
  6. package/src/styles/vaadin-dashboard-layout-base-styles.d.ts +13 -0
  7. package/src/styles/vaadin-dashboard-layout-base-styles.js +86 -0
  8. package/src/styles/vaadin-dashboard-section-base-styles.d.ts +13 -0
  9. package/src/styles/vaadin-dashboard-section-base-styles.js +64 -0
  10. package/src/styles/vaadin-dashboard-widget-base-styles.d.ts +13 -0
  11. package/src/styles/vaadin-dashboard-widget-base-styles.js +110 -0
  12. package/src/styles/vaadin-dashboard-widget-section-base-styles.js +294 -0
  13. package/src/vaadin-dashboard-button.js +4 -3
  14. package/src/vaadin-dashboard-item-mixin.js +8 -8
  15. package/src/vaadin-dashboard-layout-mixin.js +0 -78
  16. package/src/vaadin-dashboard-layout.js +15 -1
  17. package/src/vaadin-dashboard-section.js +13 -42
  18. package/src/vaadin-dashboard-widget.js +13 -46
  19. package/src/vaadin-dashboard.d.ts +1 -1
  20. package/src/vaadin-dashboard.js +12 -14
  21. package/src/widget-resize-controller.js +3 -1
  22. package/vaadin-dashboard-layout.js +1 -1
  23. package/vaadin-dashboard-section.js +1 -1
  24. package/vaadin-dashboard-widget.js +1 -1
  25. package/vaadin-dashboard.js +1 -1
  26. package/web-types.json +3 -3
  27. package/web-types.lit.json +3 -3
  28. package/src/vaadin-dashboard-styles.js +0 -157
  29. package/theme/lumo/vaadin-dashboard-button-styles.d.ts +0 -2
  30. package/theme/lumo/vaadin-dashboard-button-styles.js +0 -8
  31. package/theme/lumo/vaadin-dashboard-button.d.ts +0 -1
  32. package/theme/lumo/vaadin-dashboard-button.js +0 -1
  33. package/theme/lumo/vaadin-dashboard-layout-styles.d.ts +0 -1
  34. package/theme/lumo/vaadin-dashboard-layout-styles.js +0 -28
  35. package/theme/lumo/vaadin-dashboard-layout.d.ts +0 -2
  36. package/theme/lumo/vaadin-dashboard-layout.js +0 -2
  37. package/theme/lumo/vaadin-dashboard-section-styles.d.ts +0 -5
  38. package/theme/lumo/vaadin-dashboard-section-styles.js +0 -89
  39. package/theme/lumo/vaadin-dashboard-section.d.ts +0 -3
  40. package/theme/lumo/vaadin-dashboard-section.js +0 -3
  41. package/theme/lumo/vaadin-dashboard-styles.d.ts +0 -1
  42. package/theme/lumo/vaadin-dashboard-styles.js +0 -16
  43. package/theme/lumo/vaadin-dashboard-widget-styles.d.ts +0 -9
  44. package/theme/lumo/vaadin-dashboard-widget-styles.js +0 -334
  45. package/theme/lumo/vaadin-dashboard-widget.d.ts +0 -3
  46. package/theme/lumo/vaadin-dashboard-widget.js +0 -3
  47. package/theme/lumo/vaadin-dashboard.d.ts +0 -4
  48. package/theme/lumo/vaadin-dashboard.js +0 -4
@@ -0,0 +1,294 @@
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 '@vaadin/component-base/src/styles/style-props.js';
12
+ import { css } from 'lit';
13
+
14
+ export const dashboardWidgetAndSectionStyles = css`
15
+ :host {
16
+ box-sizing: border-box;
17
+ --_widget-background: var(--vaadin-dashboard-widget-background, var(--vaadin-background-color));
18
+ --_widget-border-radius: var(--vaadin-dashboard-widget-border-radius, var(--vaadin-radius-m));
19
+ --_widget-border-width: var(--vaadin-dashboard-widget-border-width, 1px);
20
+ --_widget-border-color: var(--vaadin-dashboard-widget-border-color, var(--vaadin-border-color-secondary));
21
+ --_widget-shadow: var(--vaadin-dashboard-widget-shadow, 0 0 0 0 transparent);
22
+ --_widget-editable-shadow: 0 1px 4px -1px rgba(0, 0, 0, 0.3);
23
+ --_widget-selected-shadow: 0 3px 12px -1px rgba(0, 0, 0, 0.3);
24
+ --_drop-target-background: var(--vaadin-dashboard-drop-target-background, var(--vaadin-background-container));
25
+ --_drop-target-border-color: var(--vaadin-dashboard-drop-target-border-color, var(--vaadin-border-color-secondary));
26
+ --_focus-ring-color: var(--vaadin-focus-ring-color);
27
+ --_focus-ring-width: var(--vaadin-focus-ring-width);
28
+ }
29
+
30
+ :host([focused]) {
31
+ z-index: 1;
32
+ outline: var(--_focus-ring-width) solid var(--_focus-ring-color);
33
+ outline-offset: calc(var(--_widget-border-width) * -1);
34
+ }
35
+
36
+ :host([dragging]) {
37
+ box-shadow: none;
38
+ background: var(--_drop-target-background);
39
+ border-color: var(--_drop-target-border-color);
40
+ }
41
+
42
+ :host([dragging]) * {
43
+ visibility: hidden;
44
+ }
45
+
46
+ :host(:not([editable])) [part~='move-button'],
47
+ :host(:not([editable])) [part~='remove-button'],
48
+ :host(:not([editable])) #focus-button,
49
+ :host(:not([editable])) #focus-button-wrapper,
50
+ :host(:not([editable])) .mode-controls {
51
+ display: none;
52
+ }
53
+
54
+ #focustrap {
55
+ display: contents;
56
+ }
57
+
58
+ header {
59
+ display: flex;
60
+ align-items: center;
61
+ box-sizing: border-box;
62
+ justify-content: space-between;
63
+ gap: var(--vaadin-dashboard-header-gap, var(--vaadin-gap-s));
64
+ }
65
+
66
+ [part='title'] {
67
+ flex: 1;
68
+ color: var(--vaadin-dashboard-widget-title-color, var(--vaadin-text-color));
69
+ font-size: var(--vaadin-dashboard-widget-title-font-size, 1em);
70
+ font-weight: var(--vaadin-dashboard-widget-title-font-weight, 500);
71
+ line-height: var(--vaadin-dashboard-widget-title-line-height, inherit);
72
+ white-space: var(--vaadin-dashboard-widget-title-wrap, wrap);
73
+ text-overflow: ellipsis;
74
+ overflow: hidden;
75
+ align-self: safe center;
76
+ }
77
+
78
+ vaadin-dashboard-button {
79
+ z-index: 1;
80
+ }
81
+
82
+ vaadin-dashboard-button .icon::before {
83
+ display: block;
84
+ content: '';
85
+ height: var(--vaadin-icon-size, 1lh);
86
+ width: var(--vaadin-icon-size, 1lh);
87
+ background: currentColor;
88
+ mask-image: var(--icon);
89
+ }
90
+
91
+ #focus-button-wrapper,
92
+ #focus-button {
93
+ position: absolute;
94
+ inset: 0;
95
+ opacity: 0;
96
+ }
97
+
98
+ #focus-button {
99
+ pointer-events: none;
100
+ padding: 0;
101
+ border: none;
102
+ }
103
+
104
+ .mode-controls {
105
+ position: absolute;
106
+ inset: 0;
107
+ z-index: 2;
108
+ }
109
+
110
+ .mode-controls[hidden] {
111
+ display: none;
112
+ }
113
+
114
+ /* Drag handle */
115
+ [part~='move-button'] {
116
+ cursor: move;
117
+ --icon: var(--_vaadin-icon-drag);
118
+ }
119
+
120
+ /* Remove button */
121
+ [part~='remove-button'] {
122
+ cursor: pointer;
123
+ --icon: var(--_vaadin-icon-cross);
124
+ }
125
+
126
+ /* Move-mode buttons */
127
+ [part~='move-backward-button'],
128
+ [part~='move-forward-button'],
129
+ [part~='move-apply-button'] {
130
+ position: absolute;
131
+ top: 50%;
132
+ }
133
+
134
+ [part~='move-backward-button'] {
135
+ inset-inline-start: 0;
136
+ transform: translateY(-50%);
137
+ --icon: var(--_vaadin-icon-chevron-down);
138
+ }
139
+
140
+ [part~='move-forward-button'] {
141
+ inset-inline-end: 0;
142
+ transform: translateY(-50%);
143
+ --icon: var(--_vaadin-icon-chevron-down);
144
+ }
145
+
146
+ [part~='move-apply-button'] {
147
+ left: 50%;
148
+ transform: translate(-50%, -50%);
149
+ --icon: var(--_vaadin-icon-checkmark);
150
+ }
151
+
152
+ :host([first-child]) [part~='move-backward-button'],
153
+ :host([last-child]) [part~='move-forward-button'] {
154
+ display: none;
155
+ }
156
+
157
+ :host(:not([dir='rtl'])) [part~='move-backward-button'],
158
+ :host([dir='rtl']) [part~='move-forward-button'] {
159
+ border-top-left-radius: 0;
160
+ border-bottom-left-radius: 0;
161
+ }
162
+
163
+ :host(:not([dir='rtl'])) [part~='move-forward-button'],
164
+ :host([dir='rtl']) [part~='move-backward-button'] {
165
+ border-top-right-radius: 0;
166
+ border-bottom-right-radius: 0;
167
+ }
168
+
169
+ :host(:not([dir='rtl'])) [part~='move-backward-button'] .icon,
170
+ :host([dir='rtl']) [part~='move-forward-button'] .icon {
171
+ rotate: 90deg;
172
+ }
173
+
174
+ :host(:not([dir='rtl'])) [part~='move-forward-button'] .icon,
175
+ :host([dir='rtl']) [part~='move-backward-button'] .icon {
176
+ rotate: -90deg;
177
+ }
178
+
179
+ /* Resize-mode buttons */
180
+ [part~='resize-shrink-width-button'],
181
+ [part~='resize-shrink-height-button'],
182
+ [part~='resize-grow-width-button'],
183
+ [part~='resize-grow-height-button'],
184
+ [part~='resize-apply-button'] {
185
+ position: absolute;
186
+ }
187
+
188
+ [part~='resize-shrink-width-button'] {
189
+ inset-inline-end: 0;
190
+ top: 50%;
191
+ }
192
+
193
+ :host(:not([dir='rtl'])) [part~='resize-shrink-width-button'] {
194
+ transform: translateY(-50%) translateX(-100%);
195
+ }
196
+
197
+ :host([dir='rtl']) [part~='resize-shrink-width-button'] {
198
+ transform: translateY(-50%) translateX(100%);
199
+ }
200
+
201
+ .mode-controls:has([part~='resize-grow-width-button'][hidden]) [part~='resize-shrink-width-button'] {
202
+ transform: translateY(-50%);
203
+ }
204
+
205
+ [part~='resize-grow-width-button'] {
206
+ inset-inline-start: 100%;
207
+ top: 50%;
208
+ }
209
+
210
+ :host(:not([dir='rtl'])) [part~='resize-grow-width-button'] {
211
+ transform: translateY(-50%) translateX(-100%);
212
+ }
213
+
214
+ :host([dir='rtl']) [part~='resize-grow-width-button'] {
215
+ transform: translateY(-50%) translateX(100%);
216
+ }
217
+
218
+ [part~='resize-shrink-height-button'] {
219
+ bottom: 0;
220
+ left: 50%;
221
+ transform: translateX(-50%) translateY(-100%);
222
+ }
223
+
224
+ [part~='resize-grow-height-button'] {
225
+ top: 100%;
226
+ left: 50%;
227
+ transform: translateX(-50%) translateY(-100%);
228
+ }
229
+
230
+ [part~='resize-grow-height-button'],
231
+ [part~='resize-grow-width-button'] {
232
+ --icon: var(--_vaadin-icon-plus);
233
+ }
234
+
235
+ [part~='resize-shrink-height-button'],
236
+ [part~='resize-shrink-width-button'] {
237
+ --icon: var(--_vaadin-icon-minus);
238
+ }
239
+
240
+ [part~='resize-apply-button'] {
241
+ left: 50%;
242
+ top: 50%;
243
+ transform: translate(-50%, -50%);
244
+ --icon: var(--_vaadin-icon-checkmark);
245
+ }
246
+
247
+ [part~='resize-shrink-width-button'] + [part~='resize-grow-width-button'] {
248
+ margin-left: 1px;
249
+ }
250
+
251
+ [part~='resize-grow-height-button'],
252
+ [part~='resize-shrink-height-button'] {
253
+ border-bottom-left-radius: 0;
254
+ border-bottom-right-radius: 0;
255
+ }
256
+
257
+ [part~='resize-shrink-height-button']:not([hidden]) + [part~='resize-grow-height-button'] {
258
+ border-top-left-radius: 0;
259
+ border-top-right-radius: 0;
260
+ }
261
+
262
+ [part~='resize-shrink-height-button'] + [part~='resize-grow-height-button'] {
263
+ margin-top: 1px;
264
+ }
265
+
266
+ :host(:not([dir='rtl'])) [part~='resize-grow-width-button'],
267
+ :host(:not([dir='rtl'])) [part~='resize-shrink-width-button'] {
268
+ border-top-right-radius: 0;
269
+ border-bottom-right-radius: 0;
270
+ }
271
+
272
+ :host([dir='rtl']) [part~='resize-grow-width-button'],
273
+ :host([dir='rtl']) [part~='resize-shrink-width-button'] {
274
+ border-top-left-radius: 0;
275
+ border-bottom-left-radius: 0;
276
+ }
277
+
278
+ :host(:not([dir='rtl'])) [part~='resize-shrink-width-button']:not([hidden]) + [part~='resize-grow-width-button'] {
279
+ border-top-left-radius: 0;
280
+ border-bottom-left-radius: 0;
281
+ }
282
+
283
+ :host([dir='rtl']) [part~='resize-shrink-width-button']:not([hidden]) + [part~='resize-grow-width-button'] {
284
+ border-top-right-radius: 0;
285
+ border-bottom-right-radius: 0;
286
+ }
287
+
288
+ @media (forced-colors: active) {
289
+ vaadin-dashboard-button .icon::before {
290
+ background: currentColor;
291
+ forced-color-adjust: none;
292
+ }
293
+ }
294
+ `;
@@ -9,21 +9,22 @@
9
9
  * license.
10
10
  */
11
11
  import { html, LitElement } from 'lit';
12
- import { buttonStyles } from '@vaadin/button/src/vaadin-button-core-styles.js';
13
12
  import { ButtonMixin } from '@vaadin/button/src/vaadin-button-mixin.js';
14
13
  import { defineCustomElement } from '@vaadin/component-base/src/define.js';
15
14
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
16
15
  import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
17
16
  import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
17
+ import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
18
18
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
19
+ import { dashboardButtonStyles } from './styles/vaadin-dashboard-button-base-styles.js';
19
20
 
20
- class DashboardButton extends ButtonMixin(ElementMixin(ThemableMixin(PolylitMixin(LitElement)))) {
21
+ class DashboardButton extends ButtonMixin(ElementMixin(ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement))))) {
21
22
  static get is() {
22
23
  return 'vaadin-dashboard-button';
23
24
  }
24
25
 
25
26
  static get styles() {
26
- return buttonStyles;
27
+ return dashboardButtonStyles;
27
28
  }
28
29
 
29
30
  /** @protected */
@@ -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 */
@@ -310,11 +305,16 @@ export const DashboardItemMixin = (superClass) =>
310
305
  }
311
306
  }
312
307
 
313
- focus() {
308
+ /**
309
+ * @param {FocusOptions=} options
310
+ * @protected
311
+ * @override
312
+ */
313
+ focus(options) {
314
314
  if (this.hasAttribute('editable')) {
315
- this.$['focus-button'].focus();
315
+ this.$['focus-button'].focus(options);
316
316
  } else {
317
- super.focus();
317
+ super.focus(options);
318
318
  }
319
319
  }
320
320
 
@@ -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 { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
15
16
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
17
+ import { dashboardLayoutStyles } from './styles/vaadin-dashboard-layout-base-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(PolylitMixin(LumoInjectionMixin(LitElement)))),
62
+ ) {
59
63
  static get is() {
60
64
  return 'vaadin-dashboard-layout';
61
65
  }
@@ -64,6 +68,16 @@ 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
+
75
+ static get lumoInjector() {
76
+ return {
77
+ includeBaseStyles: true,
78
+ };
79
+ }
80
+
67
81
  /** @protected */
68
82
  render() {
69
83
  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 { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
16
+ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
17
+ import { dashboardSectionStyles } from './styles/vaadin-dashboard-section-base-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,21 @@ 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(PolylitMixin(LumoInjectionMixin(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
- }
81
+ return dashboardSectionStyles;
82
+ }
109
83
 
110
- :host::before {
111
- z-index: 2 !important;
112
- }
113
- `,
114
- hasWidgetWrappers,
115
- super.styles,
116
- ];
84
+ static get lumoInjector() {
85
+ return {
86
+ includeBaseStyles: true,
87
+ };
117
88
  }
118
89
 
119
90
  static get properties() {
@@ -125,7 +96,7 @@ class DashboardSection extends DashboardItemMixin(ElementMixin(ThemableMixin(Pol
125
96
  * `i18n` object with a custom one.
126
97
  *
127
98
  * The object has the following structure and default values:
128
- * ```
99
+ * ```js
129
100
  * {
130
101
  * selectSection: 'Select section for editing',
131
102
  * remove: 'Remove',
@@ -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 { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
16
+ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
17
+ import { dashboardWidgetStyles } from './styles/vaadin-dashboard-widget-base-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,21 @@ 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(PolylitMixin(LumoInjectionMixin(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
- }
115
+ return dashboardWidgetStyles;
116
+ }
141
117
 
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
- ];
118
+ static get lumoInjector() {
119
+ return {
120
+ includeBaseStyles: true,
121
+ };
155
122
  }
156
123
 
157
124
  static get properties() {
@@ -163,7 +130,7 @@ class DashboardWidget extends DashboardItemMixin(ElementMixin(ThemableMixin(Poly
163
130
  * `i18n` object with a custom one.
164
131
  *
165
132
  * The object has the following structure and default values:
166
- * ```
133
+ * ```js
167
134
  * {
168
135
  * selectWidget: 'Select widget for editing',
169
136
  * remove: 'Remove',
@@ -259,7 +259,7 @@ declare class Dashboard<TItem extends DashboardItem = DashboardItem> extends Das
259
259
  * just the individual properties you want to change.
260
260
  *
261
261
  * The object has the following structure and default values:
262
- * ```
262
+ * ```js
263
263
  * {
264
264
  * selectSection: 'Select section for editing',
265
265
  * selectWidget: 'Select widget for editing',