import * as React from 'react';
import SimpleButton from '../../../components/SimpleButton';
import Panel from '../../../components/Panel';
import { allIcons } from '../../../components/icons';
import { ButtonInfo } from '../Buttons/ButtonInfo';
import { twMerge } from 'tailwind-merge';
import { Box, Flex } from '../../../components/Flex';
export const PanelWithButton = (props) => {
    const { buttonContent } = props;
    const IconCmp = allIcons[props.glyphicon];
    const header = (React.createElement(Flex, { alignItems: "center", className: "twa:w-full" },
        React.createElement(Flex, { alignItems: "center" },
            props.glyphicon != null && (IconCmp ? React.createElement(IconCmp, null) : null),
            React.createElement(Box, { "data-name": "space-before", className: "twa:mr-2" }),
            props.headerText,
            React.createElement(Box, { "data-name": "space-after", className: "twa:mr-2" }),
            props.infoLink != null && !props.infoLinkDisabled && (React.createElement(ButtonInfo, { onClick: () => window.open(props.infoLink, '_blank') }))),
        React.createElement(Box, { className: "twa:flex-1" }),
        buttonContent ? (React.createElement(SimpleButton, { 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, { className: 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));
};
