Skip to content

Commit 51c6ee1

Browse files
authored
refactor!: redesign disabled button styles (Lumo) (#2644)
1 parent ac791ce commit 51c6ee1

13 files changed

Lines changed: 14 additions & 23 deletions

File tree

-114 Bytes
Loading
-50 Bytes
Loading
55 Bytes
Loading
-108 Bytes
Loading

‎packages/button/theme/lumo/vaadin-button-styles.js‎

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,6 @@ const button = css`
4848
--lumo-button-size: var(--lumo-size-l);
4949
}
5050
51-
/* This needs to be the last selector for it to take priority */
52-
:host([disabled][disabled]) {
53-
pointer-events: none;
54-
color: var(--lumo-disabled-text-color);
55-
background-color: var(--lumo-contrast-5pct);
56-
}
57-
5851
/* For interaction states */
5952
:host::before,
6053
:host::after {
@@ -114,7 +107,6 @@ const button = css`
114107
:host([theme~='tertiary']),
115108
:host([theme~='tertiary-inline']) {
116109
background-color: transparent !important;
117-
transition: opacity 0.2s;
118110
min-width: 0;
119111
}
120112
@@ -147,11 +139,6 @@ const button = css`
147139
min-width: calc(var(--lumo-button-size) * 2.5);
148140
}
149141
150-
:host([theme~='primary'][disabled]) {
151-
background-color: var(--lumo-primary-color-50pct);
152-
color: var(--lumo-primary-contrast-color);
153-
}
154-
155142
:host([theme~='primary'])::before {
156143
background-color: black;
157144
}
@@ -181,10 +168,6 @@ const button = css`
181168
color: var(--lumo-success-contrast-color);
182169
}
183170
184-
:host([theme~='success'][theme~='primary'][disabled]) {
185-
background-color: var(--lumo-success-color-50pct);
186-
}
187-
188171
:host([theme~='error']) {
189172
color: var(--lumo-error-text-color);
190173
}
@@ -194,10 +177,6 @@ const button = css`
194177
color: var(--lumo-error-contrast-color);
195178
}
196179
197-
:host([theme~='error'][theme~='primary'][disabled]) {
198-
background-color: var(--lumo-error-color-50pct);
199-
}
200-
201180
:host([theme~='contrast']) {
202181
color: var(--lumo-contrast);
203182
}
@@ -207,8 +186,20 @@ const button = css`
207186
color: var(--lumo-base-color);
208187
}
209188
210-
:host([theme~='contrast'][theme~='primary'][disabled]) {
211-
background-color: var(--lumo-contrast-50pct);
189+
/* Disabled state. Keep selectors after other color variants. */
190+
191+
:host([disabled]) {
192+
pointer-events: none;
193+
color: var(--lumo-disabled-text-color);
194+
}
195+
196+
:host([theme~='primary'][disabled]) {
197+
background-color: var(--lumo-contrast-30pct);
198+
color: var(--lumo-base-color);
199+
}
200+
201+
:host([theme~='primary'][disabled]) [part] {
202+
opacity: 0.7;
212203
}
213204
214205
/* Icons */
8 Bytes
Loading
71 Bytes
Loading
58 Bytes
Loading
63 Bytes
Loading
-32 Bytes
Loading

0 commit comments

Comments
 (0)