| 1 | "use client"; |
| 2 | |
| 3 | import * as PopoverPrimitive from "@radix-ui/react-popover"; |
| 4 | import * as React from "react"; |
| 5 | |
| 6 | import { cn } from "@/lib/utils"; |
| 7 | |
| 8 | const Popover = PopoverPrimitive.Root; |
| 9 | |
| 10 | const PopoverTrigger = PopoverPrimitive.Trigger; |
| 11 | |
| 12 | const PopoverContent = React.forwardRef< |
| 13 | React.ElementRef<typeof PopoverPrimitive.Content>, |
| 14 | React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content> & { |
| 15 | container?: HTMLElement | Element | null; |
| 16 | } |
| 17 | >( |
| 18 | ( |
| 19 | { |
| 20 | className, |
| 21 | align = "center", |
| 22 | sideOffset = 4, |
| 23 | container = undefined, |
| 24 | ...props |
| 25 | }, |
| 26 | ref, |
| 27 | ) => ( |
| 28 | <PopoverPrimitive.Portal container={container}> |
| 29 | <PopoverPrimitive.Content |
| 30 | ref={ref} |
| 31 | align={align} |
| 32 | sideOffset={sideOffset} |
| 33 | className={cn( |
| 34 | "z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden 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 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95", |
| 35 | className, |
| 36 | )} |
| 37 | {...props} |
| 38 | /> |
| 39 | </PopoverPrimitive.Portal> |
| 40 | ), |
| 41 | ); |
| 42 | PopoverContent.displayName = PopoverPrimitive.Content.displayName; |
| 43 | |
| 44 | export { Popover, PopoverContent, PopoverTrigger }; |
| 45 |