'use client'; import * as React from 'react'; import type { ZestChangeEventDetails } from '../utils/createChangeEventDetails'; import type { ZestEventReasons } from '../utils/reasons'; export interface RadioGroupContext { checkedValue: Value | undefined; setCheckedValue: ( value: Value, eventDetails: ZestChangeEventDetails, ) => void; disabled: boolean; readOnly: boolean; required: boolean; } export const RadioGroupContext = React.createContext | undefined>(undefined); /** * Unlike the web, a standalone radio has no hidden `` to fall back on, so * it cannot hold state of its own. `Radio.Root` therefore requires a group. */ export function useRadioGroupContext() { const context = React.useContext | undefined>(RadioGroupContext); if (context === undefined) { throw new Error( 'Zest: RadioGroupContext is missing. Radio parts must be placed within .', ); } return context; }