Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Menu] Deprecate *Props and complete slots, slotProps #44913

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

siriwatknp
Copy link
Member

@siriwatknp siriwatknp commented Jan 2, 2025

Part of #41281

  • Deprecate MenuListProps and TransitionProps.
  • Added slots.transition and slots.list
  • Added a codemod for migration

@siriwatknp siriwatknp requested a review from DiegoAndai January 2, 2025 07:54
@siriwatknp siriwatknp added the component: menu This is the name of the generic UI component, not the React module! label Jan 2, 2025
@mui-bot
Copy link

mui-bot commented Jan 2, 2025

@siriwatknp siriwatknp marked this pull request as ready for review January 2, 2025 11:47
packages/mui-material/src/Menu/Menu.js Outdated Show resolved Hide resolved
packages/mui-material/src/Menu/Menu.js Outdated Show resolved Hide resolved
* [Follow this guide](https://mui.com/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
* @default Grow
*/
TransitionComponent: PropTypes.elementType,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we adding this one? slots.transition should be used instead.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's because I move TransitionComponent to the the props, let me find other way.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But did it work beofre this? I'm asking because it's not included in the API: https://mui.com/material-ui/api/menu/.

If it never worked before, there's no need to add it now.

If it worked, we can add it but we should:

  • Add it to the types (as it was incorrectly missing before)
  • Add the deprecated message

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it never worked before, there's no need to add it now.

This is because the TransitionComponent pass through …other before. But now, we need this backward compatibility with TransitionComponent={slots.transition ?? other.TransitionComponent}.

The moment I added the line, the generatePropTypes attached TransitionComponent to the proptypes. I haven't find a way to disable it in this case.

I think I will work on Popover first (to deprecate the TransitionComponent and then once it's done will revisit this PR)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see now.

Right, so if we finish the Popover first, then we can use its slots instead of TransitionComponent and we don't need to rescue TransitionComponent from other, this plan makes sense 👍🏼

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: menu This is the name of the generic UI component, not the React module! PR: out-of-date The pull request has merge conflicts and can't be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants