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