Skip to content

Commit ef69e7e

Browse files
authored
refactor: update upload-file Lumo CSS to use base styles (#10059)
1 parent 0f42625 commit ef69e7e

File tree

10 files changed

+28
-57
lines changed

10 files changed

+28
-57
lines changed

packages/upload/src/vaadin-upload-file.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ class UploadFile extends UploadFileMixin(ThemableMixin(PolylitMixin(LumoInjectio
6363
return uploadFileStyles;
6464
}
6565

66+
static get lumoInjector() {
67+
return {
68+
includeBaseStyles: true,
69+
};
70+
}
71+
6672
/** @protected */
6773
render() {
6874
return html`
-452 Bytes
Loading
-596 Bytes
Loading
-449 Bytes
Loading
-443 Bytes
Loading
647 Bytes
Loading
666 Bytes
Loading
-283 Bytes
Loading
103 Bytes
Loading

packages/vaadin-lumo-styles/src/components/upload-file.css

Lines changed: 22 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,14 @@
55
*/
66
@media lumo_components_upload-file {
77
:host {
8-
display: block;
98
padding: var(--lumo-space-s) 0;
10-
outline: none;
9+
gap: 0 var(--lumo-space-xs);
1110
--_focus-ring-color: var(--vaadin-focus-ring-color, var(--lumo-primary-color-50pct));
1211
--_focus-ring-width: var(--vaadin-focus-ring-width, 2px);
1312
}
1413

15-
[hidden] {
16-
display: none;
17-
}
18-
19-
[part='row'] {
20-
list-style-type: none;
21-
display: flex;
22-
align-items: baseline;
23-
justify-content: space-between;
24-
}
25-
26-
button {
27-
background: transparent;
28-
padding: 0;
29-
border: none;
30-
box-shadow: none;
31-
}
32-
33-
:host([complete]) ::slotted([slot='progress']),
34-
:host([error]) ::slotted([slot='progress']) {
35-
display: none !important;
36-
}
37-
38-
:host([focus-ring]) [part='row'] {
14+
:host(:focus-visible) {
15+
outline: none;
3916
border-radius: var(--lumo-border-radius-s);
4017
box-shadow: 0 0 0 var(--_focus-ring-width) var(--_focus-ring-color);
4118
}
@@ -46,57 +23,47 @@
4623
font-size: var(--lumo-font-size-s);
4724
}
4825

49-
[part='info'] {
50-
display: flex;
51-
align-items: baseline;
52-
flex: auto;
53-
}
54-
55-
[part='meta'] {
56-
width: 0.001px;
57-
flex: 1 1 auto;
58-
}
59-
6026
[part='name'] {
27+
color: var(--lumo-body-text-color);
6128
white-space: nowrap;
62-
overflow: hidden;
63-
text-overflow: ellipsis;
6429
}
6530

6631
[part='commands'] {
67-
display: flex;
68-
align-items: baseline;
69-
flex: none;
32+
align-self: start;
7033
}
7134

7235
[part$='icon'] {
73-
margin-right: var(--lumo-space-xs);
7436
font-size: var(--lumo-icon-size-m);
7537
font-family: 'lumo-icons';
7638
line-height: 1;
77-
}
78-
79-
/* When both icons are hidden, let us keep space for one */
80-
[part='done-icon'][hidden] + [part='warning-icon'][hidden] {
81-
display: block !important;
82-
visibility: hidden;
39+
align-self: start;
8340
}
8441

8542
[part$='button'] {
86-
flex: none;
87-
margin-left: var(--lumo-space-xs);
43+
border: none;
44+
box-shadow: none;
45+
outline: none;
46+
padding: 0;
47+
border-radius: var(--lumo-border-radius-s);
8848
cursor: var(--lumo-clickable-cursor);
8949
}
9050

9151
[part$='button']:focus {
92-
outline: none;
93-
border-radius: var(--lumo-border-radius-s);
9452
box-shadow: 0 0 0 var(--_focus-ring-width) var(--_focus-ring-color);
9553
}
9654

55+
/* Vertically align icons / buttons with the first line of text */
56+
[part$='icon'],
57+
[part$='button'] {
58+
margin-top: calc((1em * var(--lumo-line-height-m) - var(--lumo-icon-size-m)) / 2);
59+
}
60+
9761
[part$='icon']::before,
9862
[part$='button']::before {
99-
vertical-align: -0.25em;
63+
background: transparent;
64+
mask-image: none;
65+
width: auto;
66+
height: auto;
10067
}
10168

10269
[part='done-icon']::before {
@@ -126,8 +93,6 @@
12693
}
12794

12895
::slotted([slot='progress']) {
129-
width: auto;
130-
margin-left: calc(var(--lumo-icon-size-m) + var(--lumo-space-xs));
131-
margin-right: calc(var(--lumo-icon-size-m) + var(--lumo-space-xs));
96+
margin-inline-end: calc(var(--lumo-icon-size-m) + var(--lumo-space-xs));
13297
}
13398
}

0 commit comments

Comments
 (0)