-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
Conversation
Netlify deploy previewhttps://deploy-preview-37084--material-ui.netlify.app/ Bundle size report |
89494d8
to
47f92b5
Compare
@@ -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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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', |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this 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 }} |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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?
b511588
to
c46495a
Compare
No description provided.