"use client";
import { rem } from "../../core/utils/units-converters/rem.mjs";
import { getRadius } from "../../core/utils/get-size/get-size.mjs";
import { createVarsResolver } from "../../core/styles-api/create-vars-resolver/create-vars-resolver.mjs";
import { useProps } from "../../core/MantineProvider/use-props/use-props.mjs";
import { useStyles } from "../../core/styles-api/use-styles/use-styles.mjs";
import { polymorphicFactory } from "../../core/factory/polymorphic-factory.mjs";
import { Box } from "../../core/Box/Box.mjs";
import ColorSwatch_module_default from "./ColorSwatch.module.mjs";
import { jsx, jsxs } from "react/jsx-runtime";
//#region packages/@mantine/core/src/components/ColorSwatch/ColorSwatch.tsx
const defaultProps = { withShadow: true };
const varsResolver = createVarsResolver((_, { radius, size }) => ({ root: {
	"--cs-radius": radius === void 0 ? void 0 : getRadius(radius),
	"--cs-size": rem(size)
} }));
const ColorSwatch = polymorphicFactory((_props) => {
	const props = useProps("ColorSwatch", defaultProps, _props);
	const { classNames, className, style, styles, unstyled, vars, color, radius, withShadow, children, attributes, ...others } = useProps("ColorSwatch", defaultProps, props);
	const getStyles = useStyles({
		name: "ColorSwatch",
		props,
		classes: ColorSwatch_module_default,
		className,
		style,
		classNames,
		styles,
		unstyled,
		attributes,
		vars,
		varsResolver
	});
	return /* @__PURE__ */ jsxs(Box, {
		...getStyles("root", { focusable: true }),
		...others,
		children: [
			/* @__PURE__ */ jsx("span", { ...getStyles("alphaOverlay") }),
			withShadow && /* @__PURE__ */ jsx("span", { ...getStyles("shadowOverlay") }),
			/* @__PURE__ */ jsx("span", { ...getStyles("colorOverlay", { style: { backgroundColor: color } }) }),
			/* @__PURE__ */ jsx("span", {
				...getStyles("childrenOverlay"),
				children
			})
		]
	});
});
ColorSwatch.classes = ColorSwatch_module_default;
ColorSwatch.varsResolver = varsResolver;
ColorSwatch.displayName = "@mantine/core/ColorSwatch";
//#endregion
export { ColorSwatch };

//# sourceMappingURL=ColorSwatch.mjs.map