"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var React = require("react");
var Utilities_1 = require("../../Utilities");
var Icon_1 = require("../../Icon");
var Button_1 = require("../../Button");
var Tooltip_1 = require("../../Tooltip");
var getClassNames = Utilities_1.classNamesFunction();
var nullFunction = function () { return null; };
var CrumbBase = /** @class */ (function (_super) {
    tslib_1.__extends(CrumbBase, _super);
    function CrumbBase() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    CrumbBase.prototype.render = function () {
        var _a = this.props, _b = _a.as, RootElement = _b === void 0 ? 'li' : _b, _c = _a.item, item = _c === void 0 ? { text: '', onClick: undefined, href: undefined, isCurrentItem: false } : _c, menuProps = _a.menuProps, theme = _a.theme, withChevron = _a.withChevron, iconProps = _a.iconProps, getStyles = _a.getStyles;
        var classNames = getClassNames(getStyles, { theme: theme, isCurrentItem: !!item.isCurrentItem });
        return (React.createElement(RootElement, { className: classNames.root },
            (item.onClick || item.href || menuProps) ? (React.createElement(Button_1.ActionButton, { className: classNames.crumbButton, href: item.href, "aria-current": item.isCurrentItem ? 'page' : undefined, menuProps: menuProps, onRenderMenuIcon: nullFunction, onClick: this._onClick },
                iconProps && (React.createElement(Icon_1.Icon, tslib_1.__assign({ className: classNames.overflowIcon }, iconProps))),
                item.text && (React.createElement(Tooltip_1.TooltipHost, { className: classNames.textContent, content: item.text, overflowMode: Tooltip_1.TooltipOverflowMode.Self },
                    React.createElement("span", null, item.text))))) : (React.createElement("span", { className: classNames.crumbLabel },
                React.createElement(Tooltip_1.TooltipHost, { className: classNames.textContent, content: item.text, overflowMode: Tooltip_1.TooltipOverflowMode.Self },
                    React.createElement("span", null, item.text)))),
            withChevron && (React.createElement(Icon_1.Icon, { className: classNames.chevron, iconName: Utilities_1.getRTL() ? 'ChevronLeft' : 'ChevronRight' }))));
    };
    CrumbBase.prototype._onClick = function (ev) {
        var item = this.props.item;
        if (item && item.onClick) {
            item.onClick(ev, item);
        }
    };
    tslib_1.__decorate([
        Utilities_1.autobind
    ], CrumbBase.prototype, "_onClick", null);
    CrumbBase = tslib_1.__decorate([
        Utilities_1.customizable('Crumb', ['getStyles', 'theme'])
    ], CrumbBase);
    return CrumbBase;
}(React.Component));
exports.CrumbBase = CrumbBase;
//# sourceMappingURL=Crumb.base.js.map