'use client'; import type { CSSProperties, ReactNode } from 'react'; /** * Floating HTML tooltip anchored inside a `relative` chart container. Values lead (strong), labels follow. * Pass `x`/`y` in container pixels; it flips to stay inside `width`. */ export function ChartTooltip({ x, y, width, children, }: { x: number; y: number; width: number; children: ReactNode; }) { const flip = x > width * 0.6; const style: CSSProperties = { left: flip ? undefined : x + 10, right: flip ? width - x + 10 : undefined, top: Math.max(0, y - 8), }; return (