"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var React = require("react");
var Button_1 = require("office-ui-fabric-react/lib/Button");
var Checkbox_1 = require("office-ui-fabric-react/lib/Checkbox");
var ContextualMenu_1 = require("office-ui-fabric-react/lib/ContextualMenu");
var Dropdown_1 = require("office-ui-fabric-react/lib/Dropdown");
var Slider_1 = require("office-ui-fabric-react/lib/Slider");
var Utilities_1 = require("office-ui-fabric-react/lib/Utilities");
require("./ContextualMenuExample.scss");
var DIRECTION_OPTIONS = [
    { key: ContextualMenu_1.DirectionalHint[ContextualMenu_1.DirectionalHint.topLeftEdge], text: 'Top Left Edge' },
    { key: ContextualMenu_1.DirectionalHint[ContextualMenu_1.DirectionalHint.topCenter], text: 'Top Center' },
    { key: ContextualMenu_1.DirectionalHint[ContextualMenu_1.DirectionalHint.topRightEdge], text: 'Top Right Edge' },
    { key: ContextualMenu_1.DirectionalHint[ContextualMenu_1.DirectionalHint.topAutoEdge], text: 'Top Auto Edge' },
    { key: ContextualMenu_1.DirectionalHint[ContextualMenu_1.DirectionalHint.bottomLeftEdge], text: 'Bottom Left Edge' },
    { key: ContextualMenu_1.DirectionalHint[ContextualMenu_1.DirectionalHint.bottomCenter], text: 'Bottom Center' },
    { key: ContextualMenu_1.DirectionalHint[ContextualMenu_1.DirectionalHint.bottomRightEdge], text: 'Bottom Right Edge' },
    { key: ContextualMenu_1.DirectionalHint[ContextualMenu_1.DirectionalHint.bottomAutoEdge], text: 'Bottom Auto Edge' },
    { key: ContextualMenu_1.DirectionalHint[ContextualMenu_1.DirectionalHint.leftTopEdge], text: 'Left Top Edge' },
    { key: ContextualMenu_1.DirectionalHint[ContextualMenu_1.DirectionalHint.leftCenter], text: 'Left Center' },
    { key: ContextualMenu_1.DirectionalHint[ContextualMenu_1.DirectionalHint.leftBottomEdge], text: 'Left Bottom Edge' },
    { key: ContextualMenu_1.DirectionalHint[ContextualMenu_1.DirectionalHint.rightTopEdge], text: 'Right Top Edge' },
    { key: ContextualMenu_1.DirectionalHint[ContextualMenu_1.DirectionalHint.rightCenter], text: 'Right Center' },
    { key: ContextualMenu_1.DirectionalHint[ContextualMenu_1.DirectionalHint.rightBottomEdge], text: 'Right Bottom Edge' },
];
var ContextualMenuDirectionalExample = (function (_super) {
    tslib_1.__extends(ContextualMenuDirectionalExample, _super);
    function ContextualMenuDirectionalExample() {
        var _this = _super.call(this) || this;
        _this.state = {
            isContextualMenuVisible: false,
            isBeakVisible: false,
            directionalHint: ContextualMenu_1.DirectionalHint.bottomLeftEdge,
            directionalHintForRTL: ContextualMenu_1.DirectionalHint.bottomLeftEdge,
            useDirectionalHintForRtl: false,
            gapSpace: 0,
            beakWidth: 10,
            edgeFixed: false
        };
        return _this;
    }
    ContextualMenuDirectionalExample.prototype.render = function () {
        var _a = this.state, beakWidth = _a.beakWidth, directionalHint = _a.directionalHint, directionalHintForRTL = _a.directionalHintForRTL, edgeFixed = _a.edgeFixed, gapSpace = _a.gapSpace, isBeakVisible = _a.isBeakVisible, isContextualMenuVisible = _a.isContextualMenuVisible, useDirectionalHintForRtl = _a.useDirectionalHintForRtl;
        return (React.createElement("div", { className: 'ms-ContextualMenuDirectionalExample' },
            React.createElement("div", { className: 'ms-ContextualMenuDirectionalExample-configArea' },
                React.createElement(Checkbox_1.Checkbox, { label: 'Show beak', checked: isBeakVisible, onChange: this._onShowBeakChange }),
                React.createElement(Checkbox_1.Checkbox, { label: 'Fix Edge', checked: edgeFixed, onChange: this._onFixEdgeChange }),
                React.createElement(Slider_1.Slider, { max: 20, label: 'Gap Space', min: 0, defaultValue: 0, onChange: this._onGapSlider }),
                isBeakVisible &&
                    (React.createElement(Slider_1.Slider, { max: 50, label: 'Beak Width', min: 10, defaultValue: 10, onChange: this._onBeakWidthSlider })),
                React.createElement(Dropdown_1.Dropdown, { label: 'Directional hint', selectedKey: ContextualMenu_1.DirectionalHint[directionalHint], options: DIRECTION_OPTIONS, onChanged: this._onDirectionalChanged }),
                Utilities_1.getRTL() &&
                    React.createElement(Checkbox_1.Checkbox, { label: 'Use RTL directional hint', checked: useDirectionalHintForRtl, onChange: this._onUseRtlHintChange }),
                Utilities_1.getRTL() &&
                    React.createElement(Dropdown_1.Dropdown, { label: 'Directional hint for RTL', selectedKey: ContextualMenu_1.DirectionalHint[directionalHintForRTL], options: DIRECTION_OPTIONS, onChanged: this._onDirectionalRtlChanged, disabled: !useDirectionalHintForRtl })),
            React.createElement("div", { className: 'ms-ContextualMenuDirectionalExample-buttonArea', ref: 'menuButton' },
                React.createElement(Button_1.DefaultButton, { onClick: this._onShowMenuClicked, text: isContextualMenuVisible ? 'Hide context menu' : 'Show context menu' })),
            isContextualMenuVisible ? (React.createElement(ContextualMenu_1.ContextualMenu, { target: this.refs.menuButton, isBeakVisible: isBeakVisible, directionalHint: directionalHint, directionalHintForRTL: useDirectionalHintForRtl ? directionalHintForRTL : undefined, gapSpace: gapSpace, beakWidth: beakWidth, directionalHintFixed: edgeFixed, items: [
                    {
                        key: 'newItem',
                        name: 'New',
                        icon: 'Add',
                        subMenuProps: {
                            items: [
                                {
                                    key: 'emailMessage',
                                    name: 'Email message',
                                },
                                {
                                    key: 'calendarEvent',
                                    name: 'Calendar event',
                                }
                            ]
                        },
                    },
                    {
                        key: 'upload',
                        name: 'Upload',
                        icon: 'Upload'
                    },
                    {
                        key: 'rename',
                        name: 'Rename',
                    },
                    {
                        key: '-',
                        itemType: ContextualMenu_1.ContextualMenuItemType.Divider
                    },
                    {
                        key: 'share',
                        name: 'Share',
                        icon: 'Share',
                        items: [
                            {
                                key: 'sharetoemail',
                                name: 'Share to Email',
                                icon: 'Mail'
                            },
                            {
                                key: 'sharetofacebook',
                                name: 'Share to Facebook',
                            },
                            {
                                key: 'sharetotwitter',
                                name: 'Share to Twitter',
                                icon: 'Share'
                            },
                        ]
                    },
                    {
                        key: 'print',
                        name: 'Print',
                        icon: 'Print'
                    },
                    {
                        key: 'display',
                        name: 'display'
                    },
                    {
                        key: 'properties',
                        name: 'Properties'
                    },
                ] })) : (null)));
    };
    ContextualMenuDirectionalExample.prototype._onShowBeakChange = function (ev, isVisible) {
        this.setState({
            isBeakVisible: isVisible
        });
    };
    ContextualMenuDirectionalExample.prototype._onFixEdgeChange = function (ev, isVisible) {
        this.setState({
            edgeFixed: isVisible
        });
    };
    ContextualMenuDirectionalExample.prototype._onUseRtlHintChange = function (ev, isVisible) {
        this.setState({
            useDirectionalHintForRtl: isVisible
        });
    };
    ContextualMenuDirectionalExample.prototype._onShowMenuClicked = function () {
        this.setState({
            isContextualMenuVisible: !this.state.isContextualMenuVisible
        });
    };
    ContextualMenuDirectionalExample.prototype._onDirectionalChanged = function (option) {
        this.setState({
            directionalHint: ContextualMenu_1.DirectionalHint[option.key]
        });
    };
    ContextualMenuDirectionalExample.prototype._onDirectionalRtlChanged = function (option) {
        this.setState({
            directionalHintForRTL: ContextualMenu_1.DirectionalHint[option.key]
        });
    };
    ContextualMenuDirectionalExample.prototype._onGapSlider = function (value) {
        this.setState({
            gapSpace: value
        });
    };
    ContextualMenuDirectionalExample.prototype._onBeakWidthSlider = function (value) {
        this.setState({
            beakWidth: value
        });
    };
    return ContextualMenuDirectionalExample;
}(React.Component));
tslib_1.__decorate([
    Utilities_1.autobind
], ContextualMenuDirectionalExample.prototype, "_onShowBeakChange", null);
tslib_1.__decorate([
    Utilities_1.autobind
], ContextualMenuDirectionalExample.prototype, "_onFixEdgeChange", null);
tslib_1.__decorate([
    Utilities_1.autobind
], ContextualMenuDirectionalExample.prototype, "_onUseRtlHintChange", null);
tslib_1.__decorate([
    Utilities_1.autobind
], ContextualMenuDirectionalExample.prototype, "_onShowMenuClicked", null);
tslib_1.__decorate([
    Utilities_1.autobind
], ContextualMenuDirectionalExample.prototype, "_onDirectionalChanged", null);
tslib_1.__decorate([
    Utilities_1.autobind
], ContextualMenuDirectionalExample.prototype, "_onDirectionalRtlChanged", null);
tslib_1.__decorate([
    Utilities_1.autobind
], ContextualMenuDirectionalExample.prototype, "_onGapSlider", null);
tslib_1.__decorate([
    Utilities_1.autobind
], ContextualMenuDirectionalExample.prototype, "_onBeakWidthSlider", null);
exports.ContextualMenuDirectionalExample = ContextualMenuDirectionalExample;

//# sourceMappingURL=ContextualMenu.Directional.Example.js.map
