diff --git a/docs/data/material/migration/migrating-from-deprecated-apis/migrating-from-deprecated-apis.md b/docs/data/material/migration/migrating-from-deprecated-apis/migrating-from-deprecated-apis.md index cb06f952f07491..903eb619001eac 100644 --- a/docs/data/material/migration/migrating-from-deprecated-apis/migrating-from-deprecated-apis.md +++ b/docs/data/material/migration/migrating-from-deprecated-apis/migrating-from-deprecated-apis.md @@ -90,6 +90,36 @@ Bear in mind that the `.MuiAccordionSummary-gutters` class is applied to the com }, ``` +## Alert + +Use the [codemod](https://github.com/mui/material-ui/tree/HEAD/packages/mui-codemod#alert-props) below to migrate the code as described in the following sections: + +```bash +npx @mui/codemod@latest deprecations/alert-props +``` + +### components + +The Alert's `components` was deprecated in favor of `slots`: + +```diff + +``` + +### componentsProps + +The Alert's `componentsProps` was deprecated in favor of `slotProps`: + +```diff + +``` + ## Avatar Use the [codemod](https://github.com/mui/material-ui/tree/HEAD/packages/mui-codemod#avatar-props) below to migrate the code as described in the following sections: diff --git a/packages/mui-codemod/README.md b/packages/mui-codemod/README.md index 709373675e397c..479a4fd75405a0 100644 --- a/packages/mui-codemod/README.md +++ b/packages/mui-codemod/README.md @@ -136,6 +136,32 @@ CSS transforms: npx @mui/codemod@latest deprecations/accordion-summary-classes ``` +#### `alert-props` + +```diff + +``` + +```diff + MuiAlert: { + defaultProps: { +- components: { CloseButton: CustomButton } ++ slots: { closeButton: CustomButton }, +- componentsProps: { closeButton: { testid: 'test-id' }} ++ slotProps: { closeButton: { testid: 'test-id' } }, + }, +}, +``` + +```bash +npx @mui/codemod@latest deprecations/alert-props +``` + #### `avatar-props` ```diff diff --git a/packages/mui-codemod/src/deprecations/alert-props/test-cases/actual.js b/packages/mui-codemod/src/deprecations/alert-props/test-cases/actual.js index 1c1a02c7b7e601..380a640bce04fc 100644 --- a/packages/mui-codemod/src/deprecations/alert-props/test-cases/actual.js +++ b/packages/mui-codemod/src/deprecations/alert-props/test-cases/actual.js @@ -1,20 +1,18 @@ import Alert from '@mui/material/Alert'; ; ; + slots={{ closeIcon: SlotsIcon }} + components={{ CloseButton: ComponentsButton }} + slotProps={{ closeIcon: slotsIconProps }} + componentsProps={{ closeButton: componentsButtonProps }} +/>; ; + components={{ CloseButton: ComponentsButton }} + slotProps={{ closeIcon: slotsIconProps, closeButton: slotsButtonProps }} + componentsProps={{ closeButton: componentsButtonProps }} +/>;