{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "retro-model-picker",
  "title": "RetroModelPicker",
  "description": "A Mac OS 9 pop-up menu for choosing an AI model, with an icon and a short description per model.",
  "registryDependencies": [
    "https://nostalgia-ui.com/r/nostalgia-theme.json",
    "https://nostalgia-ui.com/r/retro-select.json"
  ],
  "files": [
    {
      "path": "registry/new-york/ui/retro-model-picker.tsx",
      "content": "\"use client\"\n\n/*\n * RetroModelPicker: a compact pop-up menu for choosing an AI model, sized\n * for a composer toolbar. The trigger shows the model's icon and name; the\n * menu lists each model with a 16px icon, its name and a one-line\n * description. Built on RetroSelect, so arrows, Home/End, typeahead (on the\n * name only), Return and disabled models all behave like a pop-up menu.\n *\n * Crafted moment: the gliding azul highlight, inherited from RetroSelect.\n * One highlight slides between the two-line rows, and both the name and the\n * description flip to white as it arrives. Classic flair snaps row to row.\n */\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\nimport {\n  RetroSelect,\n  RetroSelectContent,\n  RetroSelectItem,\n  RetroSelectItemIcon,\n  RetroSelectTrigger,\n  RetroSelectValue,\n} from \"@/registry/new-york/ui/retro-select\"\n\ntype RetroModel = {\n  id: string\n  name: string\n  /** One line under the name, e.g. \"Fast answers for everyday tasks\". */\n  description?: string\n  /** A 16px icon. */\n  icon?: React.ReactNode\n  disabled?: boolean\n}\n\ntype RetroModelPickerProps = {\n  models: RetroModel[]\n  value?: string\n  defaultValue?: string\n  onValueChange?: (id: string) => void\n  disabled?: boolean\n  /** Shown when nothing is selected. */\n  placeholder?: string\n  /** Which way the menu opens. `\"top\"` suits a composer at the bottom of a chat. */\n  side?: \"top\" | \"bottom\"\n  align?: \"start\" | \"center\" | \"end\"\n  /** Classes for the trigger. */\n  className?: string\n  /** Classes for the menu. */\n  contentClassName?: string\n  /** Names the trigger for screen readers (\"Model: Fast\"). */\n  \"aria-label\"?: string\n}\n\n/* the description's ink flips with the row's, on the same 60ms delay */\nconst ROW_CSS = `\n.os9-model-row .os9-model-desc { transition: color 0s linear 60ms; }\n.os9-select[data-glide-off] .os9-model-row .os9-model-desc { transition: none; }\n`\n\nfunction RetroModelPicker({\n  models,\n  value,\n  defaultValue,\n  onValueChange,\n  disabled,\n  placeholder = \"Choose a Model\",\n  side = \"top\",\n  align = \"start\",\n  className,\n  contentClassName,\n  \"aria-label\": ariaLabel = \"Model\",\n}: RetroModelPickerProps) {\n  /* items on the root give the trigger its label before the menu has opened */\n  const items = React.useMemo(\n    () => models.map((m) => ({ value: m.id, label: m.name, disabled: m.disabled })),\n    [models]\n  )\n  const [inner, setInner] = React.useState(defaultValue ?? \"\")\n  const current = models.find((m) => m.id === (value ?? inner))\n\n  return (\n    <RetroSelect\n      items={items}\n      value={value}\n      defaultValue={defaultValue}\n      onValueChange={(next) => {\n        setInner(next)\n        onValueChange?.(next)\n      }}\n      disabled={disabled}\n    >\n      <RetroSelectTrigger\n        aria-label={`${ariaLabel}: ${current?.name ?? placeholder}`}\n        className={cn(\"w-auto max-w-[220px] min-w-[120px] shrink\", className)}\n      >\n        <span className=\"inline-flex min-w-0 items-center\">\n          <RetroSelectValue placeholder={placeholder} className=\"truncate\" />\n        </span>\n      </RetroSelectTrigger>\n      <RetroSelectContent\n        side={side}\n        align={align}\n        className={cn(\"w-[260px]! max-w-[calc(100vw-16px)]!\", contentClassName)}\n      >\n        <style href=\"os9-model-picker\" precedence=\"default\">\n          {ROW_CSS}\n        </style>\n        {models.map((model) => (\n          <RetroSelectItem\n            key={model.id}\n            value={model.id}\n            label={model.name}\n            disabled={model.disabled}\n            className=\"os9-model-row group h-auto min-h-[18px] items-start py-[4px] pr-[10px] whitespace-normal\"\n          >\n            {model.icon && (\n              <RetroSelectItemIcon className=\"mt-px mr-[8px] size-[16px] [&>svg]:size-[16px]\">\n                {model.icon}\n              </RetroSelectItemIcon>\n            )}\n            <span className=\"flex min-w-0 flex-col gap-[3px]\">\n              <span className=\"truncate leading-[16px]\">{model.name}</span>\n              {model.description && (\n                <span\n                  className={cn(\n                    \"os9-model-desc\",\n                    \"font-[family-name:var(--os9-font-sans)] text-[10px] leading-[13px] tracking-normal\",\n                    \"text-os9-gray-700 group-data-highlighted:text-os9-white\",\n                    \"group-data-disabled:text-os9-gray-600\"\n                  )}\n                >\n                  {model.description}\n                </span>\n              )}\n            </span>\n          </RetroSelectItem>\n        ))}\n      </RetroSelectContent>\n    </RetroSelect>\n  )\n}\n\nexport { RetroModelPicker }\nexport type { RetroModelPickerProps, RetroModel }\n",
      "type": "registry:ui"
    }
  ],
  "type": "registry:ui"
}