"use client"; import { ChevronRightIcon } from "lucide-react"; import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui"; import { containedPortal } from "../ui/portal-container"; import { createContext, useContext, type ComponentProps, type Ref } from "react"; import { cn } from "../lib/cn"; import { MENU_CHEVRON_CLASS, MENU_ITEM_CLASS, MENU_SEPARATOR_CLASS, MENU_SURFACE_CLASS, } from "../lib/menu-styles"; const MENU_MOTION_CLASS = "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"; import { usePortalTokenSource, usePortalTokenStyle } from "../lib/use-portal-token-style"; const DropdownMenuContainedPortal = containedPortal(DropdownMenuPrimitive.Portal); type DropdownMenuSourceContextValue = { source: HTMLElement | null; ref: (node: HTMLElement | null) => void; }; const DropdownMenuSourceContext = createContext(null); function assignRef(ref: Ref | undefined, value: T | null) { if (typeof ref === "function") ref(value); else if (ref) ref.current = value; } function DropdownMenu(props: ComponentProps) { const source = usePortalTokenSource(); return ( ); } function DropdownMenuTrigger({ ref, ...props }: ComponentProps) { const sourceRef = useContext(DropdownMenuSourceContext); return ( { sourceRef?.ref(node); assignRef(ref, node); }} {...props} /> ); } function DropdownMenuContent({ className, sideOffset = 4, style, ...props }: ComponentProps) { const source = useContext(DropdownMenuSourceContext); const portalStyle = usePortalTokenStyle(source?.source ?? null); return ( ); } function DropdownMenuItem({ className, inset, variant = "default", ...props }: ComponentProps & { inset?: boolean; variant?: "default" | "destructive"; }) { return ( ); } function DropdownMenuSeparator({ className, ...props }: ComponentProps) { return ( ); } function DropdownMenuSub(props: ComponentProps) { return ; } function DropdownMenuSubTrigger({ className, inset, children, ...props }: ComponentProps & { inset?: boolean }) { return ( {children} ); } function DropdownMenuSubContent({ className, style, ...props }: ComponentProps) { const source = useContext(DropdownMenuSourceContext); const portalStyle = usePortalTokenStyle(source?.source ?? null); return ( ); } export { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, };