@jetbrains/ring-ui-built 6.0.32 → 6.0.33

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 (224) hide show
  1. package/components/_helpers/_rollupPluginBabelHelpers.js +567 -1
  2. package/components/_helpers/anchor.js +6 -7
  3. package/components/_helpers/button__classes.js +14 -16
  4. package/components/_helpers/caption.js +20 -14
  5. package/components/_helpers/card.js +105 -95
  6. package/components/_helpers/dialog__body-scroll-preventer.js +19 -11
  7. package/components/_helpers/icon__svg.js +25 -22
  8. package/components/_helpers/input.js +177 -146
  9. package/components/_helpers/query-assist__suggestions.js +90 -74
  10. package/components/_helpers/select__filter.js +69 -48
  11. package/components/_helpers/services-link.js +37 -29
  12. package/components/_helpers/sidebar.js +107 -99
  13. package/components/_helpers/tab-link.js +7 -7
  14. package/components/_helpers/theme.js +40 -31
  15. package/components/_helpers/title.js +72 -57
  16. package/components/alert/alert.js +202 -150
  17. package/components/alert/container.js +41 -32
  18. package/components/alert-service/alert-service.js +170 -105
  19. package/components/analytics/analytics.js +22 -12
  20. package/components/analytics/analytics__custom-plugin.js +75 -54
  21. package/components/auth/auth.js +36 -4
  22. package/components/auth/auth__core.js +1471 -746
  23. package/components/auth/background-flow.js +127 -87
  24. package/components/auth/down-notification.js +73 -30
  25. package/components/auth/iframe-flow.js +133 -75
  26. package/components/auth/request-builder.js +82 -46
  27. package/components/auth/response-parser.js +116 -86
  28. package/components/auth/storage.js +334 -171
  29. package/components/auth/token-validator.js +242 -137
  30. package/components/auth/window-flow.js +134 -92
  31. package/components/auth-dialog/auth-dialog.js +172 -114
  32. package/components/auth-dialog-service/auth-dialog-service.js +31 -8
  33. package/components/avatar/avatar-example-datauri.js +1 -23
  34. package/components/avatar/avatar.js +152 -119
  35. package/components/avatar/fallback-avatar.js +38 -22
  36. package/components/badge/badge.js +45 -35
  37. package/components/button/button.js +107 -86
  38. package/components/button-group/button-group.js +33 -19
  39. package/components/button-set/button-set.js +32 -20
  40. package/components/button-toolbar/button-toolbar.js +31 -19
  41. package/components/caret/caret.js +220 -186
  42. package/components/checkbox/checkbox.js +101 -76
  43. package/components/clipboard/clipboard-fallback.js +10 -10
  44. package/components/clipboard/clipboard.js +132 -35
  45. package/components/code/code.js +166 -92
  46. package/components/collapse/collapse-content.js +64 -42
  47. package/components/collapse/collapse-context.js +2 -2
  48. package/components/collapse/collapse-control.js +14 -12
  49. package/components/collapse/collapse.js +17 -11
  50. package/components/collapse/consts.js +4 -4
  51. package/components/collapse/utils.js +3 -1
  52. package/components/confirm/confirm.js +104 -66
  53. package/components/confirm-service/confirm-service.js +59 -37
  54. package/components/content-layout/content-layout.js +64 -43
  55. package/components/content-layout/sidebar.js +1 -0
  56. package/components/contenteditable/contenteditable.js +59 -50
  57. package/components/control-label/control-label.js +9 -9
  58. package/components/data-list/data-list.js +182 -129
  59. package/components/data-list/data-list.mock.js +6 -2
  60. package/components/data-list/item.js +170 -143
  61. package/components/data-list/selection.js +136 -76
  62. package/components/data-list/title.js +12 -1
  63. package/components/date-picker/consts.js +26 -19
  64. package/components/date-picker/date-input.js +144 -113
  65. package/components/date-picker/date-picker.js +282 -227
  66. package/components/date-picker/date-popup.js +395 -350
  67. package/components/date-picker/day.js +116 -87
  68. package/components/date-picker/month-names.js +66 -43
  69. package/components/date-picker/month-slider.js +76 -51
  70. package/components/date-picker/month.js +25 -16
  71. package/components/date-picker/months.js +50 -43
  72. package/components/date-picker/weekdays.js +22 -12
  73. package/components/date-picker/years.js +110 -83
  74. package/components/dialog/dialog.js +190 -142
  75. package/components/dialog/dialog__body-scroll-preventer.js +4 -0
  76. package/components/dropdown/anchor.js +9 -0
  77. package/components/dropdown/dropdown.js +213 -182
  78. package/components/dropdown-menu/dropdown-menu.js +97 -71
  79. package/components/editable-heading/editable-heading.js +127 -75
  80. package/components/error-bubble/error-bubble.js +60 -31
  81. package/components/error-message/error-message.js +59 -39
  82. package/components/footer/footer.js +30 -27
  83. package/components/global/compose.js +10 -1
  84. package/components/global/composeRefs.js +12 -7
  85. package/components/global/controls-height.js +2 -2
  86. package/components/global/create-stateful-context.js +15 -15
  87. package/components/global/data-tests.js +14 -6
  88. package/components/global/dom.js +86 -47
  89. package/components/global/focus-sensor-hoc.js +132 -122
  90. package/components/global/fuzzy-highlight.js +36 -22
  91. package/components/global/get-event-key.js +8 -8
  92. package/components/global/get-uid.js +8 -4
  93. package/components/global/inject-styles.js +15 -10
  94. package/components/global/listeners.js +51 -27
  95. package/components/global/memoize.js +12 -6
  96. package/components/global/normalize-indent.js +50 -19
  97. package/components/global/promise-with-timeout.js +8 -6
  98. package/components/global/prop-types.js +5 -3
  99. package/components/global/react-dom-renderer.js +44 -28
  100. package/components/global/react-render-adapter.js +1 -1
  101. package/components/global/rerender-hoc.js +30 -12
  102. package/components/global/schedule-raf.js +6 -5
  103. package/components/global/sniffer.js +1 -1
  104. package/components/global/theme.js +22 -0
  105. package/components/global/trivial-template-tag.js +10 -3
  106. package/components/global/typescript-utils.js +6 -2
  107. package/components/global/url.js +26 -20
  108. package/components/global/use-event-callback.js +4 -6
  109. package/components/grid/col.js +52 -35
  110. package/components/grid/grid.js +31 -17
  111. package/components/grid/row.js +47 -35
  112. package/components/group/group.js +25 -17
  113. package/components/header/header.js +78 -33
  114. package/components/header/logo.js +36 -20
  115. package/components/header/profile.js +199 -166
  116. package/components/header/services-link.js +4 -0
  117. package/components/header/services.js +116 -73
  118. package/components/header/smart-profile.js +203 -111
  119. package/components/header/smart-services.js +113 -62
  120. package/components/header/tray-icon.js +37 -21
  121. package/components/header/tray.js +32 -21
  122. package/components/heading/heading.js +25 -24
  123. package/components/http/http.js +353 -203
  124. package/components/http/http.mock.js +101 -49
  125. package/components/hub-source/hub-source.js +190 -83
  126. package/components/hub-source/hub-source__user.js +44 -11
  127. package/components/hub-source/hub-source__users-groups.js +65 -37
  128. package/components/i18n/i18n-context.js +10 -7
  129. package/components/i18n/i18n.js +10 -7
  130. package/components/icon/icon.js +93 -76
  131. package/components/icon/icon__svg.js +8 -0
  132. package/components/icon/index.js +8 -0
  133. package/components/input/input.js +13 -0
  134. package/components/island/adaptive-island-hoc.js +43 -30
  135. package/components/island/content.js +132 -115
  136. package/components/island/header.js +70 -57
  137. package/components/island/island.js +40 -28
  138. package/components/island-legacy/content-legacy.js +25 -17
  139. package/components/island-legacy/header-legacy.js +27 -19
  140. package/components/island-legacy/island-legacy.js +25 -17
  141. package/components/link/clickableLink.js +59 -44
  142. package/components/link/link.js +68 -57
  143. package/components/list/consts.js +2 -2
  144. package/components/list/list.js +698 -611
  145. package/components/list/list__custom.js +62 -44
  146. package/components/list/list__hint.js +19 -10
  147. package/components/list/list__item.js +174 -133
  148. package/components/list/list__link.js +50 -37
  149. package/components/list/list__separator.js +24 -14
  150. package/components/list/list__title.js +32 -22
  151. package/components/list/list__users-groups-source.js +126 -54
  152. package/components/loader/loader.js +74 -43
  153. package/components/loader/loader__core.js +263 -198
  154. package/components/loader-inline/loader-inline.js +35 -23
  155. package/components/loader-screen/loader-screen.js +46 -25
  156. package/components/login-dialog/login-dialog.js +158 -111
  157. package/components/login-dialog/service.js +34 -8
  158. package/components/markdown/markdown.js +23 -15
  159. package/components/message/message.js +203 -161
  160. package/components/old-browsers-message/old-browsers-message.js +18 -11
  161. package/components/old-browsers-message/old-browsers-message__stop.js +7 -0
  162. package/components/old-browsers-message/white-list.js +16 -8
  163. package/components/pager/pager.js +271 -212
  164. package/components/panel/panel.js +25 -17
  165. package/components/permissions/permissions.js +172 -127
  166. package/components/permissions/permissions__cache.js +224 -194
  167. package/components/popup/popup.consts.js +1 -1
  168. package/components/popup/popup.js +343 -284
  169. package/components/popup/popup.target.js +8 -9
  170. package/components/popup/position.js +106 -96
  171. package/components/popup-menu/popup-menu.js +81 -44
  172. package/components/progress-bar/progress-bar.js +104 -87
  173. package/components/query-assist/query-assist.js +916 -838
  174. package/components/query-assist/query-assist__suggestions.js +30 -1
  175. package/components/radio/radio.js +34 -19
  176. package/components/radio/radio__item.js +69 -52
  177. package/components/select/select.js +957 -852
  178. package/components/select/select__filter.js +30 -0
  179. package/components/select/select__popup.js +487 -373
  180. package/components/shortcuts/core.js +217 -166
  181. package/components/shortcuts/shortcut-title.js +11 -6
  182. package/components/shortcuts/shortcuts-hoc.js +45 -19
  183. package/components/shortcuts/shortcuts.js +75 -50
  184. package/components/slider/slider.js +122 -99
  185. package/components/slider/slider.utils.js +24 -14
  186. package/components/storage/storage.js +33 -4
  187. package/components/storage/storage__fallback.js +224 -149
  188. package/components/storage/storage__local.js +153 -90
  189. package/components/tab-trap/tab-trap.js +153 -122
  190. package/components/table/cell.js +26 -14
  191. package/components/table/disable-hover-hoc.js +51 -33
  192. package/components/table/header-cell.js +89 -64
  193. package/components/table/header.js +132 -104
  194. package/components/table/multitable.js +125 -107
  195. package/components/table/row-with-focus-sensor.js +69 -25
  196. package/components/table/row.js +216 -175
  197. package/components/table/selection-adapter.js +3 -1
  198. package/components/table/selection-shortcuts-hoc.js +181 -180
  199. package/components/table/selection.js +226 -156
  200. package/components/table/smart-table.js +88 -50
  201. package/components/table/table.js +358 -289
  202. package/components/tabs/collapsible-more.js +79 -46
  203. package/components/tabs/collapsible-tab.js +38 -31
  204. package/components/tabs/collapsible-tabs.js +153 -88
  205. package/components/tabs/custom-item.js +2 -4
  206. package/components/tabs/dumb-tabs.js +117 -74
  207. package/components/tabs/smart-tabs.js +69 -29
  208. package/components/tabs/tab-link.js +5 -1
  209. package/components/tabs/tab.js +31 -19
  210. package/components/tabs/tabs.js +31 -0
  211. package/components/tag/tag.js +173 -133
  212. package/components/tags-input/tags-input.js +427 -329
  213. package/components/tags-list/tags-list.js +78 -57
  214. package/components/text/text.js +39 -28
  215. package/components/toggle/toggle.js +70 -56
  216. package/components/tooltip/tooltip.js +190 -146
  217. package/components/user-agreement/service.js +371 -228
  218. package/components/user-agreement/toolbox.eula.js +1 -160
  219. package/components/user-agreement/user-agreement.js +120 -85
  220. package/components/user-card/card.js +29 -0
  221. package/components/user-card/smart-user-card-tooltip.js +111 -51
  222. package/components/user-card/tooltip.js +84 -47
  223. package/components/user-card/user-card.js +29 -0
  224. package/package.json +1 -1
