import { j as o } from "../../../_virtual/jsx-runtime.js";
import { forwardRef as x } from "react";
import { CheckRadioWrapper as l, CheckRadioInput as C, CheckRadioLabel as I } from "../styles.js";
import { slugify as j, getId as c, noop as R } from "../../../utils/index.js";
function b({
  id: a,
  name: p,
  label: t,
  value: s,
  onChange: f = R,
  disabled: m = !1,
  hasError: k = !1,
  indeterminate: r,
  checked: h,
  tabIndex: u,
  ...e
}, g) {
  !a && t && (a = j(t));
  const i = c(e["data-testid"]), d = c(e["data-trackid"]);
  return /* @__PURE__ */ o.jsxs(l, { children: [
    /* @__PURE__ */ o.jsx(
      C,
      {
        ref: (n) => {
          n && r !== void 0 && (n.indeterminate = r);
        },
        type: "checkbox",
        id: a,
        name: p,
        value: s,
        disabled: m,
        hasError: k,
        onChange: f,
        "data-testid": i("input"),
        "data-trackid": d("input"),
        "aria-label": e["aria-label"] || t,
        checked: h,
        tabIndex: u
      }
    ),
    t && /* @__PURE__ */ o.jsx(
      I,
      {
        htmlFor: a,
        "data-testid": i("label"),
        "data-trackid": d("label"),
        children: t
      }
    )
  ] });
}
const E = x(b);
export {
  E as CheckboxInput
};
