"use client";
import { Tooltip as TooltipPrimitive } from "@base-ui/react/tooltip";
import { cn } from "./cn";
/*
* Base UI owns hover/focus detection, Escape, delay groups, anchored
* positioning, and dismissal. In 1.6 it intentionally treats Tooltip as a
* visual-only hint: it adds neither `role="tooltip"` nor `aria-describedby`,
* so every trigger still needs its own accessible name. The platform wrapper
* supplies stable composition/ref contracts and themed presentation only.
*/
function TooltipProvider({
delay = 300,
closeDelay = 0,
...props
}: TooltipPrimitive.Provider.Props) {
return (
);
}
// Tooltip.Root renders no DOM of its own, so it takes no data-slot marker.
function Tooltip(props: TooltipPrimitive.Root.Props) {
return ;
}
function TooltipTrigger(props: TooltipPrimitive.Trigger.Props) {
return ;
}
export interface TooltipContentProps
extends
TooltipPrimitive.Popup.Props,
Pick<
TooltipPrimitive.Positioner.Props,
"align" | "alignOffset" | "side" | "sideOffset"
> {
container?: TooltipPrimitive.Portal.Props["container"];
}
function TooltipContent({
className,
container,
align = "center",
alignOffset = 0,
side = "top",
sideOffset = 7,
children,
...props
}: TooltipContentProps) {
return (
{children}
);
}
export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };