-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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] Deprecate *Component and *Props for v6 #44350
[Tooltip] Deprecate *Component and *Props for v6 #44350
Conversation
…ecate-tooltip-props
Netlify deploy previewSpeedDialAction: parsed: +0.75% , gzip: +0.66% Bundle size reportDetails of bundle changes (Toolpad) |
…ecation/tooltip-comp-props
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.
Hey! I gave it another review
Sorry I didn't catch these in the previous review 😓 my bad
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.
🚀 ⭐
docs/data/material/migration/migrating-from-deprecated-apis/migrating-from-deprecated-apis.md
Outdated
Show resolved
Hide resolved
packages/mui-codemod/src/deprecations/tooltip-props/test-cases/actual.js
Outdated
Show resolved
Hide resolved
…ecation/tooltip-comp-props
This pr broke the types on our tooltip wrapper: import { Box, BoxProps, Tooltip as MuiTooltip, TooltipProps as MuiTooltipsProps } from '@mui/material';
export type TooltipProps = MuiTooltipsProps & { p?: BoxProps['p'] };
export const Tooltip = (props: TooltipProps) => {
const { children, p = 4, title, sx: sxProps, slotProps = {} } = props;
const { popper, ...slotPropsRest } = slotProps;
return (
<MuiTooltip
{...props}
title={<Box p={p}>{title}</Box>}
sx={sxProps}
slotProps={{
...slotPropsRest,
popper: {
...popper,
sx: popper?.sx,
^-- error
},
}}
>
{children}
</MuiTooltip>
);
};
@siriwatknp would you be able to help me fix this? switching |
Hey @arishoham, thanks for reaching out! This is happening because You can support import {
Box,
BoxProps,
Tooltip as MuiTooltip,
TooltipProps as MuiTooltipsProps,
TooltipOwnerState as MuiTooltipOwnerState,
} from '@mui/material';
export type TooltipProps = MuiTooltipsProps & { p?: BoxProps['p'] };
export const Tooltip = (props: TooltipProps) => {
const { children, p = 4, title, sx: sxProps, slotProps = {} } = props;
const { popper, ...slotPropsRest } = slotProps;
return (
<MuiTooltip
{...props}
title={<Box p={p}>{title}</Box>}
sx={sxProps}
slotProps={{
...slotPropsRest,
popper: (ownerState: MuiTooltipOwnerState) => {
const resolvedPopperProps = typeof popper === 'function' ? popper(ownerState) : popper;
return {
...resolvedPopperProps,
sx: resolvedPopperProps?.sx,
};
},
}}
>
{children}
</MuiTooltip>
);
}; Let me know if this works for you. |
A continuation from #42120