diff --git a/docs/data/material/migration/upgrade-to-v9/upgrade-to-v9.md b/docs/data/material/migration/upgrade-to-v9/upgrade-to-v9.md index 0e2cfdc73de838..048f8c2bc629de 100644 --- a/docs/data/material/migration/upgrade-to-v9/upgrade-to-v9.md +++ b/docs/data/material/migration/upgrade-to-v9/upgrade-to-v9.md @@ -471,3 +471,23 @@ If you render a `TextField` from `Autocomplete`, the `params` shape also changed )} /> ``` + +#### Accordion deprecated props removed + +Use the [accordion-props codemod](https://github.com/mui/material-ui/tree/HEAD/packages/mui-codemod#accordion-props) below to migrate the code as described in the following section: + +```bash +npx @mui/codemod@latest deprecations/accordion-props +``` + +The deprecated `Accordion` props have been removed. +Use the `slots` and `slotProps` props instead: + +```diff + +``` diff --git a/docs/pages/material-ui/api/accordion.json b/docs/pages/material-ui/api/accordion.json index 2beffdd0f7f8f4..c99cb5f4f299fb 100644 --- a/docs/pages/material-ui/api/accordion.json +++ b/docs/pages/material-ui/api/accordion.json @@ -33,16 +33,6 @@ "description": "Array<func
| object
| bool>
| func
| object" }, "additionalInfo": { "sx": true } - }, - "TransitionComponent": { - "type": { "name": "elementType" }, - "deprecated": true, - "deprecationInfo": "Use slots.transition instead. This prop will be removed in a future major release. See Migrating from deprecated APIs for more details." - }, - "TransitionProps": { - "type": { "name": "object" }, - "deprecated": true, - "deprecationInfo": "Use slotProps.transition instead. This prop will be removed in a future major release. See Migrating from deprecated APIs for more details." } }, "name": "Accordion", diff --git a/docs/translations/api-docs/accordion/accordion.json b/docs/translations/api-docs/accordion/accordion.json index df139b5eaa484f..a1883fb2b3494f 100644 --- a/docs/translations/api-docs/accordion/accordion.json +++ b/docs/translations/api-docs/accordion/accordion.json @@ -28,12 +28,6 @@ "slots": { "description": "The components used for each slot inside." }, "sx": { "description": "The system prop that allows defining system overrides as well as additional CSS styles." - }, - "TransitionComponent": { - "description": "The component used for the transition. Follow this guide to learn more about the requirements for this component." - }, - "TransitionProps": { - "description": "Props applied to the transition element. By default, the element is based on this Transition component." } }, "classDescriptions": { diff --git a/packages/mui-material/src/Accordion/Accordion.d.ts b/packages/mui-material/src/Accordion/Accordion.d.ts index e49fa0277480d7..6d7284e5f6e052 100644 --- a/packages/mui-material/src/Accordion/Accordion.d.ts +++ b/packages/mui-material/src/Accordion/Accordion.d.ts @@ -110,22 +110,6 @@ export interface AccordionOwnProps { * The system prop that allows defining system overrides as well as additional CSS styles. */ sx?: SxProps | undefined; - /** - * The component used for the transition. - * [Follow this guide](https://mui.com/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component. - * @deprecated Use `slots.transition` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details. - */ - TransitionComponent?: - | React.JSXElementConstructor< - TransitionProps & { children?: React.ReactElement | undefined } - > - | undefined; - /** - * Props applied to the transition element. - * By default, the element is based on this [`Transition`](https://reactcommunity.org/react-transition-group/transition/) component. - * @deprecated Use `slotProps.transition` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details. - */ - TransitionProps?: TransitionProps | undefined; } export type AccordionTypeMap< diff --git a/packages/mui-material/src/Accordion/Accordion.js b/packages/mui-material/src/Accordion/Accordion.js index f6d33ec6aeafaa..e072881bde2ba3 100644 --- a/packages/mui-material/src/Accordion/Accordion.js +++ b/packages/mui-material/src/Accordion/Accordion.js @@ -150,8 +150,6 @@ const Accordion = React.forwardRef(function Accordion(inProps, ref) { onChange, slots = {}, slotProps = {}, - TransitionComponent: TransitionComponentProp, - TransitionProps: TransitionPropsProp, ...other } = props; @@ -188,12 +186,9 @@ const Accordion = React.forwardRef(function Accordion(inProps, ref) { const classes = useUtilityClasses(ownerState); - const backwardCompatibleSlots = { transition: TransitionComponentProp, ...slots }; - const backwardCompatibleSlotProps = { transition: TransitionPropsProp, ...slotProps }; - const externalForwardedProps = { - slots: backwardCompatibleSlots, - slotProps: backwardCompatibleSlotProps, + slots, + slotProps, }; const [RootSlot, rootProps] = useSlot('root', { @@ -331,18 +326,6 @@ Accordion.propTypes /* remove-proptypes */ = { PropTypes.func, PropTypes.object, ]), - /** - * The component used for the transition. - * [Follow this guide](https://mui.com/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component. - * @deprecated Use `slots.transition` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details. - */ - TransitionComponent: PropTypes.elementType, - /** - * Props applied to the transition element. - * By default, the element is based on this [`Transition`](https://reactcommunity.org/react-transition-group/transition/) component. - * @deprecated Use `slotProps.transition` instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details. - */ - TransitionProps: PropTypes.object, }; export default Accordion; diff --git a/packages/mui-material/src/Accordion/Accordion.test.js b/packages/mui-material/src/Accordion/Accordion.test.js index 33e1e6c4fba1c8..fdb91033a29729 100644 --- a/packages/mui-material/src/Accordion/Accordion.test.js +++ b/packages/mui-material/src/Accordion/Accordion.test.js @@ -80,7 +80,7 @@ describe('', () => { it('should be controlled', () => { const { container, setProps } = render( - + {minimalChildren} , ); @@ -94,7 +94,7 @@ describe('', () => { const handleChange = spy(); render( - + {minimalChildren} , ); @@ -134,7 +134,7 @@ describe('', () => { expect(container.firstChild).to.have.class(classes.disabled); }); - it('should handle the TransitionComponent prop', () => { + it('should handle the slots.transition prop', () => { function NoTransitionCollapse(props) { return props.in ?
{props.children}
: null; } @@ -147,7 +147,7 @@ describe('', () => { return
Hello
; } const { setProps } = render( - + , @@ -221,7 +221,7 @@ describe('', () => { it('should warn when switching from controlled to uncontrolled', () => { const { setProps } = render( - + {minimalChildren} , ); @@ -233,7 +233,7 @@ describe('', () => { it('should warn when switching between uncontrolled to controlled', () => { const { setProps } = render( - {minimalChildren}, + {minimalChildren}, ); expect(() => setProps({ expanded: true })).toErrorDev( @@ -241,10 +241,10 @@ describe('', () => { ); }); - describe('prop: TransitionProps', () => { + describe('slotProps.transition', () => { it('should apply properties to the Transition component', () => { render( - + {minimalChildren} , );