@jetbrains/ring-ui 7.0.78 → 7.0.79

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.
@@ -84,10 +84,18 @@ export default class List extends Component {
84
84
  const { data, activeIndex, restoreActiveIndex } = nextProps;
85
85
  const nextState = { prevActiveIndex: activeIndex, prevData: data };
86
86
  if (data !== prevData) {
87
- Object.assign(nextState, {
88
- activeIndex: null,
89
- activeItem: null,
90
- });
87
+ // Only clear activeIndex if it's out of bounds OR the item at that position changed
88
+ const currentActiveIndex = prevState.activeIndex;
89
+ const currentActiveItem = prevState.activeItem;
90
+ if (currentActiveIndex !== null &&
91
+ (currentActiveIndex >= data.length ||
92
+ !data[currentActiveIndex] ||
93
+ (currentActiveItem && data[currentActiveIndex].key !== currentActiveItem.key))) {
94
+ Object.assign(nextState, {
95
+ activeIndex: null,
96
+ activeItem: null,
97
+ });
98
+ }
91
99
  }
92
100
  if (activeIndex !== null && activeIndex !== undefined && activeIndex !== prevActiveIndex && data[activeIndex]) {
93
101
  Object.assign(nextState, {
@@ -1,2 +1,5 @@
1
+ /**
2
+ * @deprecated Will be removed in Ring UI 8.0.
3
+ */
1
4
  declare function stopOldBrowserDetector(): void;
2
5
  export { stopOldBrowserDetector as stop };
@@ -53,6 +53,9 @@ function startOldBrowsersDetector(onOldBrowserDetected) {
53
53
  return false;
54
54
  };
55
55
  }
56
+ /**
57
+ * @deprecated Will be removed in Ring UI 8.0.
58
+ */
56
59
  function stopOldBrowserDetector() {
57
60
  window.onerror = previousWindowErrorHandler;
58
61
  }
@@ -382,7 +382,7 @@ export default class Select extends Component {
382
382
  if (index >= 0)
383
383
  return index;
384
384
  }
385
- return items.findIndex(item => !isNonOptionItem(item));
385
+ return null;
386
386
  }
387
387
  popupRef = (el) => {
388
388
  this._popup = el;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetbrains/ring-ui",
3
- "version": "7.0.78",
3
+ "version": "7.0.79",
4
4
  "description": "JetBrains UI library",
5
5
  "author": {
6
6
  "name": "JetBrains"