import clsx from "clsx"; import { RadioButton } from "./RadioButton"; import type { JSX } from "react"; export const RadioSelection = ( props: { options: { value: T; text: string; icon: JSX.Element; testId?: string; /** if not supplied, defaults to value identity check */ active?: boolean; }[]; value: T | null; type?: "radio" | "button"; } & ( | { type?: "radio"; group: string; onChange: (value: T) => void } | { type: "button"; onClick: ( value: T, event: React.MouseEvent, ) => void; } ), ) => ( <> {props.options.map((option) => props.type === "button" ? ( props.onClick(option.value, event)} /> ) : ( ), )} );