define(["require", "exports", "tslib", "react", "office-ui-fabric-react", "@fluentui/date-time-utilities", "@uifabric/date-time", "./Calendar.Example.scss"], function (require, exports, tslib_1, React, office_ui_fabric_react_1, date_time_utilities_1, date_time_1, styles) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var dateRangeType = date_time_1.DateRangeType.Month;
    var CalendarInlineMonthSelectionExample = /** @class */ (function (_super) {
        tslib_1.__extends(CalendarInlineMonthSelectionExample, _super);
        function CalendarInlineMonthSelectionExample(props) {
            var _this = _super.call(this, props) || this;
            _this._goPrevious = function () {
                _this.setState(function (prevState) {
                    var selectedDate = prevState.selectedDate || new Date();
                    var dateRangeArray = date_time_utilities_1.getDateRangeArray(selectedDate, dateRangeType, date_time_1.DayOfWeek.Sunday);
                    var subtractFrom = new Date(dateRangeArray[0].getFullYear(), dateRangeArray[0].getMonth(), 1);
                    var daysToSubtract = 1;
                    var newSelectedDate = date_time_utilities_1.addDays(subtractFrom, -daysToSubtract);
                    return {
                        selectedDate: newSelectedDate,
                    };
                });
            };
            _this._goNext = function () {
                _this.setState(function (prevState) {
                    var selectedDate = prevState.selectedDate || new Date();
                    var dateRangeArray = date_time_utilities_1.getDateRangeArray(selectedDate, dateRangeType, date_time_1.DayOfWeek.Sunday);
                    var newSelectedDate = date_time_utilities_1.addDays(dateRangeArray.pop(), 1);
                    return {
                        selectedDate: newSelectedDate,
                    };
                });
            };
            _this._onSelectDate = function (date, dateRangeArray) {
                _this.setState(function (prevState) {
                    return {
                        selectedDate: date,
                        selectedDateRange: dateRangeArray,
                    };
                });
            };
            _this.state = {
                selectedDate: new Date(),
                selectedDateRange: undefined,
            };
            return _this;
        }
        CalendarInlineMonthSelectionExample.prototype.render = function () {
            var dateRangeString = null;
            if (this.state.selectedDateRange) {
                var rangeStart = this.state.selectedDateRange[0];
                var rangeEnd = this.state.selectedDateRange[this.state.selectedDateRange.length - 1];
                dateRangeString = rangeStart.toLocaleDateString() + '-' + rangeEnd.toLocaleDateString();
            }
            return (React.createElement("div", { className: styles.wrapper },
                React.createElement("div", null,
                    "Selected date(s):",
                    ' ',
                    React.createElement("span", null, !this.state.selectedDate ? 'Not set' : this.state.selectedDate.toLocaleString())),
                React.createElement("div", null,
                    "Selected dates:",
                    React.createElement("span", null,
                        " ",
                        !dateRangeString ? 'Not set' : dateRangeString)),
                React.createElement(date_time_1.Calendar, { dateRangeType: dateRangeType, highlightCurrentMonth: false, highlightSelectedMonth: true, showGoToToday: true, onSelectDate: this._onSelectDate, value: this.state.selectedDate, firstDayOfWeek: date_time_1.DayOfWeek.Sunday, strings: date_time_1.defaultDayPickerStrings }),
                React.createElement("div", null,
                    React.createElement(office_ui_fabric_react_1.DefaultButton, { className: styles.button, onClick: this._goPrevious, text: "Previous" }),
                    React.createElement(office_ui_fabric_react_1.DefaultButton, { className: styles.button, onClick: this._goNext, text: "Next" }))));
        };
        return CalendarInlineMonthSelectionExample;
    }(React.Component));
    exports.CalendarInlineMonthSelectionExample = CalendarInlineMonthSelectionExample;
});
//# sourceMappingURL=Calendar.Inline.MonthSelection.Example.js.map