import x from "../../foundation/Icon/Generated/IconCheckMark.es.es.js";
import C from "../../foundation/Icon/Generated/IconMinus.es.es.js";
import { InputLabel as E } from "../InputLabel/InputLabel.es.es.js";
import { useMemoizedId as $ } from "../../hooks/useMemoizedId.es.es.js";
import { useCheckbox as M } from "../../../../../@react-aria/checkbox/dist/module.es.js";
import { useFocusRing as S } from "../../../../../@react-aria/focus/dist/module.es.js";
import { mergeProps as F } from "../../../../../@react-aria/utils/dist/module.es.js";
import { useToggleState as N } from "../../../../../@react-stately/toggle/dist/module.es.js";
import { FOCUS_STYLE as I } from "../../utilities/focusStyle.es.es.js";
import { merge as d } from "../../utilities/merge.es.es.js";
import { useForwardedRef as P } from "../../utilities/useForwardedRef.es.es.js";
import r, { forwardRef as R } from "react";
var U = /* @__PURE__ */ ((e) => (e.Checked = "Checked", e.Unchecked = "Unchecked", e.Mixed = "Mixed", e))(U || {});
const a = (e) => e === "Checked" || e === "Mixed", _ = ({
  id: e,
  disabled: o,
  required: i,
  label: l,
  tooltip: c,
  note: w,
  ariaLabel: n,
  value: k,
  groupInputProps: p,
  onChange: m,
  state: t = "Unchecked"
}, f) => {
  const b = $(e), s = P(f), { isFocusVisible: h, focusProps: u } = S(), v = N({
    onChange: o ? void 0 : m,
    isSelected: t === "Checked"
  }), { inputProps: g } = M(
    {
      isDisabled: o,
      isRequired: i,
      isIndeterminate: t === "Mixed",
      "aria-label": n || l,
      value: k
    },
    v,
    s
  );
  return /* @__PURE__ */ r.createElement("div", {
    className: "tw-flex tw-flex-col tw-gap-1 tw-transition-colors",
    "data-test-id": "checkbox"
  }, /* @__PURE__ */ r.createElement("label", {
    className: d([
      "tw-group tw-flex tw-items-center tw-gap-2 tw-select-none tw-outline-none",
      !o && "hover:tw-cursor-pointer"
    ])
  }, /* @__PURE__ */ r.createElement("input", {
    ...F(p || g, u),
    id: b,
    ref: s,
    className: "tw-sr-only",
    "data-test-id": "checkbox-input"
  }), /* @__PURE__ */ r.createElement("span", {
    "aria-hidden": "true",
    className: d([
      "tw-relative tw-flex tw-w-4 tw-h-4 tw-items-center tw-justify-center tw-rounded tw-border tw-shrink-0 tw-flex-none",
      h && I,
      o ? d([
        "tw-text-white tw-pointer-events-none",
        !a(t) && "tw-border-black-20 tw-bg-white dark:tw-border-black-80 dark:tw-bg-black-90",
        a(t) && "tw-border-black-40 tw-bg-black-40 dark:tw-border-black-60 dark:tw-bg-black-60"
      ]) : d([
        !a(t) && "tw-border-black-80 tw-bg-white hover:tw-border-black dark:tw-border-white dark:tw-bg-black dark:hover:tw-border-black-20 dark:hover:tw-bg-black-90 group-hover:tw-bg-white group-hover:tw-border-black dark:group-hover:tw-border-black-20 dark:group-hover:tw-bg-black-90",
        a(t) && "tw-border-violet-60 tw-bg-violet-60 tw-text-white hover:tw-border-violet-70 hover:tw-bg-violet-70 dark:tw-border-violet-50 dark:tw-bg-violet-50 dark:hover:tw-border-violet-60 dark:hover:tw-bg-violet-60 group-hover:tw-text-white group-hover:tw-border-violet-70 group-hover:tw-bg-violet-70 dark:group-hover:tw-border-violet-60 dark:group-hover:tw-bg-violet-60"
      ])
    ])
  }, t === "Checked" && /* @__PURE__ */ r.createElement(x, null), t === "Mixed" && /* @__PURE__ */ r.createElement(C, null)), l && /* @__PURE__ */ r.createElement(E, {
    disabled: o,
    clickable: !0,
    htmlFor: b,
    tooltip: c != null ? c : void 0,
    required: i,
    bold: a(t)
  }, l)), w && /* @__PURE__ */ r.createElement("span", {
    className: "tw-text-black-60 tw-font-sans tw-text-xs tw-font-normal"
  }, w));
}, B = R(_);
export {
  B as Checkbox,
  U as CheckboxState
};
//# sourceMappingURL=Checkbox.es.es.js.map
