/** * Vendored React 19-compatible replacement for the `usePopper` hook from * the unmaintained `react-popper` package. * * Changes from the original: * - Ported to TypeScript (the original was Flow-typed) * - Replaced `ReactDOM.flushSync` with a plain `setState` call. In React 18+ * `flushSync` inside a `useLayoutEffect` callback causes a warning; in * React 19 it throws. The first position is instead computed synchronously * via `forceUpdate()` while still inside the layout effect, which React * commits before the browser paints (see the effect below). * - Inlined `fromEntries` and `isEqual` helpers to remove the * `react-fast-compare` dependency. * - `useIsomorphicLayoutEffect` inlined: uses `useLayoutEffect` in browsers * and `useEffect` as an SSR fallback to suppress the React warning. * * Source: https://github.com/floating-ui/react-popper/blob/master/src/usePopper.js */ import { createPopper as defaultCreatePopper, type Instance as PopperInstance, type Options as PopperOptions, type State as PopperState, type VirtualElement } from '@popperjs/core'; import { type CSSProperties } from 'react'; type Styles = Record; type Attributes = Record>; type UsePopperOptions = Partial; export type UsePopperResult = Readonly<{ state: PopperState | null; styles: Styles; attributes: Attributes; update: PopperInstance['update'] | null; forceUpdate: PopperInstance['forceUpdate'] | null; }>; export declare function usePopper(referenceElement: Element | VirtualElement | null | undefined, popperElement: HTMLElement | null | undefined, options?: UsePopperOptions): UsePopperResult; export {}; //# sourceMappingURL=use-popper-compat.d.ts.map