"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PanelWithButton = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const SimpleButton_1 = tslib_1.__importDefault(require("../../../components/SimpleButton"));
const Panel_1 = tslib_1.__importDefault(require("../../../components/Panel"));
const icons_1 = require("../../../components/icons");
const ButtonInfo_1 = require("../Buttons/ButtonInfo");
const tailwind_merge_1 = require("tailwind-merge");
const Flex_1 = require("../../../components/Flex");
const PanelWithButton = (props) => {
    const { buttonContent } = props;
    const IconCmp = icons_1.allIcons[props.glyphicon];
    const header = (React.createElement(Flex_1.Flex, { alignItems: "center", className: "twa:w-full" },
        React.createElement(Flex_1.Flex, { alignItems: "center" },
            props.glyphicon != null && (IconCmp ? React.createElement(IconCmp, null) : null),
            React.createElement(Flex_1.Box, { "data-name": "space-before", className: "twa:mr-2" }),
            props.headerText,
            React.createElement(Flex_1.Box, { "data-name": "space-after", className: "twa:mr-2" }),
            props.infoLink != null && !props.infoLinkDisabled && (React.createElement(ButtonInfo_1.ButtonInfo, { onClick: () => window.open(props.infoLink, '_blank') }))),
        React.createElement(Flex_1.Box, { className: "twa:flex-1" }),
        buttonContent ? (React.createElement(SimpleButton_1.default, { variant: "raised", tone: "accent", disabled: props.buttonDisabled, onClick: () => (props.buttonClick ? props.buttonClick() : null) }, buttonContent)) : null,
        props.button ? React.cloneElement(props.button) : null));
    return (React.createElement(Panel_1.default, { className: (0, tailwind_merge_1.twMerge)('twa:flex-1 twa:rounded-none twa:border-none', props.className), bodyScroll: props.bodyScroll != null ? props.bodyScroll : true, bodyProps: props.bodyProps, variant: props.variant || 'primary', header: header, headerProps: props.headerProps, style: props.style }, props.children));
};
exports.PanelWithButton = PanelWithButton;
