'use strict';

const jsxRuntime = require('react/jsx-runtime');
const form = require('../../form.cjs');
const input = require('../../input.cjs');
const label = require('../common/label.cjs');
const tooltip = require('../common/tooltip.cjs');

function AutoFormInput({
  label: label$1,
  isRequired,
  fieldConfigItem,
  fieldProps
}) {
  const { showLabel: _showLabel, ...fieldPropsWithoutShowLabel } = fieldProps;
  const showLabel = _showLabel === void 0 ? true : _showLabel;
  const type = fieldProps.type || "text";
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-row  items-center space-x-2", children: /* @__PURE__ */ jsxRuntime.jsxs(form.FormItem, { className: "flex w-full flex-col justify-start", children: [
    showLabel && /* @__PURE__ */ jsxRuntime.jsx(
      label,
      {
        label: fieldConfigItem?.label || label$1,
        isRequired
      }
    ),
    /* @__PURE__ */ jsxRuntime.jsx(form.FormControl, { children: /* @__PURE__ */ jsxRuntime.jsx(input.Input, { type, ...fieldPropsWithoutShowLabel }) }),
    /* @__PURE__ */ jsxRuntime.jsx(tooltip, { fieldConfigItem }),
    /* @__PURE__ */ jsxRuntime.jsx(form.FormMessage, {})
  ] }) });
}

module.exports = AutoFormInput;
