-
-
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 #37060
Conversation
Netlify deploy previewBundle size reportBundle size will be reported once CircleCI build #515804 finishes. |
This reverts commit 9bdb1cc.
@@ -233,7 +231,7 @@ const PopperTooltip = React.forwardRef(function PopperTooltip< | |||
return ( | |||
<Root {...rootProps}>{typeof children === 'function' ? children(childProps) : children}</Root> | |||
); | |||
}) as OverridableComponent<PopperTooltipTypeMap>; | |||
}) as PolymorphicComponent<PopperTooltipTypeMap>; |
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.
@michaldudak this change seems to make yarn proptypes
change the proptypes of Menu.tsx
and Select.tsx
(both use Popper
as default Root
component) like in the picture. Any idea what might causes this?
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.
You can add /* @typescript-to-proptypes-ignore */
before running yarn proptypes
to prevent that change
container: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([
HTMLElementType,
PropTypes.func,
]),
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.
Thank you!
ps: would be cool if you can add this PR to #36679
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.
In fact, ignore my comment above, that's not how we should handle 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.
have you found another way to deal with the problem?
> = PolymorphicProps<PopperTypeMap<{}, RootComponentType>, RootComponentType> & { | ||
component?: RootComponentType; | ||
}; |
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.
> = PolymorphicProps<PopperTypeMap<{}, RootComponentType>, RootComponentType> & { | |
component?: RootComponentType; | |
}; | |
> = PolymorphicProps<PopperTypeMap<{}, RootComponentType>, RootComponentType>; |
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 Props
also describe Popper
from mui-material. Since we don't remove component
prop from that Popper
, this component props can't be removed here. Typescript will give error on the Popper.tsx (packages/mui-material/src/Popper/Popper.tsx)
...or is that not a problem?
> = PolymorphicProps<PopperTooltipTypeMap<{}, RootComponentType>, RootComponentType> & { | ||
component?: RootComponentType; | ||
}; |
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.
> = PolymorphicProps<PopperTooltipTypeMap<{}, RootComponentType>, RootComponentType> & { | |
component?: RootComponentType; | |
}; | |
> = PolymorphicProps<PopperTooltipTypeMap<{}, RootComponentType>, RootComponentType>; |
@@ -237,7 +239,9 @@ describe('useSlot', () => { | |||
anchorEl: () => document.createElement('div'), | |||
}, | |||
internalForwardedProps: { | |||
component: ItemListbox, | |||
slots: { | |||
root: ItemListbox, |
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.
why are you doing this change?
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.
that is a test that use base Popper
as describeb here elementType: Popper as unknown as 'ul',
. I believe internalForwardedProps
is a prop that is forwarded to the Popper
, hence the change.
Thanks a lot for your contribution. @nicolas-ot We need to support dropping |
BREAKING CHANGE
part of #36679
It will be covered by codemod, see #36831
For Base UI components, the
component
prop value should be moved toslots.root
:If using TypeScript, you should add the custom component type as a generic on the TabsList component.