import * as tslib_1 from "tslib";
import * as React from 'react';
import { BaseComponent, css } from '../../../../Utilities';
import { Persona, PersonaPresence } from '../../../../Persona';
import { ContextualMenu, DirectionalHint } from '../../../../ContextualMenu';
import { IconButton } from '../../../../Button';
import { FocusZone } from '../../../../FocusZone';
import * as stylesImport from './PickerItemsDefault.scss';
var styles = stylesImport;
/**
 * PeoplePickerItem with an additional contextual menu.
 * @deprecated Do not use. Will be removed in Fabric 7.0
 */
var SelectedItemWithMenu = /** @class */ (function (_super) {
    tslib_1.__extends(SelectedItemWithMenu, _super);
    function SelectedItemWithMenu(props) {
        var _this = _super.call(this, props) || this;
        _this._ellipsisRef = React.createRef();
        _this._onContextualMenu = function (ev) {
            _this.setState({ contextualMenuVisible: true });
        };
        _this._onCloseContextualMenu = function (ev) {
            _this.setState({ contextualMenuVisible: false });
        };
        _this.state = { contextualMenuVisible: false };
        return _this;
    }
    SelectedItemWithMenu.prototype.render = function () {
        var _a = this.props, item = _a.item, onRemoveItem = _a.onRemoveItem, removeButtonAriaLabel = _a.removeButtonAriaLabel;
        return (React.createElement("div", { "data-is-focusable": true, className: css('ms-PickerItem-container', styles.itemContainer) },
            React.createElement(FocusZone, { className: css('ms-PickerPersona-container', styles.personaContainer) },
                React.createElement("div", { className: css('ms-PickerItem-content', styles.itemContent) },
                    React.createElement(Persona, tslib_1.__assign({}, item, { presence: item.presence !== undefined ? item.presence : PersonaPresence.none }))),
                React.createElement("div", { ref: this._ellipsisRef, className: css('ms-PickerItem-content', styles.itemContent) },
                    React.createElement(IconButton, { iconProps: { iconName: 'More' }, onClick: this._onContextualMenu })),
                React.createElement("div", { className: css('ms-PickerItem-content', styles.itemContent) },
                    React.createElement(IconButton, { iconProps: { iconName: 'Cancel' }, onClick: onRemoveItem, ariaLabel: removeButtonAriaLabel })),
                this.state.contextualMenuVisible ? (React.createElement(ContextualMenu, { items: item.menuItems, shouldFocusOnMount: true, target: this._ellipsisRef.current, onDismiss: this._onCloseContextualMenu, directionalHint: DirectionalHint.bottomAutoEdge })) : null)));
    };
    return SelectedItemWithMenu;
}(BaseComponent));
export { SelectedItemWithMenu };
//# sourceMappingURL=SelectedItemWithMenu.js.map