"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
    return function (d, b) {
        extendStatics(d, b);
        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;
};
Object.defineProperty(exports, "__esModule", { value: true });
/* tslint:disable */
var React = require("react");
/* tslint:enable */
var Utilities_1 = require("../../../../Utilities");
var Persona_1 = require("../../../../Persona");
var ContextualMenu_1 = require("../../../../ContextualMenu");
var Button_1 = require("../../../../Button");
var FocusZone_1 = require("../../../../FocusZone");
var styles = require("./PickerItemsDefault.scss");
var SelectedItemWithMenu = (function (_super) {
    __extends(SelectedItemWithMenu, _super);
    function SelectedItemWithMenu(props) {
        var _this = _super.call(this, props) || this;
        _this.onContextualMenu = _this.onContextualMenu.bind(_this);
        _this._onCloseContextualMenu = _this._onCloseContextualMenu.bind(_this);
        _this.state = { contextualMenuVisible: false };
        return _this;
    }
    SelectedItemWithMenu.prototype.render = function () {
        var _a = this.props, item = _a.item, onRemoveItem = _a.onRemoveItem;
        return (React.createElement("div", { "data-is-focusable": true, className: Utilities_1.css('ms-PickerItem-container', styles.itemContainer) },
            React.createElement(FocusZone_1.FocusZone, { className: Utilities_1.css('ms-PickerPersona-container', styles.personaContainer) },
                React.createElement("div", { className: Utilities_1.css('ms-PickerItem-content', styles.itemContent) },
                    React.createElement(Persona_1.Persona, __assign({}, item, { presence: item.presence !== undefined ? item.presence : Persona_1.PersonaPresence.none }))),
                React.createElement("div", { ref: 'ellipsisRef', className: Utilities_1.css('ms-PickerItem-content', styles.itemContent) },
                    React.createElement(Button_1.IconButton, { iconProps: { iconName: 'More' }, onClick: this.onContextualMenu })),
                React.createElement("div", { className: Utilities_1.css('ms-PickerItem-content', styles.itemContent) },
                    React.createElement(Button_1.IconButton, { iconProps: { iconName: 'Cancel' }, onClick: onRemoveItem })),
                this.state.contextualMenuVisible ? (React.createElement(ContextualMenu_1.ContextualMenu, { items: item.menuItems, shouldFocusOnMount: true, targetElement: this.refs.ellipsisRef, onDismiss: this._onCloseContextualMenu, directionalHint: ContextualMenu_1.DirectionalHint.bottomAutoEdge }))
                    : null)));
    };
    SelectedItemWithMenu.prototype.onContextualMenu = function (ev) {
        this.setState({ contextualMenuVisible: true });
    };
    SelectedItemWithMenu.prototype._onCloseContextualMenu = function (ev) {
        this.setState({ contextualMenuVisible: false });
    };
    return SelectedItemWithMenu;
}(Utilities_1.BaseComponent));
exports.SelectedItemWithMenu = SelectedItemWithMenu;

//# sourceMappingURL=SelectedItemWithMenu.js.map
