1 | /// <reference types="react" />
|
2 | import type { OverlayProps } from "../overlay/overlayProps";
|
3 | /**
|
4 | * Public instance properties & methods for an overlay in the current overlay stack.
|
5 | */
|
6 | export interface OverlayInstance {
|
7 | /**
|
8 | * Bring document focus inside this overlay element.
|
9 | * This should be defined if `props.enforceFocus={true}` or `props.autoFocus={true}`.
|
10 | */
|
11 | bringFocusInsideOverlay?: () => void;
|
12 | /** Reference to the overlay container element which may or may not be in a Portal. */
|
13 | containerElement: React.RefObject<HTMLDivElement>;
|
14 | /**
|
15 | * Document "focus" event handler which needs to be attached & detached appropriately.
|
16 | * This should be defined if `props.enforceFocus={true}`.
|
17 | */
|
18 | handleDocumentFocus?: (e: FocusEvent) => void;
|
19 | /**
|
20 | * Document "mousedown" event handler which needs to be attached & detached appropriately.
|
21 | * This should be defined if `props.canOutsideClickClose={true}` and `props.hasBackdrop={false}`.
|
22 | */
|
23 | handleDocumentMousedown?: (e: MouseEvent) => void;
|
24 | /** Unique ID for this overlay which helps to identify it across prop changes. */
|
25 | id: string;
|
26 | /** Subset of props necessary for some overlay stack focus management logic. */
|
27 | props: Pick<OverlayProps, "autoFocus" | "enforceFocus" | "usePortal" | "hasBackdrop">;
|
28 | }
|