"use client";
const require_use_props = require("../../../core/MantineProvider/use-props/use-props.cjs");
const require_factory = require("../../../core/factory/factory.cjs");
const require_CheckIcon = require("../../Checkbox/CheckIcon.cjs");
const require_Menu_context = require("../Menu.context.cjs");
const require_MenuCheckboxGroup_context = require("../MenuCheckboxGroup/MenuCheckboxGroup.context.cjs");
const require_MenuSelectableItem = require("../MenuSelectableItem/MenuSelectableItem.cjs");
const require_Menu_module = require("../Menu.module.cjs");
let react = require("react");
let _mantine_hooks = require("@mantine/hooks");
let react_jsx_runtime = require("react/jsx-runtime");
//#region packages/@mantine/core/src/components/Menu/MenuCheckboxItem/MenuCheckboxItem.tsx
const MenuCheckboxItem = require_factory.factory((_props) => {
	const { classNames, className, style, styles, vars, color, closeMenuOnClick, rightSection, children, disabled, "data-disabled": dataDisabled, value, checked, defaultChecked, onChange, checkIcon, ref, ...others } = require_use_props.useProps("MenuCheckboxItem", null, _props);
	const ctx = require_Menu_context.useMenuContext();
	const groupCtx = (0, react.use)(require_MenuCheckboxGroup_context.MenuCheckboxGroupContext);
	const groupChecked = groupCtx && value !== void 0 ? groupCtx.values.includes(value) : void 0;
	const [_checked, setChecked] = (0, _mantine_hooks.useUncontrolled)({
		value: checked ?? groupChecked,
		defaultValue: defaultChecked,
		finalValue: false,
		onChange
	});
	return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MenuSelectableItem.MenuSelectableItem, {
		role: "menuitemcheckbox",
		checked: _checked,
		indicator: checkIcon ?? ctx.checkIcon ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_CheckIcon.CheckIcon, { size: 10 }),
		onSelect: () => {
			if (onChange) setChecked(!_checked);
			else if (groupCtx && value !== void 0) groupCtx.onChange(value);
			else setChecked(!_checked);
		},
		color,
		closeMenuOnClick,
		rightSection,
		disabled,
		dataDisabled,
		className,
		style,
		styles,
		classNames,
		buttonRef: ref,
		others,
		children
	});
});
MenuCheckboxItem.classes = require_Menu_module.default;
MenuCheckboxItem.displayName = "@mantine/core/MenuCheckboxItem";
//#endregion
exports.MenuCheckboxItem = MenuCheckboxItem;

//# sourceMappingURL=MenuCheckboxItem.cjs.map