import type { MessageBoxResult } from '../../../Types/MessageBoxResult'; import type { IPortalElementProps } from '../../Primitives/Portal/IPortalElementProps'; import type { PortalProjectionElement } from '../../Primitives/Portal/PortalProjectionElement'; import type { IMessageBoxElementProps } from './IMessageBoxElementProps'; import { MessageBoxElement } from './MessageBoxElement'; import type { IMessageBoxServiceConfig } from './IMessageBoxServiceConfig'; /** * Function type for resolving message box results. * * @public */ export type MessageBoxResolveFunction = (result: MessageBoxResult) => void; /** * Represents the `IMessageBoxRef` interface. * * @public */ export interface IMessageBoxRef { messageBoxId: string; messageBoxElement: MessageBoxElement; portalProjectionElement: PortalProjectionElement; options?: IMessageBoxOptions; resolve?: MessageBoxResolveFunction; } /** * Represents the properties of a message box element. * * @public */ export interface IMessageBoxOptions extends Partial, Partial { navigateToClose?: boolean; } /** * Service for managing the display and behavior of message box elements. * Provides methods to open and close message box elements within a portal structure. * * Uses a singleton pattern with static configuration. * * @example * ```typescript * // Configure once at app startup * MessageBoxService.configure({ * closeOnNavigation: true, * behaviors: [] * }); * * // Use throughout the app * const result = await MessageBoxService.instance.open('myMessageBox', { * header: 'Confirm', * message: 'Are you sure?', * buttons: MessageBoxButtons.YesNo * }); * ``` * * @public */ export declare class MessageBoxService { private static _instance; private static _config; private readonly _messageBoxMap; private readonly _behaviors; private _portalElement?; /** * Constructs a new instance of the `MessageBoxService` class. * Use `MessageBoxService.configure()` and `MessageBoxService.instance` instead of direct instantiation. * * @private */ private constructor(); /** * Gets the singleton instance of `MessageBoxService`. * If not configured, uses default configuration. * * @public * @static */ static get instance(): MessageBoxService; /** * Configures the `MessageBoxService` globally. * Must be called before accessing `instance` if custom configuration is needed. * Can only be called once; subsequent calls will throw an error. * * @public * @static * @param config - The configuration for the message box service. * @throws Error if already configured. * * @example * ```typescript * MessageBoxService.configure({ * closeOnNavigation: true, * behaviors: [myCustomBehavior] * }); * ``` */ static configure(config: Partial): void; /** * Opens a message box within a portal. * * @public * @param messageBoxId - Unique identifier for the message box instance. * @param options - Properties for portal and message box. * @returns A promise resolving with the result of the message box. */ open(messageBoxId: string, options?: IMessageBoxOptions): Promise; /** * Closes the message box and optionally removes it from the DOM. * * @public * @param messageBoxId - Unique identifier for the message box instance. * @returns A promise resolving once the message box is fully closed. */ close(messageBoxId: string): Promise; /** * Disposes of the service and cleans up resources. * * @public */ dispose(): void; /** * Extends the message box component by placing it within a portal structure. * * @private * @param element - The element to place within the portal. * @param props - Properties to set on the portal. * @returns The created PortalProjectionElement containing the message box. */ private extendToPortal; } //# sourceMappingURL=MessageBoxService.d.ts.map