"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));

var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));

var _bem = require("@zarm-design/bem");

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

var _configProvider = require("../config-provider");

var Panel = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
  var className = props.className,
      title = props.title,
      more = props.more,
      spacing = props.spacing,
      bordered = props.bordered,
      children = props.children,
      restProps = (0, _objectWithoutProperties2.default)(props, ["className", "title", "more", "spacing", "bordered", "children"]);

  var _React$useContext = _react.default.useContext(_configProvider.ConfigContext),
      prefixCls = _React$useContext.prefixCls;

  var bem = (0, _bem.createBEM)('panel', {
    prefixCls: prefixCls
  });
  var cls = bem([{
    spacing: spacing,
    bordered: bordered
  }, className]);
  return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({
    className: cls,
    ref: ref
  }, restProps), (title || more) && /*#__PURE__*/_react.default.createElement("div", {
    className: bem('header')
  }, title && /*#__PURE__*/_react.default.createElement("div", {
    className: bem('title')
  }, title), more && /*#__PURE__*/_react.default.createElement("div", {
    className: bem('more')
  }, more)), /*#__PURE__*/_react.default.createElement("div", {
    className: bem('body')
  }, children));
});

Panel.displayName = 'Panel';
Panel.defaultProps = {
  bordered: true,
  spacing: false
};
var _default = Panel;
exports.default = _default;