/** @packageDocumentation
 * @module Base
 */
import * as React from "react";
import { BeEvent } from "@itwin/core-bentley";
import { Point } from "@itwin/core-react/internal";
import type { PanelSide } from "../widget-panels/PanelTypes.js";
import type { FloatingWidgetResizeHandle } from "../widget/FloatingWidget.js";
import type { WidgetState } from "../state/WidgetState.js";
import type { TabState } from "../state/TabState.js";
import type { XAndY } from "../state/internal/NineZoneStateHelpers.js";
import type { DropTargetState, TabDragDropTargetState, WidgetDragDropTargetState } from "../state/DropTargetState.js";
import type { SizeProps } from "../../utils/SizeProps.js";
/** @internal */
export interface DragStartArgs {
    initialPointerPosition: Point;
    pointerPosition: Point;
}
/** @internal */
export interface TabDragStartArgs extends DragStartArgs {
    widgetSize: SizeProps;
}
/** @internal */
export interface UseDragTabArgs {
    tabId: TabState["id"];
    onDrag?: (dragBy: XAndY) => void;
    onDragEnd?: (target: TabDragDropTargetState) => void;
}
/** @internal */
export declare function useDragTab(args: UseDragTabArgs): ({ initialPointerPosition, pointerPosition, widgetSize, }: TabDragStartArgs) => void;
type UpdateWidgetDragItemFn = (id: WidgetDragItem["id"]) => void;
/** @internal */
export interface UseDragWidgetArgs {
    widgetId: WidgetState["id"];
    onDragStart?: (updateWidget: UpdateWidgetDragItemFn, initialPointerPosition: Point, pointerPosition: Point) => void;
    onDrag?: (dragBy: Point) => void;
    onDragEnd?: (target: WidgetDragDropTargetState) => void;
}
/** @internal */
export declare function useDragWidget(args: UseDragWidgetArgs): ({ initialPointerPosition, pointerPosition }: DragStartArgs) => void;
/** @internal */
export interface UseDragPanelGripArgs {
    side: PanelSide;
    onDrag?: (pointerPosition: Point, lastPointerPosition: Point) => void;
    onDragEnd?: () => void;
}
/** @internal */
export declare function useDragPanelGrip(args: UseDragPanelGripArgs): ({ initialPointerPosition }: DragStartArgs) => void;
/** @internal */
export interface UseDragResizeHandleArgs {
    widgetId: WidgetState["id"];
    handle: FloatingWidgetResizeHandle;
    onDrag?: (pointerPosition: Point) => void;
}
/** @internal */
export declare function useDragResizeHandle(args: UseDragResizeHandleArgs): ({ initialPointerPosition }: DragStartArgs) => void;
/** @internal */
export interface UseDragToolSettingsArgs {
    newFloatingWidgetId: WidgetDragItem["id"];
}
/** @internal */
export declare function useDragToolSettings(args: UseDragToolSettingsArgs): ({ initialPointerPosition }: DragStartArgs) => void;
/** @internal */
export declare function useTarget<T extends Element>(target: DropTargetState): [
    React.Ref<T>,
    boolean
];
/** @internal */
export interface UseTabTargetArgs {
    widgetId: WidgetState["id"];
    tabIndex: number;
}
/** @internal */
export declare function useTabTarget<T extends Element>(args: UseTabTargetArgs): [
    React.Ref<T>,
    boolean
];
/** @internal */
export interface UsePanelTargetArgs {
    side: PanelSide;
    newWidgetId: WidgetState["id"];
}
/** @internal */
export declare function usePanelTarget<T extends Element>(args: UsePanelTargetArgs): [
    React.Ref<T>,
    boolean
];
/** @internal */
export interface UseDragItemArgs<T extends DragItem> {
    item: T;
    isDragItem?: (item: T | undefined, dragged: DragItem) => boolean;
    onDragStart?: DragEventHandler;
    onDrag?: DragEventHandler;
    onDragEnd?: DragEventHandler;
}
/** @internal */
export declare function useDragItem<T extends DragItem>(args: UseDragItemArgs<T>): (info: DragInfo) => void;
/** @internal */
export declare function useDraggedItem(): DragItem | undefined;
/** @internal */
export declare function useIsDraggedItem(item: DragItem): boolean;
/** @internal */
export declare function useIsDraggedType(type: DragItem["type"]): boolean;
/** @internal */
export declare function useDraggedItemId<T extends DragItem>(type: T["type"]): T["id"] | undefined;
/** @internal */
export interface DragProviderProps {
    children?: React.ReactNode;
}
/** @internal */
export declare function DragProvider(props: DragProviderProps): React.JSX.Element;
interface TabDragItem {
    type: "tab";
    id: TabState["id"];
}
interface WidgetDragItem {
    type: "widget";
    id: WidgetState["id"];
}
interface PanelGripDragItem {
    type: "panelGrip";
    id: PanelSide;
}
interface ResizeHandleDragItem {
    type: "resizeHandle";
    id: FloatingWidgetResizeHandle;
    widgetId: WidgetState["id"];
}
/** @internal */
export type DragItem = TabDragItem | WidgetDragItem | PanelGripDragItem | ResizeHandleDragItem;
interface BaseDragInfo {
    initialPointerPosition: Point;
    lastPointerPosition: Point;
    pointerPosition: Point;
}
interface TabDragInfo extends BaseDragInfo {
    widgetSize: SizeProps;
}
type DragInfo = BaseDragInfo | TabDragInfo;
interface HandleDragStartArgs {
    item: DragItem;
    info: DragInfo;
}
interface Dragged {
    item: DragItem;
    info: DragInfo;
    target: DropTargetState | undefined;
}
type DragEventHandler = (item: DragItem, info: DragInfo, target: DropTargetState | undefined) => void;
type DropTargetChangedEventHandler = (target: DropTargetState | undefined) => void;
/** @internal */
export declare class DragManager {
    private _dragged;
    private _onDragStartEmitter;
    private _onDragUpdateEmitter;
    private _onDragEmitter;
    private _onDragEndEmitter;
    private _onTargetChangedEmitter;
    get draggedItem(): Dragged | undefined;
    isTargeted(target: DropTargetState): boolean;
    get onDragStart(): BeEvent<DragEventHandler>;
    get onDragUpdate(): BeEvent<DragEventHandler>;
    get onDrag(): BeEvent<DragEventHandler>;
    get onDragEnd(): BeEvent<DragEventHandler>;
    get onTargetChanged(): BeEvent<DropTargetChangedEventHandler>;
    handleDragStart({ item, info }: HandleDragStartArgs): void;
    handleDragUpdate(item: DragItem): void;
    handleDrag(x: number, y: number): void;
    handleDragEnd(): void;
    handleTargetChanged(target: DropTargetState | undefined): void;
}
/** @internal */
export declare const DragManagerContext: React.Context<DragManager>;
/** @internal */
export declare const DraggedWidgetIdContext: React.Context<string | undefined>;
/** @internal */
export declare const DraggedPanelSideContext: React.Context<PanelSide | undefined>;
/** @internal */
export declare const DraggedResizeHandleContext: React.Context<FloatingWidgetResizeHandle | undefined>;
/** @internal */
export declare function useTargeted(): DropTargetState | undefined;
export {};
//# sourceMappingURL=DragManager.d.ts.map