"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 ButtonMaximise_1 = require("../../Buttons/ButtonMaximise");
const twMerge_1 = require("../../../../twMerge");
const Flex_1 = require("../../../../components/Flex");
class PanelToolPanel extends React.Component {
    static defaultProps = {
        headerText: '',
        onClose: null,
        onConfigure: null,
        onMinimiseChanged: null,
        isMinimised: true,
    };
    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 twa:mr-1", onClick: () => onMinimiseChanged() })) : (React.createElement(ButtonMaximise_1.ButtonMaximise, { className: "ab-ToolPanelPanel__header-maximise twa:mr-1", onClick: () => onMinimiseChanged() })),
            React.createElement(Flex_1.Flex, { className: "ab-ToolPanelPanel__header-text twa:flex-1 twa:ml-0", alignItems: "center" }, headerText),
            onConfigure && (React.createElement(ButtonConfigure_1.ButtonConfigure, { iconSize: 16, className: "ab-ToolPanelPanel__header-configure-button twa:ml-1", tooltip: 'Configure ' + headerText, onClick: () => onConfigure() })),
            onClose && (React.createElement(ButtonClose_1.ButtonClose, { className: "ab-ToolPanelPanel__header-close-button twa:ml-0", tooltip: 'Close ' + headerText, onClick: () => onClose(), disabled: props.disabled }))));
        return (React.createElement(Panel_1.default, { ...props, className: (0, twMerge_1.twMerge)('ab-ToolPanelPanel', props.className), header: header, style: {
                ...props.style,
            }, headerProps: {
                ...props.headerProps,
                alignItems: 'stretch',
                className: (0, twMerge_1.twMerge)('twa:border-none', props.headerProps?.className),
                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,
                className: (0, twMerge_1.twMerge)('twa:border-none twa:flex twa:flex-col', props.bodyProps?.className),
                style: {
                    padding: 'var(--ab-cmp-dashboardpanel_body__padding)',
                    background: 'var(--ab-cmp-dashboardpanel_body__background)',
                    ...(props.bodyProps ? props.bodyProps.style : null),
                },
            } }));
    }
}
exports.PanelToolPanel = PanelToolPanel;
