import { j as t } from "../../../_virtual/jsx-runtime.js";
import { forwardRef as u } from "react";
import { CheckRadioInputGroupWrapper as l, CheckRadioErrorArea as I, CheckRadioHintArea as R } from "../styles.js";
import { getId as n, slugify as A, noop as b } from "../../../utils/index.js";
import g from "../../../icons/AlertCircle.js";
import { CheckboxInput as T } from "./CheckboxInput.js";
function w({
  id: r,
  name: k,
  label: a,
  value: m,
  checked: f,
  onChange: p = b,
  disabled: h = !1,
  hasError: i = !1,
  errorText: o,
  assistText: s,
  indeterminate: x,
  tabIndex: C,
  ...e
}, j) {
  const d = n(e["data-testid"]), c = n(e["data-trackid"]);
  return !r && a && (r = A(a)), /* @__PURE__ */ t.jsxs(l, { children: [
    /* @__PURE__ */ t.jsx(
      T,
      {
        id: r,
        ref: j,
        name: k,
        value: m,
        disabled: h,
        "aria-checked": e["aria-checked"],
        checked: f,
        onChange: p,
        "data-testid": d("check"),
        "data-trackid": c("check"),
        "aria-label": e["aria-label"] || a,
        hasError: i,
        label: a,
        indeterminate: x,
        tabIndex: C
      }
    ),
    i && o && /* @__PURE__ */ t.jsxs(
      I,
      {
        "data-testid": d("error"),
        "data-trackid": c("error"),
        children: [
          /* @__PURE__ */ t.jsx(g, {}),
          o
        ]
      }
    ),
    s && !i && /* @__PURE__ */ t.jsx(
      R,
      {
        "data-testid": d("assistText"),
        "data-trackid": c("assistText"),
        children: s
      }
    )
  ] });
}
const z = u(w);
export {
  z as Checkbox
};
