@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
package/dist/list/list.js CHANGED
@@ -45,49 +45,37 @@ import '../_helpers/checkbox.js';
45
45
  import '../global/get-event-key.js';
46
46
 
47
47
  function noop() {}
48
-
49
48
  const warnEmptyKey = deprecate(() => {}, 'No key passed for list item with non-string label. It is considered as a bad practice and has been deprecated, please provide a key.');
50
49
  /**
51
50
  * @param {Type} listItemType
52
51
  * @param {Object} item list item
53
52
  */
54
-
55
53
  function isItemType(listItemType, item) {
56
54
  let type = item.rgItemType;
57
-
58
55
  if (type == null) {
59
56
  type = DEFAULT_ITEM_TYPE;
60
57
  }
61
-
62
58
  return type === listItemType;
63
59
  }
64
-
65
60
  const nonActivatableTypes = [Type.SEPARATOR, Type.TITLE, Type.MARGIN];
66
-
67
61
  function isActivatable(item) {
68
62
  return item != null && !nonActivatableTypes.includes(item.rgItemType) && !item.disabled;
69
63
  }
70
-
71
64
  const shouldActivateFirstItem = props => props.activateFirstItem || props.activateSingleItem && props.data.length === 1;
72
-
73
65
  const ActiveItemContext = createStatefulContext(undefined, 'ActiveItem');
74
66
  /**
75
67
  * @name List
76
68
  * @constructor
77
69
  * @extends {ReactComponent}
78
70
  */
79
-
80
71
  /**
81
72
  * Displays a list of items.
82
73
  */
