UNPKG

2.49 kBJavaScriptView Raw
1"use strict";
2/*
3 * Copyright 2018 Palantir Technologies, Inc. All rights reserved.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17Object.defineProperty(exports, "__esModule", { value: true });
18exports.DatePickerNavbar = void 0;
19var tslib_1 = require("tslib");
20var classnames_1 = tslib_1.__importDefault(require("classnames"));
21var React = tslib_1.__importStar(require("react"));
22var core_1 = require("@blueprintjs/core");
23var Classes = tslib_1.__importStar(require("./common/classes"));
24var dateUtils_1 = require("./common/dateUtils");
25var DatePickerNavbar = /** @class */ (function (_super) {
26 tslib_1.__extends(DatePickerNavbar, _super);
27 function DatePickerNavbar() {
28 var _this = _super !== null && _super.apply(this, arguments) || this;
29 _this.handleNextClick = function () { return _this.props.onNextClick(); };
30 _this.handlePreviousClick = function () { return _this.props.onPreviousClick(); };
31 return _this;
32 }
33 DatePickerNavbar.prototype.render = function () {
34 var _a = this.props, classes = _a.classNames, month = _a.month, maxDate = _a.maxDate, minDate = _a.minDate;
35 return (React.createElement("div", { className: (0, classnames_1.default)(Classes.DATEPICKER_NAVBAR, classes.navBar) },
36 this.props.hideLeftNavButton || (React.createElement(core_1.Button, { "aria-label": "Go to previous month", className: classes.navButtonPrev, disabled: (0, dateUtils_1.areSameMonth)(month, minDate), icon: "chevron-left", minimal: true, onClick: this.handlePreviousClick })),
37 this.props.hideRightNavButton || (React.createElement(core_1.Button, { "aria-label": "Go to next month", className: classes.navButtonNext, disabled: (0, dateUtils_1.areSameMonth)(month, maxDate), icon: "chevron-right", minimal: true, onClick: this.handleNextClick }))));
38 };
39 return DatePickerNavbar;
40}(React.PureComponent));
41exports.DatePickerNavbar = DatePickerNavbar;
42//# sourceMappingURL=datePickerNavbar.js.map
\No newline at end of file