diff --git a/packages/mui-material/src/Accordion/Accordion.d.ts b/packages/mui-material/src/Accordion/Accordion.d.ts index f75c327c213e05..11b564eb9cf570 100644 --- a/packages/mui-material/src/Accordion/Accordion.d.ts +++ b/packages/mui-material/src/Accordion/Accordion.d.ts @@ -58,7 +58,7 @@ export type AccordionSlotsAndSlotProps = CreateSlotsAndSlotProps< * By default, the available props are based on the [Collapse](https://mui.com/material-ui/api/collapse/#props) component. */ transition: SlotComponentProps< - React.ElementType, + React.ElementType, TransitionProps & AccordionTransitionSlotPropsOverrides, AccordionOwnerState >; diff --git a/packages/mui-material/src/Accordion/Accordion.spec.tsx b/packages/mui-material/src/Accordion/Accordion.spec.tsx index cec6227e6d6865..6a6cdd8ca04f76 100644 --- a/packages/mui-material/src/Accordion/Accordion.spec.tsx +++ b/packages/mui-material/src/Accordion/Accordion.spec.tsx @@ -84,6 +84,16 @@ function Custom(props: AccordionProps) { ); } +// slotProps.transition should reject unknown props + +
+; + function Custom2(props: AccordionProps) { const { slotProps, ...other } = props; return ( diff --git a/packages/mui-material/src/Backdrop/Backdrop.d.ts b/packages/mui-material/src/Backdrop/Backdrop.d.ts index 87b892b4ce4676..3feb86cbfb4f96 100644 --- a/packages/mui-material/src/Backdrop/Backdrop.d.ts +++ b/packages/mui-material/src/Backdrop/Backdrop.d.ts @@ -37,7 +37,7 @@ export type BackdropSlotsAndSlotProps = CreateSlotsAndSlotProps< * By default, the available props are based on the [Fade](https://mui.com/material-ui/api/fade/#props) component. */ transition: SlotComponentProps< - React.ElementType, + React.ElementType, TransitionProps & BackdropTransitionSlotPropsOverrides, BackdropOwnerState >; diff --git a/packages/mui-material/src/Backdrop/Backdrop.spec.tsx b/packages/mui-material/src/Backdrop/Backdrop.spec.tsx new file mode 100644 index 00000000000000..5c168958adf8f2 --- /dev/null +++ b/packages/mui-material/src/Backdrop/Backdrop.spec.tsx @@ -0,0 +1,10 @@ +import Backdrop from '@mui/material/Backdrop'; + +// slotProps.transition should reject unknown props +; diff --git a/packages/mui-material/src/Dialog/Dialog.d.ts b/packages/mui-material/src/Dialog/Dialog.d.ts index dcfc6242b1bf17..08e6a5e45b54fd 100644 --- a/packages/mui-material/src/Dialog/Dialog.d.ts +++ b/packages/mui-material/src/Dialog/Dialog.d.ts @@ -68,7 +68,7 @@ export type DialogSlotsAndSlotProps = CreateSlotsAndSlotProps< * By default, the available props are based on the [Fade](https://mui.com/material-ui/api/fade/#props) component. */ transition: SlotComponentProps< - React.ElementType, + React.ElementType, TransitionProps & DialogTransitionSlotPropsOverrides, DialogOwnerState >; diff --git a/packages/mui-material/src/Dialog/Dialog.spec.tsx b/packages/mui-material/src/Dialog/Dialog.spec.tsx index afffde622784cc..3935f05c443d92 100644 --- a/packages/mui-material/src/Dialog/Dialog.spec.tsx +++ b/packages/mui-material/src/Dialog/Dialog.spec.tsx @@ -14,7 +14,15 @@ function Test() { return ( ; - ; + ; + + ; ); } diff --git a/packages/mui-material/src/Drawer/Drawer.d.ts b/packages/mui-material/src/Drawer/Drawer.d.ts index 429f4c0fb3d61f..d063dd5239ca1e 100644 --- a/packages/mui-material/src/Drawer/Drawer.d.ts +++ b/packages/mui-material/src/Drawer/Drawer.d.ts @@ -85,8 +85,8 @@ export type DrawerSlotsAndSlotProps = CreateSlotsAndSlotProps< * By default, the available props are based on the [Slide](https://mui.com/material-ui/api/slide/#props) component. */ transition: SlotProps< - React.ElementType, - TransitionProps & DrawerTransitionSlotPropsOverrides, + React.ElementType, + Omit & DrawerTransitionSlotPropsOverrides, DrawerOwnerState >; } diff --git a/packages/mui-material/src/Drawer/Drawer.spec.tsx b/packages/mui-material/src/Drawer/Drawer.spec.tsx index 5cf479fe793988..e307bccc3a9338 100644 --- a/packages/mui-material/src/Drawer/Drawer.spec.tsx +++ b/packages/mui-material/src/Drawer/Drawer.spec.tsx @@ -14,7 +14,16 @@ function Test() { return ( ; - ; + ; + ; + + ; ); } @@ -34,6 +43,8 @@ function Test() { 'aria-hidden': true, }, transition: { + container: document.body, + direction: 'left', timeout: 500, }, }} diff --git a/packages/mui-material/src/Menu/Menu.d.ts b/packages/mui-material/src/Menu/Menu.d.ts index eddb23a7556da9..062aca01a212b0 100644 --- a/packages/mui-material/src/Menu/Menu.d.ts +++ b/packages/mui-material/src/Menu/Menu.d.ts @@ -73,7 +73,7 @@ export type MenuSlotsAndSlotProps = CreateSlotsAndSlotProps< */ transition: SlotComponentProps< // use SlotComponentProps because transition slot does not support `component` and `sx` prop - React.ElementType, + React.ElementType, TransitionProps & MenuTransitionSlotPropsOverrides, MenuOwnerState >; diff --git a/packages/mui-material/src/Menu/Menu.spec.tsx b/packages/mui-material/src/Menu/Menu.spec.tsx index bc89ea21695072..dda94ba771d490 100644 --- a/packages/mui-material/src/Menu/Menu.spec.tsx +++ b/packages/mui-material/src/Menu/Menu.spec.tsx @@ -1,5 +1,14 @@ import Menu, { MenuProps } from '@mui/material/Menu'; +// slotProps.transition should reject unknown props +; + , + Omit & PopoverTransitionSlotPropsOverrides, PopoverOwnerState >; /** diff --git a/packages/mui-material/src/Popover/Popover.spec.tsx b/packages/mui-material/src/Popover/Popover.spec.tsx index 7b578176ee5631..5aa2f15e43d455 100644 --- a/packages/mui-material/src/Popover/Popover.spec.tsx +++ b/packages/mui-material/src/Popover/Popover.spec.tsx @@ -13,7 +13,16 @@ function Test() { return ( ; - + ; + ; + + ; ); } diff --git a/packages/mui-material/src/Snackbar/Snackbar.d.ts b/packages/mui-material/src/Snackbar/Snackbar.d.ts index ba7d9369cb3a4d..bce5ae16aa4fe4 100644 --- a/packages/mui-material/src/Snackbar/Snackbar.d.ts +++ b/packages/mui-material/src/Snackbar/Snackbar.d.ts @@ -69,7 +69,7 @@ export type SnackbarSlotsAndSlotProps = CreateSlotsAndSlotProps< * By default, the element is based on the [Grow](https://mui.com/material-ui/api/grow/#props) component. */ transition: SlotComponentProps< - React.ElementType, + React.ElementType, TransitionProps & SnackbarTransitionSlotPropsOverrides, SnackbarOwnerState >; diff --git a/packages/mui-material/src/Snackbar/Snackbar.spec.tsx b/packages/mui-material/src/Snackbar/Snackbar.spec.tsx index b058cdaf8ce14f..00fe458c1e8579 100644 --- a/packages/mui-material/src/Snackbar/Snackbar.spec.tsx +++ b/packages/mui-material/src/Snackbar/Snackbar.spec.tsx @@ -2,6 +2,14 @@ import { mergeSlotProps } from '@mui/material/utils'; import Snackbar, { SnackbarProps } from '@mui/material/Snackbar'; import { expectType } from '@mui/types'; +// slotProps.transition should reject unknown props +; + ; + transition: SlotComponentProps< + React.ElementType, + TransitionProps, + SpeedDialOwnerState + >; } >; diff --git a/packages/mui-material/src/SpeedDial/SpeedDial.spec.tsx b/packages/mui-material/src/SpeedDial/SpeedDial.spec.tsx new file mode 100644 index 00000000000000..10f232d2f4c126 --- /dev/null +++ b/packages/mui-material/src/SpeedDial/SpeedDial.spec.tsx @@ -0,0 +1,10 @@ +import SpeedDial from '@mui/material/SpeedDial'; + +// slotProps.transition should reject unknown props +; diff --git a/packages/mui-material/src/StepContent/StepContent.d.ts b/packages/mui-material/src/StepContent/StepContent.d.ts index 67ad8a83ac9bc8..1644f0596f744e 100644 --- a/packages/mui-material/src/StepContent/StepContent.d.ts +++ b/packages/mui-material/src/StepContent/StepContent.d.ts @@ -14,9 +14,7 @@ export interface StepContentSlots { * @default Collapse */ transition?: - | React.JSXElementConstructor< - TransitionProps & { children?: React.ReactElement | undefined } - > + | React.JSXElementConstructor }> | undefined; } @@ -27,7 +25,11 @@ export type StepContentSlotsAndSlotProps = CreateSlotsAndSlotProps< * Props forwarded to the transition slot. * By default, the available props are based on the [Collapse](https://mui.com/material-ui/api/collapse/#props) component */ - transition: SlotComponentProps; + transition: SlotComponentProps< + React.ElementType, + CollapseProps, + StepContentOwnerState + >; } >; diff --git a/packages/mui-material/src/StepContent/StepContent.spec.tsx b/packages/mui-material/src/StepContent/StepContent.spec.tsx index 106d61cbde0539..f10eb5196944b3 100644 --- a/packages/mui-material/src/StepContent/StepContent.spec.tsx +++ b/packages/mui-material/src/StepContent/StepContent.spec.tsx @@ -7,11 +7,21 @@ import Grow from '@mui/material/Grow'; import Slide from '@mui/material/Slide'; import Zoom from '@mui/material/Zoom'; -Step Content; -Step Content; -Step Content; -Step Content; -Step Content; +// slotProps.transition should reject unknown props + + Step Content +; + +Step Content; +Step Content; +Step Content; +Step Content; +Step Content; function Custom(props: StepContentProps) { const { slotProps, ...other } = props; diff --git a/packages/mui-material/src/Tooltip/Tooltip.d.ts b/packages/mui-material/src/Tooltip/Tooltip.d.ts index f43a6196e638e6..0d265d06972640 100644 --- a/packages/mui-material/src/Tooltip/Tooltip.d.ts +++ b/packages/mui-material/src/Tooltip/Tooltip.d.ts @@ -56,7 +56,7 @@ export type TooltipSlotsAndSlotProps = CreateSlotsAndSlotProps< * By default, the available props are based on the [Grow](https://mui.com/material-ui/api/grow/#props) component. */ transition: SlotProps< - React.ElementType, + React.ElementType, TransitionProps & TooltipTransitionSlotPropsOverrides, TooltipOwnerState >; diff --git a/packages/mui-material/src/Tooltip/Tooltip.spec.tsx b/packages/mui-material/src/Tooltip/Tooltip.spec.tsx index 93a3f3c9f7d58a..2b1ca33fc67a55 100644 --- a/packages/mui-material/src/Tooltip/Tooltip.spec.tsx +++ b/packages/mui-material/src/Tooltip/Tooltip.spec.tsx @@ -3,6 +3,17 @@ import { expectType } from '@mui/types'; import { mergeSlotProps } from '@mui/material/utils'; import Tooltip, { TooltipProps } from '@mui/material/Tooltip'; +// slotProps.transition should reject unknown props + + +; + ;