Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions docs/data/material/migration/upgrade-to-v9/upgrade-to-v9.md
Original file line number Diff line number Diff line change
Expand Up @@ -559,3 +559,32 @@ If you were already using the `surplus` key via `componentsProps`, move it to `s
-<AvatarGroup componentsProps={{ surplus: { className: 'my-class' } }}>
+<AvatarGroup slotProps={{ surplus: { className: 'my-class' } }}>
```

#### Tooltip deprecated props removed

Use the [tooltip-props codemod](https://github.com/mui/material-ui/tree/HEAD/packages/mui-codemod#tooltip-props) below to migrate the code as described in the following section:

```bash
npx @mui/codemod@latest deprecations/tooltip-props <path>
```

The deprecated props have been removed from the `Tooltip` component.
Use the `slots` and `slotProps` props instead:

```diff
<Tooltip
title="Hello World"
- components={{ Popper: CustomPopper, Transition: CustomTransition }}
- componentsProps={{ popper: { placement: 'top' }, tooltip: { className: 'custom' } }}
- PopperComponent={CustomPopper}
- PopperProps={{ disablePortal: true }}
- TransitionComponent={CustomTransition}
- TransitionProps={{ timeout: 500 }}
+ slots={{ popper: CustomPopper, transition: CustomTransition }}
Copy link
Member

Choose a reason for hiding this comment

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

slots.arrow isn't documented.

+ slotProps={{
Copy link
Member

Choose a reason for hiding this comment

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

slotProps.arrow isn't documented

Copy link
Member Author

Choose a reason for hiding this comment

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

slotProps.arrow is not related to the removal, I don't think it should be added here right?

+ popper: { placement: 'top', disablePortal: true },
+ tooltip: { className: 'custom' },
+ transition: { timeout: 500 },
+ }}
/>
```
42 changes: 1 addition & 41 deletions docs/pages/material-ui/api/tooltip.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,6 @@
"children": { "type": { "name": "custom", "description": "element" }, "required": true },
"arrow": { "type": { "name": "bool" }, "default": "false" },
"classes": { "type": { "name": "object" }, "additionalInfo": { "cssApi": true } },
"components": {
"type": {
"name": "shape",
"description": "{ Arrow?: elementType, Popper?: elementType, Tooltip?: elementType, Transition?: elementType }"
},
"default": "{}",
"deprecated": true,
"deprecationInfo": "use the <code>slots</code> prop instead. This prop will be removed in a future major release. See <a href=\"https://mui.com/material-ui/migration/migrating-from-deprecated-apis/\">Migrating from deprecated APIs</a> for more details."
},
"componentsProps": {
"type": {
"name": "shape",
"description": "{ arrow?: object, popper?: object, tooltip?: object, transition?: object }"
},
"default": "{}",
"deprecated": true,
"deprecationInfo": "use the <code>slotProps</code> prop instead. This prop will be removed in a future major release. See <a href=\"https://mui.com/material-ui/migration/migrating-from-deprecated-apis/\">Migrating from deprecated APIs</a> for more details."
},
"describeChild": { "type": { "name": "bool" }, "default": "false" },
"disableFocusListener": { "type": { "name": "bool" }, "default": "false" },
"disableHoverListener": { "type": { "name": "bool" }, "default": "false" },
Expand Down Expand Up @@ -55,17 +37,6 @@
},
"default": "'bottom'"
},
"PopperComponent": {
"type": { "name": "elementType" },
"deprecated": true,
"deprecationInfo": "use the <code>slots.popper</code> prop instead. This prop will be removed in a future major release. See <a href=\"https://mui.com/material-ui/migration/migrating-from-deprecated-apis/\">Migrating from deprecated APIs</a> for more details."
},
"PopperProps": {
"type": { "name": "object" },
"default": "{}",
"deprecated": true,
"deprecationInfo": "use the <code>slotProps.popper</code> prop instead. This prop will be removed in a future major release. See <a href=\"https://mui.com/material-ui/migration/migrating-from-deprecated-apis/\">Migrating from deprecated APIs</a> for more details."
},
"slotProps": {
"type": {
"name": "shape",
Expand All @@ -87,18 +58,7 @@
},
"additionalInfo": { "sx": true }
},
"title": { "type": { "name": "node" } },
"TransitionComponent": {
"type": { "name": "elementType" },
"deprecated": true,
"deprecationInfo": "use the <code>slots.transition</code> prop instead. This prop will be removed in a future major release. See <a href=\"https://mui.com/material-ui/migration/migrating-from-deprecated-apis/\">Migrating from deprecated APIs</a> for more details."
},
"TransitionProps": {
"type": { "name": "object" },
"default": "{}",
"deprecated": true,
"deprecationInfo": "use the <code>slotProps.transition</code> prop instead. This prop will be removed in a future major release. See <a href=\"https://mui.com/material-ui/migration/migrating-from-deprecated-apis/\">Migrating from deprecated APIs</a> for more details."
}
"title": { "type": { "name": "node" } }
},
"name": "Tooltip",
"imports": [
Expand Down
20 changes: 11 additions & 9 deletions docs/src/components/about/Team.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,18 @@ function Person(props: Profile & { sx?: PaperProps['sx'] }) {
title={props.location || false}
placement="right-end"
describeChild
PopperProps={{
popperOptions: {
modifiers: [
{
name: 'offset',
options: {
offset: [3, 2],
slotProps={{
popper: {
popperOptions: {
modifiers: [
{
name: 'offset',
options: {
offset: [3, 2],
},
},
},
],
],
},
},
}}
>
Expand Down
14 changes: 0 additions & 14 deletions docs/translations/api-docs/tooltip/tooltip.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
"arrow": { "description": "If <code>true</code>, adds an arrow to the tooltip." },
"children": { "description": "Tooltip reference element.", "requiresRef": true },
"classes": { "description": "Override or extend the styles applied to the component." },
"components": { "description": "The components used for each slot inside." },
"componentsProps": {
"description": "The extra props for the slot components. You can override the existing props or add new ones."
},
"describeChild": {
"description": "Set to <code>true</code> if the <code>title</code> acts as an accessible description. By default the <code>title</code> acts as an accessible label for the child."
},
Expand Down Expand Up @@ -52,23 +48,13 @@
},
"open": { "description": "If <code>true</code>, the component is shown." },
"placement": { "description": "Tooltip placement." },
"PopperComponent": { "description": "The component used for the popper." },
"PopperProps": {
"description": "Props applied to the <a href=\"https://mui.com/material-ui/api/popper/\"><code>Popper</code></a> element."
},
"slotProps": { "description": "The props used for each slot inside." },
"slots": { "description": "The components used for each slot inside." },
"sx": {
"description": "The system prop that allows defining system overrides as well as additional CSS styles."
},
"title": {
"description": "Tooltip title. Zero-length titles string, undefined, null and false are never displayed."
},
"TransitionComponent": {
"description": "The component used for the transition. <a href=\"https://mui.com/material-ui/transitions/#transitioncomponent-prop\">Follow this guide</a> to learn more about the requirements for this component."
},
"TransitionProps": {
"description": "Props applied to the transition element. By default, the element is based on this <a href=\"https://reactcommunity.org/react-transition-group/transition/\"><code>Transition</code></a> component."
}
},
"classDescriptions": {
Expand Down
4 changes: 2 additions & 2 deletions packages/mui-material/src/Popper/Popper.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ export default function ValueLabelComponent(props: Props) {

return (
<Tooltip
PopperProps={{
popperRef,
slotProps={{
popper: { popperRef },
}}
enterTouchDelay={0}
placement="top"
Expand Down
69 changes: 1 addition & 68 deletions packages/mui-material/src/Tooltip/Tooltip.d.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import * as React from 'react';
import { MUIStyledCommonProps, SxProps } from '@mui/system';
import { SxProps } from '@mui/system';
import { PopperProps } from '../Popper';
import { Theme } from '../styles';
import { InternalStandardProps as StandardProps } from '../internal';
import { CreateSlotsAndSlotProps, SlotProps } from '../utils/types';
import { TransitionProps } from '../transitions/transition';
import { TooltipClasses } from './tooltipClasses';

export interface TooltipComponentsPropsOverrides {}

export interface TooltipPopperSlotPropsOverrides {}

export interface TooltipTransitionSlotPropsOverrides {}
Expand Down Expand Up @@ -88,45 +86,6 @@ export interface TooltipProps
* Override or extend the styles applied to the component.
*/
classes?: Partial<TooltipClasses> | undefined;
/**
* The components used for each slot inside.
*
* @deprecated use the `slots` prop instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
*
* @default {}
*/
components?:
| {
Popper?: React.ElementType<PopperProps> | undefined;
Transition?: React.ElementType | undefined;
Tooltip?: React.ElementType | undefined;
Arrow?: React.ElementType | undefined;
}
| undefined;
/**
* The extra props for the slot components.
* You can override the existing props or add new ones.
*
* @deprecated use the `slotProps` prop instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
*
* @default {}
*/
componentsProps?:
| {
popper?: (Partial<PopperProps> & TooltipComponentsPropsOverrides) | undefined;
transition?: (TransitionProps & TooltipComponentsPropsOverrides) | undefined;
tooltip?:
| (React.HTMLProps<HTMLDivElement> &
MUIStyledCommonProps &
TooltipComponentsPropsOverrides)
| undefined;
arrow?:
| (React.HTMLProps<HTMLSpanElement> &
MUIStyledCommonProps &
TooltipComponentsPropsOverrides)
| undefined;
}
| undefined;
/**
* Set to `true` if the `title` acts as an accessible description.
* By default the `title` acts as an accessible label for the child.
Expand Down Expand Up @@ -212,17 +171,6 @@ export interface TooltipProps
* @default 'bottom'
*/
placement?: PopperProps['placement'] | undefined;
/**
* The component used for the popper.
* @deprecated use the `slots.popper` prop instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
*/
PopperComponent?: React.JSXElementConstructor<PopperProps> | undefined;
/**
* Props applied to the [`Popper`](https://mui.com/material-ui/api/popper/) element.
* @deprecated use the `slotProps.popper` prop instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
* @default {}
*/
PopperProps?: Partial<PopperProps> | undefined;
/**
* The system prop that allows defining system overrides as well as additional CSS styles.
*/
Expand All @@ -231,21 +179,6 @@ export interface TooltipProps
* Tooltip title. Zero-length titles string, undefined, null and false are never displayed.
*/
title: React.ReactNode;
/**
* The component used for the transition.
* [Follow this guide](https://mui.com/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
* @deprecated use the `slots.transition` prop instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
*/
TransitionComponent?:
| React.JSXElementConstructor<TransitionProps & { children: React.ReactElement<unknown, any> }>
| undefined;
/**
* Props applied to the transition element.
* By default, the element is based on this [`Transition`](https://reactcommunity.org/react-transition-group/transition/) component.
* @deprecated use the `slotProps.transition` prop instead. This prop will be removed in a future major release. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
* @default {}
*/
TransitionProps?: TransitionProps | undefined;
}

export interface TooltipOwnerState extends TooltipProps {}
Expand Down
Loading
Loading