{
  "name": "context-menu",
  "type": "registry:ui",
  "framework": "react",
  "title": "Context Menu",
  "description": "A menu that opens on a right click, with items, keyboard shortcuts, separators and a danger variant.",
  "dependencies": [
    "class-variance-authority",
    "radix-ui"
  ],
  "files": [
    {
      "path": "ui/context-menu.tsx",
      "content": "\"use client\"\n\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { ContextMenu as ContextMenuPrimitive } from \"radix-ui\"\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\n/*\n * Radix owns the behaviour: it opens at the pointer on a right click, a long\n * press or the menu key, and handles Escape and outside press, arrow keys,\n * Home and End, typeahead, and focus return. Only the look is newt/ui's.\n */\nconst ContextMenu = ContextMenuPrimitive.Root\n\n/*\n * The area that answers the right click. It renders a `span` with no look of\n * its own; pass `asChild` to put it on your own element.\n */\nconst ContextMenuTrigger = ContextMenuPrimitive.Trigger\n\nconst ContextMenuGroup = ContextMenuPrimitive.Group\n\nconst ContextMenuContent = React.forwardRef<\n  React.ComponentRef<typeof ContextMenuPrimitive.Content>,\n  React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content> & {\n    /**\n     * The element the menu is portalled into. Defaults to `document.body`;\n     * pass the enclosing native `<dialog>` or a themed wrapper to keep it there.\n     */\n    container?: React.ComponentProps<\n      typeof ContextMenuPrimitive.Portal\n    >[\"container\"]\n  }\n>(({ className, container, ...props }, ref) => (\n  <ContextMenuPrimitive.Portal container={container}>\n    <ContextMenuPrimitive.Content\n      ref={ref}\n      className={cn(\n        \"z-[110] w-[188px] rounded-[var(--newt-radius-md)] border border-newt-border bg-newt-bg-floating p-1.5 shadow-elevation-high outline-none\",\n        className\n      )}\n      {...props}\n    />\n  </ContextMenuPrimitive.Portal>\n))\nContextMenuContent.displayName = \"ContextMenuContent\"\n\n/*\n * `data-highlighted` is the primitive's one state for the pointer and the\n * keyboard, so it takes the place of the old `:hover` rule.\n */\nconst contextMenuItemVariants = cva(\n  \"group flex cursor-pointer select-none items-center justify-between rounded-[var(--newt-radius-sm)] px-2 py-1.5 text-[13px] outline-none transition-colors duration-fast ease-newt data-[highlighted]:text-newt-on-accent data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n  {\n    variants: {\n      variant: {\n        default: \"text-newt-text-secondary data-[highlighted]:bg-newt-brand\",\n        danger: \"text-newt-dnd data-[highlighted]:bg-newt-dnd\",\n      },\n    },\n    defaultVariants: {\n      variant: \"default\",\n    },\n  }\n)\n\nexport interface ContextMenuItemProps\n  extends\n    React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item>,\n    VariantProps<typeof contextMenuItemVariants> {}\n\nconst ContextMenuItem = React.forwardRef<\n  React.ComponentRef<typeof ContextMenuPrimitive.Item>,\n  ContextMenuItemProps\n>(({ className, variant, ...props }, ref) => (\n  <ContextMenuPrimitive.Item\n    ref={ref}\n    className={cn(contextMenuItemVariants({ variant }), className)}\n    {...props}\n  />\n))\nContextMenuItem.displayName = \"ContextMenuItem\"\n\nconst ContextMenuLabel = React.forwardRef<\n  React.ComponentRef<typeof ContextMenuPrimitive.Label>,\n  React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label>\n>(({ className, ...props }, ref) => (\n  <ContextMenuPrimitive.Label\n    ref={ref}\n    className={cn(\n      \"px-2 py-1.5 text-xs font-bold uppercase tracking-[0.02em] text-newt-text-muted\",\n      className\n    )}\n    {...props}\n  />\n))\nContextMenuLabel.displayName = \"ContextMenuLabel\"\n\nconst ContextMenuShortcut = React.forwardRef<\n  HTMLSpanElement,\n  React.ComponentProps<\"span\">\n>(({ className, ...props }, ref) => (\n  <span\n    ref={ref}\n    className={cn(\n      \"text-[11px] text-newt-text-muted group-data-[highlighted]:text-[color-mix(in_srgb,var(--newt-on-accent)_70%,transparent)]\",\n      className\n    )}\n    {...props}\n  />\n))\nContextMenuShortcut.displayName = \"ContextMenuShortcut\"\n\nconst ContextMenuSeparator = React.forwardRef<\n  React.ComponentRef<typeof ContextMenuPrimitive.Separator>,\n  React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n  <ContextMenuPrimitive.Separator\n    ref={ref}\n    className={cn(\"mx-1.5 my-1 h-px bg-newt-border\", className)}\n    {...props}\n  />\n))\nContextMenuSeparator.displayName = \"ContextMenuSeparator\"\n\nexport {\n  ContextMenu,\n  ContextMenuTrigger,\n  ContextMenuContent,\n  ContextMenuGroup,\n  ContextMenuLabel,\n  ContextMenuItem,\n  ContextMenuShortcut,\n  ContextMenuSeparator,\n  contextMenuItemVariants,\n}\n",
      "type": "registry:ui"
    }
  ]
}