@jetbrains/ring-ui 5.0.155 → 5.0.157

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 (299) hide show
  1. package/components/checkbox/checkbox.css +1 -1
  2. package/components/global/variables_dark.css +2 -2
  3. package/components/radio/radio.css +1 -1
  4. package/dist/_helpers/_rollupPluginBabelHelpers.js +642 -1
  5. package/dist/_helpers/anchor.js +6 -7
  6. package/dist/_helpers/button__classes.js +16 -28
  7. package/dist/_helpers/card.js +107 -95
  8. package/dist/_helpers/dialog__body-scroll-preventer.js +20 -11
  9. package/dist/_helpers/footer.js +29 -34
  10. package/dist/_helpers/query-assist__suggestions.js +91 -74
  11. package/dist/_helpers/select__filter.js +71 -48
  12. package/dist/_helpers/services-link.js +41 -29
  13. package/dist/_helpers/sidebar.js +103 -99
  14. package/dist/_helpers/theme.js +42 -35
  15. package/dist/_helpers/title.js +71 -57
  16. package/dist/alert/alert.js +199 -158
  17. package/dist/alert/container.js +43 -32
  18. package/dist/alert-service/alert-service.js +172 -104
  19. package/dist/analytics/analytics.js +92 -68
  20. package/dist/analytics/analytics__custom-plugin.js +84 -60
  21. package/dist/analytics/analytics__fus-plugin.js +28 -15
  22. package/dist/analytics/analytics__ga-plugin.js +60 -43
  23. package/dist/analytics/analytics__plugin-utils.js +28 -22
  24. package/dist/auth/auth.js +36 -4
  25. package/dist/auth/auth__core.js +1458 -732
  26. package/dist/auth/background-flow.js +129 -87
  27. package/dist/auth/down-notification.js +75 -30
  28. package/dist/auth/iframe-flow.js +136 -75
  29. package/dist/auth/landing.js +90 -30
  30. package/dist/auth/request-builder.js +82 -46
  31. package/dist/auth/response-parser.js +119 -86
  32. package/dist/auth/storage.js +333 -171
  33. package/dist/auth/token-validator.js +244 -137
  34. package/dist/auth/window-flow.js +136 -92
  35. package/dist/auth-dialog/auth-dialog.js +176 -114
  36. package/dist/auth-dialog-service/auth-dialog-service.js +32 -7
  37. package/dist/auth-ng/auth-ng.js +70 -34
  38. package/dist/auth-ng/auth-ng.mock.js +6 -6
  39. package/dist/autofocus-ng/autofocus-ng.js +23 -8
  40. package/dist/avatar/avatar-example-datauri.js +1 -23
  41. package/dist/avatar/avatar.js +155 -119
  42. package/dist/avatar/fallback-avatar.js +41 -22
  43. package/dist/avatar-editor-ng/avatar-editor-ng.js +56 -23
  44. package/dist/avatar-editor-ng/avatar-editor-ng__template.js +1 -28
  45. package/dist/avatar-ng/avatar-ng.js +23 -1
  46. package/dist/badge/badge.js +43 -35
  47. package/dist/badge-ng/badge-ng.js +13 -1
  48. package/dist/breadcrumb-ng/breadcrumb-ng.js +15 -29
  49. package/dist/button/button.js +111 -87
  50. package/dist/button/button__classes.js +1 -0
  51. package/dist/button-group/button-group.js +35 -19
  52. package/dist/button-group/caption.js +22 -14
  53. package/dist/button-group-ng/button-group-ng.js +13 -7
  54. package/dist/button-ng/button-ng.js +154 -133
  55. package/dist/button-set/button-set.js +34 -20
  56. package/dist/button-set-ng/button-set-ng.js +2 -2
  57. package/dist/button-toolbar/button-toolbar.js +33 -19
  58. package/dist/button-toolbar-ng/button-toolbar-ng.js +5 -3
  59. package/dist/caret/caret.js +225 -188
  60. package/dist/checkbox/checkbox.js +104 -76
  61. package/dist/checkbox-ng/checkbox-ng.js +18 -27
  62. package/dist/clipboard/clipboard-fallback.js +10 -10
  63. package/dist/clipboard/clipboard.js +131 -34
  64. package/dist/code/code.js +168 -92
  65. package/dist/compiler-ng/compiler-ng.js +18 -15
  66. package/dist/confirm/confirm.js +108 -66
  67. package/dist/confirm-ng/confirm-ng.js +33 -4
  68. package/dist/confirm-service/confirm-service.js +66 -42
  69. package/dist/content-layout/content-layout.js +64 -43
  70. package/dist/content-layout/sidebar.js +1 -0
  71. package/dist/contenteditable/contenteditable.js +61 -50
  72. package/dist/control-label/control-label.js +11 -15
  73. package/dist/data-list/data-list.js +184 -128
  74. package/dist/data-list/data-list.mock.js +11 -2
  75. package/dist/data-list/item.js +174 -143
  76. package/dist/data-list/selection.js +139 -76
  77. package/dist/data-list/title.js +13 -1
  78. package/dist/data-list-ng/data-list-ng.js +31 -1
  79. package/dist/date-picker/consts.js +18 -15
  80. package/dist/date-picker/date-input.js +147 -115
  81. package/dist/date-picker/date-picker.js +285 -228
  82. package/dist/date-picker/date-popup.js +397 -356
  83. package/dist/date-picker/day.js +98 -84
  84. package/dist/date-picker/month-names.js +64 -43
  85. package/dist/date-picker/month-slider.js +74 -51
  86. package/dist/date-picker/month.js +21 -15
  87. package/dist/date-picker/months.js +48 -43
  88. package/dist/date-picker/weekdays.js +18 -12
  89. package/dist/date-picker/years.js +109 -84
  90. package/dist/dialog/dialog.js +189 -141
  91. package/dist/dialog/dialog__body-scroll-preventer.js +5 -0
  92. package/dist/dialog-ng/dialog-ng.js +401 -287
  93. package/dist/dialog-ng/dialog-ng__template.js +1 -70
  94. package/dist/docked-panel-ng/docked-panel-ng.js +33 -18
  95. package/dist/dropdown/anchor.js +10 -0
  96. package/dist/dropdown/dropdown.js +214 -182
  97. package/dist/dropdown-menu/dropdown-menu.js +102 -72
  98. package/dist/editable-heading/editable-heading.js +100 -58
  99. package/dist/error-bubble/error-bubble.js +64 -31
  100. package/dist/error-message/error-message.js +61 -38
  101. package/dist/error-message-ng/error-message-ng.js +11 -22
  102. package/dist/footer/footer.js +11 -1
  103. package/dist/footer-ng/footer-ng.js +64 -36
  104. package/dist/form-ng/form-ng.js +66 -56
  105. package/dist/global/angular-component-factory.js +76 -53
  106. package/dist/global/compose.js +10 -1
  107. package/dist/global/composeRefs.js +12 -7
  108. package/dist/global/controls-height.js +2 -2
  109. package/dist/global/create-stateful-context.js +19 -19
  110. package/dist/global/data-tests.js +15 -7
  111. package/dist/global/dom.js +95 -53
  112. package/dist/global/focus-sensor-hoc.js +134 -122
  113. package/dist/global/fuzzy-highlight.js +41 -27
  114. package/dist/global/get-event-key.js +8 -8
  115. package/dist/global/get-uid.js +8 -4
  116. package/dist/global/inject-styles.js +15 -10
  117. package/dist/global/linear-function.js +2 -2
  118. package/dist/global/listeners.js +53 -27
  119. package/dist/global/memoize.js +13 -6
  120. package/dist/global/normalize-indent.js +51 -19
  121. package/dist/global/promise-with-timeout.js +8 -6
  122. package/dist/global/prop-types.js +5 -3
  123. package/dist/global/react-dom-renderer.js +47 -28
  124. package/dist/global/react-render-adapter.js +19 -13
  125. package/dist/global/rerender-hoc.js +41 -16
  126. package/dist/global/ring-angular-component.js +20 -10
  127. package/dist/global/schedule-raf.js +6 -5
  128. package/dist/global/sniffer.js +1 -1
  129. package/dist/global/theme.js +24 -0
  130. package/dist/global/trivial-template-tag.js +10 -3
  131. package/dist/global/typescript-utils.js +6 -2
  132. package/dist/global/url.js +27 -21
  133. package/dist/global/use-event-callback.js +4 -6
  134. package/dist/grid/col.js +55 -35
  135. package/dist/grid/grid.js +36 -17
  136. package/dist/grid/row.js +48 -35
  137. package/dist/group/group.js +27 -17
  138. package/dist/group-ng/group-ng.js +2 -2
  139. package/dist/header/header.js +80 -33
  140. package/dist/header/logo.js +39 -20
  141. package/dist/header/profile.js +188 -150
  142. package/dist/header/services-link.js +9 -0
  143. package/dist/header/services.js +118 -73
  144. package/dist/header/smart-profile.js +207 -111
  145. package/dist/header/smart-services.js +115 -62
  146. package/dist/header/tray-icon.js +38 -21
  147. package/dist/header/tray.js +34 -21
  148. package/dist/heading/heading.js +25 -26
  149. package/dist/heading-ng/heading-ng.js +11 -1
  150. package/dist/http/http.js +368 -215
  151. package/dist/http/http.mock.js +104 -49
  152. package/dist/hub-source/hub-source.js +191 -83
  153. package/dist/hub-source/hub-source__user.js +45 -11
  154. package/dist/hub-source/hub-source__users-groups.js +67 -37
  155. package/dist/i18n/i18n-context.js +14 -10
  156. package/dist/i18n/i18n.js +11 -7
  157. package/dist/icon/icon.js +94 -76
  158. package/dist/icon/icon__svg.js +31 -24
  159. package/dist/icon/index.js +9 -0
  160. package/dist/icon-ng/icon-ng.js +27 -15
  161. package/dist/input/input.js +184 -145
  162. package/dist/input-ng/input-ng.js +96 -118
  163. package/dist/island/adaptive-island-hoc.js +45 -30
  164. package/dist/island/content.js +130 -115
  165. package/dist/island/header.js +69 -56
  166. package/dist/island/island.js +40 -28
  167. package/dist/island-legacy/content-legacy.js +27 -17
  168. package/dist/island-legacy/header-legacy.js +29 -19
  169. package/dist/island-legacy/island-legacy.js +27 -17
  170. package/dist/island-ng/island-content-ng.js +17 -26
  171. package/dist/island-ng/island-header-ng.js +9 -12
  172. package/dist/island-ng/island-ng-class-fixer.js +3 -0
  173. package/dist/island-ng/island-ng.js +6 -10
  174. package/dist/link/clickableLink.js +61 -44
  175. package/dist/link/link.js +85 -74
  176. package/dist/link-ng/link-ng.js +3 -5
  177. package/dist/list/consts.js +1 -1
  178. package/dist/list/list.js +696 -602
  179. package/dist/list/list__custom.js +61 -44
  180. package/dist/list/list__hint.js +21 -10
  181. package/dist/list/list__item.js +167 -129
  182. package/dist/list/list__link.js +54 -37
  183. package/dist/list/list__separator.js +24 -14
  184. package/dist/list/list__title.js +32 -22
  185. package/dist/list/list__users-groups-source.js +131 -54
  186. package/dist/loader/loader.js +78 -43
  187. package/dist/loader/loader__core.js +257 -189
  188. package/dist/loader-inline/loader-inline.js +37 -23
  189. package/dist/loader-inline-ng/loader-inline-ng.js +2 -2
  190. package/dist/loader-ng/loader-ng.js +46 -19
  191. package/dist/loader-screen/loader-screen.js +48 -25
  192. package/dist/loader-screen-ng/loader-screen-ng.js +46 -30
  193. package/dist/login-dialog/login-dialog.js +162 -111
  194. package/dist/login-dialog/service.js +35 -7
  195. package/dist/markdown/code.js +31 -9
  196. package/dist/markdown/heading.js +3 -5
  197. package/dist/markdown/link.js +13 -6
  198. package/dist/markdown/markdown.js +66 -33
  199. package/dist/message/message.js +157 -125
  200. package/dist/message-bundle-ng/message-bundle-ng.js +128 -44
  201. package/dist/old-browsers-message/old-browsers-message.js +19 -11
  202. package/dist/old-browsers-message/old-browsers-message__stop.js +8 -0
  203. package/dist/old-browsers-message/white-list.js +16 -9
  204. package/dist/pager/pager.js +275 -210
  205. package/dist/pager-ng/pager-ng.js +36 -1
  206. package/dist/panel/panel.js +27 -17
  207. package/dist/panel-ng/panel-ng.js +14 -1
  208. package/dist/permissions/permissions.js +173 -127
  209. package/dist/permissions/permissions__cache.js +225 -194
  210. package/dist/permissions-ng/permissions-ng.js +86 -35
  211. package/dist/place-under-ng/place-under-ng.js +68 -45
  212. package/dist/popup/popup.consts.js +1 -1
  213. package/dist/popup/popup.js +342 -280
  214. package/dist/popup/popup.target.js +8 -9
  215. package/dist/popup/position.js +153 -153
  216. package/dist/popup-menu/popup-menu.js +86 -44
  217. package/dist/progress-bar/progress-bar.js +97 -80
  218. package/dist/progress-bar-ng/progress-bar-ng.js +11 -1
  219. package/dist/promised-click-ng/promised-click-ng.js +92 -58
  220. package/dist/proxy-attrs/proxy-attrs.js +18 -9
  221. package/dist/query-assist/query-assist.js +903 -832
  222. package/dist/query-assist/query-assist__suggestions.js +33 -1
  223. package/dist/query-assist-ng/query-assist-ng.js +38 -1
  224. package/dist/radio/radio.js +36 -19
  225. package/dist/radio/radio__item.js +71 -52
  226. package/dist/radio-ng/radio-ng.js +14 -25
  227. package/dist/save-field-ng/save-field-ng.js +86 -52
  228. package/dist/save-field-ng/save-field-ng__template.js +1 -32
  229. package/dist/select/select.js +937 -835
  230. package/dist/select/select__filter.js +33 -0
  231. package/dist/select/select__popup.js +472 -359
  232. package/dist/select-ng/select-ng.js +125 -74
  233. package/dist/select-ng/select-ng__lazy.js +101 -50
  234. package/dist/select-ng/select-ng__options.js +107 -81
  235. package/dist/shortcuts/core.js +218 -166
  236. package/dist/shortcuts/shortcut-title.js +11 -6
  237. package/dist/shortcuts/shortcuts-hoc.js +47 -19
  238. package/dist/shortcuts/shortcuts.js +77 -50
  239. package/dist/shortcuts-hint-ng/shortcuts-hint-ng.js +104 -53
  240. package/dist/shortcuts-hint-ng/shortcuts-hint-ng__template.js +1 -48
  241. package/dist/shortcuts-ng/shortcuts-ng.js +86 -51
  242. package/dist/sidebar-ng/sidebar-ng.js +53 -22
  243. package/dist/sidebar-ng/sidebar-ng__button-template.js +1 -18
  244. package/dist/sidebar-ng/sidebar-ng__template.js +1 -10
  245. package/dist/storage/storage.js +35 -4
  246. package/dist/storage/storage__fallback.js +224 -149
  247. package/dist/storage/storage__local.js +156 -90
  248. package/dist/style.css +1 -1
  249. package/dist/tab-trap/tab-trap.js +157 -122
  250. package/dist/table/cell.js +28 -14
  251. package/dist/table/disable-hover-hoc.js +53 -33
  252. package/dist/table/header-cell.js +87 -64
  253. package/dist/table/header.js +126 -98
  254. package/dist/table/multitable.js +127 -107
  255. package/dist/table/row-with-focus-sensor.js +73 -25
  256. package/dist/table/row.js +208 -170
  257. package/dist/table/selection-adapter.js +3 -1
  258. package/dist/table/selection-shortcuts-hoc.js +184 -181
  259. package/dist/table/selection.js +228 -156
  260. package/dist/table/smart-table.js +93 -51
  261. package/dist/table/table.js +348 -281
  262. package/dist/table-legacy-ng/table-legacy-ng.js +117 -102
  263. package/dist/table-legacy-ng/table-legacy-ng__pager.js +42 -10
  264. package/dist/table-legacy-ng/table-legacy-ng__selection-navigate-actions.js +92 -69
  265. package/dist/table-legacy-ng/table-legacy-ng__selection.js +169 -119
  266. package/dist/table-legacy-ng/table-legacy-ng__toolbar.js +36 -21
  267. package/dist/table-ng/smart-table-ng.js +31 -1
  268. package/dist/table-ng/table-ng.js +31 -1
  269. package/dist/tabs/collapsible-more.js +87 -50
  270. package/dist/tabs/collapsible-tab.js +45 -38
  271. package/dist/tabs/collapsible-tabs.js +161 -94
  272. package/dist/tabs/custom-item.js +2 -4
  273. package/dist/tabs/dumb-tabs.js +122 -75
  274. package/dist/tabs/smart-tabs.js +75 -29
  275. package/dist/tabs/tab-link.js +29 -19
  276. package/dist/tabs/tab.js +33 -19
  277. package/dist/tabs/tabs.js +35 -0
  278. package/dist/tabs-ng/tabs-ng.js +38 -24
  279. package/dist/tabs-ng/tabs-ng__template.js +1 -38
  280. package/dist/tag/tag.js +170 -133
  281. package/dist/tags-input/tags-input.js +428 -327
  282. package/dist/tags-input-ng/tags-input-ng.js +37 -1
  283. package/dist/tags-list/tags-list.js +80 -56
  284. package/dist/template-ng/template-ng.js +50 -39
  285. package/dist/text/text.js +38 -28
  286. package/dist/title-ng/title-ng.js +28 -23
  287. package/dist/toggle/toggle.js +72 -56
  288. package/dist/toggle-ng/toggle-ng.js +14 -1
  289. package/dist/tooltip/tooltip.js +192 -146
  290. package/dist/tooltip-ng/tooltip-ng.js +51 -25
  291. package/dist/user-agreement/service.js +374 -227
  292. package/dist/user-agreement/toolbox.eula.js +1 -160
  293. package/dist/user-agreement/user-agreement.js +128 -86
  294. package/dist/user-card/card.js +32 -0
  295. package/dist/user-card/smart-user-card-tooltip.js +116 -51
  296. package/dist/user-card/tooltip.js +90 -48
  297. package/dist/user-card/user-card.js +32 -0
  298. package/dist/user-card-ng/user-card-ng.js +34 -2
  299. package/package.json +13 -13
