"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
/* tslint:disable:no-unused-variable */
var React = require("react");
/* tslint:enable:no-unused-variable */
var Utilities_1 = require("../../../Utilities");
var Button_1 = require("office-ui-fabric-react/lib/Button");
var FocusTrapZone_1 = require("office-ui-fabric-react/lib/FocusTrapZone");
var Link_1 = require("office-ui-fabric-react/lib/Link");
var TextField_1 = require("office-ui-fabric-react/lib/TextField");
var Toggle_1 = require("office-ui-fabric-react/lib/Toggle");
require("./FocusTrapZone.Box.Example.scss");
var BoxNoClickExample = (function (_super) {
    tslib_1.__extends(BoxNoClickExample, _super);
    function BoxNoClickExample(props) {
        var _this = _super.call(this, props) || this;
        _this.state = {
            isToggled: false,
        };
        return _this;
    }
    BoxNoClickExample.prototype.render = function () {
        var _this = this;
        var isToggled = this.state.isToggled;
        return (React.createElement("div", null,
            React.createElement(Button_1.DefaultButton, { description: 'Focuses inside the FocusTrapZone', onClick: this._onButtonClickHandler, text: 'Go to Trap Zone' }),
            (function () {
                if (isToggled) {
                    return (React.createElement(FocusTrapZone_1.FocusTrapZone, { isClickableOutsideFocusTrap: true, forceFocusInsideTrap: false }, _this._internalContents()));
                }
                else {
                    return (React.createElement("div", null, _this._internalContents()));
                }
            })()));
    };
    BoxNoClickExample.prototype._internalContents = function () {
        var _this = this;
        var isToggled = this.state.isToggled;
        return (React.createElement("div", { className: 'ms-FocusTrapZoneBoxExample' },
            React.createElement(TextField_1.TextField, { label: 'Default TextField', placeholder: 'Input inside Focus Trap Zone', className: '' }),
            React.createElement(Link_1.Link, { href: '', className: '' }, "Hyperlink inside FocusTrapZone"),
            React.createElement("br", null),
            React.createElement("br", null),
            React.createElement(Toggle_1.Toggle, { componentRef: function (t) { return _this._toggle = t; }, checked: isToggled, onChanged: this._onFocusTrapZoneToggleChanged, label: 'Focus Trap Zone', onText: 'On', offText: 'Off' }),
            (function () {
                if (isToggled) {
                    return (React.createElement(Button_1.DefaultButton, { description: 'Exit Focus Trap Zone', onClick: _this._onExitButtonClickHandler, text: 'Exit Focus Trap Zone' }));
                }
            })()));
    };
    BoxNoClickExample.prototype._onButtonClickHandler = function () {
        this.setState({
            isToggled: true
        });
    };
    BoxNoClickExample.prototype._onExitButtonClickHandler = function () {
        this.setState({
            isToggled: false
        });
    };
    BoxNoClickExample.prototype._onFocusTrapZoneToggleChanged = function (isToggled) {
        var _this = this;
        this.setState({
            isToggled: isToggled
        }, function () { return _this._toggle.focus(); });
    };
    tslib_1.__decorate([
        Utilities_1.autobind
    ], BoxNoClickExample.prototype, "_onButtonClickHandler", null);
    tslib_1.__decorate([
        Utilities_1.autobind
    ], BoxNoClickExample.prototype, "_onExitButtonClickHandler", null);
    tslib_1.__decorate([
        Utilities_1.autobind
    ], BoxNoClickExample.prototype, "_onFocusTrapZoneToggleChanged", null);
    return BoxNoClickExample;
}(React.Component));
exports.default = BoxNoClickExample;
//# sourceMappingURL=FocusTrapZone.Box.Click.Example.js.map