Popover
The anchored floating layer. Flips side when it does not fit, closes on Escape or an outside click. Everything else here sits on it.
import { Button, Popover, usePopover } from '@objectifthunes/whiteboard'
const { anchorRef, open, toggle, close } = usePopover<HTMLButtonElement>()
<Button ref={anchorRef} variant="secondary" onClick={toggle}>Filters</Button>
<Popover open={open} onClose={close} anchorRef={anchorRef} align="start">
{/* any content */}
</Popover>usePopover is the wiring every call site repeats: an anchor ref plus open state with stable toggle and close. You can skip it and pass your own ref and state.
Positioning is fixed, measured against the anchor before paint, and recomputed on scroll and resize. side is a preference, not a guarantee — it flips when the preferred side does not fit and the other one fits better. computePopoverPosition is exported if you want the maths without the component.
Popovers sit at --wb-z-popover (3500), deliberately above the modal backdrop at 3000. A Combobox or DatePicker inside a Modal portals to the body as a sibling of that backdrop, so a lower value would render it behind the dialog that opened it.
Outside clicks that land on the anchor are ignored, because the trigger owns its own toggle. Closing here as well would immediately reopen it.