@jetbrains/ring-ui 4.1.23 → 4.1.26

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.
@@ -87,7 +87,6 @@ export default class DatePopup extends Component {
87
87
  if (this.state.text && prevState.active) {
88
88
  this.confirm(prevState.active);
89
89
  }
90
- // eslint-disable-next-line react/no-did-update-set-state
91
90
  this.setState({text: null});
92
91
  }
93
92
  }
@@ -171,27 +171,25 @@ export default class List extends Component {
171
171
  }
172
172
  }
173
173
 
174
- if (
175
- activeIndex == null &&
176
- prevState.activeIndex == null &&
177
- shouldActivateFirstItem(nextProps)
178
- ) {
174
+ return nextState;
175
+ }
176
+
177
+ componentDidMount() {
178
+ document.addEventListener('mousemove', this.onDocumentMouseMove);
179
+ document.addEventListener('keydown', this.onDocumentKeyDown, true);
180
+
181
+ const {data, activeIndex} = this.props;
182
+
183
+ if (activeIndex == null && shouldActivateFirstItem(this.props)) {
179
184
  const firstActivatableIndex = data.findIndex(isActivatable);
180
185
  if (firstActivatableIndex >= 0) {
181
- Object.assign(nextState, {
186
+ this.setState({
182
187
  activeIndex: firstActivatableIndex,
183
188
  activeItem: data[firstActivatableIndex],
184
189
  needScrollToActive: true
185
190
  });
186
191
  }
187
192
  }
188
-
189
- return nextState;
190
- }
191
-
192
- componentDidMount() {
193
- document.addEventListener('mousemove', this.onDocumentMouseMove);
194
- document.addEventListener('keydown', this.onDocumentKeyDown, true);
195
193
  }
196
194
 
197
195
  shouldComponentUpdate(nextProps, nextState) {
@@ -59,6 +59,7 @@ export default class Popup extends PureComponent {
59
59
 
60
60
  directions: PropTypes.arrayOf(PropTypes.string),
61
61
  autoPositioning: PropTypes.bool,
62
+ autoPositioningOnScroll: PropTypes.bool,
62
63
  autoCorrectTopOverflow: PropTypes.bool,
63
64
  left: PropTypes.number,
64
65
  top: PropTypes.number,
@@ -91,6 +92,7 @@ export default class Popup extends PureComponent {
91
92
 
92
93
  directions: DEFAULT_DIRECTIONS,
93
94
  autoPositioning: true,
95
+ autoPositioningOnScroll: true,
94
96
  autoCorrectTopOverflow: true,
95
97
  left: 0,
96
98
  top: 0,
@@ -110,7 +112,6 @@ export default class Popup extends PureComponent {
110
112
 
111
113
  componentDidMount() {
112
114
  if (!this.props.client) {
113
- // eslint-disable-next-line react/no-did-mount-set-state
114
115
  this.setState({client: true});
115
116
  }
116
117
  if (!this.props.hidden) {
@@ -250,7 +251,9 @@ export default class Popup extends PureComponent {
250
251
  setTimeout(() => {
251
252
  this._listenersEnabled = true;
252
253
  this.listeners.add(window, 'resize', this._redraw);
253
- this.listeners.add(window, 'scroll', this._redraw);
254
+ if (this.props.autoPositioningOnScroll) {
255
+ this.listeners.add(window, 'scroll', this._redraw);
256
+ }
254
257
  this.listeners.add(document, 'pointerdown', this._onDocumentClick, true);
255
258
  let el = this._getAnchor();
256
259
  while (el) {
@@ -386,6 +386,10 @@ export default class Select extends Component {
386
386
  nextState.selected = Select._getEmptyValue(multiple);
387
387
  }
388
388
 
389
+ if (multiple && !nextState.selected) {
390
+ nextState.selected = prevState.selected;
391
+ }
392
+
389
393
  const {selected} = {...prevState, ...nextState};
390
394
  if (selected && multiple) {
391
395
  nextState.multipleMap = buildMultipleMap(selected);
@@ -48,7 +48,6 @@ export default class Tag extends PureComponent {
48
48
 
49
49
  componentDidUpdate(prevProps) {
50
50
  if (this.props.focused !== prevProps.focused) {
51
- // eslint-disable-next-line react/no-did-update-set-state
52
51
  this.setState({focused: this.props.focused});
53
52
  }
54
53
  if (this.state.focused) {
@@ -227,8 +227,7 @@ class DatePopup extends Component {
227
227
  if (this.state.active !== prevState.active) {
228
228
  if (this.state.text && prevState.active) {
229
229
  this.confirm(prevState.active);
230
- } // eslint-disable-next-line react/no-did-update-set-state
231
-
230
+ }
232
231
 
233
232
  this.setState({
234
233
  text: null
package/dist/list/list.js CHANGED
@@ -518,24 +518,28 @@ class List extends Component {
518
518
  }
519
519
  }
520
520
 
521
- if (activeIndex == null && prevState.activeIndex == null && shouldActivateFirstItem(nextProps)) {
521
+ return nextState;
522
+ }
523
+
524
+ componentDidMount() {
525
+ document.addEventListener('mousemove', this.onDocumentMouseMove);
526
+ document.addEventListener('keydown', this.onDocumentKeyDown, true);
527
+ const {
528
+ data,
529
+ activeIndex
530
+ } = this.props;
531
+
532
+ if (activeIndex == null && shouldActivateFirstItem(this.props)) {
522
533
  const firstActivatableIndex = data.findIndex(isActivatable);
523
534
 
524
535
  if (firstActivatableIndex >= 0) {
525
- Object.assign(nextState, {
536
+ this.setState({
526
537
  activeIndex: firstActivatableIndex,
527
538
  activeItem: data[firstActivatableIndex],
528
539
  needScrollToActive: true
529
540
  });
530
541
  }
531
542
  }
532
-
533
- return nextState;
534
- }
535
-
536
- componentDidMount() {
537
- document.addEventListener('mousemove', this.onDocumentMouseMove);
538
- document.addEventListener('keydown', this.onDocumentKeyDown, true);
539
543
  }
540
544
 
541
545
  shouldComponentUpdate(nextProps, nextState) {
@@ -137,7 +137,6 @@ class Popup extends PureComponent {
137
137
 
138
138
  componentDidMount() {
139
139
  if (!this.props.client) {
140
- // eslint-disable-next-line react/no-did-mount-set-state
141
140
  this.setState({
142
141
  client: true
143
142
  });
@@ -213,7 +212,11 @@ class Popup extends PureComponent {
213
212
  setTimeout(() => {
214
213
  this._listenersEnabled = true;
215
214
  this.listeners.add(window, 'resize', this._redraw);
216
- this.listeners.add(window, 'scroll', this._redraw);
215
+
216
+ if (this.props.autoPositioningOnScroll) {
217
+ this.listeners.add(window, 'scroll', this._redraw);
218
+ }
219
+
217
220
  this.listeners.add(document, 'pointerdown', this._onDocumentClick, true);
218
221
 
219
222
  let el = this._getAnchor();
@@ -336,6 +339,7 @@ _defineProperty(Popup, "propTypes", {
336
339
  // true means that it's never used in SSR
337
340
  directions: PropTypes.arrayOf(PropTypes.string),
338
341
  autoPositioning: PropTypes.bool,
342
+ autoPositioningOnScroll: PropTypes.bool,
339
343
  autoCorrectTopOverflow: PropTypes.bool,
340
344
  left: PropTypes.number,
341
345
  top: PropTypes.number,
@@ -370,6 +374,7 @@ _defineProperty(Popup, "defaultProps", {
370
374
  keepMounted: false,
371
375
  directions: DEFAULT_DIRECTIONS,
372
376
  autoPositioning: true,
377
+ autoPositioningOnScroll: true,
373
378
  autoCorrectTopOverflow: true,
374
379
  left: 0,
375
380
  top: 0,
@@ -697,6 +697,10 @@ class Select extends Component {
697
697
  nextState.selected = Select._getEmptyValue(multiple);
698
698
  }
699
699
 
700
+ if (multiple && !nextState.selected) {
701
+ nextState.selected = prevState.selected;
702
+ }
703
+
700
704
  const {
701
705
  selected
702
706
  } = { ...prevState,
package/dist/tag/tag.js CHANGED
@@ -47,7 +47,6 @@ class Tag extends PureComponent {
47
47
 
48
48
  componentDidUpdate(prevProps) {
49
49
  if (this.props.focused !== prevProps.focused) {
50
- // eslint-disable-next-line react/no-did-update-set-state
51
50
  this.setState({
52
51
  focused: this.props.focused
53
52
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetbrains/ring-ui",
3
- "version": "4.1.23",
3
+ "version": "4.1.26",
4
4
  "description": "JetBrains UI library",
5
5
  "author": "JetBrains",
6
6
  "license": "Apache-2.0",
@@ -67,14 +67,14 @@
67
67
  },
68
68
  "readmeFilename": "README.md",
69
69
  "devDependencies": {
70
- "@babel/cli": "^7.17.3",
70
+ "@babel/cli": "^7.17.6",
71
71
  "@babel/eslint-parser": "^7.17.0",
72
72
  "@jetbrains/eslint-config": "^5.3.2",
73
- "@jetbrains/generator-ring-ui": "^4.1.7",
73
+ "@jetbrains/generator-ring-ui": "^4.1.9",
74
74
  "@jetbrains/stylelint-config": "^3.0.2",
75
- "@primer/octicons": "^16.3.1",
76
- "@rollup/plugin-babel": "^5.3.0",
77
- "@rollup/plugin-replace": "^3.1.0",
75
+ "@primer/octicons": "^17.0.0",
76
+ "@rollup/plugin-babel": "^5.3.1",
77
+ "@rollup/plugin-replace": "^4.0.0",
78
78
  "@storybook/addon-a11y": "6.4.19",
79
79
  "@storybook/addon-docs": "6.4.19",
80
80
  "@storybook/addon-essentials": "6.4.19",
@@ -89,9 +89,9 @@
89
89
  "@storybook/manager-webpack5": "^6.4.19",
90
90
  "@storybook/source-loader": "6.4.19",
91
91
  "@storybook/theming": "6.4.19",
92
- "@testing-library/react": "^12.1.3",
92
+ "@testing-library/react": "^12.1.4",
93
93
  "@testing-library/user-event": "^13.5.0",
94
- "@wojtekmaj/enzyme-adapter-react-17": "^0.6.6",
94
+ "@wojtekmaj/enzyme-adapter-react-17": "^0.6.7",
95
95
  "angular": "^1.8.2",
96
96
  "angular-mocks": "^1.8.2",
97
97
  "angular-route": "^1.8.2",
@@ -104,13 +104,13 @@
104
104
  "cheerio": "^0.22.0",
105
105
  "core-js": "^3.21.1",
106
106
  "enzyme": "^3.11.0",
107
- "eslint": "^8.9.0",
107
+ "eslint": "^8.12.0",
108
108
  "eslint-import-resolver-webpack": "^0.13.2",
109
109
  "eslint-plugin-angular": "^4.1.0",
110
110
  "eslint-plugin-bdd": "^2.1.1",
111
111
  "eslint-plugin-import": "^2.25.4",
112
112
  "eslint-plugin-jsx-a11y": "^6.5.1",
113
- "eslint-plugin-react": "^7.28.0",
113
+ "eslint-plugin-react": "^7.29.4",
114
114
  "events": "^3.3.0",
115
115
  "glob": "^7.2.0",
116
116
  "html-webpack-plugin": "^5.5.0",
@@ -119,35 +119,35 @@
119
119
  "imports-loader": "^3.1.1",
120
120
  "jest": "~27.5.1",
121
121
  "jest-teamcity": "^1.10.0",
122
- "karma": "^6.3.16",
123
- "karma-chrome-launcher": "3.1.0",
122
+ "karma": "^6.3.17",
123
+ "karma-chrome-launcher": "3.1.1",
124
124
  "karma-mocha": "^2.0.1",
125
125
  "karma-sourcemap-loader": "^0.3.8",
126
126
  "karma-teamcity-reporter": "^2.0.0",
127
127
  "karma-webpack": "^5.0.0",
128
128
  "lerna": "^4.0.0",
129
- "lint-staged": "^12.3.4",
129
+ "lint-staged": "^12.3.6",
130
130
  "merge-options": "^3.0.4",
131
- "mocha": "^9.2.1",
131
+ "mocha": "^9.2.2",
132
132
  "pinst": "^3.0.0",
133
- "puppeteer": "^13.3.2",
133
+ "puppeteer": "^13.5.1",
134
134
  "raw-loader": "^4.0.2",
135
135
  "react": "^17.0.2",
136
136
  "react-dom": "^17.0.2",
137
137
  "react-test-renderer": "^17.0.2",
138
138
  "regenerator-runtime": "^0.13.9",
139
- "rollup": "^2.67.3",
139
+ "rollup": "^2.70.1",
140
140
  "rollup-plugin-clear": "^2.0.7",
141
141
  "rollup-plugin-styles": "^4.0.0",
142
142
  "sinon": "^13.0.1",
143
143
  "sinon-chai": "^3.7.0",
144
144
  "storage-mock": "^2.1.0",
145
- "stylelint": "^14.5.1",
145
+ "stylelint": "^14.6.1",
146
146
  "svg-inline-loader": "^0.8.2",
147
147
  "teamcity-service-messages": "^0.1.12",
148
148
  "terser-webpack-plugin": "^5.3.1",
149
149
  "wallaby-webpack": "^3.9.16",
150
- "webpack": "^5.69.1",
150
+ "webpack": "^5.70.0",
151
151
  "webpack-cli": "^4.9.2",
152
152
  "xmlappend": "^1.0.4",
153
153
  "yo": "^4.3.0"
@@ -156,7 +156,7 @@
156
156
  "core-js": ">=3.0.0",
157
157
  "react": ">=16.8.0",
158
158
  "react-dom": ">=16.8.0",
159
- "webpack": "^5.69.1"
159
+ "webpack": "^5.70.0"
160
160
  },
161
161
  "peerDependenciesMeta": {
162
162
  "webpack": {
@@ -164,14 +164,14 @@
164
164
  }
165
165
  },
166
166
  "dependencies": {
167
- "@babel/core": "^7.17.5",
167
+ "@babel/core": "^7.17.8",
168
168
  "@jetbrains/angular-elastic": "^2.5.1",
169
169
  "@jetbrains/babel-preset-jetbrains": "^2.3.2",
170
170
  "@jetbrains/icons": "^3.18.0",
171
171
  "@jetbrains/logos": "^1.4.27",
172
172
  "@jetbrains/postcss-require-hover": "^0.1.2",
173
173
  "@ungap/url-search-params": "^0.2.2",
174
- "babel-loader": "^8.2.3",
174
+ "babel-loader": "^8.2.4",
175
175
  "babel-plugin-transform-define": "^2.0.1",
176
176
  "browserslist": "^4.16.6",
177
177
  "change-case": "^4.1.1",
@@ -179,7 +179,7 @@
179
179
  "combokeys": "^3.0.1",
180
180
  "compile-code-loader": "^1.0.0",
181
181
  "conic-gradient": "^1.0.0",
182
- "css-loader": "^6.6.0",
182
+ "css-loader": "^6.7.1",
183
183
  "date-fns": "^2.28.0",
184
184
  "deep-equal": "^2.0.4",
185
185
  "element-resize-detector": "^1.2.4",
@@ -195,16 +195,16 @@
195
195
  "interpolate-loader": "^2.0.1",
196
196
  "just-debounce-it": "^3.0.1",
197
197
  "memoize-one": "^6.0.0",
198
- "postcss": "^8.4.6",
198
+ "postcss": "^8.4.12",
199
199
  "postcss-calc": "^8.2.4",
200
200
  "postcss-flexbugs-fixes": "^5.0.2",
201
201
  "postcss-font-family-system-ui": "^5.0.0",
202
202
  "postcss-loader": "^6.2.1",
203
203
  "postcss-modules-values-replace": "^3.4.0",
204
- "postcss-preset-env": "^7.4.1",
204
+ "postcss-preset-env": "^7.4.3",
205
205
  "prop-types": "^15.8.1",
206
206
  "react-markdown": "^5.0.3",
207
- "react-movable": "^3.0.2",
207
+ "react-movable": "^3.0.4",
208
208
  "react-virtualized": "^9.22.3",
209
209
  "react-waypoint": "^10.1.0",
210
210
  "remark-breaks": "^3.0.2",
@@ -221,5 +221,5 @@
221
221
  "node": ">=7.4",
222
222
  "npm": ">=6.0.0"
223
223
  },
224
- "gitHead": "7c742f3de2e959496ce7b04eb61b6f4d99ffe450"
224
+ "gitHead": "cbcdb55cbfcc78f52feb50432f18a3147f6d8f15"
225
225
  }