"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "MenuItem", {
    enumerable: true,
    get: function() {
        return MenuItem;
    }
});
const _react = /*#__PURE__*/ _interop_require_default(require("react"));
const _classnames = /*#__PURE__*/ _interop_require_default(require("classnames"));
const _NavigationDrawertokens = require("../../NavigationDrawer.tokens");
const _MenuItemstyles = require("./MenuItem.styles");
function _interop_require_default(obj) {
    return obj && obj.__esModule ? obj : {
        default: obj
    };
}
const MenuItem = (props)=>{
    const { onClick, href, target, disabled, selected, icon, contentLeft, withContentLeft, label, isOpen, hasIndicator, counter } = props;
    const onMenuClick = typeof onClick === 'function' && !disabled ? onClick : undefined;
    const hasCustomContentLeft = contentLeft && withContentLeft;
    const menuClasses = (0, _classnames.default)(_NavigationDrawertokens.classes.navigationDrawerMenuItem, selected && _NavigationDrawertokens.classes.navigationDrawerMenuItemSelected, disabled && _NavigationDrawertokens.classes.navigationDrawerMenuItemDisabled, hasCustomContentLeft && _NavigationDrawertokens.classes.navigationDrawerMenuItemContentLeft, !withContentLeft && _NavigationDrawertokens.classes.navigationDrawerMenuItemWithoutContentLeft);
    const 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
    }));
    const contentLeftItem = contentLeft ? /*#__PURE__*/ _react.default.createElement(_MenuItemstyles.ContentLeftWrapper, null, contentLeft, indicators) : null;
    const iconItem = icon ? /*#__PURE__*/ _react.default.createElement(_MenuItemstyles.IconWrapper, null, /*#__PURE__*/ _react.default.createElement(_MenuItemstyles.Icon, null, icon), indicators) : null;
    const 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);
};
