import { jsx } from 'react/jsx-runtime';
import { forwardRef } from 'react';
import { Field, getIn } from 'formik';
import { dissoc } from 'ramda';
import { I as Input } from '../Input-xjYQfsaz.js';
import '../utils-BJnb9o5c.js';
import '../primitives/Field.js';
import '../index-Bo3AAQJp.js';
import '../label-BgLSVt4u.js';
import '../index-DhnfW8wQ.js';
import 'react-dom';
import '../index-BtkPdosV.js';
import '../separator-ByRsc-y-.js';
import '../primitives/InputGroup.js';
import '../input-group-BKkj65Uq.js';
import '../button-CrEMzWKw.js';
import '../index-CfriMyrd.js';
import '../input-1J5oQa1u.js';
import '../textarea-B0vzA497.js';

const FormikInput = forwardRef(
  ({ name, onChange: onChangeProp, ...rest }, ref) => /* @__PURE__ */ jsx(Field, { name, children: ({ field, meta, form }) => {
    const { status = {}, setStatus } = form;
    const fieldStatus = getIn(status, name);
    const fieldProps = {
      ...field,
      onChange: (e) => {
        setStatus(dissoc(name, status));
        field.onChange(e);
        onChangeProp?.(e);
      }
    };
    return /* @__PURE__ */ jsx(
      Input,
      {
        ref,
        ...fieldProps,
        error: meta.touched ? meta.error || fieldStatus : "",
        ...rest
      }
    );
  } })
);
FormikInput.displayName = "FormikInput";

export { FormikInput };
//# sourceMappingURL=Input.js.map
