I have a component library dot-components which is based on mui-org/material-ui. I have another application which is using my dot-components component library and recently I have noticed a console warning appearing in my unit tests.
Console Warning
console.warn
Material-UI: The `css` function is deprecated. Use the `styleFunctionSx` instead.
at css (../../node_modules/@material-ui/system/styleFunctionSx.js:75:13)
at Object.<anonymous> (../../node_modules/@material-ui/core/Box/Box.js:14:37)
at Object.<anonymous> (../../node_modules/@material-ui/core/Box/index.js:21:36)
The console warning in question is related to mui-org/material-ui PR #23454 however I have gone through my application as well as dot-components and have confirmed we are not using Box at all. I've looked through all of stack overflow and searched everywhere I could online. I even tried asking about it in mui-org/material-ui #27799 however they are more concerned with closing issues than they are actually helping.
I am out of options here, and the only thing that I can think of is MUI is throwing a warning because it sees the use of css in my styled components
Styled Component Sample
import styled, { css } from 'styled-components';
export const StyledProductInstancesList = styled.div``;
export const StyledCard = styled(DotCard)`
${({ theme }) => css`
margin-bottom: ${theme.spacing(1)}px;
`}
`;
I put together a sandbox with a very clear minimal example of the issue I'm seeing.
Packages being imported
@material-ui/core: 4.11.4
@material-ui/styles: 4.11.4
@material-ui/system: 4.12.1
@material-ui/types: 5.1.0
@material-ui/utils: 4.11.2
@types/react: 16.9.56 => 16.9.56
react: 17.0.1 => 17.0.1
react-dom: 17.0.1 => 17.0.1
styled-components: 5.2.1 => 5.2.1
typescript: ~4.0.3 => 4.0.7