/** * Stage 3 port of Base UI React's `getEmptyRootContext` * (`packages/react/src/floating-ui-react/utils/getEmptyRootContext.ts`). * * Factory for a structurally valid, no-op `FloatingRootStore`. Used when * an API requires a `FloatingRootContext` but the caller has no real * floating surface mounted yet. The returned store responds to every * method call, but `setOpen` has no `onOpenChange` to forward to and * there are no reference / floating elements seeded. */ import { FloatingRootStore } from "../components/floating-root-store"; import { PopupTriggerMap } from "../popup-trigger-map"; import type { FloatingRootContext } from "../types"; export function getEmptyRootContext(): FloatingRootContext { return new FloatingRootStore({ open: false, transitionStatus: undefined, floatingElement: null, referenceElement: null, triggerElements: new PopupTriggerMap(), floatingId: "", syncOnly: false, nested: false, onOpenChange: undefined, }); }