@jetbrains/ring-ui 5.0.145 → 5.0.147

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 (77) hide show
  1. package/components/data-list/data-list.css +2 -1
  2. package/components/date-picker/date-picker.css +1 -1
  3. package/components/editable-heading/editable-heading.css +9 -8
  4. package/components/header/profile.d.ts +1 -1
  5. package/components/heading/heading.css +5 -5
  6. package/components/input/input-legacy.css +2 -2
  7. package/components/input/input.css +5 -5
  8. package/components/link/link.d.ts +4 -4
  9. package/components/list/list.css +2 -2
  10. package/components/query-assist/query-assist.css +12 -11
  11. package/components/select/select-popup.css +2 -2
  12. package/components/select/select.css +3 -3
  13. package/components/shortcuts/shortcuts.d.ts +1 -1
  14. package/components/tags-input/tags-input.css +1 -1
  15. package/components/toggle/toggle.css +1 -1
  16. package/dist/_helpers/card.js +5 -5
  17. package/dist/analytics/analytics__custom-plugin.js +6 -2
  18. package/dist/analytics/analytics__ga-plugin.js +2 -1
  19. package/dist/auth/auth__core.js +100 -63
  20. package/dist/auth/iframe-flow.js +2 -1
  21. package/dist/auth/landing.js +2 -1
  22. package/dist/auth/request-builder.js +2 -1
  23. package/dist/auth/token-validator.js +6 -2
  24. package/dist/auth/window-flow.js +4 -2
  25. package/dist/caret/caret.js +16 -13
  26. package/dist/clipboard/clipboard-fallback.js +3 -3
  27. package/dist/data-list/data-list.js +6 -3
  28. package/dist/data-list/item.js +1 -1
  29. package/dist/date-picker/date-input.js +4 -4
  30. package/dist/date-picker/date-picker.js +7 -6
  31. package/dist/date-picker/date-popup.js +3 -2
  32. package/dist/dialog-ng/dialog-ng.js +3 -2
  33. package/dist/dropdown/dropdown.js +4 -2
  34. package/dist/editable-heading/editable-heading.js +2 -2
  35. package/dist/global/focus-sensor-hoc.js +13 -8
  36. package/dist/global/normalize-indent.js +2 -2
  37. package/dist/global/react-render-adapter.js +4 -1
  38. package/dist/global/rerender-hoc.js +2 -1
  39. package/dist/global/schedule-raf.js +2 -1
  40. package/dist/header/profile.d.ts +1 -1
  41. package/dist/header/profile.js +6 -6
  42. package/dist/header/smart-profile.js +3 -2
  43. package/dist/header/smart-services.js +6 -3
  44. package/dist/http/http.js +13 -7
  45. package/dist/hub-source/hub-source__user.js +3 -2
  46. package/dist/input/input.js +7 -4
  47. package/dist/island/content.js +2 -1
  48. package/dist/link/link.d.ts +4 -4
  49. package/dist/list/list__users-groups-source.js +10 -7
  50. package/dist/loader/loader.js +2 -1
  51. package/dist/loader/loader__core.js +2 -1
  52. package/dist/markdown/code.js +3 -2
  53. package/dist/message/message.js +8 -6
  54. package/dist/old-browsers-message/white-list.js +2 -2
  55. package/dist/pager/pager.js +16 -12
  56. package/dist/permissions/permissions__cache.js +1 -1
  57. package/dist/popup/popup.js +2 -1
  58. package/dist/popup/position.js +1 -1
  59. package/dist/query-assist/query-assist.js +46 -34
  60. package/dist/select/select.js +17 -10
  61. package/dist/select/select__popup.js +10 -3
  62. package/dist/select-ng/select-ng.js +2 -1
  63. package/dist/select-ng/select-ng__lazy.js +2 -1
  64. package/dist/shortcuts/core.js +2 -1
  65. package/dist/shortcuts/shortcuts.d.ts +1 -1
  66. package/dist/style.css +1 -1
  67. package/dist/tab-trap/tab-trap.js +4 -2
  68. package/dist/table/header.js +2 -2
  69. package/dist/table/multitable.js +14 -7
  70. package/dist/table/row-with-focus-sensor.js +8 -4
  71. package/dist/table/selection-shortcuts-hoc.js +11 -11
  72. package/dist/tabs/collapsible-tabs.js +1 -1
  73. package/dist/tag/tag.js +2 -1
  74. package/dist/tags-input/tags-input.js +23 -13
  75. package/dist/tooltip/tooltip.js +4 -2
  76. package/dist/user-agreement/user-agreement.js +8 -8
  77. package/package.json +38 -37
