'use client'; import { RadioGroup as AriaRadioGroup, RadioField, RadioButton, type RadioGroupProps as AriaRadioGroupProps, type ValidationResult, type RadioFieldProps } from 'react-aria-components/RadioGroup'; import {composeRenderProps} from 'react-aria-components/composeRenderProps'; import {Label, FieldError, Description} from './Form'; import './RadioGroup.css'; import './utilities.css'; export interface RadioGroupProps extends Omit { children?: React.ReactNode; label?: string; description?: string; errorMessage?: string | ((validation: ValidationResult) => string); } export function RadioGroup({ label, description, errorMessage, children, ...props }: RadioGroupProps) { return (
{children}
{description && {description}} {errorMessage}
); } export interface RadioProps extends RadioFieldProps { description?: string; } export function Radio(props: RadioProps) { return ( {composeRenderProps(props.children, children => ( <>
{children} ))} {props.description && {props.description}} ); }