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

[Popper][base] Drop component prop #37084

Merged
merged 15 commits into from
May 2, 2023
Merged

Conversation

hbjORbj
Copy link
Member

@hbjORbj hbjORbj commented Apr 28, 2023

No description provided.

@hbjORbj hbjORbj self-assigned this Apr 28, 2023
@hbjORbj hbjORbj added breaking change component: Popper The React component. See <Popup> for the latest version. package: base-ui Specific to @mui/base labels Apr 28, 2023
@mui-bot
Copy link

mui-bot commented Apr 28, 2023

Netlify deploy preview

https://deploy-preview-37084--material-ui.netlify.app/

Bundle size report

Details of bundle changes

Generated by 🚫 dangerJS against c46495a

@nicolas-ot
Copy link
Contributor

You have the same error as mine!

well for test_uni-1
3) useSlot
unstyled popper as the root slot
4) useSlot
multiple slots with unstyled popper

I changed this:

image

@@ -72,10 +77,9 @@ const Popper = React.forwardRef(function Popper(
...other
} = props;

const RootComponent = slots?.root ?? components?.Root;
const RootComponent = component ?? slots?.root ?? components?.Root;
Copy link
Member

Choose a reason for hiding this comment

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

Is there any difference between this and letting the styled util handle the component prop as done in the other components?

Copy link
Member Author

Choose a reason for hiding this comment

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

We never did <PopperRoot as={component} ...> but simply pass component prop as part of otherProps to Base Popper, so I think this is the correct way. cc @michaldudak

Copy link
Member

Choose a reason for hiding this comment

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

The end behavior should be the same tough, right?

Copy link
Member

Choose a reason for hiding this comment

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

I think the result is the same, as Popper has no styles. I believe we should let styled handle this as in other components, for consistency. I don't know why it wasn't implemented like this from the start.

Copy link
Member Author

Choose a reason for hiding this comment

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

addressed

const ignoreList = [
'/pages.ts',
'docs/data/joy/getting-started/templates',
'docs/data/base/components/select/UnstyledSelectIntroduction.tsx',
Copy link
Member Author

Choose a reason for hiding this comment

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

This demo will create PropTypes and slotProps.popper gets wild... here's the snapshot... hence this change for now.. @michaldudak
Screenshot 2023-05-01 at 14 47 48

Copy link
Member

Choose a reason for hiding this comment

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

Let's create an issue for this prop, would be great to know what's causing it.

Copy link
Member

@mnajdova mnajdova left a comment

Choose a reason for hiding this comment

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

The changes look good 👍 Left few final comments for consideration.

@@ -37,8 +38,7 @@ describe('<Popper />', () => {
<Popper
anchorEl={() => document.createElement('div')}
open
component={CustomComponent}
ownerState={{ id: 'id' }}
slots={{ root: CustomComponent }}
Copy link
Member

Choose a reason for hiding this comment

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

I am curious, why was the ownerState removed? Should it be moved to the slotProps? I am not saying to add it back, since it's clearly not needed, but I was wondering if there was another reason

Copy link
Member Author

Choose a reason for hiding this comment

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

Because external ownerState isn't supported in Base Popper any more. Yes, I think when I removed it, I should've done either slotProps={{id}} or just id={id}

@@ -72,10 +77,9 @@ const Popper = React.forwardRef(function Popper(
...other
} = props;

const RootComponent = slots?.root ?? components?.Root;
const RootComponent = component ?? slots?.root ?? components?.Root;
Copy link
Member

Choose a reason for hiding this comment

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

The end behavior should be the same tough, right?

@hbjORbj hbjORbj merged commit 6149727 into mui:master May 2, 2023
binh1298 pushed a commit to binh1298/material-ui that referenced this pull request May 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change component: Popper The React component. See <Popup> for the latest version. package: base-ui Specific to @mui/base
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants