"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var React = require("react");
var ContextualMenu_1 = require("office-ui-fabric-react/lib/ContextualMenu");
var Button_1 = require("office-ui-fabric-react/lib/Button");
var FocusZone_1 = require("office-ui-fabric-react/lib/FocusZone");
var Utilities_1 = require("office-ui-fabric-react/lib/Utilities");
require("./ContextualMenuExample.scss");
var ContextualMenuCustomizationExample = (function (_super) {
    tslib_1.__extends(ContextualMenuCustomizationExample, _super);
    function ContextualMenuCustomizationExample() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    ContextualMenuCustomizationExample.prototype.render = function () {
        var _this = this;
        return (React.createElement(Button_1.DefaultButton, { componentRef: function (button) { return _this._button = button; }, className: 'ContextualMenuButton3', text: 'Click for ContextualMenu', menuProps: {
                shouldFocusOnMount: false,
                directionalHint: ContextualMenu_1.DirectionalHint.bottomLeftEdge,
                className: 'ms-ContextualMenu-customizationExample',
                items: [
                    {
                        key: 'newItem',
                        name: 'New'
                    },
                    {
                        key: 'upload',
                        name: 'Upload'
                    },
                    {
                        key: 'divider_1',
                        itemType: ContextualMenu_1.ContextualMenuItemType.Divider
                    },
                    {
                        key: 'charm',
                        name: 'Charm',
                        className: 'Charm-List',
                        subMenuProps: {
                            arrowDirection: FocusZone_1.FocusZoneDirection.bidirectional,
                            items: [
                                {
                                    key: 'none',
                                    name: 'None'
                                },
                                {
                                    key: 'bulb',
                                    name: 'Lightbulb',
                                    onRender: this._renderCharmMenuItem,
                                    className: 'ms-ContextualMenu-customizationExample-item'
                                },
                                {
                                    key: 'run',
                                    name: 'Running',
                                    onRender: this._renderCharmMenuItem,
                                    className: 'ms-ContextualMenu-customizationExample-item'
                                },
                                {
                                    key: 'plane',
                                    name: 'Airplane',
                                    onRender: this._renderCharmMenuItem,
                                    className: 'ms-ContextualMenu-customizationExample-item'
                                },
                                {
                                    key: 'page',
                                    name: 'Page',
                                    onRender: this._renderCharmMenuItem,
                                    className: 'ms-ContextualMenu-customizationExample-item'
                                },
                                {
                                    key: 'cake',
                                    name: 'Cake',
                                    onRender: this._renderCharmMenuItem,
                                    className: 'ms-ContextualMenu-customizationExample-item'
                                },
                                {
                                    key: 'soccer',
                                    name: 'Soccer',
                                    onRender: this._renderCharmMenuItem,
                                    className: 'ms-ContextualMenu-customizationExample-item'
                                },
                                {
                                    key: 'home',
                                    name: 'Home',
                                    onRender: this._renderCharmMenuItem,
                                    className: 'ms-ContextualMenu-customizationExample-item'
                                },
                                {
                                    key: 'emoji',
                                    name: 'Emoji2',
                                    onRender: this._renderCharmMenuItem,
                                    className: 'ms-ContextualMenu-customizationExample-item'
                                },
                                {
                                    key: 'work',
                                    name: 'Work',
                                    onRender: this._renderCharmMenuItem,
                                    className: 'ms-ContextualMenu-customizationExample-item'
                                },
                                {
                                    key: 'coffee',
                                    name: 'Coffee',
                                    onRender: this._renderCharmMenuItem,
                                    className: 'ms-ContextualMenu-customizationExample-item'
                                },
                                {
                                    key: 'people',
                                    name: 'People',
                                    onRender: this._renderCharmMenuItem,
                                    className: 'ms-ContextualMenu-customizationExample-item'
                                },
                                {
                                    key: 'stopwatch',
                                    name: 'Stopwatch',
                                    onRender: this._renderCharmMenuItem,
                                    className: 'ms-ContextualMenu-customizationExample-item'
                                },
                                {
                                    key: 'music',
                                    name: 'MusicInCollectionFill',
                                    onRender: this._renderCharmMenuItem,
                                    className: 'ms-ContextualMenu-customizationExample-item'
                                },
                                {
                                    key: 'lock',
                                    name: 'Lock',
                                    onRender: this._renderCharmMenuItem,
                                    className: 'ms-ContextualMenu-customizationExample-item'
                                }
                            ]
                        },
                    },
                    {
                        key: 'categories',
                        name: 'Categorize',
                        subMenuProps: {
                            items: [
                                {
                                    key: 'categories',
                                    name: 'categories',
                                    categoryList: [
                                        {
                                            name: 'Personal',
                                            color: 'yellow'
                                        },
                                        {
                                            name: 'Work',
                                            color: 'green'
                                        },
                                        {
                                            name: 'Birthday',
                                            color: 'blue'
                                        },
                                        {
                                            name: 'Spam',
                                            color: 'grey'
                                        },
                                        {
                                            name: 'Urgent',
                                            color: 'red'
                                        },
                                        {
                                            name: 'Hobbies',
                                            color: 'black'
                                        },
                                    ],
                                    onRender: this._renderCategoriesList
                                },
                                {
                                    key: 'divider_1',
                                    itemType: ContextualMenu_1.ContextualMenuItemType.Divider
                                },
                                {
                                    key: 'clear',
                                    name: 'Clear categories'
                                },
                                {
                                    key: 'manage',
                                    name: 'Manage categories'
                                }
                            ]
                        },
                    }
                ]
            } }));
    };
    ContextualMenuCustomizationExample.prototype._dismissMenu = function () {
        if (this._button) {
            this._button.dismissMenu();
        }
    };
    ContextualMenuCustomizationExample.prototype._renderCharmMenuItem = function (item) {
        return (React.createElement(Button_1.IconButton, { iconProps: { iconName: item.name }, className: 'ms-ContextualMenu-customizationExample-icon ms-ContextualMenu-link', "data-is-focusable": true, onClick: this._dismissMenu }));
    };
    ContextualMenuCustomizationExample.prototype._renderCategoriesList = function (item) {
        return (React.createElement("ul", { className: 'ms-ContextualMenu-customizationExample-categoriesList' },
            React.createElement("li", { className: 'ms-ContextualMenu-item' }, item.categoryList.map(function (category) {
                return React.createElement("button", { className: 'ms-ContextualMenu-link', role: 'menuitem' },
                    React.createElement("div", null,
                        React.createElement("span", { className: 'ms-ContextualMenu-icon ms-ContextualMenu-customizationExample-categorySwatch', style: { backgroundColor: category.color } }),
                        React.createElement("span", { className: 'ms-ContextualMenu-itemText' }, category.name)));
            }))));
    };
    tslib_1.__decorate([
        Utilities_1.autobind
    ], ContextualMenuCustomizationExample.prototype, "_dismissMenu", null);
    tslib_1.__decorate([
        Utilities_1.autobind
    ], ContextualMenuCustomizationExample.prototype, "_renderCharmMenuItem", null);
    return ContextualMenuCustomizationExample;
}(React.Component));
exports.ContextualMenuCustomizationExample = ContextualMenuCustomizationExample;
//# sourceMappingURL=ContextualMenu.Customization.Example.js.map