import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
import { createBEM } from '@zarm-design/bem';
import React from 'react';
import { ConfigContext } from '../config-provider';
var Panel = /*#__PURE__*/React.forwardRef(function (props, ref) {
  var className = props.className,
      title = props.title,
      more = props.more,
      spacing = props.spacing,
      bordered = props.bordered,
      children = props.children,
      restProps = _objectWithoutProperties(props, ["className", "title", "more", "spacing", "bordered", "children"]);

  var _React$useContext = React.useContext(ConfigContext),
      prefixCls = _React$useContext.prefixCls;

  var bem = createBEM('panel', {
    prefixCls: prefixCls
  });
  var cls = bem([{
    spacing: spacing,
    bordered: bordered
  }, className]);
  return /*#__PURE__*/React.createElement("div", _extends({
    className: cls,
    ref: ref
  }, restProps), (title || more) && /*#__PURE__*/React.createElement("div", {
    className: bem('header')
  }, title && /*#__PURE__*/React.createElement("div", {
    className: bem('title')
  }, title), more && /*#__PURE__*/React.createElement("div", {
    className: bem('more')
  }, more)), /*#__PURE__*/React.createElement("div", {
    className: bem('body')
  }, children));
});
Panel.displayName = 'Panel';
Panel.defaultProps = {
  bordered: true,
  spacing: false
};
export default Panel;