package/dist/list/list.js CHANGED
@@ -1,4 +1,16 @@
1
- import React, { Component, cloneElement } from 'react';
1
+ import { c as _defineProperty, j as _inherits, k as _createSuper, b as _classCallCheck, m as _assertThisInitialized, h as _objectWithoutProperties, _ as _createClass, a as _objectSpread2 } from '../_helpers/_rollupPluginBabelHelpers.js';
2
+ import 'core-js/modules/es.array.includes.js';
3
+ import 'core-js/modules/es.string.includes.js';
4
+ import 'core-js/modules/es.array.map.js';
5
+ import 'core-js/modules/es.array.concat.js';
6
+ import 'core-js/modules/es.symbol.js';
7
+ import 'core-js/modules/es.symbol.description.js';
8
+ import 'core-js/modules/es.object.to-string.js';
9
+ import 'core-js/modules/es.array.find-index.js';
10
+ import 'core-js/modules/es.object.assign.js';
11
+ import 'core-js/modules/es.object.keys.js';
12
+ import 'core-js/modules/es.array.find.js';
13
+ import React, { cloneElement, Component } from 'react';
2
14
  import PropTypes from 'prop-types';
3
15
  import classNames from 'classnames';
4
16
  import VirtualizedList from 'react-virtualized/dist/es/List';
