@jetbrains/ring-ui-built 7.0.0-beta.2 → 7.0.0-beta.3

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