"use client";
import { jsx } from "../../packages/jsx/src/jsx-runtime.js";
import { CheckboxItem } from "@radix-ui/react-dropdown-menu";
import { menuItemStyles } from "./styles.js";
import { Checkbox } from "../Checkbox/Checkbox.js";
function MenuCheckboxItem({ children, textValue, ...rest }) {
  return /* @__PURE__ */ jsx(
    CheckboxItem,
    {
      sx: menuItemStyles,
      onClickCapture: (event) => {
        var _a;
        if (event.target instanceof HTMLInputElement) {
          (_a = rest.onCheckedChange) == null ? void 0 : _a.call(rest, !rest.checked);
        }
        event.stopPropagation();
      },
      onKeyDown: (event) => {
        var _a;
        if (event.key === "Enter" || event.key === " ") {
          (_a = rest.onCheckedChange) == null ? void 0 : _a.call(rest, !rest.checked);
        }
      },
      ...rest,
      children: /* @__PURE__ */ jsx(
        Checkbox,
        {
          checked: rest.checked !== "indeterminate" ? rest.checked : void 0,
          onChange: () => {
            var _a;
            return (_a = rest.onCheckedChange) == null ? void 0 : _a.call(rest, !rest.checked);
          },
          disabled: rest.disabled,
          sx: { cursor: "pointer" },
          children: children || textValue
        }
      )
    }
  );
}
export {
  MenuCheckboxItem
};
