import { j as d } from "../../../_virtual/jsx-runtime.js";
import f from "../../../icons/AlertCircle.js";
import { getId as m } from "../../../utils/index.js";
import { CheckRadioInputGroupWrapper as n, CheckRadioGroupLabel as R, CheckRadioGroupWrapper as u, CheckRadioErrorArea as C, CheckRadioHintArea as v } from "../styles.js";
import { Radio as G } from "./Radio.js";
function w({
  value: o,
  options: r,
  onChange: p,
  name: x,
  groupLabel: l,
  orientation: h = "row",
  id: I,
  hasError: t = !1,
  errorText: c,
  disabled: j = !1,
  assistText: s,
  ...k
}) {
  const e = m(k["data-testid"]), i = m(k["data-testid"]);
  return /* @__PURE__ */ d.jsxs(n, { children: [
    l && /* @__PURE__ */ d.jsx(
      R,
      {
        "data-testid": e("group-label"),
        "data-trackid": i("group-label"),
        children: l
      }
    ),
    r && /* @__PURE__ */ d.jsx(u, { orientation: h, children: r.map((a) => /* @__PURE__ */ d.jsx(
      G,
      {
        label: a.label,
        value: a.value,
        name: x,
        hasError: t,
        checked: a.value === o,
        disabled: j || a.disabled,
        onChange: p,
        "data-testid": e(a["data-testid"]),
        "data-trackid": i(a["data-trackid"]),
        "aria-label": a.label
      },
      a.value
    )) }),
    t && c && /* @__PURE__ */ d.jsxs(
      C,
      {
        "data-testid": e("error"),
        "data-trackid": i("error"),
        children: [
          /* @__PURE__ */ d.jsx(f, {}),
          c
        ]
      }
    ),
    s && !t && /* @__PURE__ */ d.jsx(
      v,
      {
        "data-testid": e("assistText"),
        "data-trackid": i("assistText"),
        children: s
      }
    )
  ] });
}
export {
  w as RadioButtonGroup
};
