@jetbrains/ring-ui 5.0.83 → 5.0.85

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 (65) hide show
  1. package/components/date-picker/date-picker.js +3 -8
  2. package/components/dropdown/dropdown.d.ts +3 -0
  3. package/components/dropdown/dropdown.js +12 -1
  4. package/components/global/get-uid.js +6 -1
  5. package/components/shortcuts/core.js +1 -1
  6. package/dist/analytics/analytics__custom-plugin.js +2 -4
  7. package/dist/analytics/analytics__fus-plugin.js +2 -4
  8. package/dist/analytics/analytics__ga-plugin.js +1 -2
  9. package/dist/auth/auth.js +3 -1
  10. package/dist/auth/auth__core.js +57 -94
  11. package/dist/auth/iframe-flow.js +1 -2
  12. package/dist/auth/landing.js +1 -2
  13. package/dist/auth/request-builder.js +1 -2
  14. package/dist/auth/token-validator.js +2 -6
  15. package/dist/auth/window-flow.js +2 -4
  16. package/dist/button/button.js +1 -2
  17. package/dist/caret/caret.js +13 -16
  18. package/dist/content-layout/content-layout.js +1 -2
  19. package/dist/data-list/data-list.js +3 -6
  20. package/dist/data-list/item.js +1 -1
  21. package/dist/date-picker/date-picker.js +8 -13
  22. package/dist/date-picker/date-popup.js +1 -2
  23. package/dist/dialog-ng/dialog-ng.js +2 -3
  24. package/dist/dropdown/dropdown.d.ts +3 -0
  25. package/dist/dropdown/dropdown.js +15 -6
  26. package/dist/editable-heading/editable-heading.js +1 -3
  27. package/dist/global/focus-sensor-hoc.js +8 -13
  28. package/dist/global/get-uid.js +6 -1
  29. package/dist/global/normalize-indent.js +2 -2
  30. package/dist/global/react-render-adapter.js +1 -4
  31. package/dist/global/rerender-hoc.js +1 -2
  32. package/dist/global/schedule-raf.js +1 -2
  33. package/dist/header/smart-profile.js +2 -3
  34. package/dist/header/smart-services.js +3 -6
  35. package/dist/http/http.js +7 -13
  36. package/dist/hub-source/hub-source__user.js +2 -3
  37. package/dist/icon/icon.js +1 -2
  38. package/dist/input/input.js +3 -6
  39. package/dist/island/content.js +1 -2
  40. package/dist/list/list__users-groups-source.js +7 -10
  41. package/dist/loader/loader.js +1 -2
  42. package/dist/loader/loader__core.js +1 -2
  43. package/dist/markdown/code.js +2 -3
  44. package/dist/message/message.js +4 -6
  45. package/dist/pager/pager.js +4 -8
  46. package/dist/permissions/permissions__cache.js +1 -1
  47. package/dist/popup/popup.js +2 -4
  48. package/dist/popup/position.js +2 -3
  49. package/dist/query-assist/query-assist.js +29 -41
  50. package/dist/select/select.js +10 -17
  51. package/dist/select/select__popup.js +3 -10
  52. package/dist/select-ng/select-ng.js +1 -2
  53. package/dist/select-ng/select-ng__lazy.js +1 -2
  54. package/dist/shortcuts/core.js +2 -3
  55. package/dist/tab-trap/tab-trap.js +2 -4
  56. package/dist/table/header.js +2 -2
  57. package/dist/table/multitable.js +7 -14
  58. package/dist/table/row-with-focus-sensor.js +4 -8
  59. package/dist/table/selection-shortcuts-hoc.js +11 -11
  60. package/dist/tabs/collapsible-tabs.js +1 -1
  61. package/dist/tabs/dumb-tabs.js +1 -2
  62. package/dist/tag/tag.js +1 -2
  63. package/dist/tags-input/tags-input.js +13 -23
  64. package/dist/tooltip/tooltip.js +2 -4
  65. package/package.json +23 -23
@@ -148,17 +148,15 @@ function getListItems(props, state, rawFilterString) {
148
148
  ...data[i]
149
149
  };
