import * as tslib_1 from "tslib";
import * as React from 'react';
import { DefaultButton, Callout, DirectionalHint, Dropdown, Checkbox, Slider } from 'office-ui-fabric-react';
import './CalloutExample.scss';
var DIRECTION_OPTIONS = [
    { key: DirectionalHint.topLeftEdge, text: 'Top Left Edge' },
    { key: DirectionalHint.topCenter, text: 'Top Center' },
    { key: DirectionalHint.topRightEdge, text: 'Top Right Edge' },
    { key: DirectionalHint.topAutoEdge, text: 'Top Auto Edge' },
    { key: DirectionalHint.bottomLeftEdge, text: 'Bottom Left Edge' },
    { key: DirectionalHint.bottomCenter, text: 'Bottom Center' },
    { key: DirectionalHint.bottomRightEdge, text: 'Bottom Right Edge' },
    { key: DirectionalHint.bottomAutoEdge, text: 'Bottom Auto Edge' },
    { key: DirectionalHint.leftTopEdge, text: 'Left Top Edge' },
    { key: DirectionalHint.leftCenter, text: 'Left Center' },
    { key: DirectionalHint.leftBottomEdge, text: 'Left Bottom Edge' },
    { key: DirectionalHint.rightTopEdge, text: 'Right Top Edge' },
    { key: DirectionalHint.rightCenter, text: 'Right Center' },
    { key: DirectionalHint.rightBottomEdge, text: 'Right Bottom Edge' }
];
var CalloutDirectionalExample = /** @class */ (function (_super) {
    tslib_1.__extends(CalloutDirectionalExample, _super);
    function CalloutDirectionalExample(props) {
        var _this = _super.call(this, props) || this;
        _this._onCalloutDismiss = function () {
            _this.setState({
                isCalloutVisible: false
            });
        };
        _this._onShowMenuClicked = function () {
            _this.setState({
                isCalloutVisible: !_this.state.isCalloutVisible
            });
        };
        _this._onShowBeakChange = function (ev, isVisible) {
            _this.setState({
                isBeakVisible: isVisible,
                beakWidth: 10
            });
        };
        _this._onDirectionalChanged = function (event, option) {
            _this.setState({
                directionalHint: option.key
            });
        };
        _this._onGapSlider = function (value) {
            _this.setState({
                gapSpace: value
            });
        };
        _this._onBeakWidthSlider = function (value) {
            _this.setState({
                beakWidth: value
            });
        };
        _this.state = {
            isCalloutVisible: false,
            isBeakVisible: true,
            directionalHint: DirectionalHint.bottomLeftEdge
        };
        return _this;
    }
    CalloutDirectionalExample.prototype.render = function () {
        var _this = this;
        var _a = this.state, isCalloutVisible = _a.isCalloutVisible, isBeakVisible = _a.isBeakVisible, directionalHint = _a.directionalHint, gapSpace = _a.gapSpace, beakWidth = _a.beakWidth;
        //  ms-Callout-smallbeak is used in this directional example to reflect all the positions.
        //  Large beak will disable some position to avoid beak over the callout edge.
        return (React.createElement("div", { className: "ms-CalloutExample" },
            React.createElement("div", { className: "ms-CalloutExample-configArea" },
                React.createElement(Checkbox, { styles: { root: { margin: '10px 0' } }, label: "Show beak", checked: isBeakVisible, onChange: this._onShowBeakChange }),
                React.createElement(Slider, { max: 30, label: "Gap Space", min: 0, defaultValue: 0, onChange: this._onGapSlider }),
                isBeakVisible && React.createElement(Slider, { max: 50, label: "Beak Width", min: 10, defaultValue: 16, onChange: this._onBeakWidthSlider }),
                React.createElement(Dropdown, { label: "Directional hint", selectedKey: directionalHint, options: DIRECTION_OPTIONS, onChange: this._onDirectionalChanged })),
            React.createElement("div", { className: "ms-CalloutExample-buttonArea", ref: function (menuButton) { return (_this._menuButtonElement = menuButton); } },
                React.createElement(DefaultButton, { className: 'calloutExampleButton', onClick: this._onShowMenuClicked, text: isCalloutVisible ? 'Hide callout' : 'Show callout' })),
            isCalloutVisible ? (React.createElement(Callout, { className: "ms-CalloutExample-callout", gapSpace: gapSpace, target: this._menuButtonElement, isBeakVisible: isBeakVisible, beakWidth: beakWidth, onDismiss: this._onCalloutDismiss, directionalHint: directionalHint, setInitialFocus: true },
                React.createElement("div", { className: "ms-CalloutExample-header" },
                    React.createElement("p", { className: "ms-CalloutExample-title" }, "All of your favorite people")),
                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."))))) : null));
    };
    return CalloutDirectionalExample;
}(React.Component));
export { CalloutDirectionalExample };
//# sourceMappingURL=Callout.Directional.Example.js.map