(function (factory) {
    if (typeof module === "object" && typeof module.exports === "object") {
        var v = factory(require, exports);
        if (v !== undefined) module.exports = v;
    }
    else if (typeof define === "function" && define.amd) {
        define(["require", "exports", "tslib", "@greenatom/icons", "react", "../Label", "../typography/P2", "./styles"], factory);
    }
})(function (require, exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var tslib_1 = require("tslib");
    var icons_1 = require("@greenatom/icons");
    var react_1 = (0, tslib_1.__importStar)(require("react"));
    var Label_1 = (0, tslib_1.__importDefault)(require("../Label"));
    var P2_1 = (0, tslib_1.__importDefault)(require("../typography/P2"));
    var styles_1 = require("./styles");
    var InfoCardComponent = function (_a) {
        var label = _a.label, message = _a.message, onCloseClick = _a.onCloseClick, _b = _a.size, size = _b === void 0 ? "l" : _b, _c = _a.moreButtonText, moreButtonText = _c === void 0 ? "Подробнее" : _c, _d = _a.collapseButtonText, collapseButtonText = _d === void 0 ? "Свернуть" : _d, status = _a.status, width = _a.width, isClosableIcon = _a.isClosableIcon;
        var _e = (0, tslib_1.__read)((0, react_1.useState)(false), 2), showMessage = _e[0], toggleMessage = _e[1];
        var messageToggler = function () {
            toggleMessage(function (previousValue) { return !previousValue; });
        };
        return (react_1.default.createElement(styles_1.StyledInfoCard, { size: size, status: status, showMessage: showMessage, "$width": width },
            react_1.default.createElement(styles_1.InfoCardHeader, null,
                react_1.default.createElement(Label_1.default, { status: status, size: size === "l" ? "m" : "s", isIcon: true }, label),
                isClosableIcon && (react_1.default.createElement(styles_1.CloseIconStyle, { size: "xs", viewType: "ghost", icon: react_1.default.createElement(icons_1.IconBrokenCloseCircle, { width: 16, height: 16 }), onClick: onCloseClick }))),
            showMessage && (react_1.default.createElement(styles_1.MessageHolder, { showMessage: showMessage, size: size }, message)),
            react_1.default.createElement(styles_1.ButtonsStyled, { showMessage: showMessage, viewType: "link", size: "xs", sizeInfoCard: size, className: "textToggler", onClick: messageToggler },
                react_1.default.createElement(P2_1.default, { type: "cetus" }, showMessage ? collapseButtonText : moreButtonText))));
    };
    exports.default = InfoCardComponent;
});
