{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "retro-dropdown-menu",
  "title": "RetroDropdownMenu",
  "description": "A Mac OS 9 styled dropdown menu with white background, classic drop shadow, a gliding azul highlight, the selection blink, bevel separators, submenus, checkbox/radio items, and keyboard shortcut labels, built on UI SDK Menu.",
  "dependencies": [
    "@ui-sdk/core@0.1.0-beta.1",
    "@ui-sdk/react@0.1.0-beta.1"
  ],
  "registryDependencies": [
    "https://nostalgia-ui.com/r/nostalgia-theme.json",
    "https://nostalgia-ui.com/r/retro-motion.json"
  ],
  "files": [
    {
      "path": "registry/new-york/ui/retro-dropdown-menu.tsx",
      "content": "\"use client\"\n\n/*\n * RetroDropdownMenu: a Mac OS 9 pull-down menu on UI SDK.\n *\n * Crafted moments:\n *  - Gliding azul highlight (modern flair): one highlight layer slides\n *    between rows, so pointer and keyboard moves read as one motion. The\n *    row's ink flips to white in one step as the highlight arrives. Classic\n *    flair snaps the highlight row to row, like 1999.\n *  - Menu blink (both flairs): the chosen item flashes three times, then the\n *    command runs and the menu closes, as the Mac OS always did.\n *\n * The parts are shared by RetroContextMenu and RetroMenuBar.\n */\n\nimport * as React from \"react\"\nimport {\n  Menu as MenuPrimitive,\n  MenuCheckboxItem as MenuCheckboxItemPrimitive,\n  MenuContent as MenuContentPrimitive,\n  MenuGroup as MenuGroupPrimitive,\n  MenuGroupLabel as MenuGroupLabelPrimitive,\n  MenuItem as MenuItemPrimitive,\n  MenuItemIndicator as MenuItemIndicatorPrimitive,\n  MenuRadioGroup as MenuRadioGroupPrimitive,\n  MenuRadioItem as MenuRadioItemPrimitive,\n  MenuSeparator as MenuSeparatorPrimitive,\n  MenuSub as MenuSubPrimitive,\n  MenuSubContent as MenuSubContentPrimitive,\n  MenuSubTrigger as MenuSubTriggerPrimitive,\n  MenuTrigger as MenuTriggerPrimitive,\n} from \"@ui-sdk/react/menu\"\n\nimport { cn } from \"@/lib/utils\"\nimport { BLINK_COUNT, BLINK_CYCLE_MS, blinkThen, popupClass, useGlide } from \"@/registry/new-york/lib/retro-motion\"\n\n/* string class names and plain children, as shadcn-style parts take */\ntype WithClassName<P> = Omit<P, \"className\" | \"children\"> & {\n  className?: string\n  children?: React.ReactNode\n}\n\n/* ------------------------------------------------------------------ */\n/*  Shared menu CSS (glide suppression + blink)                        */\n/* ------------------------------------------------------------------ */\n\n/* Unlayered, so it beats the row utilities without !important; the blink\n * animation in turn beats both. React hoists it and dedupes it by href. */\nconst MENU_CSS = `\n.os9-menu:not([data-glide-off]) [role^=\"menuitem\"][data-highlighted],\n.os9-menu:not([data-glide-off]) [role^=\"menuitem\"][data-popup-open] {\n  background-color: transparent;\n}\n.os9-menu[data-glide-off] > [data-glide-layer],\n.os9-menu:has([data-pending]) > [data-glide-layer] {\n  opacity: 0 !important;\n  transition: none !important;\n}\n.os9-menu [role^=\"menuitem\"] { transition: color 0s linear 60ms; }\n.os9-menu[data-glide-off] [role^=\"menuitem\"] { transition: none; }\n@keyframes os9-menu-blink {\n  0%, 49.9% { background-color: transparent; color: var(--os9-black); }\n  50%, 100% { background-color: var(--os9-azul); color: var(--os9-white); }\n}\n.os9-menu [data-pending] {\n  animation: os9-menu-blink ${BLINK_CYCLE_MS}ms steps(1, end) ${BLINK_COUNT};\n}\n.os9-menu [data-pending] * { color: inherit !important; }\n`\n\nfunction RetroMenuStyles() {\n  return (\n    <style href=\"os9-menu\" precedence=\"default\">\n      {MENU_CSS}\n    </style>\n  )\n}\n\n/* ------------------------------------------------------------------ */\n/*  Root & trigger                                                     */\n/* ------------------------------------------------------------------ */\n\nfunction RetroDropdownMenu(props: React.ComponentProps<typeof MenuPrimitive>) {\n  return <MenuPrimitive {...props} />\n}\n\nfunction RetroDropdownMenuTrigger(props: React.ComponentProps<typeof MenuTriggerPrimitive>) {\n  return <MenuTriggerPrimitive {...props} />\n}\n\n/* ------------------------------------------------------------------ */\n/*  Content                                                            */\n/* ------------------------------------------------------------------ */\n\n/* OS 9 menus appear at once; modern flair adds a 100ms fade and a 2px drop.\n * Box properties carry `!` so UI SDK's popup reset can't strip them in apps\n * that haven't declared `@layer ui-sdk;` first. */\nconst retroMenuPopupClass = cn(\n  \"os9-menu relative z-50 min-w-[160px] p-[2px]! outline-none\",\n  \"bg-os9-white! border! border-os9-black! shadow-[2px_2px_0_var(--os9-black)]\",\n  \"overflow-visible! text-os9-black!\",\n  \"transition-[opacity,translate] duration-100 ease-out\",\n  \"data-starting-style:opacity-0 data-starting-style:-translate-y-[2px]\",\n  \"data-ending-style:opacity-0 data-ending-style:duration-75\",\n  \"in-data-[flair=classic]:transition-none motion-reduce:transition-none\"\n)\n\ntype RetroDropdownMenuContentProps = WithClassName<React.ComponentProps<typeof MenuContentPrimitive>>\n\nfunction RetroMenuPopup({\n  primitive: Primitive,\n  className,\n  ref,\n  children,\n  ...props\n}: RetroDropdownMenuContentProps & {\n  primitive: typeof MenuContentPrimitive | typeof MenuSubContentPrimitive\n}) {\n  const glideRef = useGlide(ref)\n  return (\n    <Primitive ref={glideRef} className={popupClass(retroMenuPopupClass, className)} {...props}>\n      <RetroMenuStyles />\n      <span\n        aria-hidden\n        data-glide-layer\n        className=\"pointer-events-none absolute top-0 left-0 bg-os9-azul opacity-0\"\n      />\n      {children}\n    </Primitive>\n  )\n}\n\nfunction RetroDropdownMenuContent({\n  align = \"start\",\n  side = \"bottom\",\n  sideOffset = 4,\n  ...props\n}: RetroDropdownMenuContentProps) {\n  return (\n    <RetroMenuPopup\n      primitive={MenuContentPrimitive}\n      align={align}\n      side={side}\n      sideOffset={sideOffset}\n      {...props}\n    />\n  )\n}\n\n/* ------------------------------------------------------------------ */\n/*  Items                                                              */\n/* ------------------------------------------------------------------ */\n\nconst retroMenuRowClass = cn(\n  \"group relative z-[1] flex items-center cursor-default select-none outline-none\",\n  \"h-[18px] px-[16px]\",\n  \"font-[family-name:var(--os9-font-heading)] text-[12px] tracking-[0.42px] leading-[0.98]\",\n  \"text-os9-black\",\n  \"data-highlighted:bg-os9-azul data-highlighted:text-os9-white\",\n  \"data-disabled:text-os9-gray-600 data-disabled:data-highlighted:bg-transparent data-disabled:data-highlighted:text-os9-gray-600\"\n)\n\ntype RetroDropdownMenuItemProps = WithClassName<React.ComponentProps<typeof MenuItemPrimitive>> & {\n  /** Skip the selection blink for this item. */\n  noBlink?: boolean\n}\n\nfunction RetroDropdownMenuItem({ className, onSelect, noBlink, ...props }: RetroDropdownMenuItemProps) {\n  return (\n    <MenuItemPrimitive\n      className={cn(retroMenuRowClass, className)}\n      /* blink, then run the command; the menu closes once this resolves */\n      onSelect={noBlink ? onSelect : (event) => blinkThen(() => onSelect?.(event))}\n      {...props}\n    />\n  )\n}\n\nconst indicatorSlot = \"absolute left-[6px] flex size-[10px] items-center justify-center\"\n\nfunction RetroDropdownMenuCheckboxItem({\n  className,\n  children,\n  value,\n  ...props\n}: WithClassName<Omit<React.ComponentProps<typeof MenuCheckboxItemPrimitive>, \"value\">> & {\n  /** Identifies the item in the menu's onCheckedChange. Defaults to a generated id. */\n  value?: string\n}) {\n  const id = React.useId()\n  return (\n    <MenuCheckboxItemPrimitive\n      value={value ?? id}\n      className={cn(retroMenuRowClass, \"pl-[24px]\", className)}\n      {...props}\n    >\n      <span className={indicatorSlot}>\n        <MenuItemIndicatorPrimitive>\n          <svg width=\"10\" height=\"10\" viewBox=\"0 0 16 16\" fill=\"none\" aria-hidden>\n            <path\n              d=\"M3 8.5L6.5 12L13 4\"\n              stroke=\"currentColor\"\n              strokeWidth=\"2.5\"\n              strokeLinecap=\"square\"\n              strokeLinejoin=\"miter\"\n            />\n          </svg>\n        </MenuItemIndicatorPrimitive>\n      </span>\n      {children}\n    </MenuCheckboxItemPrimitive>\n  )\n}\n\n/* a GroupLabel must live inside a Group; outside one, fall back to a plain\n * label so a label at the top of a menu still works */\nconst InGroupContext = React.createContext(false)\n\nfunction RetroDropdownMenuGroup({\n  children,\n  ...props\n}: WithClassName<React.ComponentProps<typeof MenuGroupPrimitive>>) {\n  return (\n    <MenuGroupPrimitive {...props}>\n      <InGroupContext.Provider value>{children}</InGroupContext.Provider>\n    </MenuGroupPrimitive>\n  )\n}\n\nfunction RetroDropdownMenuRadioGroup({\n  children,\n  ...props\n}: WithClassName<React.ComponentProps<typeof MenuRadioGroupPrimitive>>) {\n  return (\n    <MenuRadioGroupPrimitive {...props}>\n      <InGroupContext.Provider value>{children}</InGroupContext.Provider>\n    </MenuRadioGroupPrimitive>\n  )\n}\n\nfunction RetroDropdownMenuRadioItem({\n  className,\n  children,\n  ...props\n}: WithClassName<React.ComponentProps<typeof MenuRadioItemPrimitive>>) {\n  return (\n    <MenuRadioItemPrimitive className={cn(retroMenuRowClass, \"pl-[24px]\", className)} {...props}>\n      <span className={indicatorSlot}>\n        <MenuItemIndicatorPrimitive>\n          <svg width=\"8\" height=\"8\" viewBox=\"0 0 8 8\" fill=\"none\" aria-hidden>\n            <circle cx=\"4\" cy=\"4\" r=\"3\" fill=\"currentColor\" />\n          </svg>\n        </MenuItemIndicatorPrimitive>\n      </span>\n      {children}\n    </MenuRadioItemPrimitive>\n  )\n}\n\nconst labelClass =\n  \"px-[16px] py-[2px] font-[family-name:var(--os9-font-heading)] text-[10px] tracking-[0.42px] leading-[0.98] text-os9-gray-700\"\n\nfunction RetroDropdownMenuLabel({\n  className,\n  ...props\n}: WithClassName<React.ComponentProps<typeof MenuGroupLabelPrimitive>>) {\n  const inGroup = React.useContext(InGroupContext)\n  if (inGroup) return <MenuGroupLabelPrimitive className={cn(labelClass, className)} {...props} />\n  return <div className={cn(labelClass, className)} {...(props as React.ComponentProps<\"div\">)} />\n}\n\nfunction RetroDropdownMenuSeparator({\n  className,\n  ...props\n}: WithClassName<React.ComponentProps<typeof MenuSeparatorPrimitive>>) {\n  return (\n    <MenuSeparatorPrimitive\n      className={cn(\n        \"h-[2px] mx-[4px] my-[2px] border-t border-os9-gray-700 border-b border-b-os9-white\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction RetroDropdownMenuShortcut({ className, ...props }: React.ComponentProps<\"span\">) {\n  return (\n    <span\n      className={cn(\n        \"ml-auto pl-[16px] font-[family-name:var(--os9-font-heading)] text-[12px] tracking-[0.42px]\",\n        \"text-os9-gray-700 group-data-highlighted:text-os9-white\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\n/* ------------------------------------------------------------------ */\n/*  Submenus                                                           */\n/* ------------------------------------------------------------------ */\n\nfunction RetroDropdownMenuSub(props: React.ComponentProps<typeof MenuSubPrimitive>) {\n  return <MenuSubPrimitive {...props} />\n}\n\nfunction RetroDropdownMenuSubTrigger({\n  className,\n  children,\n  ...props\n}: WithClassName<React.ComponentProps<typeof MenuSubTriggerPrimitive>>) {\n  return (\n    <MenuSubTriggerPrimitive\n      className={cn(\n        retroMenuRowClass,\n        \"data-popup-open:bg-os9-azul data-popup-open:text-os9-white\",\n        className\n      )}\n      {...props}\n    >\n      {children}\n      <svg width=\"6\" height=\"8\" viewBox=\"0 0 6 8\" fill=\"none\" className=\"ml-auto\" aria-hidden>\n        <path d=\"M0 0L6 4L0 8V0Z\" fill=\"currentColor\" />\n      </svg>\n    </MenuSubTriggerPrimitive>\n  )\n}\n\nfunction RetroDropdownMenuSubContent({\n  align = \"start\",\n  side = \"right\",\n  sideOffset = 0,\n  ...props\n}: RetroDropdownMenuContentProps) {\n  return (\n    <RetroMenuPopup\n      primitive={MenuSubContentPrimitive}\n      align={align}\n      side={side}\n      sideOffset={sideOffset}\n      {...props}\n    />\n  )\n}\n\nexport {\n  RetroDropdownMenu,\n  RetroDropdownMenuTrigger,\n  RetroDropdownMenuContent,\n  RetroDropdownMenuItem,\n  RetroDropdownMenuSeparator,\n  RetroDropdownMenuSub,\n  RetroDropdownMenuSubTrigger,\n  RetroDropdownMenuSubContent,\n  RetroDropdownMenuCheckboxItem,\n  RetroDropdownMenuGroup,\n  RetroDropdownMenuRadioGroup,\n  RetroDropdownMenuRadioItem,\n  RetroDropdownMenuLabel,\n  RetroDropdownMenuShortcut,\n  RetroMenuPopup,\n  RetroMenuStyles,\n  retroMenuPopupClass,\n  retroMenuRowClass,\n}\nexport type { RetroDropdownMenuContentProps, RetroDropdownMenuItemProps }\n",
      "type": "registry:ui"
    }
  ],
  "type": "registry:ui"
}