
import { _MenuTrigger } from "./Menu/MenuTrigger.js";
import "./Menu/index.js";
import { ComponentProps, ComponentType, MouseEvent, PointerEvent, ReactElement, RefObject } from "react";

//#region src/components/actions/use-context-menu.d.ts
type NativeMouseEvent = globalThis.MouseEvent;
type NativePointerEvent = globalThis.PointerEvent;
interface UseContextMenuReturn<E extends HTMLElement = HTMLElement, P extends object = {}, T = ComponentProps<typeof _MenuTrigger>> {
  /** Container element that receives context menu events. Attach this ref to your target element. */
  targetRef: RefObject<E | null>;
  /**
   * Programmatically opens the menu at the specified coordinates or element center.
   * Runtime props are merged with defaultMenuProps (runtime props take precedence).
   *
   * @param props - Props to pass to the menu component (optional, defaults to defaultMenuProps)
   * @param triggerProps - Additional props for MenuTrigger (merged with defaultTriggerProps)
   * @param event - The pointer/mouse event containing coordinates for positioning (optional, centers on element if not provided)
   */
  open(props?: P, triggerProps?: T, event?: NativeMouseEvent | NativePointerEvent | MouseEvent | PointerEvent): void;
  /**
   * Updates the props of the currently open menu without repositioning.
   * Props are merged with defaultMenuProps.
   */
  update(props: P, triggerProps?: T): void;
  /** Closes the menu programmatically. */
  close(): void;
  /** Current open/closed state of the menu. */
  isOpen: boolean;
  /**
   * JSX element that must be rendered in your component tree.
   * Contains the MenuTrigger and positioning logic.
   * IMPORTANT: Must be placed directly inside the target container (the element with targetRef).
   */
  get rendered(): ReactElement | null;
}
/**
 * Generic hook to manage a context menu component that opens at pointer coordinates.
 *
 * @param Component - A React component that represents the menu content (Menu or CommandMenu).
 * @param defaultTriggerProps - Default props to pass to the MenuTrigger.
 * @param defaultMenuProps - Default props to pass to the Menu component.
 * @returns An object with `targetRef` to attach to the container element, `open` function to open the menu at event coordinates, `close` function to close the menu, and `rendered` JSX element to include in your component tree.
 */
declare function useContextMenu<E extends HTMLElement = HTMLElement, P extends object = {}, T = ComponentProps<typeof _MenuTrigger>>(Component: ComponentType<P>, defaultTriggerProps?: Omit<ComponentProps<typeof _MenuTrigger>, 'children' | 'isOpen' | 'onOpenChange' | 'targetRef'>, defaultMenuProps?: P): UseContextMenuReturn<E, P, T>;
//#endregion
export { UseContextMenuReturn, useContextMenu };
//# sourceMappingURL=use-context-menu.d.ts.map