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

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

export { AutoFormSwitch as default };
