import { _objectSpread2 } from "../../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
import { PREFIX } from "../../status.js";
import Action from "../Action/index.js";
import TooltipTags from "../TooltipTags/index.js";
import CardMask from "../CardMask/index.js";
import React, { useMemo } from "react";
import { CardPro } from "@pisell/materials";
import classNames from "classnames";
import "./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 = useMemo(() => {
		return _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.createElement("div", {
		className: classNames(`${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.createElement(CardPro, {
		isMedia: false,
		isShowHead: false,
		isShowFooter: false,
		className: classNames(`${PREFIX}__card-wrapper-card`, isSelected && `pisell-product-sku__card-wrapper-selected`),
		style: finalStyle
	}, /* @__PURE__ */ React.createElement("div", { className: `${PREFIX}__card-wrapper-children` }, children), /* @__PURE__ */ React.createElement(CardMask, { props: skuStatusOverlayConfig || {} }), layoutDirection === "column" && method !== "button" ? /* @__PURE__ */ React.createElement("div", {
		className: `${PREFIX}__card-wrapper-action`,
		style: {
			bottom: paddingY,
			right: paddingX
		}
	}, /* @__PURE__ */ React.createElement(Action, { props })) : null, /* @__PURE__ */ React.createElement(TooltipTags, { props })));
};
//#endregion
export { CardWrapper as default };
