import { jsx } from 'react/jsx-runtime';
import { forwardRef } from 'react';
import { Field, getIn } from 'formik';
import { dissoc } from 'ramda';
import { T as Textarea } from '../Textarea-B2Uhx-Yy.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/Textarea.js';
import '../textarea-B0vzA497.js';

const FormikTextarea = 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(
      Textarea,
      {
        ref,
        error: meta.touched ? meta.error || fieldStatus : "",
        ...fieldProps,
        ...rest
      }
    );
  } })
);
FormikTextarea.displayName = "FormikTextarea";

export { FormikTextarea };
//# sourceMappingURL=Textarea.js.map
