@synerise/ds-date-picker 0.13.1 → 0.13.3

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,25 @@
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.13.3](https://github.com/Synerise/synerise-design/compare/@synerise/ds-date-picker@0.13.2...@synerise/ds-date-picker@0.13.3) (2024-11-28)
7
+
8
+ **Note:** Version bump only for package @synerise/ds-date-picker
9
+
10
+
11
+
12
+
13
+
14
+ ## [0.13.2](https://github.com/Synerise/synerise-design/compare/@synerise/ds-date-picker@0.13.1...@synerise/ds-date-picker@0.13.2) (2024-11-21)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * **core:** onError fn types ([c34bdfe](https://github.com/Synerise/synerise-design/commit/c34bdfe9da898d7999c605f9fbcbba4716dfb6d4))
20
+
21
+
22
+
23
+
24
+
6
25
  ## [0.13.1](https://github.com/Synerise/synerise-design/compare/@synerise/ds-date-picker@0.13.0...@synerise/ds-date-picker@0.13.1) (2024-11-12)
7
26
 
8
27
  **Note:** Version bump only for package @synerise/ds-date-picker
@@ -1,9 +1,6 @@
1
1
  var _excluded = ["autoFocus", "disabled", "texts", "format", "valueFormatOptions", "value", "onApply", "showTime", "onValueChange", "onClear", "errorText", "popoverPlacement", "prefixel", "error", "onDropdownVisibleChange", "dropdownProps", "suffixel", "hideNow", "readOnly", "renderTrigger", "inputProps", "allowClear"];
2
-
3
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : 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
-
5
3
  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; }
6
-
7
4
  import React, { useCallback, useEffect, useRef, useState } from 'react';
8
5
  import { useIntl } from 'react-intl';
9
6
  import Dropdown from '@synerise/ds-dropdown';
@@ -12,41 +9,37 @@ import RawDatePicker from './RawDatePicker/RawDatePicker';
12
9
  import PickerInput from './Elements/PickerInput/PickerInput';
13
10
  import * as S from './DatePicker.styles';
14
11
  import { getDefaultTexts } from './utils/getDefaultTexts';
15
-
16
12
  var DatePicker = function DatePicker(_ref) {
17
13
  var autoFocus = _ref.autoFocus,
18
- disabled = _ref.disabled,
19
- texts = _ref.texts,
20
- format = _ref.format,
21
- valueFormatOptions = _ref.valueFormatOptions,
22
- value = _ref.value,
23
- onApply = _ref.onApply,
24
- showTime = _ref.showTime,
25
- onValueChange = _ref.onValueChange,
26
- onClear = _ref.onClear,
27
- errorText = _ref.errorText,
28
- popoverPlacement = _ref.popoverPlacement,
29
- prefixel = _ref.prefixel,
30
- error = _ref.error,
31
- onDropdownVisibleChange = _ref.onDropdownVisibleChange,
32
- dropdownProps = _ref.dropdownProps,
33
- suffixel = _ref.suffixel,
34
- hideNow = _ref.hideNow,
35
- readOnly = _ref.readOnly,
36
- renderTrigger = _ref.renderTrigger,
37
- inputProps = _ref.inputProps,
38
- _ref$allowClear = _ref.allowClear,
39
- allowClear = _ref$allowClear === void 0 ? true : _ref$allowClear,
40
- rest = _objectWithoutPropertiesLoose(_ref, _excluded);
41
-
14
+ disabled = _ref.disabled,
15
+ texts = _ref.texts,
16
+ format = _ref.format,
17
+ valueFormatOptions = _ref.valueFormatOptions,
18
+ value = _ref.value,
19
+ onApply = _ref.onApply,
20
+ showTime = _ref.showTime,
21
+ onValueChange = _ref.onValueChange,
22
+ onClear = _ref.onClear,
23
+ errorText = _ref.errorText,
24
+ popoverPlacement = _ref.popoverPlacement,
25
+ prefixel = _ref.prefixel,
26
+ error = _ref.error,
27
+ onDropdownVisibleChange = _ref.onDropdownVisibleChange,
28
+ dropdownProps = _ref.dropdownProps,
29
+ suffixel = _ref.suffixel,
30
+ hideNow = _ref.hideNow,
31
+ readOnly = _ref.readOnly,
32
+ renderTrigger = _ref.renderTrigger,
33
+ inputProps = _ref.inputProps,
34
+ _ref$allowClear = _ref.allowClear,
35
+ allowClear = _ref$allowClear === void 0 ? true : _ref$allowClear,
36
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
42
37
  var _useState = useState(autoFocus || false),
43
- dropVisible = _useState[0],
44
- setDropVisible = _useState[1];
45
-
38
+ dropVisible = _useState[0],
39
+ setDropVisible = _useState[1];
46
40
  var _useState2 = useState(value),
47
- selectedDate = _useState2[0],
48
- setSelectedDate = _useState2[1];
49
-
41
+ selectedDate = _useState2[0],
42
+ setSelectedDate = _useState2[1];
50
43
  var ref = useRef(null);
51
44
  var intl = useIntl();
52
45
  var allTexts = getDefaultTexts(intl, texts);
@@ -111,5 +104,4 @@ var DatePicker = function DatePicker(_ref) {
111
104
  disabled: disabled
112
105
  }, dropdownProps), trigger);
