Skip to content

Commit 90a525d

Browse files
authored
refactor: update dashboard to use base styles, cleanup Lumo CSS (#10054)
1 parent 9a2a3b9 commit 90a525d

11 files changed

+42
-334
lines changed

packages/dashboard/src/styles/vaadin-dashboard-button-base-styles.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ import { css } from 'lit';
1212
import { buttonStyles } from '@vaadin/button/src/styles/vaadin-button-base-styles.js';
1313

1414
const dashboardButton = css`
15+
:host {
16+
padding: 4px;
17+
}
18+
1519
:host([theme~='tertiary']) {
1620
color: var(--vaadin-dashboard-button-text-color, var(--vaadin-color-subtle));
1721
}

packages/dashboard/src/styles/vaadin-dashboard-widget-section-base-styles.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ export const dashboardWidgetAndSectionStyles = css`
7777
7878
vaadin-dashboard-button {
7979
z-index: 1;
80-
padding: 4px;
8180
}
8281
8382
vaadin-dashboard-button .icon::before {

packages/dashboard/src/vaadin-dashboard-layout.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ class DashboardLayout extends DashboardLayoutMixin(
7272
return dashboardLayoutStyles;
7373
}
7474

75+
static get lumoInjector() {
76+
return {
77+
includeBaseStyles: true,
78+
};
79+
}
80+
7581
/** @protected */
7682
render() {
7783
return html`<div id="grid"><slot></slot></div>`;

packages/dashboard/src/vaadin-dashboard-section.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,12 @@ class DashboardSection extends DashboardItemMixin(
8181
return dashboardSectionStyles;
8282
}
8383

84+
static get lumoInjector() {
85+
return {
86+
includeBaseStyles: true,
87+
};
88+
}
89+
8490
static get properties() {
8591
return {
8692
/**

packages/dashboard/src/vaadin-dashboard-widget.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@ class DashboardWidget extends DashboardItemMixin(
115115
return dashboardWidgetStyles;
116116
}
117117

118+
static get lumoInjector() {
119+
return {
120+
includeBaseStyles: true,
121+
};
122+
}
123+
118124
static get properties() {
119125
return {
120126
/**

packages/dashboard/src/vaadin-dashboard.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ class Dashboard extends DashboardLayoutMixin(
120120
return dashboardStyles;
121121
}
122122

123+
static get lumoInjector() {
124+
return {
125+
includeBaseStyles: true,
126+
};
127+
}
128+
123129
static get properties() {
124130
return {
125131
/**

packages/vaadin-lumo-styles/src/components/dashboard-layout.css

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -4,76 +4,10 @@
44
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
55
*/
66
@media lumo_components_dashboard-layout {
7-
:host {
8-
display: block;
9-
overflow: auto;
10-
box-sizing: border-box;
11-
width: 100%;
12-
}
13-
14-
:host([hidden]) {
15-
display: none !important;
16-
}
17-
18-
:host([dense-layout]) #grid {
19-
grid-auto-flow: dense;
20-
}
21-
227
#grid {
23-
box-sizing: border-box;
24-
25-
/* Padding around dashboard edges */
268
--_default-padding: var(--lumo-space-m);
27-
--_padding: max(0px, var(--vaadin-dashboard-padding, var(--_default-padding)));
28-
padding: var(--_padding);
29-
30-
/* Gap between widgets */
319
--_default-gap: var(--lumo-space-m);
32-
--_gap: max(0px, var(--vaadin-dashboard-gap, var(--_default-gap)));
33-
gap: var(--_gap);
34-
35-
/* Default min and max column widths */
36-
--_default-col-min-width: 25rem;
37-
--_default-col-max-width: 1fr;
38-
39-
/* Effective min and max column widths */
40-
--_col-min-width: var(--vaadin-dashboard-col-min-width, var(--_default-col-min-width));
41-
--_col-max-width: var(--vaadin-dashboard-col-max-width, var(--_default-col-max-width));
42-
43-
/* Effective max column count */
44-
--_col-max-count: var(--vaadin-dashboard-col-max-count, var(--_col-count));
45-
46-
/* Effective column count */
47-
--_effective-col-count: min(var(--_col-count), var(--_col-max-count));
48-
49-
/* Default row min height */
5010
--_default-row-min-height: 12rem;
51-
/* Effective row min height */
52-
--_row-min-height: var(--vaadin-dashboard-row-min-height, var(--_default-row-min-height));
53-
/* Effective row height */
54-
--_row-height: minmax(var(--_row-min-height, auto), auto);
55-
56-
display: grid;
57-
overflow: hidden;
58-
min-width: calc(var(--_col-min-width) + var(--_padding) * 2);
59-
60-
grid-template-columns: repeat(
61-
var(--_effective-col-count, auto-fill),
62-
minmax(var(--_col-min-width), var(--_col-max-width))
63-
);
64-
65-
grid-auto-rows: var(--_row-height);
66-
}
67-
68-
::slotted(*) {
69-
/* The grid-column value applied to children */
70-
--_item-column: span min(var(--vaadin-dashboard-widget-colspan, 1), var(--_effective-col-count, var(--_col-count)));
71-
72-
grid-column: var(--_item-column);
73-
74-
/* The grid-row value applied to children */
75-
--_item-row: span var(--vaadin-dashboard-widget-rowspan, 1);
76-
grid-row: var(--_item-row);
7711
}
7812

7913
:host([theme~='shaded-background']) {

packages/vaadin-lumo-styles/src/components/dashboard-section.css

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,50 +5,23 @@
55
*/
66
@media lumo_components_dashboard-section {
77
:host {
8-
display: grid;
9-
position: relative;
10-
grid-template-columns: subgrid;
11-
--_section-column: 1 / calc(var(--_effective-col-count) + 1);
12-
grid-column: var(--_section-column) !important;
138
gap: var(--_gap, 1rem);
14-
/* Dashboard section header height */
15-
--_section-header-height: minmax(0, auto);
16-
grid-template-rows: var(--_section-header-height) repeat(auto-fill, var(--_row-height));
17-
grid-auto-rows: var(--_row-height);
189
--_section-outline-offset: calc(min(var(--_gap), var(--_padding)) / 3);
1910
--_focus-ring-offset: calc((var(--_section-outline-offset) - var(--_focus-ring-width)));
2011
border-radius: var(--lumo-border-radius-l);
21-
}
22-
23-
:host([hidden]) {
24-
display: none !important;
25-
}
26-
27-
::slotted(*) {
28-
--_item-column: span min(var(--vaadin-dashboard-widget-colspan, 1), var(--_effective-col-count, var(--_col-count)));
29-
30-
grid-column: var(--_item-column);
31-
--_item-row: span var(--vaadin-dashboard-widget-rowspan, 1);
32-
grid-row: var(--_item-row);
12+
border: none;
13+
margin: 0;
14+
padding: 0;
3315
}
3416

3517
header {
36-
grid-column: var(--_section-column);
3718
margin-bottom: calc(-1 * var(--_section-outline-offset));
3819
line-height: var(--lumo-line-height-s);
3920
padding-inline: var(--lumo-space-s);
4021
min-height: var(--lumo-size-l);
4122
align-items: center;
4223
}
4324

44-
:host::before {
45-
z-index: 2 !important;
46-
}
47-
48-
::slotted(vaadin-dashboard-widget-wrapper) {
49-
display: contents;
50-
}
51-
5225
[part='title'] {
5326
font-size: var(--lumo-font-size-xl);
5427
font-weight: 600;
@@ -108,6 +81,5 @@
10881

10982
[part~='move-forward-button'] {
11083
inset-inline-end: calc(-1 * var(--_section-outline-offset));
111-
transform: translateY(-50%);
11284
}
11385
}

packages/vaadin-lumo-styles/src/components/dashboard-widget.css

Lines changed: 1 addition & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -4,43 +4,15 @@
44
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
55
*/
66
@media lumo_components_dashboard-widget {
7-
:host {
8-
display: flex;
9-
flex-direction: column;
10-
grid-column: var(--_item-column);
11-
grid-row: var(--_item-row);
12-
background: var(--_widget-background);
13-
border-radius: var(--_widget-border-radius);
14-
box-shadow: var(--_widget-shadow);
15-
position: relative;
16-
}
17-
187
:host::before {
19-
content: '';
20-
position: absolute;
218
inset: calc(-1 * var(--_widget-border-width));
229
border: var(--_widget-border-width) solid var(--_widget-border-color);
2310
border-radius: calc(var(--_widget-border-radius) + var(--_widget-border-width));
24-
pointer-events: none;
25-
}
26-
27-
:host([hidden]) {
28-
display: none !important;
29-
}
30-
31-
:host(:not([editable])) [part~='resize-button'] {
32-
display: none;
33-
}
34-
35-
[part~='content'] {
36-
flex: 1;
37-
overflow: hidden;
3811
}
3912

4013
/* Widget states */
4114

4215
:host([editable]) {
43-
--vaadin-dashboard-widget-shadow: var(--_widget-editable-shadow);
4416
--_widget-border-color: var(--lumo-contrast-20pct);
4517
--_widget-border-width: 1px;
4618
}
@@ -51,7 +23,6 @@
5123
}
5224

5325
:host([selected]) {
54-
--vaadin-dashboard-widget-shadow: var(--_widget-selected-shadow);
5526
background: var(--lumo-primary-color-10pct);
5627
}
5728

@@ -62,13 +33,7 @@
6233
}
6334

6435
:host([resizing])::after {
65-
content: '';
66-
z-index: 2;
67-
position: absolute;
6836
top: -1px;
69-
width: var(--_widget-resizer-width, 0);
70-
height: var(--_widget-resizer-height, 0);
71-
border-radius: inherit;
7237
background: var(--_drop-target-background-color);
7338
border: var(--_drop-target-border);
7439
}
@@ -81,7 +46,7 @@
8146
}
8247

8348
:host([editable]) header {
84-
padding-inline: var(--lumo-space-xs);
49+
padding: var(--lumo-space-xs);
8550
}
8651

8752
[part='title'] {
@@ -113,25 +78,12 @@
11378
/* Resize handle */
11479

11580
[part~='resize-button'] {
116-
z-index: 1;
117-
overflow: hidden;
11881
--_resize-button-offset: min(var(--_gap), var(--_padding), var(--lumo-space-xs));
119-
position: absolute;
12082
bottom: calc(-1 * var(--_resize-button-offset));
12183
inset-inline-end: calc(-1 * var(--_resize-button-offset));
122-
cursor: nwse-resize;
123-
touch-action: none;
12484
--icon: var(--lumo-icons-resize-handle);
12585
}
12686

127-
:host([dir='rtl']) [part~='resize-button'] {
128-
cursor: sw-resize;
129-
}
130-
131-
:host([dir='rtl']) [part~='resize-button'] .icon::before {
132-
transform: scaleX(-1);
133-
}
134-
13587
/* Accessible resize mode controls */
13688

13789
[part~='resize-apply-button'] {
@@ -146,48 +98,11 @@
14698
min-width: var(--lumo-size-s);
14799
}
148100

149-
[part~='resize-shrink-width-button'] + [part~='resize-grow-width-button'] {
150-
margin-left: 1px;
151-
}
152-
153101
[part~='resize-grow-height-button'],
154102
[part~='resize-shrink-height-button'] {
155103
height: var(--lumo-size-s);
156104
padding-right: 0;
157105
padding-left: 0;
158-
border-bottom-left-radius: 0;
159-
border-bottom-right-radius: 0;
160-
}
161-
162-
[part~='resize-shrink-height-button']:not([hidden]) + [part~='resize-grow-height-button'] {
163-
border-top-left-radius: 0;
164-
border-top-right-radius: 0;
165-
}
166-
167-
[part~='resize-shrink-height-button'] + [part~='resize-grow-height-button'] {
168-
margin-top: 1px;
169-
}
170-
171-
:host(:not([dir='rtl'])) [part~='resize-grow-width-button'],
172-
:host(:not([dir='rtl'])) [part~='resize-shrink-width-button'] {
173-
border-top-right-radius: 0;
174-
border-bottom-right-radius: 0;
175-
}
176-
177-
:host([dir='rtl']) [part~='resize-grow-width-button'],
178-
:host([dir='rtl']) [part~='resize-shrink-width-button'] {
179-
border-top-left-radius: 0;
180-
border-bottom-left-radius: 0;
181-
}
182-
183-
:host(:not([dir='rtl'])) [part~='resize-shrink-width-button']:not([hidden]) + [part~='resize-grow-width-button'] {
184-
border-top-left-radius: 0;
185-
border-bottom-left-radius: 0;
186-
}
187-
188-
:host([dir='rtl']) [part~='resize-shrink-width-button']:not([hidden]) + [part~='resize-grow-width-button'] {
189-
border-top-right-radius: 0;
190-
border-bottom-right-radius: 0;
191106
}
192107

193108
[part~='resize-grow-height-button'],

packages/vaadin-lumo-styles/src/components/dashboard.css

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,6 @@
44
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
55
*/
66
@media lumo_components_dashboard {
7-
#grid[item-resizing] {
8-
-webkit-user-select: none;
9-
user-select: none;
10-
}
11-
12-
::slotted(vaadin-dashboard-widget-wrapper) {
13-
display: contents;
14-
}
15-
167
:host {
178
--_widget-opacity: 1;
189
}

0 commit comments

Comments
 (0)