@@ -120,10 +120,12 @@ class Message extends Component {
120
120
  popup;
121
121
  node;
122
122
  popupRef = el => {
123
+ var _this$popup;
123
124
  this.popup = el;
124
- this.node = this.popup?.node;
125
+ this.node = (_this$popup = this.popup) === null || _this$popup === void 0 ? void 0 : _this$popup.node;
125
126
  };
126
127
  getTailOffset() {
128
+ var _this$popup2;
127
129
  const DEFAULT_OFFSET = 32;
128
130
  const {
129
131
  popupProps
@@ -131,14 +133,14 @@ class Message extends Component {
131
133
  if (this.props.tailOffset != null) {
132
134
  return this.props.tailOffset;
133
135
  }
134
- const anchor = popupProps?.anchorElement || this.popup?.parent;
136
+ const anchor = (popupProps === null || popupProps === void 0 ? void 0 : popupProps.anchorElement) || ((_this$popup2 = this.popup) === null || _this$popup2 === void 0 ? void 0 : _this$popup2.parent);
135
137
  if (!anchor) {
136
138
  return DEFAULT_OFFSET;
137
139
  }
138
140
  const offset = Math.floor(anchor.offsetWidth / 2);
139
141
  const isOpenedToRight = this.state.direction != null && [Directions.TOP_RIGHT, Directions.BOTTOM_RIGHT].includes(this.state.direction);
140
- if (popupProps?.left && isOpenedToRight) {
141
- return offset - popupProps?.left;
142
+ if (popupProps !== null && popupProps !== void 0 && popupProps.left && isOpenedToRight) {
143
+ return offset - (popupProps === null || popupProps === void 0 ? void 0 : popupProps.left);
142
144
  }
143
145
  return offset;
144
146
  }
@@ -197,10 +199,10 @@ class Message extends Component {
197
199
  className: modules_8b837449.button,
198
200
  onClick: onClose,
199
201
  primary: true
200
- }, buttonProps), (_translations$gotIt = translations?.gotIt) !== null && _translations$gotIt !== void 0 ? _translations$gotIt : translate('gotIt')), onDismiss && /*#__PURE__*/React.createElement(Button, {
202
+ }, buttonProps), (_translations$gotIt = translations === null || translations === void 0 ? void 0 : translations.gotIt) !== null && _translations$gotIt !== void 0 ? _translations$gotIt : translate('gotIt')), onDismiss && /*#__PURE__*/React.createElement(Button, {
201
203
  onClick: onDismiss,
202
204
  text: true
203
- }, (_translations$dismiss = translations?.dismiss) !== null && _translations$dismiss !== void 0 ? _translations$dismiss : translate('dismiss'))));
205
+ }, (_translations$dismiss = translations === null || translations === void 0 ? void 0 : translations.dismiss) !== null && _translations$dismiss !== void 0 ? _translations$dismiss : translate('dismiss'))));
204
206
  });
205
207
  });
206
208
  }
@@ -5,11 +5,11 @@ const MAJOR_VERSION_INDEX = 0;
5
5
  /**
6
6
  * SUPPORTED_BROWSERS are defined by Babel plugin, see babel config
7
7
  */
