@neo4j-ndl/react-graph 1.3.9 → 1.3.11

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.
@@ -22,35 +22,34 @@ const jsx_runtime_1 = require("react/jsx-runtime");
22
22
  * You should have received a copy of the GNU General Public License
23
23
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
24
24
  */
25
- const re_resizable_1 = require("re-resizable");
25
+ const react_1 = require("@neo4j-ndl/react");
26
26
  const GraphVisualizationSidepanel = ({ sidepanel, }) => {
27
- const { children, isSidePanelOpen, sidePanelWidth, onSidePanelResize, minWidth = 230, } = sidepanel;
27
+ const { children, isSidePanelOpen, setIsSidePanelOpen, sidePanelWidth, onSidePanelResize, minWidth = 230, } = sidepanel;
28
28
  if (!isSidePanelOpen) {
29
29
  return null;
30
30
  }
31
- return ((0, jsx_runtime_1.jsx)(re_resizable_1.Resizable, { defaultSize: {
32
- height: '100%',
33
- width: sidePanelWidth !== null && sidePanelWidth !== void 0 ? sidePanelWidth : 400,
34
- }, className: "ndl-graph-resizable", minWidth: minWidth, maxWidth: "66%", enable: {
35
- bottom: false,
36
- bottomLeft: false,
37
- bottomRight: false,
38
- left: true,
39
- right: false,
40
- top: false,
41
- topLeft: false,
42
- topRight: false,
43
- }, handleClasses: { left: 'ndl-sidepanel-handle' }, onResizeStop: (_e, _dir, ref) => {
44
- onSidePanelResize(ref.getBoundingClientRect().width);
45
- }, children: (0, jsx_runtime_1.jsx)("div", { className: "ndl-graph-visualization-sidepanel-content", tabIndex: 0, children: children }) }));
31
+ return ((0, jsx_runtime_1.jsx)(react_1.Drawer, { className: "ndl-graph-visualization-drawer", isExpanded: isSidePanelOpen, onExpandedChange: (expanded) => {
32
+ setIsSidePanelOpen === null || setIsSidePanelOpen === void 0 ? void 0 : setIsSidePanelOpen(expanded);
33
+ }, position: "right", type: "push", isResizeable: true, isCloseable: false, resizeableProps: {
34
+ bounds: 'window',
35
+ defaultSize: {
36
+ height: '100%',
37
+ width: sidePanelWidth !== null && sidePanelWidth !== void 0 ? sidePanelWidth : 400,
38
+ },
39
+ maxWidth: 600,
40
+ minWidth,
41
+ onResizeStop: (_e, _dir, ref) => {
42
+ onSidePanelResize(ref.getBoundingClientRect().width);
43
+ },
44
+ }, children: (0, jsx_runtime_1.jsx)("div", { className: "ndl-graph-visualization-sidepanel-wrapper", children: children }) }));
46
45
  };
47
46
  exports.GraphVisualizationSidepanel = GraphVisualizationSidepanel;
48
47
  const Title = ({ children }) => {
49
- return ((0, jsx_runtime_1.jsx)("div", { className: "ndl-graph-visualization-sidepanel-title ndl-grid-area-title", children: children }));
48
+ return ((0, jsx_runtime_1.jsx)(react_1.Drawer.Header, { className: "ndl-graph-visualization-sidepanel-title", children: children }));
50
49
  };
51
50
  exports.GraphVisualizationSidepanel.Title = Title;
52
51
  const Content = ({ children }) => {
53
- return (0, jsx_runtime_1.jsx)("section", { className: "ndl-grid-area-content", children: children });
52
+ return ((0, jsx_runtime_1.jsx)(react_1.Drawer.Body, { className: "ndl-graph-visualization-sidepanel-content", children: children }));
54
53
  };
55
54
  exports.GraphVisualizationSidepanel.Content = Content;