@@ -22,17 +34,36 @@ import ListSeparator from './list__separator.js';
22
34
  import ListHint from './list__hint.js';
23
35
  import { Type, Dimension, DEFAULT_ITEM_TYPE } from './consts.js';
24
36
  import { m as modules_3b67a421 } from '../_helpers/list.js';
37
+ import 'core-js/modules/es.array.reduce.js';
38
+ import 'core-js/modules/es.object.entries.js';
39
+ import 'core-js/modules/es.regexp.to-string.js';
40
+ import 'core-js/modules/es.array.iterator.js';
41
+ import 'core-js/modules/es.map.js';
42
+ import 'core-js/modules/es.string.iterator.js';
43
+ import 'core-js/modules/web.dom-collections.iterator.js';
44
+ import 'core-js/modules/es.weak-map.js';
45
+ import 'core-js/modules/web.dom-collections.for-each.js';
46
+ import 'core-js/modules/es.array.filter.js';
47
+ import 'core-js/modules/es.regexp.exec.js';
48
+ import 'core-js/modules/es.string.split.js';
49
+ import 'core-js/modules/es.set.js';
25
50
  import '../shortcuts/core.js';
51
+ import 'core-js/modules/es.array.slice.js';
52
+ import 'core-js/modules/es.array.splice.js';
53
+ import 'core-js/modules/es.string.match.js';
26
54
  import 'combokeys';
27
55
  import '../global/sniffer.js';
28
56
  import 'sniffr';
29
- import '../_helpers/_rollupPluginBabelHelpers.js';
30
57
  import '../link/link.js';
31
58
  import '../link/clickableLink.js';
32
59
  import '../_helpers/link.js';
60
+ import 'core-js/modules/es.number.constructor.js';
61
+ import 'core-js/modules/es.array.index-of.js';
33
62
  import '../avatar/avatar.js';
34
63
  import '../global/url.js';
64
+ import 'core-js/modules/es.string.replace.js';
35
65
  import '../avatar/fallback-avatar.js';
66
+ import 'core-js/modules/es.array.from.js';
36
67
  import '../checkbox/checkbox.js';
37
68
  import '@jetbrains/icons/checkmark-14px';
38
69
  import '@jetbrains/icons/remove-14px';
@@ -40,33 +71,39 @@ import '../icon/icon.js';
40
71
  import '../icon/icon__constants.js';
41
72
  import '../_helpers/icon.js';
42
73
  import '../icon/icon__svg.js';
74
+ import 'core-js/modules/es.string.starts-with.js';
43
75
  import '../global/prop-types.js';
44
76
  import '../global/composeRefs.js';
45
77
  import '../_helpers/checkbox.js';
46
78
  import '../global/get-event-key.js';
47
79
 
80
+ var _excluded = ["selectedLabel", "originalModel"];
48
81
  function noop() {}
