"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const react_1 = tslib_1.__importDefault(require("react"));
const react_core_1 = require("@patternfly/react-core");
const info_circle_icon_1 = require("@patternfly/react-icons/dist/js/icons/info-circle-icon");
const InfoLinkWithModal = ({ linkText, infoCircleSize = 'sm', modalTitle, modalVariant = 'medium', isInline = false, linkId, modalId, children, }) => {
    const [isModalOpen, setModalOpen] = react_1.default.useState(false);
    const handleModalClose = react_1.default.useCallback(() => setModalOpen(false), []);
    const handleLinkClick = react_1.default.useCallback(() => setModalOpen(true), []);
    const closebuttonId = `${modalId || 'info-link-modal'}__button-close`;
    return (react_1.default.createElement(react_1.default.Fragment, null,
        react_1.default.createElement(react_core_1.Button, { id: linkId, variant: react_core_1.ButtonVariant.link, onClick: handleLinkClick, isInline: true },
            !isInline && (react_1.default.createElement(react_1.default.Fragment, null,
                react_1.default.createElement(react_core_1.Icon, { size: infoCircleSize },
                    react_1.default.createElement(info_circle_icon_1.InfoCircleIcon, null)),
                "\u00A0")),
            linkText),
        react_1.default.createElement(react_core_1.Modal, { id: modalId, isOpen: isModalOpen, onClose: handleModalClose, variant: modalVariant },
            react_1.default.createElement(react_core_1.ModalHeader, { title: modalTitle }),
            react_1.default.createElement(react_core_1.ModalBody, null, children),
            react_1.default.createElement(react_core_1.ModalFooter, null,
                react_1.default.createElement(react_core_1.Button, { id: closebuttonId, key: "close", variant: react_core_1.ButtonVariant.primary, onClick: handleModalClose }, "Close")))));
};
exports.default = InfoLinkWithModal;
//# sourceMappingURL=InfoLinkWithModal.js.map