@@ -4,39 +4,21 @@ import classNames from 'classnames';
44import Icon from '../Icon' ;
55import ModalDialog from './ModalDialog' ;
66
7- interface AlertModalProps {
8- /** Specifies the content of the dialog */
9- children : React . ReactNode ;
10- /** The aria-label of the dialog */
11- title : string ;
12- /** Is the modal dialog open or closed */
13- isOpen ?: boolean ;
14- /** Prevent clicking on the backdrop or pressing Esc to close the modal */
15- isBlocking ?: boolean ;
16- /** Specifies whether the dialog box should contain 'x' icon button in the top right */
17- hasCloseButton ?: boolean ;
7+ type ModalDialogProps = React . ComponentProps < typeof ModalDialog > ;
8+
9+ // Extends all ModalDialog props, but omits certain props to re-declare them:
10+ // - onClose: ModalDialog requires it, but AlertModal defaults it to () => {}
11+ // - isOverflowVisible: required in ModalDialog but was absent from AlertModal's propTypes;
12+ // undefined is falsy so defaulting to false matches the previous behavior
13+ // - variant: ModalDialog allows 'dark' but AlertModal intentionally excludes it
14+ // footerNode and icon are AlertModal-specific props not present on ModalDialog
15+ interface AlertModalProps extends Omit < ModalDialogProps , 'onClose' | 'isOverflowVisible' | 'variant' > {
1816 /** A callback to close the modal dialog */
1917 onClose ?: ( ) => void ;
20- /** Sizes determine the maximum width of the dialog box */
21- size ?: 'sm' | 'md' | 'lg' | 'xl' | 'fullscreen' ;
22- /** The visual style of the dialog box */
23- variant ?: 'default' | 'warning' | 'danger' | 'success' ;
24- /** The label supplied to the close icon button if one is rendered */
25- closeLabel ?: string ;
26- /** Specifies class name to append to the base element */
27- className ?: string ;
28- /**
29- * Determines where a scrollbar should appear if a modal is too large for the
30- * viewport. When false, the ModalDialog.Body receives a scrollbar, when true
31- * the browser window itself receives the scrollbar.
32- */
33- isFullscreenScroll ?: boolean ;
34- /** To show full screen view on mobile screens */
35- isFullscreenOnMobile ?: boolean ;
3618 /** Specifies whether overflow content inside the modal should be visible */
3719 isOverflowVisible ?: boolean ;
38- /** Specifies the z-index of the modal */
39- zIndex ?: number ;
20+ /** The visual style of the dialog box */
21+ variant ?: 'default' | 'warning' | 'danger' | 'success' ;
4022 /** Specifies what should be displayed in the footer of the dialog box */
4123 footerNode ?: React . ReactNode ;
4224 /** Icon that will be shown in the header of modal */
@@ -48,33 +30,19 @@ function AlertModal({
4830 footerNode = null ,
4931 icon,
5032 title,
51- isOpen = false ,
52- isBlocking = false ,
5333 hasCloseButton = false ,
5434 onClose = ( ) => { } ,
55- size = 'md' ,
56- variant = 'default' ,
57- closeLabel = 'Close' ,
58- className,
59- isFullscreenScroll = false ,
60- isFullscreenOnMobile,
6135 isOverflowVisible = false ,
62- zIndex,
36+ className,
37+ ...props
6338} : AlertModalProps ) {
6439 return (
6540 < ModalDialog
41+ { ...props }
6642 title = { title }
67- isOpen = { isOpen }
68- onClose = { onClose }
69- size = { size }
70- variant = { variant }
7143 hasCloseButton = { hasCloseButton }
72- closeLabel = { closeLabel }
73- isFullscreenScroll = { isFullscreenScroll }
74- isFullscreenOnMobile = { isFullscreenOnMobile }
75- isBlocking = { isBlocking }
44+ onClose = { onClose }
7645 isOverflowVisible = { isOverflowVisible }
77- zIndex = { zIndex }
7846 className = { classNames ( 'pgn__alert-modal' , className ) }
7947 >
8048 < ModalDialog . Header >
0 commit comments