"use client"; import type { ReactNode } from "react"; import { SegmentedControl, SegmentedControlItem } from "@/components/base/segmented-control/segmented-control"; import { cx } from "@/utils/cx"; export interface RadioOption { value: T; label: ReactNode; /** Extra classes on the selected segment (e.g. a status tint). */ activeClass?: string; } interface RadioGroupProps { name: string; options: readonly RadioOption[]; value: T; onChange: (value: T) => void; size?: "xs" | "sm"; fullWidth?: boolean; } /** Single-select segmented control: BoardUI's SegmentedControl (React Aria handles roving focus + arrow keys). */ export function RadioGroup({ name, options, value, onChange, size = "sm", fullWidth = false }: RadioGroupProps) { return ( { const next = options.find((o) => keys.has(o.value)); if (next) onChange(next.value); }} className={cx("max-w-full", fullWidth ? "flex w-full" : "shrink-0")} > {options.map((option) => ( {option.label} ))} ); }