113
106
  };
114
-
115
107
  export default DatePicker;
@@ -1,9 +1,6 @@
1
1
  var _excluded = ["month", "onMonthChange", "onMonthNameClick", "onYearNameClick", "hideLongNext", "hideLongPrev", "hideShortNext", "hideShortPrev", "renderNavbar", "intl", "modifiers"];
2
-
3
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : 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
-
5
3
  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; }
6
-
7
4
  import React from 'react';
8
5
  import { injectIntl } from 'react-intl';
9
6
  import { useDataFormat } from '@synerise/ds-data-format';
@@ -13,28 +10,24 @@ import { fnsAddMonths, fnsAddYears } from '../../fns';
13
10
  import localeUtils from '../../localeUtils';
14
11
  import { DayPicker } from './DayPicker.styles';
15
12
  import * as S from '../Navbar/Navbar.styles';
16
-
17
13
  var captionElement = function captionElement() {
18
14
  return null;
19
15
  };
20
-
21
16
  var Picker = function Picker(props) {
22
17
  var month = props.month,
23
- onMonthChange = props.onMonthChange,
24
- onMonthNameClick = props.onMonthNameClick,
25
- onYearNameClick = props.onYearNameClick,
26
- hideLongNext = props.hideLongNext,
27
- hideLongPrev = props.hideLongPrev,
28
- hideShortNext = props.hideShortNext,
29
- hideShortPrev = props.hideShortPrev,
30
- renderNavbar = props.renderNavbar,
31
- intl = props.intl,
32
- modifiers = props.modifiers,
33
- rest = _objectWithoutPropertiesLoose(props, _excluded);
34
-
18
+ onMonthChange = props.onMonthChange,
19
+ onMonthNameClick = props.onMonthNameClick,
20
+ onYearNameClick = props.onYearNameClick,
21
+ hideLongNext = props.hideLongNext,
22
+ hideLongPrev = props.hideLongPrev,
23
+ hideShortNext = props.hideShortNext,
24
+ hideShortPrev = props.hideShortPrev,
25
+ renderNavbar = props.renderNavbar,
26
+ intl = props.intl,
27
+ modifiers = props.modifiers,
28
+ rest = _objectWithoutPropertiesLoose(props, _excluded);
35
29
  var _useDataFormat = useDataFormat(),
36
- firstDayOfWeek = _useDataFormat.firstDayOfWeek;
37
-
30
+ firstDayOfWeek = _useDataFormat.firstDayOfWeek;
38
31
  return /*#__PURE__*/React.createElement(React.Fragment, null, renderNavbar ? renderNavbar(props) : /*#__PURE__*/React.createElement(Navbar, {
39
32
  title: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(S.Link, {
40
33
  "data-testid": "datapicker-nav-title-monthpicker-link",
@@ -66,5 +59,4 @@ var Picker = function Picker(props) {
66
59
  modifiers: modifiers
67
60
  }, rest)));
68
61
  };
69
-
70
62
  export default injectIntl(Picker);
@@ -1,11 +1,9 @@
1
1
  import styled from 'styled-components';
2
2
  import DayPickerBase from 'react-day-picker';
3
3
  var DaySelectorPrefix = ".DayPicker-Day";
4
-
5
4
  var daySelector = function daySelector(modifier) {
6
5
  return DaySelectorPrefix + "--" + modifier;
7
6
  };
8
-
9
7
  export var DayBackground = styled.div.withConfig({
10
8
  displayName: "DayPickerstyles__DayBackground",
11
9
  componentId: "oi7l9r-0"
@@ -1,13 +1,8 @@
1
1
  function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
2
-
3
2
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
4
-
5
3
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
-
7
4
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
8
-
9
5
  function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
10
-
11
6
  import React from 'react';
12
7
  import { range } from 'lodash';
13
8
  import { legacyParse } from '@date-fns/upgrade/v2';
@@ -15,13 +10,11 @@ import GridPicker from '../GridPicker/GridPicker';
15
10
  import Navbar from '../Navbar/Navbar';
16
11
  import { getDecadeRange, getCenturyRange } from '../../utils';
17
12
  import { fnsAddYears, fnsSetYear, fnsGetYear } from '../../fns';
18
-
19
13
  function getInitialState(props) {
20
14
  return {
21
15
  cursor: props.value || new Date()
22
16
  };
23
17
  }
24
-
25
18
  function getCells(cursor) {
26
19
  var startYear = getCenturyRange(cursor)[0];
27
20
  return range(0, 10).map(function (index) {
@@ -32,75 +25,54 @@ function getCells(cursor) {
32
25
  };
33
26
  });
34
27
  }
35
-
36
28
  var DecadePicker = /*#__PURE__*/function (_React$PureComponent) {
37
29
  function DecadePicker() {
38
30
  var _this;
39
-
40
31
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
41
32
  args[_key] = arguments[_key];
42
33
  }
43
-
44
34
  _this = _React$PureComponent.call.apply(_React$PureComponent, [this].concat(args)) || this;
45
-
46
35
  _defineProperty(_this, "state", getInitialState(_this.props));
47
-
48
36
  _defineProperty(_this, "handleLongPrev", function () {
49
37
  var cursor = _this.state.cursor;
50
-
51
38
  _this.setState({
52
39
  cursor: fnsAddYears(cursor, -100)
53
40
  });
54
41
  });
55
-
56
42
  _defineProperty(_this, "handleLongNext", function () {
57
43
  var cursor = _this.state.cursor;
58
-
59
44
  _this.setState({
60
45
  cursor: fnsAddYears(cursor, 100)
61
46
  });
62
47
  });
63
-
64
48
  _defineProperty(_this, "handleCellClick", function (isoDate) {
65
49
  var onChange = _this.props.onChange;
66
-
67
50
  if (isoDate === -1) {
68
51
  _this.handleLongPrev();
69
-
70
52
  return;
71
53
  }
72
-
73
54
  if (isoDate === 1) {
74
55
  _this.handleLongNext();
75
-
76
56
  return;
77
57
  }
78
-
79
58
  onChange && onChange(new Date(isoDate));
80
59
  });
81
-
82
60
  return _this;
83
61
  }
84
-
85
62
  _inheritsLoose(DecadePicker, _React$PureComponent);
86
-
87
63
  var _proto = DecadePicker.prototype;
88
-
89
64
  _proto.getSnapshotBeforeUpdate = function getSnapshotBeforeUpdate(prevProps) {
90
65
  var value = this.props.value;
91
-
92
66
  if ((prevProps == null ? void 0 : prevProps.value) !== value) {
93
67
  this.setState(getInitialState(this.props));
94
68
  }
95
-
96
69
  return null;
97
70
  };
98
-
99
71
  _proto.render = function render() {
100
72
  var cursor = this.state.cursor;
101
73
  var _this$props = this.props,
102
- value = _this$props.value,
103
- onTitleClick = _this$props.onTitleClick;
74
+ value = _this$props.value,
75
+ onTitleClick = _this$props.onTitleClick;
104
76
  var centuryRange = getCenturyRange(cursor);
105
77
  var cells = getCells(cursor);
106
78
  var valueCell = value ? cells.find(function (cell) {
@@ -132,8 +104,6 @@ var DecadePicker = /*#__PURE__*/function (_React$PureComponent) {
132
104
  key: "body"
133
105
  })];
134
106
  };
135
-
136
107
  return DecadePicker;
137
108
  }(React.PureComponent);
138
-
139
109
  export { DecadePicker as default };
@@ -1,9 +1,6 @@
1
1
  var _excluded = ["text", "canApply", "onApply", "intl", "canSwitchMode", "onSwitchMode", "mode", "dateOnly", "message", "texts", "hideNow"];
2
-
3
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : 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
-
5
3
  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; }
6
-
7
4
  import React from 'react';
8
5
  import { injectIntl } from 'react-intl';
9
6
  import { v4 as uuid } from 'uuid';
@@ -11,21 +8,19 @@ import Button from '@synerise/ds-button';
11
8
  import Tooltip from '@synerise/ds-tooltip';
12
9
  import Icon, { CalendarM, ClockM } from '@synerise/ds-icon';
13
10
  import * as S from './Footer.styles';
14
-
15
11
  var Footer = function Footer(_ref) {
16
12
  var text = _ref.text,
17
- canApply = _ref.canApply,
18
- onApply = _ref.onApply,
19
- intl = _ref.intl,
20
- canSwitchMode = _ref.canSwitchMode,
21
- onSwitchMode = _ref.onSwitchMode,
22
- mode = _ref.mode,
23
- dateOnly = _ref.dateOnly,
24
- message = _ref.message,
25
- texts = _ref.texts,
26
- hideNow = _ref.hideNow,
27
- rest = _objectWithoutPropertiesLoose(_ref, _excluded);
28
-
13
+ canApply = _ref.canApply,
14
+ onApply = _ref.onApply,
15
+ intl = _ref.intl,
16
+ canSwitchMode = _ref.canSwitchMode,
17
+ onSwitchMode = _ref.onSwitchMode,
18
+ mode = _ref.mode,
19
+ dateOnly = _ref.dateOnly,
20
+ message = _ref.message,
21
+ texts = _ref.texts,
22
+ hideNow = _ref.hideNow,
23
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
29
24
  var SwitchModeButton = React.useMemo(function () {
30
25
  return /*#__PURE__*/React.createElement(Button, {
31
26
  type: "ghost",
@@ -58,5 +53,4 @@ var Footer = function Footer(_ref) {
58
53
  }
59
54
  }, texts.apply))));
60
55
  };
61
-
62
56
  export default injectIntl(Footer);
@@ -1,39 +1,29 @@
1
1
  function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
2
-
3
2
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
4
-
5
3
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
-
7
4
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
8
-
9
5
  function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
10
-
11
6
  import React from 'react';
12
7
  import classNames from 'classnames';
13
8
  import * as S from './GridPicker.styles';
14
-
15
9
  var GridPicker = /*#__PURE__*/function (_React$PureComponent) {
16
10
  function GridPicker() {
17
11
  var _this;
18
-
19
12
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
20
13
  args[_key] = arguments[_key];
21
14
  }
22
-
23
15
  _this = _React$PureComponent.call.apply(_React$PureComponent, [this].concat(args)) || this;
24
-
25
16
  _defineProperty(_this, "handleCellClick", function (cell) {
26
17
  if (cell.disabled) return;
27
18
  var onCellClick = _this.props.onCellClick;
28
19
  onCellClick && onCellClick(cell.key);
29
20
  });
30
-
31
21
  _defineProperty(_this, "renderCell", function (cell) {
32
22
  var selectedKey = _this.props.selectedKey;
33
23
  var key = cell.key,
34
- text = cell.text,
35
- disabled = cell.disabled,
36
- outside = cell.outside;
24
+ text = cell.text,
25
+ disabled = cell.disabled,
26
+ outside = cell.outside;
37
27
  return /*#__PURE__*/React.createElement(S.CellContainer, {
38
28
  className: classNames('cell', {
39
29
  'cell--selected': selectedKey === key,
@@ -49,20 +39,14 @@ var GridPicker = /*#__PURE__*/function (_React$PureComponent) {
49
39
  className: "cell-content"
50
40
  }, text));
51
41
  });
52
-
53
42
  return _this;
54
43
  }
55
-
56
44
  _inheritsLoose(GridPicker, _React$PureComponent);
57
-
58
45
  var _proto = GridPicker.prototype;
59
-
60
46
  _proto.render = function render() {
61
47
  var cells = this.props.cells;
62
48
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(S.GridContainer, null, cells.map(this.renderCell)));
63
49
  };
64
-
65
50
  return GridPicker;
66
51
  }(React.PureComponent);
67
-
68
52
  export { GridPicker as default };
@@ -1,13 +1,8 @@
1
1
  function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
2
-
3
2
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
4
-
5
3
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
-
7
4
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
8
-
9
5
  function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
10
-
11
6
  import React from 'react';
12
7
  import { injectIntl } from 'react-intl';
13
8
  import { range } from 'lodash';
@@ -17,14 +12,12 @@ import fnsFormat from '../../format';
17
12
  import YearPicker from '../YearPicker/YearPicker';
18
13
  import GridPicker from '../GridPicker/GridPicker';
19
14
  import Navbar from '../Navbar/Navbar';
20
-
21
15
  function getInitialState(props) {
22
16
  return {
23
17
  cursor: props.value || new Date(),
24
18
  yearMode: false
25
19
  };
26
20
  }
27
-
28
21
  function getCells(cursor, min, max, locale) {
29
22
  var minDate = min ? fnsStartOfMonth(min) : fnsSetMonth(cursor, 0);
30
23
  var maxDate = max ? fnsEndOfMonth(max) : fnsSetMonth(cursor, 12);
@@ -37,70 +30,53 @@ function getCells(cursor, min, max, locale) {
37
30
  };
38
31
  });
