"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ButtonShare = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const SimpleButton_1 = tslib_1.__importDefault(require("../../../components/SimpleButton"));
const AdaptablePopupTeamSharing_1 = require("../Popups/AdaptablePopupTeamSharing");
class ButtonShare extends React.Component {
    constructor(props) {
        super(props);
        this.state = { open: false };
    }
    render() {
        const { onShare, Header, ...buttonProps } = this.props;
        return (React.createElement(React.Fragment, null,
            React.createElement(SimpleButton_1.default, { "data-name": "share", tooltip: "Share", variant: "text", icon: "folder-shared", iconSize: buttonProps.iconSize ?? 24, onClick: () => this.setState({ open: true }), ...buttonProps }),
            this.state.open && (React.createElement(AdaptablePopupTeamSharing_1.AdaptablePopupTeamSharing, { header: Header, showPopup: true, onClose: () => this.setState({ open: false }), onConfirm: (config) => {
                    this.setState({ open: false });
                    onShare(config);
                } }))));
    }
}
exports.ButtonShare = ButtonShare;
