import { __rest } from '../../_virtual/_tslib.js';
import React__default, { forwardRef } from 'react';
import Close from '../../icons/Close.js';
import { getId } from '../../utils/index.js';
import { Button } from '../Button/index.js';
import { IconButton } from '../IconButton/index.js';
import { Wrapper, IconWrapper, Container, Title, Content, Actions, CloseIcon } from './styles.js';
import { getIcon } from './utils.js';

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

export { MessagingContent, MessagingContentComponent };
