"use strict";
var __extends = (this && this.__extends) || function (d, b) {
    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var __assign = (this && this.__assign) || Object.assign || function(t) {
    for (var s, i = 1, n = arguments.length; i < n; i++) {
        s = arguments[i];
        for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
            t[p] = s[p];
    }
    return t;
};
var React = require('react');
var Persona_1 = require('../../Persona');
require('./Facepile.scss');
var properties_1 = require('../../utilities/properties');
var Facepile = (function (_super) {
    __extends(Facepile, _super);
    function Facepile() {
        _super.apply(this, arguments);
    }
    Facepile.prototype.render = function () {
        var _this = this;
        return (React.createElement("div", {className: 'ms-Facepile'}, 
            React.createElement("div", {className: 'ms-Facepile-members'}, this.props.personas.map(function (persona, index) {
                var personaControl = _this._getPersonaControl(persona);
                return persona.onClick ?
                    _this._getElementWithOnClickEvent(personaControl, persona, index) :
                    _this._getElementWithoutOnClickEvent(personaControl, persona, index);
            }))
        ));
    };
    Facepile.prototype._getPersonaControl = function (persona) {
        return React.createElement(Persona_1.Persona, {imageInitials: persona.imageInitials, imageUrl: persona.imageUrl, initialsColor: persona.initialsColor, primaryText: persona.personaName, size: Persona_1.PersonaSize.extraSmall, hidePersonaDetails: true});
    };
    Facepile.prototype._getElementWithOnClickEvent = function (personaControl, persona, index) {
        return React.createElement("button", __assign({}, properties_1.getNativeProps(persona, properties_1.buttonProperties), {className: 'ms-Facepile-itemBtn ms-Facepile-itemBtn--member', title: persona.personaName, key: index, onClick: this._onPersonaClick.bind(this, persona), onMouseMove: this._onPersonaMouseMove.bind(this, persona), onMouseOut: this._onPersonaMouseOut.bind(this, persona)}), personaControl);
    };
    Facepile.prototype._getElementWithoutOnClickEvent = function (personaControl, persona, index) {
        return React.createElement("div", __assign({}, properties_1.getNativeProps(persona, properties_1.divProperties), {className: 'ms-Facepile-itemBtn ms-Facepile-itemBtn--member', title: persona.personaName, key: index, onMouseMove: this._onPersonaMouseMove.bind(this, persona), onMouseOut: this._onPersonaMouseOut.bind(this, persona)}), personaControl);
    };
    Facepile.prototype._onPersonaClick = function (persona, ev) {
        persona.onClick(ev, persona);
        ev.preventDefault();
        ev.stopPropagation();
    };
    Facepile.prototype._onPersonaMouseMove = function (persona, ev) {
        if (!!persona.onMouseMove) {
            persona.onMouseMove(ev, persona);
        }
    };
    Facepile.prototype._onPersonaMouseOut = function (persona, ev) {
        if (!!persona.onMouseOut) {
            persona.onMouseOut(ev, persona);
        }
    };
    return Facepile;
}(React.Component));
exports.Facepile = Facepile;

//# sourceMappingURL=Facepile.js.map
