/** * Shared behavioral machinery for Dialog and Drawer. * Drawer: drag-to-dismiss / snap points. * @module react/components/ui/modal-surface */ import * as React from "react"; import { type DisclosureOptions } from "./disclosure.js"; /** Open/close state shared between a modal skin's Root and its parts. */ export interface ModalState { open: boolean; setOpen: (open: boolean) => void; contentId: string; descriptionId: string; titleId: string; defaultContentId: string; defaultDescriptionId: string; defaultTitleId: string; setContentId: React.Dispatch>; setDescriptionId: React.Dispatch>; setTitleId: React.Dispatch>; descriptionPresent: boolean; titlePresent: boolean; setDescriptionPresent: React.Dispatch>; setTitlePresent: React.Dispatch>; triggerRef: React.RefObject; } /** Props for the shared modal content shell. */ export interface ModalContentProps extends React.HTMLAttributes { /** Extra node rendered before `children` -- used by Drawer for the drag handle. */ lead?: React.ReactNode; /** React 19: ref is a regular prop, forwarded to (merged onto) the panel node. */ ref?: React.Ref; } type ModalBtnProps = React.ButtonHTMLAttributes & { asChild?: boolean; ref?: React.Ref; }; /** Run the shared modal focus, stack, scroll-lock, and dismissal lifecycle. */ export declare function useModalContentEffect(open: boolean, setOpen: (open: boolean) => void, ref: React.RefObject, triggerRef: React.RefObject, dismissOnEscape?: boolean): void; /** Resolve a token scope outside any clipping modal panel for a modal portal. */ export declare function getModalTokenScope(document: Document, anchor: HTMLElement | null): HTMLElement; /** * Creates a fresh context instance plus the Root, useModal, ModalTrigger, * ModalClose, and ModalContent parts -- all bound to that context. * * Each skin (Dialog, Drawer) calls this ONCE at module scope so their contexts * are distinct objects. This prevents cross-binding when one skin is nested * inside the other: a DrawerClose inside a Dialog will only close the Drawer, * never the Dialog, because the two contexts cannot overlap. * * @param name - Component name used in the thrown error (e.g. "Dialog"). */ export declare function createModalSurfaceParts(name: string): { ModalRoot: ({ children, open, defaultOpen, onOpenChange }: DisclosureOptions & { children: React.ReactNode; }) => React.ReactElement; useModal: () => ModalState; ModalTrigger: ({ children, asChild, disabled, id, onClick, ref, type, ...props }: ModalBtnProps) => React.ReactElement; ModalClose: ({ children, asChild, disabled, onClick, ref, type, ...props }: ModalBtnProps) => React.ReactElement; ModalContent: ({ className, children, lead, id, ref, "aria-label": ariaLabel, "aria-labelledby": labelledBy, ...props }: ModalContentProps) => React.ReactElement | null; }; export {}; //# sourceMappingURL=modal-surface.d.ts.map