import { j as t } from "../../_virtual/jsx-runtime.js";
import m from "../../icons/Check.js";
import { Wrapper as l, ToggleLabel as j, ToggleWrapper as k, ToggleInput as u, ToggleSlider as T } from "./styles.js";
import { getId as n } from "../../utils/index.js";
function W({
  checked: c,
  disabled: o,
  id: a,
  onChange: p,
  value: s,
  label: e,
  name: g,
  ...r
}) {
  const h = (x) => p(x), d = n(r["data-testid"]), i = n(r["data-testid"]);
  return /* @__PURE__ */ t.jsxs(
    l,
    {
      htmlFor: a || e,
      "data-testid": d("wrapper"),
      "data-trackid": i("wrapper"),
      children: [
        e && /* @__PURE__ */ t.jsx(
          j,
          {
            disabled: o,
            "aria-label": e,
            "data-testid": d("label"),
            children: e
          }
        ),
        /* @__PURE__ */ t.jsxs(k, { children: [
          /* @__PURE__ */ t.jsx(
            u,
            {
              id: a || e,
              name: g,
              value: s,
              checked: c,
              "aria-checked": r["aria-checked"],
              disabled: o,
              type: "checkbox",
              role: "checkbox",
              onChange: h,
              "data-testid": d("input"),
              "data-trackid": i("input")
            }
          ),
          /* @__PURE__ */ t.jsx(T, { children: /* @__PURE__ */ t.jsx(m, {}) })
        ] })
      ]
    }
  );
}
export {
  W as Toggle
};
