import _extends from "@babel/runtime/helpers/extends";
import _defineProperty from "@babel/runtime/helpers/defineProperty";
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
import _createClass from "@babel/runtime/helpers/createClass";
import _inherits from "@babel/runtime/helpers/inherits";
import _createSuper from "@babel/runtime/helpers/createSuper";
import * as React from 'react';
import RcCollapse from 'rc-collapse';
import classNames from 'classnames';
import { ConfigConsumer } from '../config-provider';

var CollapsePanel = /*#__PURE__*/function (_React$Component) {
  _inherits(CollapsePanel, _React$Component);

  var _super = _createSuper(CollapsePanel);

  function CollapsePanel() {
    var _this;

    _classCallCheck(this, CollapsePanel);

    _this = _super.apply(this, arguments);

    _this.renderCollapsePanel = function (_ref) {
      var getPrefixCls = _ref.getPrefixCls;
      var _this$props = _this.props,
          customizePrefixCls = _this$props.prefixCls,
          _this$props$className = _this$props.className,
          className = _this$props$className === void 0 ? '' : _this$props$className,
          _this$props$showArrow = _this$props.showArrow,
          showArrow = _this$props$showArrow === void 0 ? true : _this$props$showArrow;
      var prefixCls = getPrefixCls('collapse', customizePrefixCls);
      var collapsePanelClassName = classNames(_defineProperty({}, "".concat(prefixCls, "-no-arrow"), !showArrow), className);
      return /*#__PURE__*/React.createElement(RcCollapse.Panel, _extends({}, _this.props, {
        prefixCls: prefixCls,
        className: collapsePanelClassName
      }));
    };

    return _this;
  }

  _createClass(CollapsePanel, [{
    key: "render",
    value: function render() {
      return /*#__PURE__*/React.createElement(ConfigConsumer, null, this.renderCollapsePanel);
    }
  }]);

  return CollapsePanel;
}(React.Component);

export { CollapsePanel as default };