"use strict";

exports.__esModule = true;
exports.default = exports.CardHeader = exports.CardFooter = exports.CardCover = exports.CardBody = void 0;

var _react = _interopRequireWildcard(require("react"));

var _clsx = _interopRequireDefault(require("clsx"));

var _ConfigProviderContext = _interopRequireDefault(require("../config-provider/ConfigProviderContext"));

var _constant = require("../utils/constant");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var CardHeader = function CardHeader(props) {
  var _cls;

  var _useContext = (0, _react.useContext)(_ConfigProviderContext.default),
      prefixCls = _useContext.prefixCls,
      createNamespace = _useContext.createNamespace;

  var _createNamespace = createNamespace('card-header', prefixCls),
      bem = _createNamespace[0];

  return /*#__PURE__*/_react.default.createElement("div", {
    className: (0, _clsx.default)(props.className, bem(), (_cls = {}, _cls[_constant.BORDER_BOTTOM] = props.border, _cls)),
    style: props.style,
    onClick: props.onClick
  }, /*#__PURE__*/_react.default.createElement("div", {
    className: (0, _clsx.default)(bem('content'))
  }, props.children), props.extra && /*#__PURE__*/_react.default.createElement("div", {
    className: (0, _clsx.default)(bem('extra'))
  }, props.extra));
};

exports.CardHeader = CardHeader;

var CardBody = function CardBody(props) {
  var _useContext2 = (0, _react.useContext)(_ConfigProviderContext.default),
      prefixCls = _useContext2.prefixCls,
      createNamespace = _useContext2.createNamespace;

  var _createNamespace2 = createNamespace('card-body', prefixCls),
      bem = _createNamespace2[0];

  return /*#__PURE__*/_react.default.createElement("div", {
    className: (0, _clsx.default)(props.className, bem()),
    style: props.style,
    onClick: props.onClick
  }, props.children);
};

exports.CardBody = CardBody;

var CardFooter = function CardFooter(props) {
  var _cls2;

  var _useContext3 = (0, _react.useContext)(_ConfigProviderContext.default),
      prefixCls = _useContext3.prefixCls,
      createNamespace = _useContext3.createNamespace;

  var _createNamespace3 = createNamespace('card-footer', prefixCls),
      bem = _createNamespace3[0];

  return /*#__PURE__*/_react.default.createElement("div", {
    className: (0, _clsx.default)(props.className, bem({
      compact: props.compact
    }), (_cls2 = {}, _cls2[_constant.BORDER_TOP] = props.border, _cls2)),
    style: props.style,
    onClick: props.onClick
  }, props.children);
};

exports.CardFooter = CardFooter;

var CardCover = function CardCover(props) {
  var _useContext4 = (0, _react.useContext)(_ConfigProviderContext.default),
      prefixCls = _useContext4.prefixCls,
      createNamespace = _useContext4.createNamespace;

  var _createNamespace4 = createNamespace('card-cover', prefixCls),
      bem = _createNamespace4[0];

  return /*#__PURE__*/_react.default.createElement("div", {
    className: (0, _clsx.default)(props.className, bem()),
    style: props.style,
    onClick: props.onClick
  }, props.children);
};

exports.CardCover = CardCover;

var Card = function Card(props) {
  var _useContext5 = (0, _react.useContext)(_ConfigProviderContext.default),
      prefixCls = _useContext5.prefixCls,
      createNamespace = _useContext5.createNamespace;

  var _createNamespace5 = createNamespace('card', prefixCls),
      bem = _createNamespace5[0];

  var className = props.className,
      style = props.style,
      round = props.round,
      border = props.border,
      children = props.children;
  return /*#__PURE__*/_react.default.createElement("div", {
    className: (0, _clsx.default)(bem({
      round: round,
      border: border
    }), className),
    style: style,
    onClick: props.onClick
  }, children);
}; // defaultProps defined if need


Card.defaultProps = {};
var _default = Card;
exports.default = _default;