56
55
  //# sourceMappingURL=graph-visualization-sidepanel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"graph-visualization-sidepanel.js","sourceRoot":"","sources":["../../src/graph-visualization-sidepanel.tsx"],"names":[],"mappings":";;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,+CAAyC;AAIlC,MAAM,2BAA2B,GAAG,CAAC,EAC1C,SAAS,GAGV,EAAE,EAAE;IACH,MAAM,EACJ,QAAQ,EACR,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,QAAQ,GAAG,GAAG,GACf,GAAG,SAAS,CAAC;IAEd,IAAI,CAAC,eAAe,EAAE,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CACL,uBAAC,wBAAS,IACR,WAAW,EAAE;YACX,MAAM,EAAE,MAAM;YACd,KAAK,EAAE,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,GAAG;SAC7B,EACD,SAAS,EAAC,qBAAqB,EAC/B,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAC,KAAK,EACd,MAAM,EAAE;YACN,MAAM,EAAE,KAAK;YACb,UAAU,EAAE,KAAK;YACjB,WAAW,EAAE,KAAK;YAClB,IAAI,EAAE,IAAI;YACV,KAAK,EAAE,KAAK;YACZ,GAAG,EAAE,KAAK;YACV,OAAO,EAAE,KAAK;YACd,QAAQ,EAAE,KAAK;SAChB,EACD,aAAa,EAAE,EAAE,IAAI,EAAE,sBAAsB,EAAE,EAC/C,YAAY,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;YAC9B,iBAAiB,CAAC,GAAG,CAAC,qBAAqB,EAAE,CAAC,KAAK,CAAC,CAAC;QACvD,CAAC,YAGD,gCAAK,SAAS,EAAC,2CAA2C,EAAC,QAAQ,EAAE,CAAC,YACnE,QAAQ,GACL,GACI,CACb,CAAC;AACJ,CAAC,CAAC;AA/CW,QAAA,2BAA2B,+BA+CtC;AAEF,MAAM,KAAK,GAAG,CAAC,EAAE,QAAQ,EAAiC,EAAE,EAAE;IAC5D,OAAO,CACL,gCAAK,SAAS,EAAC,6DAA6D,YACzE,QAAQ,GACL,CACP,CAAC;AACJ,CAAC,CAAC;AACF,mCAA2B,CAAC,KAAK,GAAG,KAAK,CAAC;AAE1C,MAAM,OAAO,GAAG,CAAC,EAAE,QAAQ,EAAiC,EAAE,EAAE;IAC9D,OAAO,oCAAS,SAAS,EAAC,uBAAuB,YAAE,QAAQ,GAAW,CAAC;AACzE,CAAC,CAAC;AACF,mCAA2B,CAAC,OAAO,GAAG,OAAO,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { Resizable } from 're-resizable';\n\nimport { type Sidepanel } from './graph-visualization-context';\n\nexport const GraphVisualizationSidepanel = ({\n sidepanel,\n}: {\n sidepanel: Sidepanel;\n}) => {\n const {\n children,\n isSidePanelOpen,\n sidePanelWidth,\n onSidePanelResize,\n minWidth = 230,\n } = sidepanel;\n\n if (!isSidePanelOpen) {\n return null;\n }\n\n return (\n <Resizable\n defaultSize={{\n height: '100%',\n width: sidePanelWidth ?? 400,\n }}\n className=\"ndl-graph-resizable\"\n minWidth={minWidth}\n maxWidth=\"66%\"\n enable={{\n bottom: false,\n bottomLeft: false,\n bottomRight: false,\n left: true,\n right: false,\n top: false,\n topLeft: false,\n topRight: false,\n }}\n handleClasses={{ left: 'ndl-sidepanel-handle' }}\n onResizeStop={(_e, _dir, ref) => {\n onSidePanelResize(ref.getBoundingClientRect().width);\n }}\n >\n {/* eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex */}\n <div className=\"ndl-graph-visualization-sidepanel-content\" tabIndex={0}>\n {children}\n </div>\n </Resizable>\n );\n};\n\nconst Title = ({ children }: { children: React.ReactNode }) => {\n return (\n <div className=\"ndl-graph-visualization-sidepanel-title ndl-grid-area-title\">\n {children}\n </div>\n );\n};\nGraphVisualizationSidepanel.Title = Title;\n\nconst Content = ({ children }: { children: React.ReactNode }) => {\n return <section className=\"ndl-grid-area-content\">{children}</section>;\n};\nGraphVisualizationSidepanel.Content = Content;\n"]}
