import { type ReactElement } from "react"; import * as React from "react"; import { Tooltip as TooltipPrimitive } from "@base-ui/react/tooltip"; import { cn } from "@/lib/utils"; import { asChildProps } from "@/lib/as-child"; import { useThemeVars } from "@/lib/theme-provider"; /** * Tooltip — WealthX Design System * Figma: https://www.figma.com/design/9V9F0NGVsif8LGmEhVjOcT/Design-System---shadcn?node-id=73-2904 * * Base: official shadcn tooltip (npx shadcn\@latest add tooltip) * WealthX overrides: bg-brand-secondary, text-brand-secondary-foreground, sharp corners (no rounded-md) */ export type TooltipProviderProps = React.ComponentProps< typeof TooltipPrimitive.Provider >; function TooltipProvider({ delay = 0, ...props }: TooltipProviderProps): ReactElement { return ( ); } export type TooltipProps = React.ComponentProps; function Tooltip({ ...props }: TooltipProps): ReactElement { return ; } export type TooltipTriggerProps = React.ComponentProps< typeof TooltipPrimitive.Trigger > & { /** shadcn-compatible alias for Base UI's `render`: replaces the trigger with its single child. */ asChild?: boolean; }; function TooltipTrigger({ asChild, children, ...props }: TooltipTriggerProps): ReactElement { return ( ); } export type TooltipContentProps = React.ComponentProps< typeof TooltipPrimitive.Popup > & { sideOffset?: number; side?: React.ComponentProps["side"]; }; function TooltipContent({ className, sideOffset = 8, side, children, style, ...props }: TooltipContentProps): ReactElement { const themeVars = useThemeVars(); return ( // Force the portal to render directly in document.body so the Positioner's // `position: fixed` coordinates are relative to the viewport — not to any // parent floating element (e.g. a Dialog) that may inherit its own portal // context via FloatingPortal's PortalContext. {children} ); } export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };