'use strict';

var jsxRuntime = require('react/jsx-runtime');
var formik = require('formik');
var ramda = require('ramda');
var Switch = require('../Switch-CFf8DtB_.js');
require('react');
require('../primitives/Switch.js');
require('../utils-CTr7wn5d.js');
require('../index-COPkC3I5.js');
require('../index-D-iDn9RI.js');
require('../index-CGUGhyIp.js');
require('../index-CyrAgb4H.js');
require('../index-CCdG4z4E.js');
require('../index-CF951Pw9.js');
require('../index-Bf0WsHta.js');
require('../index-DMbj7vXd.js');
require('react-dom');
require('../primitives/Label.js');
require('../label-Bdc9ytTI.js');

const FormikSwitch = ({ name, onCheckedChange: onCheckedChangeProp, onChange: onChangeProp, ...rest }) => (jsxRuntime.jsx(formik.Field, { name: name, children: ({ field, meta: { error }, form }) => {
        const { status = {}, setStatus } = form;
        const fieldStatus = formik.getIn(status, name);
        return (jsxRuntime.jsx(Switch.Switch, { checked: !!field.value, error: error || fieldStatus, name: field.name, onBlur: field.onBlur, onCheckedChange: (checked) => {
                setStatus(ramda.dissoc(name, status));
                form.setFieldValue(name, checked);
                onCheckedChangeProp?.(checked);
                onChangeProp?.();
            }, ...rest }));
    } }));
FormikSwitch.displayName = "FormikSwitch";

exports.FormikSwitch = FormikSwitch;
//# sourceMappingURL=Switch.js.map
