@jetbrains/ring-ui 5.0.36 → 5.0.37

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.
Files changed (236) hide show
  1. package/components/input/input.css +2 -0
  2. package/components/query-assist/query-assist.js +1 -1
  3. package/dist/_helpers/_rollupPluginBabelHelpers.js +0 -4
  4. package/dist/_helpers/anchor.js +0 -1
  5. package/dist/_helpers/card.js +0 -3
  6. package/dist/_helpers/dialog__body-scroll-preventer.js +0 -11
  7. package/dist/_helpers/footer.js +2 -13
  8. package/dist/_helpers/query-assist__suggestions.js +0 -10
  9. package/dist/_helpers/select__filter.js +0 -11
  10. package/dist/_helpers/services-link.js +0 -2
  11. package/dist/_helpers/sidebar.js +0 -12
  12. package/dist/_helpers/theme.js +0 -3
  13. package/dist/_helpers/title.js +0 -9
  14. package/dist/alert/alert.js +2 -32
  15. package/dist/alert/container.js +0 -5
  16. package/dist/alert-service/alert-service.js +0 -26
  17. package/dist/analytics/analytics.js +0 -22
  18. package/dist/analytics/analytics__custom-plugin.js +0 -38
  19. package/dist/analytics/analytics__fus-plugin.js +0 -20
  20. package/dist/analytics/analytics__ga-plugin.js +0 -13
  21. package/dist/analytics/analytics__plugin-utils.js +0 -8
  22. package/dist/analytics-ng/analytics-ng.js +3 -9
  23. package/dist/auth/auth.js +2 -3
  24. package/dist/auth/auth__core.js +30 -243
  25. package/dist/auth/background-flow.js +2 -25
  26. package/dist/auth/down-notification.js +0 -7
  27. package/dist/auth/iframe-flow.js +2 -26
  28. package/dist/auth/landing.js +2 -6
  29. package/dist/auth/request-builder.js +0 -11
  30. package/dist/auth/response-parser.js +4 -26
  31. package/dist/auth/storage.js +4 -60
  32. package/dist/auth/token-validator.js +6 -42
  33. package/dist/auth/window-flow.js +2 -34
  34. package/dist/auth-dialog/auth-dialog.js +2 -12
  35. package/dist/auth-dialog-service/auth-dialog-service.js +2 -4
  36. package/dist/auth-ng/auth-ng.js +6 -22
  37. package/dist/auth-ng/auth-ng.mock.js +0 -4
  38. package/dist/autofocus-ng/autofocus-ng.js +0 -5
  39. package/dist/avatar/avatar.js +4 -17
  40. package/dist/avatar/fallback-avatar.js +2 -9
  41. package/dist/avatar-editor-ng/avatar-editor-ng.js +1 -17
  42. package/dist/badge/badge.js +0 -3
  43. package/dist/button/button.js +0 -8
  44. package/dist/button-group/button-group.js +0 -3
  45. package/dist/button-group/caption.js +0 -2
  46. package/dist/button-group-ng/button-group-ng.js +0 -4
  47. package/dist/button-ng/button-ng.js +3 -21
  48. package/dist/button-set/button-set.js +0 -3
  49. package/dist/button-set-ng/button-set-ng.js +0 -2
  50. package/dist/button-toolbar/button-toolbar.js +0 -3
  51. package/dist/button-toolbar-ng/button-toolbar-ng.js +0 -2
  52. package/dist/caret/caret.js +2 -53
  53. package/dist/checkbox/checkbox.js +0 -12
  54. package/dist/code/code.js +3 -25
  55. package/dist/compiler-ng/compiler-ng.js +0 -5
  56. package/dist/confirm/confirm.js +0 -6
  57. package/dist/confirm-service/confirm-service.js +10 -8
  58. package/dist/content-layout/content-layout.js +0 -7
  59. package/dist/contenteditable/contenteditable.js +6 -13
  60. package/dist/data-list/data-list.js +4 -28
  61. package/dist/data-list/item.js +0 -15
  62. package/dist/data-list/selection.js +0 -27
  63. package/dist/date-picker/consts.js +0 -7
  64. package/dist/date-picker/date-input.js +0 -20
  65. package/dist/date-picker/date-picker.js +2 -36
  66. package/dist/date-picker/date-popup.js +18 -71
  67. package/dist/date-picker/day.js +0 -14
  68. package/dist/date-picker/month-names.js +0 -9
  69. package/dist/date-picker/month-slider.js +0 -10
  70. package/dist/date-picker/month.js +2 -4
  71. package/dist/date-picker/months.js +6 -13
  72. package/dist/date-picker/years.js +0 -14
  73. package/dist/dialog/dialog.js +0 -19
  74. package/dist/dialog-ng/dialog-ng.js +17 -105
  75. package/dist/docked-panel-ng/docked-panel-ng.js +6 -29
  76. package/dist/dropdown/dropdown.js +2 -33
  77. package/dist/dropdown-menu/dropdown-menu.js +4 -8
  78. package/dist/editable-heading/editable-heading.js +0 -3
  79. package/dist/error-bubble/error-bubble.js +2 -4
  80. package/dist/error-message/error-message.js +0 -3
  81. package/dist/footer-ng/footer-ng.js +0 -13
  82. package/dist/form-ng/form-ng.js +1 -21
  83. package/dist/global/angular-component-factory.js +0 -10
  84. package/dist/global/compose.js +0 -1
  85. package/dist/global/composeRefs.js +0 -1
  86. package/dist/global/controls-height.js +0 -2
  87. package/dist/global/create-stateful-context.js +0 -5
  88. package/dist/global/data-tests.js +0 -4
  89. package/dist/global/dom.js +2 -11
  90. package/dist/global/focus-sensor-hoc.js +4 -33
  91. package/dist/global/fuzzy-highlight.js +2 -16
  92. package/dist/global/get-event-key.js +8 -17
  93. package/dist/global/get-uid.js +0 -2
  94. package/dist/global/linear-function.js +0 -2
  95. package/dist/global/listeners.js +0 -13
  96. package/dist/global/memoize.js +0 -2
  97. package/dist/global/normalize-indent.js +2 -5
  98. package/dist/global/react-dom-renderer.js +0 -8
  99. package/dist/global/react-render-adapter.js +0 -7
  100. package/dist/global/rerender-hoc.js +0 -7
  101. package/dist/global/ring-angular-component.js +0 -5
  102. package/dist/global/schedule-raf.js +0 -5
  103. package/dist/global/trivial-template-tag.js +2 -3
  104. package/dist/global/url.js +0 -27
  105. package/dist/grid/col.js +0 -4
  106. package/dist/grid/grid.js +0 -3
  107. package/dist/grid/row.js +0 -5
  108. package/dist/group/group.js +0 -3
  109. package/dist/header/header.js +0 -5
  110. package/dist/header/logo.js +0 -4
  111. package/dist/header/profile.js +0 -7
  112. package/dist/header/services.js +0 -11
  113. package/dist/header/smart-profile.js +4 -18
  114. package/dist/header/smart-services.js +0 -17
  115. package/dist/header/tray-icon.js +2 -3
  116. package/dist/header/tray.js +0 -3
  117. package/dist/heading/heading.js +0 -5
  118. package/dist/http/http.js +20 -65
  119. package/dist/http/http.mock.js +2 -14
  120. package/dist/hub-source/hub-source.js +0 -32
  121. package/dist/hub-source/hub-source__user.js +0 -1
  122. package/dist/hub-source/hub-source__users-groups.js +0 -12
  123. package/dist/icon/icon.js +0 -13
  124. package/dist/icon/icon__constants.js +0 -4
  125. package/dist/icon/icon__svg.js +0 -10
  126. package/dist/icon-ng/icon-ng.js +2 -7
  127. package/dist/input/input.js +0 -30
  128. package/dist/input-ng/input-ng.js +0 -17
  129. package/dist/island/adaptive-island-hoc.js +0 -7
  130. package/dist/island/content.js +0 -25
  131. package/dist/island/header.js +0 -7
  132. package/dist/island/island.js +0 -4
  133. package/dist/island-legacy/content-legacy.js +0 -2
  134. package/dist/island-legacy/header-legacy.js +0 -2
  135. package/dist/island-legacy/island-legacy.js +0 -2
  136. package/dist/island-ng/island-content-ng.js +0 -3
  137. package/dist/link/clickableLink.js +2 -10
  138. package/dist/link/link.js +2 -9
  139. package/dist/link-ng/link-ng.js +0 -2
  140. package/dist/list/consts.js +0 -4
  141. package/dist/list/list.js +6 -128
  142. package/dist/list/list__custom.js +0 -4
  143. package/dist/list/list__hint.js +0 -3
  144. package/dist/list/list__item.js +0 -8
  145. package/dist/list/list__link.js +2 -3
  146. package/dist/list/list__separator.js +0 -1
  147. package/dist/list/list__title.js +0 -1
  148. package/dist/list/list__users-groups-source.js +4 -17
  149. package/dist/loader/loader.js +0 -10
  150. package/dist/loader/loader__core.js +6 -70
  151. package/dist/loader-inline/loader-inline.js +0 -3
  152. package/dist/loader-ng/loader-ng.js +0 -7
  153. package/dist/loader-screen/loader-screen.js +0 -3
  154. package/dist/loader-screen-ng/loader-screen-ng.js +2 -14
  155. package/dist/login-dialog/login-dialog.js +0 -15
  156. package/dist/login-dialog/service.js +2 -4
  157. package/dist/markdown/code.js +0 -2
  158. package/dist/markdown/heading.js +0 -1
  159. package/dist/markdown/link.js +0 -1
  160. package/dist/markdown/markdown.js +0 -2
  161. package/dist/message/message.js +0 -24
  162. package/dist/message-bundle-ng/message-bundle-ng.js +2 -45
  163. package/dist/old-browsers-message/old-browsers-message.js +2 -21
  164. package/dist/old-browsers-message/white-list.js +2 -6
  165. package/dist/pager/pager.js +2 -39
  166. package/dist/panel/panel.js +0 -3
  167. package/dist/permissions/permissions.js +1 -43
  168. package/dist/permissions/permissions__cache.js +12 -63
  169. package/dist/permissions-ng/permissions-ng.js +11 -19
  170. package/dist/place-under-ng/place-under-ng.js +0 -19
  171. package/dist/popup/popup.consts.js +0 -11
  172. package/dist/popup/popup.js +6 -68
  173. package/dist/popup/position.js +8 -30
  174. package/dist/popup-menu/popup-menu.js +4 -13
  175. package/dist/progress-bar/progress-bar.js +0 -14
  176. package/dist/promised-click-ng/promised-click-ng.js +3 -22
  177. package/dist/query-assist/query-assist.js +17 -201
  178. package/dist/radio/radio.js +0 -6
  179. package/dist/radio/radio__item.js +0 -9
  180. package/dist/radio-ng/radio-ng.js +0 -4
  181. package/dist/save-field-ng/save-field-ng.js +1 -37
  182. package/dist/select/select.js +18 -208
  183. package/dist/select/select__popup.js +4 -76
  184. package/dist/select-ng/select-ng.js +18 -74
  185. package/dist/select-ng/select-ng__lazy.js +2 -17
  186. package/dist/select-ng/select-ng__options.js +3 -29
  187. package/dist/shortcuts/core.js +4 -56
  188. package/dist/shortcuts/shortcuts-hoc.js +0 -4
  189. package/dist/shortcuts/shortcuts.js +0 -10
  190. package/dist/shortcuts-hint-ng/shortcuts-hint-ng.js +0 -13
  191. package/dist/shortcuts-ng/shortcuts-ng.js +16 -46
  192. package/dist/sidebar-ng/sidebar-ng.js +2 -12
  193. package/dist/storage/storage.js +2 -5
  194. package/dist/storage/storage__fallback.js +2 -48
  195. package/dist/storage/storage__local.js +0 -23
  196. package/dist/style.css +1 -1
  197. package/dist/tab-trap/tab-trap.js +0 -37
  198. package/dist/table/cell.js +0 -2
  199. package/dist/table/disable-hover-hoc.js +0 -9
  200. package/dist/table/header-cell.js +0 -8
  201. package/dist/table/header.js +0 -16
  202. package/dist/table/multitable.js +0 -23
  203. package/dist/table/row-with-focus-sensor.js +0 -12
  204. package/dist/table/row.js +0 -18
  205. package/dist/table/selection-adapter.js +0 -2
  206. package/dist/table/selection-shortcuts-hoc.js +8 -42
  207. package/dist/table/selection.js +0 -50
  208. package/dist/table/smart-table.js +0 -9
  209. package/dist/table/table.js +6 -37
  210. package/dist/table-legacy-ng/table-legacy-ng.js +12 -42
  211. package/dist/table-legacy-ng/table-legacy-ng__selection-navigate-actions.js +0 -31
  212. package/dist/table-legacy-ng/table-legacy-ng__selection.js +0 -32
  213. package/dist/table-legacy-ng/table-legacy-ng__toolbar.js +2 -5
  214. package/dist/tabs/collapsible-more.js +0 -5
  215. package/dist/tabs/collapsible-tab.js +0 -4
  216. package/dist/tabs/collapsible-tabs.js +8 -28
  217. package/dist/tabs/dumb-tabs.js +0 -8
  218. package/dist/tabs/smart-tabs.js +0 -6
  219. package/dist/tabs/tab-link.js +0 -1
  220. package/dist/tabs/tab.js +0 -2
  221. package/dist/tabs-ng/tabs-ng.js +13 -29
  222. package/dist/tag/tag.js +0 -24
  223. package/dist/tags-input/tags-input.js +0 -76
  224. package/dist/tags-list/tags-list.js +0 -6
  225. package/dist/template-ng/template-ng.js +0 -12
  226. package/dist/text/text.js +0 -3
  227. package/dist/theme-ng/theme-ng.js +0 -8
  228. package/dist/title-ng/title-ng.js +6 -17
  229. package/dist/toggle/toggle.js +0 -4
  230. package/dist/tooltip/tooltip.js +4 -35
  231. package/dist/tooltip-ng/tooltip-ng.js +2 -8
  232. package/dist/user-agreement/service.js +0 -62
  233. package/dist/user-agreement/user-agreement.js +0 -8
  234. package/dist/user-card/smart-user-card-tooltip.js +2 -8
  235. package/dist/user-card/tooltip.js +0 -3
  236. package/package.json +15 -15
