"use client";
import { jsx as e, jsxs as c } from "react/jsx-runtime";
import { forwardRef as b, createContext as h, useContext as k } from "react";
import { c as a } from "./cn-ct4n7r74mh8y0f48.js";
import { R as N, P as I, Q as w, bi as y, bj as A } from "./vendor-base-ui-kxxocm122zr4pipe.js";
const j = {
  variant: {
    default: {
      classes: "ring-kumo-line",
      description: "Default radio appearance"
    },
    error: {
      classes: "ring-destructive",
      description: "Error state for validation failures"
    }
  }
}, G = {
  variant: "default"
};
function P({
  variant: r = G.variant
} = {}) {
  return a(j.variant[r].classes);
}
const u = h({
  controlPosition: "start"
}), d = b(
  ({ className: r, disabled: t, variant: i = "default", label: o, value: s }, n) => {
    const { controlPosition: l } = k(u);
    return /* @__PURE__ */ c(
      "label",
      {
        className: a(
          "m-0 group relative inline-flex items-center gap-2",
          // "start" (default): radio before label
          // "end": label before radio using flex-row-reverse
          l === "end" && "flex-row-reverse justify-end",
          t ? "cursor-not-allowed opacity-50" : "cursor-pointer",
          r
        ),
        children: [
          /* @__PURE__ */ e(
            y,
            {
              ref: n,
              value: s,
              disabled: t,
              className: a(
                "relative flex h-4 w-4 items-center justify-center rounded-full border-0 bg-kumo-base ring after:absolute after:-inset-x-3 after:-inset-y-2",
                i === "error" ? "ring-kumo-danger" : "ring-kumo-line",
                !t && "group-hover:ring-kumo-ring focus-visible:ring-kumo-ring focus-visible:outline-offset-3",
                "data-checked:bg-kumo-contrast"
              ),
              children: /* @__PURE__ */ e(A, { className: "flex items-center justify-center", children: /* @__PURE__ */ e("span", { className: "h-2 w-2 rounded-full bg-kumo-base" }) })
            }
          ),
          /* @__PURE__ */ e("span", { className: "text-base font-medium text-kumo-default", children: o })
        ]
      }
    );
  }
);
d.displayName = "Radio.Item";
function m({
  legend: r,
  children: t,
  orientation: i = "vertical",
  error: o,
  description: s,
  defaultValue: n,
  value: l,
  onValueChange: f,
  disabled: p,
  controlPosition: x = "start",
  name: g,
  className: R
}) {
  return /* @__PURE__ */ e(u.Provider, { value: { controlPosition: x }, children: /* @__PURE__ */ e(
    N,
    {
      defaultValue: n,
      value: l,
      onValueChange: (v) => f?.(v),
      disabled: p,
      name: g,
      children: /* @__PURE__ */ c(
        I,
        {
          className: a(
            "flex flex-col gap-4 rounded-lg border border-kumo-line p-4",
            R
          ),
          children: [
            /* @__PURE__ */ e(w, { className: "text-lg font-medium text-kumo-default", children: r }),
            /* @__PURE__ */ e(
              "div",
              {
                className: a(
                  "flex gap-2",
                  i === "vertical" ? "flex-col" : "flex-row flex-wrap"
                ),
                children: t
              }
            ),
            o && /* @__PURE__ */ e("p", { className: "text-sm text-kumo-danger", children: o }),
            s && /* @__PURE__ */ e("p", { className: "text-sm text-kumo-subtle", children: s })
          ]
        }
      )
    }
  ) });
}
m.displayName = "Radio.Group";
const V = {
  Item: d,
  Group: m
};
export {
  j as K,
  V as R,
  m as a,
  G as b,
  P as r
};
//# sourceMappingURL=radio-394mfs3au5m8cgd8.js.map
