{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "select",
  "type": "registry:ui",
  "title": "Select",
  "description": "A card-catalogue drawer of options.",
  "categories": [
    "core"
  ],
  "files": [
    {
      "path": "ui/select.tsx",
      "type": "registry:ui",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { Select as SelectPrimitive } from \"radix-ui\";\n\nconst type = { fontFamily: \"var(--font-type, 'Courier New', ui-monospace, monospace)\" };\n\n// Popups render in a layer on <body> that copies the paper type of the nearest [data-paper]\n// element (and follows it if it changes). That keeps their theme without trapping them inside the\n// container's stacking context, so sticky headers can't cover them.\nfunction usePaperContainer() {\n  const anchor = React.useRef<HTMLSpanElement>(null);\n  const [container, setContainer] = React.useState<HTMLElement | undefined>();\n  React.useEffect(() => {\n    const source = anchor.current?.closest<HTMLElement>(\"[data-paper]\");\n    if (!source || source === document.documentElement) return;\n    const layer = document.createElement(\"div\");\n    layer.setAttribute(\"data-paper-layer\", \"\");\n    const sync = () => layer.setAttribute(\"data-paper\", source.getAttribute(\"data-paper\") ?? \"\");\n    sync();\n    document.body.appendChild(layer);\n    const observer = new MutationObserver(sync);\n    observer.observe(source, { attributes: true, attributeFilter: [\"data-paper\"] });\n    setContainer(layer);\n    return () => {\n      observer.disconnect();\n      layer.remove();\n    };\n  }, []);\n  return [anchor, container] as const;\n}\n\n/** A card-catalogue drawer of options. */\nexport const Select = SelectPrimitive.Root;\nexport const SelectGroup = SelectPrimitive.Group;\nexport const SelectValue = SelectPrimitive.Value;\n\nexport function SelectTrigger({ className = \"\", style, children, ...props }: React.ComponentProps<typeof SelectPrimitive.Trigger>) {\n  return (\n    <SelectPrimitive.Trigger\n      className={`group flex h-10 w-full cursor-pointer items-center justify-between gap-2 border-0 border-b-[1.5px] border-(--rule) bg-transparent px-0.5 pb-1 pt-2 text-left text-[15px] text-(--ink) outline-none transition-colors focus-visible:border-(--pen) disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-(--danger) data-[placeholder]:text-(--ink-faint) data-[state=open]:border-(--pen) [&>span]:truncate ${className}`}\n      style={{ ...type, ...style }}\n      {...props}\n    >\n      {children}\n      {/* no asChild inside registry files: the shadcn CLI rewrites it to `render` in Base UI projects */}\n      <SelectPrimitive.Icon className=\"shrink-0 text-[12px] text-(--ink-muted) transition-transform group-data-[state=open]:rotate-180\">\n        ▼\n      </SelectPrimitive.Icon>\n    </SelectPrimitive.Trigger>\n  );\n}\n\nexport function SelectContent({\n  className = \"\",\n  children,\n  position = \"popper\",\n  ...props\n}: React.ComponentProps<typeof SelectPrimitive.Content>) {\n  const [anchor, container] = usePaperContainer();\n  return (\n    <>\n      <span ref={anchor} hidden />\n      <SelectPrimitive.Portal container={container}>\n        <SelectPrimitive.Content\n          position={position}\n          sideOffset={6}\n          data-paper-motion\n          className={`paper relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] overflow-y-auto rounded-[3px] border border-(--edge) bg-(--paper-raised) text-(--ink) shadow-[0_14px_30px_-12px_rgb(0_0_0/.45)] data-[state=open]:animate-[paper-pop-in_.16s_ease-out] ${\n            position === \"popper\" ? \"w-(--radix-select-trigger-width)\" : \"\"\n          } ${className}`}\n          {...props}\n        >\n          <SelectPrimitive.Viewport className=\"p-1\">{children}</SelectPrimitive.Viewport>\n        </SelectPrimitive.Content>\n      </SelectPrimitive.Portal>\n    </>\n  );\n}\n\nexport function SelectItem({ className = \"\", style, children, ...props }: React.ComponentProps<typeof SelectPrimitive.Item>) {\n  return (\n    <SelectPrimitive.Item\n      className={`relative flex w-full cursor-pointer select-none items-center border-b border-dashed border-(--edge) py-2 pl-8 pr-3 text-[14px] outline-none last:border-b-0 data-[disabled]:pointer-events-none data-[highlighted]:bg-(--paper-sunk) data-[disabled]:opacity-45 ${className}`}\n      style={{ ...type, ...style }}\n      {...props}\n    >\n      <span className=\"absolute left-2 flex size-4 items-center justify-center\">\n        <SelectPrimitive.ItemIndicator>\n          <svg viewBox=\"0 0 26 26\" className=\"size-4 overflow-visible text-(--pen)\" aria-hidden>\n            <path d=\"M5 14 C 7 15.5, 9 18, 10.5 20.5 C 13 14, 17 8, 23 2.5\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"3\" strokeLinecap=\"round\" />\n          </svg>\n        </SelectPrimitive.ItemIndicator>\n      </span>\n      <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n    </SelectPrimitive.Item>\n  );\n}\n\nexport function SelectLabel({ className = \"\", style, ...props }: React.ComponentProps<typeof SelectPrimitive.Label>) {\n  return (\n    <SelectPrimitive.Label\n      className={`px-3 pb-1 pt-2.5 text-[10px] font-bold uppercase tracking-[0.2em] text-(--ink-muted) ${className}`}\n      style={{ ...type, ...style }}\n      {...props}\n    />\n  );\n}\n\nexport function SelectSeparator({ className = \"\", ...props }: React.ComponentProps<typeof SelectPrimitive.Separator>) {\n  return <SelectPrimitive.Separator className={`-mx-1 my-1 h-px bg-(--margin) ${className}`} {...props} />;\n}\n"
    }
  ],
  "dependencies": [
    "radix-ui"
  ]
}