// Port of web/uikit/Tooltips.tsx, rebuilt on the Floating controller (floating.go). // // The first Go port degraded the tooltip into a pure-CSS `group-hover` reveal: // static placement classes instead of measurement, no flip/shift, no portal, no // open delay, no close grace period, an arrow drawn from the REQUESTED placement // (so it pointed the wrong way after a flip — except it could never flip), and a // `tabindex="0"` on every wrapper, which put every tooltip in the tab order. All of // that is restored/fixed here on top of Floating: the bubble is portaled to // document.body, measured, flipped and shifted, opens after 200ms of hover, and // stays up for a grace period so the cursor can cross the gap and select text in it. // // Deliberate deviations from the TSX, and why: // // - The arrow is Floating.Arrow (a rotated square pinned to the panel's edge whose // offset along that edge is written imperatively) rather than the TSX's // border-triangle utility classes. Those classes pin the arrow to a fixed // fraction of the PANEL (`left-1/2`), so as soon as shift slides the panel away // from its trigger the arrow visibly detaches from it. Floating.Arrow tracks the // trigger, and takes its SIDE from the RESOLVED placement, so it still points at // the trigger after a flip. // - One close delay (100ms — the TSX's trigger-leave value) covers both // trigger-leave and panel-leave; the TSX used 50ms for panel-leave. Floating owns // the hover bridge and has a single HoverCloseDelay, and 100ms is the more // forgiving of the two, which is the whole point of the grace period. // - The trigger element is built here instead of with Floating.Trigger. A tooltip // wraps arbitrary content — usually a