{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "retro-select",
  "title": "RetroSelect",
  "description": "A Mac OS 9 styled select dropdown with raised bevel trigger, up/down chevron arrows, and azul-highlighted menu items, built on UI SDK Select.",
  "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-select.tsx",
      "content": "\"use client\"\n\n/*\n * RetroSelect: a Mac OS 9 pop-up menu on UI SDK.\n *\n * Crafted moment: the gliding azul highlight (modern flair). One highlight\n * layer slides between options, so pointer and keyboard moves read as one\n * motion, and the option's ink flips to white as it arrives, exactly like\n * the menus. Classic flair (and reduced motion) snaps row to row.\n */\n\nimport * as React from \"react\"\nimport {\n  Select as SelectPrimitive,\n  SelectContent as SelectContentPrimitive,\n  SelectGroup as SelectGroupPrimitive,\n  SelectGroupLabel as SelectGroupLabelPrimitive,\n  SelectItem as SelectItemPrimitive,\n  SelectItemIcon as SelectItemIconPrimitive,\n  SelectItemIndicator as SelectItemIndicatorPrimitive,\n  SelectSeparator as SelectSeparatorPrimitive,\n  SelectTrigger as SelectTriggerPrimitive,\n  SelectValue as SelectValuePrimitive,\n  SelectValueIcon as SelectValueIconPrimitive,\n  type SelectProps as SelectPrimitiveProps,\n} from \"@ui-sdk/react/select\"\n\nimport { cn } from \"@/lib/utils\"\nimport { 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/*  Glide CSS                                                          */\n/* ------------------------------------------------------------------ */\n\n/* Unlayered, so it beats the option utilities without !important.\n * React hoists it and dedupes it by href. */\nconst SELECT_CSS = `\n.os9-select:not([data-glide-off]) [role=\"option\"][data-highlighted] {\n  background-color: transparent;\n}\n.os9-select[data-glide-off] > [data-glide-layer] {\n  opacity: 0 !important;\n  transition: none !important;\n}\n.os9-select [role=\"option\"] { transition: color 0s linear 60ms; }\n.os9-select[data-glide-off] [role=\"option\"] { transition: none; }\n`\n\n/* ------------------------------------------------------------------ */\n/*  Root                                                               */\n/* ------------------------------------------------------------------ */\n\ntype RetroSelectProps = Omit<\n  SelectPrimitiveProps<string, false>,\n  \"value\" | \"defaultValue\" | \"onValueChange\" | \"multiple\"\n> & {\n  /** The selected value. `\"\"` selects nothing. */\n  value?: string\n  defaultValue?: string\n  onValueChange?: (value: string) => void\n}\n\n/* Keeps the string API: \"\" (or nothing) means no selection. */\nfunction RetroSelect({ value, defaultValue, onValueChange, ...props }: RetroSelectProps) {\n  return (\n    <SelectPrimitive<string, false>\n      {...(value !== undefined\n        ? { value: value === \"\" ? null : value }\n        : { defaultValue: defaultValue === \"\" || defaultValue === undefined ? null : defaultValue })}\n      onValueChange={(next) => onValueChange?.(next ?? \"\")}\n      {...props}\n    />\n  )\n}\n\n/* ------------------------------------------------------------------ */\n/*  Trigger & value                                                    */\n/* ------------------------------------------------------------------ */\n\nfunction RetroSelectTrigger({\n  className,\n  children,\n  ...props\n}: WithClassName<React.ComponentProps<typeof SelectTriggerPrimitive>>) {\n  return (\n    <SelectTriggerPrimitive\n      className={cn(\n        \"inline-flex items-center justify-between\",\n        \"h-[20px] w-full\",\n        \"font-[family-name:var(--os9-font-heading)] text-[12px] tracking-[0.42px] leading-[0.98]\",\n        \"text-os9-black\",\n        \"border border-os9-black bg-os9-gray-300\",\n        \"shadow-[inset_1px_1px_0_var(--os9-white),inset_-1px_-1px_0_var(--os9-gray-700)]\",\n        \"cursor-pointer select-none\",\n        \"focus-visible:os9-focus-ring\",\n        \"disabled:pointer-events-none disabled:opacity-50\",\n        \"data-open:bg-os9-gray-800 data-open:text-os9-white\",\n        \"data-open:shadow-[inset_1px_1px_0_var(--os9-gray-700),inset_-1px_-1px_0_var(--os9-white)]\",\n        className\n      )}\n      {...props}\n    >\n      <span className=\"truncate px-2\">{children}</span>\n      <span\n        className={cn(\n          \"flex h-full items-center justify-center\",\n          \"w-[20px] shrink-0\",\n          \"border-l border-os9-black\"\n        )}\n      >\n        <span className=\"flex flex-col items-center gap-[1px]\">\n          <svg width=\"8\" height=\"4\" viewBox=\"0 0 8 4\" fill=\"none\" aria-hidden>\n            <path d=\"M4 0L8 4H0L4 0Z\" fill=\"currentColor\" />\n          </svg>\n          <svg width=\"8\" height=\"4\" viewBox=\"0 0 8 4\" fill=\"none\" aria-hidden>\n            <path d=\"M4 4L0 0H8L4 4Z\" fill=\"currentColor\" />\n          </svg>\n        </span>\n      </span>\n    </SelectTriggerPrimitive>\n  )\n}\n\n/* The selected option's label, led by its RetroSelectItemIcon when it has one. */\nfunction RetroSelectValue({\n  className,\n  ...props\n}: WithClassName<React.ComponentProps<typeof SelectValuePrimitive>>) {\n  return (\n    <>\n      <SelectValueIconPrimitive className=\"mr-[6px] inline-flex align-middle\" />\n      <SelectValuePrimitive className={className} {...props} />\n    </>\n  )\n}\n\n/* ------------------------------------------------------------------ */\n/*  Content                                                            */\n/* ------------------------------------------------------------------ */\n\ntype RetroSelectContentProps = WithClassName<React.ComponentProps<typeof SelectContentPrimitive>> & {\n  /** `\"item-aligned\"` places the selected option over the trigger, like a classic pop-up menu. */\n  position?: \"popper\" | \"item-aligned\"\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. */\nfunction RetroSelectContent({\n  className,\n  children,\n  position = \"popper\",\n  side = \"bottom\",\n  align = \"start\",\n  sideOffset = 1,\n  ref,\n  ...props\n}: RetroSelectContentProps) {\n  const glideRef = useGlide(ref)\n  return (\n    <SelectContentPrimitive\n      ref={glideRef}\n      side={side}\n      align={align}\n      sideOffset={sideOffset}\n      alignItemWithTrigger={position === \"item-aligned\"}\n      className={popupClass(\n        cn(\n          \"os9-select relative z-50 flex flex-col gap-px outline-none\",\n          \"min-w-(--anchor-width)! max-h-[min(var(--available-height),320px)]!\",\n          \"m-0! p-[2px]! border! border-os9-black! bg-os9-gray-300! text-os9-black!\",\n          \"overflow-x-hidden! overflow-y-auto! shadow-[2px_2px_0_var(--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        className\n      )}\n      {...props}\n    >\n      <style href=\"os9-select\" precedence=\"default\">\n        {SELECT_CSS}\n      </style>\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    </SelectContentPrimitive>\n  )\n}\n\n/* ------------------------------------------------------------------ */\n/*  Items                                                              */\n/* ------------------------------------------------------------------ */\n\nfunction RetroSelectItem({\n  className,\n  children,\n  ...props\n}: WithClassName<React.ComponentProps<typeof SelectItemPrimitive<string>>>) {\n  return (\n    <SelectItemPrimitive\n      className={cn(\n        \"relative z-[1] flex shrink-0 items-center\",\n        \"h-[18px] w-full px-[14px]\",\n        \"font-[family-name:var(--os9-font-heading)] text-[12px] tracking-[0.42px] leading-[0.98]\",\n        \"text-os9-black whitespace-nowrap\",\n        \"cursor-pointer select-none outline-none\",\n        \"data-highlighted:bg-os9-azul data-highlighted:text-os9-white\",\n        \"data-disabled:pointer-events-none data-disabled:text-os9-gray-700\",\n        className\n      )}\n      {...props}\n    >\n      <span className=\"absolute left-[2px] flex h-[8px] w-[8px] items-center justify-center\">\n        <SelectItemIndicatorPrimitive>\n          <svg width=\"8\" height=\"8\" 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        </SelectItemIndicatorPrimitive>\n      </span>\n      {children}\n    </SelectItemPrimitive>\n  )\n}\n\n/* An icon or swatch before an option's label; the trigger shows it too. */\nfunction RetroSelectItemIcon({\n  className,\n  ...props\n}: WithClassName<React.ComponentProps<typeof SelectItemIconPrimitive>>) {\n  return (\n    <SelectItemIconPrimitive\n      className={cn(\"mr-[6px] inline-flex shrink-0 items-center\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction RetroSelectGroup({\n  className,\n  ...props\n}: WithClassName<React.ComponentProps<typeof SelectGroupPrimitive>>) {\n  return <SelectGroupPrimitive className={cn(\"flex flex-col gap-px\", className)} {...props} />\n}\n\nfunction RetroSelectLabel({\n  className,\n  ...props\n}: WithClassName<React.ComponentProps<typeof SelectGroupLabelPrimitive>>) {\n  return (\n    <SelectGroupLabelPrimitive\n      className={cn(\n        \"px-[14px] py-[2px]\",\n        \"font-[family-name:var(--os9-font-heading)] text-[10px] tracking-[0.42px] leading-[0.98]\",\n        \"text-os9-gray-700\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction RetroSelectSeparator({\n  className,\n  ...props\n}: WithClassName<React.ComponentProps<typeof SelectSeparatorPrimitive>>) {\n  return (\n    <SelectSeparatorPrimitive\n      className={cn(\"h-[2px] shrink-0 bg-os9-gray-600\", className)}\n      {...props}\n    />\n  )\n}\n\nexport {\n  RetroSelect,\n  RetroSelectGroup,\n  RetroSelectValue,\n  RetroSelectTrigger,\n  RetroSelectContent,\n  RetroSelectItem,\n  RetroSelectItemIcon,\n  RetroSelectSeparator,\n  RetroSelectLabel,\n}\nexport type { RetroSelectProps, RetroSelectContentProps }\n",
      "type": "registry:ui"
    }
  ],
  "type": "registry:ui"
}