1
+ {"version":3,"file":"graph-visualization-sidepanel.js","sourceRoot":"","sources":["../../src/graph-visualization-sidepanel.tsx"],"names":[],"mappings":";;;;AAAA;;;;;;;;;;;;;;;;;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C,KAAK,GAAG,KAAK,CAAC;AAE1C,MAAM,OAAO,GAAG,CAAC,EAAE,QAAQ,EAAiC,EAAE,EAAE;IAC9D,OAAO,CACL,uBAAC,cAAM,CAAC,IAAI,IAAC,SAAS,EAAC,2CAA2C,YAC/D,QAAQ,GACG,CACf,CAAC;AACJ,CAAC,CAAC;AACF,mCAA2B,CAAC,OAAO,GAAG,OAAO,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { Drawer } from '@neo4j-ndl/react';\n\nimport { type Sidepanel } from './graph-visualization-context';\n\nexport const GraphVisualizationSidepanel = ({\n sidepanel,\n}: {\n sidepanel: Sidepanel;\n}) => {\n const {\n children,\n isSidePanelOpen,\n setIsSidePanelOpen,\n sidePanelWidth,\n onSidePanelResize,\n minWidth = 230,\n } = sidepanel;\n\n if (!isSidePanelOpen) {\n return null;\n }\n\n return (\n <Drawer\n className=\"ndl-graph-visualization-drawer\"\n isExpanded={isSidePanelOpen}\n onExpandedChange={(expanded) => {\n setIsSidePanelOpen?.(expanded);\n }}\n position=\"right\"\n type=\"push\"\n isResizeable\n isCloseable={false}\n resizeableProps={{\n bounds: 'window',\n defaultSize: {\n height: '100%',\n width: sidePanelWidth ?? 400,\n },\n maxWidth: 600,\n minWidth,\n onResizeStop: (_e, _dir, ref) => {\n onSidePanelResize(ref.getBoundingClientRect().width);\n },\n }}\n >\n <div className=\"ndl-graph-visualization-sidepanel-wrapper\">\n {children}\n </div>\n </Drawer>\n );\n};\n\nconst Title = ({ children }: { children: React.ReactNode }) => {\n return (\n <Drawer.Header className=\"ndl-graph-visualization-sidepanel-title\">\n {children}\n </Drawer.Header>\n );\n};\nGraphVisualizationSidepanel.Title = Title;\n\nconst Content = ({ children }: { children: React.ReactNode }) => {\n return (\n <Drawer.Body className=\"ndl-graph-visualization-sidepanel-content\">\n {children}\n </Drawer.Body>\n );\n};\nGraphVisualizationSidepanel.Content = Content;\n"]}
@@ -61,17 +61,17 @@ const rels = [
61
61
  exports.containerClasses = 'n-w-full n-border-neutral-border-weak n-mx-2 n-rounded-lg n-border';
62
62
  const Component = () => {
63
63
  const [gesture, setGesture] = (0, react_2.useState)('box');
64
- return ((0, jsx_runtime_1.jsx)("div", { style: { height: '600px' }, children: (0, jsx_runtime_1.jsx)(graph_visualization_1.GraphVisualization, { gesture: gesture, setGesture: setGesture, bottomLeftIsland: (0, jsx_runtime_1.jsxs)(react_1.IconButtonArray, { size: "small", children: [(0, jsx_runtime_1.jsx)(graph_visualization_1.GraphVisualization.LassoSelectButton, {}), (0, jsx_runtime_1.jsx)(graph_visualization_1.GraphVisualization.SingleSelectButton, {}), (0, jsx_runtime_1.jsx)(graph_visualization_1.GraphVisualization.BoxSelectButton, {})] }), bottomRightIsland: (0, jsx_runtime_1.jsx)("div", { children: "\u2198\uFE0F" }), nodes: nodes, rels: rels, sidepanel: {
65
- children: (0, jsx_runtime_1.jsx)("div", { children: "Custom panel contents" }),
66
- isSidePanelOpen: true,
64
+ const [isSidePanelOpen, setIsSidePanelOpen] = (0, react_2.useState)(false);
65
+ const [search, setSearch] = (0, react_2.useState)('');
66
+ return ((0, jsx_runtime_1.jsx)("div", { style: { height: '600px' }, children: (0, jsx_runtime_1.jsx)(graph_visualization_1.GraphVisualization, { gesture: gesture, setGesture: setGesture, bottomLeftIsland: (0, jsx_runtime_1.jsx)("div", { children: "\u2199\uFE0F" }), bottomRightIsland: (0, jsx_runtime_1.jsxs)(react_1.IconButtonArray, { size: "small", children: [(0, jsx_runtime_1.jsx)(graph_visualization_1.GraphVisualization.LassoSelectButton, {}), (0, jsx_runtime_1.jsx)(graph_visualization_1.GraphVisualization.SingleSelectButton, {}), (0, jsx_runtime_1.jsx)(graph_visualization_1.GraphVisualization.BoxSelectButton, {})] }), nodes: nodes, rels: rels, sidepanel: {
67
+ children: ((0, jsx_runtime_1.jsx)(react_1.TextInput, { label: "Search in custom panel", value: search, onChange: (e) => setSearch(e.target.value) })),
68
+ isSidePanelOpen,
69
+ setIsSidePanelOpen,
67
70
  onSidePanelResize: () => {
68
71
  /* no op */
69
72
  },
70
- setIsSidePanelOpen: () => {
71
- /* no op */
72
- },
73
73
  sidePanelWidth: 300,
74
- }, topLeftIsland: (0, jsx_runtime_1.jsx)("div", { children: "\u2196\uFE0F" }), topRightIsland: (0, jsx_runtime_1.jsx)("div", { children: "\u2197\uFE0F" }), className: exports.containerClasses }) }));
74
+ }, topLeftIsland: (0, jsx_runtime_1.jsx)("div", { children: "\u2196\uFE0F" }), topRightIsland: (0, jsx_runtime_1.jsx)(graph_visualization_1.GraphVisualization.ToggleSidePanelButton, {}), className: exports.containerClasses }) }));
75
75
  };
76
76
  exports.default = Component;
77
77
  //# sourceMappingURL=graph-visualization-custom.story.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"graph-visualization-custom.story.js","sourceRoot":"","sources":["../../../src/stories/graph-visualization-custom.story.tsx"],"names":[],"mappings":";;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,4CAAmD;AACnD,iCAAiC;AAEjC,gEAA4D;AAG5D,MAAM,KAAK,GAAc;IACvB;QACE,EAAE,EAAE,OAAO;QACX,MAAM,EAAE,CAAC,SAAS,EAAE,WAAW,CAAC;QAChC,UAAU,EAAE,EAAE;KACf;IACD;QACE,EAAE,EAAE,OAAO;QACX,MAAM,EAAE,CAAC,MAAM,CAAC;QAChB,UAAU,EAAE,EAAE,IAAI,EAAE,EAAE,WAAW,EAAE,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,GAAG,EAAE;oBACvB,WAAW;gBACb,CAAC;gBACD,cAAc,EAAE,GAAG;aACpB,EACD,aAAa,EAAE,2DAAa,EAC5B,cAAc,EAAE,2DAAa,EAC7B,SAAS,EAAE,wBAAgB,GAC3B,GACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { IconButtonArray } from '@neo4j-ndl/react';\nimport { useState } from 'react';\n\nimport { GraphVisualization } from '../graph-visualization';\nimport { type Gesture, type NeoNode } from '../graph-visualization-context';\n\nconst nodes: NeoNode[] = [\n {\n id: 'node1',\n labels: ['Pokemon', 'Legendary'],\n properties: {},\n },\n {\n id: 'node2',\n labels: ['Type'],\n properties: { name: { stringified: 'Dragon', type: 'String' } },\n },\n {\n id: 'node3',\n labels: ['Type'],\n properties: { name: { stringified: 'Flying', type: 'String' } },\n },\n];\n\nconst rels = [\n {\n from: 'node1',\n id: 'rel1',\n properties: {},\n to: 'node2',\n type: 'HAS_TYPE',\n },\n {\n from: 'node1',\n id: 'rel2',\n properties: {},\n to: 'node3',\n type: 'HAS_TYPE',\n },\n];\nexport const containerClasses =\n 'n-w-full n-border-neutral-border-weak n-mx-2 n-rounded-lg n-border';\n\nconst Component = () => {\n const [gesture, setGesture] = useState<Gesture>('box');\n\n return (\n <div style={{ height: '600px' }}>\n <GraphVisualization\n gesture={gesture}\n setGesture={setGesture}\n bottomLeftIsland={\n <IconButtonArray size=\"small\">\n <GraphVisualization.LassoSelectButton />\n <GraphVisualization.SingleSelectButton />\n <GraphVisualization.BoxSelectButton />\n </IconButtonArray>\n }\n bottomRightIsland={<div>↘️</div>}\n nodes={nodes}\n rels={rels}\n sidepanel={{\n children: <div>Custom panel contents</div>,\n isSidePanelOpen: true,\n onSidePanelResize: () => {\n /* no op */\n },\n setIsSidePanelOpen: () => {\n /* no op */\n },\n sidePanelWidth: 300,\n }}\n topLeftIsland={<div>↖️</div>}\n topRightIsland={<div>↗️</div>}\n className={containerClasses}\n />\n </div>\n );\n};\n\nexport default Component;\n"]}
1
+ {"version":3,"file":"graph-visualization-custom.story.js","sourceRoot":"","sources":["../../../src/stories/graph-visualization-custom.story.tsx"],"names":[],"mappings":";;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,4CAA8D;AAC9D,iCAAiC;AAEjC,gEAA4D;AAG5D,MAAM,KAAK,GAAc;IACvB;QACE,EAAE,EAAE,OAAO;QACX,MAAM,EAAE,CAAC,SAAS,EAAE,WAAW,CAAC;QAChC,UAAU,EAAE,EAAE;KACf;IACD;QACE,EAAE,EAAE,OAAO;QACX,MAAM,EAAE,CAAC,MAAM,CAAC;QAChB,UAAU,EAAE,EAAE,IAAI,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;KAChE;IACD;QACE,EAAE,EAAE,OAAO;QACX,MAAM,EAAE,CAAC,MAAM,CAAC;QAChB,UAAU,EAAE,EAAE,IAAI,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;KAChE;CACF,CAAC;AAEF,MAAM,IAAI,GAAG;IACX;QACE,IAAI,EAAE,OAAO;QACb,EAAE,EAAE,MAAM;QACV,UAAU,EAAE,EAAE;QACd,EAAE,EAAE,OAAO;QACX,IAAI,EAAE,UAAU;KACjB;IACD;QACE,IAAI,EAAE,OAAO;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AC,wCAAkB,CAAC,qBAAqB,KAAG,EAC5D,SAAS,EAAE,wBAAgB,GAC3B,GACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { IconButtonArray, TextInput } from '@neo4j-ndl/react';\nimport { useState } from 'react';\n\nimport { GraphVisualization } from '../graph-visualization';\nimport { type Gesture, type NeoNode } from '../graph-visualization-context';\n\nconst nodes: NeoNode[] = [\n {\n id: 'node1',\n labels: ['Pokemon', 'Legendary'],\n properties: {},\n },\n {\n id: 'node2',\n labels: ['Type'],\n properties: { name: { stringified: 'Dragon', type: 'String' } },\n },\n {\n id: 'node3',\n labels: ['Type'],\n properties: { name: { stringified: 'Flying', type: 'String' } },\n },\n];\n\nconst rels = [\n {\n from: 'node1',\n id: 'rel1',\n properties: {},\n to: 'node2',\n type: 'HAS_TYPE',\n },\n {\n from: 'node1',\n id: 'rel2',\n properties: {},\n to: 'node3',\n type: 'HAS_TYPE',\n },\n];\nexport const containerClasses =\n 'n-w-full n-border-neutral-border-weak n-mx-2 n-rounded-lg n-border';\n\nconst Component = () => {\n const [gesture, setGesture] = useState<Gesture>('box');\n const [isSidePanelOpen, setIsSidePanelOpen] = useState(false);\n const [search, setSearch] = useState('');\n\n return (\n <div style={{ height: '600px' }}>\n <GraphVisualization\n gesture={gesture}\n setGesture={setGesture}\n bottomLeftIsland={<div>↙️</div>}\n bottomRightIsland={\n <IconButtonArray size=\"small\">\n <GraphVisualization.LassoSelectButton />\n <GraphVisualization.SingleSelectButton />\n <GraphVisualization.BoxSelectButton />\n </IconButtonArray>\n }\n nodes={nodes}\n rels={rels}\n sidepanel={{\n children: (\n <TextInput\n label=\"Search in custom panel\"\n value={search}\n onChange={(e) => setSearch(e.target.value)}\n />\n ),\n isSidePanelOpen,\n setIsSidePanelOpen,\n onSidePanelResize: () => {\n /* no op */\n },\n sidePanelWidth: 300,\n }}\n topLeftIsland={<div>↖️</div>}\n topRightIsland={<GraphVisualization.ToggleSidePanelButton />}\n className={containerClasses}\n />\n </div>\n );\n};\n\nexport default Component;\n"]}
@@ -19,34 +19,33 @@ import { jsx as _jsx } from "react/jsx-runtime";
19
19
  * You should have received a copy of the GNU General Public License
