{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "select", "title": "Select", "description": "Animated select menu with collision-aware positioning, typeahead, proximity hover, spring-animated popover, and animated checkmark. Base UI flavor.", "dependencies": [ "@base-ui/react", "framer-motion", "class-variance-authority" ], "registryDependencies": [ "https://zeron-ui.vercel.app/r/surfaces.json", "utils", "https://zeron-ui.vercel.app/r/springs.json", "https://zeron-ui.vercel.app/r/shape-context.json", "https://zeron-ui.vercel.app/r/surface-context.json", "https://zeron-ui.vercel.app/r/surface-classes.json", "https://zeron-ui.vercel.app/r/icon-context.json", "https://zeron-ui.vercel.app/r/use-proximity-hover.json", "https://zeron-ui.vercel.app/r/elevated.json", "https://zeron-ui.vercel.app/r/portal-container-context.json" ], "files": [ { "path": "src/components/ui/select.tsx", "content": "\"use client\";\n\nimport {\n Children,\n forwardRef,\n isValidElement,\n useRef,\n useEffect,\n useState,\n useCallback,\n useMemo,\n createContext,\n useContext,\n type ReactNode,\n type HTMLAttributes,\n type ComponentProps,\n} from \"react\";\nimport { motion, AnimatePresence } from \"framer-motion\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { Select as SelectPrimitive } from \"@base-ui/react/select\";\nimport type { IconComponent } from \"@/lib/icon-context\";\nimport { cn } from \"@/lib/utils\";\nimport { spring, exitFallbackMs } from \"@/lib/springs\";\nimport { useProximityHover } from \"@/hooks/use-proximity-hover\";\nimport { useShape } from \"@/lib/shape-context\";\nimport { Elevated } from \"@/lib/elevated\";\nimport { usePortalContainer } from \"@/lib/portal-container-context\";\n\n// ---------------------------------------------------------------------------\n// Select context\n//\n// Built on Base UI's Select primitive, which owns positioning (collision\n// flipping, anchor tracking), dismissal (outside press, focus-out, Escape\n// nesting inside dialogs), list keyboard navigation + typeahead, combobox\n// ARIA, and the hidden form input. This layer keeps the\n// proximity-hover overlays, the spring open/close animation (via actionsRef\n// deferred unmount), and the animated checkmark.\n// ---------------------------------------------------------------------------\n\n// How long a selection holds the popup open before closing, so the\n// acknowledgment — the checkmark drawing in and the selected background\n// springing to the picked row — is visible instead of being cut off by the\n// ~60ms close fade. Escape and outside presses still close immediately.\nconst selectionAckMs = 300;\n\ninterface SelectContextValue {\n value: string;\n open: boolean;\n actionsRef: React.RefObject<{ unmount: () => void } | null>;\n}\n\nconst SelectContext = createContext(null);\n\nfunction useSelectContext() {\n const ctx = useContext(SelectContext);\n if (!ctx) throw new Error(\"Select compound components must be inside