'use strict';
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var react_1 = __importDefault(require("react"));
var prop_types_1 = __importDefault(require("prop-types"));
var classnames_1 = __importDefault(require("classnames"));
var Button_1 = require("./Button");
var Icon_1 = require("./Icon");
var index_en_US_1 = __importDefault(require("../../lang/common/index-en_US"));
var Banner = /** @class */ (function (_super) {
    __extends(Banner, _super);
    function Banner() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Banner.prototype.getCloseButton = function () {
        if (!this.props.closable) {
            return null;
        }
        return (react_1.default.createElement(Button_1.Button, { iconOnly: true, bsStyle: "link", className: "rc-banner-close-button", testAutomationId: "closeButton", onClick: this.props.onClose, "aria-label": this.props.closeLabel },
            react_1.default.createElement(Icon_1.Icon, { name: "close" })));
    };
    Banner.prototype.render = function () {
        var _a = this.props, children = _a.children, className = _a.className, arrowOffset = _a.arrowOffset, arrowColsOffset = _a.arrowColsOffset, additionalOffset = _a.additionalOffset;
        if (arrowColsOffset > 11 || arrowColsOffset < 0) {
            // eslint-disable-next-line
            console.error('arrowColsOffset must be between 1 and 11');
        }
        var classNames = classnames_1.default('rc-banner', className);
        var arrowStyle = {
            left: arrowColsOffset !== null ? (100 / 12) * arrowColsOffset + '%' : arrowOffset,
            marginLeft: additionalOffset
        };
        return (react_1.default.createElement("div", { className: "rc-banner-wrap" },
            react_1.default.createElement("div", { className: "rc-banner-triangle-top", style: arrowStyle },
                react_1.default.createElement("div", { className: "rc-banner-triangle-inner" },
                    react_1.default.createElement("div", { className: "rc-banner-triangle-border" }),
                    react_1.default.createElement("div", { className: "rc-banner-triangle-fill" }))),
            this.getCloseButton(),
            react_1.default.createElement("div", { className: classNames }, children)));
    };
    Banner.propTypes = {
        arrowOffset: prop_types_1.default.string,
        arrowColsOffset: prop_types_1.default.number,
        additionalOffset: prop_types_1.default.number,
        closable: prop_types_1.default.bool,
        closeLabel: prop_types_1.default.string,
        onClose: prop_types_1.default.func,
        children: prop_types_1.default.node,
        className: prop_types_1.default.string
    };
    Banner.defaultProps = {
        arrowOffset: '50%',
        arrowColsOffset: 0,
        additionalOffset: 0,
        closable: false,
        get closeLabel() {
            return index_en_US_1.default.CLOSE;
        },
        onClose: null,
        children: null,
        className: null
    };
    return Banner;
}(react_1.default.Component));
exports.Banner = Banner;
//# sourceMappingURL=Banner.js.map