39
32
  }
40
-
41
33
  var MonthPicker = /*#__PURE__*/function (_React$PureComponent) {
42
34
  function MonthPicker() {
43
35
  var _this;
44
-
45
36
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
46
37
  args[_key] = arguments[_key];
47
38
  }
48
-
49
39
  _this = _React$PureComponent.call.apply(_React$PureComponent, [this].concat(args)) || this;
50
-
51
40
  _defineProperty(_this, "state", getInitialState(_this.props));
52
-
53
41
  _defineProperty(_this, "handleLongPrev", function () {
54
42
  var cursor = _this.state.cursor;
55
-
56
43
  _this.setState({
57
44
  cursor: fnsAddYears(cursor, -1)
58
45
  });
59
46
  });
60
-
61
47
  _defineProperty(_this, "handleLongNext", function () {
62
48
  var cursor = _this.state.cursor;
63
-
64
49
  _this.setState({
65
50
  cursor: fnsAddYears(cursor, 1)
66
51
  });
67
52
  });
68
-
69
53
  return _this;
70
54
  }
71
-
72
55
  _inheritsLoose(MonthPicker, _React$PureComponent);
73
-
74
56
  var _proto = MonthPicker.prototype;
75
-
76
57
  _proto.getSnapshotBeforeUpdate = function getSnapshotBeforeUpdate(prevProps) {
77
58
  var value = this.props.value;
78
-
79
59
  if ((prevProps == null ? void 0 : prevProps.value) !== value) {
80
60
  this.setState(getInitialState(this.props));
81
61
  }
82
-
83
62
  return null;
84
63
  };
