@@ -69,40 +69,43 @@ const IconButtonRoot = styled(ButtonBase, {
6969 marginRight : ownerState . size === 'small' ? - 3 : - 12 ,
7070 } ) ,
7171 } ) ,
72- ( { theme, ownerState } ) => ( {
73- ...( ownerState . color === 'inherit' && {
74- color : 'inherit' ,
75- } ) ,
76- ...( ownerState . color !== 'inherit' &&
77- ownerState . color !== 'default' && {
78- color : ( theme . vars || theme ) . palette [ ownerState . color ] . main ,
79- ...( ! ownerState . disableRipple && {
80- '&:hover' : {
81- backgroundColor : theme . vars
82- ? `rgba(${ theme . vars . palette [ ownerState . color ] . mainChannel } / ${
83- theme . vars . palette . action . hoverOpacity
84- } )`
85- : alpha ( theme . palette [ ownerState . color ] . main , theme . palette . action . hoverOpacity ) ,
86- // Reset on touch devices, it doesn't add specificity
87- '@media (hover: none)' : {
88- backgroundColor : 'transparent' ,
72+ ( { theme, ownerState } ) => {
73+ const palette = ( theme . vars || theme ) . palette ?. [ ownerState . color ] ;
74+ return {
75+ ...( ownerState . color === 'inherit' && {
76+ color : 'inherit' ,
77+ } ) ,
78+ ...( ownerState . color !== 'inherit' &&
79+ ownerState . color !== 'default' && {
80+ color : palette ?. main ,
81+ ...( ! ownerState . disableRipple && {
82+ '&:hover' : {
83+ ...( palette && {
84+ backgroundColor : theme . vars
85+ ? `rgba(${ palette . mainChannel } / ${ theme . vars . palette . action . hoverOpacity } )`
86+ : alpha ( palette . main , theme . palette . action . hoverOpacity ) ,
87+ } ) ,
88+ // Reset on touch devices, it doesn't add specificity
89+ '@media (hover: none)' : {
90+ backgroundColor : 'transparent' ,
91+ } ,
8992 } ,
90- } ,
93+ } ) ,
9194 } ) ,
95+ ...( ownerState . size === 'small' && {
96+ padding : 5 ,
97+ fontSize : theme . typography . pxToRem ( 18 ) ,
9298 } ) ,
93- ...( ownerState . size === 'small' && {
94- padding : 5 ,
95- fontSize : theme . typography . pxToRem ( 18 ) ,
96- } ) ,
97- ...( ownerState . size === 'large' && {
98- padding : 12 ,
99- fontSize : theme . typography . pxToRem ( 28 ) ,
100- } ) ,
101- [ `&.${ iconButtonClasses . disabled } ` ] : {
102- backgroundColor : 'transparent' ,
103- color : ( theme . vars || theme ) . palette . action . disabled ,
104- } ,
105- } ) ,
99+ ...( ownerState . size === 'large' && {
100+ padding : 12 ,
101+ fontSize : theme . typography . pxToRem ( 28 ) ,
102+ } ) ,
103+ [ `&.${ iconButtonClasses . disabled } ` ] : {
104+ backgroundColor : 'transparent' ,
105+ color : ( theme . vars || theme ) . palette . action . disabled ,
106+ } ,
107+ } ;
108+ } ,
106109) ;
107110
108111/**
0 commit comments