20
20
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
21
21
  */
22
- import { Resizable } from 're-resizable';
22
+ import { Drawer } from '@neo4j-ndl/react';
23
23
  export const GraphVisualizationSidepanel = ({ sidepanel, }) => {
24
- const { children, isSidePanelOpen, sidePanelWidth, onSidePanelResize, minWidth = 230, } = sidepanel;
24
+ const { children, isSidePanelOpen, setIsSidePanelOpen, sidePanelWidth, onSidePanelResize, minWidth = 230, } = sidepanel;
25
25
  if (!isSidePanelOpen) {
26
26
  return null;
27
27
  }
28
- return (_jsx(Resizable, { defaultSize: {
29
- height: '100%',
30
- width: sidePanelWidth !== null && sidePanelWidth !== void 0 ? sidePanelWidth : 400,
31
- }, className: "ndl-graph-resizable", minWidth: minWidth, maxWidth: "66%", enable: {
32
- bottom: false,
33
- bottomLeft: false,
34
- bottomRight: false,
35
- left: true,
36
- right: false,
37
- top: false,
38
- topLeft: false,
39
- topRight: false,
40
- }, handleClasses: { left: 'ndl-sidepanel-handle' }, onResizeStop: (_e, _dir, ref) => {
41
- onSidePanelResize(ref.getBoundingClientRect().width);
42
- }, children: _jsx("div", { className: "ndl-graph-visualization-sidepanel-content", tabIndex: 0, children: children }) }));
28
+ return (_jsx(Drawer, { className: "ndl-graph-visualization-drawer", isExpanded: isSidePanelOpen, onExpandedChange: (expanded) => {
29
+ setIsSidePanelOpen === null || setIsSidePanelOpen === void 0 ? void 0 : setIsSidePanelOpen(expanded);
30
+ }, position: "right", type: "push", isResizeable: true, isCloseable: false, resizeableProps: {
31
+ bounds: 'window',
32
+ defaultSize: {
33
+ height: '100%',
34
+ width: sidePanelWidth !== null && sidePanelWidth !== void 0 ? sidePanelWidth : 400,
35
+ },
36
+ maxWidth: 600,
37
+ minWidth,
38
+ onResizeStop: (_e, _dir, ref) => {
39
+ onSidePanelResize(ref.getBoundingClientRect().width);
40
+ },
41
+ }, children: _jsx("div", { className: "ndl-graph-visualization-sidepanel-wrapper", children: children }) }));
43
42
  };
