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

[material-ui][Popover] Deprecate *Props and complete slots, slotProps #45035

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

Conversation

siriwatknp
Copy link
Member

Part of #41281

  • Deprecate BackdropComponent, BackdropProps, PaperProps, TransitionComponent, and TransitionProps.
  • Added root, paper, transition, and backdrop slots
  • Added a codemod for migration

@siriwatknp siriwatknp added component: Popover The React component. package: material-ui Specific to @mui/material labels Jan 16, 2025
@mui-bot
Copy link

mui-bot commented Jan 16, 2025

Netlify deploy preview

Popover: parsed: +0.72% , gzip: +0.45%
TextField: parsed: +0.46% , gzip: +0.31%

Bundle size report

Details of bundle changes (Toolpad)
Details of bundle changes

Generated by 🚫 dangerJS against d12623d

@@ -63,6 +63,12 @@ describe('<Popover />', () => {
<ReplacementPaper ref={ref} {...props} data-testid="custom" />
)),
},
backdrop: {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
backdrop: {
transition: {
expectedClassName: classes.transition,
testWithElement: null,
},

i think test for transition slot is missing

@@ -644,7 +644,7 @@ function testSlotPropsCallbackWithPropsAsOwnerState(
const { queryByTestId } = await render(
React.cloneElement(element, { slotProps, className: 'custom' }),
);
const slotComponent = queryByTestId('custom');
const slotComponent = queryByTestId('custom', { exact: false });
Copy link
Member

Choose a reason for hiding this comment

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

Why is this required?

Copy link
Member Author

Choose a reason for hiding this comment

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

For slots that are passed to inner component like the backdrop, the className from the ownerState is concatenated with the outer component's className, so the value is not exactly custom.

The { exact: false } still capture the custom class but neglect other classes from the outer component.

packages/mui-material/src/Popover/Popover.d.ts Outdated Show resolved Hide resolved
packages/mui-material/src/Popover/Popover.d.ts Outdated Show resolved Hide resolved
packages/mui-material/src/Popover/Popover.js Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: Popover The React component. package: material-ui Specific to @mui/material
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants