import * as tslib_1 from "tslib";
import * as React from 'react';
import { DefaultButton, FocusTrapCallout, Stack, getId, FocusZone, PrimaryButton } from 'office-ui-fabric-react';
import './CalloutExample.scss';
var CalloutFocusTrapExample = /** @class */ (function (_super) {
    tslib_1.__extends(CalloutFocusTrapExample, _super);
    function CalloutFocusTrapExample() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.state = {
            isCalloutVisible: false
        };
        // Use getId() to ensure that the callout title ID is unique on the page.
        // (It's also okay to use a plain string without getId() and manually ensure its uniqueness.)
        _this._titleId = getId('callout-label');
        _this._onDismiss = function () {
            _this.setState({
                isCalloutVisible: !_this.state.isCalloutVisible
            });
        };
        return _this;
    }
    CalloutFocusTrapExample.prototype.render = function () {
        var _this = this;
        var isCalloutVisible = this.state.isCalloutVisible;
        return (React.createElement("div", { className: "ms-CalloutExample" },
            React.createElement("div", { className: "ms-CalloutBasicExample-buttonArea", ref: function (menuButton) { return (_this._menuButtonElement = menuButton); } },
                React.createElement(DefaultButton, { onClick: this._onDismiss, text: isCalloutVisible ? 'Hide callout' : 'Show callout' })),
            isCalloutVisible ? (React.createElement("div", null,
                React.createElement(FocusTrapCallout, { role: "alertdialog", ariaLabelledBy: this._titleId, className: "ms-CalloutExample-callout", gapSpace: 0, target: this._menuButtonElement, onDismiss: this._onDismiss, setInitialFocus: true },
                    React.createElement("div", { className: "ms-CalloutExample-header" },
                        React.createElement("p", { className: "ms-CalloutExample-title", id: this._titleId }, "Callout title here")),
                    React.createElement("div", { className: "ms-CalloutExample-inner" },
                        React.createElement("div", { className: "ms-CalloutExample-content" },
                            React.createElement("p", { className: "ms-CalloutExample-subText" }, "Message body is optional. If help documentation is available, consider adding a link to learn more at the bottom."))),
                    React.createElement(FocusZone, null,
                        React.createElement(Stack, { className: "ms-CalloutExample-buttons", gap: 8, horizontal: true },
                            React.createElement(PrimaryButton, { onClick: this._onDismiss }, "Agree"),
                            React.createElement(DefaultButton, { onClick: this._onDismiss }, "Cancel")))))) : null));
    };
    return CalloutFocusTrapExample;
}(React.Component));
export { CalloutFocusTrapExample };
//# sourceMappingURL=Callout.FocusTrap.Example.js.map