import { jsx } from "react/jsx-runtime";
import "react";
import { u as useFormContext, C as Controller } from "../../../index.esm-D7jRhDaG.js";
import FormField from "../../vendor/FormField.js";
import Select$1 from "../../vendor/Select/Select.js";
const Select = ({
  label,
  helpText,
  name,
  options,
  required,
  disabled,
  error,
  ...otherProps
}) => {
  var _a;
  const {
    control,
    formState: { errors }
  } = useFormContext();
  return /* @__PURE__ */ jsx(
    FormField,
    {
      disabled,
      error: (error == null ? void 0 : error.message) ?? ((_a = errors[name]) == null ? void 0 : _a.message),
      helpText,
      label,
      control: /* @__PURE__ */ jsx(
        Controller,
        {
          name,
          control,
          render: ({ field }) => {
            return /* @__PURE__ */ jsx(
              Select$1,
              {
                ...field,
                valueOnly: true,
                required,
                options,
                ...otherProps
              }
            );
          }
        }
      )
    }
  );
};
export {
  Select
};
//# sourceMappingURL=Select.js.map