150
150
  if (check(item, lowerCaseString, data)) {
151
- var _state$multipleMap2;
152
151
  exactMatch = item.label === filterString;
153
152
  if (props.multiple && !(typeof props.multiple === 'object' && props.multiple.removeSelectedItems)) {
154
- var _state$multipleMap;
155
- item.checkbox = !!((_state$multipleMap = state.multipleMap) !== null && _state$multipleMap !== void 0 && _state$multipleMap[item.key]);
153
+ item.checkbox = !!state.multipleMap?.[item.key];
156
154
  }
157
155
  if (props.multiple && typeof props.multiple === 'object' && props.multiple.limit && Array.isArray(state.selected)) {
158
156
  item.disabled = props.multiple.limit === state.selected.length && !state.selected.find(selectedItem => selectedItem.key === item.key);
159
157
  }
160
158
  // Ignore item if it's multiple and is already selected
161
- if (!(props.multiple && typeof props.multiple === 'object' && props.multiple.removeSelectedItems && (_state$multipleMap2 = state.multipleMap) !== null && _state$multipleMap2 !== void 0 && _state$multipleMap2[item.key])) {
159
+ if (!(props.multiple && typeof props.multiple === 'object' && props.multiple.removeSelectedItems && state.multipleMap?.[item.key])) {
162
160
  filteredData.push(item);
163
161
  }
164
162
  }
@@ -264,7 +262,6 @@ class Select extends Component {
264
262
  });
265
263
  });
