'use strict';

var jsxRuntime = require('react/jsx-runtime');
var React = require('react');
var formik = require('formik');
var ramda = require('ramda');
var TreeSelect = require('../TreeSelect-Cmm5yYq3.js');
require('../utils-BhM0B89p.js');
require('../primitives/Popover.js');
require('../index-COPkC3I5.js');
require('../index-D-iDn9RI.js');
require('../index-CGUGhyIp.js');
require('../index-Bvu9MiFi.js');
require('../index-DMbj7vXd.js');
require('react-dom');
require('../index-lWVw05cs.js');
require('../index-CS_WSHYi.js');
require('../index-BwAq9ba8.js');
require('../index-CCdG4z4E.js');
require('../index-C9ICrOhM.js');
require('../floating-ui.react-dom-B4Aw6O7R.js');
require('../index-Bf0WsHta.js');
require('../index-Df-Ffa3s.js');
require('../index-DcCSSgb7.js');
require('../index-CyrAgb4H.js');
require('../SelectFieldWrapper-DKkizQNM.js');
require('../primitives/Field.js');
require('../index-vioSzJOw.js');
require('../label-DJ7KkKYy.js');
require('../separator-DSL-aG1J.js');
require('../Tree-DAyVPLnJ.js');
require('../chevron-down-CPsWSS51.js');
require('../createLucideIcon-D0tRgV6l.js');
require('../chevron-right-0jNdwX2Q.js');
require('../primitives/Checkbox.js');
require('../check-BQgcDXys.js');
require('../index-CF951Pw9.js');
require('../loader-circle-Bw7zP2Gn.js');
require('../index-DnKJmaCq.js');
require('../index-BrpkRQoS.js');
require('../redux-DEF7lAd1.js');
require('../x-Brw3FJst.js');

const FormikTreeSelect = React.forwardRef(
  ({ name, onChange: onChangeProp, ...otherProps }, ref) => {
    const [field, meta, { setValue }] = formik.useField(name);
    const { status = {}, setStatus } = formik.useFormikContext();
    const fieldStatus = formik.getIn(status, name);
    return /* @__PURE__ */ jsxRuntime.jsx(
      TreeSelect.TreeSelect,
      {
        ref,
        error: meta.error || fieldStatus || "",
        value: field.value,
        onChange: (value) => {
          setStatus(ramda.dissoc(name, status));
          setValue(value);
          onChangeProp?.(value);
        },
        ...otherProps
      }
    );
  }
);
FormikTreeSelect.displayName = "FormikTreeSelect";

exports.FormikTreeSelect = FormikTreeSelect;
//# sourceMappingURL=TreeSelect.js.map
