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

[Tooltip] Allow overriding internal components and their props #28692

Merged
merged 1 commit into from
Oct 4, 2021

Conversation

michaldudak
Copy link
Member

@michaldudak michaldudak commented Sep 29, 2021

First discussed in #28679 (comment)

Adds components and componentProps props to the Tooltip component.
For slots that were customizable before (Transition, Popper), the new props (components.Transition, components.Popper) take precedence over the old ones (TransitionComponent, PopperComponent).
In the case of props, componentsProps.popper are merged with PopperProps and componentsProps.transition are merged with TransitionProps. When there are conflicts, componentsProps' values win.

@michaldudak michaldudak added component: tooltip This is the name of the generic UI component, not the React module! package: material-ui Specific to @mui/material labels Sep 29, 2021
@mui-pr-bot
Copy link

mui-pr-bot commented Sep 29, 2021

Details of bundle changes

@material-ui/core: parsed: +0.11% , gzip: +0.17%
@material-ui/lab: parsed: +0.16% , gzip: +0.22%

Generated by 🚫 dangerJS against 6401c66

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.

Looks great! 🙏

@@ -225,12 +225,15 @@ function composeEventHandler(handler, eventHandler) {
};
}

// TODO (v6) Remove PopperComponent, PopperProps, TransitionComponent and TransitionProps.
Copy link
Member

Choose a reason for hiding this comment

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

👍

Copy link
Member

Choose a reason for hiding this comment

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

I would recommend this todo convention,

Suggested change
// TODO (v6) Remove PopperComponent, PopperProps, TransitionComponent and TransitionProps.
// TODO v6: Remove PopperComponent, PopperProps, TransitionComponent and TransitionProps.

It reduces the chance to forget something. There are already instances for v5 and v6 in the codebase.

Copy link
Member

@oliviertassinari oliviertassinari left a comment

Choose a reason for hiding this comment

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

Nice addition :)

@@ -225,12 +225,15 @@ function composeEventHandler(handler, eventHandler) {
};
}

// TODO (v6) Remove PopperComponent, PopperProps, TransitionComponent and TransitionProps.
Copy link
Member

Choose a reason for hiding this comment

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

I would recommend this todo convention,

Suggested change
// TODO (v6) Remove PopperComponent, PopperProps, TransitionComponent and TransitionProps.
// TODO v6: Remove PopperComponent, PopperProps, TransitionComponent and TransitionProps.

It reduces the chance to forget something. There are already instances for v5 and v6 in the codebase.

@@ -1092,6 +1092,96 @@ describe('<Tooltip />', () => {
});
});

describe('prop: components', () => {
Copy link
Member

@oliviertassinari oliviertassinari Oct 10, 2021

Choose a reason for hiding this comment

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

Do we need to test it? For instance, we didn't really test classes before.

Copy link
Member Author

Choose a reason for hiding this comment

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

components prop is normally tested in describeConformanceUnstyled test suite, but since we don't have an unstyled Tooltip yet, I added the test here directly. It can be removed when we have an unstyled Tooltip.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: tooltip This is the name of the generic UI component, not the React module! package: material-ui Specific to @mui/material
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants