@synerise/ds-date-picker 0.6.0 → 0.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,38 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.6.4](https://github.com/Synerise/synerise-design/compare/@synerise/ds-date-picker@0.6.3...@synerise/ds-date-picker@0.6.4) (2021-11-23)
7
+
8
+ **Note:** Version bump only for package @synerise/ds-date-picker
9
+
10
+
11
+
12
+
13
+
14
+ ## [0.6.3](https://github.com/Synerise/synerise-design/compare/@synerise/ds-date-picker@0.6.2...@synerise/ds-date-picker@0.6.3) (2021-11-22)
15
+
16
+ **Note:** Version bump only for package @synerise/ds-date-picker
17
+
18
+
19
+
20
+
21
+
22
+ ## [0.6.2](https://github.com/Synerise/synerise-design/compare/@synerise/ds-date-picker@0.6.1...@synerise/ds-date-picker@0.6.2) (2021-11-16)
23
+
24
+ **Note:** Version bump only for package @synerise/ds-date-picker
25
+
26
+
27
+
28
+
29
+
30
+ ## [0.6.1](https://github.com/Synerise/synerise-design/compare/@synerise/ds-date-picker@0.5.69...@synerise/ds-date-picker@0.6.1) (2021-11-09)
31
+
32
+ **Note:** Version bump only for package @synerise/ds-date-picker
33
+
34
+
35
+
36
+
37
+
6
38
  # [0.6.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-date-picker@0.5.69...@synerise/ds-date-picker@0.6.0) (2021-11-09)
7
39
 
8
40
  **Note:** Version bump only for package @synerise/ds-date-picker
@@ -2,20 +2,6 @@ var _excluded = ["autoFocus", "disabled", "texts", "format", "value", "onApply",
2
2
 
3
3
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
4
 
5
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
6
-
7
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
8
-
9
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
10
-
11
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
12
-
13
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
14
-
15
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
16
-
17
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
18
-
19
5
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
20
6
 
21
7
  import * as React from 'react';
@@ -43,17 +29,15 @@ var DatePicker = function DatePicker(_ref) {
43
29
  dropdownProps = _ref.dropdownProps,
44
30
  suffixel = _ref.suffixel,
45
31
  hideNow = _ref.hideNow,
46
- rest = _objectWithoutProperties(_ref, _excluded);
32
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
47
33
 
48
34
  var _React$useState = React.useState(autoFocus || false),
49
- _React$useState2 = _slicedToArray(_React$useState, 2),
50
- dropVisible = _React$useState2[0],
51
- setDropVisible = _React$useState2[1];
35
+ dropVisible = _React$useState[0],
36
+ setDropVisible = _React$useState[1];
52
37
 
53
- var _React$useState3 = React.useState(value),
54
- _React$useState4 = _slicedToArray(_React$useState3, 2),
55
- selectedDate = _React$useState4[0],
56
- setSelectedDate = _React$useState4[1];
38
+ var _React$useState2 = React.useState(value),
39
+ selectedDate = _React$useState2[0],
40
+ setSelectedDate = _React$useState2[1];
57
41
 
58
42
  var ref = React.useRef(null);
59
43
  useOnClickOutside(ref, function () {
@@ -2,8 +2,6 @@ var _excluded = ["month", "onMonthChange", "onMonthNameClick", "onYearNameClick"
2
2
 
3
3
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
4
 
5
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
6
-
7
5
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
8
6
 
9
7
  import * as React from 'react';
@@ -31,7 +29,7 @@ var Picker = function Picker(props) {
31
29
  renderNavbar = props.renderNavbar,
32
30
  intl = props.intl,
33
31
  modifiers = props.modifiers,
34
- rest = _objectWithoutProperties(props, _excluded);
32
+ rest = _objectWithoutPropertiesLoose(props, _excluded);
35
33
 
36
34
  return /*#__PURE__*/React.createElement(React.Fragment, null, renderNavbar ? renderNavbar(props) : /*#__PURE__*/React.createElement(Navbar, {
37
35
  title: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(S.Link, {
@@ -3,7 +3,7 @@ import DayPickerBase from 'react-day-picker';
3
3
  var DaySelectorPrefix = ".DayPicker-Day";
4
4
 
5
5
  var daySelector = function daySelector(modifier) {
6
- return "".concat(DaySelectorPrefix, "--").concat(modifier);
6
+ return DaySelectorPrefix + "--" + modifier;
7
7
  };
8
8
 
9
9
  export var DayBackground = styled.div.withConfig({
@@ -1,36 +1,8 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
2
-
3
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
4
-
5
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
6
-
7
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8
-
9
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
10
-
11
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
12
-
13
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
14
-
15
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
16
-
17
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
18
-
19
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
20
-
21
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
22
-
23
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
24
-
25
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
26
-
27
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
28
-
29
1
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
30
2
 
31
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
3
+ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
32
4
 
33
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
5
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
34
6
 
35
7
  import * as React from 'react';
36
8
  import { range } from 'lodash';
@@ -58,39 +30,36 @@ function getCells(cursor) {
58
30
  }
59
31
 
60
32
  var DecadePicker = /*#__PURE__*/function (_React$PureComponent) {
61
- _inherits(DecadePicker, _React$PureComponent);
62
-
63
- var _super = _createSuper(DecadePicker);
33
+ _inheritsLoose(DecadePicker, _React$PureComponent);
64
34
 
65
35
  function DecadePicker() {
66
36
  var _this;
67
37
 
68
- _classCallCheck(this, DecadePicker);
69
-
70
38
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
71
39
  args[_key] = arguments[_key];
72
40
  }
73
41
 
74
- _this = _super.call.apply(_super, [this].concat(args));
75
- _this.state = getInitialState(_this.props);
42
+ _this = _React$PureComponent.call.apply(_React$PureComponent, [this].concat(args)) || this;
43
+
44
+ _defineProperty(_assertThisInitialized(_this), "state", getInitialState(_this.props));
76
45
 
77
- _this.handleLongPrev = function () {
46
+ _defineProperty(_assertThisInitialized(_this), "handleLongPrev", function () {
78
47
  var cursor = _this.state.cursor;
79
48
 
80
49
  _this.setState({
81
50
  cursor: fnsAddYears(cursor, -100)
82
51
  });
83
- };
52
+ });
84
53
 
85
- _this.handleLongNext = function () {
54
+ _defineProperty(_assertThisInitialized(_this), "handleLongNext", function () {
86
55
  var cursor = _this.state.cursor;
87
56
 
88
57
  _this.setState({
89
58
  cursor: fnsAddYears(cursor, 100)
90
59
  });
91
- };
60
+ });
92
61
 
93
- _this.handleCellClick = function (isoDate) {
62
+ _defineProperty(_assertThisInitialized(_this), "handleCellClick", function (isoDate) {
94
63
  var onChange = _this.props.onChange;
95
64
 
96
65
  if (isoDate === -1) {
@@ -106,61 +75,59 @@ var DecadePicker = /*#__PURE__*/function (_React$PureComponent) {
106
75
  }
107
76
 
108
77
  onChange && onChange(new Date(isoDate));
109
- };
78
+ });
110
79
 
111
80
  return _this;
112
81
  }
113
82
 
114
- _createClass(DecadePicker, [{
115
- key: "getSnapshotBeforeUpdate",
116
- value: function getSnapshotBeforeUpdate(prevProps) {
117
- var value = this.props.value;
83
+ var _proto = DecadePicker.prototype;
118
84
 
119
- if ((prevProps === null || prevProps === void 0 ? void 0 : prevProps.value) !== value) {
120
- this.setState(getInitialState(this.props));
121
- }
85
+ _proto.getSnapshotBeforeUpdate = function getSnapshotBeforeUpdate(prevProps) {
86
+ var value = this.props.value;
122
87
 
123
- return null;
124
- }
125
- }, {
126
- key: "render",
127
- value: function render() {
128
- var cursor = this.state.cursor;
129
- var _this$props = this.props,
130
- value = _this$props.value,
131
- onTitleClick = _this$props.onTitleClick;
132
- var centuryRange = getCenturyRange(cursor);
133
- var cells = getCells(cursor);
134
- var valueCell = value ? cells.find(function (cell) {
135
- var valueYear = fnsGetYear(value);
136
- var minYear = fnsGetYear(legacyParse(cell.key));
137
- var maxYear = minYear + 10;
138
- return valueYear >= minYear && valueYear < maxYear;
139
- }) : null;
140
- var selectedKey = valueCell ? valueCell.key : null;
141
- cells = [{
142
- key: -1,
143
- text: "".concat(centuryRange[0] - 10, "-").concat(centuryRange[0] - 1),
144
- outside: true
145
- }].concat(_toConsumableArray(cells), [{
146
- key: 1,
147
- text: "".concat(centuryRange[1] + 1, "-").concat(centuryRange[1] + 10),
148
- outside: true
149
- }]);
150
- return [/*#__PURE__*/React.createElement(Navbar, {
151
- title: centuryRange.join('-'),
152
- onTitleClick: onTitleClick,
153
- onLongPrev: this.handleLongPrev,
154
- onLongNext: this.handleLongNext,
155
- key: "head"
156
- }), /*#__PURE__*/React.createElement(GridPicker, {
157
- selectedKey: selectedKey,
158
- cells: cells,
159
- onCellClick: this.handleCellClick,
160
- key: "body"
161
- })];
88
+ if ((prevProps == null ? void 0 : prevProps.value) !== value) {
89
+ this.setState(getInitialState(this.props));
162
90
  }
163
- }]);
91
+
92
+ return null;
93
+ };
94
+
95
+ _proto.render = function render() {
96
+ var cursor = this.state.cursor;
97
+ var _this$props = this.props,
98
+ value = _this$props.value,
99
+ onTitleClick = _this$props.onTitleClick;
100
+ var centuryRange = getCenturyRange(cursor);
101
+ var cells = getCells(cursor);
102
+ var valueCell = value ? cells.find(function (cell) {
103
+ var valueYear = fnsGetYear(value);
104
+ var minYear = fnsGetYear(legacyParse(cell.key));
105
+ var maxYear = minYear + 10;
106
+ return valueYear >= minYear && valueYear < maxYear;
107
+ }) : null;
108
+ var selectedKey = valueCell ? valueCell.key : null;
109
+ cells = [{
110
+ key: -1,
111
+ text: centuryRange[0] - 10 + "-" + (centuryRange[0] - 1),
112
+ outside: true
113
+ }].concat(cells, [{
114
+ key: 1,
115
+ text: centuryRange[1] + 1 + "-" + (centuryRange[1] + 10),
116
+ outside: true
117
+ }]);
118
+ return [/*#__PURE__*/React.createElement(Navbar, {
119
+ title: centuryRange.join('-'),
120
+ onTitleClick: onTitleClick,
121
+ onLongPrev: this.handleLongPrev,
122
+ onLongNext: this.handleLongNext,
123
+ key: "head"
124
+ }), /*#__PURE__*/React.createElement(GridPicker, {
125
+ selectedKey: selectedKey,
126
+ cells: cells,
127
+ onCellClick: this.handleCellClick,
128
+ key: "body"
129
+ })];
130
+ };
164
131
 
165
132
  return DecadePicker;
166
133
  }(React.PureComponent);
@@ -2,8 +2,6 @@ var _excluded = ["text", "canApply", "onApply", "intl", "canSwitchMode", "onSwit
2
2
 
3
3
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
4
 
5
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
6
-
7
5
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
8
6
 
9
7
  import * as React from 'react';
@@ -26,7 +24,7 @@ var Footer = function Footer(_ref) {
26
24
  message = _ref.message,
27
25
  texts = _ref.texts,
28
26
  hideNow = _ref.hideNow,
29
- rest = _objectWithoutProperties(_ref, _excluded);
27
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
30
28
 
31
29
  var SwitchModeButton = React.useMemo(function () {
32
30
  return /*#__PURE__*/React.createElement(Button, {
@@ -1,52 +1,32 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
2
-
3
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4
-
5
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
6
-
7
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
8
-
9
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
10
-
11
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
12
-
13
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
14
-
15
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
16
-
17
1
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
18
2
 
19
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
3
+ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
20
4
 
21
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
5
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
22
6
 
23
7
  import * as React from 'react';
24
8
  import classNames from 'classnames';
25
9
  import * as S from './GridPicker.styles';
26
10
 
27
11
  var GridPicker = /*#__PURE__*/function (_React$PureComponent) {
28
- _inherits(GridPicker, _React$PureComponent);
29
-
30
- var _super = _createSuper(GridPicker);
12
+ _inheritsLoose(GridPicker, _React$PureComponent);
31
13
 
32
14
  function GridPicker() {
33
15
  var _this;
34
16
 
35
- _classCallCheck(this, GridPicker);
36
-
37
17
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
38
18
  args[_key] = arguments[_key];
39
19
  }
40
20
 
41
- _this = _super.call.apply(_super, [this].concat(args));
21
+ _this = _React$PureComponent.call.apply(_React$PureComponent, [this].concat(args)) || this;
42
22
 
43
- _this.handleCellClick = function (cell) {
23
+ _defineProperty(_assertThisInitialized(_this), "handleCellClick", function (cell) {
44
24
  if (cell.disabled) return;
45
25
  var onCellClick = _this.props.onCellClick;
46
26
  onCellClick && onCellClick(cell.key);
47
- };
27
+ });
48
28
 
49
- _this.renderCell = function (cell) {
29
+ _defineProperty(_assertThisInitialized(_this), "renderCell", function (cell) {
50
30
  var selectedKey = _this.props.selectedKey;
51
31
  var key = cell.key,
52
32
  text = cell.text,
@@ -66,18 +46,17 @@ var GridPicker = /*#__PURE__*/function (_React$PureComponent) {
66
46
  }, /*#__PURE__*/React.createElement("div", {
67
47
  className: "cell-content"
68
48
  }, text));
69
- };
49
+ });
70
50
 
71
51
  return _this;
72
52
  }
73
53
 
74
- _createClass(GridPicker, [{
75
- key: "render",
76
- value: function render() {
77
- var cells = this.props.cells;
78
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(S.GridContainer, null, cells.map(this.renderCell)));
79
- }
80
- }]);
54
+ var _proto = GridPicker.prototype;
55
+
56
+ _proto.render = function render() {
57
+ var cells = this.props.cells;
58
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(S.GridContainer, null, cells.map(this.renderCell)));
59
+ };
81
60
 
82
61
  return GridPicker;
83
62
  }(React.PureComponent);
@@ -1,24 +1,8 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
2
-
3
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4
-
5
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
6
-
7
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
8
-
9
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
10
-
11
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
12
-
13
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
14
-
15
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
16
-
17
1
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
18
2
 
19
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
3
+ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
20
4
 
21
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
5
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
22
6
 
23
7
  import * as React from 'react';
24
8
  import { range } from 'lodash';
@@ -50,103 +34,98 @@ function getCells(cursor, min, max) {
50
34
  }
51
35
 
52
36
  var MonthPicker = /*#__PURE__*/function (_React$PureComponent) {
53
- _inherits(MonthPicker, _React$PureComponent);
54
-
55
- var _super = _createSuper(MonthPicker);
37
+ _inheritsLoose(MonthPicker, _React$PureComponent);
56
38
 
57
39
  function MonthPicker() {
58
40
  var _this;
59
41
 
60
- _classCallCheck(this, MonthPicker);
61
-
62
42
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
63
43
  args[_key] = arguments[_key];
64
44
  }
65
45
 
66
- _this = _super.call.apply(_super, [this].concat(args));
67
- _this.state = getInitialState(_this.props);
46
+ _this = _React$PureComponent.call.apply(_React$PureComponent, [this].concat(args)) || this;
68
47
 
69
- _this.handleLongPrev = function () {
48
+ _defineProperty(_assertThisInitialized(_this), "state", getInitialState(_this.props));
49
+
50
+ _defineProperty(_assertThisInitialized(_this), "handleLongPrev", function () {
70
51
  var cursor = _this.state.cursor;
71
52
 
72
53
  _this.setState({
73
54
  cursor: fnsAddYears(cursor, -1)
74
55
  });
75
- };
56
+ });
76
57
 
77
- _this.handleLongNext = function () {
58
+ _defineProperty(_assertThisInitialized(_this), "handleLongNext", function () {
78
59
  var cursor = _this.state.cursor;
79
60
 
80
61
  _this.setState({
81
62
  cursor: fnsAddYears(cursor, 1)
82
63
  });
83
- };
64
+ });
84
65
 
85
66
  return _this;
86
67
  }
87
68
 
88
- _createClass(MonthPicker, [{
89
- key: "getSnapshotBeforeUpdate",
90
- value: function getSnapshotBeforeUpdate(prevProps) {
91
- var value = this.props.value;
69
+ var _proto = MonthPicker.prototype;
92
70
 
93
- if ((prevProps === null || prevProps === void 0 ? void 0 : prevProps.value) !== value) {
94
- this.setState(getInitialState(this.props));
95
- }
71
+ _proto.getSnapshotBeforeUpdate = function getSnapshotBeforeUpdate(prevProps) {
72
+ var value = this.props.value;
96
73
 
97
- return null;
74
+ if ((prevProps == null ? void 0 : prevProps.value) !== value) {
75
+ this.setState(getInitialState(this.props));
98
76
  }
99
- }, {
100
- key: "render",
101
- value: function render() {
102
- var _this2 = this;
103
-
104
- var _this$state = this.state,
105
- cursor = _this$state.cursor,
106
- yearMode = _this$state.yearMode;
107
- var _this$props = this.props,
108
- min = _this$props.min,
109
- max = _this$props.max,
110
- value = _this$props.value,
111
- onChange = _this$props.onChange;
112
- var cells = getCells(cursor, min, max);
113
- var valueCell = value ? cells.find(function (cell) {
114
- return fnsIsSameMonth(value, legacyParse(cell.key));
115
- }) : null;
116
- var selectedKey = valueCell ? valueCell.key : null;
117
-
118
- if (yearMode) {
119
- return /*#__PURE__*/React.createElement(YearPicker, {
120
- value: cursor,
121
- onChange: function onChange(changedDate) {
122
- return _this2.setState({
123
- cursor: changedDate,
124
- yearMode: false
125
- });
126
- }
127
- });
128
- }
129
77
 
130
- return [/*#__PURE__*/React.createElement(Navbar, {
131
- onTitleClick: function onTitleClick() {
78
+ return null;
79
+ };
80
+
81
+ _proto.render = function render() {
82
+ var _this2 = this;
83
+
84
+ var _this$state = this.state,
85
+ cursor = _this$state.cursor,
86
+ yearMode = _this$state.yearMode;
87
+ var _this$props = this.props,
88
+ min = _this$props.min,
89
+ max = _this$props.max,
90
+ value = _this$props.value,
91
+ onChange = _this$props.onChange;
92
+ var cells = getCells(cursor, min, max);
93
+ var valueCell = value ? cells.find(function (cell) {
94
+ return fnsIsSameMonth(value, legacyParse(cell.key));
95
+ }) : null;
96
+ var selectedKey = valueCell ? valueCell.key : null;
97
+
98
+ if (yearMode) {
99
+ return /*#__PURE__*/React.createElement(YearPicker, {
100
+ value: cursor,
101
+ onChange: function onChange(changedDate) {
132
102
  return _this2.setState({
133
- yearMode: true
103
+ cursor: changedDate,
104
+ yearMode: false
134
105
  });
135
- },
136
- title: fnsFormat(cursor, 'yyyy'),
137
- onLongPrev: this.handleLongPrev,
138
- onLongNext: this.handleLongNext,
139
- key: "head"
140
- }), /*#__PURE__*/React.createElement(GridPicker, {
141
- selectedKey: selectedKey,
142
- cells: cells,
143
- onCellClick: function onCellClick(isoDate) {
144
- return onChange(new Date(isoDate));
145
- },
146
- key: "body"
147
- })];
106
+ }
107
+ });
148
108
  }
149
- }]);
109
+
110
+ return [/*#__PURE__*/React.createElement(Navbar, {
111
+ onTitleClick: function onTitleClick() {
112
+ return _this2.setState({
113
+ yearMode: true
114
+ });
115
+ },
116
+ title: fnsFormat(cursor, 'yyyy'),
117
+ onLongPrev: this.handleLongPrev,
118
+ onLongNext: this.handleLongNext,
119
+ key: "head"
120
+ }), /*#__PURE__*/React.createElement(GridPicker, {
121
+ selectedKey: selectedKey,
122
+ cells: cells,
123
+ onCellClick: function onCellClick(isoDate) {
124
+ return onChange(new Date(isoDate));
125
+ },
126
+ key: "body"
127
+ })];
128
+ };
150
129
 
151
130
  return MonthPicker;
152
131
  }(React.PureComponent);