@principal-ade/dynamic-file-tree 0.2.13 → 0.2.15

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.mjs CHANGED
@@ -1952,7 +1952,7 @@ var MultiFileTree = ({
1952
1952
  };
1953
1953
  // src/components/StoryboardWorkflowsTree/StoryboardWorkflowsTreeCore.tsx
1954
1954
  import { Package, FolderKanban, LayoutDashboard, Workflow, BookOpen, FolderOpen, GitCommit, ExternalLink, List, ListX, Eye as Eye2, EyeOff as EyeOff2 } from "lucide-react";
1955
- import React13, { useMemo as useMemo9, useRef as useRef5 } from "react";
1955
+ import React13, { useMemo as useMemo9, useRef as useRef5, useLayoutEffect } from "react";
1956
1956
  import { Tree as Tree3 } from "react-arborist";
1957
1957
 
1958
1958
  // src/utils/gitStatus.tsx
@@ -2483,9 +2483,9 @@ var StoryboardWorkflowsTreeCoreInner = ({
2483
2483
  onClick,
2484
2484
  selectedNodeId: _selectedNodeId,
2485
2485
  defaultOpen = false,
2486
- initialOpenState,
2487
- openState,
2488
- onToggle,
2486
+ initialOpenState: _initialOpenState,
2487
+ openState: _openState,
2488
+ onToggle: _onToggle,
2489
2489
  horizontalNodePadding = "16px",
2490
2490
  verticalNodePadding = "6px",
2491
2491
  verticalPadding = "20px",
@@ -2768,15 +2768,27 @@ var StoryboardWorkflowsTreeCoreInner = ({
2768
2768
  const initialHeight = 600;
2769
2769
  const [containerRef, containerHeight] = useContainerHeight(initialHeight);
2770
2770
  const treeRef = useRef5(null);
2771
- const handleToggle = (id) => {
2772
- if (onToggle && treeRef.current) {
2773
- const node = treeRef.current.get(id);
2774
- if (node) {
2775
- onToggle(id, node.isOpen);
2771
+ const scrollTopRef = useRef5(0);
2772
+ const listElementRef = useRef5(null);
2773
+ useLayoutEffect(() => {
2774
+ if (containerRef.current && !listElementRef.current) {
2775
+ const listElement = containerRef.current.querySelector('[role="tree"]')?.parentElement;
2776
+ if (listElement) {
2777
+ listElementRef.current = listElement;
2778
+ const handleScroll = () => {
2779
+ scrollTopRef.current = listElement.scrollTop;
2780
+ };
2781
+ listElement.addEventListener("scroll", handleScroll);
2782
+ return () => listElement.removeEventListener("scroll", handleScroll);
2776
2783
  }
2777
2784
  }
2778
- };
2779
- const effectiveInitialOpenState = openState ?? initialOpenState;
2785
+ return;
2786
+ });
2787
+ useLayoutEffect(() => {
2788
+ if (listElementRef.current && scrollTopRef.current > 0) {
2789
+ listElementRef.current.scrollTop = scrollTopRef.current;
2790
+ }
2791
+ });
2780
2792
  return /* @__PURE__ */ React13.createElement("div", {
2781
2793
  ref: containerRef,
2782
2794
  style: {
@@ -2791,8 +2803,6 @@ var StoryboardWorkflowsTreeCoreInner = ({
2791
2803
  initialData: treeData,
2792
2804
  onSelect: handleSelect,
2793
2805
  openByDefault: defaultOpen,
2794
- ...effectiveInitialOpenState !== undefined && { initialOpenState: effectiveInitialOpenState },
2795
- ...onToggle !== undefined && { onToggle: handleToggle },
2796
2806
  width: "100%",
2797
2807
  height: containerHeight,
2798
2808
  rowHeight,
@@ -1 +1 @@
1
- {"version":3,"file":"StoryboardWorkflowsTreeCore.d.ts","sourceRoot":"","sources":["../../../../src/components/StoryboardWorkflowsTree/StoryboardWorkflowsTreeCore.tsx"],"names":[],"mappings":"AACA,OAAO,KAA0B,MAAM,OAAO,CAAC;AAS/C,OAAO,KAAK,EAEV,4BAA4B,EAQ7B,MAAM,SAAS,CAAC;AAq8BjB,eAAO,MAAM,2BAA2B,0DA8BtC,CAAC"}
1
+ {"version":3,"file":"StoryboardWorkflowsTreeCore.d.ts","sourceRoot":"","sources":["../../../../src/components/StoryboardWorkflowsTree/StoryboardWorkflowsTreeCore.tsx"],"names":[],"mappings":"AACA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAShE,OAAO,KAAK,EAEV,4BAA4B,EAQ7B,MAAM,SAAS,CAAC;AA49BjB,eAAO,MAAM,2BAA2B,0DA8BtC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@principal-ade/dynamic-file-tree",
3
- "version": "0.2.13",
3
+ "version": "0.2.15",
4
4
  "description": "React component for selective directory filtering and file tree visualization",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",