import type { ReactNode } from "react"; import { cn } from "@/lib/utils"; const TOOLTIP_WIDTH_GUESS = 200; const OFFSET = 12; /** * The one tooltip panel every chart uses, positioned inside the chart's * `relative` wrapper. It flips to the left of the pointer near the right edge * so it never spills out of the card. */ export function ChartTooltip({ x, y, containerWidth, children, }: { x: number; y: number; containerWidth: number; children: ReactNode; }) { const flip = x + OFFSET + TOOLTIP_WIDTH_GUESS > containerWidth; return (
{children}
); } /** A tooltip row: series key (a short line or square of its colour), name, value. */ export function TooltipRow({ color, label, value, mark = "rect", className, }: { color?: string; label: ReactNode; value: ReactNode; mark?: "rect" | "line"; className?: string; }) { return (

{color && ( )} {label} {value}

); }