85
-
86
64
  _proto.render = function render() {
87
65
  var _this2 = this;
88
-
89
66
  var _this$state = this.state,
90
- cursor = _this$state.cursor,
91
- yearMode = _this$state.yearMode;
67
+ cursor = _this$state.cursor,
68
+ yearMode = _this$state.yearMode;
92
69
  var _this$props = this.props,
93
- min = _this$props.min,
94
- max = _this$props.max,
95
- value = _this$props.value,
96
- intl = _this$props.intl,
97
- onChange = _this$props.onChange;
70
+ min = _this$props.min,
71
+ max = _this$props.max,
72
+ value = _this$props.value,
73
+ intl = _this$props.intl,
74
+ onChange = _this$props.onChange;
98
75
  var cells = getCells(cursor, min, max, intl == null ? void 0 : intl.locale);
99
76
  var valueCell = value ? cells.find(function (cell) {
100
77
  return fnsIsSameMonth(value, legacyParse(cell.key));
101
78
  }) : null;
102
79
  var selectedKey = valueCell ? valueCell.key : null;
103
-
104
80
  if (yearMode) {
105
81
  return /*#__PURE__*/React.createElement(YearPicker, {
106
82
  value: cursor,
@@ -112,7 +88,6 @@ var MonthPicker = /*#__PURE__*/function (_React$PureComponent) {
112
88
  }
113
89
  });
114
90
  }
115
-
116
91
  return [/*#__PURE__*/React.createElement(Navbar, {
117
92
  onTitleClick: function onTitleClick() {
118
93
  return _this2.setState({
@@ -132,8 +107,6 @@ var MonthPicker = /*#__PURE__*/function (_React$PureComponent) {
132
107
  key: "body"
133
108
  })];
134
109
  };
135
-
136
110
  return MonthPicker;
137
111
  }(React.PureComponent);
138
-
139
112
  export default injectIntl(MonthPicker);
@@ -2,18 +2,17 @@ import React from 'react';
2
2
  import { v4 as uuid } from 'uuid';
3
3
  import Icon, { AngleLeftS, AngleRightS, DoubleAngleLeftS, DoubleAngleRightS } from '@synerise/ds-icon';
4
4
  import * as S from './Navbar.styles';
5
-
6
5
  var Navbar = function Navbar(props) {
7
6
  var title = props.title,
8
- onTitleClick = props.onTitleClick,
9
- hidePrev = props.hidePrev,
10
- hideNext = props.hideNext,
11
- onLongPrev = props.onLongPrev,
12
- onLongNext = props.onLongNext,
13
- onShortPrev = props.onShortPrev,
14
- onShortNext = props.onShortNext,
15
- inactivePrev = props.inactivePrev,
16
- inactiveNext = props.inactiveNext;
7
+ onTitleClick = props.onTitleClick,
8
+ hidePrev = props.hidePrev,
9
+ hideNext = props.hideNext,
10
+ onLongPrev = props.onLongPrev,
11
+ onLongNext = props.onLongNext,
12
+ onShortPrev = props.onShortPrev,
13
+ onShortNext = props.onShortNext,
14
+ inactivePrev = props.inactivePrev,
15
+ inactiveNext = props.inactiveNext;
17
16
  return /*#__PURE__*/React.createElement(S.Container, {
18
17
  className: "ds-date-picker-nav"
19
18
  }, /*#__PURE__*/React.createElement(S.ArrowContainer, null, onLongPrev && !hidePrev ? /*#__PURE__*/React.createElement(S.NavButton, {
@@ -68,5 +67,4 @@ var Navbar = function Navbar(props) {
68
67
  className: "arrow-placeholder long-next"
69
68
  })));
70
69
  };
71
-
72
70
  export default Navbar;
@@ -1,19 +1,11 @@
1
1
  var _excluded = ["autoFocus", "size", "disabled", "readOnly", "value", "format", "valueFormatOptions", "onChange", "showTime", "placeholder", "onClear", "onClick", "clearTooltip", "highlight", "error", "errorText", "prefixel", "suffixel", "allowClear"];
2
-
3
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : 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
-
5
3
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
6
-
7
4
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
8
-
9
5
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
10
-
11
6
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
12
-
13
7
  function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
14
-
15
8
  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; }
16
-
17
9
  import React, { useCallback, useMemo, useState } from 'react';
18
10
  import Icon, { CalendarM, Close3S } from '@synerise/ds-icon';
19
11
  import Tooltip from '@synerise/ds-tooltip';
@@ -21,47 +13,40 @@ import { getDefaultDataTimeOptions, useDataFormat } from '@synerise/ds-data-form
21
13
  import { legacyParse } from '@date-fns/upgrade/v2';
22
14
  import * as S from './PickerInput.styles';
23
15
  import format from '../../format';
24
-
25
16
  var PickerInput = function PickerInput(_ref) {
26
17
  var autoFocus = _ref.autoFocus,
27
- size = _ref.size,
28
- disabled = _ref.disabled,
29
- readOnly = _ref.readOnly,
30
- value = _ref.value,
31
- dateFormat = _ref.format,
32
- valueFormatOptions = _ref.valueFormatOptions,
33
- onChange = _ref.onChange,
34
- showTime = _ref.showTime,
35
- placeholder = _ref.placeholder,
36
- onClear = _ref.onClear,
37
- onClick = _ref.onClick,
38
- clearTooltip = _ref.clearTooltip,
39
- highlight = _ref.highlight,
40
- error = _ref.error,
41
- errorText = _ref.errorText,
42
- prefixel = _ref.prefixel,
43
- suffixel = _ref.suffixel,
44
- allowClear = _ref.allowClear,
45
- rest = _objectWithoutPropertiesLoose(_ref, _excluded);
46
-
18
+ size = _ref.size,
19
+ disabled = _ref.disabled,
20
+ readOnly = _ref.readOnly,
21
+ value = _ref.value,
22
+ dateFormat = _ref.format,
23
+ valueFormatOptions = _ref.valueFormatOptions,
24
+ onChange = _ref.onChange,
25
+ showTime = _ref.showTime,
26
+ placeholder = _ref.placeholder,
27
+ onClear = _ref.onClear,
28
+ onClick = _ref.onClick,
29
+ clearTooltip = _ref.clearTooltip,
30
+ highlight = _ref.highlight,
31
+ error = _ref.error,
32
+ errorText = _ref.errorText,
33
+ prefixel = _ref.prefixel,
34
+ suffixel = _ref.suffixel,
35
+ allowClear = _ref.allowClear,
36
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
47
37
  var _useDataFormat = useDataFormat(),
48
- formatValue = _useDataFormat.formatValue;
49
-
38
+ formatValue = _useDataFormat.formatValue;
50
39
  var _useState = useState(false),
51
- hovered = _useState[0],
52
- setHovered = _useState[1];
53
-
40
+ hovered = _useState[0],
41
+ setHovered = _useState[1];
54
42
  var getText = useCallback(function () {
55
43
  if (!value) return '';
56
-
57
44
  if (dateFormat) {
58
45
  return format(legacyParse(value), dateFormat);
59
46
  }
60
-
61
47
  if (typeof value === 'string') {
62
48
  return format(legacyParse(value), dateFormat || showTime ? 'MMM d, yyyy, HH:mm' : 'MMM d, yyyy');
63
49
  }
64
-
65
50
  return formatValue(value, _objectSpread({}, getDefaultDataTimeOptions(showTime), {}, valueFormatOptions));
66
51
  }, [value, dateFormat, showTime, formatValue, valueFormatOptions]);
67
52
  var handleApply = useCallback(function (date) {
@@ -114,5 +99,4 @@ var PickerInput = function PickerInput(_ref) {
114
99
  errorText: errorText
115
100
  }, rest))), !!suffixel && /*#__PURE__*/React.createElement(S.Suffixel, null, suffixel));
116
101
  };
117
-
118
102
  export default PickerInput;