@truedat/core 8.12.11 → 8.12.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/core",
3
- "version": "8.12.11",
3
+ "version": "8.12.12",
4
4
  "description": "Truedat Web Core",
5
5
  "sideEffects": [
6
6
  "**/*.css",
@@ -57,7 +57,7 @@
57
57
  "@testing-library/jest-dom": "^6.6.3",
58
58
  "@testing-library/react": "^16.3.0",
59
59
  "@testing-library/user-event": "^14.6.1",
60
- "@truedat/test": "8.12.11",
60
+ "@truedat/test": "8.12.12",
61
61
  "identity-obj-proxy": "^3.0.0",
62
62
  "jest": "^29.7.0",
63
63
  "redux-saga-test-plan": "^4.0.6"
@@ -99,5 +99,5 @@
99
99
  "swr": "^2.3.3",
100
100
  "turndown": "^7.2.2"
101
101
  },
102
- "gitHead": "48671e0f1467f7713019ab8d729818c741fa9bc7"
102
+ "gitHead": "b6e3413dae81b2e28e98a21cf371174caa30ab4b"
103
103
  }
@@ -1671,37 +1671,44 @@ const LayoutFlow = ({
1671
1671
  />
1672
1672
  </button>
1673
1673
  </div>
1674
- {!isMinimapCollapsed ? (
1675
- <div className="td-graph-minimap-body">
1676
- <MiniMap
1677
- position="bottom-left"
1678
- pannable
1679
- zoomable
1680
- maskColor="rgba(15, 23, 42, 0.08)"
1681
- nodeColor={minimapNodeColor}
1682
- nodeStrokeColor="rgba(15, 23, 42, 0.12)"
1683
- className="td-graph-minimap"
1684
- />
1685
- <button
1686
- type="button"
1687
- className="td-graph-minimap-expand"
1688
- aria-label={
1689
- isMinimapExpanded ? "Reducir mini-mapa" : "Expandir mini-mapa"
1690
- }
1691
- onClick={(event) => {
1692
- event.stopPropagation();
1693
- setIsMinimapExpanded((prev) => !prev);
1694
- }}
1695
- onMouseDown={(event) => event.stopPropagation()}
1696
- >
1697
- {isMinimapExpanded ? (
1698
- <Minimize2 size={12} strokeWidth={2} />
1699
- ) : (
1700
- <Expand size={12} strokeWidth={2} />
1701
- )}
1702
- </button>
1703
- </div>
1704
- ) : null}
1674
+ <div
1675
+ className="td-graph-minimap-body"
1676
+ aria-hidden={isMinimapCollapsed}
1677
+ inert={isMinimapCollapsed}
1678
+ >
1679
+ <MiniMap
1680
+ position="bottom-left"
1681
+ pannable
1682
+ zoomable
1683
+ maskColor="rgba(15, 23, 42, 0.08)"
1684
+ nodeColor={minimapNodeColor}
1685
+ nodeStrokeColor="rgba(15, 23, 42, 0.12)"
1686
+ className="td-graph-minimap"
1687
+ style={
1688
+ isMinimapExpanded
1689
+ ? { width: 288, height: 200 }
1690
+ : { width: 200, height: 150 }
1691
+ }
1692
+ />
1693
+ <button
1694
+ type="button"
1695
+ className="td-graph-minimap-expand"
1696
+ aria-label={
1697
+ isMinimapExpanded ? "Reducir mini-mapa" : "Expandir mini-mapa"
1698
+ }
1699
+ onClick={(event) => {
1700
+ event.stopPropagation();
1701
+ setIsMinimapExpanded((prev) => !prev);
1702
+ }}
1703
+ onMouseDown={(event) => event.stopPropagation()}
1704
+ >
1705
+ {isMinimapExpanded ? (
1706
+ <Minimize2 size={12} strokeWidth={2} />
1707
+ ) : (
1708
+ <Expand size={12} strokeWidth={2} />
1709
+ )}
1710
+ </button>
1711
+ </div>
1705
1712
  </div>
1706
1713
  )}
1707
1714
  {bottomControls && (
@@ -61,6 +61,9 @@ jest.mock("@xyflow/react", () => ({
61
61
  {children}
62
62
  </button>
63
63
  ),
64
+ MiniMap: ({ style, className, ...props }) => (
65
+ <div data-testid="mini-map" className={className} style={style} />
66
+ ),
64
67
  Background: () => null,
65
68
  BackgroundVariant: {
66
69
  Dots: "dots",
@@ -286,4 +289,57 @@ describe("<Graph />", () => {
286
289
  expect(mockSetCenter).not.toHaveBeenCalled();
287
290
  expect(mockSetViewport).not.toHaveBeenCalled();
288
291
  });
292
+
293
+ describe("mini-map", () => {
294
+ const minimapProps = {
295
+ ...props,
296
+ graphOptions: {
297
+ minimapNodeColor: () => "#ffffff",
298
+ },
299
+ };
300
+
301
+ it("is not rendered without minimapNodeColor", () => {
302
+ render(<Graph {...props} />);
303
+
304
+ expect(screen.queryByTestId("mini-map")).not.toBeInTheDocument();
305
+ });
306
+
307
+ it("collapses and expands the shell from the header toggle", () => {
308
+ const { container } = render(<Graph {...minimapProps} />);
309
+
310
+ const shell = container.querySelector(".td-graph-minimap-shell");
311
+ const toggle = container.querySelector(".td-graph-minimap-toggle");
312
+ const body = container.querySelector(".td-graph-minimap-body");
313
+
314
+ expect(shell).not.toHaveClass("td-graph-minimap-shell--collapsed");
315
+ expect(toggle).toHaveAttribute("aria-expanded", "true");
316
+ expect(body).not.toHaveAttribute("inert");
317
+ expect(body).toHaveAttribute("aria-hidden", "false");
318
+
319
+ fireEvent.click(toggle);
320
+
321
+ expect(shell).toHaveClass("td-graph-minimap-shell--collapsed");
322
+ expect(toggle).toHaveAttribute("aria-expanded", "false");
323
+ expect(body).toHaveAttribute("inert");
324
+ expect(body).toHaveAttribute("aria-hidden", "true");
325
+ });
326
+
327
+ it("resizes the mini-map with the expand button", () => {
328
+ const { container } = render(<Graph {...minimapProps} />);
329
+
330
+ const expandButton = container.querySelector(".td-graph-minimap-expand");
331
+
332
+ expect(screen.getByTestId("mini-map")).toHaveStyle({
333
+ width: "200px",
334
+ height: "150px",
335
+ });
336
+
337
+ fireEvent.click(expandButton);
338
+
339
+ expect(screen.getByTestId("mini-map")).toHaveStyle({
340
+ width: "288px",
341
+ height: "200px",
342
+ });
343
+ });
344
+ });
289
345
  });
@@ -1,8 +1,3 @@
1
- .td-graph-minimap-shell--expanded .td-graph-minimap {
2
- width: 288px;
3
- height: 200px;
4
- }
5
-
6
1
  .td-graph__space-pan-active {
7
2
  .react-flow__node,
8
3
  .react-flow__node *,