'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 __());
    };
})();
import React from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import { Button } from './Button';
import { Icon } from './Icon';
import lang from '../../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.createElement(Button, { iconOnly: true, bsStyle: "link", className: "rc-banner-close-button", testAutomationId: "closeButton", onClick: this.props.onClose, "aria-label": this.props.closeLabel },
            React.createElement(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('rc-banner', className);
        var arrowStyle = {
            left: arrowColsOffset !== null ? (100 / 12) * arrowColsOffset + '%' : arrowOffset,
            marginLeft: additionalOffset
        };
        return (React.createElement("div", { className: "rc-banner-wrap" },
            React.createElement("div", { className: "rc-banner-triangle-top", style: arrowStyle },
                React.createElement("div", { className: "rc-banner-triangle-inner" },
                    React.createElement("div", { className: "rc-banner-triangle-border" }),
                    React.createElement("div", { className: "rc-banner-triangle-fill" }))),
            this.getCloseButton(),
            React.createElement("div", { className: classNames }, children)));
    };
    Banner.propTypes = {
        arrowOffset: PropTypes.string,
        arrowColsOffset: PropTypes.number,
        additionalOffset: PropTypes.number,
        closable: PropTypes.bool,
        closeLabel: PropTypes.string,
        onClose: PropTypes.func,
        children: PropTypes.node,
        className: PropTypes.string
    };
    Banner.defaultProps = {
        arrowOffset: '50%',
        arrowColsOffset: 0,
        additionalOffset: 0,
        closable: false,
        get closeLabel() {
            return lang.CLOSE;
        },
        onClose: null,
        children: null,
        className: null
    };
    return Banner;
}(React.Component));
export { Banner };
//# sourceMappingURL=Banner.js.map