diff --git a/packages/material-ui/src/Autocomplete/Autocomplete.js b/packages/material-ui/src/Autocomplete/Autocomplete.js index 7e6588a1e1e787..3d92ca3fb90e3a 100644 --- a/packages/material-ui/src/Autocomplete/Autocomplete.js +++ b/packages/material-ui/src/Autocomplete/Autocomplete.js @@ -114,7 +114,7 @@ const AutocompleteRoot = experimentalStyled( }, )(({ styleProps }) => ({ /* Styles applied to the root element. */ - [`&.Mui-focused .${autocompleteClasses.clearIndicator}`]: { + [`&.${autocompleteClasses.focused} .${autocompleteClasses.clearIndicator}`]: { visibility: 'visible', }, /* Avoid double tap issue on iOS */ @@ -351,7 +351,7 @@ const AutocompleteListbox = experimentalStyled( opacity: theme.palette.action.disabledOpacity, pointerEvents: 'none', }, - '&.Mui-focusVisible': { + [`&.${autocompleteClasses.focusVisible}`]: { backgroundColor: theme.palette.action.focus, }, '&[aria-selected="true"]': { @@ -366,7 +366,7 @@ const AutocompleteListbox = experimentalStyled( backgroundColor: theme.palette.action.selected, }, }, - '&.Mui-focusVisible': { + [`&.${autocompleteClasses.focusVisible}`]: { backgroundColor: alpha( theme.palette.primary.main, theme.palette.action.selectedOpacity + theme.palette.action.focusOpacity, diff --git a/packages/material-ui/src/Autocomplete/autocompleteClasses.js b/packages/material-ui/src/Autocomplete/autocompleteClasses.js index 39689ac2478586..215065835f45f1 100644 --- a/packages/material-ui/src/Autocomplete/autocompleteClasses.js +++ b/packages/material-ui/src/Autocomplete/autocompleteClasses.js @@ -8,6 +8,7 @@ const autocompleteClasses = generateUtilityClasses('MuiAutocomplete', [ 'root', 'fullWidth', 'focused', + 'focusVisible', 'tag', 'tagSizeSmall', 'tagSizeMedium', diff --git a/packages/material-ui/src/Button/Button.js b/packages/material-ui/src/Button/Button.js index 4fd270f676d87e..cf52016d61dfa0 100644 --- a/packages/material-ui/src/Button/Button.js +++ b/packages/material-ui/src/Button/Button.js @@ -154,12 +154,12 @@ const ButtonRoot = experimentalStyled( boxShadow: theme.shadows[8], }), }, - '&.Mui-focusVisible': { + [`&.${buttonClasses.focusVisible}`]: { ...(styleProps.variant === 'contained' && { boxShadow: theme.shadows[6], }), }, - '&.Mui-disabled': { + [`&.${buttonClasses.disabled}`]: { color: theme.palette.action.disabled, ...(styleProps.variant === 'outlined' && { border: `1px solid ${theme.palette.action.disabledBackground}`, @@ -246,13 +246,13 @@ const ButtonRoot = experimentalStyled( '&:hover': { boxShadow: 'none', }, - '&.Mui-focusVisible': { + [`&.${buttonClasses.focusVisible}`]: { boxShadow: 'none', }, '&:active': { boxShadow: 'none', }, - '&.Mui-disabled': { + [`&.${buttonClasses.disabled}`]: { boxShadow: 'none', }, }, diff --git a/packages/material-ui/src/ButtonBase/ButtonBase.js b/packages/material-ui/src/ButtonBase/ButtonBase.js index e5eb416ba0f9df..2e8c4493bff9db 100644 --- a/packages/material-ui/src/ButtonBase/ButtonBase.js +++ b/packages/material-ui/src/ButtonBase/ButtonBase.js @@ -9,7 +9,7 @@ import useForkRef from '../utils/useForkRef'; import useEventCallback from '../utils/useEventCallback'; import useIsFocusVisible from '../utils/useIsFocusVisible'; import TouchRipple from './TouchRipple'; -import { getButtonBaseUtilityClass } from './buttonBaseClasses'; +import buttonBaseClasses, { getButtonBaseUtilityClass } from './buttonBaseClasses'; const overridesResolver = (props, styles) => styles.root || {}; @@ -58,7 +58,7 @@ export const ButtonBaseRoot = experimentalStyled( '&::-moz-focus-inner': { borderStyle: 'none', // Remove Firefox dotted outline. }, - '&.Mui-disabled': { + [`&.${buttonBaseClasses.disabled}`]: { pointerEvents: 'none', // Disable link interactions cursor: 'default', }, diff --git a/packages/material-ui/src/ButtonGroup/ButtonGroup.js b/packages/material-ui/src/ButtonGroup/ButtonGroup.js index 64fef87ddc6416..e9a8bb59989d8f 100644 --- a/packages/material-ui/src/ButtonGroup/ButtonGroup.js +++ b/packages/material-ui/src/ButtonGroup/ButtonGroup.js @@ -142,14 +142,14 @@ const ButtonGroupRoot = experimentalStyled( ...(styleProps.variant === 'contained' && styleProps.orientation === 'horizontal' && { borderRight: `1px solid ${theme.palette.grey[400]}`, - '&.Mui-disabled': { + [`&.${buttonGroupClasses.disabled}`]: { borderRight: `1px solid ${theme.palette.action.disabled}`, }, }), ...(styleProps.variant === 'contained' && styleProps.orientation === 'vertical' && { borderBottom: `1px solid ${theme.palette.grey[400]}`, - '&.Mui-disabled': { + [`&.${buttonGroupClasses.disabled}`]: { borderBottom: `1px solid ${theme.palette.action.disabled}`, }, }), diff --git a/packages/material-ui/src/CardActionArea/CardActionArea.js b/packages/material-ui/src/CardActionArea/CardActionArea.js index 3ea68c62469fb1..c832cec8e76fef 100644 --- a/packages/material-ui/src/CardActionArea/CardActionArea.js +++ b/packages/material-ui/src/CardActionArea/CardActionArea.js @@ -47,7 +47,7 @@ const CardActionAreaRoot = experimentalStyled( opacity: 0, }, }, - [`&.Mui-focusVisible .${cardActionAreaClasses.focusHighlight}`]: { + [`&.${cardActionAreaClasses.focusVisible} .${cardActionAreaClasses.focusHighlight}`]: { opacity: theme.palette.action.focusOpacity, }, })); diff --git a/packages/material-ui/src/Checkbox/Checkbox.js b/packages/material-ui/src/Checkbox/Checkbox.js index 912d7f210a3734..05c46bb0db3423 100644 --- a/packages/material-ui/src/Checkbox/Checkbox.js +++ b/packages/material-ui/src/Checkbox/Checkbox.js @@ -52,7 +52,7 @@ const CheckboxRoot = experimentalStyled( color: theme.palette.text.secondary, /* Styles applied to the root element unless `color="default"`. */ ...(styleProps.color !== 'default' && { - [`&.Mui-checked, &.${checkboxClasses.indeterminate}`]: { + [`&.${checkboxClasses.checked}, &.${checkboxClasses.indeterminate}`]: { color: theme.palette[styleProps.color].main, '&:hover': { backgroundColor: alpha( @@ -65,7 +65,7 @@ const CheckboxRoot = experimentalStyled( }, }, }, - '&.Mui-disabled': { + [`&.${checkboxClasses.disabled}`]: { color: theme.palette.action.disabled, }, }), diff --git a/packages/material-ui/src/Chip/Chip.js b/packages/material-ui/src/Chip/Chip.js index a11ed55fb8f49e..1e80e0300447d0 100644 --- a/packages/material-ui/src/Chip/Chip.js +++ b/packages/material-ui/src/Chip/Chip.js @@ -116,7 +116,7 @@ const ChipRoot = experimentalStyled( padding: 0, // Remove `button` padding verticalAlign: 'middle', boxSizing: 'border-box', - '&.Mui-disabled': { + [`&.${chipClasses.disabled}`]: { opacity: theme.palette.action.disabledOpacity, pointerEvents: 'none', }, @@ -194,7 +194,7 @@ const ChipRoot = experimentalStyled( }), /* Styles applied to the root element if `onDelete` is defined. */ ...(styleProps.onDelete && { - '&.Mui-focusVisible': { + [`&.${chipClasses.focusVisible}`]: { backgroundColor: alpha( theme.palette.action.selected, theme.palette.action.selectedOpacity + theme.palette.action.focusOpacity, @@ -204,7 +204,7 @@ const ChipRoot = experimentalStyled( /* Styles applied to the root element if `onDelete` and not `color="default"` is defined. */ ...(styleProps.onDelete && styleProps.color !== 'default' && { - '&.Mui-focusVisible': { + [`&.${chipClasses.focusVisible}`]: { backgroundColor: theme.palette[styleProps.color].dark, }, }), @@ -222,7 +222,7 @@ const ChipRoot = experimentalStyled( theme.palette.action.selectedOpacity + theme.palette.action.hoverOpacity, ), }, - '&.Mui-focusVisible': { + [`&.${chipClasses.focusVisible}`]: { backgroundColor: alpha( theme.palette.action.selected, theme.palette.action.selectedOpacity + theme.palette.action.focusOpacity, @@ -235,7 +235,7 @@ const ChipRoot = experimentalStyled( /* Styles applied to the root element if `onClick` and not `color="default"` is defined or `clickable={true}`. */ ...(styleProps.clickable && styleProps.color !== 'default' && { - '&:hover, &.Mui-focusVisible': { + [`&:hover, &.${chipClasses.focusVisible}`]: { backgroundColor: theme.palette[styleProps.color].dark, }, }), @@ -250,7 +250,7 @@ const ChipRoot = experimentalStyled( [`&.${chipClasses.clickable}:hover`]: { backgroundColor: theme.palette.action.hover, }, - '&.Mui-focusVisible': { + [`&.${chipClasses.focusVisible}`]: { backgroundColor: theme.palette.action.focus, }, [`& .${chipClasses.avatar}`]: { @@ -283,7 +283,7 @@ const ChipRoot = experimentalStyled( theme.palette.action.hoverOpacity, ), }, - '&.Mui-focusVisible': { + [`&.${chipClasses.focusVisible}`]: { backgroundColor: alpha( theme.palette[styleProps.color].main, theme.palette.action.focusOpacity, diff --git a/packages/material-ui/src/Fab/Fab.js b/packages/material-ui/src/Fab/Fab.js index 76eefffbba88d5..09e2d56e69a1ce 100644 --- a/packages/material-ui/src/Fab/Fab.js +++ b/packages/material-ui/src/Fab/Fab.js @@ -78,10 +78,10 @@ const FabRoot = experimentalStyled( }, textDecoration: 'none', }, - '&.Mui-focusVisible': { + [`&.${fabClasses.focusVisible}`]: { boxShadow: theme.shadows[6], }, - '&.Mui-disabled': { + [`&.${fabClasses.disabled}`]: { color: theme.palette.action.disabled, boxShadow: theme.shadows[0], backgroundColor: theme.palette.action.disabledBackground, diff --git a/packages/material-ui/src/FilledInput/FilledInput.js b/packages/material-ui/src/FilledInput/FilledInput.js index c28b0e5bc5d62d..903c5969abe516 100644 --- a/packages/material-ui/src/FilledInput/FilledInput.js +++ b/packages/material-ui/src/FilledInput/FilledInput.js @@ -5,7 +5,7 @@ import { unstable_composeClasses as composeClasses } from '@material-ui/unstyled import InputBase from '../InputBase'; import experimentalStyled, { shouldForwardProp } from '../styles/experimentalStyled'; import useThemeProps from '../styles/useThemeProps'; -import { getFilledInputUtilityClass } from './filledInputClasses'; +import filledInputClasses, { getFilledInputUtilityClass } from './filledInputClasses'; import { overridesResolver as inputBaseOverridesResolver, InputBaseRoot, @@ -55,10 +55,10 @@ const FilledInputRoot = experimentalStyled( backgroundColor, }, }, - '&.Mui-focused': { + [`&.${filledInputClasses.focused}`]: { backgroundColor, }, - '&.Mui-disabled': { + [`&.${filledInputClasses.disabled}`]: { backgroundColor: light ? 'rgba(0, 0, 0, 0.12)' : 'rgba(255, 255, 255, 0.12)', }, ...(!styleProps.disableUnderline && { @@ -77,10 +77,10 @@ const FilledInputRoot = experimentalStyled( }), pointerEvents: 'none', // Transparent to the hover style. }, - '&.Mui-focused:after': { + [`&.${filledInputClasses.focused}:after`]: { transform: 'scaleX(1)', }, - '&.Mui-error:after': { + [`&.${filledInputClasses.error}:after`]: { borderBottomColor: theme.palette.error.main, transform: 'scaleX(1)', // error is always underlined in red }, @@ -97,10 +97,10 @@ const FilledInputRoot = experimentalStyled( }), pointerEvents: 'none', // Transparent to the hover style. }, - '&:hover:not(.Mui-disabled):before': { + [`&:hover:not(.${filledInputClasses.disabled}):before`]: { borderBottom: `1px solid ${theme.palette.text.primary}`, }, - '&.Mui-disabled:before': { + [`&.${filledInputClasses.disabled}:before`]: { borderBottomStyle: 'dotted', }, }), diff --git a/packages/material-ui/src/FilledInput/filledInputClasses.js b/packages/material-ui/src/FilledInput/filledInputClasses.js index 20b29a507dc290..9d13af49557756 100644 --- a/packages/material-ui/src/FilledInput/filledInputClasses.js +++ b/packages/material-ui/src/FilledInput/filledInputClasses.js @@ -4,6 +4,13 @@ export function getFilledInputUtilityClass(slot) { return generateUtilityClass('MuiFilledInput', slot); } -const filledInputClasses = generateUtilityClasses('MuiFilledInput', ['root', 'underline', 'input']); +const filledInputClasses = generateUtilityClasses('MuiFilledInput', [ + 'root', + 'focused', + 'disabled', + 'error', + 'underline', + 'input', +]); export default filledInputClasses; diff --git a/packages/material-ui/src/FormControl/formControlClasses.js b/packages/material-ui/src/FormControl/formControlClasses.js index afd2e623acd5ba..6fdc6f36089d06 100644 --- a/packages/material-ui/src/FormControl/formControlClasses.js +++ b/packages/material-ui/src/FormControl/formControlClasses.js @@ -10,6 +10,7 @@ const formControlClasses = generateUtilityClasses('MuiFormControl', [ 'marginNormal', 'marginDense', 'fullWidth', + 'disabled', ]); export default formControlClasses; diff --git a/packages/material-ui/src/FormControlLabel/FormControlLabel.js b/packages/material-ui/src/FormControlLabel/FormControlLabel.js index dfaf3de842121b..db84cb721db925 100644 --- a/packages/material-ui/src/FormControlLabel/FormControlLabel.js +++ b/packages/material-ui/src/FormControlLabel/FormControlLabel.js @@ -47,7 +47,7 @@ export const FormControlLabelRoot = experimentalStyled( WebkitTapHighlightColor: 'transparent', marginLeft: -11, marginRight: 16, // used for row presentation of radio/checkbox - '&.Mui-disabled': { + [`&.${formControlLabelClasses.disabled}`]: { cursor: 'default', }, ...(styleProps.labelPlacement === 'start' && { @@ -64,7 +64,7 @@ export const FormControlLabelRoot = experimentalStyled( marginLeft: 16, }), [`& .${formControlLabelClasses.label}`]: { - '&.Mui-disabled': { + [`&.${formControlLabelClasses.disabled}`]: { color: theme.palette.text.disabled, }, }, diff --git a/packages/material-ui/src/FormHelperText/FormHelperText.js b/packages/material-ui/src/FormHelperText/FormHelperText.js index a0ddf5e79cd167..d06c4543c8a80c 100644 --- a/packages/material-ui/src/FormHelperText/FormHelperText.js +++ b/packages/material-ui/src/FormHelperText/FormHelperText.js @@ -7,7 +7,7 @@ import formControlState from '../FormControl/formControlState'; import useFormControl from '../FormControl/useFormControl'; import experimentalStyled from '../styles/experimentalStyled'; import capitalize from '../utils/capitalize'; -import { getFormHelperTextUtilityClasses } from './formHelperTextClasses'; +import formHelperTextClasses, { getFormHelperTextUtilityClasses } from './formHelperTextClasses'; import useThemeProps from '../styles/useThemeProps'; const overridesResolver = (props, styles) => { @@ -53,10 +53,10 @@ const FormHelperTextRoot = experimentalStyled( marginRight: 0, marginBottom: 0, marginLeft: 0, - '&.Mui-disabled': { + [`&.${formHelperTextClasses.disabled}`]: { color: theme.palette.text.disabled, }, - '&.Mui-error': { + [`&.${formHelperTextClasses.error}`]: { color: theme.palette.error.main, }, ...(styleProps.size === 'small' && { diff --git a/packages/material-ui/src/FormLabel/FormLabel.js b/packages/material-ui/src/FormLabel/FormLabel.js index 459b8eaf29522c..61a4b6d77e1bed 100644 --- a/packages/material-ui/src/FormLabel/FormLabel.js +++ b/packages/material-ui/src/FormLabel/FormLabel.js @@ -50,13 +50,13 @@ export const FormLabelRoot = experimentalStyled( ...theme.typography.body1, lineHeight: '1.4375em', padding: 0, - '&.Mui-focused': { + [`&.${formLabelClasses.focused}`]: { color: theme.palette[styleProps.color].main, }, - '&.Mui-disabled': { + [`&.${formLabelClasses.disabled}`]: { color: theme.palette.text.disabled, }, - '&.Mui-error': { + [`&.${formLabelClasses.error}`]: { color: theme.palette.error.main, }, })); @@ -66,7 +66,7 @@ const AsteriskComponent = experimentalStyled( {}, { name: 'MuiFormLabel', slot: 'Asterisk' }, )(({ theme }) => ({ - '&.Mui-error': { + [`&.${formLabelClasses.error}`]: { color: theme.palette.error.main, }, })); diff --git a/packages/material-ui/src/Input/Input.js b/packages/material-ui/src/Input/Input.js index 4063d64e896f4a..26969cba2f8148 100644 --- a/packages/material-ui/src/Input/Input.js +++ b/packages/material-ui/src/Input/Input.js @@ -5,7 +5,7 @@ import { deepmerge, refType } from '@material-ui/utils'; import InputBase from '../InputBase'; import experimentalStyled, { shouldForwardProp } from '../styles/experimentalStyled'; import useThemeProps from '../styles/useThemeProps'; -import { getInputUtilityClass } from './inputClasses'; +import inputClasses, { getInputUtilityClass } from './inputClasses'; import { overridesResolver as inputBaseOverridesResolver, InputBaseRoot, @@ -64,10 +64,10 @@ const InputRoot = experimentalStyled( }), pointerEvents: 'none', // Transparent to the hover style. }, - '&.Mui-focused:after': { + [`&.${inputClasses.focused}:after`]: { transform: 'scaleX(1)', }, - '&.Mui-error:after': { + [`&.${inputClasses.error}:after`]: { borderBottomColor: theme.palette.error.main, transform: 'scaleX(1)', // error is always underlined in red }, @@ -84,14 +84,14 @@ const InputRoot = experimentalStyled( }), pointerEvents: 'none', // Transparent to the hover style. }, - '&:hover:not(.Mui-disabled):before': { + [`&:hover:not(.${inputClasses.disabled}):before`]: { borderBottom: `2px solid ${theme.palette.text.primary}`, // Reset on touch devices, it doesn't add specificity '@media (hover: none)': { borderBottom: `1px solid ${bottomLineColor}`, }, }, - '&.Mui-disabled:before': { + [`&.${inputClasses.disabled}:before`]: { borderBottomStyle: 'dotted', }, }), diff --git a/packages/material-ui/src/Input/inputClasses.js b/packages/material-ui/src/Input/inputClasses.js index 5120b2561ca098..ac721073772112 100644 --- a/packages/material-ui/src/Input/inputClasses.js +++ b/packages/material-ui/src/Input/inputClasses.js @@ -4,6 +4,13 @@ export function getInputUtilityClass(slot) { return generateUtilityClass('MuiInput', slot); } -const inputClasses = generateUtilityClasses('MuiInput', ['root', 'underline', 'input']); +const inputClasses = generateUtilityClasses('MuiInput', [ + 'root', + 'focused', + 'error', + 'disabled', + 'underline', + 'input', +]); export default inputClasses; diff --git a/packages/material-ui/src/InputBase/InputBase.js b/packages/material-ui/src/InputBase/InputBase.js index 19320d459c74dc..99b9f9a2b97e84 100644 --- a/packages/material-ui/src/InputBase/InputBase.js +++ b/packages/material-ui/src/InputBase/InputBase.js @@ -107,7 +107,7 @@ export const InputBaseRoot = experimentalStyled( cursor: 'text', display: 'inline-flex', alignItems: 'center', - '&.Mui-disabled': { + [`&.${inputBaseClasses.disabled}`]: { color: theme.palette.text.disabled, cursor: 'default', }, @@ -190,7 +190,7 @@ export const InputBaseComponent = experimentalStyled( '&:focus:-ms-input-placeholder': placeholderVisible, // IE11 '&:focus::-ms-input-placeholder': placeholderVisible, // Edge }, - '&.Mui-disabled': { + [`&.${inputBaseClasses.disabled}`]: { opacity: 1, // Reset iOS opacity WebkitTextFillColor: theme.palette.text.disabled, // Fix opacity Safari bug }, diff --git a/packages/material-ui/src/NativeSelect/NativeSelectInput.js b/packages/material-ui/src/NativeSelect/NativeSelectInput.js index 9ee1ba0ca124cd..2b25146e89b985 100644 --- a/packages/material-ui/src/NativeSelect/NativeSelectInput.js +++ b/packages/material-ui/src/NativeSelect/NativeSelectInput.js @@ -53,7 +53,7 @@ export const nativeSelectRootStyles = ({ styleProps, theme }) => ({ '&::-ms-expand': { display: 'none', }, - '&.Mui-disabled': { + [`&.${nativeSelectClasses.disabled}`]: { cursor: 'default', }, '&[multiple]': { @@ -97,7 +97,7 @@ export const nativeSelectIconStyles = ({ styleProps, theme }) => ({ top: 'calc(50% - 12px)', // Center vertically pointerEvents: 'none', // Don't block pointer events on the select under the icon. color: theme.palette.action.active, - '&.Mui-disabled': { + [`&.${nativeSelectClasses.disabled}`]: { color: theme.palette.action.disabled, }, ...(styleProps.open && { diff --git a/packages/material-ui/src/OutlinedInput/OutlinedInput.js b/packages/material-ui/src/OutlinedInput/OutlinedInput.js index d9ca7b8ff7ba7b..a0b1def4f211de 100644 --- a/packages/material-ui/src/OutlinedInput/OutlinedInput.js +++ b/packages/material-ui/src/OutlinedInput/OutlinedInput.js @@ -54,14 +54,14 @@ const OutlinedInputRoot = experimentalStyled( borderColor, }, }, - [`&.Mui-focused .${outlinedInputClasses.notchedOutline}`]: { + [`&.${outlinedInputClasses.focused} .${outlinedInputClasses.notchedOutline}`]: { borderColor: theme.palette[styleProps.color].main, borderWidth: 2, }, - [`&.Mui-error .${outlinedInputClasses.notchedOutline}`]: { + [`&.${outlinedInputClasses.error} .${outlinedInputClasses.notchedOutline}`]: { borderColor: theme.palette.error.main, }, - [`&.Mui-disabled .${outlinedInputClasses.notchedOutline}`]: { + [`&.${outlinedInputClasses.disabled} .${outlinedInputClasses.notchedOutline}`]: { borderColor: theme.palette.action.disabled, }, ...(styleProps.startAdornment && { diff --git a/packages/material-ui/src/OutlinedInput/outlinedInputClasses.js b/packages/material-ui/src/OutlinedInput/outlinedInputClasses.js index a926d5b86b69e6..c74405362f821f 100644 --- a/packages/material-ui/src/OutlinedInput/outlinedInputClasses.js +++ b/packages/material-ui/src/OutlinedInput/outlinedInputClasses.js @@ -6,6 +6,9 @@ export function getOutlinedInputUtilityClass(slot) { const outlinedInputClasses = generateUtilityClasses('MuiOutlinedInput', [ 'root', + 'focused', + 'error', + 'disabled', 'notchedOutline', 'input', ]); diff --git a/packages/material-ui/src/PaginationItem/PaginationItem.js b/packages/material-ui/src/PaginationItem/PaginationItem.js index 40f7c51a938884..c543ff3a7fec53 100644 --- a/packages/material-ui/src/PaginationItem/PaginationItem.js +++ b/packages/material-ui/src/PaginationItem/PaginationItem.js @@ -83,7 +83,7 @@ const PaginationItemEllipsis = experimentalStyled( color: theme.palette.text.primary, height: 'auto', /* Styles applied to the root element if `disabled="true"`. */ - '&.Mui-disabled': { + [`&.${paginationItemClasses.disabled}`]: { opacity: theme.palette.action.disabledOpacity, }, /* Styles applied to the root element if `size="small"`. */ @@ -122,11 +122,11 @@ const PaginationItemPage = experimentalStyled( padding: '0 6px', margin: '0 3px', color: theme.palette.text.primary, - '&.Mui-focusVisible': { + [`&.${paginationItemClasses.focusVisible}`]: { backgroundColor: theme.palette.action.focus, }, /* Styles applied to the root element if `disabled="true"`. */ - '&.Mui-disabled': { + [`&.${paginationItemClasses.disabled}`]: { opacity: theme.palette.action.disabledOpacity, }, /* Styles applied to the root element if `type="page"`. */ @@ -141,7 +141,7 @@ const PaginationItemPage = experimentalStyled( backgroundColor: 'transparent', }, }, - '&.Mui-selected': { + [`&.${paginationItemClasses.selected}`]: { backgroundColor: theme.palette.action.selected, '&:hover': { backgroundColor: alpha( @@ -153,13 +153,13 @@ const PaginationItemPage = experimentalStyled( backgroundColor: theme.palette.action.selected, }, }, - '&.Mui-focusVisible': { + [`&.${paginationItemClasses.focusVisible}`]: { backgroundColor: alpha( theme.palette.action.selected, theme.palette.action.selectedOpacity + theme.palette.action.focusOpacity, ), }, - '&.Mui-disabled': { + [`&.${paginationItemClasses.disabled}`]: { opacity: 1, color: theme.palette.action.disabled, backgroundColor: theme.palette.action.selected, @@ -190,7 +190,7 @@ const PaginationItemPage = experimentalStyled( ({ theme, styleProps }) => ({ /* Styles applied to the root element if `variant="text"`. */ ...(styleProps.variant === 'text' && { - '&.Mui-selected': { + [`&.${paginationItemClasses.selected}`]: { ...(styleProps.color !== 'standard' && { color: theme.palette[styleProps.color].contrastText, backgroundColor: theme.palette[styleProps.color].main, @@ -201,11 +201,11 @@ const PaginationItemPage = experimentalStyled( backgroundColor: theme.palette[styleProps.color].main, }, }, - '&.Mui-focusVisible': { + [`&.${paginationItemClasses.focusVisible}`]: { backgroundColor: theme.palette[styleProps.color].dark, }, }), - '&.Mui-disabled': { + [`&.${paginationItemClasses.disabled}`]: { color: theme.palette.action.disabled, }, }, @@ -215,7 +215,7 @@ const PaginationItemPage = experimentalStyled( border: `1px solid ${ theme.palette.mode === 'light' ? 'rgba(0, 0, 0, 0.23)' : 'rgba(255, 255, 255, 0.23)' }`, - '&.Mui-selected': { + [`&.${paginationItemClasses.selected}`]: { ...(styleProps.color !== 'standard' && { color: theme.palette[styleProps.color].main, border: `1px solid ${alpha(theme.palette[styleProps.color].main, 0.5)}`, @@ -233,14 +233,14 @@ const PaginationItemPage = experimentalStyled( backgroundColor: 'transparent', }, }, - '&.Mui-focusVisible': { + [`&.${paginationItemClasses.focusVisible}`]: { backgroundColor: alpha( theme.palette[styleProps.color].main, theme.palette.action.activatedOpacity + theme.palette.action.focusOpacity, ), }, }), - '&.Mui-disabled': { + [`&.${paginationItemClasses.disabled}`]: { borderColor: theme.palette.action.disabledBackground, color: theme.palette.action.disabled, }, diff --git a/packages/material-ui/src/Radio/Radio.js b/packages/material-ui/src/Radio/Radio.js index aad87b70e3e49d..708b08f6cb7552 100644 --- a/packages/material-ui/src/Radio/Radio.js +++ b/packages/material-ui/src/Radio/Radio.js @@ -9,7 +9,7 @@ import { alpha } from '../styles/colorManipulator'; import capitalize from '../utils/capitalize'; import createChainedFunction from '../utils/createChainedFunction'; import useRadioGroup from '../RadioGroup/useRadioGroup'; -import { getRadioUtilityClass } from './radioClasses'; +import radioClasses, { getRadioUtilityClass } from './radioClasses'; import experimentalStyled, { shouldForwardProp } from '../styles/experimentalStyled'; const overridesResolver = (props, styles) => { @@ -44,7 +44,7 @@ const RadioRoot = experimentalStyled( color: theme.palette.text.secondary, /* Styles applied to the root element unless `color="default"`. */ ...(styleProps.color !== 'default' && { - '&.Mui-checked': { + [`&.${radioClasses.checked}`]: { color: theme.palette[styleProps.color].main, '&:hover': { backgroundColor: alpha( @@ -58,7 +58,7 @@ const RadioRoot = experimentalStyled( }, }, }), - '&.Mui-disabled': { + [`&.${radioClasses.disabled}`]: { color: theme.palette.action.disabled, }, })); diff --git a/packages/material-ui/src/Rating/Rating.js b/packages/material-ui/src/Rating/Rating.js index c06640faeb2894..2c6a3a03815361 100644 --- a/packages/material-ui/src/Rating/Rating.js +++ b/packages/material-ui/src/Rating/Rating.js @@ -106,11 +106,11 @@ const RatingRoot = experimentalStyled( cursor: 'pointer', textAlign: 'left', WebkitTapHighlightColor: 'transparent', - '&.Mui-disabled': { + [`&.${ratingClasses.disabled}`]: { opacity: theme.palette.action.disabledOpacity, pointerEvents: 'none', }, - [`&.Mui-focusVisible .${ratingClasses.iconActive}`]: { + [`&.${ratingClasses.focusVisible} .${ratingClasses.iconActive}`]: { outline: '1px solid #999', }, [`& .${ratingClasses.visuallyHidden}`]: visuallyHidden, diff --git a/packages/material-ui/src/Select/Select.test.js b/packages/material-ui/src/Select/Select.test.js index 740ed8052e383d..27fe07d23f36f8 100644 --- a/packages/material-ui/src/Select/Select.test.js +++ b/packages/material-ui/src/Select/Select.test.js @@ -698,7 +698,7 @@ describe('