"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var React = require("react");
var Utilities_1 = require("../../Utilities");
var Tooltip_1 = require("../../Tooltip");
var PersonaCoin_1 = require("./PersonaCoin");
var Persona_types_1 = require("./Persona.types");
var PersonaConsts_1 = require("./PersonaConsts");
var stylesImport = require("./Persona.scss");
var styles = stylesImport;
var Persona = /** @class */ (function (_super) {
    tslib_1.__extends(Persona, _super);
    function Persona(props) {
        return _super.call(this, props) || this;
    }
    Persona.prototype.render = function () {
        var _a = this.props, hidePersonaDetails = _a.hidePersonaDetails, onRenderPrimaryText = _a.onRenderPrimaryText, onRenderSecondaryText = _a.onRenderSecondaryText, onRenderTertiaryText = _a.onRenderTertiaryText, onRenderOptionalText = _a.onRenderOptionalText;
        var size = this.props.size;
        // These properties are to be explicitly passed into PersonaCoin because they are the only props directly used
        var _b = this.props, className = _b.className, coinProps = _b.coinProps, coinSize = _b.coinSize, imageUrl = _b.imageUrl, imageAlt = _b.imageAlt, imageInitials = _b.imageInitials, initialsColor = _b.initialsColor, presence = _b.presence, primaryText = _b.primaryText, imageShouldFadeIn = _b.imageShouldFadeIn, imageShouldStartVisible = _b.imageShouldStartVisible, showSecondaryText = _b.showSecondaryText, onPhotoLoadingStateChange = _b.onPhotoLoadingStateChange, onRenderCoin = _b.onRenderCoin;
        var personaCoinProps = {
            coinProps: coinProps,
            coinSize: coinSize,
            imageUrl: imageUrl,
            imageAlt: imageAlt,
            imageInitials: imageInitials,
            initialsColor: initialsColor,
            presence: presence,
            primaryText: primaryText,
            imageShouldFadeIn: imageShouldFadeIn,
            imageShouldStartVisible: imageShouldStartVisible,
            size: size,
            onPhotoLoadingStateChange: onPhotoLoadingStateChange,
            onRenderCoin: onRenderCoin
        };
        var divProps = Utilities_1.getNativeProps(this.props, Utilities_1.divProperties);
        var personaDetails = (React.createElement("div", { className: Utilities_1.css('ms-Persona-details', styles.details) },
            this._renderElement(this.props.primaryText, Utilities_1.css('ms-Persona-primaryText', styles.primaryText), onRenderPrimaryText),
            this._renderElement(this.props.secondaryText, Utilities_1.css('ms-Persona-secondaryText', styles.secondaryText), onRenderSecondaryText),
            this._renderElement(this.props.tertiaryText, Utilities_1.css('ms-Persona-tertiaryText', styles.tertiaryText), onRenderTertiaryText),
            this._renderElement(this.props.optionalText, Utilities_1.css('ms-Persona-optionalText', styles.optionalText), onRenderOptionalText),
            this.props.children));
        return (React.createElement("div", tslib_1.__assign({}, divProps, { className: Utilities_1.css('ms-Persona', styles.root, className, PersonaConsts_1.PERSONA_SIZE[size], PersonaConsts_1.PERSONA_PRESENCE[presence], showSecondaryText && styles.showSecondaryText), style: coinSize ? { height: coinSize, minWidth: coinSize } : undefined }),
            React.createElement(PersonaCoin_1.PersonaCoin, tslib_1.__assign({}, personaCoinProps)),
            (!hidePersonaDetails || (size === Persona_types_1.PersonaSize.size10 || size === Persona_types_1.PersonaSize.tiny)) && personaDetails));
    };
    Persona.prototype._renderElement = function (text, className, render) {
        return (React.createElement("div", { className: className }, render
            ? render(this.props)
            : text && (React.createElement(Tooltip_1.TooltipHost, { content: text, overflowMode: Tooltip_1.TooltipOverflowMode.Parent, directionalHint: 0 /* topLeftEdge */ }, text))));
    };
    Persona.defaultProps = {
        primaryText: '',
        size: Persona_types_1.PersonaSize.size48,
        presence: Persona_types_1.PersonaPresence.none,
        imageAlt: ''
    };
    tslib_1.__decorate([
        Utilities_1.autobind
    ], Persona.prototype, "_renderElement", null);
    return Persona;
}(Utilities_1.BaseComponent));
exports.Persona = Persona;
//# sourceMappingURL=Persona.js.map