import { jsx } from 'react/jsx-runtime';
import { forwardRef } from 'react';
import { useField, useFormikContext, getIn } from 'formik';
import { dissoc } from 'ramda';
import { S as Select } from '../Select-BgSz0fve.js';
import '../SelectFieldWrapper-BJzq9aCY.js';
import '../primitives/Field.js';
import '../index-D7Zy7P05.js';
import '../utils-DdHUxIdC.js';
import '../label-B4qDF3W1.js';
import '../index-DhnfW8wQ.js';
import 'react-dom';
import '../index-BtkPdosV.js';
import '../separator-BbhgePmX.js';
import '../primitives/Combobox.js';
import '../button-D6uWDFCs.js';
import '../index-CfriMyrd.js';
import '../input-group-C_qKMibX.js';
import '../input-GLCCE2kT.js';
import '../textarea-BSZwxzjQ.js';
import '../check-Cpkv29p1.js';
import '../createLucideIcon-C8ycilSN.js';
import '../x-_o2T3n6D.js';
import '../chevron-down-BNi0ntys.js';
import '../floating-ui.react-dom-D8_f_WWh.js';
import '../index-DZXbzIgC.js';
import '../index-CSMSzzKM.js';
import '../with-selector-Dv0G_V_o.js';
import '../primitives/Spinner.js';
import 'react-i18next';
import '../loader-circle-DycHUAWN.js';

const FormikSelect = forwardRef((props, ref) => {
    const { name, onOpenChange, onChange: onChangeProp, ...otherProps } = props;
    const [field, meta, { setValue, setTouched }] = useField(name);
    const { status = {}, setStatus } = useFormikContext();
    const fieldStatus = getIn(status, name);
    const selectProps = {
        ...otherProps,
        ref,
        error: meta.touched ? meta.error || fieldStatus : "",
        name: field.name,
        value: field.value,
        onOpenChange: (open) => {
            if (!open)
                setTouched(true, false);
            onOpenChange?.(open);
        },
        onChange: (value) => {
            setStatus(dissoc(name, status));
            setValue(value);
            onChangeProp?.(value);
        },
    };
    return jsx(Select, { ...selectProps });
});
FormikSelect.displayName = "FormikSelect";

export { FormikSelect };
//# sourceMappingURL=Select.js.map
