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;
};
define(["require", "exports", "react", "../../../../Utilities", "../../../../Persona", "../../../../ContextualMenu", "../../../../Button", "../../../../FocusZone", "./PickerItemsDefault.scss"], function (require, exports, React, Utilities_1, Persona_1, ContextualMenu_1, Button_1, FocusZone_1, PickerItemsDefault_scss_1) {
    "use strict";
    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', PickerItemsDefault_scss_1.default.itemContainer) },
                React.createElement(FocusZone_1.FocusZone, { className: Utilities_1.css('ms-PickerPersona-container', PickerItemsDefault_scss_1.default.personaContainer) },
                    React.createElement("div", { className: Utilities_1.css('ms-PickerItem-content', PickerItemsDefault_scss_1.default.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', PickerItemsDefault_scss_1.default.itemContent) },
                        React.createElement(Button_1.IconButton, { icon: 'More', onClick: this.onContextualMenu })),
                    React.createElement("div", { className: Utilities_1.css('ms-PickerItem-content', PickerItemsDefault_scss_1.default.itemContent) },
                        React.createElement(Button_1.IconButton, { icon: '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;
    }(React.Component));
    exports.SelectedItemWithMenu = SelectedItemWithMenu;
});

//# sourceMappingURL=SelectedItemWithMenu.js.map
