Skip to content

Commit e791ece

Browse files
authored
refactor: update split-layout Lumo theme to use base styles (#10217)
1 parent 588800a commit e791ece

File tree

2 files changed

+25
-97
lines changed

2 files changed

+25
-97
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,12 @@ class SplitLayout extends SplitLayoutMixin(ElementMixin(ThemableMixin(PolylitMix
165165
return splitLayoutStyles;
166166
}
167167

168+
static get lumoInjector() {
169+
return {
170+
includeBaseStyles: true,
171+
};
172+
}
173+
168174
/** @protected */
169175
render() {
170176
return html`

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

Lines changed: 19 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -4,128 +4,50 @@
44
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
55
*/
66
@media lumo_components_split-layout {
7-
:host {
8-
display: flex;
9-
overflow: hidden !important;
10-
}
11-
12-
:host([hidden]) {
13-
display: none !important;
14-
}
15-
16-
:host([orientation='vertical']) {
17-
flex-direction: column;
18-
}
19-
20-
:host ::slotted(*) {
21-
flex: 1 1 auto;
22-
overflow: auto;
23-
}
24-
257
[part='splitter'] {
26-
flex: none;
27-
position: relative;
28-
z-index: 1;
29-
overflow: visible;
30-
min-width: var(--lumo-space-s);
31-
min-height: var(--lumo-space-s);
32-
background-color: var(--lumo-contrast-5pct);
8+
--_splitter-size: var(--vaadin-split-layout-splitter-size, var(--lumo-space-s));
9+
--_splitter-target-size: var(--vaadin-split-layout-splitter-target-size, var(--lumo-space-s));
10+
--_handle-size: var(--vaadin-split-layout-handle-size, var(--lumo-space-xs));
11+
--_handle-target-size: var(--vaadin-split-layout-handle-target-size, var(--lumo-size-m));
12+
background: var(--vaadin-split-layout-splitter-background, var(--lumo-contrast-5pct));
3313
transition: 0.1s background-color;
3414
}
3515

36-
:host(:not([orientation='vertical'])) > [part='splitter'] {
37-
cursor: ew-resize;
38-
}
39-
40-
:host([orientation='vertical']) > [part='splitter'] {
41-
cursor: ns-resize;
42-
}
43-
4416
[part='handle'] {
45-
position: absolute;
46-
top: 50%;
47-
left: 50%;
48-
transform: translate3d(-50%, -50%, 0);
49-
display: flex;
50-
align-items: center;
51-
justify-content: center;
52-
width: var(--lumo-size-m);
53-
height: var(--lumo-size-m);
54-
}
55-
56-
[part='handle']::after {
57-
content: '';
58-
display: block;
59-
--_handle-size: 4px;
60-
width: var(--_handle-size);
61-
height: 100%;
62-
max-width: 100%;
63-
max-height: 100%;
17+
background: var(--vaadin-split-layout-handle-background, var(--lumo-contrast-30pct));
6418
border-radius: var(--lumo-border-radius-s);
65-
background-color: var(--lumo-contrast-30pct);
66-
transition:
67-
0.1s opacity,
68-
0.1s background-color;
69-
}
70-
71-
:host([orientation='vertical']) [part='handle']::after {
72-
width: 100%;
73-
height: var(--_handle-size);
7419
}
7520

7621
/* Active style */
77-
[part='splitter']:active [part='handle']::after {
78-
background-color: var(--lumo-contrast-50pct);
22+
[part='splitter']:active [part='handle'] {
23+
background: var(--lumo-contrast-50pct);
7924
}
8025

81-
/* Small/minimal */
26+
/* Small overrides */
8227
:host([theme~='small']) > [part='splitter'] {
83-
border-left: 1px solid var(--lumo-contrast-10pct);
84-
border-top: 1px solid var(--lumo-contrast-10pct);
85-
}
86-
87-
:host(:is([theme~='small'], [theme~='minimal'])) > [part='splitter'] {
88-
min-width: 0;
89-
min-height: 0;
90-
background-color: transparent;
91-
}
92-
93-
:host(:is([theme~='small'], [theme~='minimal'])) > [part='splitter']::after {
94-
content: '';
95-
position: absolute;
96-
inset: -4px;
28+
--vaadin-split-layout-handle-size: 5px;
29+
background: var(--lumo-contrast-10pct);
9730
}
9831

99-
:host(:is([theme~='small'], [theme~='minimal'])) > [part='splitter'] > [part='handle'] {
100-
left: calc(50% - 0.5px);
101-
top: calc(50% - 0.5px);
32+
/* Minimal */
33+
:host([theme~='minimal']) > [part='splitter'] {
34+
--vaadin-split-layout-splitter-size: 0px;
35+
--vaadin-split-layout-handle-size: 5px;
36+
--vaadin-split-layout-splitter-target-size: 5px;
10237
}
10338

104-
:host(:is([theme~='small'], [theme~='minimal'])) > [part='splitter'] > [part='handle']::after {
39+
:host([theme~='minimal']) > [part='splitter'] > [part='handle'] {
10540
opacity: 0;
106-
--_handle-size: 5px;
10741
}
10842

109-
:host(:is([theme~='small'], [theme~='minimal'])) > [part='splitter']:hover > [part='handle']::after,
110-
:host(:is([theme~='small'], [theme~='minimal'])) > [part='splitter']:active > [part='handle']::after {
43+
:host([theme~='minimal']) > [part='splitter']:is(:hover, :active) > [part='handle'] {
11144
opacity: 1;
11245
}
11346

11447
/* Hover style */
11548
@media (any-hover: hover) {
116-
[part='splitter']:hover [part='handle']::after {
49+
[part='splitter']:hover [part='handle'] {
11750
background-color: var(--lumo-contrast-40pct);
11851
}
11952
}
120-
121-
@media (forced-colors: active) {
122-
[part~='splitter'] {
123-
outline: 1px solid;
124-
}
125-
126-
[part~='handle']::after {
127-
background-color: AccentColor !important;
128-
forced-color-adjust: none;
129-
}
130-
}
13153
}

0 commit comments

Comments
 (0)