"use client"; import { useId, useState, type CSSProperties } from "react"; import { motion, useReducedMotion } from "motion/react"; export type RadioSphereOption = { value: string; label: string; /** Small text under the label. */ hint?: string; disabled?: boolean; }; type RadioSphereProps = { options: RadioSphereOption[]; /** Group name shown above the choices. */ label: string; /** Picked value (controlled). */ value?: string; /** Picked value at start (uncontrolled). */ defaultValue?: string; /** Called with the new value. */ onChange?: (value: string) => void; /** Form field name. */ name?: string; /** Sphere and ring colour. */ accent?: string; /** Wrapper look (width etc.). */ className?: string; }; /* RadioSphere: a real radio group where one glossy sphere rolls from the old pick into the new one. Arrow keys work like any native radio group. */ export function RadioSphere({ options, label, value, defaultValue, onChange, name, accent = "#a78bfa", className = "w-full max-w-xs", }: RadioSphereProps) { const reduce = useReducedMotion(); const uid = useId(); const [inner, setInner] = useState(defaultValue); const selected = value ?? inner; return (
); }