"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PanelToolPanel = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const Panel_1 = tslib_1.__importDefault(require("../../../../components/Panel"));
const ButtonClose_1 = require("../../Buttons/ButtonClose");
const ButtonConfigure_1 = require("../../Buttons/ButtonConfigure");
const ButtonMinimise_1 = require("../../Buttons/ButtonMinimise");
const rebass_1 = require("rebass");
const join_1 = tslib_1.__importDefault(require("../../../../components/utils/join"));
const ButtonMaximise_1 = require("../../Buttons/ButtonMaximise");
class PanelToolPanel extends React.Component {
    render() {
        const { useDefaultPanelStyle, isMinimised, onMinimiseChanged, headerText, onClose, onConfigure, ...props } = this.props;
        let header = (React.createElement(React.Fragment, null,
            !isMinimised ? (React.createElement(ButtonMinimise_1.ButtonMinimise, { className: "ab-ToolPanelPanel__header-minimise", onClick: () => onMinimiseChanged(), marginRight: 1 })) : (React.createElement(ButtonMaximise_1.ButtonMaximise, { className: "ab-ToolPanelPanel__header-maximise", onClick: () => onMinimiseChanged(), marginRight: 1 })),
            React.createElement(rebass_1.Flex, { className: "ab-ToolPanelPanel__header-text", flex: 1, alignItems: "center", marginLeft: 0 }, headerText),
            onConfigure && (React.createElement(ButtonConfigure_1.ButtonConfigure, { iconSize: 16, marginLeft: 1, className: "ab-ToolPanelPanel__header-configure-button", tooltip: 'Configure ' + headerText, onClick: () => onConfigure() })),
            onClose && (React.createElement(ButtonClose_1.ButtonClose, { marginLeft: 0, className: "ab-ToolPanelPanel__header-close-button", tooltip: 'Close ' + headerText, onClick: () => onClose(), disabled: props.disabled }))));
        return (React.createElement(Panel_1.default, { border: "var(--ab-cmp-toolpanelpanel__border)", ...props, className: (0, join_1.default)('ab-ToolPanelPanel', props.className), header: header, style: {
                color: 'var(--ab-cmp-toolpanelpanel__color)',
                fill: 'var(--ab-cmp-toolpanelpanel__fill)',
                ...props.style,
            }, headerProps: {
                ...props.headerProps,
                alignItems: 'stretch',
                style: {
                    padding: 'var(--ab-cmp-toolpanelpanel_header__padding)',
                    background: 'var(--ab-cmp-toolpanelpanel_header__background)',
                    color: 'var(--ab-cmp-toolpanelpanel_header__color)',
                    fill: 'var(--ab-cmp-toolpanelpanel_header__fill)',
                    ...(props.headerProps ? props.headerProps.style : null),
                },
            }, bodyProps: {
                ...props.bodyProps,
                style: {
                    padding: 'var(--ab-cmp-dashboardpanel_body__padding)',
                    background: 'var(--ab-cmp-dashboardpanel_body__background)',
                    ...(props.bodyProps ? props.bodyProps.style : null),
                    display: 'flex',
                    flexDirection: 'column',
                },
            } }));
    }
}
exports.PanelToolPanel = PanelToolPanel;
PanelToolPanel.defaultProps = {
    headerText: '',
    onClose: null,
    onConfigure: null,
    onMinimiseChanged: null,
    isMinimised: true,
};
