import { jsx as r } from "react/jsx-runtime";
import { Root as f, Indicator as g } from "@radix-ui/react-checkbox";
import { Minus as u, Check as m } from "lucide-react";
import { c as t } from "../../../../index-BtlgVD4m.js";
const v = ({
  ref: i,
  indeterminate: n,
  checked: e,
  // Controlled state prop
  defaultChecked: s,
  // Uncontrolled state prop
  onChange: o,
  // Handler for state changes
  disabled: d,
  isError: c,
  ...h
}) => {
  const a = n && !e ? "indeterminate" : e, b = a === "indeterminate" && !e ? u : m;
  return /* @__PURE__ */ r(
    f,
    {
      ref: i,
      checked: a,
      defaultChecked: s,
      onCheckedChange: o,
      disabled: d,
      className: t(
        "peer h-[var(--height-h-4)] w-[var(--width-w-4)] shrink-0",
        "rounded-[var(--border-radius-sm)] ring-offset-[var(--base-background)] cursor-pointer",
        "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[var(--base-ring)] focus-visible:ring-offset-2",
        "disabled:cursor-not-allowed disabled:opacity-50",
        // Apply styles based on the effective state (checked, indeterminate, unchecked)
        "data-[state=checked]:bg-[var(--base-highlight)] data-[state=checked]:text-[var(--base-primary-foreground)]",
        "data-[state=indeterminate]:bg-[var(--base-highlight)] data-[state=indeterminate]:text-[var(--base-primary-foreground)]",
        "data-[state=unchecked]:border data-[state=unchecked]:border-[var(--base-secondary-foreground)] data-[state=unchecked]:opacity-50 data-[state=unchecked]:text-[var(--base-secondary-foreground)]",
        // Error state — red outline ring to indicate validation failure
        c && "ring-1 ring-[var(--base-ring-error)] ring-offset-1"
      ),
      ...h,
      children: /* @__PURE__ */ r(g, { className: t("flex items-center justify-center text-current"), children: /* @__PURE__ */ r(b, { className: "h-[var(--height-h-4)] w-[var(--width-w-4)] text-[var(--base-primary-foreground)]" }) })
    }
  );
};
v.displayName = "CheckboxIndicator";
export {
  v as default
};
//# sourceMappingURL=CheckboxIndicator.js.map
