@@ -9,6 +9,7 @@ import { createPortal } from 'react-dom';
99import { classNames } from '../../helpers/classNames' ;
1010import { transferProps } from '../../helpers/transferProps' ;
1111import { withGlobalProps } from '../../providers/globalProps' ;
12+ import { getRootColorClassName } from '../_helpers/getRootColorClassName' ;
1213import { dialogOnCancelHandler } from './_helpers/dialogOnCancelHandler' ;
1314import { dialogOnClickHandler } from './_helpers/dialogOnClickHandler' ;
1415import { dialogOnCloseHandler } from './_helpers/dialogOnCloseHandler' ;
@@ -21,6 +22,7 @@ import styles from './Modal.module.scss';
2122
2223const preRender = (
2324 children ,
25+ color ,
2426 dialogRef ,
2527 position ,
2628 size ,
@@ -32,6 +34,7 @@ const preRender = (
3234 { ...transferProps ( events ) }
3335 className = { classNames (
3436 styles . root ,
37+ color && getRootColorClassName ( color , styles ) ,
3538 getSizeClassName ( size , styles ) ,
3639 getPositionClassName ( position , styles ) ,
3740 ) }
@@ -48,6 +51,7 @@ export const Modal = ({
4851 autoFocus,
4952 children,
5053 closeButtonRef,
54+ color,
5155 dialogRef,
5256 portalId,
5357 position,
@@ -107,6 +111,7 @@ export const Modal = ({
107111 if ( portalId === null ) {
108112 return preRender (
109113 children ,
114+ color ,
110115 internalDialogRef ,
111116 position ,
112117 size ,
@@ -118,6 +123,7 @@ export const Modal = ({
118123 return createPortal (
119124 preRender (
120125 children ,
126+ color ,
121127 internalDialogRef ,
122128 position ,
123129 size ,
@@ -135,6 +141,7 @@ Modal.defaultProps = {
135141 autoFocus : true ,
136142 children : null ,
137143 closeButtonRef : null ,
144+ color : undefined ,
138145 dialogRef : null ,
139146 portalId : null ,
140147 position : 'center' ,
@@ -180,6 +187,11 @@ Modal.propTypes = {
180187 // eslint-disable-next-line react/forbid-prop-types
181188 current : PropTypes . any ,
182189 } ) ,
190+ /**
191+ * Color to clarify importance and meaning of the modal. Implements
192+ * [Feedback color collection](/docs/foundation/collections#colors).
193+ */
194+ color : PropTypes . oneOf ( [ 'success' , 'warning' , 'danger' , 'help' , 'info' , 'note' ] ) ,
183195 /**
184196 * Reference to dialog element
185197 */
0 commit comments