import { jsx, jsxs } from 'react/jsx-runtime';
import { FormItem, FormControl, FormMessage } from '../../form.mjs';
import { Input } from '../../input.mjs';
import AutoFormLabel from '../common/label.mjs';
import AutoFormTooltip from '../common/tooltip.mjs';

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

export { AutoFormInput as default };
