import React, { PureComponent, type ReactElement } from "react";
import { type Modifier } from "react-popper";
import { NOOP } from "../../utils/function-utils";
import { AnimationType as AnimationTypeEnum, HideShowEvent as DialogTriggerEventEnum, DialogPosition as DialogPositionEnum } from "./DialogConstants";
import { type VibeComponentProps } from "../../types";
import type * as PopperJS from "@popperjs/core";
import { type DialogAnimationType, type DialogPosition, type DialogTriggerEvent } from "./Dialog.types";
import LayerContext from "../LayerProvider/LayerContext";
export interface DialogProps extends VibeComponentProps {
    /**
     * Class name applied to the reference wrapper element.
     */
    referenceWrapperClassName?: string;
    /**
     * The wrapper element type to use for React components. Defaults to "span".
     */
    referenceWrapperElement?: "span" | "div";
    /**
     * The placement of the dialog relative to the reference element.
     */
    position?: DialogPosition;
    /**
     * Custom Popper.js modifiers.
     * https://popper.js.org/docs/v2/modifiers/
     */
    modifiers?: Modifier<any>[];
    /**
     * The starting edge of the dialog.
     */
    startingEdge?: string;
    /**
     * Offset values for positioning adjustments.
     * `main` - horizontal offset
     * `secondary` - vertical offset
     */
    moveBy?: {
        main?: number;
        secondary?: number;
    };
    /**
     * Delay in milliseconds before showing the dialog.
     */
    showDelay?: number;
    /**
     * Delay in milliseconds before hiding the dialog.
     */
    hideDelay?: number;
    /**
     * Events that trigger showing the dialog.
     */
    showTrigger?: DialogTriggerEvent | DialogTriggerEvent[];
    /**
     * Events that trigger hiding the dialog.
     */
    hideTrigger?: DialogTriggerEvent | DialogTriggerEvent[];
    /**
     * If true, prevents closing the dialog when the mouse enters it.
     */
    showOnDialogEnter?: boolean;
    /**
     * If true, shows the dialog when the component mounts.
     */
    shouldShowOnMount?: boolean;
    /**
     * If true, disables opening the dialog.
     */
    disable?: boolean;
    /**
     * Controls the open state of the dialog.
     */
    open?: boolean;
    /**
     * Derived state control for managing dialog visibility.
     */
    isOpen?: boolean;
    /**
     * Classes that prevent showing the dialog when present.
     */
    showTriggerIgnoreClass?: string | Array<string>;
    /**
     * Classes that prevent hiding the dialog when present.
     */
    hideTriggerIgnoreClass?: string | Array<string>;
    /**
     * The animation type used for the dialog.
     */
    animationType?: DialogAnimationType;
    /**
     * Class name applied to the dialog content container.
     */
    wrapperClassName?: string;
    /**
     * If true, prevents animation when mounting.
     */
    preventAnimationOnMount?: boolean;
    /**
     * The CSS selector of the container where the dialog is rendered.
     */
    containerSelector?: string;
    /**
     * If true, positions the tooltip element.
     */
    tooltip?: boolean;
    /**
     * Class name applied to the tooltip element.
     */
    tooltipClassName?: string;
    /**
     * Callback fired when the dialog is shown.
     */
    onDialogDidShow?: (event?: DialogEvent, eventName?: DialogTriggerEvent | string) => void;
    /**
     * Callback fired when the dialog is hidden.
     */
    onDialogDidHide?: (event: DialogEvent, eventName: DialogTriggerEvent | string) => void;
    /**
     * Callback fired when clicking outside the dialog.
     */
    onClickOutside?: (event: React.MouseEvent) => void;
    /**
     * Callback fired when clicking inside the dialog content.
     */
    onContentClick?: (event: React.MouseEvent) => void;
    /**
     * The z-index applied to the dialog.
     */
    zIndex?: number;
    /**
     * If true, uses derived state from props.
     */
    useDerivedStateFromProps?: boolean;
    /**
     * If true, makes the dialog disappear when the reference element is hidden.
     */
    hideWhenReferenceHidden?: boolean;
    /**
     * If true, triggers the callback when the dialog mounts.
     */
    shouldCallbackOnMount?: boolean;
    /**
     * If true, instantly shows and hides the dialog without delay.
     */
    instantShowAndHide?: boolean;
    /**
     * Callback to dynamically adjust show delay and animation behavior.
     */
    getDynamicShowDelay?: () => {
        showDelay: number;
        preventAnimation: boolean;
    };
    /**
     * The content displayed inside the dialog.
     */
    content?: (() => JSX.Element) | JSX.Element;
    /**
     * The element to position the dialog beside.
     */
    children?: ReactElement | ReactElement[] | string;
    /**
     * If true, keyboard focus/blur events behave like mouse enter/leave.
     */
    addKeyboardHideShowTriggersByDefault?: boolean;
    /**
     * If true, disables scrolling for the container element.
     */
    disableContainerScroll?: boolean | string;
    /**
     * Enables the observation of content resize for the popper element.
     * When set to `true`, a ResizeObserver is attached to the popper content,
     * automatically triggering repositioning when the size of the content changes.
     *
     * This is useful for dialogs, tooltips, or popovers with dynamic content
     * that may grow or shrink without a re-render being triggered.
     */
    observeContentResize?: boolean;
}
export interface DialogState {
    /**
     * If true, the dialog is open.
     */
    isOpen?: boolean;
    /**
     * If true, the dialog state is derived from props.
     */
    shouldUseDerivedStateFromProps?: boolean;
    /**
     * If true, prevents animation when opening or closing the dialog.
     */
    preventAnimation?: boolean;
}
export type DialogEvent = React.MouseEvent | React.KeyboardEvent | KeyboardEvent | React.FocusEvent | CustomEvent;
export default class Dialog extends PureComponent<DialogProps, DialogState> {
    static hideShowTriggers: typeof DialogTriggerEventEnum;
    static positions: typeof DialogPositionEnum;
    static animationTypes: typeof AnimationTypeEnum;
    static defaultProps: {
        position: string;
        modifiers: (import("react-popper").StrictModifier<any> | Partial<PopperJS.Modifier<any, object>>)[];
        moveBy: {
            main: number;
            secondary: number;
        };
        showDelay: number;
        hideDelay: number;
        showTrigger: DialogTriggerEventEnum;
        hideTrigger: DialogTriggerEventEnum;
        showOnDialogEnter: boolean;
        shouldShowOnMount: boolean;
        disable: boolean;
        open: boolean;
        animationType: AnimationTypeEnum;
        preventAnimationOnMount: boolean;
        tooltip: boolean;
        onDialogDidShow: typeof NOOP;
        onDialogDidHide: typeof NOOP;
        onClickOutside: typeof NOOP;
        onContentClick: typeof NOOP;
        useDerivedStateFromProps: boolean;
        hideWhenReferenceHidden: boolean;
        shouldCallbackOnMount: boolean;
        instantShowAndHide: boolean;
        addKeyboardHideShowTriggersByDefault: boolean;
        observeContentResize: boolean;
    };
    private showTimeout;
    private hideTimeout;
    private containerRef;
    context: React.ContextType<typeof LayerContext>;
    constructor(props: DialogProps);
    closeDialogOnEscape(event: KeyboardEvent): void;
    componentDidMount(): void;
    componentWillUnmount(): void;
    static getDerivedStateFromProps(nextProps: DialogProps, state: DialogState): DialogState;
    getDefaultContainer(): HTMLElement;
    getContainer(): Element;
    showDialog(event: DialogEvent, eventName: DialogTriggerEvent | string, options?: {
        preventAnimation?: boolean;
    }): void;
    onShowDialog(event: DialogEvent, eventName: DialogTriggerEvent | string): void;
    showDialogIfNeeded(event: DialogEvent, eventName: DialogTriggerEvent | string, options?: {}): void;
    hideDialog(event: DialogEvent, eventName: DialogTriggerEvent | string): void;
    onHideDialog(event: DialogEvent, eventName: DialogTriggerEvent | string): void;
    hideDialogIfNeeded(event: DialogEvent, eventName: DialogTriggerEvent | string): void;
    handleEvent(eventName: DialogTriggerEvent, target: EventTarget, event: DialogEvent): void;
    isShown(): boolean;
    isShowTrigger(eventName: DialogTriggerEvent): boolean;
    isHideTrigger(eventName: DialogTriggerEvent): boolean;
    onMouseEnter(e: React.MouseEvent): void;
    onMouseLeave(e: React.MouseEvent): void;
    onClick(e: React.MouseEvent): void;
    onKeyDown(event: React.KeyboardEvent): void;
    onMouseDown(e: React.MouseEvent): void;
    onFocus(e: React.FocusEvent): void;
    onBlur(e: React.FocusEvent): void;
    onEsc(e: React.KeyboardEvent): void;
    onContextMenu(e: React.MouseEvent): void;
    onClickOutside(event: React.MouseEvent): void;
    onDialogEnter(event: React.MouseEvent): void;
    onDialogLeave(event: React.MouseEvent): void;
    onContentClick(e: React.MouseEvent): void;
    render(): string | React.ReactElement<any, string | React.JSXElementConstructor<any>>[] | React.JSX.Element;
}
