@jetbrains/ring-ui 7.0.96 → 7.0.97

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.
@@ -373,7 +373,7 @@ class Auth {
373
373
  await this._backendCheckPromise;
374
374
  }
375
375
  catch (e) {
376
- throw new Error('Cannot refresh token: backend is not available. Postponed by user.');
376
+ throw new Error('Cannot refresh token: backend is not available. Postponed by user.', { cause: e });
377
377
  }
378
378
  finally {
379
379
  this._backendCheckPromise = null;
@@ -734,7 +734,7 @@ class Auth {
734
734
  throw new Error('No state in AuthResponse');
735
735
  }
736
736
  const { scope: defaultScope } = this.config;
737
- let urlFromState = null;
737
+ let urlFromState;
738
738
  try {
739
739
  urlFromState = new URL(state); // checking if state contains valid URL on same origin, see HUB-11514
740
740
  }
@@ -65,7 +65,7 @@ export default class Avatar extends PureComponent {
65
65
  };
66
66
  src = encodeURL(urlStart, queryParams);
67
67
  }
68
- let subavatarSrc = null;
68
+ let subavatarSrc;
69
69
  if (subavatar && !isDataURI(subavatar)) {
70
70
  const [urlStart, query] = subavatar.split('?');
71
71
  const queryParams = {
@@ -36,7 +36,7 @@ export default class ListItem extends PureComponent {
36
36
  const style = {
37
37
  paddingLeft: `${(Number(level) || 0) * RING_UNIT + DEFAULT_PADDING + (showCheckbox ? CHECKBOX_WIDTH : 0)}px`,
38
38
  };
39
- let computedTitle = null;
39
+ let computedTitle;
40
40
  if (this._isString(title)) {
41
41
  // if title is specified and is a string then use it
42
42
  computedTitle = title;
@@ -68,7 +68,6 @@ export interface ListState<T = unknown> {
68
68
  prevActiveIndex: number | null;
69
69
  prevData: ListDataItem<T>[];
70
70
  activeItem: ListDataItem<T> | null;
71
- needScrollToActive: boolean;
72
71
  scrolling: boolean;
73
72
  hasOverflow: boolean;
74
73
  scrolledToBottom: boolean;
@@ -74,7 +74,6 @@ export default class List extends Component {
74
74
  prevActiveIndex: null,
75
75
  prevData: [],
76
76
  activeItem: null,
77
- needScrollToActive: false,
78
77
  scrolling: false,
79
78
  hasOverflow: false,
80
79
  scrolledToBottom: false,
@@ -101,7 +100,6 @@ export default class List extends Component {
101
100
  Object.assign(nextState, {
102
101
  activeIndex,
103
102
  activeItem: data[activeIndex],
104
- needScrollToActive: true,
105
103
  });
106
104
  }
107
105
  else if (data !== prevData && restoreActiveIndex && activeItem && activeItem.key) {
@@ -131,22 +129,20 @@ export default class List extends Component {
131
129
  this.virtualizedList.recomputeRowHeights();
132
130
  }
133
131
  const { activeIndex } = this.state;
134
- if (!this.virtualizedList &&
135
- !this.props.disableScrollToActive &&
136
- this.state.needScrollToActive &&
137
- activeIndex != null &&
138
- activeIndex !== prevState.activeIndex) {
139
- const itemId = this.getId(this.props.data[activeIndex]);
140
- if (itemId) {
141
- document.getElementById(itemId)?.scrollIntoView?.({
142
- block: 'center',
143
- });
132
+ if (!this.props.disableScrollToActive && activeIndex != null && activeIndex !== prevState.activeIndex) {
133
+ if (this.virtualizedList) {
134
+ this.virtualizedList.scrollToRow(activeIndex + 1);
135
+ }
136
+ else {
137
+ const itemId = this.getId(this.props.data[activeIndex]);
138
+ if (itemId) {
139
+ document.getElementById(itemId)?.scrollIntoView?.({
140
+ block: 'center',
141
+ });
142
+ }
144
143
  }
145
- this.setState({ needScrollToActive: false });
146
144
  }
147
- const isActiveItemRetainedPosition = activeIndex
148
- ? prevProps.data[activeIndex]?.key === this.props.data[activeIndex]?.key
149
- : false;
145
+ const isActiveItemRetainedPosition = activeIndex != null ? prevProps.data[activeIndex]?.key === this.props.data[activeIndex]?.key : false;
150
146
  if ((this.props.activeIndex === null || this.props.activeIndex === undefined) &&
151
147
  getDataHash(this.props.data) !== getDataHash(prevProps.data) &&
152
148
  shouldActivateFirstItem(this.props) &&
@@ -209,7 +205,6 @@ export default class List extends Component {
209
205
  this.setState({
210
206
  activeIndex: firstActivatableIndex,
211
207
  activeItem: this.props.data[firstActivatableIndex],
212
- needScrollToActive: true,
213
208
  });
214
209
  }
215
210
  };
@@ -284,7 +279,6 @@ export default class List extends Component {
284
279
  this.setState({
285
280
  activeIndex: correctedIndex,
286
281
  activeItem: item,
287
- needScrollToActive: true,
288
282
  }, function onSet() {
289
283
  if (!isActivatable(item)) {
290
284
  retryCallback(e);
@@ -476,12 +470,7 @@ export default class List extends Component {
476
470
  this.scrollEndHandler();
477
471
  }} scrollTop={scrollTop} rowCount={rowCount} estimatedRowSize={this.defaultItemHeight()} rowHeight={this._cache.rowHeight} rowRenderer={this.renderItem} overscanRowCount={this._bufferSize}
478
472
  // ensure rerendering
479
- noop={() => { }} scrollToIndex={!this.props.disableScrollToActive &&
480
- this.state.needScrollToActive &&
481
- this.state.activeIndex !== null &&
482
- this.state.activeIndex !== undefined
483
- ? this.state.activeIndex + 1
484
- : undefined} scrollToAlignment='center' deferredMeasurementCache={this._cache} onRowsRendered={this.checkOverflow} containerRole='none' // row role is set by rowRenderer
473
+ noop={() => { }} scrollToAlignment='center' deferredMeasurementCache={this._cache} onRowsRendered={this.checkOverflow} containerRole='none' // row role is set by rowRenderer
485
474
  />
486
475
  </div>)}
487
476
  </AutoSizer>);
@@ -42,7 +42,7 @@ export const CollapsibleTabs = ({ children, selected, onSelect, onLastVisibleInd
42
42
  const adjustTabs = useCallback((entry) => {
43
43
  const containerWidth = entry.contentRect.width;
44
44
  const { tabs: tabsSizes, more = 0 } = elements.sizes;
45
- let renderMore = children.some(tab => tab.props.alwaysHidden);
45
+ const renderMore = children.some(tab => tab.props.alwaysHidden);
46
46
  const tabsToRender = [];
47
47
  let filledWidth = renderMore ? (more ?? 0) : 0;
48
48
  for (let i = 0; i < tabsSizes.length; i++) {
@@ -58,7 +58,6 @@ export const CollapsibleTabs = ({ children, selected, onSelect, onLastVisibleInd
58
58
  for (let i = tabsToRender.length - 1; i >= 0; i--) {
59
59
  if (filledWidth + more < containerWidth + MEASURE_TOLERANCE) {
60
60
  filledWidth += more;
61
- renderMore = true;
62
61
  break;
63
62
  }
64
63
  else {
@@ -71,7 +70,6 @@ export const CollapsibleTabs = ({ children, selected, onSelect, onLastVisibleInd
71
70
  const selectedWidth = tabsSizes[selectedIndex];
72
71
  for (let i = tabsToRender.length - 1; i >= 0; i--) {
73
72
  if (filledWidth + selectedWidth < containerWidth + MEASURE_TOLERANCE) {
74
- filledWidth += selectedWidth;
75
73
  break;
76
74
  }
77
75
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetbrains/ring-ui",
3
- "version": "7.0.96",
3
+ "version": "7.0.97",
4
4
  "description": "JetBrains UI library",
5
5
  "author": {
6
6
  "name": "JetBrains"
@@ -56,6 +56,8 @@
56
56
  "figma-connect-unpublish": "npx figma connect unpublish --token=$FIGMA_CODE_CONNECT_TOKEN",
57
57
  "figma-connect-unpublish-local": "dotenv -- npm run figma-connect-unpublish",
58
58
  "lint": "npm run lint:js && npm run stylelint",
59
+ "prelint-ci": "echo \"##teamcity[importData type='jslint' path='eslint-report.xml']\"",
60
+ "lint-ci": "eslint --format jslint-xml . > eslint-report.xml && npm run stylelint-ci",
59
61
  "lint:js": "eslint",
60
62
  "postbuild": "cpy './**/*.d.ts' ../dist --parents --cwd=components/",
61
63
  "_postinstall": "husky && npm run postinstall:gitconfig",
@@ -79,12 +81,15 @@
79
81
  "start": "storybook dev -p 9999",
80
82
  "storybook-debug": "node --inspect-brk node_modules/@storybook/react/bin -p 9999",
81
83
  "stylelint": "stylelint --ignore-path .stylelintignore '**/*.css'",
84
+ "stylelint-ci": "stylelint --ignore-path .stylelintignore --custom-formatter 'scripts/jslint-xml.js' '**/*.css' | xmlappend eslint-report.xml",
82
85
  "test": "vitest src",
83
86
  "type-check": "(npm run type-check:create-d-ts && npm run type-check:main && npm run type-check:build) ; npm run type-check:cleanup-d-ts",
84
87
  "type-check:create-d-ts": "npx tcm src && npx tcm .storybook",
85
88
  "type-check:main": "tsc --noEmit -p tsconfig.json",
86
89
  "type-check:build": "tsc --noEmit -p tsconfig-build.json",
87
90
  "type-check:cleanup-d-ts": "rimraf src/**/*.css.d.ts .storybook/*.css.d.ts .storybook/**/*.css.d.ts",
91
+ "pretype-check-ci": "npm run type-check:create-d-ts",
92
+ "type-check-ci": "node scripts/tsc-teamcity",
88
93
  "update-styles": "node scripts/update-styles.mjs",
89
94
  "validate-tc-config": "mvn --file .teamcity/pom.xml org.jetbrains.teamcity:teamcity-configs-maven-plugin:generate -e"
90
95
  },
@@ -99,9 +104,9 @@
99
104
  "@csstools/css-parser-algorithms": "^4.0.0",
100
105
  "@csstools/stylelint-no-at-nest-rule": "^5.0.0",
101
106
  "@eslint/compat": "^2.0.2",
102
- "@eslint/eslintrc": "^3.3.3",
107
+ "@eslint/eslintrc": "^3.3.4",
103
108
  "@eslint/js": "^10.0.1",
104
- "@figma/code-connect": "^1.3.13",
109
+ "@figma/code-connect": "^1.4.1",
105
110
  "@jetbrains/eslint-config": "^6.0.5",
106
111
  "@jetbrains/logos": "3.0.0-canary.734b213.0",
107
112
  "@jetbrains/rollup-css-plugin": "./packages/rollup-css-plugin",
@@ -112,11 +117,11 @@
112
117
  "@rollup/plugin-json": "^6.1.0",
113
118
  "@rollup/plugin-node-resolve": "^16.0.3",
114
119
  "@rollup/plugin-replace": "^6.0.3",
115
- "@storybook/addon-a11y": "10.2.8",
116
- "@storybook/addon-docs": "^10.2.8",
117
- "@storybook/addon-themes": "^10.2.8",
120
+ "@storybook/addon-a11y": "10.2.13",
121
+ "@storybook/addon-docs": "^10.2.13",
122
+ "@storybook/addon-themes": "^10.2.13",
118
123
  "@storybook/csf": "^0.1.13",
119
- "@storybook/react-webpack5": "10.2.8",
124
+ "@storybook/react-webpack5": "10.2.13",
120
125
  "@storybook/test-runner": "^0.24.2",
121
126
  "@testing-library/dom": "^10.4.1",
122
127
  "@testing-library/react": "^16.3.2",
@@ -129,7 +134,7 @@
129
134
  "@types/webpack-env": "^1.18.8",
130
135
  "@vitejs/plugin-react": "^5.1.4",
131
136
  "@vitest/eslint-plugin": "^1.6.9",
132
- "acorn": "^8.15.0",
137
+ "acorn": "^8.16.0",
133
138
  "babel-plugin-require-context-hook": "^1.0.0",
134
139
  "caniuse-lite": "^1.0.30001770",
135
140
  "chai-as-promised": "^8.0.2",
@@ -138,8 +143,9 @@
138
143
  "core-js": "^3.48.0",
139
144
  "cpy-cli": "^7.0.0",
140
145
  "dotenv-cli": "^11.0.0",
141
- "eslint": "^10.0.1",
146
+ "eslint": "^9.39.2",
142
147
  "eslint-config-prettier": "^10.1.8",
148
+ "eslint-formatter-jslint-xml": "^8.40.0",
143
149
  "eslint-import-resolver-exports": "^1.0.0-beta.5",
144
150
  "eslint-import-resolver-typescript": "^4.4.4",
145
151
  "eslint-import-resolver-webpack": "^0.13.10",
@@ -148,10 +154,10 @@
148
154
  "eslint-plugin-prettier": "^5.5.5",
149
155
  "eslint-plugin-react": "^7.37.5",
150
156
  "eslint-plugin-react-hooks": "^7.0.1",
151
- "eslint-plugin-storybook": "^10.2.8",
157
+ "eslint-plugin-storybook": "^10.2.13",
152
158
  "eslint-plugin-unicorn": "^63.0.0",
153
159
  "events": "^3.3.0",
154
- "glob": "^13.0.3",
160
+ "glob": "^13.0.6",
155
161
  "globals": "^17.3.0",
156
162
  "html-webpack-plugin": "^5.6.6",
157
163
  "http-server": "^14.1.1",
@@ -170,22 +176,23 @@
170
176
  "react-dom": "^19.2.4",
171
177
  "regenerator-runtime": "^0.14.1",
172
178
  "rimraf": "^6.1.3",
173
- "rollup": "^4.57.1",
179
+ "rollup": "^4.59.0",
174
180
  "rollup-plugin-clear": "^2.0.7",
175
181
  "storage-mock": "^2.1.0",
176
182
  "storybook": "10.2.13",
177
- "stylelint": "^17.3.0",
183
+ "stylelint": "^17.4.0",
178
184
  "stylelint-config-sass-guidelines": "^13.0.0",
179
185
  "svg-inline-loader": "^0.8.2",
180
186
  "teamcity-service-messages": "^0.1.14",
181
187
  "terser-webpack-plugin": "^5.3.16",
182
188
  "typed-css-modules": "^0.9.1",
183
189
  "typescript": "~5.9.3",
184
- "typescript-eslint": "^8.55.0",
190
+ "typescript-eslint": "^8.56.1",
185
191
  "vitest": "^4.0.18",
186
192
  "vitest-teamcity-reporter": "^0.4.1",
187
- "webpack": "^5.105.2",
188
- "webpack-cli": "^6.0.1"
193
+ "webpack": "^5.105.3",
194
+ "webpack-cli": "^6.0.1",
195
+ "xmlappend": "^1.0.4"
189
196
  },
190
197
  "peerDependencies": {
191
198
  "@types/react": ">=18.0.0",
@@ -240,7 +247,7 @@
240
247
  "postcss-font-family-system-ui": "^5.0.0",
241
248
  "postcss-loader": "^8.2.1",
242
249
  "postcss-modules-values-replace": "^4.2.2",
243
- "postcss-preset-env": "^11.1.3",
250
+ "postcss-preset-env": "^11.2.0",
244
251
  "react-compiler-runtime": "^1.0.0",
245
252
  "react-movable": "^3.4.1",
246
253
  "react-virtualized": "^9.22.6",