8
- if (!["and_chr 113", "chrome 112", "chrome 111", "chrome 109", "edge 112", "edge 111", "firefox 111", "ios_saf 16.4", "ios_saf 16.3", "ios_saf 16.2", "ios_saf 16.1", "safari 16.3", "samsung 20"]) {
8
+ if (!["and_chr 114", "chrome 113", "chrome 112", "chrome 109", "edge 113", "edge 112", "firefox 113", "ios_saf 16.4", "ios_saf 16.3", "ios_saf 16.1", "opera 98", "safari 16.4", "samsung 20"]) {
9
9
  // eslint-disable-next-line no-console
10
10
  console.warn('Ring UI: no SUPPORTED_BROWSERS passed. Please check babel config.');
11
11
  }
12
- const SUPPORTED = ["and_chr 113", "chrome 112", "chrome 111", "chrome 109", "edge 112", "edge 111", "firefox 111", "ios_saf 16.4", "ios_saf 16.3", "ios_saf 16.2", "ios_saf 16.1", "safari 16.3", "samsung 20"] || [];
12
+ const SUPPORTED = ["and_chr 114", "chrome 113", "chrome 112", "chrome 109", "edge 113", "edge 112", "firefox 113", "ios_saf 16.4", "ios_saf 16.3", "ios_saf 16.1", "opera 98", "safari 16.4", "samsung 20"] || [];
13
13
  const WHITE_LISTED_BROWSERS = ['chrome', 'firefox', 'safari', 'edge'];
14
14
  const WHITE_LIST = SUPPORTED.reduce((acc, item) => {
15
15
  var _item$match;
@@ -115,10 +115,10 @@ class Pager extends PureComponent {
115
115
  translate
116
116
  } = this.context;
117
117
  const data = pageSizes.map(size => {
118
- var _this$props$translati;
118
+ var _this$props$translati, _this$props$translati2;
119
119
  return {
120
120
  key: size,
121
- label: `${size} ${(_this$props$translati = this.props.translations?.perPage) !== null && _this$props$translati !== void 0 ? _this$props$translati : translate('perPage')}`
121
+ label: `${size} ${(_this$props$translati = (_this$props$translati2 = this.props.translations) === null || _this$props$translati2 === void 0 ? void 0 : _this$props$translati2.perPage) !== null && _this$props$translati !== void 0 ? _this$props$translati : translate('perPage')}`
122
122
  };
123
123
  });
124
124
  const selected = data.find(it => it.key === pageSize);
@@ -144,8 +144,9 @@ class Pager extends PureComponent {
144
144
  currentPage
145
145
  } = this.props;
146
146
  if (currentPage !== 1) {
147
+ var _this$props$onPageCha, _this$props;
147
148
  const prevPage = currentPage - 1;
148
- this.props.onPageChange?.(prevPage);
149
+ (_this$props$onPageCha = (_this$props = this.props).onPageChange) === null || _this$props$onPageCha === void 0 ? void 0 : _this$props$onPageCha.call(_this$props, prevPage);
149
150
  }
150
151
  };
151
152
  handleNextClick = () => {
@@ -156,13 +157,15 @@ class Pager extends PureComponent {
156
157
  const nextPage = currentPage + 1;
157
158
  const total = this.getTotalPages();
158
159
  if (currentPage !== total) {
159
- this.props.onPageChange?.(nextPage);
160
+ var _this$props$onPageCha2, _this$props2;
161
+ (_this$props$onPageCha2 = (_this$props2 = this.props).onPageChange) === null || _this$props$onPageCha2 === void 0 ? void 0 : _this$props$onPageCha2.call(_this$props2, nextPage);
160
162
  } else if (this.props.openTotal) {
161
163
  onLoadPage(nextPage);
162
164
  }
163
165
  };
164
166
  handlePageChange = memoize(i => event => {
165
- this.props.onPageChange?.(i, event);
167
+ var _this$props$onPageCha3, _this$props3;
168
+ (_this$props$onPageCha3 = (_this$props3 = this.props).onPageChange) === null || _this$props$onPageCha3 === void 0 ? void 0 : _this$props$onPageCha3.call(_this$props3, i, event);
166
169
  });
167
170
  handleLoadMore = memoize(i => () => {
168
171
  this.props.onLoadPage(i);
@@ -209,7 +212,7 @@ class Pager extends PureComponent {
209
212
  }));
210
213
  }
211
214
  getPagerLinks() {
212
- var _this$props$translati2, _this$props$translati3;
215
+ var _this$props$translati3, _this$props$translati4, _this$props$translati5, _this$props$translati6;
213
216
  const {
214
217
  translate
215
218
  } = this.context;
@@ -223,8 +226,8 @@ class Pager extends PureComponent {
223
226
  glyph: chevronLeftIcon,
224
227
  key: "icon"
225
228
  });
226
- const prevText = (_this$props$translati2 = this.props.translations?.previousPage) !== null && _this$props$translati2 !== void 0 ? _this$props$translati2 : translate('previousPage');
227
- const nextText = (_this$props$translati3 = this.props.translations?.nextPage) !== null && _this$props$translati3 !== void 0 ? _this$props$translati3 : translate('nextPage');
229
+ const prevText = (_this$props$translati3 = (_this$props$translati4 = this.props.translations) === null || _this$props$translati4 === void 0 ? void 0 : _this$props$translati4.previousPage) !== null && _this$props$translati3 !== void 0 ? _this$props$translati3 : translate('previousPage');
230
+ const nextText = (_this$props$translati5 = (_this$props$translati6 = this.props.translations) === null || _this$props$translati6 === void 0 ? void 0 : _this$props$translati6.nextPage) !== null && _this$props$translati5 !== void 0 ? _this$props$translati5 : translate('nextPage');
228
231
  const nextLinkContent = WrapText => [/*#__PURE__*/React.createElement("span", {
229
232
  key: "text"
230
233
  }, /*#__PURE__*/React.createElement(WrapText, null, nextText)), nextIcon];
@@ -263,7 +266,7 @@ class Pager extends PureComponent {
263
266
  return this.props.hrefFunc(page, pageSize);
264
267
  }
265
268
  getPagerContent() {
266
- var _this$props$translati4, _this$props$translati5;
269
+ var _this$props$translati7, _this$props$translati8, _this$props$translati9, _this$props$translati10;
267
270
  const {
268
271
  currentPage,
269
272
  visiblePagesLimit
@@ -273,7 +276,8 @@ class Pager extends PureComponent {
273
276
  translate
274
277
  } = this.context;
275
278
  if (totalPages < this.props.currentPage) {
276
- this.props.onPageChange?.(totalPages);
279
+ var _this$props$onPageCha4, _this$props4;
280
+ (_this$props$onPageCha4 = (_this$props4 = this.props).onPageChange) === null || _this$props$onPageCha4 === void 0 ? void 0 : _this$props$onPageCha4.call(_this$props4, totalPages);
277
281
  }
278
282
  let start = 1;
279
283
  let end = totalPages;
@@ -301,10 +305,10 @@ class Pager extends PureComponent {
301
305
  buttons.push(this.getButton(i, i, i, i === currentPage));
302
306
  }
303
307
  const lastPageButtonAvailable = end < totalPages && !this.props.openTotal || this.props.openTotal && this.props.canLoadLastPageWithOpenTotal;
304
- return /*#__PURE__*/React.createElement("div", null, this.getPagerLinks(), /*#__PURE__*/React.createElement(ButtonToolbar, null, start > 1 && this.getButton(1, (_this$props$translati4 = this.props.translations?.firstPage) !== null && _this$props$translati4 !== void 0 ? _this$props$translati4 : translate('firstPage')), /*#__PURE__*/React.createElement(ButtonGroup, null, start > 1 && this.getButton(start - 1, '...'), buttons, end < totalPages && this.getButton(end + 1, '...'), end === totalPages && this.props.openTotal && /*#__PURE__*/React.createElement(Button, _extends({
308
+ return /*#__PURE__*/React.createElement("div", null, this.getPagerLinks(), /*#__PURE__*/React.createElement(ButtonToolbar, null, start > 1 && this.getButton(1, (_this$props$translati7 = (_this$props$translati8 = this.props.translations) === null || _this$props$translati8 === void 0 ? void 0 : _this$props$translati8.firstPage) !== null && _this$props$translati7 !== void 0 ? _this$props$translati7 : translate('firstPage')), /*#__PURE__*/React.createElement(ButtonGroup, null, start > 1 && this.getButton(start - 1, '...'), buttons, end < totalPages && this.getButton(end + 1, '...'), end === totalPages && this.props.openTotal && /*#__PURE__*/React.createElement(Button, _extends({
305
309
  href: this.generateHref(end + 1),
306
310
  disabled: this.props.loader
307
- }, this.getClickProps(this.handleLoadMore(end + 1))), '...')), lastPageButtonAvailable && this.getButton(this.props.openTotal ? -1 : totalPages, (_this$props$translati5 = this.props.translations?.lastPage) !== null && _this$props$translati5 !== void 0 ? _this$props$translati5 : translate('lastPage'))), this.getPageSizeSelector());
311
+ }, this.getClickProps(this.handleLoadMore(end + 1))), '...')), lastPageButtonAvailable && this.getButton(this.props.openTotal ? -1 : totalPages, (_this$props$translati9 = (_this$props$translati10 = this.props.translations) === null || _this$props$translati10 === void 0 ? void 0 : _this$props$translati10.lastPage) !== null && _this$props$translati9 !== void 0 ? _this$props$translati9 : translate('lastPage'))), this.getPageSizeSelector());
308
312
  }
309
313
  render() {
310
314
  const classes = classNames(modules_1a5f0d42.pager, this.props.className);
@@ -205,7 +205,7 @@ class PermissionCache {
205
205
  testPermission(permissionName, projectId) {
206
206
  const permissionCache = this.permissionCache;
207
207
  const convertedName = this.namesConverter(permissionName);
208
- const cachedPermission = permissionCache?.[permissionName] || convertedName && permissionCache?.[convertedName];
208
+ const cachedPermission = (permissionCache === null || permissionCache === void 0 ? void 0 : permissionCache[permissionName]) || convertedName && (permissionCache === null || permissionCache === void 0 ? void 0 : permissionCache[convertedName]);
209
209
  // Hasn't the permission in any project
210
210
  if (!cachedPermission) {
211
211
  return false;
@@ -238,7 +238,8 @@ class Popup extends PureComponent {
238
238
  * @private
239
239
  */
240
240
  _onDocumentClick = evt => {
241
- if (this.container && evt.target instanceof Node && this.container.contains(evt.target) || !this._listenersEnabled || this.props.dontCloseOnAnchorClick && evt.target instanceof Node && this._getAnchor()?.contains(evt.target)) {
241
+ var _this$_getAnchor;
242
+ if (this.container && evt.target instanceof Node && this.container.contains(evt.target) || !this._listenersEnabled || this.props.dontCloseOnAnchorClick && evt.target instanceof Node && (_this$_getAnchor = this._getAnchor()) !== null && _this$_getAnchor !== void 0 && _this$_getAnchor.contains(evt.target)) {
242
243
  return;
243
244
  }
244
245
  this.props.onOutsideClick(evt);
@@ -242,7 +242,7 @@ function position(attrs) {
242
242
  anchorRect,
243
243
  maxHeight,
244
244
  direction: chosenDirection,
245
- popupScrollHeight: (_popup$scrollHeight = popup?.scrollHeight) !== null && _popup$scrollHeight !== void 0 ? _popup$scrollHeight : 0,
245
+ popupScrollHeight: (_popup$scrollHeight = popup === null || popup === void 0 ? void 0 : popup.scrollHeight) !== null && _popup$scrollHeight !== void 0 ? _popup$scrollHeight : 0,
246
246
  scroll
247
247
  });
248
248
  }
@@ -287,8 +287,9 @@ class QueryAssist extends Component {
287
287
  }
288
288
  if (typeof query === 'string' && queryChanged && query !== this.immediateState.query) {
289
289
  this.immediateState.query = query;
290
- if (prevProps.autoOpen && query?.length > 0) {
291
- this.requestData?.();
290
+ if (prevProps.autoOpen && (query === null || query === void 0 ? void 0 : query.length) > 0) {
291
+ var _this$requestData;
292
+ (_this$requestData = this.requestData) === null || _this$requestData === void 0 ? void 0 : _this$requestData.call(this);
292
293
  } else if (query) {
293
294
  this.requestStyleRanges();
294
295
  }
@@ -350,26 +351,30 @@ class QueryAssist extends Component {
350
351
  }
351
352
  if (_this.immediateState.focus && !_this.props.disabled) {
352
353
  if (typeof _this.immediateState.selection === 'number' && Number.isInteger(_this.immediateState.selection) && _this.immediateState.selection > -1) {
354
+ var _this$caret;
353
355
  // Set to end of field value if newCaretPosition is inappropriate
354
- _this.caret?.setPosition(newCaretPosition >= 0 ? newCaretPosition : -1);
356
+ (_this$caret = _this.caret) === null || _this$caret === void 0 ? void 0 : _this$caret.setPosition(newCaretPosition >= 0 ? newCaretPosition : -1);
355
357
  _this.scrollInput();
356
358
  } else if (_this.immediateState.selection && typeof _this.immediateState.selection === 'object' && _this.immediateState.selection.startOffset !== undefined) {
357
- _this.caret?.setPosition(_this.immediateState.selection);
359
+ var _this$caret2;
360
+ (_this$caret2 = _this.caret) === null || _this$caret2 === void 0 ? void 0 : _this$caret2.setPosition(_this.immediateState.selection);
358
361
  } else if (_this.immediateState.selection === undefined || params.forceSetCaret) {
359
- _this.caret?.setPosition(-1);
362
+ var _this$caret3;
363
+ (_this$caret3 = _this.caret) === null || _this$caret3 === void 0 ? void 0 : _this$caret3.setPosition(-1);
360
364
  }
361
365
  }
362
366
  };
363
367
  })();
364
368
  scrollInput() {
365
- const caretOffset = this.caret?.getOffset();
366
- if (this.input?.clientWidth !== this.input?.scrollWidth && caretOffset != null && this.input?.clientWidth != null && caretOffset > this.input.clientWidth) {
369
+ var _this$caret4, _this$input, _this$input2, _this$input3;
370
+ const caretOffset = (_this$caret4 = this.caret) === null || _this$caret4 === void 0 ? void 0 : _this$caret4.getOffset();
371
+ if (((_this$input = this.input) === null || _this$input === void 0 ? void 0 : _this$input.clientWidth) !== ((_this$input2 = this.input) === null || _this$input2 === void 0 ? void 0 : _this$input2.scrollWidth) && caretOffset != null && ((_this$input3 = this.input) === null || _this$input3 === void 0 ? void 0 : _this$input3.clientWidth) != null && caretOffset > this.input.clientWidth) {
367
372
  this.input.scrollLeft += caretOffset;
368
373
  }
369
374
  }
370
375
  getQuery() {
371
- var _this$input$textConte;
372
- return (_this$input$textConte = this.input?.textContent?.replace(/\s/g, ' ')) !== null && _this$input$textConte !== void 0 ? _this$input$textConte : '';
376
+ var _this$input$textConte, _this$input4, _this$input4$textCont;
377
+ return (_this$input$textConte = (_this$input4 = this.input) === null || _this$input4 === void 0 ? void 0 : (_this$input4$textCont = _this$input4.textContent) === null || _this$input4$textCont === void 0 ? void 0 : _this$input4$textCont.replace(/\s/g, ' ')) !== null && _this$input$textConte !== void 0 ? _this$input$textConte : '';
373
378
  }
374
379
  isRenderingGlassOrLoader() {
375
380
  const renderLoader = this.props.loader !== false && this.state.loading;
@@ -387,13 +392,13 @@ class QueryAssist extends Component {
387
392
  };
388
393
  isComposing;
389
394
  handleInput = e => {
390
- var _currentCaret$positio;
395
+ var _this$caret5, _currentCaret$positio;
391
396
  this.togglePlaceholder();
392
- const currentCaret = this.caret?.getPosition();
397
+ const currentCaret = (_this$caret5 = this.caret) === null || _this$caret5 === void 0 ? void 0 : _this$caret5.getPosition();
393
398
  const props = {
394
399
  dirty: true,
395
400
  query: this.getQuery(),
396
- caret: typeof currentCaret === 'number' ? currentCaret : (_currentCaret$positio = currentCaret?.position) !== null && _currentCaret$positio !== void 0 ? _currentCaret$positio : 0,
401
+ caret: typeof currentCaret === 'number' ? currentCaret : (_currentCaret$positio = currentCaret === null || currentCaret === void 0 ? void 0 : currentCaret.position) !== null && _currentCaret$positio !== void 0 ? _currentCaret$positio : 0,
397
402
  focus: true
398
403
  };
399
404
  if (this.immediateState.query === props.query && !this.isComposing) {
@@ -423,7 +428,8 @@ class QueryAssist extends Component {
423
428
  }
424
429
  this.props.onChange(props);
425
430
  if (this.props.autoOpen === 'force' || props.query.length > 0) {
426
- this.requestData?.();
431
+ var _this$requestData2;
432
+ (_this$requestData2 = this.requestData) === null || _this$requestData2 === void 0 ? void 0 : _this$requestData2.call(this);
427
433
  }
428
434
  };
429
435
  // It's necessary to prevent new element creation before any other hooks
@@ -451,17 +457,18 @@ class QueryAssist extends Component {
451
457
  setState = (state, resolve) => {
452
458
  super.setState(state, () => {
453
459
  this._pushHistory(state);
454
- resolve?.();
460
+ resolve === null || resolve === void 0 ? void 0 : resolve();
455
461
  });
456
462
  };
457
463
  _pushHistory(state) {
464
+ var _this$historyStack$;
458
465
  const queryIsSet = ('query' in state);
459
- const queryIsSame = this.historyStack[0]?.query === state.query;
466
+ const queryIsSame = ((_this$historyStack$ = this.historyStack[0]) === null || _this$historyStack$ === void 0 ? void 0 : _this$historyStack$.query) === state.query;
460
467
  if (queryIsSet && !queryIsSame) {
461
- var _this$caret$getPositi;
468
+ var _this$caret$getPositi, _this$caret6;
462
469
  this.historyStack.unshift({
463
470
  query: state.query,
464
- caret: (_this$caret$getPositi = this.caret?.getPosition({
471
+ caret: (_this$caret$getPositi = (_this$caret6 = this.caret) === null || _this$caret6 === void 0 ? void 0 : _this$caret6.getPosition({
465
472
  avoidFocus: true
466
473
  })) !== null && _this$caret$getPositi !== void 0 ? _this$caret$getPositi : -1
467
474
  });
@@ -475,7 +482,8 @@ class QueryAssist extends Component {
475
482
  this.setState({
476
483
  query: previous.query
477
484
  }, () => {
478
- this.caret?.setPosition(previous.caret);
485
+ var _this$caret7;
486
+ (_this$caret7 = this.caret) === null || _this$caret7 === void 0 ? void 0 : _this$caret7.setPosition(previous.caret);
479
487
  this.handleInput(e);
480
488
  });
481
489
  };
@@ -489,18 +497,19 @@ class QueryAssist extends Component {
489
497
  }
490
498
  };
491
499
  handleCaretMove = e => {
492
- var _currentCaret$positio2;
500
+ var _this$caret8, _currentCaret$positio2;
493
501
  if (this.isComposing) {
494
502
  return;
495
503
  }
496
- const currentCaret = this.caret?.getPosition();
497
- const caret = typeof currentCaret === 'number' ? currentCaret : (_currentCaret$positio2 = currentCaret?.position) !== null && _currentCaret$positio2 !== void 0 ? _currentCaret$positio2 : 0;
504
+ const currentCaret = (_this$caret8 = this.caret) === null || _this$caret8 === void 0 ? void 0 : _this$caret8.getPosition();
505
+ const caret = typeof currentCaret === 'number' ? currentCaret : (_currentCaret$positio2 = currentCaret === null || currentCaret === void 0 ? void 0 : currentCaret.position) !== null && _currentCaret$positio2 !== void 0 ? _currentCaret$positio2 : 0;
498
506
  const popupHidden = !this.state.showPopup && e.type === 'click';
499
507
  if (!this.props.disabled && (caret !== this.immediateState.caret || popupHidden)) {
500
508
  this.immediateState.caret = caret;
501
509
  this.scrollInput();
502
510
  if (this.immediateState.query.length > 0) {
503
- this.requestData?.();
511
+ var _this$requestData3;
512
+ (_this$requestData3 = this.requestData) === null || _this$requestData3 === void 0 ? void 0 : _this$requestData3.call(this);
504
513
  }
505
514
  }
506
515
  if (this.immediateState.query.length < 1) {
@@ -528,6 +537,7 @@ class QueryAssist extends Component {
528
537
  let afterCompletion = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
529
538
  return new Promise((resolve, reject) => {
530
539
  if (query === _this2.getQuery() && (caret === _this2.immediateState.caret || _this2.immediateState.caret === undefined)) {
540
+ var _this2$caret;
531
541
  // Do not setState on unmounted component
532
542
  if (!_this2.node) {
533
543
  return;
@@ -545,7 +555,7 @@ class QueryAssist extends Component {
545
555
  if (!deepEqual(_this2.state.styleRanges, styleRanges)) {
546
556
  state.styleRanges = styleRanges;
547
557
  }
548
- _this2.immediateState.selection = _this2.caret?.getPosition({
558
+ _this2.immediateState.selection = (_this2$caret = _this2.caret) === null || _this2$caret === void 0 ? void 0 : _this2$caret.getPosition({
549
559
  avoidFocus: true
550
560
  });
551
561
  _this2.setState(state, resolve);
@@ -567,7 +577,7 @@ class QueryAssist extends Component {
567
577
  return this.props.onApply(this.immediateState);
568
578
  };
569
579
  handleComplete = (data, replace) => {
570
- var _suggestion$caret, _suggestion$caret2;
580
+ var _suggestion$caret, _suggestion$caret2, _this$requestData4;
571
581
  if (!data || !data.data) {
572
582
  this.handleApply();
573
583
  return;
@@ -605,7 +615,7 @@ class QueryAssist extends Component {
605
615
  this.setCaretPosition();
606
616
  }
607
617
  this.closePopup();
608
- this.requestData?.(true);
618
+ (_this$requestData4 = this.requestData) === null || _this$requestData4 === void 0 ? void 0 : _this$requestData4.call(this, true);
609
619
  };
610
620
  requestStyleRanges = () => {
611
621
  const {
@@ -675,8 +685,8 @@ class QueryAssist extends Component {
675
685
  const completionStartNode = inputChildren && typeof completionStart === 'number' && inputChildren[Math.min(completionStart, inputChildren.length - 1)];
676
686
  let offset = completionStartNode && getRect(completionStartNode).right - getRect(this.input).left;
677
687
  if (!offset) {
678
- var _this$caret$getOffset;
679
- const caret = (_this$caret$getOffset = this.caret?.getOffset()) !== null && _this$caret$getOffset !== void 0 ? _this$caret$getOffset : 0;
688
+ var _this$caret$getOffset, _this$caret9;
689
+ const caret = (_this$caret$getOffset = (_this$caret9 = this.caret) === null || _this$caret9 === void 0 ? void 0 : _this$caret9.getOffset()) !== null && _this$caret$getOffset !== void 0 ? _this$caret$getOffset : 0;
680
690
  // Do not compensate caret in the beginning of field
681
691
  if (caret === 0) {
682
692
  return minOffset;
@@ -690,7 +700,8 @@ class QueryAssist extends Component {
690
700
  handleCtrlSpace = e => {
691
701
  preventDefault(e);
692
702
  if (!this.state.showPopup) {
693
- this.requestData?.();
703
+ var _this$requestData5;
704
+ (_this$requestData5 = this.requestData) === null || _this$requestData5 === void 0 ? void 0 : _this$requestData5.call(this);
694
705
  }
695
706
  };
696
707
  trackPopupMouseState = e => {
@@ -726,7 +737,8 @@ class QueryAssist extends Component {
726
737
  blurInput() {
727
738
  this.immediateState.selection = null;
728
739
  if (!this.props.focus) {
729
- this.caret?.target.blur();
740
+ var _this$caret10;
741
+ (_this$caret10 = this.caret) === null || _this$caret10 === void 0 ? void 0 : _this$caret10.target.blur();
730
742
  }
731
743
  }
732
744
  /**
@@ -873,14 +885,14 @@ class QueryAssist extends Component {
873
885
  actions.push( /*#__PURE__*/React.createElement(I18nContext.Consumer, {
874
886
  key: 'clearAction'
875
887
  }, _ref6 => {
876
- var _this$props$translati;
888
+ var _this$props$translati, _this$props$translati2;
877
889
  let {
878
890
  translate
879
891
  } = _ref6;
880
892
  return /*#__PURE__*/React.createElement(Button, {
881
893
  icon: closeIcon,
882
894
  className: modules_da7ab055.clear,
883
- title: (_this$props$translati = this.props.translations?.clearTitle) !== null && _this$props$translati !== void 0 ? _this$props$translati : translate('clearTitle'),
895
+ title: (_this$props$translati = (_this$props$translati2 = this.props.translations) === null || _this$props$translati2 === void 0 ? void 0 : _this$props$translati2.clearTitle) !== null && _this$props$translati !== void 0 ? _this$props$translati : translate('clearTitle'),
884
896
  ref: this.clearRef,
885
897
  onClick: this.clearQuery,
886
898
  "data-test": "query-assist-clear-icon"
@@ -938,7 +950,7 @@ class QueryAssist extends Component {
938
950
  }), renderGlass && !huge && /*#__PURE__*/React.createElement(Icon, {
939
951
  glyph: searchIcon,
940
952
  className: modules_da7ab055.icon,
941
- title: (_translations$searchT = translations?.searchTitle) !== null && _translations$searchT !== void 0 ? _translations$searchT : translate('searchTitle'),
953
+ title: (_translations$searchT = translations === null || translations === void 0 ? void 0 : translations.searchTitle) !== null && _translations$searchT !== void 0 ? _translations$searchT : translate('searchTitle'),
942
954
  ref: this.glassRef,
943
955
  "data-test": "query-assist-search-icon"
944
956
  }), renderLoader && /*#__PURE__*/React.createElement("div", {
@@ -948,7 +960,7 @@ class QueryAssist extends Component {
948
960
  }),
949
961
  ref: this.loaderRef
950
962
  }, /*#__PURE__*/React.createElement(LoaderInline, null)), /*#__PURE__*/React.createElement(ContentEditable, {
951
- "aria-label": (_translations$searchT2 = translations?.searchTitle) !== null && _translations$searchT2 !== void 0 ? _translations$searchT2 : translate('searchTitle'),
963
+ "aria-label": (_translations$searchT2 = translations === null || translations === void 0 ? void 0 : translations.searchTitle) !== null && _translations$searchT2 !== void 0 ? _translations$searchT2 : translate('searchTitle'),
952
964
  className: inputClasses,
953
965
  "data-test": "ring-query-assist-input",
954
966
  inputRef: this.inputRef,
@@ -1001,7 +1013,7 @@ class QueryAssist extends Component {
1001
1013
  }, /*#__PURE__*/React.createElement(Icon, {
1002
1014
  glyph: searchIcon,
1003
1015
  className: modules_da7ab055.rightSearchIcon,
1004
- title: (_translations$searchT3 = translations?.searchTitle) !== null && _translations$searchT3 !== void 0 ? _translations$searchT3 : translate('searchTitle'),
1016
+ title: (_translations$searchT3 = translations === null || translations === void 0 ? void 0 : translations.searchTitle) !== null && _translations$searchT3 !== void 0 ? _translations$searchT3 : translate('searchTitle'),
1005
1017
  onClick: this.handleApply,
1006
1018
  ref: this.glassRef,
1007
1019
  "data-test": "query-assist-search-icon"
@@ -149,15 +149,17 @@ function getListItems(props, state, rawFilterString) {
149
149
  ...data[i]
150
150
  };
151
151
  if (check(item, lowerCaseString, data)) {
152
+ var _state$multipleMap2;
152
153
  exactMatch = item.label === filterString;
153
154
  if (props.multiple && !(typeof props.multiple === 'object' && props.multiple.removeSelectedItems)) {
154
- item.checkbox = !!state.multipleMap?.[item.key];
155
+ var _state$multipleMap;
156
+ item.checkbox = !!((_state$multipleMap = state.multipleMap) !== null && _state$multipleMap !== void 0 && _state$multipleMap[item.key]);
155
157
  }
156
158
  if (props.multiple && typeof props.multiple === 'object' && props.multiple.limit && Array.isArray(state.selected)) {
157
159
  item.disabled = props.multiple.limit === state.selected.length && !state.selected.find(selectedItem => selectedItem.key === item.key);
158
160
  }
159
161
  // Ignore item if it's multiple and is already selected
160
- if (!(props.multiple && typeof props.multiple === 'object' && props.multiple.removeSelectedItems && state.multipleMap?.[item.key])) {
162
+ if (!(props.multiple && typeof props.multiple === 'object' && props.multiple.removeSelectedItems && (_state$multipleMap2 = state.multipleMap) !== null && _state$multipleMap2 !== void 0 && _state$multipleMap2[item.key])) {
161
163
  filteredData.push(item);
162
164
  }
163
165
  }
@@ -392,6 +394,7 @@ class Select extends Component {
392
394
  });
393
395
  };
394
396
  _blurHandler = () => {
397
+ var _this$_popup;
395
398
  this.props.onBlur();
396
399
  if (this._popup && this._popup.isVisible() && !this._popup.isClickingPopup) {
397
400
  window.setTimeout(() => {
@@ -400,7 +403,7 @@ class Select extends Component {
400
403
  });
401
404
  });
402
405
  }
403
- if (!this._popup?.isClickingPopup) {
406
+ if (!((_this$_popup = this._popup) !== null && _this$_popup !== void 0 && _this$_popup.isClickingPopup)) {
404
407
  this.setState({
405
408
  shortcutsEnabled: false,
406
409
  focused: false
@@ -418,17 +421,19 @@ class Select extends Component {
418
421
  }
419
422
  };
420
423
  _onEnter = () => {
424
+ var _this$_popup2;
421
425
  if (this.state.addButton && this.state.shownData.length === 0) {
422
426
  this.addHandler();
423
427
  }
424
428
  this.props.onDone();
425
- if (!this._popup?.isVisible() && this.props.allowAny) {
429
+ if (!((_this$_popup2 = this._popup) !== null && _this$_popup2 !== void 0 && _this$_popup2.isVisible()) && this.props.allowAny) {
426
430
  return true;
427
431
  }
428
432
  return undefined;
429
433
  };
430
434
  _onEsc = event => {
431
- if (!this._popup?.isVisible()) {
435
+ var _this$_popup3;
436
+ if (!((_this$_popup3 = this._popup) !== null && _this$_popup3 !== void 0 && _this$_popup3.isVisible())) {
432
437
  return true;
433
438
  } else if (this.props.multiple || !this.props.getInitial) {
434
439
  return false;
@@ -672,6 +677,7 @@ class Select extends Component {
672
677
  this._setFilter(e.currentTarget.value, e);
673
678
  };
674
679
  _setFilter = (value, event) => {
680
+ var _this$_popup4;
675
681
  if (this.isInputMode() && !this.state.focused) {
676
682
  return;
677
683
  }
@@ -693,7 +699,7 @@ class Select extends Component {
693
699
  this.props.onChange(fakeSelected, event);
694
700
  });
695
701
  }
696
- !this._popup?.isVisible() && this.props.onBeforeOpen();
702
+ !((_this$_popup4 = this._popup) !== null && _this$_popup4 !== void 0 && _this$_popup4.isVisible()) && this.props.onBeforeOpen();
697
703
  this.setState({
698
704
  filterValue
699
705
  }, () => {
@@ -899,7 +905,7 @@ class Select extends Component {
899
905
  } = this.props;
900
906
  const icons = [];
901
907
  const height = this.props.height || this.context;
902
- if (!Array.isArray(selected) && selected?.icon) {
908
+ if (!Array.isArray(selected) && selected !== null && selected !== void 0 && selected.icon) {
903
909
  icons.push( /*#__PURE__*/React.createElement("button", {
904
910
  title: "Toggle options popup",
905
911
  type: "button",
@@ -939,7 +945,8 @@ class Select extends Component {
939
945
  return icons;
940
946
  }
941
947
  _getAvatar() {
942
- return !Array.isArray(this.state.selected) && (this.state.selected?.avatar || this.state.selected?.showGeneratedAvatar) && /*#__PURE__*/React.createElement(Avatar, {
948
+ var _this$state$selected, _this$state$selected2;
949
+ return !Array.isArray(this.state.selected) && (((_this$state$selected = this.state.selected) === null || _this$state$selected === void 0 ? void 0 : _this$state$selected.avatar) || ((_this$state$selected2 = this.state.selected) === null || _this$state$selected2 === void 0 ? void 0 : _this$state$selected2.showGeneratedAvatar)) && /*#__PURE__*/React.createElement(Avatar, {
943
950
  className: modules_9d0de074.avatar,
944
951
  url: this.state.selected.avatar,
945
952
  username: this.state.selected.username,
@@ -964,7 +971,7 @@ class Select extends Component {
964
971
  };
965
972
  }
966
973
  renderSelect(activeItemId) {
967
- var _this$props$label3, _this$props$label4, _this$props$buttonCla;
974
+ var _this$props$label3, _this$props$label4, _this$_popup5, _this$_popup5$list, _this$props$buttonCla;
968
975
  const dataTest = this.props['data-test'];
969
976
  const {
970
977
  selectedLabel
@@ -1021,7 +1028,7 @@ class Select extends Component {
1021
1028
  "data-test": "ring-select__focus",
1022
1029
  enableShortcuts: shortcutsEnabled ? Object.keys({
1023
1030
  ...this.getShortcutsMap(),
1024
- ...this._popup?.list?.shortcutsMap
1031
+ ...((_this$_popup5 = this._popup) === null || _this$_popup5 === void 0 ? void 0 : (_this$_popup5$list = _this$_popup5.list) === null || _this$_popup5$list === void 0 ? void 0 : _this$_popup5$list.shortcutsMap)
1025
1032
  }) : undefined,
1026
1033
  afterInput: this.props.type === Type.INPUT && iconsNode
1027
1034
  })), this._renderPopup()), this.props.error && /*#__PURE__*/React.createElement("div", {
@@ -114,7 +114,10 @@ class SelectPopup extends PureComponent {
114
114
  isClickingPopup = false; // This flag is set to true while an item in the popup is being clicked
115
115
  filter;
116
116
  focusFilter() {
117
- setTimeout(() => this.filter?.focus());
117
+ setTimeout(() => {
118
+ var _this$filter;
119
+ return (_this$filter = this.filter) === null || _this$filter === void 0 ? void 0 : _this$filter.focus();
120
+ });
118
121
  }
119
122
  isEventTargetFilter(event) {
120
123
  return event.target instanceof Element && event.target.matches('input,textarea');
@@ -218,7 +221,10 @@ class SelectPopup extends PureComponent {
218
221
  tabPress = event => {
219
222
  this.props.onCloseAttempt(event, true);
220
223
  };
221
- onClickHandler = () => this.filter?.focus();
224
+ onClickHandler = () => {
225
+ var _this$filter2;
226
+ return (_this$filter2 = this.filter) === null || _this$filter2 === void 0 ? void 0 : _this$filter2.focus();
227
+ };
222
228
  getFilter() {
223
229
  if (this.props.filter || this.props.tags) {
224
230
  return /*#__PURE__*/React.createElement("div", {
@@ -335,6 +341,7 @@ class SelectPopup extends PureComponent {
335
341
  }
336
342
  };
337
343
  getSelectAll = () => {
344
+ var _multiple$renderSelec;
338
345
  const multiple = this.props.multiple;
339
346
  const activeFilters = this.props.data.filter(item => !item.disabled);
340
347
  return Array.isArray(this.props.selected) && /*#__PURE__*/React.createElement("div", {
@@ -343,7 +350,7 @@ class SelectPopup extends PureComponent {
343
350
  text: true,
344
351
  inline: true,
345
352
  onClick: this.handleSelectAll
346
- }, activeFilters.length !== this.props.selected.length ? multiple.selectAllLabel || 'Select all' : multiple.deselectAllLabel || 'Deselect all'), multiple.renderSelectedItemsDescription?.(this.props.selected, activeFilters.length) || /*#__PURE__*/React.createElement(Text, {
353
+ }, activeFilters.length !== this.props.selected.length ? multiple.selectAllLabel || 'Select all' : multiple.deselectAllLabel || 'Deselect all'), ((_multiple$renderSelec = multiple.renderSelectedItemsDescription) === null || _multiple$renderSelec === void 0 ? void 0 : _multiple$renderSelec.call(multiple, this.props.selected, activeFilters.length)) || /*#__PURE__*/React.createElement(Text, {
347
354
  info: true
348
355
  }, `${this.props.selected.length} selected`));
349
356
  };
@@ -408,7 +408,8 @@ angularModule.directive('rgSelect', function rgSelectDirective() {
408
408
  }
409
409
  }
410
410
  function reRenderSelect(props) {
411
- if (ctrl.selectInstance?.node) {
411
+ var _ctrl$selectInstance;
412
+ if ((_ctrl$selectInstance = ctrl.selectInstance) !== null && _ctrl$selectInstance !== void 0 && _ctrl$selectInstance.node) {
412
413
  ctrl.selectInstance.rerender({
413
414
  ...props,
414
415
  ref: selectRef
@@ -141,8 +141,9 @@ class SelectLazy {
141
141
  if (this.type === 'dropdown') {
142
142
  render( /*#__PURE__*/cloneElement(this.reactSelect, {
143
143
  ref: node => {
144
+ var _node$_openPopupIfClo;
144
145
  this.selectRef(node);
145
- node?._openPopupIfClosed?.();
146
+ node === null || node === void 0 ? void 0 : (_node$_openPopupIfClo = node._openPopupIfClosed) === null || _node$_openPopupIfClo === void 0 ? void 0 : _node$_openPopupIfClo.call(node);
146
147
  }
147
148
  }), this.container);
148
149
  } else {
@@ -158,7 +158,8 @@ class Shortcuts {
158
158
  };
159
159
  }
160
160
  hasKey(key, scope) {
161
- return !!this._scopes[scope]?.[key];
161
+ var _this$_scopes$scope;
162
+ return !!((_this$_scopes$scope = this._scopes[scope]) !== null && _this$_scopes$scope !== void 0 && _this$_scopes$scope[key]);
162
163
  }
163
164
  _defaultFilter = (e, element, key) => {
164
165
  // if the element or its parents have the class "ring-js-shortcuts" then no need to stop
@@ -24,5 +24,5 @@ export default class Shortcuts extends PureComponent<ShortcutsProps> {
24
24
  componentWillUnmount(): void;
25
25
  turnShorcutsOn(): void;
26
26
  turnShorcutsOff(): void;
27
- render(): string | number | true | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactFragment | null;
27
+ render(): string | number | true | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null;
28
28
  }