@jetbrains/ring-ui-built 6.0.55 → 6.0.57

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.
@@ -241,7 +241,10 @@ var Auth = /*#__PURE__*/function () {
241
241
  }
242
242
  if (this.config.reloadOnUserChange) {
243
243
  this.addListener(USER_CHANGED_EVENT, function () {
244
- return _this._reloadCurrentPage();
244
+ // Timeout is needed to ensure all other listeners triggered before stopping current page
245
+ setTimeout(function () {
246
+ return _this._reloadCurrentPage();
247
+ });
245
248
  });
246
249
  }
247
250
  this.addListener(LOGOUT_POSTPONED_EVENT, function () {
@@ -21,6 +21,7 @@ export interface DialogProps extends Partial<TabTrapProps> {
21
21
  dense?: boolean | null | undefined;
22
22
  native?: boolean;
23
23
  modal?: boolean;
24
+ preventBodyScroll?: boolean;
24
25
  }
25
26
  export default class Dialog extends PureComponent<DialogProps> {
26
27
  static propTypes: {
@@ -41,6 +42,7 @@ export default class Dialog extends PureComponent<DialogProps> {
41
42
  portalTarget: PropTypes.Requireable<HTMLElement>;
42
43
  autoFocusFirst: PropTypes.Requireable<boolean>;
43
44
  'data-test': PropTypes.Requireable<string>;
45
+ preventBodyScroll: PropTypes.Requireable<boolean>;
44
46
  };
45
47
  static defaultProps: Partial<DialogProps>;
46
48
  state: {
@@ -60,7 +60,7 @@ import '../global/controls-height.js';
60
60
  import '../_helpers/button__classes.js';
61
61
  import 'scrollbar-width';
62
62
 
63
- var _excluded = ["show", "showCloseButton", "onOverlayClick", "onCloseAttempt", "onEscPress", "onCloseClick", "children", "className", "contentClassName", "trapFocus", "data-test", "closeButtonInside", "portalTarget", "label", "closeButtonTitle", "dense", "shortcutOptions", "native", "modal"];
63
+ var _excluded = ["show", "showCloseButton", "onOverlayClick", "onCloseAttempt", "onEscPress", "onCloseClick", "children", "className", "contentClassName", "trapFocus", "data-test", "closeButtonInside", "portalTarget", "label", "closeButtonTitle", "dense", "shortcutOptions", "native", "modal", "preventBodyScroll"];
64
64
  function noop() {}
65
65
  var Dialog = /*#__PURE__*/function (_PureComponent) {
66
66
  function Dialog() {
@@ -149,6 +149,9 @@ var Dialog = /*#__PURE__*/function (_PureComponent) {
149
149
  }, {
150
150
  key: "toggleScrollPreventer",
151
151
  value: function toggleScrollPreventer() {
152
+ if (!this.props.preventBodyScroll) {
153
+ return;
154
+ }
152
155
  if (this.props.show) {
153
156
  this.scrollPreventer.prevent();
154
157
  } else {
@@ -179,6 +182,7 @@ var Dialog = /*#__PURE__*/function (_PureComponent) {
179
182
  _this$props4.shortcutOptions;
180
183
  var native = _this$props4.native;
181
184
  _this$props4.modal;
185
+ _this$props4.preventBodyScroll;
182
186
  var restProps = _objectWithoutProperties(_this$props4, _excluded);
183
187
  var classes = classNames(modules_5e9b8c03.container, className);
184
188
  var shortcutsMap = this.getShortcutsMap();
@@ -269,7 +273,8 @@ _defineProperty(Dialog, "propTypes", {
269
273
  trapFocus: PropTypes.bool,
270
274
  portalTarget: PropTypes.instanceOf(HTMLElement),
271
275
  autoFocusFirst: PropTypes.bool,
272
- 'data-test': PropTypes.string
276
+ 'data-test': PropTypes.string,
277
+ preventBodyScroll: PropTypes.bool
273
278
  });
274
279
  _defineProperty(Dialog, "defaultProps", {
275
280
  label: 'Dialog',
@@ -284,7 +289,8 @@ _defineProperty(Dialog, "defaultProps", {
284
289
  },
285
290
  trapFocus: false,
286
291
  autoFocusFirst: true,
287
- modal: true
292
+ modal: true,
293
+ preventBodyScroll: true
288
294
  });
289
295
 
290
296
  export { Dialog as default };
@@ -213,6 +213,9 @@ export default class Select<T = unknown> extends Component<SelectProps<T>, Selec
213
213
  shortcutsScope: string;
214
214
  listId: string;
215
215
  private _focusHandler;
216
+ isClickingSelect: boolean;
217
+ mouseDownHandler: () => void;
218
+ mouseUpHandler: () => void;
216
219
  private _blurHandler;
217
220
  node?: HTMLElement | null;
218
221
  nodeRef: (el: HTMLElement | null) => void;
@@ -307,10 +307,17 @@ var Select = /*#__PURE__*/function (_Component) {
307
307
  focused: true
308
308
  });
309
309
  });
310
+ _defineProperty(_this, "isClickingSelect", false);
311
+ _defineProperty(_this, "mouseDownHandler", function () {
312
+ _this.isClickingSelect = true;
313
+ });
314
+ _defineProperty(_this, "mouseUpHandler", function () {
315
+ _this.isClickingSelect = false;
316
+ });
310
317
  _defineProperty(_this, "_blurHandler", function () {
311
318
  var _this$_popup;
312
319
  _this.props.onBlur();
313
- if (_this._popup && _this._popup.isVisible() && !_this._popup.isClickingPopup) {
320
+ if (_this._popup && _this._popup.isVisible() && !_this._popup.isClickingPopup && !_this.isClickingSelect) {
314
321
  window.setTimeout(function () {
315
322
  _this.setState({
316
323
  showPopup: false
@@ -1012,6 +1019,10 @@ var Select = /*#__PURE__*/function (_Component) {
1012
1019
  ref: this.nodeRef,
1013
1020
  className: classNames(classes, modules_9d0de074.inputMode),
1014
1021
  "data-test": joinDataTestAttributes('ring-select', dataTest),
1022
+ role: "presentation" // has interactive elements inside
1023
+ ,
1024
+ onMouseDown: this.mouseDownHandler,
1025
+ onMouseUp: this.mouseUpHandler,
1015
1026
  children: [shortcutsEnabled && /*#__PURE__*/jsx(Shortcuts, {
1016
1027
  map: this.getShortcutsMap(),
1017
1028
  scope: this.shortcutsScope
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetbrains/ring-ui-built",
3
- "version": "6.0.55",
3
+ "version": "6.0.57",
4
4
  "description": "JetBrains UI library",
5
5
  "author": "JetBrains",
6
6
  "license": "Apache-2.0",