Fix: Switch component not being styled as disabled when is checked (#80012)

* Fix Switch component not being styled as disabled when checked

* Remove unnecessary code
This commit is contained in:
Sonia Aguilar 2024-01-04 15:07:22 +01:00 committed by GitHub
parent 0844b87b2f
commit d29f9cfd3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -85,11 +85,6 @@ const getSwitchStyles = (theme: GrafanaTheme2, transparent?: boolean) => ({
zIndex: -1000,
position: 'absolute',
'&:disabled + label': {
background: theme.colors.action.disabledBackground,
cursor: 'not-allowed',
},
'&:checked + label': {
background: theme.colors.primary.main,
borderColor: theme.colors.primary.main,
@ -104,6 +99,22 @@ const getSwitchStyles = (theme: GrafanaTheme2, transparent?: boolean) => ({
},
},
'&:disabled + label': {
background: theme.colors.action.disabledBackground,
borderColor: theme.colors.border.weak,
cursor: 'not-allowed',
'&:hover': {
background: theme.colors.action.disabledBackground,
},
},
'&:disabled:checked + label': {
'&::after': {
background: theme.colors.text.disabled,
},
},
'&:focus + label, &:focus-visible + label': getFocusStyles(theme),
'&:focus:not(:focus-visible) + label': getMouseFocusStyles(theme),