44
43
  const Title = ({ children }) => {
45
- return (_jsx("div", { className: "ndl-graph-visualization-sidepanel-title ndl-grid-area-title", children: children }));
44
+ return (_jsx(Drawer.Header, { className: "ndl-graph-visualization-sidepanel-title", children: children }));
46
45
  };
47
46
  GraphVisualizationSidepanel.Title = Title;
48
47
  const Content = ({ children }) => {
49
- return _jsx("section", { className: "ndl-grid-area-content", children: children });
48
+ return (_jsx(Drawer.Body, { className: "ndl-graph-visualization-sidepanel-content", children: children }));
50
49
  };
51
50
  GraphVisualizationSidepanel.Content = Content;
52
51
  //# sourceMappingURL=graph-visualization-sidepanel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"graph-visualization-sidepanel.js","sourceRoot":"","sources":["../../src/graph-visualization-sidepanel.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAIzC,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,EAC1C,SAAS,GAGV,EAAE,EAAE;IACH,MAAM,EACJ,QAAQ,EACR,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,QAAQ,GAAG,GAAG,GACf,GAAG,SAAS,CAAC;I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* Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { Resizable } from 're-resizable';\n\nimport { type Sidepanel } from './graph-visualization-context';\n\nexport const GraphVisualizationSidepanel = ({\n sidepanel,\n}: {\n sidepanel: Sidepanel;\n}) => {\n const {\n children,\n isSidePanelOpen,\n sidePanelWidth,\n onSidePanelResize,\n minWidth = 230,\n } = sidepanel;\n\n if (!isSidePanelOpen) {\n return null;\n }\n\n return (\n <Resizable\n defaultSize={{\n height: '100%',\n width: sidePanelWidth ?? 400,\n }}\n className=\"ndl-graph-resizable\"\n minWidth={minWidth}\n maxWidth=\"66%\"\n enable={{\n bottom: false,\n bottomLeft: false,\n bottomRight: false,\n left: true,\n right: false,\n top: false,\n topLeft: false,\n topRight: false,\n }}\n handleClasses={{ left: 'ndl-sidepanel-handle' }}\n onResizeStop={(_e, _dir, ref) => {\n onSidePanelResize(ref.getBoundingClientRect().width);\n }}\n >\n {/* eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex */}\n <div className=\"ndl-graph-visualization-sidepanel-content\" tabIndex={0}>\n {children}\n </div>\n </Resizable>\n );\n};\n\nconst Title = ({ children }: { children: React.ReactNode }) => {\n return (\n <div className=\"ndl-graph-visualization-sidepanel-title ndl-grid-area-title\">\n {children}\n </div>\n );\n};\nGraphVisualizationSidepanel.Title = Title;\n\nconst Content = ({ children }: { children: React.ReactNode }) => {\n return <section className=\"ndl-grid-area-content\">{children}</section>;\n};\nGraphVisualizationSidepanel.Content = Content;\n"]}
1
+ {"version":3,"file":"graph-visualization-sidepanel.js","sourceRoot":"","sources":["../../src/graph-visualization-sidepanel.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAI1C,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,EAC1C,SAAS,GAGV,EAAE,EAAE;IACH,MAAM,EACJ,QAAQ,EACR,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,QAAQ,GAAG,GAAG,GACf,GAAG,SAAS,CAAC;IAEd,IAAI,CAAC,eAAe,EAAE,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CACL,KAAC,MAAM,IACL,SAAS,EAAC,gCAAgC,EAC1C,UAAU,EAAE,eAAe,EAC3B,gBAAgB,EAAE,CAAC,QAAQ,EAAE,EAAE;YAC7B,kBAAkB,aAAlB,kBAAkB,uBAAlB,kBAAkB,CAAG,QAAQ,CAAC,CAAC;QACjC,CAAC,EACD,QAAQ,EAAC,OAAO,EAChB,IAAI,EAAC,MAAM,EACX,YAAY,QACZ,WAAW,EAAE,KAAK,EAClB,eAAe,EAAE;YACf,MAAM,EAAE,QAAQ;YAChB,WAAW,EAAE;gBACX,MAAM,EAAE,MAAM;gBACd,KAAK,EAAE,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,GAAG;aAC7B;YACD,QAAQ,EAAE,GAAG;YACb,QAAQ;YACR,YAAY,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;gBAC9B,iBAAiB,CAAC,GAAG,CAAC,qBAAqB,EAAE,CAAC,KAAK,CAAC,CAAC;YACvD,CAAC;SACF,YAED,cAAK,SAAS,EAAC,2CAA2C,YACvD,QAAQ,GACL,GACC,CACV,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,KAAK,GAAG,CAAC,EAAE,QAAQ,EAAiC,EAAE,EAAE;IAC5D,OAAO,CACL,KAAC,MAAM,CAAC,MAAM,IAAC,SAAS,EAAC,yCAAyC,YAC/D,QAAQ,GACK,CACjB,CAAC;AACJ,CAAC,CAAC;AACF,2BAA2B,CAAC,KAAK,GAAG,KAAK,CAAC;AAE1C,MAAM,OAAO,GAAG,CAAC,EAAE,QAAQ,EAAiC,EAAE,EAAE;IAC9D,OAAO,CACL,KAAC,MAAM,CAAC,IAAI,IAAC,SAAS,EAAC,2CAA2C,YAC/D,QAAQ,GACG,CACf,CAAC;AACJ,CAAC,CAAC;AACF,2BAA2B,CAAC,OAAO,GAAG,OAAO,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { Drawer } from '@neo4j-ndl/react';\n\nimport { type Sidepanel } from './graph-visualization-context';\n\nexport const GraphVisualizationSidepanel = ({\n sidepanel,\n}: {\n sidepanel: Sidepanel;\n}) => {\n const {\n children,\n isSidePanelOpen,\n setIsSidePanelOpen,\n sidePanelWidth,\n onSidePanelResize,\n minWidth = 230,\n } = sidepanel;\n\n if (!isSidePanelOpen) {\n return null;\n }\n\n return (\n <Drawer\n className=\"ndl-graph-visualization-drawer\"\n isExpanded={isSidePanelOpen}\n onExpandedChange={(expanded) => {\n setIsSidePanelOpen?.(expanded);\n }}\n position=\"right\"\n type=\"push\"\n isResizeable\n isCloseable={false}\n resizeableProps={{\n bounds: 'window',\n defaultSize: {\n height: '100%',\n width: sidePanelWidth ?? 400,\n },\n maxWidth: 600,\n minWidth,\n onResizeStop: (_e, _dir, ref) => {\n onSidePanelResize(ref.getBoundingClientRect().width);\n },\n }}\n >\n <div className=\"ndl-graph-visualization-sidepanel-wrapper\">\n {children}\n </div>\n </Drawer>\n );\n};\n\nconst Title = ({ children }: { children: React.ReactNode }) => {\n return (\n <Drawer.Header className=\"ndl-graph-visualization-sidepanel-title\">\n {children}\n </Drawer.Header>\n );\n};\nGraphVisualizationSidepanel.Title = Title;\n\nconst Content = ({ children }: { children: React.ReactNode }) => {\n return (\n <Drawer.Body className=\"ndl-graph-visualization-sidepanel-content\">\n {children}\n </Drawer.Body>\n );\n};\nGraphVisualizationSidepanel.Content = Content;\n"]}
@@ -19,7 +19,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
19
19
  * You should have received a copy of the GNU General Public License
20
20
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
21
21
  */
22
- import { IconButtonArray } from '@neo4j-ndl/react';
22
+ import { IconButtonArray, TextInput } from '@neo4j-ndl/react';
23
23
  import { useState } from 'react';
24
24
  import { GraphVisualization } from '../graph-visualization';
