@bpmn-io/properties-panel 3.3.1 → 3.3.2
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.
- package/dist/index.esm.js +25 -16
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +25 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -245,18 +245,25 @@ function Tooltip(props) {
|
|
|
245
245
|
parent
|
|
246
246
|
} = props;
|
|
247
247
|
const [visible, setShow] = useState(false);
|
|
248
|
+
const [focusedViaKeyboard, setFocusedViaKeyboard] = useState(false);
|
|
248
249
|
let timeout = null;
|
|
249
250
|
const wrapperRef = useRef(null);
|
|
250
251
|
const tooltipRef = useRef(null);
|
|
251
252
|
const showTooltip = async event => {
|
|
252
|
-
const show = () =>
|
|
253
|
-
if (
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
253
|
+
const show = () => setShow(true);
|
|
254
|
+
if (!visible && !timeout) {
|
|
255
|
+
if (event instanceof MouseEvent) {
|
|
256
|
+
timeout = setTimeout(show, 200);
|
|
257
|
+
} else {
|
|
258
|
+
show();
|
|
259
|
+
setFocusedViaKeyboard(true);
|
|
260
|
+
}
|
|
257
261
|
}
|
|
258
262
|
};
|
|
259
|
-
const hideTooltip = () =>
|
|
263
|
+
const hideTooltip = () => {
|
|
264
|
+
setShow(false);
|
|
265
|
+
setFocusedViaKeyboard(false);
|
|
266
|
+
};
|
|
260
267
|
const hideTooltipViaEscape = e => {
|
|
261
268
|
e.code === 'Escape' && hideTooltip();
|
|
262
269
|
};
|
|
@@ -280,7 +287,7 @@ function Tooltip(props) {
|
|
|
280
287
|
if (visible && !isTooltipHovered({
|
|
281
288
|
x: e.x,
|
|
282
289
|
y: e.y
|
|
283
|
-
}) && !isFocused) {
|
|
290
|
+
}) && !(isFocused && focusedViaKeyboard)) {
|
|
284
291
|
hideTooltip();
|
|
285
292
|
}
|
|
286
293
|
};
|
|
@@ -288,8 +295,8 @@ function Tooltip(props) {
|
|
|
288
295
|
const {
|
|
289
296
|
relatedTarget
|
|
290
297
|
} = e;
|
|
291
|
-
const isTooltipChild = el =>
|
|
292
|
-
if (visible && !isHovered(wrapperRef.current) && !isTooltipChild(relatedTarget)) {
|
|
298
|
+
const isTooltipChild = el => !!el.closest('.bio-properties-panel-tooltip');
|
|
299
|
+
if (visible && !isHovered(wrapperRef.current) && relatedTarget && !isTooltipChild(relatedTarget)) {
|
|
293
300
|
hideTooltip();
|
|
294
301
|
}
|
|
295
302
|
};
|
|
@@ -301,7 +308,7 @@ function Tooltip(props) {
|
|
|
301
308
|
document.removeEventListener('mousemove', hideHoveredTooltip);
|
|
302
309
|
document.removeEventListener('focusout', hideFocusedTooltip);
|
|
303
310
|
};
|
|
304
|
-
}, [wrapperRef.current, visible]);
|
|
311
|
+
}, [wrapperRef.current, visible, focusedViaKeyboard]);
|
|
305
312
|
const renderTooltip = () => {
|
|
306
313
|
return jsxs("div", {
|
|
307
314
|
class: "bio-properties-panel-tooltip",
|
|
@@ -324,12 +331,12 @@ function Tooltip(props) {
|
|
|
324
331
|
tabIndex: "0",
|
|
325
332
|
ref: wrapperRef,
|
|
326
333
|
onMouseEnter: showTooltip,
|
|
327
|
-
onMouseLeave: () =>
|
|
334
|
+
onMouseLeave: () => {
|
|
335
|
+
clearTimeout(timeout);
|
|
336
|
+
timeout = null;
|
|
337
|
+
},
|
|
328
338
|
onFocus: showTooltip,
|
|
329
339
|
onKeyDown: hideTooltipViaEscape,
|
|
330
|
-
onMouseDown: e => {
|
|
331
|
-
e.preventDefault();
|
|
332
|
-
},
|
|
333
340
|
children: [props.children, visible ? parent ? createPortal(renderTooltip(), parent.current) : renderTooltip() : null]
|
|
334
341
|
});
|
|
335
342
|
}
|
|
@@ -675,7 +682,8 @@ function Group(props) {
|
|
|
675
682
|
class: classnames('bio-properties-panel-group-header', edited ? '' : 'empty', open ? 'open' : '', sticky && open ? 'sticky' : ''),
|
|
676
683
|
onClick: toggleOpen,
|
|
677
684
|
children: [jsx("div", {
|
|
678
|
-
title: label,
|
|
685
|
+
title: props.tooltip ? null : label,
|
|
686
|
+
"data-title": label,
|
|
679
687
|
class: "bio-properties-panel-group-header-title",
|
|
680
688
|
children: jsx(TooltipWrapper, {
|
|
681
689
|
value: props.tooltip,
|
|
@@ -3000,7 +3008,8 @@ function ListGroup(props) {
|
|
|
3000
3008
|
class: classnames('bio-properties-panel-group-header', hasItems ? '' : 'empty', hasItems && open ? 'open' : '', sticky && open ? 'sticky' : ''),
|
|
3001
3009
|
onClick: hasItems ? toggleOpen : noop$1,
|
|
3002
3010
|
children: [jsx("div", {
|
|
3003
|
-
title: label,
|
|
3011
|
+
title: props.tooltip ? null : label,
|
|
3012
|
+
"data-title": label,
|
|
3004
3013
|
class: "bio-properties-panel-group-header-title",
|
|
3005
3014
|
children: jsx(TooltipWrapper, {
|
|
3006
3015
|
value: props.tooltip,
|