"use client"; import { Check, ChevronDown } from "lucide-react"; import { motion, type Transition, useReducedMotion, type Variants, } from "motion/react"; import { createContext, type ReactNode, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState, } from "react"; import { EASE_OUT } from "@/lib/ease"; import { cn } from "@/lib/utils"; // Spring with bounce powers the unfold/separation; per-property timings in the // content choreograph it (see SelectContent). Mirrors bouncy-accordion's feel. const CHEVRON_TRANSITION: Transition = { type: "spring", duration: 0.4, bounce: 0.3 }; const LIST_VARIANTS: Variants = { hidden: {}, show: { transition: { staggerChildren: 0.035, delayChildren: 0.05 } }, }; const ITEM_VARIANTS: Variants = { hidden: { opacity: 0, y: -6, filter: "blur(3px)" }, show: { opacity: 1, y: 0, filter: "blur(0px)" }, }; type Placement = "bottom" | "top"; interface SelectContextValue { value: string | undefined; open: boolean; setOpen: (open: boolean) => void; select: (value: string) => void; register: (value: string, label: string) => void; unregister: (value: string) => void; labelFor: (value: string | undefined) => string | undefined; reduce: boolean; triggerId: string; listId: string; disabled: boolean; placement: Placement; setPlacement: (p: Placement) => void; } const SelectContext = createContext(null); function useSelectContext(component: string) { const ctx = useContext(SelectContext); if (!ctx) throw new Error(`${component} must be used within