"use client";
import { j as o } from "./index.esm38.js";
import { forwardRef as N, useRef as b, useEffect as R } from "react";
import i from "./index.esm40.js";
import s from "./index.esm53.js";
import { Root as h } from "./index.esm8.js";
const d = N(
  ({
    type: t = "checkbox",
    size: n = "md",
    description: r,
    indeterminate: m = !1,
    className: u,
    testId: p,
    children: a,
    disabled: f,
    ...x
  }, e) => {
    const c = b(null);
    R(() => {
      t === "checkbox" && c.current && (c.current.indeterminate = m);
    }, [m, t]);
    const j = (l) => {
      c.current = l, typeof e == "function" ? e(l) : e && (e.current = l);
    };
    return /* @__PURE__ */ o.jsxs(
      h,
      {
        as: "label",
        testId: p,
        className: i(
          s.root,
          s[`root--${n}`],
          f && s["root--disabled"],
          u
        ),
        children: [
          /* @__PURE__ */ o.jsx("input", { ref: j, type: t, className: s.input, disabled: f, ...x }),
          /* @__PURE__ */ o.jsx(
            "span",
            {
              className: i(s.control, s[`control--${t}`], s[`control--${n}`]),
              "aria-hidden": "true"
            }
          ),
          (a || r) && /* @__PURE__ */ o.jsxs("span", { className: s.content, children: [
            a && /* @__PURE__ */ o.jsx("span", { className: s.label, children: a }),
            r && /* @__PURE__ */ o.jsx("span", { className: s.description, children: r })
          ] })
        ]
      }
    );
  }
);
d.displayName = "SelectableControl";
export {
  d as SelectableControl
};
//# sourceMappingURL=index.esm15.js.map
