@homecode/ui 4.22.11 → 4.22.12
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.
|
@@ -215,6 +215,7 @@ class Popup extends Component {
|
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
217
|
}, 100);
|
|
218
|
+
isControllable = () => typeof this.props.isOpen === 'boolean';
|
|
218
219
|
isLastClickInside = () => this.pointerDownTarget &&
|
|
219
220
|
(this.pointerDownTarget.closest(`.${S.trigger}`) ||
|
|
220
221
|
this.pointerDownTarget.closest(`.${S.content}`));
|
|
@@ -273,12 +274,14 @@ class Popup extends Component {
|
|
|
273
274
|
onFocus = e => {
|
|
274
275
|
this.focused = true;
|
|
275
276
|
this.props.triggerProps?.onFocus?.(e);
|
|
276
|
-
if (!this.pointerPressed)
|
|
277
|
+
if (!this.pointerPressed && (!this.isControllable() || this.props.isOpen))
|
|
277
278
|
this.open();
|
|
278
279
|
};
|
|
279
280
|
onBlur = e => {
|
|
280
281
|
this.focused = false;
|
|
281
282
|
this.props.triggerProps?.onBlur?.(e);
|
|
283
|
+
if (this.isControllable() && this.props.isOpen)
|
|
284
|
+
return;
|
|
282
285
|
// give time to fire clicks inside popup
|
|
283
286
|
this.timers.after(60, () => {
|
|
284
287
|
if (!this.isLastClickInside())
|
|
@@ -54,6 +54,7 @@ export declare class Popup extends Component<T.Props> {
|
|
|
54
54
|
updateOffset: () => void;
|
|
55
55
|
applyOffset(): void;
|
|
56
56
|
checkHover: any;
|
|
57
|
+
isControllable: () => boolean;
|
|
57
58
|
isLastClickInside: () => any;
|
|
58
59
|
onDocPointerDown: (e: PointerEvent) => void;
|
|
59
60
|
onDocPointerUp: (e: PointerEvent) => void;
|