/** * Option cards — a radio group rendered as a grid of bordered cards instead * of a single segmented bar. Used where each choice benefits from more room * than a segment can offer: an icon, a bold label, and (in the default * variant) a one-line description, with a ring/dot marking the active card. * * Two variants: * - default: icon tile + label + description, stacked, left-aligned — * e.g. container width (Full width / Boxed / Narrow / Fluid). * - compact: icon + label only, centered — a denser row for choices that * don't need a description, e.g. card hover effect, pagination style. */ import type { LucideIcon } from '../icons'; export interface OptionCardItem { value: string; label: string; description?: string; icon?: LucideIcon; } interface OptionCardsProps { label?: string; value: string; options: OptionCardItem[]; onChange: ( value: string ) => void; help?: string; compact?: boolean; } export default function OptionCards( { label, value, options, onChange, help, compact = false, }: OptionCardsProps ) { const move = ( delta: number ) => { const index = options.findIndex( ( option ) => option.value === value ); const next = options[ ( index + delta + options.length ) % options.length ]; if ( next ) { onChange( next.value ); } }; return (
{ help }
) }