@jetbrains/ring-ui 7.0.77 → 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;
@@ -34,6 +34,7 @@ export interface TagProps {
34
34
  outline?: boolean;
35
35
  tagType?: TagType;
36
36
  interactive?: boolean;
37
+ 'data-test'?: string | null;
37
38
  }
38
39
  /**
39
40
  * @name Tag
@@ -5,6 +5,7 @@ import closeIcon from '@jetbrains/icons/close-12px';
5
5
  import Icon from '../icon/icon';
6
6
  import Button from '../button/button';
7
7
  import { ControlsHeight } from '../global/controls-height';
8
+ import dataTests from '../global/data-tests';
8
9
  import styles from './tag.css';
9
10
  export var TagType;
10
11
  (function (TagType) {
@@ -99,13 +100,13 @@ export default class Tag extends PureComponent {
99
100
  [styles.disabled]: this.props.disabled,
100
101
  [styles.withRemove]: !this.props.readOnly && this.props.onRemove,
101
102
  }, this.props.className);
102
- const { backgroundColor, textColor, render } = this.props;
103
+ const { backgroundColor, textColor, render, 'data-test': dataTest } = this.props;
103
104
  return (<span className={classNames(styles.container, this.props.containerClassName, styles[this.props.tagType], {
104
105
  [styles.outline]: this.props.outline,
105
106
  [styles.interactive]: this.props.interactive,
106
107
  })}>
107
108
  {render({
108
- 'data-test': 'ring-tag',
109
+ 'data-test': dataTests('ring-tag', dataTest),
109
110
  className: classes,
110
111
  ref: this.tagRef,
111
112
  onClick: this.props.onClick,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetbrains/ring-ui",
3
- "version": "7.0.77",
3
+ "version": "7.0.79",
4
4
  "description": "JetBrains UI library",
5
5
  "author": {
6
6
  "name": "JetBrains"
@@ -145,7 +145,7 @@
145
145
  "eslint-plugin-storybook": "^10.0.6",
146
146
  "eslint-plugin-unicorn": "^62.0.0",
147
147
  "events": "^3.3.0",
148
- "glob": "^11.0.3",
148
+ "glob": "^11.1.0",
149
149
  "globals": "^16.5.0",
150
150
  "html-webpack-plugin": "^5.6.4",
151
151
  "http-server": "^14.1.1",