import { jsx } from 'react/jsx-runtime';
import { forwardRef } from 'react';
import { useField, useFormikContext, getIn } from 'formik';
import { dissoc } from 'ramda';
import { M as MultiEmailInput } from '../MultiEmailInput-L-QJg0hh.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 '../x-_o2T3n6D.js';
import '../createLucideIcon-C8ycilSN.js';

const FormikMultiEmailInput = forwardRef(({ name, onChange: onChangeProp, ...otherProps }, ref) => {
  const [field, meta, { setValue, setTouched }] = useField(name);
  const { status = {}, setStatus } = useFormikContext();
  const fieldStatus = getIn(status, name);
  return /* @__PURE__ */ jsx(
    MultiEmailInput,
    {
      ref,
      error: meta.touched ? meta.error || fieldStatus : "",
      value: field.value,
      onBlur: () => setTouched(true),
      onChange: (value) => {
        setStatus(dissoc(name, status));
        setValue(value);
        onChangeProp?.(value);
      },
      ...otherProps
    }
  );
});
FormikMultiEmailInput.displayName = "FormikMultiEmailInput";

export { FormikMultiEmailInput };
//# sourceMappingURL=MultiEmailInput.js.map
