Skip to content

Commit

Permalink
add paperslot
Browse files Browse the repository at this point in the history
  • Loading branch information
sai6855 committed Jan 6, 2025
1 parent 3a81578 commit db4bea2
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions packages/mui-material/src/Dialog/Dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,10 @@ const Dialog = React.forwardRef(function Dialog(inProps, ref) {

const backwardCompatibleSlotProps = {
transition: TransitionProps,
paper: {
component: PaperComponent,
...PaperProps,
},
...slotProps,
};

Expand All @@ -313,6 +317,13 @@ const Dialog = React.forwardRef(function Dialog(inProps, ref) {
},
});

const [PaperSlot, paperSlotProps] = useSlot('paper', {
elementType: DialogPaper,
externalForwardedProps,
ownerState,
className: clsx(classes.paper, PaperProps.className),
});

return (
<DialogRoot
className={clsx(classes.root, className)}
Expand Down Expand Up @@ -341,19 +352,17 @@ const Dialog = React.forwardRef(function Dialog(inProps, ref) {
onMouseDown={handleMouseDown}
ownerState={ownerState}
>
<DialogPaper
as={PaperComponent}
<PaperSlot
as={paperSlotProps.component}
elevation={24}
role="dialog"
aria-describedby={ariaDescribedby}
aria-labelledby={ariaLabelledby}
aria-modal={ariaModal}
{...PaperProps}
className={clsx(classes.paper, PaperProps.className)}
ownerState={ownerState}
{...paperSlotProps}
>
<DialogContext.Provider value={dialogContextValue}>{children}</DialogContext.Provider>
</DialogPaper>
</PaperSlot>
</DialogContainer>
</TransitionSlot>
</DialogRoot>
Expand Down

0 comments on commit db4bea2

Please sign in to comment.