{
  "name": "dropdown",
  "type": "registry:ui",
  "framework": "react",
  "title": "Dropdown Menu",
  "description": "A menu that opens from a button, with icon, label and description items that highlight in brand color.",
  "dependencies": [
    "class-variance-authority",
    "radix-ui"
  ],
  "files": [
    {
      "path": "ui/dropdown.tsx",
      "content": "\"use client\"\n\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { DropdownMenu as DropdownMenuPrimitive } from \"radix-ui\"\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\n/*\n * Radix owns the behaviour: open state, Escape and outside press, focus\n * return to the trigger, arrow keys, Home and End, typeahead, and\n * collision-aware placement. Only the look is newt/ui's.\n */\nconst Dropdown = DropdownMenuPrimitive.Root\n\n/*\n * It has no look of its own. Pass `asChild` to put the state on your own\n * button, or the classes of the button it should be, for example\n * `className={buttonVariants({ variant: \"secondary\" })}`.\n */\nconst DropdownTrigger = DropdownMenuPrimitive.Trigger\n\nconst DropdownGroup = DropdownMenuPrimitive.Group\n\nconst DropdownRadioGroup = DropdownMenuPrimitive.RadioGroup\n\nconst DropdownContent = React.forwardRef<\n  React.ComponentRef<typeof DropdownMenuPrimitive.Content>,\n  React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.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 DropdownMenuPrimitive.Portal\n    >[\"container\"]\n  }\n>(\n  (\n    { className, align = \"start\", sideOffset = 4, container, ...props },\n    ref\n  ) => (\n    <DropdownMenuPrimitive.Portal container={container}>\n      <DropdownMenuPrimitive.Content\n        ref={ref}\n        align={align}\n        sideOffset={sideOffset}\n        className={cn(\n          \"z-[110] w-60 rounded-[var(--newt-radius-md)] border border-newt-border bg-newt-bg-floating p-1.5 text-newt-text-primary shadow-elevation-high outline-none\",\n          className\n        )}\n        {...props}\n      />\n    </DropdownMenuPrimitive.Portal>\n  )\n)\nDropdownContent.displayName = \"DropdownContent\"\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 dropdownItemVariants = cva(\n  \"group flex cursor-pointer select-none items-center gap-2.5 rounded-[var(--newt-radius-sm)] px-2.5 py-2 outline-none transition-colors duration-fast ease-newt data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n  {\n    variants: {\n      variant: {\n        default: \"data-[highlighted]:bg-newt-brand\",\n        danger:\n          \"text-newt-danger data-[highlighted]:bg-newt-danger data-[highlighted]:text-newt-on-accent\",\n      },\n    },\n    defaultVariants: {\n      variant: \"default\",\n    },\n  }\n)\n\nexport interface DropdownItemProps\n  extends\n    React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item>,\n    VariantProps<typeof dropdownItemVariants> {}\n\nconst DropdownItem = React.forwardRef<\n  React.ComponentRef<typeof DropdownMenuPrimitive.Item>,\n  DropdownItemProps\n>(({ className, variant, ...props }, ref) => (\n  <DropdownMenuPrimitive.Item\n    ref={ref}\n    className={cn(dropdownItemVariants({ variant }), className)}\n    {...props}\n  />\n))\nDropdownItem.displayName = \"DropdownItem\"\n\nexport interface DropdownRadioItemProps\n  extends\n    React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>,\n    VariantProps<typeof dropdownItemVariants> {}\n\n/*\n * The checked item keeps the brand fill, so the highlight on it is an inset\n * outline: without it the keyboard position is lost on the chosen item.\n */\nconst DropdownRadioItem = React.forwardRef<\n  React.ComponentRef<typeof DropdownMenuPrimitive.RadioItem>,\n  DropdownRadioItemProps\n>(({ className, variant, ...props }, ref) => (\n  <DropdownMenuPrimitive.RadioItem\n    ref={ref}\n    className={cn(\n      dropdownItemVariants({ variant }),\n      \"data-[state=checked]:bg-newt-brand\",\n      \"data-[state=checked]:data-[highlighted]:outline data-[state=checked]:data-[highlighted]:outline-2 data-[state=checked]:data-[highlighted]:-outline-offset-2 data-[state=checked]:data-[highlighted]:outline-newt-on-accent\",\n      className\n    )}\n    {...props}\n  />\n))\nDropdownRadioItem.displayName = \"DropdownRadioItem\"\n\nconst DropdownLabel = React.forwardRef<\n  React.ComponentRef<typeof DropdownMenuPrimitive.Label>,\n  React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label>\n>(({ className, ...props }, ref) => (\n  <DropdownMenuPrimitive.Label\n    ref={ref}\n    className={cn(\n      \"px-2.5 py-1.5 text-xs font-bold uppercase tracking-[0.02em] text-newt-text-muted\",\n      className\n    )}\n    {...props}\n  />\n))\nDropdownLabel.displayName = \"DropdownLabel\"\n\nconst DropdownSeparator = React.forwardRef<\n  React.ComponentRef<typeof DropdownMenuPrimitive.Separator>,\n  React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n  <DropdownMenuPrimitive.Separator\n    ref={ref}\n    className={cn(\"mx-1.5 my-1 h-px bg-newt-border\", className)}\n    {...props}\n  />\n))\nDropdownSeparator.displayName = \"DropdownSeparator\"\n\nconst DropdownIcon = React.forwardRef<\n  HTMLSpanElement,\n  React.HTMLAttributes<HTMLSpanElement>\n>(({ className, ...props }, ref) => (\n  <span\n    ref={ref}\n    aria-hidden=\"true\"\n    className={cn(\n      \"w-5 shrink-0 text-center text-newt-text-muted group-data-[highlighted]:text-newt-on-accent group-data-[state=checked]:text-newt-on-accent\",\n      className\n    )}\n    {...props}\n  />\n))\nDropdownIcon.displayName = \"DropdownIcon\"\n\nconst DropdownItemText = React.forwardRef<\n  HTMLDivElement,\n  React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n  <div ref={ref} className={cn(\"min-w-0\", className)} {...props} />\n))\nDropdownItemText.displayName = \"DropdownItemText\"\n\nconst DropdownItemLabel = React.forwardRef<\n  HTMLDivElement,\n  React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n  <div ref={ref} className={cn(\"text-sm font-medium\", className)} {...props} />\n))\nDropdownItemLabel.displayName = \"DropdownItemLabel\"\n\nconst DropdownItemDescription = React.forwardRef<\n  HTMLDivElement,\n  React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n  <div\n    ref={ref}\n    className={cn(\n      \"text-xs text-newt-text-muted group-data-[highlighted]:text-[color-mix(in_srgb,var(--newt-on-accent)_75%,transparent)] group-data-[state=checked]:text-[color-mix(in_srgb,var(--newt-on-accent)_75%,transparent)]\",\n      className\n    )}\n    {...props}\n  />\n))\nDropdownItemDescription.displayName = \"DropdownItemDescription\"\n\nexport {\n  Dropdown,\n  DropdownTrigger,\n  DropdownContent,\n  DropdownGroup,\n  DropdownLabel,\n  DropdownItem,\n  DropdownRadioGroup,\n  DropdownRadioItem,\n  DropdownSeparator,\n  DropdownIcon,\n  DropdownItemText,\n  DropdownItemLabel,\n  DropdownItemDescription,\n  dropdownItemVariants,\n}\n",
      "type": "registry:ui"
    }
  ]
}