'use strict';

var jsxRuntime = require('react/jsx-runtime');
var React = require('react');
var formik = require('formik');
var ramda = require('ramda');
var Checkbox = require('../Checkbox-CxqWOvFN.js');
require('../utils-BhM0B89p.js');
require('../primitives/Checkbox.js');
require('../check-BQgcDXys.js');
require('../createLucideIcon-D0tRgV6l.js');
require('../index-D-iDn9RI.js');
require('../index-CGUGhyIp.js');
require('../index-COPkC3I5.js');
require('../index-CyrAgb4H.js');
require('../index-CCdG4z4E.js');
require('../index-CF951Pw9.js');
require('../index-Bf0WsHta.js');
require('../index-DcCSSgb7.js');
require('../index-DMbj7vXd.js');
require('react-dom');
require('../primitives/Field.js');
require('../index-vioSzJOw.js');
require('../label-DJ7KkKYy.js');
require('../separator-DSL-aG1J.js');

const FormikCheckbox = React.forwardRef(
  ({
    name,
    onCheckedChange: onCheckedChangeProp,
    onChange: onChangeProp,
    ...rest
  }, ref) => /* @__PURE__ */ jsxRuntime.jsx(formik.Field, { name, children: ({ field, meta, form }) => {
    const { status = {}, setStatus } = form;
    const fieldStatus = formik.getIn(status, name);
    return /* @__PURE__ */ jsxRuntime.jsx(
      Checkbox.Checkbox,
      {
        ref,
        checked: !!field.value,
        error: meta.touched ? meta.error || fieldStatus : "",
        name: field.name,
        onBlur: field.onBlur,
        onCheckedChange: (checked) => {
          setStatus(ramda.dissoc(name, status));
          form.setFieldValue(name, checked);
          onCheckedChangeProp?.(checked);
          onChangeProp?.();
        },
        ...rest
      }
    );
  } })
);
FormikCheckbox.displayName = "FormikCheckbox";

exports.FormikCheckbox = FormikCheckbox;
//# sourceMappingURL=Checkbox.js.map
