1+ import '@ui5/webcomponents-icons/dist/hint' ;
12import '@ui5/webcomponents-icons/dist/message-error' ;
23import '@ui5/webcomponents-icons/dist/message-information' ;
34import '@ui5/webcomponents-icons/dist/message-success' ;
45import '@ui5/webcomponents-icons/dist/message-warning' ;
56import '@ui5/webcomponents-icons/dist/question-mark' ;
6- import '@ui5/webcomponents-icons/dist/hint' ;
77import { useConsolidatedRef , useI18nBundle , usePassThroughHtmlProps } from '@ui5/webcomponents-react-base/dist/hooks' ;
88import { StyleClassHelper } from '@ui5/webcomponents-react-base/dist/StyleClassHelper' ;
99import { enrichEventWithDetails } from '@ui5/webcomponents-react-base/dist/Utils' ;
@@ -33,6 +33,9 @@ import { MessageBoxTypes } from '@ui5/webcomponents-react/dist/MessageBoxTypes';
3333import { Text } from '@ui5/webcomponents-react/dist/Text' ;
3434import { Title } from '@ui5/webcomponents-react/dist/Title' ;
3535import { TitleLevel } from '@ui5/webcomponents-react/dist/TitleLevel' ;
36+ import { CommonProps } from '@ui5/webcomponents-react/interfaces/CommonProps' ;
37+ import { Ui5CustomEvent } from '@ui5/webcomponents-react/interfaces/Ui5CustomEvent' ;
38+ import { Ui5DialogDomRef } from '@ui5/webcomponents-react/interfaces/Ui5DialogDomRef' ;
3639import React , {
3740 FC ,
3841 forwardRef ,
@@ -45,9 +48,6 @@ import React, {
4548 useMemo
4649} from 'react' ;
4750import { createUseStyles } from 'react-jss' ;
48- import { CommonProps } from '@ui5/webcomponents-react/interfaces/CommonProps' ;
49- import { Ui5DialogDomRef } from '@ui5/webcomponents-react/interfaces/Ui5DialogDomRef' ;
50- import { Ui5CustomEvent } from '@ui5/webcomponents-react/interfaces/Ui5CustomEvent' ;
5151import { stopPropagation } from '../../internal/stopPropagation' ;
5252import styles from './MessageBox.jss' ;
5353
@@ -70,6 +70,12 @@ export interface MessageBoxPropTypes extends CommonProps {
7070 * Array of actions of the MessageBox. Those actions will be transformed into buttons in the `MessageBox` footer.
7171 */
7272 actions ?: ( MessageBoxActions | string ) [ ] ;
73+ /**
74+ * Specifies which action of the created dialog will be emphasized.
75+ *
76+ * @since 0.16.3
77+ */
78+ emphasizedAction ?: MessageBoxActions | string ;
7379 /**
7480 * A custom icon. If not present, it will be derived from the `MessageBox` type.
7581 */
@@ -114,6 +120,7 @@ const MessageBox: FC<MessageBoxPropTypes> = forwardRef((props: MessageBoxPropTyp
114120 title,
115121 icon,
116122 actions,
123+ emphasizedAction,
117124 onClose,
118125 initialFocus,
119126 onBeforeOpen,
@@ -239,7 +246,7 @@ const MessageBox: FC<MessageBoxPropTypes> = forwardRef((props: MessageBoxPropTyp
239246 < Button
240247 id = { action }
241248 key = { `${ action } -${ index } ` }
242- design = { index === 0 ? ButtonDesign . Emphasized : ButtonDesign . Transparent }
249+ design = { emphasizedAction === action ? ButtonDesign . Emphasized : ButtonDesign . Transparent }
243250 onClick = { handleOnClose }
244251 data-action = { action }
245252 >
@@ -259,6 +266,7 @@ MessageBox.defaultProps = {
259266 title : null ,
260267 icon : null ,
261268 type : MessageBoxTypes . CONFIRM ,
269+ emphasizedAction : MessageBoxActions . OK ,
262270 actions : [ ]
263271} ;
264272
0 commit comments