Skip to content

Commit e54c822

Browse files
authored
refactor: update upload Lumo CSS to use base styles (#10552)
1 parent 23b4c99 commit e54c822

24 files changed

+77
-25
lines changed

packages/upload/src/styles/vaadin-upload-base-styles.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ export const uploadStyles = css`
2121
2222
:host([dragover-valid]) {
2323
--vaadin-upload-background: var(--vaadin-background-container);
24-
--vaadin-upload-border: 1px dashed var(--vaadin-text-color);
24+
--vaadin-upload-border-color: var(--vaadin-text-color);
25+
border-style: dashed;
2526
}
2627
2728
:host([hidden]) {

packages/upload/src/vaadin-upload.d.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,21 @@ export interface UploadEventMap extends HTMLElementEventMap, UploadCustomEventMa
147147
* `dragover-valid` | Set when the dragged file is valid with `maxFiles` and `accept` criteria
148148
* `max-files-reached` | Set when maximum number of files that the user is allowed to add has been reached
149149
*
150+
* The following custom CSS properties are available for styling:
151+
*
152+
* Custom CSS property | Description
153+
* -----------------------------------------|-------------
154+
* `--vaadin-upload-background` | The host element background
155+
* `--vaadin-upload-border-color` | The host element border color
156+
* `--vaadin-upload-border-radius` | The host element border radius
157+
* `--vaadin-upload-border-width` | The host element border width
158+
* `--vaadin-upload-padding` | The host element padding
159+
* `--vaadin-upload-drop-label-color` | The drop label color
160+
* `--vaadin-upload-drop-label-font-size` | The drop label font size
161+
* `--vaadin-upload-drop-label-font-weight` | The drop label font weight
162+
* `--vaadin-upload-drop-label-gap` | The drop label gap
163+
* `--vaadin-upload-drop-label-line-height` | The drop label line height
164+
*
150165
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
151166
*
152167
* @fires {CustomEvent} file-reject - Fired when a file cannot be added to the queue due to a constrain.

packages/upload/src/vaadin-upload.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,21 @@ import { UploadMixin } from './vaadin-upload-mixin.js';
4545
* `dragover-valid` | Set when the dragged file is valid with `maxFiles` and `accept` criteria
4646
* `max-files-reached` | Set when maximum number of files that the user is allowed to add has been reached
4747
*
48+
* The following custom CSS properties are available for styling:
49+
*
50+
* Custom CSS property | Description
51+
* -----------------------------------------|-------------
52+
* `--vaadin-upload-background` | The host element background
53+
* `--vaadin-upload-border-color` | The host element border color
54+
* `--vaadin-upload-border-radius` | The host element border radius
55+
* `--vaadin-upload-border-width` | The host element border width
56+
* `--vaadin-upload-padding` | The host element padding
57+
* `--vaadin-upload-drop-label-color` | The drop label color
58+
* `--vaadin-upload-drop-label-font-size` | The drop label font size
59+
* `--vaadin-upload-drop-label-font-weight` | The drop label font weight
60+
* `--vaadin-upload-drop-label-gap` | The drop label gap
61+
* `--vaadin-upload-drop-label-line-height` | The drop label line height
62+
*
4863
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
4964
*
5065
* @fires {CustomEvent} file-reject - Fired when a file cannot be added to the queue due to a constrain.
@@ -75,6 +90,10 @@ class Upload extends UploadMixin(ElementMixin(ThemableMixin(PolylitMixin(LumoInj
7590
return uploadStyles;
7691
}
7792

93+
static get lumoInjector() {
94+
return { ...super.lumoInjector, includeBaseStyles: true };
95+
}
96+
7897
/** @protected */
7998
render() {
8099
return html`
4.82 KB
Loading
1 Byte
Loading
4.8 KB
Loading

packages/upload/test/visual/base/upload.test.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ describe('upload', () => {
3434
await visualDiff(div, `${dir}-nodrop`);
3535
});
3636

37+
it('dragover-valid', async () => {
38+
element.setAttribute('dragover-valid', '');
39+
await visualDiff(div, `${dir}-dragover-valid`);
40+
});
41+
3742
it('files', async () => {
3843
element.files = [
3944
{ name: 'Don Quixote.pdf', progress: 100, complete: true },
-133 Bytes
Loading
-128 Bytes
Loading
-133 Bytes
Loading

0 commit comments

Comments
 (0)