@mescius/dsimageviewer
Version:
Document Solutions Image Viewer
43 lines (42 loc) • 1.9 kB
TypeScript
/// <reference path="../../vendor/react/react.d.ts" />
//@ts-ignore
import { Component } from 'react';
import { ConfirmationDialogProps, ConfirmationDialogState, ConfirmButton } from './Types';
/**
* A confirmation dialog component that displays a modal with customizable buttons and handles user interactions.
* Manually handles ESC key press to close the dialog with appropriate resolution (Cancel/No/false).
* Automatically binds/unbinds key events when dialog visibility changes.
*/
export declare class ConfirmationDialog extends Component<ConfirmationDialogProps, ConfirmationDialogState> {
private _confirmationPromise?;
private _resolve?;
private _confirmationText;
private _detailsText;
private _level?;
private _escKeyHandler?;
state: ConfirmationDialogState;
private _customCssClass;
/**
* Resolves the confirmation promise with the given value and hides the dialog
* @param val - The value to resolve the promise with (boolean or ConfirmButton)
*/
private _resolveConfirmation;
/**
* Handles ESC key press to close the dialog with appropriate resolution
* @param event - Keyboard event
*/
private _handleEscKey;
/**
* Binds ESC key event listener when dialog is shown
*/
private _bindEscKey;
/**
* Unbinds ESC key event listener when dialog is hidden
*/
private _unbindEscKey;
componentDidUpdate(prevProps: ConfirmationDialogProps, prevState: ConfirmationDialogState): void;
componentWillUnmount(): void;
confirm(confirmationText?: string | JSX.Element, level?: "info" | "warning" | "warn" | "debug" | "error", title?: string, buttons?: ConfirmButton[], customCssClass?: "gc-old-school-notify", detailsText?: string | JSX.Element): Promise<boolean | ConfirmButton>;
cancel(): void;
render(): JSX.Element;
}