({children, ...props}: RadioGroupProps)
| 21 | let RadioContext = React.createContext<RadioGroupState | null>(null); |
| 22 | |
| 23 | export function RadioGroup({children, ...props}: RadioGroupProps) { |
| 24 | let state = useRadioGroupState(props); |
| 25 | let {radioGroupProps, labelProps} = useRadioGroup(props, state); |
| 26 | |
| 27 | return ( |
| 28 | <div |
| 29 | {...radioGroupProps} |
| 30 | className="react-aria-RadioGroup" |
| 31 | data-orientation={props.orientation || 'vertical'} |
| 32 | data-invalid={state.isInvalid || undefined} |
| 33 | data-disabled={state.isDisabled || undefined} |
| 34 | data-readonly={state.isReadOnly || undefined}> |
| 35 | {props.label && ( |
| 36 | <span {...labelProps} className="react-aria-Label"> |
| 37 | {props.label} |
| 38 | </span> |
| 39 | )} |
| 40 | <div className="radio-items"> |
| 41 | <RadioContext.Provider value={state}>{children}</RadioContext.Provider> |
| 42 | </div> |
| 43 | </div> |
| 44 | ); |
| 45 | } |
| 46 | |
| 47 | export function Radio(props: AriaRadioProps) { |
| 48 | let state = React.useContext(RadioContext)!; |
nothing calls this directly
no test coverage detected