import { jsx as _jsx } from "react/jsx-runtime";
import { createContext, useContext } from 'react';
import { Radio } from '../../../lib/ui/RadioField/Radio.js';
const radioFieldContext = createContext(null);
export function RadioField({ value, onChange, name, options, }) {
    const { Provider } = radioFieldContext;
    return (_jsx(Provider, { value: {
            value,
            onChange,
            name,
        }, children: _jsx("div", { className: 'seam-radio-field', children: options.map(({ value, label }, index) => (_jsx(Radio, { value: value, label: label }, index))) }) }));
}
export function useRadioField() {
    const context = useContext(radioFieldContext);
    if (context === null) {
        throw new Error('useRadioField must be used within a <RadioField/>');
    }
    return context;
}
//# sourceMappingURL=RadioField.js.map