/** @packageDocumentation
 * @module Popup
 */
import * as React from "react";
import type { AbstractToolbarProps, DialogLayoutDataProvider, OnValueCommitFunc, Primitives, PropertyDescription, RelativePosition } from "@itwin/appui-abstract";
import { PropertyRecord, UiEvent } from "@itwin/appui-abstract";
import type { XAndY } from "@itwin/core-geometry";
import type { Point } from "@itwin/core-react";
import type { KeyinEntry } from "../keyins/Keyins";
import { WrapperContext } from "../configurableui/ConfigurableUiContent";
import { type Placement } from "../utils/Placement";
import type { ToolbarItem } from "../toolbar/ToolbarItem";
import type { ToolbarProps } from "../toolbar/Toolbar";
import type { SizeProps } from "../utils/SizeProps";
/** Information maintained by PopupManager about a Popup
 * @public
 */
export interface PopupInfo {
    id: string;
    pt: XAndY;
    component: React.ReactNode;
    /** @deprecated in 4.11.0. Please use the optional `parent` property moving forward. */
    parentDocument: Document;
    /** will become standard once `parentDocument` is removed. */
    parent?: Document;
}
/** @internal */
interface CommonPopupOptions {
    onCancel: () => void;
    location: XAndY;
    offset: XAndY;
    placement: Placement;
    anchor?: HTMLElement;
    id?: string;
}
interface DisplayCardPopupOptions extends CommonPopupOptions {
    title: string | PropertyRecord | undefined;
    toolbarProps?: ToolbarProps;
    onItemExecuted: (item: any) => void;
}
/**
 * @public
 * @deprecated in 4.13.0. Event args are inferred from a listener. If explicit type is needed use a type helper.
 */
export interface PopupsChangedEventArgs {
    popups: ReadonlyArray<PopupInfo>;
}
/** Popups Changed Event class.
 * @public
 * @deprecated in 4.13.0. This class should not be used by applications to instantiate objects.
 */
export declare class PopupsChangedEvent extends UiEvent<PopupsChangedEventArgs> {
}
/** Props for each popup managed by the PopupManager
 * @public
 */
export interface PopupPropsBase {
    id: string;
    el: HTMLElement;
    pt: XAndY;
    offset: XAndY;
}
/** Describes React based content
 * @public
 */
export interface ReactContent {
    reactNode: React.ReactNode;
}
/** Type for Popup Content
 * @public
 */
export type PopupContentType = HTMLElement | ReactContent;
/** ReactContent type guard.
 * @internal
 */
export declare const isReactContent: (content: PopupContentType) => content is ReactContent;
/** Popup Manager class
 * @public
 */
export declare class PopupManager {
    private static _popups;
    private static _editorId;
    private static _toolbarId;
    private static _htmlElementId;
    private static _cardId;
    private static _toolSettingsId;
    private static _keyPalettePopupId;
    private static _defaultOffset;
    static readonly onPopupsChangedEvent: PopupsChangedEvent;
    static get popupCount(): number;
    static get popups(): ReadonlyArray<PopupInfo>;
    static set popups(popups: ReadonlyArray<PopupInfo>);
    /** @internal */
    static clearPopups(): void;
    private static addPopup;
    private static updatePopup;
    static addOrUpdatePopup(popupInfo: PopupInfo): void;
    static removePopup(id: string): boolean;
    static get defaultOffset(): XAndY;
    static set defaultOffset(offset: XAndY);
    static showInputEditor(el: HTMLElement, pt: XAndY, value: Primitives.Value, propertyDescription: PropertyDescription, onCommit: OnValueCommitFunc, onCancel: () => void): boolean;
    static hideInputEditor(): boolean;
    static showKeyinPalette(keyins: KeyinEntry[], el: HTMLElement, onItemExecuted?: (item: any) => void, onCancel?: () => void): boolean;
    static hideKeyinPalette(): boolean;
    /** @deprecated in 4.16.0. Use {@link PopupManager.displayToolbar} instead. */
    static showToolbar(toolbarProps: AbstractToolbarProps, el: HTMLElement, pt: XAndY, offset: XAndY, onItemExecuted: (item: any) => void, onCancel: () => void, relativePosition: RelativePosition): boolean;
    static displayToolbar(items: ToolbarItem[], options: CommonPopupOptions & {
        onItemExecuted: (item: any) => void;
    }): boolean;
    static hideToolbar(): boolean;
    /** @deprecated in 4.16.0. Use {@link PopupManager.showComponent} instead. */
    static showHTMLElement(displayElement: HTMLElement, el: HTMLElement, pt: XAndY, offset: XAndY, onCancel: () => void, relativePosition: RelativePosition): boolean;
    /** @deprecated in 4.16.0. Use {@link PopupManager.hideComponent} instead. */
    static hideHTMLElement(): boolean;
    /**
     * Displays a React component as a popup.
     * @param displayElement The React component to display.
     * @param options for displaying the component.
     */
    static showComponent(displayElement: React.ReactElement, options: CommonPopupOptions): boolean;
    static hideComponent(id?: string): boolean;
    /** @deprecated in 4.16.0. Use {@link PopupManager.displayCard} instead. */
    static showCard(content: PopupContentType, title: string | PropertyRecord | undefined, toolbarProps: AbstractToolbarProps | undefined, el: HTMLElement, pt: XAndY, offset: XAndY, onItemExecuted: (item: any) => void, onCancel: () => void, relativePosition: RelativePosition): boolean;
    static displayCard(content: React.ReactNode, options: DisplayCardPopupOptions): boolean;
    static hideCard(id?: string): boolean;
    static openToolSettings(dataProvider: DialogLayoutDataProvider, el: HTMLElement, pt: XAndY, offset: XAndY, onCancel: () => void, relativePosition: RelativePosition): boolean;
    static closeToolSettings(): boolean;
    static getPopupPosition(el: HTMLElement, pt: XAndY, offset: XAndY, size: SizeProps): Point;
}
interface PopupRendererState {
    parentDocument: Document | null;
    popups: ReadonlyArray<PopupInfo>;
}
/** Popup Renderer.
 * @public
 */
export declare class PopupRenderer extends React.Component<{}, PopupRendererState> {
    /** @internal */
    static contextType: React.Context<HTMLElement>;
    /** @internal */
    context: React.ContextType<typeof WrapperContext>;
    readonly state: PopupRendererState;
    componentDidMount(): void;
    componentWillUnmount(): void;
    private _handleRefSet;
    render(): React.ReactNode;
    private _handlePopupsChangedEvent;
}
export {};
//# sourceMappingURL=PopupManager.d.ts.map