tasko/components/ui/tooltip.tsx

31 lines
1.1 KiB
TypeScript
Raw Normal View History

2024-02-16 01:49:19 +00:00
'use client';
2024-02-15 02:30:10 +00:00
2024-02-16 01:49:19 +00:00
import * as React from 'react';
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
2024-02-15 02:30:10 +00:00
2024-02-16 01:49:19 +00:00
import { cn } from '@/lib/utils';
2024-02-15 02:30:10 +00:00
2024-02-16 01:49:19 +00:00
const TooltipProvider = TooltipPrimitive.Provider;
2024-02-15 02:30:10 +00:00
2024-02-16 01:49:19 +00:00
const Tooltip = TooltipPrimitive.Root;
2024-02-15 02:30:10 +00:00
2024-02-16 01:49:19 +00:00
const TooltipTrigger = TooltipPrimitive.Trigger;
2024-02-15 02:30:10 +00:00
const TooltipContent = React.forwardRef<
2024-11-01 01:58:40 +00:00
React.ComponentRef<typeof TooltipPrimitive.Content>,
2024-02-15 02:30:10 +00:00
React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>
>(({ className, sideOffset = 4, ...props }, ref) => (
<TooltipPrimitive.Content
ref={ref}
sideOffset={sideOffset}
className={cn(
2024-02-16 01:49:19 +00:00
'z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
2024-02-15 02:30:10 +00:00
className
)}
{...props}
/>
2024-02-16 01:49:19 +00:00
));
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
2024-02-15 02:30:10 +00:00
2024-02-16 01:49:19 +00:00
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };