@pipelex/mthds-ui 0.43.0 → 0.44.0
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/{chunk-HPARBH6K.js → chunk-5E3UJI2I.js} +43 -12
- package/dist/chunk-5E3UJI2I.js.map +1 -0
- package/dist/graph/index.js +1 -1
- package/dist/graph/react/index.d.ts +5 -1
- package/dist/graph/react/index.js +12 -3
- package/dist/graph/react/index.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/standalone/graph-standalone.html +106 -106
- package/dist/standalone/graph-viewer.css +1 -1
- package/dist/standalone/graph-viewer.js +105 -105
- package/package.json +2 -2
- package/dist/chunk-HPARBH6K.js.map +0 -1
package/dist/graph/index.js
CHANGED
|
@@ -580,7 +580,11 @@ interface DetailPanelProps {
|
|
|
580
580
|
isDragging?: boolean;
|
|
581
581
|
/** Mouse-down handler for the resize handle. When provided, the handle is rendered. */
|
|
582
582
|
onResizeHandleMouseDown?: (e: React__default.MouseEvent) => void;
|
|
583
|
-
/**
|
|
583
|
+
/**
|
|
584
|
+
* Close panel on Escape key. Defaults to true. An Escape pressed while a
|
|
585
|
+
* dialog is open above the panel, such as the picture viewer a result opens,
|
|
586
|
+
* closes that dialog alone and leaves the panel open.
|
|
587
|
+
*/
|
|
584
588
|
closeOnEscape?: boolean;
|
|
585
589
|
}
|
|
586
590
|
declare function DetailPanel({ isOpen, onClose, children, width, isDragging, onResizeHandleMouseDown, closeOnEscape, }: DetailPanelProps): react_jsx_runtime.JSX.Element;
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
roundedPolylinePath,
|
|
28
28
|
routeLabelCenter,
|
|
29
29
|
validateGraphSpec
|
|
30
|
-
} from "../../chunk-
|
|
30
|
+
} from "../../chunk-5E3UJI2I.js";
|
|
31
31
|
import {
|
|
32
32
|
GRAPH_STYLES,
|
|
33
33
|
resolveGraphStyle,
|
|
@@ -196,6 +196,14 @@ function resultDescriptors(graph) {
|
|
|
196
196
|
// src/graph/react/detail/DetailPanel.tsx
|
|
197
197
|
import React2 from "react";
|
|
198
198
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
199
|
+
var DIALOG_LAYER_SELECTOR = 'dialog, [role="dialog"], [role="alertdialog"]';
|
|
200
|
+
function escapeBelongsAbove(event, panel) {
|
|
201
|
+
if (event.defaultPrevented) return true;
|
|
202
|
+
const target = event.target;
|
|
203
|
+
if (!(target instanceof Element)) return false;
|
|
204
|
+
const layer = target.closest(DIALOG_LAYER_SELECTOR);
|
|
205
|
+
return layer !== null && !(panel !== null && layer.contains(panel));
|
|
206
|
+
}
|
|
199
207
|
function DetailPanel({
|
|
200
208
|
isOpen,
|
|
201
209
|
onClose,
|
|
@@ -205,10 +213,11 @@ function DetailPanel({
|
|
|
205
213
|
onResizeHandleMouseDown,
|
|
206
214
|
closeOnEscape = true
|
|
207
215
|
}) {
|
|
216
|
+
const panelRef = React2.useRef(null);
|
|
208
217
|
React2.useEffect(() => {
|
|
209
218
|
if (!isOpen || !closeOnEscape) return;
|
|
210
219
|
const onKeyDown = (e) => {
|
|
211
|
-
if (e.key === "Escape") onClose();
|
|
220
|
+
if (e.key === "Escape" && !escapeBelongsAbove(e, panelRef.current)) onClose();
|
|
212
221
|
};
|
|
213
222
|
document.addEventListener("keydown", onKeyDown);
|
|
214
223
|
return () => document.removeEventListener("keydown", onKeyDown);
|
|
@@ -218,7 +227,7 @@ function DetailPanel({
|
|
|
218
227
|
!isOpen && "detail-panel--closed",
|
|
219
228
|
isDragging && "detail-panel--dragging"
|
|
220
229
|
].filter(Boolean).join(" ");
|
|
221
|
-
return /* @__PURE__ */ jsxs2("div", { className, style: width ? { width: `${width}px` } : void 0, children: [
|
|
230
|
+
return /* @__PURE__ */ jsxs2("div", { ref: panelRef, className, style: width ? { width: `${width}px` } : void 0, children: [
|
|
222
231
|
onResizeHandleMouseDown && /* @__PURE__ */ jsx2(
|
|
223
232
|
"div",
|
|
224
233
|
{
|