import { type PanelPosition, Panel as XYPanel } from "@xyflow/react"; import { type ComponentPropsWithoutRef, type HTMLAttributes, forwardRef } from "react"; import { twMerge } from "tailwind-merge"; import { IconButton as _IconButton } from "ui/components/buttons/IconButton"; export type PanelProps = HTMLAttributes & { position: PanelPosition; unstyled?: boolean; }; export function Panel({ position, className, children, unstyled, ...props }: PanelProps) { if (unstyled) { return ( {children} ); } return ( {children} ); } const Wrapper = ({ children, className, ...props }: ComponentPropsWithoutRef<"div">) => (
{children}
); const IconButton = ({ Icon, size = "lg", variant = "ghost", onClick, disabled, className, round, ...rest }: ComponentPropsWithoutRef & { round?: boolean }) => ( <_IconButton Icon={Icon} size={size} variant={variant} onClick={onClick} disabled={disabled} className={twMerge(round ? "rounded-full" : "", className)} {...rest} /> ); const Text = forwardRef & { mono?: boolean }>( ({ children, className, mono, ...props }, ref) => ( {children} ) ); Panel.Wrapper = Wrapper; Panel.IconButton = IconButton; Panel.Text = Text;