import * as React from 'react' ; import { useContext } from 'react' ; export const DOCUMENT_BODY = 'DOCUMENT_BODY' as const ; export interface OverlayBehaviorContextType { portalContainer : HTMLElement | typeof DOCUMENT_BODY ; } export const OverlayBehaviorContext = React . createContext < OverlayBehaviorContextType > ( { portalContainer : DOCUMENT_BODY , } ) ; export function useOverlayBehavior ( ) { return useContext ( OverlayBehaviorContext ) ; } export function OverlayBehaviorProvider ( { children , ... value } ) { return < OverlayBehaviorContext . Provider value = { value } > { children } < /OverlayBehaviorContext.Provider>; }