'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var _tslib = require('../../_virtual/_tslib.js');
var React = require('react');
var Close = require('../../icons/Close.js');
var index = require('../../utils/index.js');
var index$1 = require('../Button/index.js');
var index$2 = require('../IconButton/index.js');
var styles = require('./styles.js');
var utils = require('./utils.js');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var React__default = /*#__PURE__*/_interopDefaultLegacy(React);

function MessagingContentComponent(_a, ref) {
    var { dismissAction, primaryAction, variant, compact, showClose, title, onClose, children, className, componentName = 'banner' } = _a, props = _tslib.__rest(_a, ["dismissAction", "primaryAction", "variant", "compact", "showClose", "title", "onClose", "children", "className", "componentName"]);
    const showActions = primaryAction || dismissAction;
    const icon = utils.getIcon(props.icon, variant);
    const appendTestId = index.getId(props['data-testid']);
    return (React__default['default'].createElement(styles.Wrapper, { variant: variant, componentName: componentName, className: className, role: "alert", "data-testid": props['data-testid'], "data-trackid": props['data-trackid'], ref: ref },
        icon && (React__default['default'].createElement(styles.IconWrapper, { "data-testid": appendTestId('icon') }, icon)),
        React__default['default'].createElement(styles.Container, { compact: compact, "data-testid": appendTestId('container') },
            title && !compact && (React__default['default'].createElement(styles.Title, { "data-testid": appendTestId('title') }, title)),
            React__default['default'].createElement(styles.Content, { "data-testid": appendTestId('content') }, children),
            showActions && (React__default['default'].createElement(styles.Actions, { "data-testid": appendTestId('actions'), compact: compact, showClose: showClose },
                dismissAction && (React__default['default'].createElement(index$1.Button, { variant: "ghost", onClick: dismissAction.onClick, size: "xSmall", "data-testid": appendTestId('secondary-action') }, dismissAction.label)),
                primaryAction && (React__default['default'].createElement(index$1.Button, { variant: "primary", onClick: primaryAction.onClick, size: "xSmall", "data-testid": appendTestId('primary-action') }, primaryAction.label))))),
        showClose && (React__default['default'].createElement(styles.CloseIcon, { compact: compact, "data-testid": appendTestId('close-icon-wrapper') },
            React__default['default'].createElement(index$2.IconButton, { icon: React__default['default'].createElement(Close['default'], null), size: "medium", variant: "ghost-tertiary", onClick: onClose, "data-testid": appendTestId('close-icon-button') })))));
}
const MessagingContent = React.forwardRef(MessagingContentComponent);

exports.MessagingContent = MessagingContent;
exports.MessagingContentComponent = MessagingContentComponent;
