import type { ReactElement, ReactNode } from "react"; import { Tooltip as TooltipPrimitive } from "@base-ui/react/tooltip"; import { cn } from "@/lib/utils"; type Side = NonNullable; function TooltipProvider({ ...props }: TooltipPrimitive.Provider.Props) { return ; } function TooltipRoot({ ...props }: TooltipPrimitive.Root.Props) { return ; } function TooltipTrigger({ ...props }: TooltipPrimitive.Trigger.Props) { return ; } function TooltipPopup({ className, ...props }: TooltipPrimitive.Popup.Props) { return ( ); } function TooltipPositioner({ className, ...props }: TooltipPrimitive.Positioner.Props) { return ( ); } export type TooltipProps = { /** Text shown in the tooltip popup. */ content: ReactNode; /** The element the tooltip is attached to. Rendered as the trigger. */ children: ReactElement; /** Which side of the trigger to place the popup. Defaults to `"right"`. */ side?: Side; /** Pixel gap between the trigger and the popup. */ sideOffset?: number; }; /** * Standalone tooltip: wraps its own `Provider`, so it can be dropped in * anywhere without an ancestor provider. `children` is delegated to the * Base UI trigger via `render`, so the underlying element keeps its own * tag/handlers (e.g. a `NavLink` for the collapsed sidebar). */ function Tooltip({ content, children, side = "right", sideOffset = 6 }: TooltipProps) { return ( {content} ); } export { Tooltip, TooltipProvider, TooltipRoot, TooltipTrigger, TooltipPositioner, TooltipPopup, };