25
25
  const nodes = [
@@ -58,17 +58,17 @@ const rels = [
58
58
  export const containerClasses = 'n-w-full n-border-neutral-border-weak n-mx-2 n-rounded-lg n-border';
59
59
  const Component = () => {
60
60
  const [gesture, setGesture] = useState('box');
61
- return (_jsx("div", { style: { height: '600px' }, children: _jsx(GraphVisualization, { gesture: gesture, setGesture: setGesture, bottomLeftIsland: _jsxs(IconButtonArray, { size: "small", children: [_jsx(GraphVisualization.LassoSelectButton, {}), _jsx(GraphVisualization.SingleSelectButton, {}), _jsx(GraphVisualization.BoxSelectButton, {})] }), bottomRightIsland: _jsx("div", { children: "\u2198\uFE0F" }), nodes: nodes, rels: rels, sidepanel: {
62
- children: _jsx("div", { children: "Custom panel contents" }),
63
- isSidePanelOpen: true,
61
+ const [isSidePanelOpen, setIsSidePanelOpen] = useState(false);
62
+ const [search, setSearch] = useState('');
63
+ return (_jsx("div", { style: { height: '600px' }, children: _jsx(GraphVisualization, { gesture: gesture, setGesture: setGesture, bottomLeftIsland: _jsx("div", { children: "\u2199\uFE0F" }), bottomRightIsland: _jsxs(IconButtonArray, { size: "small", children: [_jsx(GraphVisualization.LassoSelectButton, {}), _jsx(GraphVisualization.SingleSelectButton, {}), _jsx(GraphVisualization.BoxSelectButton, {})] }), nodes: nodes, rels: rels, sidepanel: {
64
+ children: (_jsx(TextInput, { label: "Search in custom panel", value: search, onChange: (e) => setSearch(e.target.value) })),
65
+ isSidePanelOpen,
66
+ setIsSidePanelOpen,
64
67
  onSidePanelResize: () => {
65
68
  /* no op */
66
69
  },
67
- setIsSidePanelOpen: () => {
68
- /* no op */
69
- },
70
70
  sidePanelWidth: 300,
71
- }, topLeftIsland: _jsx("div", { children: "\u2196\uFE0F" }), topRightIsland: _jsx("div", { children: "\u2197\uFE0F" }), className: containerClasses }) }));
71
+ }, topLeftIsland: _jsx("div", { children: "\u2196\uFE0F" }), topRightIsland: _jsx(GraphVisualization.ToggleSidePanelButton, {}), className: containerClasses }) }));
72
72
  };
73
73
  export default Component;
74
74
  //# sourceMappingURL=graph-visualization-custom.story.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"graph-visualization-custom.story.js","sourceRoot":"","sources":["../../../src/stories/graph-visualization-custom.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAG5D,MAAM,KAAK,GAAc;IACvB;QACE,EAAE,EAAE,OAAO;QACX,MAAM,EAAE,CAAC,SAAS,EAAE,WAAW,CAAC;QAChC,UAAU,EAAE,EAAE;KACf;IACD;QACE,EAAE,EAAE,OAAO;QACX,MAAM,EAAE,CAAC,MAAM,CAAC;QAChB,UAAU,E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WAAW;gBACb,CAAC;gBACD,kBAAkB,EAAE,GAAG,EAAE;oBACvB,WAAW;gBACb,CAAC;gBACD,cAAc,EAAE,GAAG;aACpB,EACD,aAAa,EAAE,yCAAa,EAC5B,cAAc,EAAE,yCAAa,EAC7B,SAAS,EAAE,gBAAgB,GAC3B,GACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { IconButtonArray } from '@neo4j-ndl/react';\nimport { useState } from 'react';\n\nimport { GraphVisualization } from '../graph-visualization';\nimport { type Gesture, type NeoNode } from '../graph-visualization-context';\n\nconst nodes: NeoNode[] = [\n {\n id: 'node1',\n labels: ['Pokemon', 'Legendary'],\n properties: {},\n },\n {\n id: 'node2',\n labels: ['Type'],\n properties: { name: { stringified: 'Dragon', type: 'String' } },\n },\n {\n id: 'node3',\n labels: ['Type'],\n properties: { name: { stringified: 'Flying', type: 'String' } },\n },\n];\n\nconst rels = [\n {\n from: 'node1',\n id: 'rel1',\n properties: {},\n to: 'node2',\n type: 'HAS_TYPE',\n },\n {\n from: 'node1',\n id: 'rel2',\n properties: {},\n to: 'node3',\n type: 'HAS_TYPE',\n },\n];\nexport const containerClasses =\n 'n-w-full n-border-neutral-border-weak n-mx-2 n-rounded-lg n-border';\n\nconst Component = () => {\n const [gesture, setGesture] = useState<Gesture>('box');\n\n return (\n <div style={{ height: '600px' }}>\n <GraphVisualization\n gesture={gesture}\n setGesture={setGesture}\n bottomLeftIsland={\n <IconButtonArray size=\"small\">\n <GraphVisualization.LassoSelectButton />\n <GraphVisualization.SingleSelectButton />\n <GraphVisualization.BoxSelectButton />\n </IconButtonArray>\n }\n bottomRightIsland={<div>↘️</div>}\n nodes={nodes}\n rels={rels}\n sidepanel={{\n children: <div>Custom panel contents</div>,\n isSidePanelOpen: true,\n onSidePanelResize: () => {\n /* no op */\n },\n setIsSidePanelOpen: () => {\n /* no op */\n },\n sidePanelWidth: 300,\n }}\n topLeftIsland={<div>↖️</div>}\n topRightIsland={<div>↗️</div>}\n className={containerClasses}\n />\n </div>\n );\n};\n\nexport default Component;\n"]}
1
+ {"version":3,"file":"graph-visualization-custom.story.js","sourceRoot":"","sources":["../../../src/stories/graph-visualization-custom.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAG5D,MAAM,KAAK,GAAc;IACvB;QACE,EAAE,EAAE,OAAO;QACX,MAAM,EAAE,CAAC,SAAS,EAAE,WAAW,CAAC;QAChC,UAAU,EAAE,EAAE;KACf;IACD;QACE,EAAE,EAAE,OAAO;QACX,MAAM,EAAE,CAAC,MAAM,CAAC;QAChB,UAAU,EAAE,EAAE,IAAI,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;KAChE;IACD;QACE,EAAE,EAAE,OAAO;QACX,MAAM,EAAE,CAAC,MAAM,CAAC;QAChB,UAAU,EAAE,EAAE,IAAI,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;KAChE;CACF,CAAC;AAEF,MAAM,IAAI,GAAG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AClB,iBAAiB,EAAE,GAAG,EAAE;oBACtB,WAAW;gBACb,CAAC;gBACD,cAAc,EAAE,GAAG;aACpB,EACD,aAAa,EAAE,yCAAa,EAC5B,cAAc,EAAE,KAAC,kBAAkB,CAAC,qBAAqB,KAAG,EAC5D,SAAS,EAAE,gBAAgB,GAC3B,GACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { IconButtonArray, TextInput } from '@neo4j-ndl/react';\nimport { useState } from 'react';\n\nimport { GraphVisualization } from '../graph-visualization';\nimport { type Gesture, type NeoNode } from '../graph-visualization-context';\n\nconst nodes: NeoNode[] = [\n {\n id: 'node1',\n labels: ['Pokemon', 'Legendary'],\n properties: {},\n },\n {\n id: 'node2',\n labels: ['Type'],\n properties: { name: { stringified: 'Dragon', type: 'String' } },\n },\n {\n id: 'node3',\n labels: ['Type'],\n properties: { name: { stringified: 'Flying', type: 'String' } },\n },\n];\n\nconst rels = [\n {\n from: 'node1',\n id: 'rel1',\n properties: {},\n to: 'node2',\n type: 'HAS_TYPE',\n },\n {\n from: 'node1',\n id: 'rel2',\n properties: {},\n to: 'node3',\n type: 'HAS_TYPE',\n },\n];\nexport const containerClasses =\n 'n-w-full n-border-neutral-border-weak n-mx-2 n-rounded-lg n-border';\n\nconst Component = () => {\n const [gesture, setGesture] = useState<Gesture>('box');\n const [isSidePanelOpen, setIsSidePanelOpen] = useState(false);\n const [search, setSearch] = useState('');\n\n return (\n <div style={{ height: '600px' }}>\n <GraphVisualization\n gesture={gesture}\n setGesture={setGesture}\n bottomLeftIsland={<div>↙️</div>}\n bottomRightIsland={\n <IconButtonArray size=\"small\">\n <GraphVisualization.LassoSelectButton />\n <GraphVisualization.SingleSelectButton />\n <GraphVisualization.BoxSelectButton />\n </IconButtonArray>\n }\n nodes={nodes}\n rels={rels}\n sidepanel={{\n children: (\n <TextInput\n label=\"Search in custom panel\"\n value={search}\n onChange={(e) => setSearch(e.target.value)}\n />\n ),\n isSidePanelOpen,\n setIsSidePanelOpen,\n onSidePanelResize: () => {\n /* no op */\n },\n sidePanelWidth: 300,\n }}\n topLeftIsland={<div>↖️</div>}\n topRightIsland={<GraphVisualization.ToggleSidePanelButton />}\n className={containerClasses}\n />\n </div>\n );\n};\n\nexport default Component;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"graph-visualization-custom.story.d.ts","sourceRoot":"","sources":["../../../src/stories/graph-visualization-custom.story.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AA0CH,eAAO,MAAM,gBAAgB,uEACyC,CAAC;AAEvE,QAAA,MAAM,SAAS,+CAmCd,CAAC;AAEF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"graph-visualization-custom.story.d.ts","sourceRoot":"","sources":["../../../src/stories/graph-visualization-custom.story.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AA0CH,eAAO,MAAM,gBAAgB,uEACyC,CAAC;AAEvE,QAAA,MAAM,SAAS,+CAyCd,CAAC;AAEF,eAAe,SAAS,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neo4j-ndl/react-graph",
3
- "version": "1.3.9",
3
+ "version": "1.3.11",
4
4
  "sideEffects": false,
5
5
  "description": "React implementation of the graph visualization from Neo4j Design System",
6
6
  "keywords": [
@@ -56,8 +56,8 @@
56
56
  "@neo4j-nvl/base": "^1.0.0",
57
57
  "@neo4j-nvl/interaction-handlers": "^1.0.0",
58
58
  "@neo4j-nvl/react": "^1.0.0",
59
- "@neo4j-ndl/base": "^4.9.16",
60
- "@neo4j-ndl/react": "^4.9.34"
59
+ "@neo4j-ndl/base": "^4.9.17",
60
+ "@neo4j-ndl/react": "^4.9.36"
61
61
  },
62
62
  "dependencies": {
63
63
  "classnames": "2.5.1",