"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "MenuItem", {
    enumerable: true,
    get: function() {
        return MenuItem;
    }
});
var _react = /*#__PURE__*/ _interop_require_default(require("react"));
var _classnames = /*#__PURE__*/ _interop_require_default(require("classnames"));
var _NavigationDrawertokens = require("../../NavigationDrawer.tokens");
var _MenuItemstyles = require("./MenuItem.styles");
function _interop_require_default(obj) {
    return obj && obj.__esModule ? obj : {
        default: obj
    };
}
var MenuItem = function MenuItem(props) {
    var onClick = props.onClick, href = props.href, target = props.target, disabled = props.disabled, selected = props.selected, icon = props.icon, contentLeft = props.contentLeft, withContentLeft = props.withContentLeft, label = props.label, isOpen = props.isOpen, hasIndicator = props.hasIndicator, counter = props.counter;
    var onMenuClick = typeof onClick === 'function' && !disabled ? onClick : undefined;
    var hasCustomContentLeft = contentLeft && withContentLeft;
    var menuClasses = (0, _classnames.default)(_NavigationDrawertokens.classes.navigationDrawerMenuItem, selected && _NavigationDrawertokens.classes.navigationDrawerMenuItemSelected, disabled && _NavigationDrawertokens.classes.navigationDrawerMenuItemDisabled, hasCustomContentLeft && _NavigationDrawertokens.classes.navigationDrawerMenuItemContentLeft, !withContentLeft && _NavigationDrawertokens.classes.navigationDrawerMenuItemWithoutContentLeft);
    var indicators = /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, hasIndicator && /*#__PURE__*/ _react.default.createElement(_MenuItemstyles.StyledIndicator, {
        className: (0, _classnames.default)(withContentLeft && _NavigationDrawertokens.classes.navigationDrawerMenuIndicator)
    }), counter !== undefined && /*#__PURE__*/ _react.default.createElement(_MenuItemstyles.ExtraCounter, {
        className: (0, _classnames.default)(withContentLeft && _NavigationDrawertokens.classes.navigationDrawerMenuCounter),
        count: counter
    }));
    var contentLeftItem = contentLeft ? /*#__PURE__*/ _react.default.createElement(_MenuItemstyles.ContentLeftWrapper, null, contentLeft, indicators) : null;
    var iconItem = icon ? /*#__PURE__*/ _react.default.createElement(_MenuItemstyles.IconWrapper, null, /*#__PURE__*/ _react.default.createElement(_MenuItemstyles.Icon, null, icon), indicators) : null;
    var menuItemContent = withContentLeft ? /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, contentLeft && contentLeftItem, icon && iconItem, isOpen && /*#__PURE__*/ _react.default.createElement(_MenuItemstyles.Label, null, label)) : /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/ _react.default.createElement(_MenuItemstyles.Label, null, label), /*#__PURE__*/ _react.default.createElement(_MenuItemstyles.RightContentWrapper, null, indicators));
    return typeof onClick === 'function' ? /*#__PURE__*/ _react.default.createElement("div", {
        className: menuClasses,
        onClick: onMenuClick
    }, menuItemContent) : /*#__PURE__*/ _react.default.createElement(_MenuItemstyles.Link, {
        className: (0, _classnames.default)(_NavigationDrawertokens.classes.navigationDrawerMenuLink, menuClasses),
        href: href,
        rel: "noopener noreferrer",
        target: target
    }, menuItemContent);
};