49
- 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.');
82
+ var warnEmptyKey = deprecate(function () {}, '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
83
  /**
51
84
  * @param {Type} listItemType
52
85
  * @param {Object} item list item
53
86
  */
54
87
  function isItemType(listItemType, item) {
55
- let type = item.rgItemType;
88
+ var type = item.rgItemType;
56
89
  if (type == null) {
57
90
  type = DEFAULT_ITEM_TYPE;
58
91
  }
59
92
  return type === listItemType;
60
93
  }
61
- const nonActivatableTypes = [Type.SEPARATOR, Type.TITLE, Type.MARGIN];
94
+ var nonActivatableTypes = [Type.SEPARATOR, Type.TITLE, Type.MARGIN];
62
95
  function isActivatable(item) {
63
96
  return item != null && !nonActivatableTypes.includes(item.rgItemType) && !item.disabled;
64
97
  }
65
98
  function getDataHash(data) {
66
- return data.map(it => it.key).join('-');
99
+ return data.map(function (it) {
100
+ return it.key;
101
+ }).join('-');
67
102
  }
68
- const shouldActivateFirstItem = props => props.activateFirstItem || props.activateSingleItem && props.data.length === 1;
69
- const ActiveItemContext = createStatefulContext(undefined, 'ActiveItem');
103
+ var shouldActivateFirstItem = function shouldActivateFirstItem(props) {
104
+ return props.activateFirstItem || props.activateSingleItem && props.data.length === 1;
105
+ };
106
+ var ActiveItemContext = createStatefulContext(undefined, 'ActiveItem');
70
107
  /**
71
108
  * @name List
72
109
  * @constructor
@@ -75,636 +112,693 @@ const ActiveItemContext = createStatefulContext(undefined, 'ActiveItem');
75
112
  /**
76
113
  * Displays a list of items.
77
114
  */
78
- class List extends Component {
79
- static propTypes = {
80
- id: PropTypes.string,
81
- className: PropTypes.string,
82
- hint: PropTypes.node,
83
- hintOnSelection: PropTypes.string,
84
- data: PropTypes.array,
85
- maxHeight: PropTypes.number,
86
- activeIndex: PropTypes.number,
87
- restoreActiveIndex: PropTypes.bool,
88
- activateSingleItem: PropTypes.bool,
89
- activateFirstItem: PropTypes.bool,
90
- shortcuts: PropTypes.bool,
91
- onMouseOut: PropTypes.func,
92
- onSelect: PropTypes.func,
93
- onScrollToBottom: PropTypes.func,
94
- onResize: PropTypes.func,
95
- useMouseUp: PropTypes.bool,
96
- visible: PropTypes.bool,
97
- renderOptimization: PropTypes.bool,
98
- disableMoveOverflow: PropTypes.bool,
99
- disableMoveDownOverflow: PropTypes.bool,
100
- compact: PropTypes.bool,
101
- disableScrollToActive: PropTypes.bool,
102
- hidden: PropTypes.bool,
103
- ariaLabel: PropTypes.string
104
- };
105
- static defaultProps = {
106
- data: [],
107
- restoreActiveIndex: false,
108
- activateSingleItem: false,
109
- activateFirstItem: false,
110
- onMouseOut: noop,
111
- onSelect: noop,
112
- onScrollToBottom: noop,
113
- onResize: noop,
114
- shortcuts: false,
115
- renderOptimization: true,
116
- disableMoveDownOverflow: false,
117
- ariaLabel: 'List'
118
- };
119
- state = {
120
- activeIndex: null,
121
- prevActiveIndex: null,
122
- prevData: [],
123
- activeItem: null,
124
- needScrollToActive: false,
125
- scrolling: false,
126
- hasOverflow: false,
127
- disabledHover: false,
128
- scrolledToBottom: false
129
- };
130
- static getDerivedStateFromProps(nextProps, prevState) {
131
- const {
132
- prevActiveIndex,
133
- prevData,
134
- activeItem
135
- } = prevState;
136
- const {
137
- data,
138
- activeIndex,
139
- restoreActiveIndex
140
- } = nextProps;
141
- const nextState = {
142
- prevActiveIndex: activeIndex,
143
- prevData: data
144
- };
145
- if (data !== prevData) {
146
- Object.assign(nextState, {
147
- activeIndex: null,
148
- activeItem: null
149
- });
115
+ var List = /*#__PURE__*/function (_Component) {
116
+ _inherits(List, _Component);
117
+ var _super = _createSuper(List);
118
+ function List() {
119
+ var _this;
120
+ _classCallCheck(this, List);
121
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
122
+ args[_key] = arguments[_key];
150
123
  }
151
- if (activeIndex != null && activeIndex !== prevActiveIndex && data[activeIndex] != null) {
152
- Object.assign(nextState, {
153
- activeIndex,
154
- activeItem: data[activeIndex],
155
- needScrollToActive: true
156
- });
157
- } else if (data !== prevData && restoreActiveIndex && activeItem != null && activeItem.key != null) {
158
- // Restore active index if there is an item with the same "key" property
159
- const index = data.findIndex(item => item.key === activeItem.key);
160
- if (index >= 0) {
161
- Object.assign(nextState, {
162
- activeIndex: index,
163
- activeItem: data[index]
124
+ _this = _super.call.apply(_super, [this].concat(args));
125
+ _defineProperty(_assertThisInitialized(_this), "state", {
126
+ activeIndex: null,
127
+ prevActiveIndex: null,
128
+ prevData: [],
129
+ activeItem: null,
130
+ needScrollToActive: false,
131
+ scrolling: false,
132
+ hasOverflow: false,
133
+ disabledHover: false,
134
+ scrolledToBottom: false
135
+ });
136
+ _defineProperty(_assertThisInitialized(_this), "scheduleScrollListener", scheduleRAF());
137
+ _defineProperty(_assertThisInitialized(_this), "scheduleHoverListener", scheduleRAF());
138
+ _defineProperty(_assertThisInitialized(_this), "virtualizedList", void 0);
139
+ _defineProperty(_assertThisInitialized(_this), "unmounted", void 0);
140
+ _defineProperty(_assertThisInitialized(_this), "container", void 0);
141
+ _defineProperty(_assertThisInitialized(_this), "hoverHandler", memoize(function (index) {
142
+ return function () {
143
+ return _this.scheduleHoverListener(function () {
144
+ if (_this.state.disabledHover) {
145
+ return;
146
+ }
147
+ if (_this.container) {
148
+ _this.setState({
149
+ activeIndex: index,
150
+ activeItem: _this.props.data[index],
151
+ needScrollToActive: false
152
+ });
153
+ }
164
154
  });
165
- }
166
- }
167
- return nextState;
168
- }
169
- componentDidMount() {
170
- document.addEventListener('mousemove', this.onDocumentMouseMove);
171
- document.addEventListener('keydown', this.onDocumentKeyDown, true);
172
- if (this.props.activeIndex == null && shouldActivateFirstItem(this.props)) {
173
- this.activateFirst();
174
- }
175
- }
176
- shouldComponentUpdate(nextProps, nextState) {
177
- return nextProps !== this.props || Object.keys(nextState).some(key => nextState[key] !== this.state[key]);
178
- }
179
- componentDidUpdate(prevProps) {
180
- if (this.virtualizedList && prevProps.data !== this.props.data) {
181
- this.virtualizedList.recomputeRowHeights();
182
- }
183
- if (this.props.activeIndex == null && getDataHash(this.props.data) !== getDataHash(prevProps.data) && shouldActivateFirstItem(this.props)) {
184
- this.activateFirst();
185
- }
186
- this.checkOverflow();
187
- }
188
- componentWillUnmount() {
189
- this.unmounted = true;
190
- document.removeEventListener('mousemove', this.onDocumentMouseMove);
191
- document.removeEventListener('keydown', this.onDocumentKeyDown, true);
192
- }
193
- scheduleScrollListener = scheduleRAF();
194
- scheduleHoverListener = scheduleRAF();
195
- static isItemType = isItemType;
196
- static ListHint = ListHint;
197
- static ListProps = {
198
- Type,
199
- Dimension
200
- };
201
- virtualizedList;
202
- unmounted;
203
- container;
204
- hoverHandler = memoize(index => () => this.scheduleHoverListener(() => {
205
- if (this.state.disabledHover) {
206
- return;
207
- }
208
- if (this.container) {
209
- this.setState({
210
- activeIndex: index,
211
- activeItem: this.props.data[index],
212
- needScrollToActive: false
213
- });
214
- }
215
- }));
216
- _activatableItems = false;
217
- // eslint-disable-next-line @typescript-eslint/no-magic-numbers
218
- _bufferSize = 10; // keep X items above and below of the visible area
219
- // reuse size cache for similar items
220
- sizeCacheKey = index => {
221
- if (index === 0 || index === this.props.data.length + 1) {
222
- return Type.MARGIN;
223
- }
224
- const item = this.props.data[index - 1];
225
- const isFirst = index === 1;
226
- switch (item.rgItemType) {
227
- case Type.SEPARATOR:
228
- case Type.TITLE:
229
- return `${item.rgItemType}${isFirst ? '_first' : ''}${item.description ? '_desc' : ''}`;
230
- case Type.MARGIN:
155
+ };
156
+ }));
157
+ _defineProperty(_assertThisInitialized(_this), "_activatableItems", false);
158
+ // eslint-disable-next-line @typescript-eslint/no-magic-numbers
159
+ _defineProperty(_assertThisInitialized(_this), "_bufferSize", 10);
160
+ // keep X items above and below of the visible area
161
+ // reuse size cache for similar items
162
+ _defineProperty(_assertThisInitialized(_this), "sizeCacheKey", function (index) {
163
+ if (index === 0 || index === _this.props.data.length + 1) {
231
164
  return Type.MARGIN;
232
- case Type.CUSTOM:
233
- return `${Type.CUSTOM}_${item.key}`;
234
- case Type.ITEM:
235
- case Type.LINK:
236
- default:
237
- if (item.details) {
238
- return `${Type.ITEM}_${item.details}`;
239
- }
240
- return Type.ITEM;
241
- }
242
- };
243
- _cache = new CellMeasurerCache({
244
- defaultHeight: this.defaultItemHeight(),
245
- fixedWidth: true,
246
- keyMapper: this.sizeCacheKey
247
- });
248
- _hasActivatableItems = memoizeOne(items => items.some(isActivatable));
249
- hasActivatableItems() {
250
- return this._hasActivatableItems(this.props.data);
251
- }
252
- activateFirst = () => {
253
- const firstActivatableIndex = this.props.data.findIndex(isActivatable);
254
- if (firstActivatableIndex >= 0) {
255
- this.setState({
256
- activeIndex: firstActivatableIndex,
257
- activeItem: this.props.data[firstActivatableIndex],
258
- needScrollToActive: true
259
- });
260
- }
261
- };
262
- selectHandler = memoize(index => {
263
- var _this = this;
264
- return function (event) {
265
- let tryKeepOpen = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
266
- const item = _this.props.data[index];
267
- if (!_this.props.useMouseUp && item.onClick) {
268
- item.onClick(item, event);
269
- } else if (_this.props.useMouseUp && item.onMouseUp) {
270
- item.onMouseUp(item, event);
271
165
  }
272
- if (_this.props.onSelect) {
273
- _this.props.onSelect(item, event, {
274
- tryKeepOpen
166
+ var item = _this.props.data[index - 1];
167
+ var isFirst = index === 1;
168
+ switch (item.rgItemType) {
169
+ case Type.SEPARATOR:
170
+ case Type.TITLE:
171
+ return "".concat(item.rgItemType).concat(isFirst ? '_first' : '').concat(item.description ? '_desc' : '');
172
+ case Type.MARGIN:
173
+ return Type.MARGIN;
174
+ case Type.CUSTOM:
175
+ return "".concat(Type.CUSTOM, "_").concat(item.key);
176
+ case Type.ITEM:
177
+ case Type.LINK:
178
+ default:
179
+ if (item.details) {
180
+ return "".concat(Type.ITEM, "_").concat(item.details);
181
+ }
182
+ return Type.ITEM;
183
+ }
184
+ });
185
+ _defineProperty(_assertThisInitialized(_this), "_cache", new CellMeasurerCache({
186
+ defaultHeight: _this.defaultItemHeight(),
187
+ fixedWidth: true,
188
+ keyMapper: _this.sizeCacheKey
189
+ }));
190
+ _defineProperty(_assertThisInitialized(_this), "_hasActivatableItems", memoizeOne(function (items) {
191
+ return items.some(isActivatable);
192
+ }));
193
+ _defineProperty(_assertThisInitialized(_this), "activateFirst", function () {
194
+ var firstActivatableIndex = _this.props.data.findIndex(isActivatable);
195
+ if (firstActivatableIndex >= 0) {
196
+ _this.setState({
197
+ activeIndex: firstActivatableIndex,
198
+ activeItem: _this.props.data[firstActivatableIndex],
199
+ needScrollToActive: true
275
200
  });
276
201
  }
277
- };
278
- });
279
- checkboxHandler = memoize(index => event => this.selectHandler(index)(event, true));
280
- upHandler = e => {
281
- const {
282
- data,
283
- disableMoveOverflow
284
- } = this.props;
285
- const index = this.state.activeIndex;
286
- let newIndex;
287
- if (index === null || index === 0) {
288
- if (!disableMoveOverflow) {
289
- newIndex = data.length - 1;
202
+ });
203
+ _defineProperty(_assertThisInitialized(_this), "selectHandler", memoize(function (index) {
204
+ return function (event) {
205
+ var tryKeepOpen = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
206
+ var item = _this.props.data[index];
207
+ if (!_this.props.useMouseUp && item.onClick) {
208
+ item.onClick(item, event);
209
+ } else if (_this.props.useMouseUp && item.onMouseUp) {
210
+ item.onMouseUp(item, event);
211
+ }
212
+ if (_this.props.onSelect) {
213
+ _this.props.onSelect(item, event, {
214
+ tryKeepOpen: tryKeepOpen
215
+ });
216
+ }
217
+ };
218
+ }));
219
+ _defineProperty(_assertThisInitialized(_this), "checkboxHandler", memoize(function (index) {
220
+ return function (event) {
221
+ return _this.selectHandler(index)(event, true);
222
+ };
223
+ }));
224
+ _defineProperty(_assertThisInitialized(_this), "upHandler", function (e) {
225
+ var _this$props = _this.props,
226
+ data = _this$props.data,
227
+ disableMoveOverflow = _this$props.disableMoveOverflow;
228
+ var index = _this.state.activeIndex;
229
+ var newIndex;
230
+ if (index === null || index === 0) {
231
+ if (!disableMoveOverflow) {
232
+ newIndex = data.length - 1;
233
+ } else {
234
+ return;
235
+ }
290
236
  } else {
291
- return;
237
+ newIndex = index - 1;
292
238
  }
293
- } else {
294
- newIndex = index - 1;
295
- }
296
- this.moveHandler(newIndex, this.upHandler, e);
297
- };
298
- downHandler = e => {
299
- const {
300
- data,
301
- disableMoveOverflow,
302
- disableMoveDownOverflow
303
- } = this.props;
304
- const index = this.state.activeIndex;
305
- let newIndex;
306
- if (index === null) {
307
- newIndex = 0;
308
- } else if (index + 1 === data.length) {
309
- if (!disableMoveOverflow && !disableMoveDownOverflow) {
239
+ _this.moveHandler(newIndex, _this.upHandler, e);
240
+ });
241
+ _defineProperty(_assertThisInitialized(_this), "downHandler", function (e) {
242
+ var _this$props2 = _this.props,
243
+ data = _this$props2.data,
244
+ disableMoveOverflow = _this$props2.disableMoveOverflow,
245
+ disableMoveDownOverflow = _this$props2.disableMoveDownOverflow;
246
+ var index = _this.state.activeIndex;
247
+ var newIndex;
248
+ if (index === null) {
310
249
  newIndex = 0;
250
+ } else if (index + 1 === data.length) {
251
+ if (!disableMoveOverflow && !disableMoveDownOverflow) {
252
+ newIndex = 0;
253
+ } else {
254
+ return;
255
+ }
311
256
  } else {
312
- return;
257
+ newIndex = index + 1;
313
258
  }
314
- } else {
315
- newIndex = index + 1;
316
- }
317
- this.moveHandler(newIndex, this.downHandler, e);
318
- };
319
- homeHandler = e => {
320
- this.moveHandler(0, this.downHandler, e);
321
- };
322
- endHandler = e => {
323
- this.moveHandler(this.props.data.length - 1, this.upHandler, e);
324
- };
325
- onDocumentMouseMove = () => {
326
- if (this.state.disabledHover) {
327
- this.setState({
328
- disabledHover: false
329
- });
330
- }
331
- };
332
- onDocumentKeyDown = e => {
333
- const metaKeys = [16, 17, 18, 19, 20, 91]; // eslint-disable-line @typescript-eslint/no-magic-numbers
334
- if (!this.state.disabledHover && !metaKeys.includes(e.keyCode)) {
335
- this.setState({
336
- disabledHover: true
337
- });
338
- }
339
- };
340
- moveHandler(index, retryCallback, e) {
341
- let correctedIndex;
342
- if (this.props.data.length === 0 || !this.hasActivatableItems()) {
343
- return;
344
- } else if (this.props.data.length < index) {
345
- correctedIndex = 0;
346
- } else {
347
- correctedIndex = index;
348
- }
349
- const item = this.props.data[correctedIndex];
350
- this.setState({
351
- activeIndex: correctedIndex,
352
- activeItem: item,
353
- needScrollToActive: true
354
- }, function onSet() {
355
- if (!isActivatable(item)) {
356
- retryCallback(e);
357
- return;
259
+ _this.moveHandler(newIndex, _this.downHandler, e);
260
+ });
261
+ _defineProperty(_assertThisInitialized(_this), "homeHandler", function (e) {
262
+ _this.moveHandler(0, _this.downHandler, e);
263
+ });
264
+ _defineProperty(_assertThisInitialized(_this), "endHandler", function (e) {
265
+ _this.moveHandler(_this.props.data.length - 1, _this.upHandler, e);
266
+ });
267
+ _defineProperty(_assertThisInitialized(_this), "onDocumentMouseMove", function () {
268
+ if (_this.state.disabledHover) {
269
+ _this.setState({
270
+ disabledHover: false
271
+ });
358
272
  }
359
- if (e.key !== 'Home' && e.key !== 'End') {
360
- preventDefault(e);
273
+ });
274
+ _defineProperty(_assertThisInitialized(_this), "onDocumentKeyDown", function (e) {
275
+ var metaKeys = [16, 17, 18, 19, 20, 91]; // eslint-disable-line @typescript-eslint/no-magic-numbers
276
+ if (!_this.state.disabledHover && !metaKeys.includes(e.keyCode)) {
277
+ _this.setState({
278
+ disabledHover: true
279
+ });
361
280
  }
362
281
  });
363
- }
364
- mouseHandler = () => {
365
- this.setState({
366
- scrolling: false
282
+ _defineProperty(_assertThisInitialized(_this), "mouseHandler", function () {
283
+ _this.setState({
284
+ scrolling: false
285
+ });
367
286
  });
368
- };
369
- scrollHandler = () => {
370
- this.setState({
371
- scrolling: true
372
- }, this.scrollEndHandler);
373
- };
374
- enterHandler = (event, shortcut) => {
375
- if (this.state.activeIndex !== null) {
376
- const item = this.props.data[this.state.activeIndex];
377
- this.selectHandler(this.state.activeIndex)(event);
378
- if (item.href && !event.defaultPrevented) {
379
- if (shortcut != null && ['command+enter', 'ctrl+enter'].includes(shortcut)) {
380
- window.open(item.href, '_blank');
381
- } else if (shortcut === 'shift+enter') {
382
- window.open(item.href);
383
- } else {
384
- window.location.href = item.href;
287
+ _defineProperty(_assertThisInitialized(_this), "scrollHandler", function () {
288
+ _this.setState({
289
+ scrolling: true
290
+ }, _this.scrollEndHandler);
291
+ });
292
+ _defineProperty(_assertThisInitialized(_this), "enterHandler", function (event, shortcut) {
293
+ if (_this.state.activeIndex !== null) {
294
+ var item = _this.props.data[_this.state.activeIndex];
295
+ _this.selectHandler(_this.state.activeIndex)(event);
296
+ if (item.href && !event.defaultPrevented) {
297
+ if (shortcut != null && ['command+enter', 'ctrl+enter'].includes(shortcut)) {
298
+ window.open(item.href, '_blank');
299
+ } else if (shortcut === 'shift+enter') {
300
+ window.open(item.href);
301
+ } else {
302
+ window.location.href = item.href;
303
+ }
385
304
  }
305
+ return false; // do not propagate event
306
+ } else {
307
+ return true; // propagate event to the parent component (e.g., QueryAssist)
386
308
  }
387
- return false; // do not propagate event
388
- } else {
389
- return true; // propagate event to the parent component (e.g., QueryAssist)
390
- }
391
- };
392
-
393
- getFirst() {
394
- return this.props.data.find(item => item.rgItemType === Type.ITEM || item.rgItemType === Type.CUSTOM);
395
- }
396
- getSelected() {
397
- return this.state.activeIndex != null ? this.props.data[this.state.activeIndex] : null;
398
- }
399
- clearSelected = () => {
400
- this.setState({
401
- activeIndex: null,
402
- needScrollToActive: false
403
309
  });
404
- };
405
- defaultItemHeight() {
406
- return this.props.compact ? Dimension.COMPACT_ITEM_HEIGHT : Dimension.ITEM_HEIGHT;
407
- }
408
- scrollEndHandler = () => this.scheduleScrollListener(() => {
409
- const innerContainer = this.inner;
410
- if (innerContainer) {
411
- const maxScrollingPosition = innerContainer.scrollHeight;
412
- const sensitivity = this.defaultItemHeight() / 2;
413
- const currentScrollingPosition = innerContainer.scrollTop + innerContainer.clientHeight + sensitivity;
414
- const scrolledToBottom = maxScrollingPosition > 0 && currentScrollingPosition >= maxScrollingPosition;
415
- if (!this.unmounted) {
416
- this.setState({
417
- scrolledToBottom
310
+ _defineProperty(_assertThisInitialized(_this), "clearSelected", function () {
311
+ _this.setState({
312
+ activeIndex: null,
313
+ needScrollToActive: false
314
+ });
315
+ });
316
+ _defineProperty(_assertThisInitialized(_this), "scrollEndHandler", function () {
317
+ return _this.scheduleScrollListener(function () {
318
+ var innerContainer = _this.inner;
319
+ if (innerContainer) {
320
+ var maxScrollingPosition = innerContainer.scrollHeight;
321
+ var sensitivity = _this.defaultItemHeight() / 2;
322
+ var currentScrollingPosition = innerContainer.scrollTop + innerContainer.clientHeight + sensitivity;
323
+ var scrolledToBottom = maxScrollingPosition > 0 && currentScrollingPosition >= maxScrollingPosition;
324
+ if (!_this.unmounted) {
325
+ _this.setState({
326
+ scrolledToBottom: scrolledToBottom
327
+ });
328
+ }
329
+ if (scrolledToBottom) {
330
+ _this.props.onScrollToBottom();
331
+ }
332
+ }
333
+ });
334
+ });
335
+ _defineProperty(_assertThisInitialized(_this), "checkOverflow", function () {
336
+ if (_this.inner) {
337
+ _this.setState({
338
+ hasOverflow: _this.inner.scrollHeight - _this.inner.clientHeight > 1
418
339
  });
419
340
  }
420
- if (scrolledToBottom) {
421
- this.props.onScrollToBottom();
341
+ });
342
+ _defineProperty(_assertThisInitialized(_this), "renderItem", function (_ref) {
343
+ var _ref$index = _ref.index,
344
+ index = _ref$index === void 0 ? 1 : _ref$index,
345
+ style = _ref.style,
346
+ _ref$isScrolling = _ref.isScrolling,
347
+ isScrolling = _ref$isScrolling === void 0 ? false : _ref$isScrolling,
348
+ parent = _ref.parent,
349
+ key = _ref.key;
350
+ var itemKey;
351
+ var el;
352
+ var realIndex = index - 1;
353
+ var item = _this.props.data[realIndex];
354
+ var itemId = _this.getId(item);
355
+ // top and bottom margins
356
+ if (index === 0 || index === _this.props.data.length + 1 || item.rgItemType === Type.MARGIN) {
357
+ itemKey = key || "".concat(Type.MARGIN, "_").concat(index);
358
+ el = /*#__PURE__*/React.createElement("div", {
359
+ style: {
360
+ height: Dimension.MARGIN
361
+ }
362
+ });
363
+ } else {
364
+ // Hack around SelectNG implementation
365
+ item.selectedLabel;
366
+ item.originalModel;
367
+ var restProps = _objectWithoutProperties(item, _excluded);
368
+ var cleanedProps = restProps;
369
+ if (cleanedProps.url) {
370
+ cleanedProps.href = cleanedProps.url;
371
+ }
372
+ if (cleanedProps.href) {
373
+ cleanedProps.rgItemType = Type.LINK;
374
+ }
375
+ var itemProps = Object.assign({
376
+ rgItemType: DEFAULT_ITEM_TYPE
377
+ }, restProps);
378
+ itemKey = key || itemId;
379
+ itemProps.hover = realIndex === _this.state.activeIndex;
380
+ if (itemProps.hoverClassName != null && itemProps.hover) {
381
+ itemProps.className = classNames(itemProps.className, itemProps.hoverClassName);
382
+ }
383
+ itemProps.onMouseOver = _this.hoverHandler(realIndex);
384
+ itemProps.tabIndex = -1;
385
+ itemProps.scrolling = isScrolling;
386
+ var selectHandler = _this.selectHandler(realIndex);
387
+ if (_this.props.useMouseUp) {
388
+ itemProps.onMouseUp = selectHandler;
389
+ } else {
390
+ itemProps.onClick = selectHandler;
391
+ }
392
+ itemProps.onCheckboxChange = _this.checkboxHandler(realIndex);
393
+ if (itemProps.compact == null) {
394
+ itemProps.compact = _this.props.compact;
395
+ }
396
+ var ItemComponent;
397
+ var isFirst = index === 1;
398
+ switch (itemProps.rgItemType) {
399
+ case Type.SEPARATOR:
400
+ ItemComponent = ListSeparator;
401
+ itemProps.isFirst = isFirst;
402
+ break;
403
+ case Type.LINK:
404
+ ItemComponent = ListLink;
405
+ _this.addItemDataTestToProp(itemProps);
406
+ break;
407
+ case Type.ITEM:
408
+ ItemComponent = ListItem;
409
+ _this.addItemDataTestToProp(itemProps);
410
+ break;
411
+ case Type.CUSTOM:
412
+ ItemComponent = ListCustom;
413
+ _this.addItemDataTestToProp(itemProps);
414
+ break;
415
+ case Type.TITLE:
416
+ itemProps.isFirst = isFirst;
417
+ ItemComponent = ListTitle;
418
+ break;
419
+ default:
420
+ throw new Error("Unknown menu element type: ".concat(itemProps.rgItemType));
421
+ }
422
+ el = /*#__PURE__*/React.createElement(ItemComponent, itemProps);
422
423
  }
423
- }
424
- });
425
- checkOverflow = () => {
426
- if (this.inner) {
427
- this.setState({
428
- hasOverflow: this.inner.scrollHeight - this.inner.clientHeight > 1
429
- });
430
- }
431
- };
432
- getVisibleListHeight(maxHeight) {
433
- return maxHeight - this.defaultItemHeight() - Dimension.INNER_PADDING;
424
+ return parent ? /*#__PURE__*/React.createElement(CellMeasurer, {
425
+ cache: _this._cache,
426
+ key: itemKey,
427
+ parent: parent,
428
+ rowIndex: index,
429
+ columnIndex: 0
430
+ }, function (_ref2) {
431
+ var registerChild = _ref2.registerChild;
432
+ return /*#__PURE__*/React.createElement("div", {
433
+ ref: registerChild,
434
+ style: style,
435
+ role: "row",
436
+ id: itemId
437
+ }, /*#__PURE__*/React.createElement("div", {
438
+ role: "cell"
439
+ }, el));
440
+ }) : /*#__PURE__*/React.createElement("div", {
441
+ role: "row",
442
+ id: itemId,
443
+ key: itemKey
444
+ }, /*#__PURE__*/React.createElement("div", {
445
+ role: "cell"
446
+ }, /*#__PURE__*/cloneElement(el)));
447
+ });
448
+ _defineProperty(_assertThisInitialized(_this), "addItemDataTestToProp", function (props) {
449
+ props['data-test'] = joinDataTestAttributes('ring-list-item', props['data-test']);
450
+ return props;
451
+ });
452
+ _defineProperty(_assertThisInitialized(_this), "virtualizedListRef", function (el) {
453
+ _this.virtualizedList = el;
454
+ });
455
+ _defineProperty(_assertThisInitialized(_this), "containerRef", function (el) {
456
+ _this.container = el;
457
+ });
458
+ _defineProperty(_assertThisInitialized(_this), "_inner", void 0);
459
+ _defineProperty(_assertThisInitialized(_this), "id", getUID('list-'));
460
+ _defineProperty(_assertThisInitialized(_this), "shortcutsScope", _this.id);
461
+ _defineProperty(_assertThisInitialized(_this), "shortcutsMap", {
462
+ up: _this.upHandler,
463
+ down: _this.downHandler,
464
+ home: _this.homeHandler,
465
+ end: _this.endHandler,
466
+ enter: _this.enterHandler,
467
+ 'meta+enter': _this.enterHandler,
468
+ 'ctrl+enter': _this.enterHandler,
469
+ 'command+enter': _this.enterHandler,
470
+ 'shift+enter': _this.enterHandler
471
+ });
472
+ return _this;
434
473
  }
435
- _deprecatedGenerateKeyFromContent(itemProps) {
436
- const identificator = itemProps.label || itemProps.description;
437
- const isString = typeof identificator === 'string' || identificator instanceof String;
438
- if (identificator && !isString) {
439
- warnEmptyKey();
440
- `${itemProps.rgItemType}_${JSON.stringify(identificator)}`;
474
+ _createClass(List, [{
475
+ key: "componentDidMount",
476
+ value: function componentDidMount() {
477
+ document.addEventListener('mousemove', this.onDocumentMouseMove);
478
+ document.addEventListener('keydown', this.onDocumentKeyDown, true);
479
+ if (this.props.activeIndex == null && shouldActivateFirstItem(this.props)) {
480
+ this.activateFirst();
481
+ }
441
482
  }
442
- return `${itemProps.rgItemType}_${identificator}`;
443
- }
444
- getId(item) {
445
- return item != null ? `${this.id}:${item.key || this._deprecatedGenerateKeyFromContent(item)}` : undefined;
446
- }
447
- renderItem = _ref => {
448
- let {
449
- index = 1,
450
- style,
451
- isScrolling = false,
452
- parent,
453
- key
454
- } = _ref;
455
- let itemKey;
456
- let el;
457
- const realIndex = index - 1;
458
- const item = this.props.data[realIndex];
459
- const itemId = this.getId(item);
460
- // top and bottom margins
461
- if (index === 0 || index === this.props.data.length + 1 || item.rgItemType === Type.MARGIN) {
462
- itemKey = key || `${Type.MARGIN}_${index}`;
463
- el = /*#__PURE__*/React.createElement("div", {
464
- style: {
465
- height: Dimension.MARGIN
466
- }
483
+ }, {
484
+ key: "shouldComponentUpdate",
485
+ value: function shouldComponentUpdate(nextProps, nextState) {
486
+ var _this2 = this;
487
+ return nextProps !== this.props || Object.keys(nextState).some(function (key) {
488
+ return nextState[key] !== _this2.state[key];
467
489
  });
468
- } else {
469
- // Hack around SelectNG implementation
470
- const {
471
- selectedLabel,
472
- originalModel,
473
- ...restProps
474
- } = item;
475
- const cleanedProps = restProps;
476
- if (cleanedProps.url) {
477
- cleanedProps.href = cleanedProps.url;
478
- }
479
- if (cleanedProps.href) {
480
- cleanedProps.rgItemType = Type.LINK;
490
+ }
491
+ }, {
492
+ key: "componentDidUpdate",
493
+ value: function componentDidUpdate(prevProps) {
494
+ if (this.virtualizedList && prevProps.data !== this.props.data) {
495
+ this.virtualizedList.recomputeRowHeights();
481
496
  }
482
- const itemProps = Object.assign({
483
- rgItemType: DEFAULT_ITEM_TYPE
484
- }, restProps);
485
- itemKey = key || itemId;
486
- itemProps.hover = realIndex === this.state.activeIndex;
487
- if (itemProps.hoverClassName != null && itemProps.hover) {
488
- itemProps.className = classNames(itemProps.className, itemProps.hoverClassName);
497
+ if (this.props.activeIndex == null && getDataHash(this.props.data) !== getDataHash(prevProps.data) && shouldActivateFirstItem(this.props)) {
498
+ this.activateFirst();
489
499
  }
490
- itemProps.onMouseOver = this.hoverHandler(realIndex);
491
- itemProps.tabIndex = -1;
492
- itemProps.scrolling = isScrolling;
493
- const selectHandler = this.selectHandler(realIndex);
494
- if (this.props.useMouseUp) {
495
- itemProps.onMouseUp = selectHandler;
500
+ this.checkOverflow();
501
+ }
502
+ }, {
503
+ key: "componentWillUnmount",
504
+ value: function componentWillUnmount() {
505
+ this.unmounted = true;
506
+ document.removeEventListener('mousemove', this.onDocumentMouseMove);
507
+ document.removeEventListener('keydown', this.onDocumentKeyDown, true);
508
+ }
509
+ }, {
510
+ key: "hasActivatableItems",
511
+ value: function hasActivatableItems() {
512
+ return this._hasActivatableItems(this.props.data);
513
+ }
514
+ }, {
515
+ key: "moveHandler",
516
+ value: function moveHandler(index, retryCallback, e) {
517
+ var correctedIndex;
518
+ if (this.props.data.length === 0 || !this.hasActivatableItems()) {
519
+ return;
520
+ } else if (this.props.data.length < index) {
521
+ correctedIndex = 0;
496
522
  } else {
497
- itemProps.onClick = selectHandler;
523
+ correctedIndex = index;
498
524
  }
499
- itemProps.onCheckboxChange = this.checkboxHandler(realIndex);
500
- if (itemProps.compact == null) {
501
- itemProps.compact = this.props.compact;
525
+ var item = this.props.data[correctedIndex];
526
+ this.setState({
527
+ activeIndex: correctedIndex,
528
+ activeItem: item,
529
+ needScrollToActive: true
530
+ }, function onSet() {
531
+ if (!isActivatable(item)) {
532
+ retryCallback(e);
533
+ return;
534
+ }
535
+ if (e.key !== 'Home' && e.key !== 'End') {
536
+ preventDefault(e);
537
+ }
538
+ });
539
+ }
540
+ }, {
541
+ key: "getFirst",
542
+ value: function getFirst() {
543
+ return this.props.data.find(function (item) {
544
+ return item.rgItemType === Type.ITEM || item.rgItemType === Type.CUSTOM;
545
+ });
546
+ }
547
+ }, {
548
+ key: "getSelected",
549
+ value: function getSelected() {
550
+ return this.state.activeIndex != null ? this.props.data[this.state.activeIndex] : null;
551
+ }
552
+ }, {
553
+ key: "defaultItemHeight",
554
+ value: function defaultItemHeight() {
555
+ return this.props.compact ? Dimension.COMPACT_ITEM_HEIGHT : Dimension.ITEM_HEIGHT;
556
+ }
557
+ }, {
558
+ key: "getVisibleListHeight",
559
+ value: function getVisibleListHeight(maxHeight) {
560
+ return maxHeight - this.defaultItemHeight() - Dimension.INNER_PADDING;
561
+ }
562
+ }, {
563
+ key: "_deprecatedGenerateKeyFromContent",
564
+ value: function _deprecatedGenerateKeyFromContent(itemProps) {
565
+ var identificator = itemProps.label || itemProps.description;
566
+ var isString = typeof identificator === 'string' || identificator instanceof String;
567
+ if (identificator && !isString) {
568
+ warnEmptyKey();
569
+ "".concat(itemProps.rgItemType, "_").concat(JSON.stringify(identificator));
502
570
  }
503
- let ItemComponent;
504
- const isFirst = index === 1;
505
- switch (itemProps.rgItemType) {
506
- case Type.SEPARATOR:
507
- ItemComponent = ListSeparator;
508
- itemProps.isFirst = isFirst;
509
- break;
510
- case Type.LINK:
511
- ItemComponent = ListLink;
512
- this.addItemDataTestToProp(itemProps);
513
- break;
514
- case Type.ITEM:
515
- ItemComponent = ListItem;
516
- this.addItemDataTestToProp(itemProps);
517
- break;
518
- case Type.CUSTOM:
519
- ItemComponent = ListCustom;
520
- this.addItemDataTestToProp(itemProps);
521
- break;
522
- case Type.TITLE:
523
- itemProps.isFirst = isFirst;
524
- ItemComponent = ListTitle;
525
- break;
526
- default:
527
- throw new Error(`Unknown menu element type: ${itemProps.rgItemType}`);
571
+ return "".concat(itemProps.rgItemType, "_").concat(identificator);
572
+ }
573
+ }, {
574
+ key: "getId",
575
+ value: function getId(item) {
576
+ return item != null ? "".concat(this.id, ":").concat(item.key || this._deprecatedGenerateKeyFromContent(item)) : undefined;
577
+ }
578
+ }, {
579
+ key: "inner",
580
+ get: function get() {
581
+ if (!this._inner) {
582
+ this._inner = this.container && this.container.querySelector('.ring-list__i');
528
583
  }
529
- el = /*#__PURE__*/React.createElement(ItemComponent, itemProps);
584
+ return this._inner;
530
585
  }
531
- return parent ? /*#__PURE__*/React.createElement(CellMeasurer, {
532
- cache: this._cache,
533
- key: itemKey,
534
- parent: parent,
535
- rowIndex: index,
536
- columnIndex: 0
537
- }, _ref2 => {
538
- let {
539
- registerChild
540
- } = _ref2;
541
- return /*#__PURE__*/React.createElement("div", {
542
- ref: registerChild,
543
- style: style,
544
- role: "row",
545
- id: itemId
546
- }, /*#__PURE__*/React.createElement("div", {
547
- role: "cell"
548
- }, el));
549
- }) : /*#__PURE__*/React.createElement("div", {
550
- role: "row",
551
- id: itemId,
552
- key: itemKey
553
- }, /*#__PURE__*/React.createElement("div", {
554
- role: "cell"
555
- }, /*#__PURE__*/cloneElement(el)));
556
- };
557
- addItemDataTestToProp = props => {
558
- props['data-test'] = joinDataTestAttributes('ring-list-item', props['data-test']);
559
- return props;
560
- };
561
- virtualizedListRef = el => {
562
- this.virtualizedList = el;
563
- };
564
- containerRef = el => {
565
- this.container = el;
566
- };
567
- _inner;
568
- get inner() {
569
- if (!this._inner) {
570
- this._inner = this.container && this.container.querySelector('.ring-list__i');
586
+ }, {
587
+ key: "renderVirtualizedInner",
588
+ value: function renderVirtualizedInner(_ref3) {
589
+ var _this3 = this;
590
+ var height = _ref3.height,
591
+ maxHeight = _ref3.maxHeight,
592
+ _ref3$autoHeight = _ref3.autoHeight,
593
+ autoHeight = _ref3$autoHeight === void 0 ? false : _ref3$autoHeight,
594
+ rowCount = _ref3.rowCount,
595
+ isScrolling = _ref3.isScrolling,
596
+ _ref3$onChildScroll = _ref3.onChildScroll,
597
+ onChildScroll = _ref3$onChildScroll === void 0 ? noop : _ref3$onChildScroll,
598
+ scrollTop = _ref3.scrollTop,
599
+ registerChild = _ref3.registerChild;
600
+ var dirOverride = {
601
+ direction: 'inherit'
602
+ }; // Virtualized sets "direction: ltr" by default https://github.com/bvaughn/react-virtualized/issues/457
603
+ return /*#__PURE__*/React.createElement(AutoSizer, {
604
+ disableHeight: true,
605
+ onResize: this.props.onResize
606
+ }, function (_ref4) {
607
+ var width = _ref4.width;
608
+ return /*#__PURE__*/React.createElement("div", {
609
+ ref: registerChild
610
+ }, /*#__PURE__*/React.createElement(VirtualizedList, {
611
+ "aria-label": _this3.props.ariaLabel,
612
+ ref: _this3.virtualizedListRef,
613
+ className: "ring-list__i",
614
+ autoHeight: autoHeight,
615
+ style: maxHeight ? _objectSpread2({
616
+ maxHeight: maxHeight,
617
+ height: 'auto'
618
+ }, dirOverride) : dirOverride,
619
+ autoContainerWidth: true,
620
+ height: height,
621
+ width: width,
622
+ isScrolling: isScrolling,
623
+ onScroll: function onScroll(e) {
624
+ onChildScroll(e);
625
+ _this3.scrollEndHandler();
626
+ },
627
+ scrollTop: scrollTop,
628
+ rowCount: rowCount,
629
+ estimatedRowSize: _this3.defaultItemHeight(),
630
+ rowHeight: _this3._cache.rowHeight,
631
+ rowRenderer: _this3.renderItem,
632
+ overscanRowCount: _this3._bufferSize
633
+ // ensure rerendering
634
+ ,
635
+ noop: function noop() {},
636
+ scrollToIndex: !_this3.props.disableScrollToActive && _this3.state.needScrollToActive && _this3.state.activeIndex != null ? _this3.state.activeIndex + 1 : undefined,
637
+ scrollToAlignment: "center",
638
+ deferredMeasurementCache: _this3._cache,
639
+ onRowsRendered: _this3.checkOverflow
640
+ }));
641
+ });
571
642
  }
572
- return this._inner;
573
- }
574
- renderVirtualizedInner(_ref3) {
575
- let {
576
- height,
577
- maxHeight,
578
- autoHeight = false,
579
- rowCount,
580
- isScrolling,
581
- onChildScroll = noop,
582
- scrollTop,
583
- registerChild
584
- } = _ref3;
585
- const dirOverride = {
586
- direction: 'inherit'
587
- }; // Virtualized sets "direction: ltr" by default https://github.com/bvaughn/react-virtualized/issues/457
588
- return /*#__PURE__*/React.createElement(AutoSizer, {
589
- disableHeight: true,
590
- onResize: this.props.onResize
591
- }, _ref4 => {
592
- let {
593
- width
594
- } = _ref4;
643
+ }, {
644
+ key: "renderVirtualized",
645
+ value: function renderVirtualized(maxHeight, rowCount) {
646
+ var _this4 = this;
647
+ if (maxHeight) {
648
+ return this.renderVirtualizedInner({
649
+ height: maxHeight,
650
+ maxHeight: maxHeight,
651
+ rowCount: rowCount
652
+ });
653
+ }
654
+ return /*#__PURE__*/React.createElement(WindowScroller, null, function (props) {
655
+ return _this4.renderVirtualizedInner(_objectSpread2(_objectSpread2({}, props), {}, {
656
+ rowCount: rowCount,
657
+ autoHeight: true
658
+ }));
659
+ });
660
+ }
661
+ }, {
662
+ key: "renderSimple",
663
+ value: function renderSimple(maxHeight, rowCount) {
664
+ var items = [];
665
+ for (var index = 0; index < rowCount; index++) {
666
+ items.push(this.renderItem({
667
+ index: index,
668
+ isScrolling: this.state.scrolling
669
+ }));
670
+ }
595
671
  return /*#__PURE__*/React.createElement("div", {
596
- ref: registerChild
597
- }, /*#__PURE__*/React.createElement(VirtualizedList, {
672
+ className: classNames('ring-list__i', modules_3b67a421.simpleInner),
673
+ onScroll: this.scrollHandler,
674
+ onMouseMove: this.mouseHandler
675
+ }, /*#__PURE__*/React.createElement("div", {
598
676
  "aria-label": this.props.ariaLabel,
599
- ref: this.virtualizedListRef,
600
- className: "ring-list__i",
601
- autoHeight: autoHeight,
677
+ role: "grid",
602
678
  style: maxHeight ? {
603
- maxHeight,
604
- height: 'auto',
605
- ...dirOverride
606
- } : dirOverride,
607
- autoContainerWidth: true,
608
- height: height,
609
- width: width,
610
- isScrolling: isScrolling,
611
- onScroll: e => {
612
- onChildScroll(e);
613
- this.scrollEndHandler();
614
- },
615
- scrollTop: scrollTop,
616
- rowCount: rowCount,
617
- estimatedRowSize: this.defaultItemHeight(),
618
- rowHeight: this._cache.rowHeight,
619
- rowRenderer: this.renderItem,
620
- overscanRowCount: this._bufferSize
621
- // ensure rerendering
622
- ,
623
- noop: () => {},
624
- scrollToIndex: !this.props.disableScrollToActive && this.state.needScrollToActive && this.state.activeIndex != null ? this.state.activeIndex + 1 : undefined,
625
- scrollToAlignment: "center",
626
- deferredMeasurementCache: this._cache,
627
- onRowsRendered: this.checkOverflow
628
- }));
629
- });
630
- }
631
- renderVirtualized(maxHeight, rowCount) {
632
- if (maxHeight) {
633
- return this.renderVirtualizedInner({
634
- height: maxHeight,
635
- maxHeight,
636
- rowCount
637
- });
679
+ maxHeight: this.getVisibleListHeight(maxHeight)
680
+ } : undefined
681
+ }, items));
638
682
  }
639
- return /*#__PURE__*/React.createElement(WindowScroller, null, props => this.renderVirtualizedInner({
640
- ...props,
641
- rowCount,
642
- autoHeight: true
643
- }));
644
- }
645
- renderSimple(maxHeight, rowCount) {
646
- const items = [];
647
- for (let index = 0; index < rowCount; index++) {
648
- items.push(this.renderItem({
649
- index,
650
- isScrolling: this.state.scrolling
651
- }));
683
+ }, {
684
+ key: "render",
685
+ value: /** @override */
686
+ function render() {
687
+ var hint = this.getSelected() && this.props.hintOnSelection || this.props.hint;
688
+ var fadeStyles = hint ? {
689
+ bottom: Dimension.ITEM_HEIGHT
690
+ } : undefined;
691
+ var rowCount = this.props.data.length + 2;
692
+ var maxHeight = this.props.maxHeight && this.getVisibleListHeight(this.props.maxHeight);
693
+ var classes = classNames(modules_3b67a421.list, this.props.className);
694
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ActiveItemContext.Updater, {
695
+ value: this.getId(this.state.activeItem),
696
+ skipUpdate: this.props.hidden || !isActivatable(this.state.activeItem)
697
+ }), /*#__PURE__*/React.createElement("div", {
698
+ id: this.props.id,
699
+ ref: this.containerRef,
700
+ className: classes,
701
+ onMouseOut: this.props.onMouseOut,
702
+ onBlur: this.props.onMouseOut,
703
+ onMouseLeave: this.clearSelected,
704
+ "data-test": "ring-list"
705
+ }, this.props.shortcuts && /*#__PURE__*/React.createElement(Shortcuts, {
706
+ map: this.shortcutsMap,
707
+ scope: this.shortcutsScope
708
+ }), this.props.renderOptimization ? this.renderVirtualized(maxHeight, rowCount) : this.renderSimple(maxHeight, rowCount), this.state.hasOverflow && !this.state.scrolledToBottom && /*#__PURE__*/React.createElement("div", {
709
+ className: modules_3b67a421.fade,
710
+ style: fadeStyles
711
+ }), hint && /*#__PURE__*/React.createElement(ListHint, {
712
+ label: hint
713
+ })));
652
714
  }
653
- return /*#__PURE__*/React.createElement("div", {
654
- className: classNames('ring-list__i', modules_3b67a421.simpleInner),
655
- onScroll: this.scrollHandler,
656
- onMouseMove: this.mouseHandler
657
- }, /*#__PURE__*/React.createElement("div", {
658
- "aria-label": this.props.ariaLabel,
659
- role: "grid",
660
- style: maxHeight ? {
661
- maxHeight: this.getVisibleListHeight(maxHeight)
662
- } : undefined
663
- }, items));
664
- }
665
- id = getUID('list-');
666
- shortcutsScope = this.id;
667
- shortcutsMap = {
668
- up: this.upHandler,
669
- down: this.downHandler,
670
- home: this.homeHandler,
671
- end: this.endHandler,
672
- enter: this.enterHandler,
673
- 'meta+enter': this.enterHandler,
674
- 'ctrl+enter': this.enterHandler,
675
- 'command+enter': this.enterHandler,
676
- 'shift+enter': this.enterHandler
677
- };
678
- /** @override */
679
- render() {
680
- const hint = this.getSelected() && this.props.hintOnSelection || this.props.hint;
681
- const fadeStyles = hint ? {
682
- bottom: Dimension.ITEM_HEIGHT
683
- } : undefined;
684
- const rowCount = this.props.data.length + 2;
685
- const maxHeight = this.props.maxHeight && this.getVisibleListHeight(this.props.maxHeight);
686
- const classes = classNames(modules_3b67a421.list, this.props.className);
687
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ActiveItemContext.Updater, {
688
- value: this.getId(this.state.activeItem),
689
- skipUpdate: this.props.hidden || !isActivatable(this.state.activeItem)
690
- }), /*#__PURE__*/React.createElement("div", {
691
- id: this.props.id,
692
- ref: this.containerRef,
693
- className: classes,
694
- onMouseOut: this.props.onMouseOut,
695
- onBlur: this.props.onMouseOut,
696
- onMouseLeave: this.clearSelected,
697
- "data-test": "ring-list"
698
- }, this.props.shortcuts && /*#__PURE__*/React.createElement(Shortcuts, {
699
- map: this.shortcutsMap,
700
- scope: this.shortcutsScope
701
- }), this.props.renderOptimization ? this.renderVirtualized(maxHeight, rowCount) : this.renderSimple(maxHeight, rowCount), this.state.hasOverflow && !this.state.scrolledToBottom && /*#__PURE__*/React.createElement("div", {
702
- className: modules_3b67a421.fade,
703
- style: fadeStyles
704
- }), hint && /*#__PURE__*/React.createElement(ListHint, {
705
- label: hint
706
- })));
707
- }
708
- }
715
+ }], [{
716
+ key: "getDerivedStateFromProps",
717
+ value: function getDerivedStateFromProps(nextProps, prevState) {
718
+ var prevActiveIndex = prevState.prevActiveIndex,
719
+ prevData = prevState.prevData,
720
+ activeItem = prevState.activeItem;
721
+ var data = nextProps.data,
722
+ activeIndex = nextProps.activeIndex,
723
+ restoreActiveIndex = nextProps.restoreActiveIndex;
724
+ var nextState = {
725
+ prevActiveIndex: activeIndex,
726
+ prevData: data
727
+ };
728
+ if (data !== prevData) {
729
+ Object.assign(nextState, {
730
+ activeIndex: null,
731
+ activeItem: null
732
+ });
733
+ }
734
+ if (activeIndex != null && activeIndex !== prevActiveIndex && data[activeIndex] != null) {
735
+ Object.assign(nextState, {
736
+ activeIndex: activeIndex,
737
+ activeItem: data[activeIndex],
738
+ needScrollToActive: true
739
+ });
740
+ } else if (data !== prevData && restoreActiveIndex && activeItem != null && activeItem.key != null) {
741
+ // Restore active index if there is an item with the same "key" property
742
+ var index = data.findIndex(function (item) {
743
+ return item.key === activeItem.key;
744
+ });
745
+ if (index >= 0) {
746
+ Object.assign(nextState, {
747
+ activeIndex: index,
748
+ activeItem: data[index]
749
+ });
750
+ }
751
+ }
752
+ return nextState;
753
+ }
754
+ }]);
755
+ return List;
756
+ }(Component);
757
+ _defineProperty(List, "propTypes", {
758
+ id: PropTypes.string,
759
+ className: PropTypes.string,
760
+ hint: PropTypes.node,
761
+ hintOnSelection: PropTypes.string,
762
+ data: PropTypes.array,
763
+ maxHeight: PropTypes.number,
764
+ activeIndex: PropTypes.number,
765
+ restoreActiveIndex: PropTypes.bool,
766
+ activateSingleItem: PropTypes.bool,
767
+ activateFirstItem: PropTypes.bool,
768
+ shortcuts: PropTypes.bool,
769
+ onMouseOut: PropTypes.func,
770
+ onSelect: PropTypes.func,
771
+ onScrollToBottom: PropTypes.func,
772
+ onResize: PropTypes.func,
773
+ useMouseUp: PropTypes.bool,
774
+ visible: PropTypes.bool,
775
+ renderOptimization: PropTypes.bool,
776
+ disableMoveOverflow: PropTypes.bool,
777
+ disableMoveDownOverflow: PropTypes.bool,
778
+ compact: PropTypes.bool,
779
+ disableScrollToActive: PropTypes.bool,
780
+ hidden: PropTypes.bool,
781
+ ariaLabel: PropTypes.string
782
+ });
783
+ _defineProperty(List, "defaultProps", {
784
+ data: [],
785
+ restoreActiveIndex: false,
786
+ activateSingleItem: false,
787
+ activateFirstItem: false,
788
+ onMouseOut: noop,
789
+ onSelect: noop,
790
+ onScrollToBottom: noop,
791
+ onResize: noop,
792
+ shortcuts: false,
793
+ renderOptimization: true,
794
+ disableMoveDownOverflow: false,
795
+ ariaLabel: 'List'
796
+ });
797
+ _defineProperty(List, "isItemType", isItemType);
798
+ _defineProperty(List, "ListHint", ListHint);
799
+ _defineProperty(List, "ListProps", {
800
+ Type: Type,
801
+ Dimension: Dimension
802
+ });
709
803
 
710
804
  export { ActiveItemContext, List as default };