2022-11-16 05:16:56 -05:00
|
|
|
// largely from https://github.com/shadcn/taxonomy
|
|
|
|
|
|
|
|
import * as React from "react"
|
|
|
|
import * as PopoverPrimitive from "@radix-ui/react-popover"
|
|
|
|
import clsx from "clsx"
|
2022-11-18 01:36:53 -05:00
|
|
|
import styles from "./popover.module.css"
|
2022-11-16 05:16:56 -05:00
|
|
|
|
|
|
|
type PopoverProps = PopoverPrimitive.PopoverProps
|
|
|
|
|
|
|
|
export function Popover({ ...props }: PopoverProps) {
|
2022-11-18 01:36:53 -05:00
|
|
|
return <PopoverPrimitive.Root {...props} />
|
2022-11-16 05:16:56 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
Popover.Trigger = React.forwardRef<
|
2022-11-18 01:36:53 -05:00
|
|
|
HTMLButtonElement,
|
|
|
|
PopoverPrimitive.PopoverTriggerProps
|
2022-11-16 05:16:56 -05:00
|
|
|
>(function PopoverTrigger({ ...props }, ref) {
|
2022-11-18 01:36:53 -05:00
|
|
|
return <PopoverPrimitive.Trigger {...props} ref={ref} />
|
2022-11-16 05:16:56 -05:00
|
|
|
})
|
|
|
|
|
|
|
|
Popover.Portal = PopoverPrimitive.Portal
|
|
|
|
|
|
|
|
Popover.Content = React.forwardRef<
|
2022-11-18 01:36:53 -05:00
|
|
|
HTMLDivElement,
|
|
|
|
PopoverPrimitive.PopoverContentProps
|
2022-11-16 05:16:56 -05:00
|
|
|
>(function PopoverContent({ className, ...props }, ref) {
|
2022-11-18 01:36:53 -05:00
|
|
|
return (
|
|
|
|
<PopoverPrimitive.Content
|
|
|
|
ref={ref}
|
|
|
|
align="end"
|
|
|
|
className={clsx(styles.root, className)}
|
|
|
|
{...props}
|
|
|
|
/>
|
|
|
|
)
|
2022-11-16 05:16:56 -05:00
|
|
|
})
|