41 lines
1.0 KiB
TypeScript
41 lines
1.0 KiB
TypeScript
import type { HTMLAttributes, ReactNode } from "react";
|
|
import { renderAsChild } from "@/lib/as-child";
|
|
import { cn } from "@/lib/utils";
|
|
|
|
export interface TooltipProviderProps {
|
|
delayDuration?: number;
|
|
children?: ReactNode;
|
|
}
|
|
|
|
export function TooltipProvider({ children }: TooltipProviderProps) {
|
|
return <>{children}</>;
|
|
}
|
|
|
|
export interface TooltipProps {
|
|
open?: boolean;
|
|
onOpenChange?: (open: boolean) => void;
|
|
delayDuration?: number;
|
|
children?: ReactNode;
|
|
}
|
|
|
|
export function Tooltip({ children }: TooltipProps) {
|
|
return <>{children}</>;
|
|
}
|
|
|
|
export function TooltipTrigger({
|
|
asChild,
|
|
children,
|
|
...props
|
|
}: HTMLAttributes<HTMLElement> & { asChild?: boolean }) {
|
|
return renderAsChild(asChild, children, props);
|
|
}
|
|
|
|
export interface TooltipContentProps extends HTMLAttributes<HTMLDivElement> {
|
|
side?: "top" | "right" | "bottom" | "left";
|
|
sideOffset?: number;
|
|
}
|
|
|
|
export function TooltipContent({ className, side, sideOffset, ...props }: TooltipContentProps) {
|
|
return <div data-side={side} className={cn(className)} {...props} />;
|
|
}
|