-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Tooltip] Fix type of sx prop in
slotProps
(#37550)
Co-authored-by: ZeeshanTamboli <[email protected]>
- Loading branch information
1 parent
149f0aa
commit ab6dd2f
Showing
4 changed files
with
41 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
packages/mui-material/test/typescript/moduleAugmentation/TooltipSlotSxProps.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import * as React from 'react'; | ||
import Button from '@mui/material/Button'; | ||
import Tooltip from '@mui/material/Tooltip'; | ||
import { PaletteColor } from '@mui/material/styles'; | ||
|
||
declare module '@mui/material/styles' { | ||
interface Palette { | ||
custom: PaletteColor; | ||
} | ||
} | ||
|
||
// Tooltip slotProps should only allow valid theme palettes to be accessed | ||
|
||
<Tooltip | ||
title="tooltip" | ||
slotProps={{ | ||
tooltip: { | ||
sx: { | ||
color: (theme) => theme.palette.custom.main, | ||
// @ts-expect-error Property 'invalid' does not exist on 'Palette' | ||
backgroundColor: (theme) => theme.palette.invalid.main, | ||
}, | ||
}, | ||
arrow: { | ||
sx: { | ||
color: (theme) => theme.palette.custom.main, | ||
// @ts-expect-error Property 'invalid' does not exist on 'Palette' | ||
backgroundColor: (theme) => theme.palette.invalid.main, | ||
}, | ||
}, | ||
}} | ||
> | ||
<Button>Hover Me!</Button> | ||
</Tooltip>; |
4 changes: 4 additions & 0 deletions
4
packages/mui-material/test/typescript/moduleAugmentation/TooltipSlotSxProps.tsconfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"extends": "../../../../../tsconfig", | ||
"files": ["TooltipSlotSxProps.spec.tsx"] | ||
} |