import { FloatingContext, ReferenceType } from '@floating-ui/react'; export interface ModalContextValue { open: boolean; onOpenChange: (open: boolean) => void; reference: (node: ReferenceType | null) => void; floating: (node: HTMLElement | null) => void; getReferenceProps: (userProps?: React.HTMLProps) => Record; getFloatingProps: (userProps?: React.HTMLProps) => Record; context: FloatingContext; labelId: string; descriptionId: string; setHasTitle: (hasTitle: boolean) => void; setHasDescription: (hasDescription: boolean) => void; } export declare const ModalContext: import('react').Context; export declare const useModalContext: () => ModalContextValue; /** * Public Modal context — the safe subset consumers can read from inside a ``. * Use this when you bypass `` and render your own title / description * markup, or when you need to close the modal programmatically from deeply nested code. * * The floating-ui plumbing (`reference`, `floating`, `getReferenceProps`, …) is * intentionally hidden — touching it from outside the Modal package leads to subtle * focus/dismissal bugs. * * @example Custom header with manual `aria-labelledby` wiring * ```tsx * function CustomHeader({ title }: { title: string }) { * const { labelId, onOpenChange } = useModal(); * return ( * *

{title}

* onOpenChange(false)} /> *
* ); * } * ``` * * @example Close the modal from a footer action * ```tsx * function ConfirmButton() { * const { onOpenChange } = useModal(); * return ; * } * ``` * * @throws if called outside a `` subtree. */ export interface UseModalReturn { /** Whether the modal is currently open. */ open: boolean; /** Programmatically open or close the modal. Equivalent to clicking the trigger / closer. */ onOpenChange: (open: boolean) => void; /** ID assigned to the title element, intended for `aria-labelledby`. Empty when no title is registered. */ labelId: string; /** ID assigned to the description element, intended for `aria-describedby`. Empty when no description is registered. */ descriptionId: string; } export declare const useModal: () => UseModalReturn;