@@ -5,10 +5,8 @@ class Selection extends Selection$1 {
5
5
  _buildData(data) {
6
6
  return new Set(this._getDescendants(data));
7
7
  }
8
-
9
8
  _buildSelected(data, selected) {
10
9
  const _selected = new Set(selected);
11
-
12
10
  [...data].forEach(item => {
13
11
  if (_selected.has(item)) {
14
12
  this._selectDescendants(item, _selected);
@@ -16,7 +14,6 @@ class Selection extends Selection$1 {
16
14
  });
17
15
  return _selected;
18
16
  }
19
-
20
17
  _getDescendants(items) {
21
18
  let result = [];
22
19
  items.forEach(item => {
@@ -25,90 +22,66 @@ class Selection extends Selection$1 {
25
22
  });
26
23
  return result;
27
24
  }
28
-
29
25
  _getAncestors(item) {
30
26
  let result = [];
31
27
  const parent = [...this._data].find(it => this._getChildren(it).includes(item));
32
-
33
28
  if (parent) {
34
29
  result = [parent, ...this._getAncestors(parent)];
35
30
  }
36
-
37
31
  return result;
38
32
  }
39
-
40
33
  _selectDescendants(item, selected) {
41
34
  this._getDescendants(this._getChildren(item)).forEach(it => selected.add(it));
42
35
  }
43
-
44
36
  _deselectDescendants(item, selected) {
45
37
  this._getDescendants(this._getChildren(item)).forEach(it => selected.delete(it));
46
38
  }
47
-
48
39
  _selectAncestors(item, selected) {
49
40
  this._getAncestors(item).forEach(ancestor => {
50
41
  const groupIsSelected = this._getChildren(ancestor).filter(it => this._isItemSelectable(it)).every(it => selected.has(it));
51
-
52
42
  if (groupIsSelected) {
53
43
  selected.add(ancestor);
54
44
  }
55
45
  });
56
46
  }
57
-
58
47
  _deselectAncestors(item, selected) {
59
48
  this._getAncestors(item).forEach(it => selected.delete(it));
60
49
  }
61
-
62
50
  select() {
63
51
  let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._focused;
64
-
65
52
  if (!value || !this._isItemSelectable(value)) {
66
53
  return this;
67
54
  }
68
-
69
55
  const selected = new Set(this._selected);
70
56
  selected.add(value);
71
-
72
57
  this._selectDescendants(value, selected);
73
-
74
58
  this._selectAncestors(value, selected);
75
-
76
59
  return this.cloneWith({
77
60
  selected
78
61
  });
79
62
  }
80
-
81
63
  focus(value) {
82
64
  return super.focus(value);
83
65
  }
84
-
85
66
  resetSelection() {
86
67
  return super.resetSelection();
87
68
  }
88
-
89
69
  cloneWith(config) {
90
70
  return super.cloneWith(config);
91
71
  }
92
-
93
72
  deselect() {
94
73
  let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._focused;
95
-
96
74
  if (!value || !this._isItemSelectable(value)) {
97
75
  return this;
98
76
  }
99
-
100
77
  const selected = new Set(this._selected);
101
78
  selected.delete(value);
102
-
103
79
  this._deselectDescendants(value, selected);
104
-
105
80
  this._deselectAncestors(value, selected);
106
-
107
81
  return this.cloneWith({
108
82
  selected
109
83
  });
110
84
  }
111
-
112
85
  }
113
86
 
114
87
  export { Selection as default };
@@ -2,16 +2,13 @@ import PropTypes from 'prop-types';
2
2
  import add from 'date-fns/add';
3
3
 
4
4
  const unit = 8; // px;
5
-
6
5
  const units = {
7
6
  unit,
8
-
9
7
  /* eslint-disable @typescript-eslint/no-magic-numbers */
10
8
  cellSize: unit * 3,
11
9
  calHeight: unit * 36,
12
10
  yearHeight: unit * 4
13
11
  /* eslint-enable */
14
-
15
12
  };
16
13
  const YEAR = 12;
17
14
  const WEEK = 7;
@@ -25,9 +22,7 @@ const weekdays = {
25
22
  SU: 0
26
23
  };
27
24
  const MIDDLE_DAY = 15;
28
-
29
25
  const durationToMillis = duration => +add(0, duration);
30
-
31
26
  const yearDuration = durationToMillis({
32
27
  years: 1
33
28
  });
@@ -37,13 +32,11 @@ const HALF = 0.5;
37
32
  const dateType = PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.string, PropTypes.number]);
38
33
  function parseTime(time) {
39
34
  let result = null;
40
-
41
35
  if (/^([01][0-9]|2[0-3]):[0-5][0-9]$/.test(time)) {
42
36
  result = time;
43
37
  } else if (/^([0-9]|2[0-3]):[0-5][0-9]$/.test(time)) {
44
38
  result = `0${time}`;
45
39
  }
46
-
47
40
  return result;
48
41
  }
49
42
 
@@ -27,26 +27,20 @@ import 'date-fns/add';
27
27
  class DateInput extends React.PureComponent {
28
28
  constructor() {
29
29
  super(...arguments);
30
-
31
30
  _defineProperty(this, "input", void 0);
32
-
33
31
  _defineProperty(this, "inputRef", el => {
34
32
  this.input = el;
35
33
  this.updateInput(this.props);
36
34
  });
37
-
38
35
  _defineProperty(this, "handleChange", e => this.props.onInput(e.currentTarget.value, e.currentTarget.dataset.name));
39
-
40
36
  _defineProperty(this, "handleKeyDown", e => e.key === 'Enter' && this.props.onConfirm());
41
37
  }
42
-
43
38
  componentDidUpdate(prevProps) {
44
39
  const {
45
40
  hidden,
46
41
  text,
47
42
  active
48
43
  } = this.props;
49
-
50
44
  if (!hidden && prevProps.hidden || text !== prevProps.text || active !== prevProps.active) {
51
45
  this.updateInput({
52
46
  text,
@@ -54,21 +48,17 @@ class DateInput extends React.PureComponent {
54
48
  });
55
49
  }
56
50
  }
57
-
58
51
  updateInput(_ref) {
59
52
  let {
60
53
  text,
61
54
  active
62
55
  } = _ref;
63
56
  const el = this.input;
64
-
65
57
  if (!el) {
66
58
  return;
67
59
  }
68
-
69
60
  if (active) {
70
61
  el.focus();
71
-
72
62
  if (!text) {
73
63
  el.select();
74
64
  }
@@ -76,7 +66,6 @@ class DateInput extends React.PureComponent {
76
66
  el.blur();
77
67
  }
78
68
  }
79
-
80
69
  render() {
81
70
  const {
82
71
  active,
@@ -96,7 +85,6 @@ class DateInput extends React.PureComponent {
96
85
  locale
97
86
  } = this.props;
98
87
  let displayText = '';
99
-
100
88
  if (active && hoverDate) {
101
89
  displayText = displayFormat(hoverDate, locale);
102
90
  } else if (active && text != null) {
@@ -106,23 +94,18 @@ class DateInput extends React.PureComponent {
106
94
  } else if (name === 'time') {
107
95
  displayText = time || '';
108
96
  }
109
-
110
97
  const placeholder = (() => {
111
98
  switch (name) {
112
99
  case 'from':
113
100
  return fromPlaceholder || translations.addFirstDate;
114
-
115
101
  case 'to':
116
102
  return toPlaceholder || translations.addSecondDate;
117
-
118
103
  case 'time':
119
104
  return timePlaceholder || translations.addTime;
120
-
121
105
  default:
122
106
  return translations.selectName.replace('%name%', name);
123
107
  }
124
108
  })();
125
-
126
109
  const classes = classNames(modules_0c7b7d96.filter, modules_0c7b7d96[`${name}Input`], divider && modules_0c7b7d96[`${name}InputWithDivider`], 'ring-js-shortcuts');
127
110
  return /*#__PURE__*/React.createElement(Input, {
128
111
  autoComplete: "off",
@@ -139,9 +122,7 @@ class DateInput extends React.PureComponent {
139
122
  placeholder: placeholder
140
123
  });
141
124
  }
142
-
143
125
  }
144
-
145
126
  _defineProperty(DateInput, "propTypes", {
146
127
  active: PropTypes.bool,
147
128
  divider: PropTypes.bool,
@@ -162,7 +143,6 @@ _defineProperty(DateInput, "propTypes", {
162
143
  onClear: PropTypes.func,
163
144
  locale: PropTypes.object
164
145
  });
165
-
166
146
  _defineProperty(DateInput, "defaultProps", {
167
147
  fromPlaceholder: null,
168
148
  toPlaceholder: null,
@@ -107,7 +107,6 @@ const PopupComponent = _ref => {
107
107
  hidden: hidden
108
108
  })));
109
109
  };
110
-
111
110
  PopupComponent.propTypes = {
112
111
  hidden: PropTypes.bool,
113
112
  className: PropTypes.string,
@@ -119,11 +118,9 @@ PopupComponent.propTypes = {
119
118
  /**
120
119
  * @name Date Picker
121
120
  */
122
-
123
121
  class DatePicker extends PureComponent {
124
122
  constructor() {
125
123
  super(...arguments);
126
-
127
124
  _defineProperty(this, "handleChange", change => {
128
125
  const {
129
126
  onChange,
@@ -133,48 +130,36 @@ class DatePicker extends PureComponent {
133
130
  const adjustedChange = withTime && !(change instanceof Date) && (change === null || change === void 0 ? void 0 : change.date) != null ? applyTimeInput(change.date, change.time) : change;
134
131
  onChange(adjustedChange);
135
132
  });
136
-
137
133
  _defineProperty(this, "clear", () => {
138
134
  let change = null;
139
-
140
135
  if (this.props.range) {
141
136
  change = {
142
137
  from: null,
143
138
  to: null
144
139
  };
145
140
  }
146
-
147
141
  this.handleChange(change);
148
142
  });
149
-
150
143
  _defineProperty(this, "popup", void 0);
151
-
152
144
  _defineProperty(this, "popupRef", el => {
153
145
  this.popup = el;
154
146
  });
155
-
156
147
  _defineProperty(this, "closePopup", () => {
157
148
  var _this$popup;
158
-
159
149
  (_this$popup = this.popup) === null || _this$popup === void 0 ? void 0 : _this$popup._onCloseAttempt();
160
150
  });
161
-
162
151
  _defineProperty(this, "parse", memoize(date => {
163
152
  const {
164
153
  parseDateInput
165
154
  } = this.props;
166
-
167
155
  if (date instanceof Date) {
168
156
  return date;
169
157
  }
170
-
171
158
  if (typeof date === 'number') {
172
159
  return new Date(date);
173
160
  }
174
-
175
161
  return parseDateInput(date);
176
162
  }));
177
-
178
163
  _defineProperty(this, "getAnchorText", () => {
179
164
  const {
180
165
  range,
@@ -192,7 +177,6 @@ class DatePicker extends PureComponent {
192
177
  const from = this.parse(this.props.from);
193
178
  const to = this.parse(this.props.to);
194
179
  const time = this.formatTime();
195
-
196
180
  if (!range && !withTime) {
197
181
  return date ? displayFormat(date, locale) : datePlaceholder || translations.setDate;
198
182
  } else if (!range && withTime) {
@@ -220,21 +204,17 @@ class DatePicker extends PureComponent {
220
204
  }
221
205
  });
222
206
  }
223
-
224
207
  formatTime() {
225
208
  const {
226
209
  displayTimeFormat,
227
210
  locale
228
211
  } = this.props;
229
212
  const date = this.parse(this.props.date);
230
-
231
213
  if (date != null) {
232
214
  return displayTimeFormat(date, locale);
233
215
  }
234
-
235
216
  return null;
236
217
  }
237
-
238
218
  render() {
239
219
  const anchorContent = /*#__PURE__*/React.createElement("div", {
240
220
  className: modules_0c7b7d96.anchorContent
@@ -245,7 +225,6 @@ class DatePicker extends PureComponent {
245
225
  glyph: chevronDownIcon,
246
226
  className: modules_0c7b7d96.chevronDownIcon
247
227
  }));
248
-
249
228
  if (this.props.disabled) {
250
229
  return /*#__PURE__*/React.createElement(Button, {
251
230
  "data-test-ring-dropdown-anchor": true,
@@ -254,7 +233,6 @@ class DatePicker extends PureComponent {
254
233
  text: false
255
234
  }, anchorContent);
256
235
  }
257
-
258
236
  const {
259
237
  className,
260
238
  popupClassName,
@@ -282,7 +260,8 @@ class DatePicker extends PureComponent {
282
260
  className: popupClassName,
283
261
  popupRef: this.popupRef,
284
262
  onClear: clear ? this.clear : null,
285
- datePopupProps: { ...datePopupProps,
263
+ datePopupProps: {
264
+ ...datePopupProps,
286
265
  // We want to provide translations further down to DateInput.
287
266
  // Yet we should pass at least DateInput default translations not to have them empty.
288
267
  translations: Object.assign({}, DateInput.defaultProps.translations, translations),
@@ -293,9 +272,7 @@ class DatePicker extends PureComponent {
293
272
  onComplete: this.closePopup
294
273
  }));
295
274
  }
296
-
297
275
  }
298
-
299
276
  _defineProperty(DatePicker, "propTypes", {
300
277
  className: PropTypes.string,
301
278
  popupClassName: PropTypes.string,
@@ -323,7 +300,6 @@ _defineProperty(DatePicker, "propTypes", {
323
300
  translations: PropTypes.object,
324
301
  locale: PropTypes.object
325
302
  });
326
-
327
303
  _defineProperty(DatePicker, "defaultProps", {
328
304
  className: '',
329
305
  date: null,
@@ -350,43 +326,33 @@ _defineProperty(DatePicker, "defaultProps", {
350
326
  rangePlaceholder: 'Set a period',
351
327
  minDate: null,
352
328
  maxDate: null,
353
-
354
329
  onChange() {},
355
-
356
330
  translations: {
357
331
  setDate: 'Set a date',
358
332
  setDateTime: 'Set date and time',
359
333
  setPeriod: 'Set a period'
360
334
  },
361
-
362
335
  applyTimeInput(date, timeString) {
363
336
  var _timeString$split$map;
364
-
365
337
  const [hours, minutes] = (_timeString$split$map = timeString === null || timeString === void 0 ? void 0 : timeString.split(':').map(Number)) !== null && _timeString$split$map !== void 0 ? _timeString$split$map : [];
366
338
  return minutes != null ? set(date, {
367
339
  hours,
368
340
  minutes
369
341
  }) : date;
370
342
  },
371
-
372
343
  parseDateInput(string) {
373
344
  if (!string) {
374
345
  return null;
375
346
  }
376
-
377
347
  const today = new Date();
378
-
379
348
  for (const format of formats) {
380
349
  const date = parse(string, format, today);
381
-
382
350
  if (isValid(date)) {
383
351
  return date;
384
352
  }
385
353
  }
386
-
387
354
  return null;
388
355
  }
389
-
390
356
  });
391
357
 
392
358
  export { DatePicker as default };