const require_runtime = require("../../../../../../_virtual/_rolldown/runtime.js");
const require_objectSpread2 = require("../../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
const require_status = require("../../status.js");
const require_index = require("../Action/index.js");
const require_index$1 = require("../TooltipTags/index.js");
const require_index$2 = require("../CardMask/index.js");
let react = require("react");
react = require_runtime.__toESM(react);
let _pisell_materials = require("@pisell/materials");
let classnames = require("classnames");
classnames = require_runtime.__toESM(classnames);
require("./index.less");
//#region src/plus/productSelect/ProductCard/SkuCard/components/CardWrapper/index.tsx
const CardWrapper = (props) => {
	const { children, className, style, skuCardConfig, skuActionConfig, skuStatusOverlayConfig, dataSource, onCardClick, isSelected } = props;
	const { paddingX, paddingY, background, marginY, marginX, radius, borderWidth, borderColor, isBorderVisible, layoutDirection } = skuCardConfig || {};
	const { method } = skuActionConfig || {};
	const finalStyle = (0, react.useMemo)(() => {
		return require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, style), {}, {
			backgroundColor: background,
			padding: `${paddingY}px ${paddingX}px`,
			margin: `${marginY}px ${marginX}px`,
			borderRadius: radius,
			border: isBorderVisible ? `${borderWidth}px solid ${borderColor}` : "none"
		});
	}, [
		style,
		paddingX,
		paddingY,
		borderWidth,
		borderColor,
		isBorderVisible,
		radius,
		background,
		marginX,
		marginY
	]);
	return /* @__PURE__ */ react.default.createElement("div", {
		className: (0, classnames.default)(`${require_status.PREFIX}__card-wrapper`, (skuStatusOverlayConfig === null || skuStatusOverlayConfig === void 0 ? void 0 : skuStatusOverlayConfig.isOpen) && `pisell-product-sku__card-wrapper-overlay`, className),
		onClick: (e) => {
			onCardClick === null || onCardClick === void 0 || onCardClick(dataSource);
		}
	}, /* @__PURE__ */ react.default.createElement(_pisell_materials.CardPro, {
		isMedia: false,
		isShowHead: false,
		isShowFooter: false,
		className: (0, classnames.default)(`${require_status.PREFIX}__card-wrapper-card`, isSelected && `pisell-product-sku__card-wrapper-selected`),
		style: finalStyle
	}, /* @__PURE__ */ react.default.createElement("div", { className: `${require_status.PREFIX}__card-wrapper-children` }, children), /* @__PURE__ */ react.default.createElement(require_index$2.default, { props: skuStatusOverlayConfig || {} }), layoutDirection === "column" && method !== "button" ? /* @__PURE__ */ react.default.createElement("div", {
		className: `${require_status.PREFIX}__card-wrapper-action`,
		style: {
			bottom: paddingY,
			right: paddingX
		}
	}, /* @__PURE__ */ react.default.createElement(require_index.default, { props })) : null, /* @__PURE__ */ react.default.createElement(require_index$1.default, { props })));
};
//#endregion
exports.default = CardWrapper;
