"use client"; import * as React from "react"; import { ContextMenu as ContextMenuPrimitive } from "radix-ui"; import { cva, type VariantProps } from "class-variance-authority"; import { cn } from "@/utils/ui"; import { HugeiconsIcon } from "@hugeicons/react"; import { Tick02Icon, ArrowRightIcon, CircleIcon, } from "@hugeicons/core-free-icons"; import { useOverlayOpenChange } from "./use-overlay-open-change"; function ContextMenu({ onOpenChange, ...props }: React.ComponentProps) { const handleOpenChange = useOverlayOpenChange({ source: "context-menu", onOpenChange, }); return ( ); } const ContextMenuTrigger = ContextMenuPrimitive.Trigger; const ContextMenuGroup = ContextMenuPrimitive.Group; const ContextMenuPortal = ContextMenuPrimitive.Portal; const ContextMenuSub = ContextMenuPrimitive.Sub; const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup; const contextMenuItemVariants = cva( "relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-3 py-1.5 text-sm text-foreground/85 outline-hidden data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:size-3.5 [&_svg]:shrink-0", { variants: { variant: { default: "focus:bg-accent focus:text-accent-foreground [&_svg]:text-muted-foreground", destructive: "text-destructive focus:bg-destructive/10 focus:text-destructive [&_svg]:text-destructive", }, }, defaultVariants: { variant: "default", }, }, ); const ContextMenuSubTrigger = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef & { inset?: boolean; variant?: VariantProps["variant"]; icon?: React.ReactNode; } >( ( { className, inset, children, variant = "default", icon, ...props }, ref, ) => ( {icon && ( {icon} )} {children} ), ); ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName; const ContextMenuSubContent = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )); ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName; const ContextMenuContent = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef & { container?: HTMLElement | null; } >(({ className, container, ...props }, ref) => ( )); ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName; const ContextMenuItem = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef & { inset?: boolean; variant?: VariantProps["variant"]; icon?: React.ReactNode; textRight?: string; } >( ( { className, inset, variant = "default", icon, children, textRight, ...props }, ref, ) => { const shouldInsetContent = inset || Boolean(icon); return ( {icon && ( {icon} )} {children} {textRight && ( {textRight} )} ); }, ); ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName; const ContextMenuCheckboxItem = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef & { variant?: VariantProps["variant"]; icon?: React.ReactNode; } >( ( { className, children, checked, variant = "default", icon, ...props }, ref, ) => ( {icon && ( {icon} )} {children} ), ); ContextMenuCheckboxItem.displayName = ContextMenuPrimitive.CheckboxItem.displayName; const ContextMenuRadioItem = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef & { variant?: VariantProps["variant"]; icon?: React.ReactNode; } >(({ className, children, variant = "default", icon, ...props }, ref) => ( {icon && ( {icon} )} {children} )); ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName; const ContextMenuLabel = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef & { inset?: boolean; icon?: React.ReactNode; } >(({ className, inset, icon, children, ...props }, ref) => ( {icon && ( {icon} )} {children} )); ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName; const ContextMenuSeparator = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )); ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName; const ContextMenuShortcut = ({ className, ...props }: React.HTMLAttributes) => { return ( ); }; ContextMenuShortcut.displayName = "ContextMenuShortcut"; export { ContextMenu, ContextMenuTrigger, ContextMenuContent, ContextMenuItem, ContextMenuCheckboxItem, ContextMenuRadioItem, ContextMenuLabel, ContextMenuSeparator, ContextMenuShortcut, ContextMenuGroup, ContextMenuPortal, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuRadioGroup, };