import { jsxs as p, jsx as t } from "react/jsx-runtime";
import { forwardRef as h } from "react";
import { F as O } from "./field-helper-text-C5ee4SFV.mjs";
import { L as x } from "./label-7sJe5-pX.mjs";
import { I as B, a as G, R as I } from "./index-DSf4qCR-.mjs";
import { c as $ } from "./bind-CU-R61T-.mjs";
import { a as y } from "./heading-gqtQNo5n.mjs";
const z = {
  "purpur-radio-button-group-item": "_purpur-radio-button-group-item_1j3ch_1",
  "purpur-radio-button-group-item__radio": "_purpur-radio-button-group-item__radio_1j3ch_14",
  "purpur-radio-button-group-item__label": "_purpur-radio-button-group-item__label_1j3ch_42",
  "purpur-radio-button-group-item__container": "_purpur-radio-button-group-item__container_1j3ch_45",
  "purpur-radio-button-group-item__item-label-container": "_purpur-radio-button-group-item__item-label-container_1j3ch_53",
  "purpur-radio-button-group-item__item-helper": "_purpur-radio-button-group-item__item-helper_1j3ch_53",
  "purpur-radio-button-group-item__label-container": "_purpur-radio-button-group-item__label-container_1j3ch_56",
  "purpur-radio-button-group-item__indicator": "_purpur-radio-button-group-item__indicator_1j3ch_79"
}, e = $.bind(z), L = ["ltr", "rtl"], P = ["horizontal", "vertical"], u = "purpur-radio-button-group-item", N = h(
  ({ disabled: o, id: r, value: _, label: i, "data-testid": a, helperText: n, ...l }, d) => /* @__PURE__ */ p("div", { className: e(`${u}__container`), ...l, children: [
    /* @__PURE__ */ t(
      B,
      {
        className: e(u),
        "data-testid": a,
        disabled: o,
        id: r,
        ref: d,
        value: _,
        "aria-labelledby": `${r}-label ${r}-helper-text`,
        children: /* @__PURE__ */ t("span", { className: e(`${u}__radio`), children: /* @__PURE__ */ t(G, { className: e(`${u}__indicator`) }) })
      }
    ),
    /* @__PURE__ */ p("span", { className: e(`${u}__label-container`), children: [
      /* @__PURE__ */ t(
        x,
        {
          htmlFor: r,
          id: `${r}-label`,
          className: e(`${u}__label`),
          disabled: o,
          children: i
        }
      ),
      n && /* @__PURE__ */ t(
        O,
        {
          className: e(`${u}__helper`),
          "data-testid": a && `${a}-helper-text`,
          disabled: o,
          id: `${r}-helper-text`,
          children: n
        }
      )
    ] })
  ] }, r)
), U = {
  "purpur-radio-button-group": "_purpur-radio-button-group_v7z64_1",
  "purpur-radio-button-group__item-container": "_purpur-radio-button-group__item-container_v7z64_10",
  "purpur-radio-button-group__container": "_purpur-radio-button-group__container_v7z64_13"
}, b = $.bind(U), g = "purpur-radio-button-group", R = h(
  ({
    id: o,
    "data-testid": r,
    className: _,
    items: i,
    heading: a,
    loop: n = !0,
    orientation: l = "vertical",
    headingTag: d = "h2",
    children: s,
    ...c
  }, f) => {
    if (!i?.length && !s)
      return null;
    const j = () => i?.map((m) => /* @__PURE__ */ t(
      N,
      {
        disabled: c.disabled,
        ...m
      },
      `radio-item-${m.value}`
    ));
    return /* @__PURE__ */ p("div", { className: b(_, `${g}__container`), children: [
      a && /* @__PURE__ */ p(
        y,
        {
          tag: d,
          "data-testid": r ? `${r}-heading` : void 0,
          id: `${o}-heading`,
          variant: "subsection-100",
          children: [
            c.required && /* @__PURE__ */ t("span", { "aria-hidden": !0, children: "* " }),
            a
          ]
        }
      ),
      /* @__PURE__ */ t(
        I,
        {
          ...c,
          "aria-labelledby": a ? `${o}-heading` : void 0,
          className: b(g),
          "data-testid": r,
          loop: n,
          orientation: l,
          ref: f,
          children: i?.length ? j() : s
        }
      )
    ] });
  }
);
R.displayName = "RadioButtonGroupRoot";
const v = ({
  children: o,
  ...r
}) => /* @__PURE__ */ t(R, { ...r, children: o });
v.Item = N;
v.displayName = "RadioButtonGroup";
export {
  v as R,
  L as a,
  P as b
};
//# sourceMappingURL=radio-button-group-BnCPcmSN.mjs.map
