"use client";
const require_get_size = require("../../core/utils/get-size/get-size.cjs");
const require_create_vars_resolver = require("../../core/styles-api/create-vars-resolver/create-vars-resolver.cjs");
const require_use_props = require("../../core/MantineProvider/use-props/use-props.cjs");
const require_use_styles = require("../../core/styles-api/use-styles/use-styles.cjs");
const require_polymorphic_factory = require("../../core/factory/polymorphic-factory.cjs");
const require_Box = require("../../core/Box/Box.cjs");
const require_UnstyledButton = require("../UnstyledButton/UnstyledButton.cjs");
const require_Transition = require("../Transition/Transition.cjs");
const require_Loader = require("../Loader/Loader.cjs");
const require_ActionIcon_module = require("./ActionIcon.module.cjs");
const require_ActionIconGroup = require("./ActionIconGroup/ActionIconGroup.cjs");
const require_ActionIconGroupSection = require("./ActionIconGroupSection/ActionIconGroupSection.cjs");
let react_jsx_runtime = require("react/jsx-runtime");
//#region packages/@mantine/core/src/components/ActionIcon/ActionIcon.tsx
const varsResolver = require_create_vars_resolver.createVarsResolver((theme, { size, radius, variant, gradient, color, autoContrast }) => {
	const colors = theme.variantColorResolver({
		color: color || theme.primaryColor,
		theme,
		gradient,
		variant: variant || "filled",
		autoContrast
	});
	return { root: {
		"--ai-size": require_get_size.getSize(size, "ai-size"),
		"--ai-radius": radius === void 0 ? void 0 : require_get_size.getRadius(radius),
		"--ai-bg": color || variant ? colors.background : void 0,
		"--ai-hover": color || variant ? colors.hover : void 0,
		"--ai-hover-color": color || variant ? colors.hoverColor : void 0,
		"--ai-color": colors.color,
		"--ai-bd": color || variant ? colors.border : void 0
	} };
});
const ActionIcon = require_polymorphic_factory.polymorphicFactory((_props) => {
	const props = require_use_props.useProps("ActionIcon", null, _props);
	const { className, unstyled, variant, classNames, styles, style, loading, loaderProps, size, color, radius, __staticSelector, gradient, vars, children, disabled, "data-disabled": dataDisabled, autoContrast, mod, attributes, ...others } = props;
	const getStyles = require_use_styles.useStyles({
		name: ["ActionIcon", __staticSelector],
		props,
		className,
		style,
		classes: require_ActionIcon_module.default,
		classNames,
		styles,
		unstyled,
		attributes,
		vars,
		varsResolver
	});
	return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_UnstyledButton.UnstyledButton, {
		...getStyles("root", { active: !disabled && !loading && !dataDisabled }),
		...others,
		unstyled,
		variant,
		size,
		disabled: disabled || loading,
		mod: [{
			loading,
			disabled: disabled || dataDisabled
		}, mod],
		children: [typeof loading === "boolean" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Transition.Transition, {
			mounted: loading,
			transition: "slide-down",
			duration: 150,
			children: (transitionStyles) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Box.Box, {
				component: "span",
				...getStyles("loader", { style: transitionStyles }),
				"aria-hidden": true,
				children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Loader.Loader, {
					color: "var(--ai-color)",
					size: "calc(var(--ai-size) * 0.55)",
					...loaderProps
				})
			})
		}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Box.Box, {
			component: "span",
			mod: { loading },
			...getStyles("icon"),
			children
		})]
	});
});
ActionIcon.classes = require_ActionIcon_module.default;
ActionIcon.varsResolver = varsResolver;
ActionIcon.displayName = "@mantine/core/ActionIcon";
ActionIcon.Group = require_ActionIconGroup.ActionIconGroup;
ActionIcon.GroupSection = require_ActionIconGroupSection.ActionIconGroupSection;
//#endregion
exports.ActionIcon = ActionIcon;

//# sourceMappingURL=ActionIcon.cjs.map