"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 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 BoxExample = /** @class */ (function (_super) {
    tslib_1.__extends(BoxExample, _super);
    function BoxExample(props) {
        var _this = _super.call(this, props) || this;
        _this._onButtonClickHandler = function () {
            _this.setState({
                isChecked: true
            });
        };
        _this._onExitButtonClickHandler = function () {
            _this.setState({
                isChecked: false
            });
        };
        _this._onFocusTrapZoneToggleChanged = function (isChecked) {
            _this.setState({
                isChecked: isChecked
            }, function () { return _this._toggle.focus(); });
        };
        _this._setRef = function (toggle) {
            _this._toggle = toggle;
        };
        _this.state = {
            isChecked: false
        };
        return _this;
    }
    BoxExample.prototype.render = function () {
        var _this = this;
        var isChecked = this.state.isChecked;
        return (React.createElement("div", null,
            React.createElement(Button_1.DefaultButton, { secondaryText: "Focuses inside the FocusTrapZone", onClick: this._onButtonClickHandler, text: "Go to Trap Zone" }),
            (function () {
                if (isChecked) {
                    return React.createElement(FocusTrapZone_1.FocusTrapZone, null, _this._internalContents());
                }
                else {
                    return React.createElement("div", null, _this._internalContents());
                }
            })()));
    };
    BoxExample.prototype._internalContents = function () {
        var _this = this;
        var isChecked = this.state.isChecked;
        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: this._setRef, checked: isChecked, onChanged: this._onFocusTrapZoneToggleChanged, label: "Focus Trap Zone", onText: "On", offText: "Off" }),
            (function () {
                if (isChecked) {
                    return (React.createElement(Button_1.DefaultButton, { secondaryText: "Exit Focus Trap Zone", onClick: _this._onExitButtonClickHandler, text: "Exit Focus Trap Zone" }));
                }
            })()));
    };
    return BoxExample;
}(React.Component));
exports.default = BoxExample;
//# sourceMappingURL=FocusTrapZone.Box.Example.js.map