@@ -1,8 +1,13 @@
1
+ import 'core-js/modules/es.array.concat.js';
2
+ import 'core-js/modules/es.array.index-of.js';
3
+ import 'core-js/modules/es.array.slice.js';
4
+ import 'core-js/modules/es.object.values.js';
5
+ import 'core-js/modules/es.regexp.exec.js';
1
6
  import PropTypes from 'prop-types';
2
7
  import { add } from 'date-fns/add';
3
8
 
4
- const unit = 8; // px;
5
- const units = {
9
+ var unit = 8; // px;
10
+ var units = {
6
11
  unit,
7
12
  /* eslint-disable @typescript-eslint/no-magic-numbers */
8
13
  cellSize: unit * 3,
@@ -10,10 +15,10 @@ const units = {
10
15
  yearHeight: unit * 4
11
16
  /* eslint-enable */
12
17
  };
13
- const YEAR = 12;
14
- const WEEK = 7;
15
- const FIFTH_DAY = 4;
16
- const weekdays = {
18
+ var YEAR = 12;
19
+ var WEEK = 7;
20
+ var FIFTH_DAY = 4;
21
+ var weekdays = {
17
22
  MO: 1,
18
23
  TU: 2,
19
24
  WE: 3,
@@ -22,34 +27,36 @@ const weekdays = {
22
27
  SA: 6,
23
28
  SU: 0
24
29
  };
25
- const MIDDLE_DAY = 15;
26
- const durationToMillis = duration => +add(0, duration);
27
- const yearDuration = durationToMillis({
30
+ var MIDDLE_DAY = 15;
31
+ var durationToMillis = function durationToMillis(duration) {
32
+ return +add(0, duration);
33
+ };
34
+ var yearDuration = durationToMillis({
28
35
  years: 1
29
36
  });
30
- const yearScrollSpeed = yearDuration / (YEAR * units.cellSize);
31
- const DOUBLE = 2;
32
- const HALF = 0.5;
33
- const dateType = PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.string, PropTypes.number]);
37
+ var yearScrollSpeed = yearDuration / (YEAR * units.cellSize);
38
+ var DOUBLE = 2;
39
+ var HALF = 0.5;
40
+ var dateType = PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.string, PropTypes.number]);
34
41
  function parseTime(time) {
35
- let result = null;
42
+ var result = null;
36
43
  if (/^([01][0-9]|2[0-3]):[0-5][0-9]$/.test(time)) {
37
44
  result = time;
38
45
  } else if (/^([0-9]|2[0-3]):[0-5][0-9]$/.test(time)) {
39
- result = `0${time}`;
46
+ result = "0".concat(time);
40
47
  }
41
48
  return result;
42
49
  }
43
50
  function shiftWeekArray(arr, startOfWeek) {
44
- const shiftTimes = startOfWeek - 1;
51
+ var shiftTimes = startOfWeek - 1;
45
52
  return arr.slice(shiftTimes).concat(arr.slice(0, shiftTimes));
46
53
  }
47
54
  function getWeekStartsOn(locale) {
48
- var _locale$options$weekS;
49
- return (_locale$options$weekS = locale?.options?.weekStartsOn) !== null && _locale$options$weekS !== void 0 ? _locale$options$weekS : weekdays.MO;
55
+ var _locale$options$weekS, _locale$options;
56
+ return (_locale$options$weekS = locale === null || locale === void 0 || (_locale$options = locale.options) === null || _locale$options === void 0 ? void 0 : _locale$options.weekStartsOn) !== null && _locale$options$weekS !== void 0 ? _locale$options$weekS : weekdays.MO;
50
57
  }
51
58
  function getDayNumInWeek(locale, day) {
52
- const weekDays = shiftWeekArray(Object.values(weekdays), getWeekStartsOn(locale));
59
+ var weekDays = shiftWeekArray(Object.values(weekdays), getWeekStartsOn(locale));
53
60
  return weekDays.indexOf(day);
54
61
  }
55
62
 
@@ -1,3 +1,9 @@
1
+ import { a as _inherits, b as _createClass, _ as _defineProperty, f as _classCallCheck, g as _callSuper } from '../_helpers/_rollupPluginBabelHelpers.js';
2
+ import 'core-js/modules/es.array.concat.js';
3
+ import 'core-js/modules/es.array.filter.js';
4
+ import 'core-js/modules/es.object.to-string.js';
5
+ import 'core-js/modules/es.regexp.exec.js';
6
+ import 'core-js/modules/es.string.replace.js';
1
7
  import React from 'react';
2
8
  import classNames from 'classnames';
3
9
  import PropTypes from 'prop-types';
@@ -6,7 +12,7 @@ import { ControlsHeight } from '../global/controls-height.js';
6
12
  import { I18nContext } from '../i18n/i18n-context.js';
7
13
  import { dateType } from './consts.js';
8
14
  import { m as modules_0c7b7d96 } from '../_helpers/date-picker.js';
9
- import '../_helpers/_rollupPluginBabelHelpers.js';
15
+ import 'core-js/modules/es.object.values.js';
10
16
  import '@jetbrains/icons/close-12px';
11
17
  import '../global/prop-types.js';
12
18
  import '../button/button.js';
@@ -15,132 +21,157 @@ import '../icon/icon.js';
15
21
  import 'util-deprecate';
16
22
  import '../icon/icon__constants.js';
17
23
  import '../_helpers/icon__svg.js';
24
+ import 'core-js/modules/es.string.starts-with.js';
18
25
  import '../global/memoize.js';
26
+ import 'core-js/modules/es.array.iterator.js';
27
+ import 'core-js/modules/es.map.js';
28
+ import 'core-js/modules/es.weak-map.js';
29
+ import 'core-js/modules/web.dom-collections.iterator.js';
19
30
  import '../link/clickableLink.js';
20
31
  import '../_helpers/button__classes.js';
21
32
  import '../global/get-uid.js';
33
+ import 'core-js/modules/es.regexp.to-string.js';
22
34
  import '../global/composeRefs.js';
35
+ import 'core-js/modules/web.dom-collections.for-each.js';
23
36
  import '../control-label/control-label.js';
24
37
  import '../i18n/i18n.js';
38
+ import 'core-js/modules/es.set.js';
39
+ import 'core-js/modules/es.array.index-of.js';
40
+ import 'core-js/modules/es.array.slice.js';
25
41
  import 'date-fns/add';
26
42
 
27
- class DateInput extends React.PureComponent {
28
- static propTypes = {
29
- active: PropTypes.bool,
30
- divider: PropTypes.bool,
31
- name: PropTypes.string,
32
- text: PropTypes.string,
33
- hoverDate: dateType,
34
- date: dateType,
35
- time: PropTypes.string,
36
- displayFormat: PropTypes.func,
37
- translations: PropTypes.object,
38
- fromPlaceholder: PropTypes.string,
39
- toPlaceholder: PropTypes.string,
40
- timePlaceholder: PropTypes.string,
41
- onInput: PropTypes.func,
42
- onActivate: PropTypes.func,
43
- onConfirm: PropTypes.func,
44
- onClear: PropTypes.func,
45
- locale: PropTypes.object
46
- };
47
- componentDidUpdate(prevProps) {
48
- const {
49
- text,
50
- active
51
- } = this.props;
52
- if (text !== prevProps.text || active !== prevProps.active) {
53
- this.updateInput({
54
- text,
55
- active
56
- });
43
+ var DateInput = /*#__PURE__*/function (_React$PureComponent) {
44
+ function DateInput() {
45
+ var _this;
46
+ _classCallCheck(this, DateInput);
47
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
48
+ args[_key] = arguments[_key];
57
49
  }
50
+ _this = _callSuper(this, DateInput, [].concat(args));
51
+ _defineProperty(_this, "input", void 0);
52
+ _defineProperty(_this, "inputRef", function (el) {
53
+ _this.input = el;
54
+ _this.updateInput(_this.props);
55
+ });
56
+ _defineProperty(_this, "handleChange", function (e) {
57
+ return _this.props.onInput(e.currentTarget.value, e.currentTarget.dataset.name);
58
+ });
59
+ _defineProperty(_this, "handleKeyDown", function (e) {
60
+ return e.key === 'Enter' && _this.props.onConfirm();
61
+ });
62
+ return _this;
58
63
  }
59
- static contextType = I18nContext;
60
- input;
61
- inputRef = el => {
62
- this.input = el;
63
- this.updateInput(this.props);
64
- };
65
- updateInput(_ref) {
66
- let {
67
- text,
68
- active
69
- } = _ref;
70
- const el = this.input;
71
- if (!el) {
72
- return;
73
- }
74
- if (active) {
75
- el.focus();
76
- if (!text) {
77
- el.select();
64
+ _inherits(DateInput, _React$PureComponent);
65
+ return _createClass(DateInput, [{
66
+ key: "componentDidUpdate",
67
+ value: function componentDidUpdate(prevProps) {
68
+ var _this$props = this.props,
69
+ text = _this$props.text,
70
+ active = _this$props.active;
71
+ if (text !== prevProps.text || active !== prevProps.active) {
72
+ this.updateInput({
73
+ text,
74
+ active
75
+ });
78
76
  }
79
- } else {
80
- el.blur();
81
77
  }
82
- }
83
- handleChange = e => this.props.onInput(e.currentTarget.value, e.currentTarget.dataset.name);
84
- handleKeyDown = e => e.key === 'Enter' && this.props.onConfirm();
85
- render() {
86
- const {
87
- active,
88
- divider,
89
- text,
90
- time,
91
- name,
92
- hoverDate,
93
- date,
94
- displayFormat,
95
- translations,
96
- onActivate,
97
- onClear,
98
- fromPlaceholder,
99
- toPlaceholder,
100
- timePlaceholder,
101
- locale
102
- } = this.props;
103
- const {
104
- translate
105
- } = this.context;
106
- let displayText = '';
107
- if (active && hoverDate) {
108
- displayText = displayFormat(hoverDate, locale);
109
- } else if (active && text != null) {
110
- displayText = text;
111
- } else if (date) {
112
- displayText = displayFormat(date, locale);
113
- } else if (name === 'time') {
114
- displayText = time || '';
78
+ }, {
79
+ key: "updateInput",
80
+ value: function updateInput(_ref) {
81
+ var text = _ref.text,
82
+ active = _ref.active;
83
+ var el = this.input;
84
+ if (!el) {
85
+ return;
86
+ }
87
+ if (active) {
88
+ el.focus();
89
+ if (!text) {
90
+ el.select();
91
+ }
92
+ } else {
93
+ el.blur();
94
+ }
115
95
  }
116
- const placeholder = ((_translations$addFirs, _translations$addSeco, _translations$addTime, _translations$selectN) => {
117
- switch (name) {
118
- case 'from':
119
- return fromPlaceholder || ((_translations$addFirs = translations?.addFirstDate) !== null && _translations$addFirs !== void 0 ? _translations$addFirs : translate('addFirstDate'));
120
- case 'to':
121
- return toPlaceholder || ((_translations$addSeco = translations?.addSecondDate) !== null && _translations$addSeco !== void 0 ? _translations$addSeco : translate('addSecondDate'));
122
- case 'time':
123
- return timePlaceholder || ((_translations$addTime = translations?.addTime) !== null && _translations$addTime !== void 0 ? _translations$addTime : translate('addTime'));
124
- default:
125
- return ((_translations$selectN = translations?.selectName) !== null && _translations$selectN !== void 0 ? _translations$selectN : translate('selectName')).replace('%name%', name).replace('{{name}}', name);
96
+ }, {
97
+ key: "render",
98
+ value: function render() {
99
+ var _this$props2 = this.props,
100
+ active = _this$props2.active,
101
+ divider = _this$props2.divider,
102
+ text = _this$props2.text,
103
+ time = _this$props2.time,
104
+ name = _this$props2.name,
105
+ hoverDate = _this$props2.hoverDate,
106
+ date = _this$props2.date,
107
+ displayFormat = _this$props2.displayFormat,
108
+ translations = _this$props2.translations,
109
+ onActivate = _this$props2.onActivate,
110
+ onClear = _this$props2.onClear,
111
+ fromPlaceholder = _this$props2.fromPlaceholder,
112
+ toPlaceholder = _this$props2.toPlaceholder,
113
+ timePlaceholder = _this$props2.timePlaceholder,
114
+ locale = _this$props2.locale;
115
+ var translate = this.context.translate;
116
+ var displayText = '';
117
+ if (active && hoverDate) {
118
+ displayText = displayFormat(hoverDate, locale);
119
+ } else if (active && text != null) {
120
+ displayText = text;
121
+ } else if (date) {
122
+ displayText = displayFormat(date, locale);
123
+ } else if (name === 'time') {
124
+ displayText = time || '';
126
125
  }
127
- })();
128
- const classes = classNames(modules_0c7b7d96.filter, modules_0c7b7d96[`${name}Input`], divider && modules_0c7b7d96[`${name}InputWithDivider`], 'ring-js-shortcuts');
129
- return /*#__PURE__*/React.createElement(Input, {
130
- autoComplete: "off",
131
- borderless: true,
132
- height: ControlsHeight.L,
133
- "data-name": name,
134
- inputRef: this.inputRef,
135
- className: classes,
136
- value: displayText,
137
- onChange: this.handleChange,
138
- onFocus: onActivate,
139
- onKeyDown: this.handleKeyDown,
140
- onClear: onClear,
141
- placeholder: placeholder
142
- });
143
- }
144
- }
126
+ var placeholder = function (_translations$addFirs, _translations$addSeco, _translations$addTime, _translations$selectN) {
127
+ switch (name) {
128
+ case 'from':
129
+ return fromPlaceholder || ((_translations$addFirs = translations === null || translations === void 0 ? void 0 : translations.addFirstDate) !== null && _translations$addFirs !== void 0 ? _translations$addFirs : translate('addFirstDate'));
130
+ case 'to':
131
+ return toPlaceholder || ((_translations$addSeco = translations === null || translations === void 0 ? void 0 : translations.addSecondDate) !== null && _translations$addSeco !== void 0 ? _translations$addSeco : translate('addSecondDate'));
132
+ case 'time':
133
+ return timePlaceholder || ((_translations$addTime = translations === null || translations === void 0 ? void 0 : translations.addTime) !== null && _translations$addTime !== void 0 ? _translations$addTime : translate('addTime'));
134
+ default:
135
+ return ((_translations$selectN = translations === null || translations === void 0 ? void 0 : translations.selectName) !== null && _translations$selectN !== void 0 ? _translations$selectN : translate('selectName')).replace('%name%', name).replace('{{name}}', name);
136
+ }
137
+ }();
138
+ var classes = classNames(modules_0c7b7d96.filter, modules_0c7b7d96["".concat(name, "Input")], divider && modules_0c7b7d96["".concat(name, "InputWithDivider")], 'ring-js-shortcuts');
139
+ return /*#__PURE__*/React.createElement(Input, {
140
+ autoComplete: "off",
141
+ borderless: true,
142
+ height: ControlsHeight.L,
143
+ "data-name": name,
144
+ inputRef: this.inputRef,
145
+ className: classes,
146
+ value: displayText,
147
+ onChange: this.handleChange,
148
+ onFocus: onActivate,
149
+ onKeyDown: this.handleKeyDown,
150
+ onClear: onClear,
151
+ placeholder: placeholder
152
+ });
153
+ }
154
+ }]);
155
+ }(React.PureComponent);
156
+ _defineProperty(DateInput, "propTypes", {
157
+ active: PropTypes.bool,
158
+ divider: PropTypes.bool,
159
+ name: PropTypes.string,
160
+ text: PropTypes.string,
161
+ hoverDate: dateType,
162
+ date: dateType,
163
+ time: PropTypes.string,
164
+ displayFormat: PropTypes.func,
165
+ translations: PropTypes.object,
166
+ fromPlaceholder: PropTypes.string,
167
+ toPlaceholder: PropTypes.string,
168
+ timePlaceholder: PropTypes.string,
169
+ onInput: PropTypes.func,
170
+ onActivate: PropTypes.func,
171
+ onConfirm: PropTypes.func,
172
+ onClear: PropTypes.func,
173
+ locale: PropTypes.object
174
+ });
175
+ _defineProperty(DateInput, "contextType", I18nContext);
145
176
 
146
177
  export { DateInput as default };