"use strict";

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

var _tslib = require("tslib");

var _consoleComponents = require("@alicloud/console-components");

var _classnames = _interopRequireDefault(require("classnames"));

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

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

function Panel(props) {
  var title = props.title,
      children = props.children,
      subTitle = props.subTitle,
      tips = props.tips,
      extra = props.extra,
      _a = props.buttons,
      buttons = _a === void 0 ? [] : _a,
      rightExtra = props.rightExtra,
      className = props.className,
      _b = props.clearPaddingBottom,
      clearPaddingBottom = _b === void 0 ? false : _b,
      isNest = props.isNest,
      nest = props.nest,
      style = props.style;
  return /*#__PURE__*/_react["default"].createElement("div", {
    style: clearPaddingBottom ? (0, _tslib.__assign)((0, _tslib.__assign)({}, style), {
      marginBottom: 0
    }) : (0, _tslib.__assign)({}, style),
    className: (0, _classnames["default"])('lp-panel', className, {
      'lp-nest-panel': isNest !== undefined ? isNest : nest
    })
  }, title || subTitle || buttons.length > 0 ? /*#__PURE__*/_react["default"].createElement("div", {
    className: "lp-panel-title"
  }, title, tips && /*#__PURE__*/_react["default"].createElement(_consoleComponents.Balloon, {
    autoFocus: false,
    trigger: /*#__PURE__*/_react["default"].createElement(_consoleComponents.Icon, {
      className: "lp-panel-tips-icon",
      type: "help",
      size: "small"
    }),
    closable: false,
    align: 't'
  }, tips), subTitle && /*#__PURE__*/_react["default"].createElement("div", {
    className: "lp-panel-subtitle"
  }, subTitle), /*#__PURE__*/_react["default"].createElement("div", {
    className: "lp-panel-right"
  }, extra && /*#__PURE__*/_react["default"].createElement("div", {
    className: "lp-panel-right-extra"
  }, extra), buttons.map(function (item, index) {
    var className = (0, _classnames["default"])('lp-panel-right-button', item.className);
    return /*#__PURE__*/_react["default"].createElement(_consoleComponents.Button, (0, _tslib.__assign)({
      key: 'button' + index,
      className: className
    }, item), item.title);
  }), rightExtra && /*#__PURE__*/_react["default"].createElement("div", {
    className: "lp-panel-right-extra"
  }, rightExtra))) : null, children && _react["default"].Children.map(children, function (child) {
    return /*#__PURE__*/_react["default"].isValidElement(child) ? /*#__PURE__*/_react["default"].cloneElement(child, {
      nest: 1
    }) : child;
  }));
}

var _default = Panel;
exports["default"] = _default;