266
264
  _defineProperty(this, "_blurHandler", () => {
267
- var _this$_popup;
268
265
  this.props.onBlur();
269
266
  if (this._popup && this._popup.isVisible() && !this._popup.isClickingPopup) {
270
267
  window.setTimeout(() => {
@@ -273,7 +270,7 @@ class Select extends Component {
273
270
  });
274
271
  });
275
272
  }
276
- if (!((_this$_popup = this._popup) !== null && _this$_popup !== void 0 && _this$_popup.isClickingPopup)) {
273
+ if (!this._popup?.isClickingPopup) {
277
274
  this.setState({
278
275
  shortcutsEnabled: false,
279
276
  focused: false
@@ -291,19 +288,17 @@ class Select extends Component {
291
288
  }
292
289
  });
293
290
  _defineProperty(this, "_onEnter", () => {
294
- var _this$_popup2;
295
291
  if (this.state.addButton && this.state.shownData.length === 0) {
296
292
  this.addHandler();
297
293
  }
298
294
  this.props.onDone();
299
- if (!((_this$_popup2 = this._popup) !== null && _this$_popup2 !== void 0 && _this$_popup2.isVisible()) && this.props.allowAny) {
295
+ if (!this._popup?.isVisible() && this.props.allowAny) {
300
296
  return true;
301
297
  }
302
298
  return undefined;
303
299
  });
304
300
  _defineProperty(this, "_onEsc", event => {
305
- var _this$_popup3;
306
- if (!((_this$_popup3 = this._popup) !== null && _this$_popup3 !== void 0 && _this$_popup3.isVisible())) {
301
+ if (!this._popup?.isVisible()) {
307
302
  return true;
308
303
  } else if (this.props.multiple || !this.props.getInitial) {
309
304
  return false;
@@ -357,7 +352,6 @@ class Select extends Component {
357
352
  this._setFilter(e.currentTarget.value, e);
358
353
  });
359
354
  _defineProperty(this, "_setFilter", (value, event) => {
360
- var _this$_popup4;
361
355
  if (this.isInputMode() && !this.state.focused) {
362
356
  return;
363
357
  }
@@ -379,7 +373,7 @@ class Select extends Component {
379
373
  this.props.onChange(fakeSelected, event);
380
374
  });
381
375
  }
382
- !((_this$_popup4 = this._popup) !== null && _this$_popup4 !== void 0 && _this$_popup4.isVisible()) && this.props.onBeforeOpen();
376
+ !this._popup?.isVisible() && this.props.onBeforeOpen();
383
377
  this.setState({
384
378
  filterValue
385
379
  }, () => {
@@ -858,7 +852,7 @@ class Select extends Component {
858
852
  } = this.props;
859
853
  const icons = [];
860
854
  const height = this.props.height || this.context;
861
- if (!Array.isArray(selected) && selected !== null && selected !== void 0 && selected.icon) {
855
+ if (!Array.isArray(selected) && selected?.icon) {
862
856
  icons.push( /*#__PURE__*/React.createElement("button", {
863
857
  title: "Toggle options popup",
864
858
  type: "button",
@@ -898,8 +892,7 @@ class Select extends Component {
898
892
  return icons;
899
893
  }
900
894
  _getAvatar() {
901
- var _this$state$selected, _this$state$selected2;
902
- 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, {
895
+ return !Array.isArray(this.state.selected) && (this.state.selected?.avatar || this.state.selected?.showGeneratedAvatar) && /*#__PURE__*/React.createElement(Avatar, {
903
896
  className: modules_9d0de074.avatar,
904
897
  url: this.state.selected.avatar,
905
898
  username: this.state.selected.username,
@@ -920,7 +913,7 @@ class Select extends Component {
920
913
  };
921
914
  }
922
915
  renderSelect(activeItemId) {
923
- var _this$props$label3, _this$props$label4, _this$_popup5, _this$_popup5$list, _this$props$buttonCla;
916
+ var _this$props$label3, _this$props$label4, _this$props$buttonCla;
924
917
  const dataTest = this.props['data-test'];
925
918
  const {
926
919
  selectedLabel
@@ -977,7 +970,7 @@ class Select extends Component {
977
970
  "data-test": "ring-select__focus",
978
971
  enableShortcuts: shortcutsEnabled ? Object.keys({
979
972
  ...this.getShortcutsMap(),
980
- ...((_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)
973
+ ...this._popup?.list?.shortcutsMap
981
974
  }) : undefined,
982
975
  afterInput: this.props.type === Type.INPUT && iconsNode
983
976
  })), this._renderPopup()), this.props.error && /*#__PURE__*/React.createElement("div", {
@@ -120,10 +120,7 @@ class SelectPopup extends PureComponent {
120
120
  _defineProperty(this, "tabPress", event => {
121
121
  this.props.onCloseAttempt(event, true);
122
122
  });
123
- _defineProperty(this, "onClickHandler", () => {
124
- var _this$filter;
125
- return (_this$filter = this.filter) === null || _this$filter === void 0 ? void 0 : _this$filter.focus();
126
- });
123
+ _defineProperty(this, "onClickHandler", () => this.filter?.focus());
127
124
  _defineProperty(this, "handleRemoveTag", memoize(tag => event => this.removeTag(tag, event)));
128
125
  _defineProperty(this, "handleTagClick", memoize(tag => () => {
129
126
  if (Array.isArray(this.props.selected)) {
@@ -141,7 +138,6 @@ class SelectPopup extends PureComponent {
141
138
  }
142
139
  });
143
140
  _defineProperty(this, "getSelectAll", () => {
144
- var _multiple$renderSelec;
145
141
  const multiple = this.props.multiple;
146
142
  const activeFilters = this.props.data.filter(item => !item.disabled);
147
143
  return Array.isArray(this.props.selected) && /*#__PURE__*/React.createElement("div", {
@@ -150,7 +146,7 @@ class SelectPopup extends PureComponent {
150
146
  text: true,
151
147
  inline: true,
152
148
  onClick: this.handleSelectAll
153
- }, 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, {
149
+ }, 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, {
154
150
  info: true
155
151
  }, `${this.props.selected.length} selected`));
156
152
  });
@@ -209,10 +205,7 @@ class SelectPopup extends PureComponent {
209
205
  window.document.removeEventListener('mouseup', this.mouseUpHandler);
210
206
  }
211
207
  focusFilter() {
212
- setTimeout(() => {
213
- var _this$filter2;
214
- return (_this$filter2 = this.filter) === null || _this$filter2 === void 0 ? void 0 : _this$filter2.focus();
215
- });
208
+ setTimeout(() => this.filter?.focus());
216
209
  }
217
210
  isEventTargetFilter(event) {
218
211
  return event.target instanceof Element && event.target.matches('input,textarea');
@@ -407,8 +407,7 @@ angularModule.directive('rgSelect', function rgSelectDirective() {
407
407
  }
408
408
  }
409
409
  function reRenderSelect(props) {
410
- var _ctrl$selectInstance;
411
- if ((_ctrl$selectInstance = ctrl.selectInstance) !== null && _ctrl$selectInstance !== void 0 && _ctrl$selectInstance.node) {
410
+ if (ctrl.selectInstance?.node) {
412
411
  ctrl.selectInstance.rerender({
413
412
  ...props,
414
413
  ref: selectRef
@@ -138,10 +138,9 @@ class SelectLazy {
138
138
  _clickHandler() {
139
139
  this.detachEvents();
140
140
  if (this.type === 'dropdown') {
141
- var _this$selectInstance, _this$selectInstance$;
142
141
  render(this.reactSelect, this.container);
143
142
  // Hack for React17, where click event is not triggered on just rendered Select node
144
- (_this$selectInstance = this.selectInstance) === null || _this$selectInstance === void 0 ? void 0 : (_this$selectInstance$ = _this$selectInstance._openPopupIfClosed) === null || _this$selectInstance$ === void 0 ? void 0 : _this$selectInstance$.call(_this$selectInstance);
143
+ this.selectInstance?._openPopupIfClosed?.();
145
144
  } else {
146
145
  hydrate(this.reactSelect, this.container);
147
146
  }
@@ -38,7 +38,7 @@ class Shortcuts {
38
38
  return false;
39
39
  }
40
40
  // stop for input, select, and textarea
41
- return element.matches('input,select,textarea') || element.contentEditable === 'true';
41
+ return element.matches('input:not([type=checkbox]),select,textarea') || element.contentEditable === 'true';
42
42
  });
43
43
  this.setFilter();
44
44
  this.setScope();
@@ -167,8 +167,7 @@ class Shortcuts {
167
167
  };
168
168
  }
169
169
  hasKey(key, scope) {
170
- var _this$_scopes$scope;
171
- return !!((_this$_scopes$scope = this._scopes[scope]) !== null && _this$_scopes$scope !== void 0 && _this$_scopes$scope[key]);
170
+ return !!this._scopes[scope]?.[key];
172
171
  }
173
172
  _getKeyboardEventType(params) {
174
173
  if (!params.type && sniffr.os.name === 'windows') {
@@ -63,7 +63,6 @@ class TabTrap extends Component {
63
63
  }
64
64
  });
65
65
  _defineProperty(this, "handleBlurIfWithoutFocus", event => {
66
- var _this$node;
67
66
  if (!this.trapWithoutFocus) {
68
67
  return;
69
68
  }
@@ -72,7 +71,7 @@ class TabTrap extends Component {
72
71
  if (!newFocused) {
73
72
  return;
74
73
  }
75
- if (newFocused instanceof Element && (_this$node = this.node) !== null && _this$node !== void 0 && _this$node.contains(newFocused)) {
74
+ if (newFocused instanceof Element && this.node?.contains(newFocused)) {
76
75
  return;
77
76
  }
78
77
  this.focusLast();
@@ -90,9 +89,8 @@ class TabTrap extends Component {
90
89
  if (this.props.autoFocusFirst) {
91
90
  this.focusFirst();
92
91
  } else if (!this.props.trapDisabled && (!this.node || !this.node.contains(this.previousFocusedNode))) {
93
- var _this$trapButtonNode;
94
92
  this.trapWithoutFocus = true;
95
- (_this$trapButtonNode = this.trapButtonNode) === null || _this$trapButtonNode === void 0 ? void 0 : _this$trapButtonNode.focus();
93
+ this.trapButtonNode?.focus();
96
94
  }
97
95
  }
98
96
  componentWillUnmount() {
@@ -63,8 +63,8 @@ class Header extends PureComponent {
63
63
  calculateColumnsWidths(columnsRowNode) {
64
64
  var _columnsRowNode$child;
65
65
  this.setState({
66
- headerWidth: columnsRowNode === null || columnsRowNode === void 0 ? void 0 : columnsRowNode.clientWidth,
67
- widths: [...((_columnsRowNode$child = columnsRowNode === null || columnsRowNode === void 0 ? void 0 : columnsRowNode.childNodes) !== null && _columnsRowNode$child !== void 0 ? _columnsRowNode$child : [])].map(column => column instanceof Element ? column.clientWidth : 0)
66
+ headerWidth: columnsRowNode?.clientWidth,
67
+ widths: [...((_columnsRowNode$child = columnsRowNode?.childNodes) !== null && _columnsRowNode$child !== void 0 ? _columnsRowNode$child : [])].map(column => column instanceof Element ? column.clientWidth : 0)
68
68
  });
69
69
  }
70
70
  createCells() {
@@ -21,15 +21,12 @@ class MultiTable extends PureComponent {
21
21
  const prevTable = tables[tableIndex - 1] ? tables[tableIndex - 1].props : null;
22
22
  let newSelection = currentTable.selection.moveUp();
23
23
  if (newSelection) {
24
- var _currentTable$onSelec;
25
- (_currentTable$onSelec = currentTable.onSelect) === null || _currentTable$onSelec === void 0 ? void 0 : _currentTable$onSelec.call(currentTable, newSelection);
24
+ currentTable.onSelect?.(newSelection);
26
25
  } else if (prevTable) {
27
- var _currentTable$onSelec2;
28
- (_currentTable$onSelec2 = currentTable.onSelect) === null || _currentTable$onSelec2 === void 0 ? void 0 : _currentTable$onSelec2.call(currentTable, currentTable.selection.resetFocus());
26
+ currentTable.onSelect?.(currentTable.selection.resetFocus());
29
27
  newSelection = prevTable.selection.moveUp();
30
28
  if (newSelection) {
31
- var _prevTable$onSelect;
32
- (_prevTable$onSelect = prevTable.onSelect) === null || _prevTable$onSelect === void 0 ? void 0 : _prevTable$onSelect.call(prevTable, newSelection);
29
+ prevTable.onSelect?.(newSelection);
33
30
  }
34
31
  }
35
32
  return false;
@@ -50,15 +47,12 @@ class MultiTable extends PureComponent {
50
47
  const nextTable = tables[tableIndex + 1] ? tables[tableIndex + 1].props : null;
51
48
  let newSelection = currentTable.selection.moveDown();
52
49
  if (newSelection) {
53
- var _currentTable$onSelec3;
54
- (_currentTable$onSelec3 = currentTable.onSelect) === null || _currentTable$onSelec3 === void 0 ? void 0 : _currentTable$onSelec3.call(currentTable, newSelection);
50
+ currentTable.onSelect?.(newSelection);
55
51
  } else if (nextTable) {
56
- var _currentTable$onSelec4;
57
- (_currentTable$onSelec4 = currentTable.onSelect) === null || _currentTable$onSelec4 === void 0 ? void 0 : _currentTable$onSelec4.call(currentTable, currentTable.selection.resetFocus());
52
+ currentTable.onSelect?.(currentTable.selection.resetFocus());
58
53
  newSelection = nextTable.selection.moveDown();
59
54
  if (newSelection) {
60
- var _nextTable$onSelect;
61
- (_nextTable$onSelect = nextTable.onSelect) === null || _nextTable$onSelect === void 0 ? void 0 : _nextTable$onSelect.call(nextTable, newSelection);
55
+ nextTable.onSelect?.(newSelection);
62
56
  }
63
57
  }
64
58
  return false;
@@ -108,8 +102,7 @@ class MultiTable extends PureComponent {
108
102
  const currentSelections = this.props.children.map(element => element.props.selection);
109
103
  const currentFocused = currentSelections.filter(selection => selection.getFocused());
110
104
  if (currentFocused.includes(prevFocused)) {
111
- var _prevProps$children$p, _prevProps$children$p2;
112
- (_prevProps$children$p = (_prevProps$children$p2 = prevProps.children[prevFocusedIndex].props).onSelect) === null || _prevProps$children$p === void 0 ? void 0 : _prevProps$children$p.call(_prevProps$children$p2, prevFocused.resetFocus());
105
+ prevProps.children[prevFocusedIndex].props.onSelect?.(prevFocused.resetFocus());
113
106
  }
114
107
  }
115
108
  }
@@ -50,20 +50,16 @@ class RowWithFocusSensorCallbacks extends PureComponent {
50
50
  super(...arguments);
51
51
  _defineProperty(this, "RowWithFocusSensor", getContainer());
52
52
  _defineProperty(this, "onFocus", () => {
53
- var _this$props$onFocus, _this$props;
54
- (_this$props$onFocus = (_this$props = this.props).onFocus) === null || _this$props$onFocus === void 0 ? void 0 : _this$props$onFocus.call(_this$props, this.props.item);
53
+ this.props.onFocus?.(this.props.item);
55
54
  });
56
55
  _defineProperty(this, "onSelect", (item, selected) => {
57
- var _this$props$onSelect, _this$props2;
58
- (_this$props$onSelect = (_this$props2 = this.props).onSelect) === null || _this$props$onSelect === void 0 ? void 0 : _this$props$onSelect.call(_this$props2, item, selected);
56
+ this.props.onSelect?.(item, selected);
59
57
  });
60
58
  _defineProperty(this, "onCollapse", () => {
61
- var _this$props$onCollaps, _this$props3;
62
- (_this$props$onCollaps = (_this$props3 = this.props).onCollapse) === null || _this$props$onCollaps === void 0 ? void 0 : _this$props$onCollaps.call(_this$props3, this.props.item);
59
+ this.props.onCollapse?.(this.props.item);
63
60
  });
64
61
  _defineProperty(this, "onExpand", () => {
65
- var _this$props$onExpand, _this$props4;
66
- (_this$props$onExpand = (_this$props4 = this.props).onExpand) === null || _this$props$onExpand === void 0 ? void 0 : _this$props$onExpand.call(_this$props4, this.props.item);
62
+ this.props.onExpand?.(this.props.item);
67
63
  });
68
64
  }
69
65
  render() {
@@ -30,7 +30,7 @@ function selectionShortcutsHOC(ComposedComponent) {
30
30
  } = this.props;
31
31
  const newSelection = selection.moveUp();
32
32
  if (newSelection) {
33
- onSelect === null || onSelect === void 0 ? void 0 : onSelect(newSelection);
33
+ onSelect?.(newSelection);
34
34
  }
35
35
  return false;
36
36
  });
@@ -41,7 +41,7 @@ function selectionShortcutsHOC(ComposedComponent) {
41
41
  } = this.props;
42
42
  const newSelection = selection.moveDown();
43
43
  if (newSelection) {
44
- onSelect === null || onSelect === void 0 ? void 0 : onSelect(newSelection);
44
+ onSelect?.(newSelection);
45
45
  }
46
46
  return false;
47
47
  });
@@ -76,9 +76,9 @@ function selectionShortcutsHOC(ComposedComponent) {
76
76
  const newSelection = this.shiftSelect(selection);
77
77
  const newMovedSelection = newSelection.moveUp();
78
78
  if (newMovedSelection) {
79
- onSelect === null || onSelect === void 0 ? void 0 : onSelect(newMovedSelection);
79
+ onSelect?.(newMovedSelection);
80
80
  } else {
81
- onSelect === null || onSelect === void 0 ? void 0 : onSelect(newSelection);
81
+ onSelect?.(newSelection);
82
82
  }
83
83
  });
84
84
  _defineProperty(this, "onShiftDownPress", e => {
@@ -94,9 +94,9 @@ function selectionShortcutsHOC(ComposedComponent) {
94
94
  const newSelection = this.shiftSelect(selection);
95
95
  const newMovedSelection = newSelection.moveDown();
96
96
  if (newMovedSelection) {
97
- onSelect === null || onSelect === void 0 ? void 0 : onSelect(newMovedSelection);
97
+ onSelect?.(newMovedSelection);
98
98
  } else {
99
- onSelect === null || onSelect === void 0 ? void 0 : onSelect(newSelection);
99
+ onSelect?.(newSelection);
100
100
  }
101
101
  });
102
102
  _defineProperty(this, "onHomePress", () => {
@@ -106,7 +106,7 @@ function selectionShortcutsHOC(ComposedComponent) {
106
106
  } = this.props;
107
107
  const newSelection = selection.moveStart();
108
108
  if (newSelection) {
109
- onSelect === null || onSelect === void 0 ? void 0 : onSelect(newSelection);
109
+ onSelect?.(newSelection);
110
110
  }
111
111
  return false;
112
112
  });
@@ -117,7 +117,7 @@ function selectionShortcutsHOC(ComposedComponent) {
117
117
  } = this.props;
118
118
  const newSelection = selection.moveEnd();
119
119
  if (newSelection) {
120
- onSelect === null || onSelect === void 0 ? void 0 : onSelect(newSelection);
120
+ onSelect?.(newSelection);
121
121
  }
122
122
  return false;
123
123
  });
@@ -130,7 +130,7 @@ function selectionShortcutsHOC(ComposedComponent) {
130
130
  if (!selectable) {
131
131
  return true;
132
132
  }
133
- onSelect === null || onSelect === void 0 ? void 0 : onSelect(selection.toggleSelection());
133
+ onSelect?.(selection.toggleSelection());
134
134
  return false;
135
135
  });
136
136
  _defineProperty(this, "onEscPress", () => {
@@ -138,7 +138,7 @@ function selectionShortcutsHOC(ComposedComponent) {
138
138
  selection,
139
139
  onSelect
140
140
  } = this.props;
141
- onSelect === null || onSelect === void 0 ? void 0 : onSelect(selection.reset());
141
+ onSelect?.(selection.reset());
142
142
  //this.restoreFocusWithoutScroll();
143
143
  });
144
144
  _defineProperty(this, "onCmdAPress", () => {
@@ -150,7 +150,7 @@ function selectionShortcutsHOC(ComposedComponent) {
150
150
  if (!selectable) {
151
151
  return true;
152
152
  }
153
- onSelect === null || onSelect === void 0 ? void 0 : onSelect(selection.selectAll());
153
+ onSelect?.(selection.selectAll());
154
154
  return false;
155
155
  });
156
156
  _defineProperty(this, "shortcutsMap", {
@@ -206,7 +206,7 @@ const CollapsibleTabs = _ref => {
206
206
  const measureTask = fastdom.measure(() => {
207
207
  var _container$children;
208
208
  const container = measureRef.current;
209
- const descendants = [...((_container$children = container === null || container === void 0 ? void 0 : container.children) !== null && _container$children !== void 0 ? _container$children : [])];
209
+ const descendants = [...((_container$children = container?.children) !== null && _container$children !== void 0 ? _container$children : [])];
210
210
  const moreButton = descendants.pop();
211
211
  let moreButtonWidth = moreButton.offsetWidth;
212
212
  const {
@@ -8,7 +8,6 @@ import { m as modules_02138f4a } from '../_helpers/tabs.js';
8
8
  import TabLink from './tab-link.js';
9
9
  import CollapsibleTabs from './collapsible-tabs.js';
10
10
  import { CustomItem } from './custom-item.js';
11
- export { CustomItem } from './custom-item.js';
12
11
  import '../link/link.js';
13
12
  import 'focus-visible';
14
13
  import '../link/clickableLink.js';
@@ -148,4 +147,4 @@ _defineProperty(Tabs, "defaultProps", {
148
147
  onSelect() {}
149
148
  });
150
149
 
151
- export { Tabs as default };
150
+ export { CustomItem, Tabs as default };
package/dist/tag/tag.js CHANGED
@@ -46,8 +46,7 @@ class Tag extends PureComponent {
46
46
  });
47
47
  }
48
48
  if (this.state.focused) {
49
- var _this$tagNode;
50
- (_this$tagNode = this.tagNode) === null || _this$tagNode === void 0 ? void 0 : _this$tagNode.focus();
49
+ this.tagNode?.focus();
51
50
  }
52
51
  this.setDocumentClickListener(this.state.focused);
53
52
  }
@@ -110,17 +110,15 @@ class TagsInput extends PureComponent {
110
110
  _defineProperty(this, "input", void 0);
111
111
  _defineProperty(this, "caret", void 0);
112
112
  _defineProperty(this, "focusInput", () => {
113
- var _this$getInputNode;
114
- (_this$getInputNode = this.getInputNode()) === null || _this$getInputNode === void 0 ? void 0 : _this$getInputNode.focus();
113
+ this.getInputNode()?.focus();
115
114
  });
116
115
  _defineProperty(this, "addTag", tag => {
117
- var _this$select, _this$select2;
118
116
  if (tag == null) {
119
117
  return;
120
118
  }
121
119
  const isUniqueTag = this.state.tags.filter(item => tag.key === item.key).length === 0;
122
- (_this$select = this.select) === null || _this$select === void 0 ? void 0 : _this$select.clear();
123
- (_this$select2 = this.select) === null || _this$select2 === void 0 ? void 0 : _this$select2.filterValue('');
120
+ this.select?.clear();
121
+ this.select?.filterValue('');
124
122
  if (isUniqueTag) {
125
123
  this.setState(prevState => ({
126
124
  tags: prevState.tags.concat([tag])
@@ -132,11 +130,10 @@ class TagsInput extends PureComponent {
132
130
  }
133
131
  });
134
132
  _defineProperty(this, "clickHandler", event => {
135
- var _this$select3;
136
133
  if (event.target !== this.node && event.target.parentElement !== this.node) {
137
134
  return;
138
135
  }
139
- (_this$select3 = this.select) === null || _this$select3 === void 0 ? void 0 : _this$select3._clickHandler();
136
+ this.select?._clickHandler();
140
137
  });
141
138
  _defineProperty(this, "filterExistingTags", suggestions => {
142
139
  const tagsMap = new Map(this.state.tags.map(tag => [tag.key, tag]));
@@ -191,22 +188,20 @@ class TagsInput extends PureComponent {
191
188
  }
192
189
  });
193
190
  _defineProperty(this, "handleKeyDown", event => {
194
- var _this$select4, _this$select4$_popup;
195
191
  const key = getEventKey(event);
196
192
  const isInputFocused = () => {
197
- var _this$getInputNode$ta, _this$getInputNode2;
198
- return event.target instanceof Element && event.target.matches((_this$getInputNode$ta = (_this$getInputNode2 = this.getInputNode()) === null || _this$getInputNode2 === void 0 ? void 0 : _this$getInputNode2.tagName) !== null && _this$getInputNode$ta !== void 0 ? _this$getInputNode$ta : '');
193
+ var _this$getInputNode$ta;
194
+ return event.target instanceof Element && event.target.matches((_this$getInputNode$ta = this.getInputNode()?.tagName) !== null && _this$getInputNode$ta !== void 0 ? _this$getInputNode$ta : '');
199
195
  };
200
196
  if (key === ' ' && this.props.allowAddNewTags) {
201
- var _this$getInputNode3;
202
197
  event.stopPropagation();
203
- const value = (_this$getInputNode3 = this.getInputNode()) === null || _this$getInputNode3 === void 0 ? void 0 : _this$getInputNode3.value;
198
+ const value = this.getInputNode()?.value;
204
199
  if (value != null && value !== '') {
205
200
  this.handleTagCreation(value);
206
201
  }
207
202
  return true;
208
203
  }
209
- if ((_this$select4 = this.select) !== null && _this$select4 !== void 0 && (_this$select4$_popup = _this$select4._popup) !== null && _this$select4$_popup !== void 0 && _this$select4$_popup.isVisible()) {
204
+ if (this.select?._popup?.isVisible()) {
210
205
  return true;
211
206
  }
212
207
  if (key === 'ArrowLeft') {
@@ -219,8 +214,7 @@ class TagsInput extends PureComponent {
219
214
  if (key === 'ArrowRight' && !isInputFocused()) {
220
215
  if (this.state.activeIndex === this.state.tags.length - 1) {
221
216
  if (!this.props.disabled) {
222
- var _this$getInputNode4;
223
- (_this$getInputNode4 = this.getInputNode()) === null || _this$getInputNode4 === void 0 ? void 0 : _this$getInputNode4.focus();
217
+ this.getInputNode()?.focus();
224
218
  this.setActiveIndex();
225
219
  }
226
220
  } else {
@@ -229,12 +223,10 @@ class TagsInput extends PureComponent {
229
223
  return false;
230
224
  }
231
225
  if (!this.props.disabled) {
232
- var _this$getInputNode5;
233
- if (key === 'Backspace' && !((_this$getInputNode5 = this.getInputNode()) !== null && _this$getInputNode5 !== void 0 && _this$getInputNode5.value)) {
234
- var _this$select5;
226
+ if (key === 'Backspace' && !this.getInputNode()?.value) {
235
227
  event.preventDefault();
236
228
  const tagsLength = this.state.tags.length;
237
- (_this$select5 = this.select) === null || _this$select5 === void 0 ? void 0 : _this$select5._hidePopup(true); // otherwise confirmation may be overlapped by popup
229
+ this.select?._hidePopup(true); // otherwise confirmation may be overlapped by popup
238
230
  this.onRemoveTag(this.state.tags[tagsLength - 1]);
239
231
  return false;
240
232
  }
@@ -281,16 +273,14 @@ class TagsInput extends PureComponent {
281
273
  }
282
274
  componentDidMount() {
283
275
  if (this.props.autoOpen && !this.props.disabled) {
284
- var _this$select6;
285
276
  this.focusInput();
286
277
  this.loadSuggestions();
287
- (_this$select6 = this.select) === null || _this$select6 === void 0 ? void 0 : _this$select6._showPopup();
278
+ this.select?._showPopup();
288
279
  }
289
280
  }
290
281
  getInputNode() {
291
282
  if (!this.input) {
292
- var _this$select7;
293
- this.input = (_this$select7 = this.select) === null || _this$select7 === void 0 ? void 0 : _this$select7.filter;
283
+ this.input = this.select?.filter;
294
284
  if (this.input) {
295
285
  this.caret = new Caret(this.input);
296
286
  }
@@ -53,7 +53,6 @@ class Tooltip extends Component {
53
53
  }
54
54
  });
55
55
  _defineProperty(this, "showPopup", () => {
56
- var _this$context;
57
56
  if (this.props.selfOverflowOnly) {
58
57
  const {
59
58
  containerNode
@@ -73,15 +72,14 @@ class Tooltip extends Component {
73
72
  return;
74
73
  }
75
74
  }
76
- (_this$context = this.context) === null || _this$context === void 0 ? void 0 : _this$context.onNestedTooltipShow();
75
+ this.context?.onNestedTooltipShow();
77
76
  this.setState({
78
77
  showPopup: true
79
78
  });
80
79
  });
81
80
  _defineProperty(this, "hidePopup", () => {
82
- var _this$context2;
83
81
  clearTimeout(this.timeout);
84
- (_this$context2 = this.context) === null || _this$context2 === void 0 ? void 0 : _this$context2.onNestedTooltipHide();
82
+ this.context?.onNestedTooltipHide();
85
83
  this.setState({
86
84
  showPopup: false
87
85
  });