/** * A function type that creates a portal for the given React element. * * @template E - The type of the React element to portal. * @template F - The type of the fallback element (defaults to `null`). * @param {E} element - The React element to portal. * @param {F} [fallbackElement] - The fallback element to return if the container is not available. * @returns {React.ReactPortal | F | null} - The portal element, fallback element, or `null`. */ export type CreatePortalFn = (element: E, fallbackElement?: F) => React.ReactPortal | F | null; /** * The value provided by the `PortalContext`. */ export type PortalContextValue = { /** Function to create a portal for a given React element. */ createPortal: CreatePortalFn; /** Reference to the container element where the portal will be rendered. */ containerRef: React.RefObject; }; /** * Context that provides the `createPortal` function and container reference to its children. * This context is compatible with Next.js and ensures no errors during the first render on the server * by using a fallback element if the container is not available. */ export declare const PortalContext: import('react').Context; /** * A custom hook to access the `PortalContext` value. * * @throws Will throw an error if used outside of a `PortalProvider`. * @returns {PortalContextValue} - The context value containing `createPortal` and `containerRef`. */ export declare const usePortal: () => PortalContextValue;