@jetbrains/ring-ui 6.0.63 → 6.0.64
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.
|
@@ -28,7 +28,8 @@ export default function focusSensorHOC(ComposedComponent) {
|
|
|
28
28
|
}
|
|
29
29
|
componentDidUpdate(prevProps) {
|
|
30
30
|
const { focused } = this.props;
|
|
31
|
-
|
|
31
|
+
const isInFocus = this.node?.contains(document.activeElement);
|
|
32
|
+
if (focused && (!isInFocus || !prevProps.focused)) {
|
|
32
33
|
this.onFocusRestore();
|
|
33
34
|
}
|
|
34
35
|
else if (!focused && prevProps.focused) {
|
|
@@ -53,7 +53,6 @@ export interface PopupProps extends BasePopupProps {
|
|
|
53
53
|
}
|
|
54
54
|
interface PopupState {
|
|
55
55
|
display: Display;
|
|
56
|
-
client?: boolean;
|
|
57
56
|
direction?: Directions;
|
|
58
57
|
}
|
|
59
58
|
/**
|
|
@@ -98,7 +97,6 @@ export default class Popup<P extends BasePopupProps = PopupProps> extends PureCo
|
|
|
98
97
|
uid: string;
|
|
99
98
|
calculateDisplay: (prevState: PopupState) => {
|
|
100
99
|
display: Display;
|
|
101
|
-
client?: boolean;
|
|
102
100
|
direction?: Directions;
|
|
103
101
|
};
|
|
104
102
|
static PopupProps: {
|
|
@@ -120,6 +118,7 @@ export default class Popup<P extends BasePopupProps = PopupProps> extends PureCo
|
|
|
120
118
|
private _redraw;
|
|
121
119
|
private _getAnchor;
|
|
122
120
|
private _listenersEnabled?;
|
|
121
|
+
private _prevTimeout?;
|
|
123
122
|
/**
|
|
124
123
|
* @param {boolean} enable
|
|
125
124
|
* @private
|
|
@@ -71,9 +71,6 @@ export default class Popup extends PureComponent {
|
|
|
71
71
|
display: Display.SHOWING
|
|
72
72
|
};
|
|
73
73
|
componentDidMount() {
|
|
74
|
-
if (!this.props.client) {
|
|
75
|
-
this.setState({ client: true });
|
|
76
|
-
}
|
|
77
74
|
if (!this.props.hidden) {
|
|
78
75
|
this._setListenersEnabled(true);
|
|
79
76
|
}
|
|
@@ -195,13 +192,15 @@ export default class Popup extends PureComponent {
|
|
|
195
192
|
return this.props.anchorElement || this.parent;
|
|
196
193
|
}
|
|
197
194
|
_listenersEnabled;
|
|
195
|
+
_prevTimeout;
|
|
198
196
|
/**
|
|
199
197
|
* @param {boolean} enable
|
|
200
198
|
* @private
|
|
201
199
|
*/
|
|
202
200
|
_setListenersEnabled(enable) {
|
|
203
201
|
if (enable && !this._listenersEnabled) {
|
|
204
|
-
|
|
202
|
+
clearTimeout(this._prevTimeout);
|
|
203
|
+
this._prevTimeout = window.setTimeout(() => {
|
|
205
204
|
this._listenersEnabled = true;
|
|
206
205
|
this.listeners.add(window, 'resize', this._redraw);
|
|
207
206
|
if (this.props.autoPositioningOnScroll) {
|
|
@@ -218,6 +217,7 @@ export default class Popup extends PureComponent {
|
|
|
218
217
|
}
|
|
219
218
|
if (!enable && this._listenersEnabled) {
|
|
220
219
|
this.listeners.removeAll();
|
|
220
|
+
clearTimeout(this._prevTimeout);
|
|
221
221
|
this._listenersEnabled = false;
|
|
222
222
|
}
|
|
223
223
|
}
|
|
@@ -283,7 +283,7 @@ export default class Popup extends PureComponent {
|
|
|
283
283
|
{this.shouldUseShortcuts() &&
|
|
284
284
|
(<Shortcuts map={this.shortcutsMap} scope={this.shortcutsScope}/>)}
|
|
285
285
|
|
|
286
|
-
{
|
|
286
|
+
{client !== false && (keepMounted || !hidden) && createPortal(<PopupTarget id={this.uid} ref={this.containerRef} onMouseOver={onMouseOver} onFocus={onMouseOver} onMouseOut={onMouseOut} onBlur={onMouseOut} onContextMenu={onContextMenu}>
|
|
287
287
|
<div data-test={dataTests('ring-popup', dataTest)} data-test-shown={!hidden && !showing} data-test-direction={direction} ref={this.popupRef} className={classes} style={style} onMouseDown={onMouseDown} onMouseUp={onMouseUp}
|
|
288
288
|
// mouse handlers are used to track clicking on inner elements
|
|
289
289
|
role="presentation">
|