"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.MESSAGE_ICONS_MAP = void 0;
exports.MessageWrapper = MessageWrapper;
const react_1 = __importDefault(require("react"));
const utils_1 = require("./utils");
const Icons_1 = require("../../components/Icons");
const UIIcon_1 = require("../../components/UIIcon");
require("./MessageWrapper.scss");
exports.MESSAGE_ICONS_MAP = new Map([
    [undefined, Icons_1.UiIcons.Error],
    ["Error" /* ErrorMessageType.Error */, Icons_1.UiIcons.Error],
    ["Warning" /* ErrorMessageType.Warning */, Icons_1.UiIcons.Warning],
    ["Info" /* ErrorMessageType.Info */, Icons_1.UiIcons.Info]
]);
/**
 * Method return MessageWrapper react element.
 *
 * @param props
 * @returns {React.ReactElement}
 */
function MessageWrapper(props) {
    const { children, message } = props;
    const errorSuffix = message.message ? utils_1.MESSAGE_TYPES_CLASSNAME_MAP.get(message.type) : undefined;
    const icon = exports.MESSAGE_ICONS_MAP.get(message.type);
    return (react_1.default.createElement("div", { className: `ts-message-wrapper ts-message-wrapper--${errorSuffix}` },
        react_1.default.createElement("div", { className: "ts-message-target" }, children),
        react_1.default.createElement("div", { className: "ts-message-body" },
            react_1.default.createElement(UIIcon_1.UIIcon, { iconName: icon }),
            react_1.default.createElement("span", null, message.message))));
}
//# sourceMappingURL=MessageWrapper.js.map