@@ -4,12 +4,7 @@ import '@ui5/webcomponents-icons/dist/message-information.js';
44import '@ui5/webcomponents-icons/dist/message-success.js' ;
55import '@ui5/webcomponents-icons/dist/message-warning.js' ;
66import '@ui5/webcomponents-icons/dist/question-mark.js' ;
7- import {
8- useConsolidatedRef ,
9- useI18nBundle ,
10- useIsomorphicLayoutEffect ,
11- usePassThroughHtmlProps
12- } from '@ui5/webcomponents-react-base/dist/hooks' ;
7+ import { useConsolidatedRef , useI18nBundle , useIsomorphicLayoutEffect } from '@ui5/webcomponents-react-base/dist/hooks' ;
138import { StyleClassHelper } from '@ui5/webcomponents-react-base/dist/StyleClassHelper' ;
149import { enrichEventWithDetails } from '@ui5/webcomponents-react-base/dist/Utils' ;
1510import {
@@ -31,14 +26,13 @@ import {
3126} from '@ui5/webcomponents-react/dist/assets/i18n/i18n-defaults' ;
3227import { Button } from '@ui5/webcomponents-react/dist/Button' ;
3328import { ButtonDesign } from '@ui5/webcomponents-react/dist/ButtonDesign' ;
34- import { Dialog } from '@ui5/webcomponents-react/dist/Dialog' ;
29+ import { Dialog , DialogPropTypes } from '@ui5/webcomponents-react/dist/Dialog' ;
3530import { Icon } from '@ui5/webcomponents-react/dist/Icon' ;
3631import { MessageBoxActions } from '@ui5/webcomponents-react/dist/MessageBoxActions' ;
3732import { MessageBoxTypes } from '@ui5/webcomponents-react/dist/MessageBoxTypes' ;
3833import { Text } from '@ui5/webcomponents-react/dist/Text' ;
3934import { Title } from '@ui5/webcomponents-react/dist/Title' ;
4035import { TitleLevel } from '@ui5/webcomponents-react/dist/TitleLevel' ;
41- import { CommonProps } from '@ui5/webcomponents-react/interfaces/CommonProps' ;
4236import { Ui5CustomEvent } from '@ui5/webcomponents-react/interfaces/Ui5CustomEvent' ;
4337import { Ui5DialogDomRef } from '@ui5/webcomponents-react/interfaces/Ui5DialogDomRef' ;
4438import React , {
@@ -71,7 +65,7 @@ const deprecatedActions = new Set<MessageBoxAction>([
7165 MessageBoxActions . YES
7266] ) ;
7367
74- export interface MessageBoxPropTypes extends CommonProps {
68+ export interface MessageBoxPropTypes extends Omit < DialogPropTypes , 'children' | 'footer' | 'headerText' | 'onAfterClose' > {
7569 /**
7670 * Flag whether the Message Box should be opened or closed
7771 */
@@ -155,7 +149,8 @@ const MessageBox = forwardRef((props: MessageBoxPropTypes, ref: Ref<Ui5DialogDom
155149 actions,
156150 emphasizedAction,
157151 onClose,
158- initialFocus
152+ initialFocus,
153+ ...rest
159154 } = props ;
160155 const dialogRef = useConsolidatedRef < Ui5DialogDomRef > ( ref ) ;
161156
@@ -269,8 +264,6 @@ const MessageBox = forwardRef((props: MessageBoxPropTypes, ref: Ref<Ui5DialogDom
269264 }
270265 } , [ dialogRef . current , open ] ) ;
271266
272- const passThroughProps = usePassThroughHtmlProps ( props , [ 'onClose' ] ) ;
273-
274267 const messageBoxClassNames = StyleClassHelper . of ( classes . messageBox ) . putIfPresent ( className ) . className ;
275268 const internalActions = getActions ( ) ;
276269
@@ -343,6 +336,8 @@ const MessageBox = forwardRef((props: MessageBoxPropTypes, ref: Ref<Ui5DialogDom
343336 }
344337 }
345338 } , [ emphasizedAction ] ) ;
339+ // @ts -ignore
340+ const { footer, headerText, title, onAfterClose, ...restWithoutOmitted } = rest ;
346341 // todo: remove lowercase conversions
347342 return (
348343 < Dialog
@@ -352,13 +347,15 @@ const MessageBox = forwardRef((props: MessageBoxPropTypes, ref: Ref<Ui5DialogDom
352347 title = { tooltip ?? props . title }
353348 className = { messageBoxClassNames }
354349 onAfterClose = { open ? handleOnClose : stopPropagation }
350+ { ...restWithoutOmitted }
355351 initialFocus = { getInitialFocus ( ) }
356- { ...passThroughProps }
357352 >
358- < header slot = "header" className = { classes . header } data-type = { type } >
359- { iconToRender }
360- < Title level = { TitleLevel . H2 } > { titleToRender ( ) } </ Title >
361- </ header >
353+ { ! props . header && (
354+ < header slot = "header" className = { classes . header } data-type = { type } >
355+ { iconToRender }
356+ < Title level = { TitleLevel . H2 } > { titleToRender ( ) } </ Title >
357+ </ header >
358+ ) }
362359 < Text className = { classes . content } > { children } </ Text >
363360 < footer slot = "footer" className = { classes . footer } >
364361 { internalActions . map ( ( action , index ) => {
0 commit comments