UNPKG

react-infinite-calendar

Version:

Infinite scrolling date-picker built with React, with localization, themes, keyboard support, and more.

75 lines (56 loc) 2.65 kB
'use strict'; exports.__esModule = true; exports.default = undefined; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _propTypes = require('prop-types'); var _propTypes2 = _interopRequireDefault(_propTypes); var _utils = require('../utils'); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var styles = { 'root': 'Cal__Weekdays__root', 'day': 'Cal__Weekdays__day' }; var Weekdays = function (_PureComponent) { _inherits(Weekdays, _PureComponent); function Weekdays() { _classCallCheck(this, Weekdays); return _possibleConstructorReturn(this, _PureComponent.apply(this, arguments)); } Weekdays.prototype.render = function render() { var _props = this.props, weekdays = _props.weekdays, weekStartsOn = _props.weekStartsOn, theme = _props.theme; var orderedWeekdays = [].concat(weekdays.slice(weekStartsOn, 7), weekdays.slice(0, weekStartsOn)); return _react2.default.createElement( 'ul', { className: styles.root, style: { backgroundColor: theme.weekdayColor, color: theme.textColor.active, paddingRight: _utils.scrollbarSize }, 'aria-hidden': true }, orderedWeekdays.map(function (val, index) { return _react2.default.createElement( 'li', { key: 'Weekday-' + index, className: styles.day }, val ); }) ); }; return Weekdays; }(_react.PureComponent); exports.default = Weekdays; process.env.NODE_ENV !== "production" ? Weekdays.propTypes = { locale: _propTypes2.default.object, theme: _propTypes2.default.object } : void 0; module.exports = exports['default'];