From fe5e34bf99b5d92307b21349ce23517bc6a4219b Mon Sep 17 00:00:00 2001 From: sai chand <60743144+sai6855@users.noreply.github.com> Date: Wed, 6 Mar 2024 01:05:23 +0530 Subject: [PATCH] [material-ui][Alert] Add `slots` and `slotProps` type to theme (#41324) --- packages/mui-material/src/Alert/Alert.d.ts | 4 ++-- packages/mui-material/src/Alert/Alert.spec.tsx | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 packages/mui-material/src/Alert/Alert.spec.tsx diff --git a/packages/mui-material/src/Alert/Alert.d.ts b/packages/mui-material/src/Alert/Alert.d.ts index 70875f28848eea..a267dec3c89f9d 100644 --- a/packages/mui-material/src/Alert/Alert.d.ts +++ b/packages/mui-material/src/Alert/Alert.d.ts @@ -33,7 +33,7 @@ export type AlertSlotsAndSlotProps = CreateSlotsAndSlotProps< } >; -export interface AlertProps extends StandardProps { +export interface AlertProps extends StandardProps, AlertSlotsAndSlotProps { /** * The action to display. It renders after the message, at the end of the alert. */ @@ -133,4 +133,4 @@ export interface AlertOwnerState extends AlertProps {} * - [Alert API](https://mui.com/material-ui/api/alert/) * - inherits [Paper API](https://mui.com/material-ui/api/paper/) */ -export default function Alert(props: AlertProps & AlertSlotsAndSlotProps): JSX.Element; +export default function Alert(props: AlertProps): JSX.Element; diff --git a/packages/mui-material/src/Alert/Alert.spec.tsx b/packages/mui-material/src/Alert/Alert.spec.tsx new file mode 100644 index 00000000000000..dbfeb1222427a0 --- /dev/null +++ b/packages/mui-material/src/Alert/Alert.spec.tsx @@ -0,0 +1,14 @@ +import { CloseRounded } from '@mui/icons-material'; +import { createTheme } from '@mui/material'; + +createTheme({ + components: { + MuiAlert: { + defaultProps: { + slots: { + closeIcon: CloseRounded, + }, + }, + }, + }, +});