import { jsx } from 'react/jsx-runtime';
import { Field, getIn } from 'formik';
import { dissoc } from 'ramda';
import { S as Switch } from '../Switch-B83TGxJ_.js';
import 'react';
import '../primitives/Switch.js';
import '../utils-DdHUxIdC.js';
import '../index-DNzunGHb.js';
import '../index-BtkPdosV.js';
import '../index-CiyxEyB0.js';
import '../index-Cor698lu.js';
import '../index-DOzu5J1s.js';
import '../index-30QpKM0j.js';
import '../index-BYZaLNq1.js';
import '../index-DhnfW8wQ.js';
import 'react-dom';
import '../primitives/Label.js';
import '../label-B4qDF3W1.js';

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

export { FormikSwitch };
//# sourceMappingURL=Switch.js.map
