import type { AlertProps as MuiAlertProps } from '@mui/material/Alert'; import MuiAlert from '@mui/material/Alert'; import type { IconButtonProps } from '@mui/material/IconButton'; import IconButton from '@mui/material/IconButton'; import type { ReactNode, SyntheticEvent } from 'react'; import { forwardRef, memo } from 'react'; import { ASSETS_URL } from '../../../consts/common'; import { CustomIcon } from '../../custom-icon'; import createClasses from './style'; export interface AlertProps extends Omit { /** * The content of the alert. */ children?: ReactNode; /** * The action to display. It renders after the message, at the end of the alert. */ action?: ReactNode; /** * Callback fired when the component requests to be closed. * When provided, a close icon button is displayed that triggers the callback when clicked. * @param {SyntheticEvent} event The event source of the callback. */ onClose?: IconButtonProps['onClick']; } const Alert = forwardRef((props: AlertProps, ref) => { const { action, children, onClose, ...other } = props; const classes = createClasses(); return ( {action} {onClose && ( )} } ref={ref} {...other} > {children} ); }); Alert.defaultProps = { variant: 'outlined', severity: 'info' }; const m = memo(Alert); export { m as Alert };