/** @packageDocumentation * @module Dialog */ import "./Dialog.scss"; import * as React from "react"; import { CommonProps } from "../utils/Props"; import { Omit } from "../utils/typeUtils"; /** Enum for button types. Determines button label, and default button style. * @public */ export declare enum DialogButtonType { None = "", Close = "close", OK = "ok", Cancel = "cancel", Yes = "yes", No = "no", Retry = "retry", Next = "next", Previous = "previous" } /** Enum for button style. * @public */ export declare enum DialogButtonStyle { None = "", Primary = "uicore-buttons-primary", Hollow = "uicore-buttons-hollow", Blue = "uicore-buttons-blue" } /** Enum for dialog alignment * @public */ export declare enum DialogAlignment { TopLeft = "top-left", Top = "top", TopRight = "top-right", Left = "left", Center = "center", Right = "right", BottomLeft = "bottom-left", Bottom = "bottom", BottomRight = "bottom-right" } /** Interface for a dialog button in a button cluster * @public */ export interface DialogButtonDef { /** type of button */ type: DialogButtonType; /** Triggered on button click */ onClick: () => void; /** Which button style to decorate button width */ buttonStyle?: DialogButtonStyle; /** Disable the button */ disabled?: boolean; /** Custom label */ label?: string; /** Custom CSS class */ className?: string; } /** Properties for the [[Dialog]] component * @public */ export interface DialogProps extends Omit, "title">, CommonProps { /** Indicates whether to show dialog or not */ opened: boolean; /** Indicates whether the user can resize dialog with cursor. Default: false */ resizable?: boolean; /** Indicates whether the user can move dialog with cursor. Default: false */ movable?: boolean; /** Indicates whether the content should be inset. Default: true */ inset?: boolean; /** Indicates whether the focus should be trapped within the dialog. Default: false */ trapFocus?: boolean; /** Whether the hide the header. Default: false */ hideHeader?: boolean; /** Override for the header */ header?: React.ReactNode; /** Title to show in title bar of dialog */ title?: string | JSX.Element; /** Footer to show at bottom of dialog. Note: will override buttonCluster */ footer?: string | JSX.Element; /** List of DialogButtonDef objects specifying buttons and associated onClick events */ buttonCluster?: DialogButtonDef[]; /** Default alignment of dialog. Default: DialogAlignment.Center */ alignment?: DialogAlignment; /** Initial x/left position of dialog in px. */ x?: number; /** Initial y/top position of dialog in px. */ y?: number; /** onClick event for X button for dialog */ onClose?: () => void; /** 'keyup' event for Esc key */ onEscape?: () => void; /** Triggered when a click is triggered outside of this dialog. */ onOutsideClick?: (event: MouseEvent) => any; /** Initial width of dialog. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. Default: "50%" */ width?: string | number; /** Initial height of dialog. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. */ height?: string | number; /** Minimum width that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. Default: 300px */ minWidth?: string | number; /** Minimum height that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. Default: 100px */ minHeight?: string | number; /** Maximum width that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. */ maxWidth?: string | number; /** Maximum height that the dialog may be resized to. Displayed in px if value is a number; otherwise, displayed in specified CSS unit. */ maxHeight?: string | number; /** Whether to show background overlay. Default: true. * @note Modeless dialogs require an id and an implementation of onModelessPointerDown. */ modal?: boolean; /** An id for a modeless dialog */ modelessId?: string; /** Pointer Down event handler when modeless (modal = false) */ onModelessPointerDown?: (event: React.PointerEvent, id: string) => void; /** Custom CSS Style for overlay */ backgroundStyle?: React.CSSProperties; /** Custom CSS Style for title */ titleStyle?: React.CSSProperties; /** Custom CSS Style for footer */ footerStyle?: React.CSSProperties; /** Custom CSS class name for the content */ contentClassName?: string; /** Custom CSS Style for the content */ contentStyle?: React.CSSProperties; } /** @internal */ interface DialogState { rightResizing: boolean; downResizing: boolean; moving: boolean; grabOffsetX: number; grabOffsetY: number; x?: number; y?: number; width?: number; height?: number; positionSet: boolean; } /** * Dialog React component with optional resizing and dragging functionality * @public */ export declare class Dialog extends React.Component { private _parentDocument; private _containerRef; static defaultProps: Partial; /** @internal */ readonly state: Readonly; constructor(props: DialogProps); private getParentWindow; componentWillUnmount(): void; componentDidMount(): void; handleRefSet: (containerDiv: HTMLDivElement | null) => void; render(): JSX.Element; private getCSSClassNameFromAlignment; private getFooterButtons; private _handleKeyUp; private _handleContainerPointerDown; private _handleStartResizeRight; private _handleStartResizeDown; private _handleStartResizeDownRight; private _handleStartMove; private _handlePointerMove; private _handlePointerUp; } export {}; //# sourceMappingURL=Dialog.d.ts.map