'use strict';

var jsxRuntime = require('react/jsx-runtime');
var formik = require('formik');
var ramda = require('ramda');
var RadioGroup = require('../RadioGroup-CkKlLHnR.js');
require('react');
require('../utils-BhM0B89p.js');
require('../primitives/RadioGroup.js');
require('../index-COPkC3I5.js');
require('../index-D-iDn9RI.js');
require('../index-CGUGhyIp.js');
require('../index-DMbj7vXd.js');
require('react-dom');
require('../index-DoVhdseB.js');
require('../index-Ch55j1or.js');
require('../index-BwAq9ba8.js');
require('../index-CCdG4z4E.js');
require('../index-lWVw05cs.js');
require('../index-CyrAgb4H.js');
require('../index-BY6wgiQV.js');
require('../index-Bf0WsHta.js');
require('../index-CF951Pw9.js');
require('../index-DcCSSgb7.js');
require('../primitives/Label.js');
require('../label-DJ7KkKYy.js');
require('../primitives/Field.js');
require('../index-vioSzJOw.js');
require('../separator-DSL-aG1J.js');

const FormikRadioGroup = ({
  name,
  onValueChange: onValueChangeProp,
  onChange: onChangeProp,
  ...props
}) => {
  const [field, meta] = formik.useField(name);
  const {
    setFieldValue,
    status = {},
    setStatus
  } = formik.useFormikContext();
  const fieldStatus = formik.getIn(status, name);
  return /* @__PURE__ */ jsxRuntime.jsx(
    RadioGroup.RadioGroup,
    {
      error: meta.touched ? meta.error || fieldStatus : "",
      name: field.name,
      value: field.value,
      onValueChange: (value) => {
        setStatus(ramda.dissoc(name, status));
        setFieldValue(name, value);
        onValueChangeProp?.(value);
        onChangeProp?.(value);
      },
      ...props
    }
  );
};
FormikRadioGroup.displayName = "FormikRadioGroup";
FormikRadioGroup.Item = RadioGroup.RadioGroup.Item;

exports.FormikRadioGroup = FormikRadioGroup;
//# sourceMappingURL=RadioGroup.js.map
