import { __assign } from "tslib";
import { Balloon, Button, Icon } from '@alicloud/console-components';
import classnames from 'classnames';
import React from 'react';
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 (React.createElement("div", { style: clearPaddingBottom ? __assign(__assign({}, style), { marginBottom: 0 }) : __assign({}, style), className: classnames('lp-panel', className, {
            'lp-nest-panel': isNest !== undefined ? isNest : nest
        }) },
        title || subTitle || buttons.length > 0 ? (React.createElement("div", { className: "lp-panel-title" },
            title,
            tips && (React.createElement(Balloon, { autoFocus: false, trigger: React.createElement(Icon, { className: "lp-panel-tips-icon", type: "help", size: "small" }), closable: false, align: 't' }, tips)),
            subTitle && React.createElement("div", { className: "lp-panel-subtitle" }, subTitle),
            React.createElement("div", { className: "lp-panel-right" },
                extra && React.createElement("div", { className: "lp-panel-right-extra" }, extra),
                buttons.map(function (item, index) {
                    var className = classnames('lp-panel-right-button', item.className);
                    return (React.createElement(Button, __assign({ key: 'button' + index, className: className }, item), item.title));
                }),
                rightExtra && (React.createElement("div", { className: "lp-panel-right-extra" }, rightExtra))))) : null,
        children &&
            React.Children.map(children, function (child) {
                return React.isValidElement(child)
                    ? React.cloneElement(child, {
                        nest: 1
                    })
                    : child;
            })));
}
export default Panel;
