33 lines
923 B
TypeScript
33 lines
923 B
TypeScript
import type { HTMLAttributes, ReactNode } from "react";
|
|
import { renderAsChild } from "@/lib/as-child";
|
|
import { cn } from "@/lib/utils";
|
|
|
|
export interface PopoverProps {
|
|
open?: boolean;
|
|
onOpenChange?: (open: boolean) => void;
|
|
modal?: boolean;
|
|
children?: ReactNode;
|
|
}
|
|
|
|
export function Popover({ children }: PopoverProps) {
|
|
return <>{children}</>;
|
|
}
|
|
|
|
export function PopoverTrigger({
|
|
asChild,
|
|
children,
|
|
...props
|
|
}: HTMLAttributes<HTMLElement> & { asChild?: boolean }) {
|
|
return renderAsChild(asChild, children, props);
|
|
}
|
|
|
|
export interface PopoverContentProps extends HTMLAttributes<HTMLDivElement> {
|
|
align?: "start" | "center" | "end";
|
|
side?: "top" | "right" | "bottom" | "left";
|
|
sideOffset?: number;
|
|
}
|
|
|
|
export function PopoverContent({ className, align, side, sideOffset, ...props }: PopoverContentProps) {
|
|
return <div data-align={align} data-side={side} className={cn(className)} {...props} />;
|
|
}
|