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

function AutoFormCheckbox({
  label,
  isRequired,
  field,
  fieldConfigItem,
  fieldProps
}) {
  return /* @__PURE__ */ jsxs("div", { children: [
    /* @__PURE__ */ jsx(FormItem, { children: /* @__PURE__ */ jsxs("div", { className: "mb-3 flex items-center gap-3", children: [
      /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(
        Checkbox,
        {
          checked: field.value,
          onCheckedChange: field.onChange,
          ...fieldProps
        }
      ) }),
      /* @__PURE__ */ jsx(
        AutoFormLabel,
        {
          label: fieldConfigItem?.label || label,
          isRequired
        }
      )
    ] }) }),
    /* @__PURE__ */ jsx(AutoFormTooltip, { fieldConfigItem })
  ] });
}

export { AutoFormCheckbox as default };
