UNPKG

@ui5/webcomponents-react

Version:

React Wrapper for UI5 Web Components and additional components

65 lines (64 loc) 3 kB
import type { ReactNode } from 'react'; import { MessageBoxAction, MessageBoxType } from '../../enums/index.js'; import type { DialogDomRef, DialogPropTypes } from '../../webComponents/index.js'; type MessageBoxActionType = MessageBoxAction | keyof typeof MessageBoxAction | string; export interface MessageBoxPropTypes extends Omit<DialogPropTypes, 'children' | 'footer' | 'headerText' | 'onClose' | 'state' | 'accessibleNameRef' | 'open' | 'initialFocus'> { /** * Defines the IDs of the elements that label the component. * * __Note:__ Per default the prop receives the IDs of the header and the content. */ accessibleNameRef?: DialogPropTypes['accessibleNameRef']; /** * Flag whether the Message Box should be opened or closed */ open?: DialogPropTypes['open']; /** * A custom title for the MessageBox. If not present, it will be derived from the `MessageBox` type. */ titleText?: DialogPropTypes['headerText']; /** * Defines the content of the `MessageBox`. * * **Note:** Although this prop accepts HTML Elements, it is strongly recommended that you only use text in order to preserve the intended design and accessibility capabilities. */ children: ReactNode | ReactNode[]; /** * Array of actions of the MessageBox. Those actions will be transformed into buttons in the `MessageBox` footer. * * __Note:__ Although this prop accepts all HTML Elements, it is strongly recommended that you only use `MessageBoxAction`s (text) or the `Button` component in order to preserve the intended. */ actions?: (MessageBoxActionType | ReactNode)[]; /** * Specifies which action of the created dialog will be emphasized. * * @since 0.16.3 * * @default `"OK"` */ emphasizedAction?: MessageBoxActionType; /** * A custom icon. If not present, it will be derived from the `MessageBox` type. */ icon?: ReactNode; /** * Defines the type of the `MessageBox` with predefined title, icon, actions and a visual highlight color. * * @default `"Confirm"` */ type?: MessageBoxType | keyof typeof MessageBoxType; /** * Defines the ID of the HTML Element or the `MessageBoxAction`, which will get the initial focus. */ initialFocus?: MessageBoxActionType; /** * Callback to be executed when the `MessageBox` is closed (either by pressing on one of the `actions` or by pressing the Escape key). * `action` is the pressed action button, it's `undefined` when closed via ESC. */ onClose?: (action: MessageBoxActionType | undefined, escPressed?: true) => void; } /** * The `MessageBox` component provides easier methods to create a `Dialog`, such as standard alerts, confirmation dialogs, or arbitrary message dialogs. */ declare const MessageBox: import("react").ForwardRefExoticComponent<MessageBoxPropTypes & import("react").RefAttributes<DialogDomRef>>; export { MessageBox };