83
-
84
74
  class List extends Component {
85
75
  constructor() {
86
76
  var _this;
87
-
88
77
  super(...arguments);
89
78
  _this = this;
90
-
91
79
  _defineProperty(this, "state", {
92
80
  activeIndex: null,
93
81
  prevActiveIndex: null,
@@ -99,22 +87,15 @@ class List extends Component {
99
87
  disabledHover: false,
100
88
  scrolledToBottom: false
101
89
  });
102
-
103
90
  _defineProperty(this, "scheduleScrollListener", scheduleRAF());
104
-
105
91
  _defineProperty(this, "scheduleHoverListener", scheduleRAF());
106
-
107
92
  _defineProperty(this, "virtualizedList", void 0);
108
-
109
93
  _defineProperty(this, "unmounted", void 0);
110
-
111
94
  _defineProperty(this, "container", void 0);
112
-
113
95
  _defineProperty(this, "hoverHandler", memoize(index => () => this.scheduleHoverListener(() => {
114
96
  if (this.state.disabledHover) {
115
97
  return;
116
98
  }
117
-
118
99
  if (this.container) {
119
100
  this.setState({
120
101
  activeIndex: index,
@@ -123,52 +104,39 @@ class List extends Component {
123
104
  });
124
105
  }
125
106
  })));
126
-
127
107
  _defineProperty(this, "_activatableItems", false);
128
-
129
108
  _defineProperty(this, "_bufferSize", 10);
130
-
131
109
  _defineProperty(this, "sizeCacheKey", index => {
132
110
  if (index === 0 || index === this.props.data.length + 1) {
133
111
  return Type.MARGIN;
134
112
  }
135
-
136
113
  const item = this.props.data[index - 1];
137
114
  const isFirst = index === 1;
138
-
139
115
  switch (item.rgItemType) {
140
116
  case Type.SEPARATOR:
141
117
  case Type.TITLE:
142
118
  return `${item.rgItemType}${isFirst ? '_first' : ''}${item.description ? '_desc' : ''}`;
143
-
144
119
  case Type.MARGIN:
145
120
  return Type.MARGIN;
146
-
147
121
  case Type.CUSTOM:
148
122
  return `${Type.CUSTOM}_${item.key}`;
149
-
150
123
  case Type.ITEM:
151
124
  case Type.LINK:
152
125
  default:
153
126
  if (item.details) {
154
127
  return `${Type.ITEM}_${item.details}`;
155
128
  }
156
-
157
129
  return Type.ITEM;
158
130
  }
159
131
  });
160
-
161
132
  _defineProperty(this, "_cache", new CellMeasurerCache({
162
133
  defaultHeight: this.defaultItemHeight(),
163
134
  fixedWidth: true,
164
135
  keyMapper: this.sizeCacheKey
165
136
  }));
166
-
167
137
  _defineProperty(this, "_hasActivatableItems", memoizeOne(items => items.some(isActivatable)));
168
-
169
138
  _defineProperty(this, "activateFirst", () => {
170
139
  const firstActivatableIndex = this.props.data.findIndex(isActivatable);
171
-
172
140
  if (firstActivatableIndex >= 0) {
173
141
  this.setState({
174
142
  activeIndex: firstActivatableIndex,
@@ -177,26 +145,21 @@ class List extends Component {
177
145
  });
178
146
  }
179
147
  });
180
-
181
148
  _defineProperty(this, "selectHandler", memoize(index => function (event) {
182
149
  let tryKeepOpen = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
183
150
  const item = _this.props.data[index];
184
-
185
151
  if (!_this.props.useMouseUp && item.onClick) {
186
152
  item.onClick(item, event);
187
153
  } else if (_this.props.useMouseUp && item.onMouseUp) {
188
154
  item.onMouseUp(item, event);
189
155
  }
190
-
191
156
  if (_this.props.onSelect) {
192
157
  _this.props.onSelect(item, event, {
193
158
  tryKeepOpen
194
159
  });
195
160
  }
196
161
  }));
197
-
198
162
  _defineProperty(this, "checkboxHandler", memoize(index => event => this.selectHandler(index)(event, true)));
199
-
200
163
  _defineProperty(this, "upHandler", e => {
201
164
  const {
202
165
  data,
@@ -204,7 +167,6 @@ class List extends Component {
204
167
  } = this.props;
205
168
  const index = this.state.activeIndex;
206
169
  let newIndex;
207
-
208
170
  if (index === null || index === 0) {
209
171
  if (!disableMoveOverflow) {
210
172
  newIndex = data.length - 1;
@@ -214,10 +176,8 @@ class List extends Component {
214
176
  } else {
215
177
  newIndex = index - 1;
216
178
  }
217
-
218
179
  this.moveHandler(newIndex, this.upHandler, e);
219
180
  });
220
-
221
181
  _defineProperty(this, "downHandler", e => {
222
182
  const {
223
183
  data,
@@ -226,7 +186,6 @@ class List extends Component {
226
186
  } = this.props;
227
187
  const index = this.state.activeIndex;
228
188
  let newIndex;
229
-
230
189
  if (index === null) {
231
190
  newIndex = 0;
232
191
  } else if (index + 1 === data.length) {
@@ -238,18 +197,14 @@ class List extends Component {
238
197
  } else {
239
198
  newIndex = index + 1;
240
199
  }
241
-
242
200
  this.moveHandler(newIndex, this.downHandler, e);
243
201
  });
244
-
245
202
  _defineProperty(this, "homeHandler", e => {
246
203
  this.moveHandler(0, this.downHandler, e);
247
204
  });
248
-
249
205
  _defineProperty(this, "endHandler", e => {
250
206
  this.moveHandler(this.props.data.length - 1, this.upHandler, e);
251
207
  });
252
-
253
208
  _defineProperty(this, "onDocumentMouseMove", () => {
254
209
  if (this.state.disabledHover) {
255
210
  this.setState({
@@ -257,34 +212,28 @@ class List extends Component {
257
212
  });
258
213
  }
259
214
  });
260
-
261
215
  _defineProperty(this, "onDocumentKeyDown", e => {
262
216
  const metaKeys = [16, 17, 18, 19, 20, 91]; // eslint-disable-line @typescript-eslint/no-magic-numbers
263
-
264
217
  if (!this.state.disabledHover && !metaKeys.includes(e.keyCode)) {
265
218
  this.setState({
266
219
  disabledHover: true
267
220
  });
268
221
  }
269
222
  });
270
-
271
223
  _defineProperty(this, "mouseHandler", () => {
272
224
  this.setState({
273
225
  scrolling: false
274
226
  });
275
227
  });
276
-
277
228
  _defineProperty(this, "scrollHandler", () => {
278
229
  this.setState({
279
230
  scrolling: true
280
231
  }, this.scrollEndHandler);
281
232
  });
282
-
283
233
  _defineProperty(this, "enterHandler", (event, shortcut) => {
284
234
  if (this.state.activeIndex !== null) {
285
235
  const item = this.props.data[this.state.activeIndex];
286
236
  this.selectHandler(this.state.activeIndex)(event);
287
-
288
237
  if (item.href && !event.defaultPrevented) {
289
238
  if (shortcut != null && ['command+enter', 'ctrl+enter'].includes(shortcut)) {
290
239
  window.open(item.href, '_blank');
@@ -294,41 +243,34 @@ class List extends Component {
294
243
  window.location.href = item.href;
295
244
  }
296
245
  }
297
-
298
246
  return false; // do not propagate event
299
247
  } else {
300
248
  return true; // propagate event to the parent component (e.g., QueryAssist)
301
249
  }
302
250
  });
303
-
304
251
  _defineProperty(this, "clearSelected", () => {
305
252
  this.setState({
306
253
  activeIndex: null,
307
254
  needScrollToActive: false
308
255
  });
309
256
  });
310
-
311
257
  _defineProperty(this, "scrollEndHandler", () => this.scheduleScrollListener(() => {
312
258
  const innerContainer = this.inner;
313
-
314
259
  if (innerContainer) {
315
260
  const maxScrollingPosition = innerContainer.scrollHeight;
316
261
  const sensitivity = this.defaultItemHeight() / 2;
317
262
  const currentScrollingPosition = innerContainer.scrollTop + innerContainer.clientHeight + sensitivity;
318
263
  const scrolledToBottom = maxScrollingPosition > 0 && currentScrollingPosition >= maxScrollingPosition;
319
-
320
264
  if (!this.unmounted) {
321
265
  this.setState({
322
266
  scrolledToBottom
323
267
  });
324
268
  }
325
-
326
269
  if (scrolledToBottom) {
327
270
  this.props.onScrollToBottom();
328
271
  }
329
272
  }
330
273
  }));
331
-
332
274
  _defineProperty(this, "checkOverflow", () => {
333
275
  if (this.inner) {
334
276
  this.setState({
@@ -336,7 +278,6 @@ class List extends Component {
336
278
  });
337
279
  }
338
280
  });
339
-
340
281
  _defineProperty(this, "renderItem", _ref => {
341
282
  let {
342
283
  index = 1,
@@ -349,8 +290,8 @@ class List extends Component {
349
290
  let el;
350
291
  const realIndex = index - 1;
351
292
  const item = this.props.data[realIndex];
352
- const itemId = this.getId(item); // top and bottom margins
353
-
293
+ const itemId = this.getId(item);
294
+ // top and bottom margins
354
295
  if (index === 0 || index === this.props.data.length + 1 || item.rgItemType === Type.MARGIN) {
355
296
  itemKey = key || `${Type.MARGIN}_${index}`;
356
297
  el = /*#__PURE__*/React.createElement("div", {
@@ -366,78 +307,61 @@ class List extends Component {
366
307
  ...restProps
367
308
  } = item;
368
309
  const cleanedProps = restProps;
369
-
370
310
  if (cleanedProps.url) {
371
311
  cleanedProps.href = cleanedProps.url;
372
312
  }
373
-
374
313
  if (cleanedProps.href) {
375
314
  cleanedProps.rgItemType = Type.LINK;
376
315
  }
377
-
378
316
  const itemProps = Object.assign({
379
317
  rgItemType: DEFAULT_ITEM_TYPE
380
318
  }, restProps);
381
319
  itemKey = key || itemId;
382
320
  itemProps.hover = realIndex === this.state.activeIndex;
383
-
384
321
  if (itemProps.hoverClassName != null && itemProps.hover) {
385
322
  itemProps.className = classNames(itemProps.className, itemProps.hoverClassName);
386
323
  }
387
-
388
324
  itemProps.onMouseOver = this.hoverHandler(realIndex);
389
325
  itemProps.tabIndex = -1;
390
326
  itemProps.scrolling = isScrolling;
391
327
  const selectHandler = this.selectHandler(realIndex);
392
-
393
328
  if (this.props.useMouseUp) {
394
329
  itemProps.onMouseUp = selectHandler;
395
330
  } else {
396
331
  itemProps.onClick = selectHandler;
397
332
  }
398
-
399
333
  itemProps.onCheckboxChange = this.checkboxHandler(realIndex);
400
-
401
334
  if (itemProps.compact == null) {
402
335
  itemProps.compact = this.props.compact;
403
336
  }
404
-
405
337
  let ItemComponent;
406
338
  const isFirst = index === 1;
407
-
408
339
  switch (itemProps.rgItemType) {
409
340
  case Type.SEPARATOR:
410
341
  ItemComponent = ListSeparator;
411
342
  itemProps.isFirst = isFirst;
412
343
  break;
413
-
414
344
  case Type.LINK:
415
345
  ItemComponent = ListLink;
416
346
  this.addItemDataTestToProp(itemProps);
417
347
  break;
418
-
419
348
  case Type.ITEM:
420
349
  ItemComponent = ListItem;
421
350
  this.addItemDataTestToProp(itemProps);
422
351
  break;
423
-
424
352
  case Type.CUSTOM:
425
353
  ItemComponent = ListCustom;
426
354
  this.addItemDataTestToProp(itemProps);
427
355
  break;
428
-
429
356
  case Type.TITLE:
430
357
  itemProps.isFirst = isFirst;
431
358
  ItemComponent = ListTitle;
432
359
  break;
433
-
434
360
  default:
435
361
  throw new Error(`Unknown menu element type: ${itemProps.rgItemType}`);
436
362
  }
437
-
438
363
  el = /*#__PURE__*/React.createElement(ItemComponent, itemProps);
439
364
  }
440
-
441
365
  return parent ? /*#__PURE__*/React.createElement(CellMeasurer, {
442
366
  cache: this._cache,
443
367
  key: itemKey,
@@ -464,26 +388,19 @@ class List extends Component {
464
388
  role: "cell"
465
389
  }, /*#__PURE__*/cloneElement(el)));
466
390
  });
467
-
468
391
  _defineProperty(this, "addItemDataTestToProp", props => {
469
392
  props['data-test'] = joinDataTestAttributes('ring-list-item', props['data-test']);
470
393
  return props;
471
394
  });
472
-
473
395
  _defineProperty(this, "virtualizedListRef", el => {
474
396
  this.virtualizedList = el;
475
397
  });
476
-
477
398
  _defineProperty(this, "containerRef", el => {
478
399
  this.container = el;
479
400
  });
480
-
481
401
  _defineProperty(this, "_inner", void 0);
482
-
483
402
  _defineProperty(this, "id", getUID('list-'));
484
-
485
403
  _defineProperty(this, "shortcutsScope", this.id);
486
-
487
404
  _defineProperty(this, "shortcutsMap", {
488
405
  up: this.upHandler,
489
406
  down: this.downHandler,
@@ -496,7 +413,6 @@ class List extends Component {
496
413
  'shift+enter': this.enterHandler
497
414
  });
498
415
  }
499
-
500
416
  static getDerivedStateFromProps(nextProps, prevState) {
501
417
  const {
502
418
  prevActiveIndex,
@@ -512,14 +428,12 @@ class List extends Component {
512
428
  prevActiveIndex: activeIndex,
513
429
  prevData: data
514
430
  };
515
-
516
431
  if (data !== prevData) {
517
432
  Object.assign(nextState, {
518
433
  activeIndex: null,
519
434
  activeItem: null
520
435
  });
521
436
  }
522
-
523
437
  if (activeIndex != null && activeIndex !== prevActiveIndex && data[activeIndex] != null) {
524
438
  Object.assign(nextState, {
525
439
  activeIndex,
@@ -529,7 +443,6 @@ class List extends Component {
529
443
  } else if (data !== prevData && restoreActiveIndex && activeItem != null && activeItem.key != null) {
530
444
  // Restore active index if there is an item with the same "key" property
531
445
  const index = data.findIndex(item => item.key === activeItem.key);
532
-
533
446
  if (index >= 0) {
534
447
  Object.assign(nextState, {
535
448
  activeIndex: index,
@@ -537,48 +450,37 @@ class List extends Component {
537
450
  });
538
451
  }
539
452
  }
540
-
541
453
  return nextState;
542
454
  }
543
-
544
455
  componentDidMount() {
545
456
  document.addEventListener('mousemove', this.onDocumentMouseMove);
546
457
  document.addEventListener('keydown', this.onDocumentKeyDown, true);
547
-
548
458
  if (this.props.activeIndex == null && shouldActivateFirstItem(this.props)) {
549
459
  this.activateFirst();
550
460
  }
551
461
  }
552
-
553
462
  shouldComponentUpdate(nextProps, nextState) {
554
463
  return nextProps !== this.props || Object.keys(nextState).some(key => nextState[key] !== this.state[key]);
555
464
  }
556
-
557
465
  componentDidUpdate(prevProps) {
558
466
  if (this.virtualizedList && prevProps.data !== this.props.data) {
559
467
  this.virtualizedList.recomputeRowHeights();
560
468
  }
561
-
562
469
  if (this.props.activeIndex == null && this.props.data !== prevProps.data && shouldActivateFirstItem(this.props)) {
563
470
  this.activateFirst();
564
471
  }
565
-
566
472
  this.checkOverflow();
567
473
  }
568
-
569
474
  componentWillUnmount() {
570
475
  this.unmounted = true;
571
476
  document.removeEventListener('mousemove', this.onDocumentMouseMove);
572
477
  document.removeEventListener('keydown', this.onDocumentKeyDown, true);
573
478
  }
574
-
575
479
  hasActivatableItems() {
576
480
  return this._hasActivatableItems(this.props.data);
577
481
  }
578
-
579
482
  moveHandler(index, retryCallback, e) {
580
483
  let correctedIndex;
581
-
582
484
  if (this.props.data.length === 0 || !this.hasActivatableItems()) {
583
485
  return;
584
486
  } else if (this.props.data.length < index) {
@@ -586,7 +488,6 @@ class List extends Component {
586
488
  } else {
587
489
  correctedIndex = index;
588
490
  }
589
-
590
491
  const item = this.props.data[correctedIndex];
591
492
  this.setState({
592
493
  activeIndex: correctedIndex,
@@ -597,53 +498,41 @@ class List extends Component {
597
498
  retryCallback(e);
598
499
  return;
599
500
  }
600
-
601
501
  if (e.key !== 'Home' && e.key !== 'End') {
602
502
  preventDefault(e);
603
503
  }
604
504
  });
605
505
  }
606
-
607
506
  getFirst() {
608
507
  return this.props.data.find(item => item.rgItemType === Type.ITEM || item.rgItemType === Type.CUSTOM);
609
508
  }
610
-
611
509
  getSelected() {
612
510
  return this.state.activeIndex != null ? this.props.data[this.state.activeIndex] : null;
613
511
  }
614
-
615
512
  defaultItemHeight() {
616
513
  return this.props.compact ? Dimension.COMPACT_ITEM_HEIGHT : Dimension.ITEM_HEIGHT;
617
514
  }
618
-
619
515
  getVisibleListHeight(maxHeight) {
620
516
  return maxHeight - this.defaultItemHeight() - Dimension.INNER_PADDING;
621
517
  }
622
-
623
518
  _deprecatedGenerateKeyFromContent(itemProps) {
624
519
  const identificator = itemProps.label || itemProps.description;
625
520
  const isString = typeof identificator === 'string' || identificator instanceof String;
626
-
627
521
  if (identificator && !isString) {
628
522
  warnEmptyKey();
629
523
  `${itemProps.rgItemType}_${JSON.stringify(identificator)}`;
630
524
  }
631
-
632
525
  return `${itemProps.rgItemType}_${identificator}`;
633
526
  }
634
-
635
527
  getId(item) {
636
528
  return item != null ? `${this.id}:${item.key || this._deprecatedGenerateKeyFromContent(item)}` : undefined;
637
529
  }
638
-
639
530
  get inner() {
640
531
  if (!this._inner) {
641
532
  this._inner = this.container && this.container.querySelector('.ring-list__i');
642
533
  }
643
-
644
534
  return this._inner;
645
535
  }
646
-
647
536
  renderVirtualizedInner(_ref3) {
648
537
  let {
649
538
  height,
@@ -658,7 +547,6 @@ class List extends Component {
658
547
  const dirOverride = {
659
548
  direction: 'inherit'
660
549
  }; // Virtualized sets "direction: ltr" by default https://github.com/bvaughn/react-virtualized/issues/457
661
-
662
550
  return /*#__PURE__*/React.createElement(AutoSizer, {
663
551
  disableHeight: true,
664
552
  onResize: this.props.onResize
@@ -691,7 +579,8 @@ class List extends Component {
691
579
  estimatedRowSize: this.defaultItemHeight(),
692
580
  rowHeight: this._cache.rowHeight,
693
581
  rowRenderer: this.renderItem,
694
- overscanRowCount: this._bufferSize // ensure rerendering
582
+ overscanRowCount: this._bufferSize
583
+ // ensure rerendering
695
584
  ,
696
585
  noop: () => {},
697
586
  scrollToIndex: !this.props.disableScrollToActive && this.state.needScrollToActive && this.state.activeIndex != null ? this.state.activeIndex + 1 : undefined,
@@ -701,7 +590,6 @@ class List extends Component {
701
590
  }));
702
591
  });
703
592
  }
704
-
705
593
  renderVirtualized(maxHeight, rowCount) {
706
594
  if (maxHeight) {
707
595
  return this.renderVirtualizedInner({
@@ -710,23 +598,20 @@ class List extends Component {
710
598
  rowCount
711
599
  });
712
600
  }
713
-
714
- return /*#__PURE__*/React.createElement(WindowScroller, null, props => this.renderVirtualizedInner({ ...props,
601
+ return /*#__PURE__*/React.createElement(WindowScroller, null, props => this.renderVirtualizedInner({
602
+ ...props,
715
603
  rowCount,
716
604
  autoHeight: true
717
605
  }));
718
606
  }
719
-
720
607
  renderSimple(maxHeight, rowCount) {
721
608
  const items = [];
722
-
723
609
  for (let index = 0; index < rowCount; index++) {
724
610
  items.push(this.renderItem({
725
611
  index,
726
612
  isScrolling: this.state.scrolling
727
613
  }));
728
614
  }
729
-
730
615
  return /*#__PURE__*/React.createElement("div", {
731
616
  className: classNames('ring-list__i', modules_3b67a421.simpleInner),
732
617
  onScroll: this.scrollHandler,
@@ -739,7 +624,6 @@ class List extends Component {
739
624
  } : undefined
740
625
  }, items));
741
626
  }
742
-
743
627
  /** @override */
744
628
  render() {
745
629
  const hint = this.getSelected() && this.props.hintOnSelection || this.props.hint;
@@ -770,9 +654,7 @@ class List extends Component {
770
654
  label: hint
771
655
  })));
772
656
  }
773
-
774
657
  }
775
-
776
658
  _defineProperty(List, "propTypes", {
777
659
  id: PropTypes.string,
778
660
  className: PropTypes.string,
@@ -799,7 +681,6 @@ _defineProperty(List, "propTypes", {
799
681
  hidden: PropTypes.bool,
800
682
  ariaLabel: PropTypes.string
801
683
  });
802
-
803
684
  _defineProperty(List, "defaultProps", {
804
685
  data: [],
805
686
  restoreActiveIndex: false,
@@ -814,11 +695,8 @@ _defineProperty(List, "defaultProps", {
814
695
  disableMoveDownOverflow: false,
815
696
  ariaLabel: 'List'
816
697
  });
817
-
818
698
  _defineProperty(List, "isItemType", isItemType);
819
-
820
699
  _defineProperty(List, "ListHint", ListHint);
821
-
822
700
  _defineProperty(List, "ListProps", {
823
701
  Type,
824
702
  Dimension
@@ -9,16 +9,13 @@ import { m as modules_3b67a421 } from '../_helpers/list.js';
9
9
  class ListCustom extends PureComponent {
10
10
  constructor() {
11
11
  super(...arguments);
12
-
13
12
  _defineProperty(this, "handleKeyPress", event => {
14
13
  const key = getEventKey(event);
15
-
16
14
  if (key === 'Enter' || key === ' ') {
17
15
  this.props.onClick(event);
18
16
  }
19
17
  });
20
18
  }
21
-
22
19
  render() {
23
20
  const {
24
21
  scrolling,
@@ -58,7 +55,6 @@ class ListCustom extends PureComponent {
58
55
  "data-test": dataTest
59
56
  }, content);
60
57
  }
61
-
62
58
  }
63
59
  ListCustom.propTypes = {
64
60
  scrolling: PropTypes.bool.isRequired,
@@ -8,7 +8,6 @@ import { m as modules_3b67a421 } from '../_helpers/list.js';
8
8
  * @constructor
9
9
  * @extends {ReactComponent}
10
10
  */
11
-
12
11
  class ListHint extends PureComponent {
13
12
  render() {
14
13
  return /*#__PURE__*/React.createElement("span", {
@@ -16,9 +15,7 @@ class ListHint extends PureComponent {
16
15
  "data-test": "ring-list-hint"
17
16
  }, this.props.label);
18
17
  }
19
-
20
18
  }
21
-
22
19
  _defineProperty(ListHint, "propTypes", {
23
20
  label: PropTypes.node
24
21
  });
@@ -26,21 +26,16 @@ var modules_5b0fb3e8 = {"unit":"8px","footer-height":"64px","breakpoint-small":"
26
26
  * @constructor
27
27
  * @extends {ReactComponent}
28
28
  */
29
-
30
29
  const RING_UNIT = 8;
31
30
  const DEFAULT_PADDING = 16;
32
31
  const CHECKBOX_WIDTH = 28;
33
32
  class ListItem extends PureComponent {
34
33
  constructor() {
35
34
  super(...arguments);
36
-
37
35
  _defineProperty(this, "id", getUID('list-item-'));
38
-
39
36
  _defineProperty(this, "stopBubbling", e => e.stopPropagation());
40
-
41
37
  _defineProperty(this, "_isString", val => typeof val === 'string' || val instanceof String);
42
38
  }
43
-
44
39
  render() {
45
40
  const {
46
41
  scrolling,
@@ -91,7 +86,6 @@ class ListItem extends PureComponent {
91
86
  paddingLeft: `${(Number(level) || 0) * RING_UNIT + DEFAULT_PADDING + (showCheckbox ? CHECKBOX_WIDTH : 0)}px`
92
87
  };
93
88
  let computedTitle = null;
94
-
95
89
  if (this._isString(title)) {
96
90
  // if title is specified and is a string then use it
97
91
  computedTitle = title;
@@ -100,7 +94,6 @@ class ListItem extends PureComponent {
100
94
  // label can also be an element, use empty string in this case
101
95
  computedTitle = this._isString(label) ? label : '';
102
96
  }
103
-
104
97
  const dataTest = joinDataTestAttributes({
105
98
  'ring-list-item': (restProps['data-test'] || '').indexOf('ring-list-item') === -1,
106
99
  'ring-list-item-action': !disabled,
@@ -166,7 +159,6 @@ class ListItem extends PureComponent {
166
159
  className: detailsClasses
167
160
  }, details)));
168
161
  }
169
-
170
162
  }
171
163
  ListItem.propTypes = {
172
164
  scrolling: PropTypes.bool,