"use client";
import { getRadius, getSize } from "../../../core/utils/get-size/get-size.mjs";
import { createVarsResolver } from "../../../core/styles-api/create-vars-resolver/create-vars-resolver.mjs";
import { parseThemeColor } from "../../../core/MantineProvider/color-functions/parse-theme-color/parse-theme-color.mjs";
import { getThemeColor } from "../../../core/MantineProvider/color-functions/get-theme-color/get-theme-color.mjs";
import { getContrastColor } from "../../../core/MantineProvider/color-functions/get-contrast-color/get-contrast-color.mjs";
import { getAutoContrastValue } from "../../../core/MantineProvider/color-functions/get-auto-contrast-value/get-auto-contrast-value.mjs";
import { useProps } from "../../../core/MantineProvider/use-props/use-props.mjs";
import { useStyles } from "../../../core/styles-api/use-styles/use-styles.mjs";
import { factory } from "../../../core/factory/factory.mjs";
import { Box } from "../../../core/Box/Box.mjs";
import { CheckboxCardContext } from "../CheckboxCard/CheckboxCard.mjs";
import { CheckboxIcon } from "../CheckIcon.mjs";
import CheckboxIndicator_module_default from "./CheckboxIndicator.module.mjs";
import { use } from "react";
import { jsx } from "react/jsx-runtime";
//#region packages/@mantine/core/src/components/Checkbox/CheckboxIndicator/CheckboxIndicator.tsx
const defaultProps = {
	icon: CheckboxIcon,
	variant: "filled",
	radius: "sm"
};
const varsResolver = createVarsResolver((theme, { radius, color, size, iconColor, variant, autoContrast }) => {
	const parsedColor = parseThemeColor({
		color: color || theme.primaryColor,
		theme
	});
	const outlineColor = parsedColor.isThemeColor && parsedColor.shade === void 0 ? `var(--mantine-color-${parsedColor.color}-outline)` : parsedColor.color;
	return { indicator: {
		"--checkbox-size": getSize(size, "checkbox-size"),
		"--checkbox-radius": radius === void 0 ? void 0 : getRadius(radius),
		"--checkbox-color": variant === "outline" ? outlineColor : getThemeColor(color, theme),
		"--checkbox-icon-color": iconColor ? getThemeColor(iconColor, theme) : getAutoContrastValue(autoContrast, theme) ? getContrastColor({
			color,
			theme,
			autoContrast
		}) : void 0
	} };
});
const CheckboxIndicator = factory((_props) => {
	const props = useProps("CheckboxIndicator", defaultProps, _props);
	const { classNames, className, style, styles, unstyled, vars, icon: Icon, indeterminate, radius, color, iconColor, autoContrast, checked, mod, variant, disabled, attributes, ...others } = props;
	const getStyles = useStyles({
		name: "CheckboxIndicator",
		classes: CheckboxIndicator_module_default,
		props,
		className,
		style,
		classNames,
		styles,
		unstyled,
		attributes,
		vars,
		varsResolver,
		rootSelector: "indicator"
	});
	const ctx = use(CheckboxCardContext);
	const _checked = typeof checked === "boolean" || typeof indeterminate === "boolean" ? checked || indeterminate : ctx?.checked || false;
	return /* @__PURE__ */ jsx(Box, {
		...getStyles("indicator", { variant }),
		variant,
		mod: [{
			checked: _checked,
			disabled
		}, mod],
		...others,
		children: /* @__PURE__ */ jsx(Icon, {
			indeterminate,
			...getStyles("icon")
		})
	});
});
CheckboxIndicator.displayName = "@mantine/core/CheckboxIndicator";
CheckboxIndicator.classes = CheckboxIndicator_module_default;
CheckboxIndicator.varsResolver = varsResolver;
//#endregion
export { CheckboxIndicator };

//# sourceMappingURL=CheckboxIndicator.mjs.map