"use strict";
/**
 * @file Alert2
 * @author fex
 */
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var React = require("react");
var theme_1 = require("../theme");
var Alert = /** @class */ (function (_super) {
    tslib_1.__extends(Alert, _super);
    function Alert(props) {
        var _this = _super.call(this, props) || this;
        _this.handleClick = _this.handleClick.bind(_this);
        _this.state = {
            show: true,
        };
        return _this;
    }
    Alert.prototype.handleClick = function () {
        this.setState({
            show: false,
        }, this.props.onClose);
    };
    Alert.prototype.render = function () {
        var _a = this.props, cx = _a.classnames, className = _a.className, level = _a.level, children = _a.children, showCloseButton = _a.showCloseButton;
        return this.state.show ? (React.createElement("div", { className: cx('Alert', level ? "Alert--" + level : '', className) },
            showCloseButton ? (React.createElement("button", { className: cx('Alert-close'), onClick: this.handleClick, type: "button" },
                React.createElement("span", null, "\u00D7"))) : null,
            children)) : null;
    };
    Alert.defaultProps = {
        level: 'info',
        className: '',
        showCloseButton: false,
    };
    Alert.propsList = ['level', 'className', 'showCloseButton', 'onClose'];
    return Alert;
}(React.Component));
exports.Alert = Alert;
exports.default = theme_1.themeable(Alert);
//# sourceMappingURL=./components/Alert2.js.map
