define(["require", "exports", "tslib", "react", "office-ui-fabric-react", "@uifabric/date-time"], function (require, exports, tslib_1, React, office_ui_fabric_react_1, date_time_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var CalendarButtonExample = /** @class */ (function (_super) {
        tslib_1.__extends(CalendarButtonExample, _super);
        function CalendarButtonExample(props) {
            var _this = _super.call(this, props) || this;
            _this._onClick = function () {
                _this.setState(function (prevState) {
                    prevState.showCalendar = !prevState.showCalendar;
                    return prevState;
                });
            };
            _this._onDismiss = function () {
                _this.setState(function (prevState) {
                    prevState.showCalendar = false;
                    return prevState;
                });
            };
            _this._onSelectDate = function (date) {
                _this.setState(function (prevState) {
                    prevState.showCalendar = false;
                    prevState.selectedDate = date;
                    return prevState;
                });
            };
            _this.state = {
                showCalendar: false,
                selectedDate: undefined,
            };
            return _this;
        }
        CalendarButtonExample.prototype.render = function () {
            var _this = this;
            return (React.createElement("div", null,
                React.createElement("div", { ref: function (calendarBtn) { return (_this._calendarButtonElement = calendarBtn); } },
                    React.createElement(office_ui_fabric_react_1.DefaultButton, { onClick: this._onClick, text: !this.state.selectedDate ? this.props.buttonString : this.state.selectedDate.toLocaleDateString() })),
                this.state.showCalendar && (React.createElement(office_ui_fabric_react_1.Callout, { isBeakVisible: false, className: "ms-DatePicker-callout", gapSpace: 0, doNotLayer: false, target: this._calendarButtonElement, directionalHint: office_ui_fabric_react_1.DirectionalHint.bottomLeftEdge, onDismiss: this._onDismiss, setInitialFocus: true },
                    React.createElement(office_ui_fabric_react_1.FocusTrapZone, { isClickableOutsideFocusTrap: true },
                        React.createElement(date_time_1.Calendar, { onSelectDate: this._onSelectDate, onDismiss: this._onDismiss, isMonthPickerVisible: this.props.isMonthPickerVisible, value: this.state.selectedDate, firstDayOfWeek: date_time_1.DayOfWeek.Sunday, strings: date_time_1.defaultDayPickerStrings, isDayPickerVisible: this.props.isDayPickerVisible, highlightCurrentMonth: this.props.highlightCurrentMonth, highlightSelectedMonth: this.props.highlightSelectedMonth, showMonthPickerAsOverlay: this.props.showMonthPickerAsOverlay, showGoToToday: this.props.showGoToToday }))))));
        };
        CalendarButtonExample.defaultProps = {
            showMonthPickerAsOverlay: false,
            isDayPickerVisible: true,
            isMonthPickerVisible: true,
            showGoToToday: true,
            buttonString: 'Click for Calendar',
        };
        return CalendarButtonExample;
    }(React.Component));
    exports.CalendarButtonExample = CalendarButtonExample;
});
//# sourceMappingURL=Calendar.Button.Example.js.map