-
= ({
+ prefixedPath,
+ files,
+ selectFile,
+ activeFile,
+ depth,
+ autoHiddenFiles,
+ visibleFiles,
+}) => {
+ const [open, setOpen] = React.useState(true);
+
+ const toggle = (): void => setOpen((prev) => !prev);
+
+ return (
+
+
+
+ {open && (
+
-
- {this.state.open && (
-
- )}
-
- );
- }
-}
+ )}
+
+ );
+};
diff --git a/sandpack-react/src/components/FileExplorer/FileExplorer.stories.tsx b/sandpack-react/src/components/FileExplorer/FileExplorer.stories.tsx
index 91bd906dc..867fc7302 100644
--- a/sandpack-react/src/components/FileExplorer/FileExplorer.stories.tsx
+++ b/sandpack-react/src/components/FileExplorer/FileExplorer.stories.tsx
@@ -83,8 +83,10 @@ export const DirectoryIconStory: React.FC = () => (
depth={1}
files={{ App: { code: "" } }}
prefixedPath="/src"
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- selectFile={(): any => null}
+ selectFile={(): void => {
+ //
+ }}
+ visibleFiles={[]}
/>
diff --git a/sandpack-react/src/components/FileExplorer/ModuleList.tsx b/sandpack-react/src/components/FileExplorer/ModuleList.tsx
index 3fe590341..1aa96232e 100644
--- a/sandpack-react/src/components/FileExplorer/ModuleList.tsx
+++ b/sandpack-react/src/components/FileExplorer/ModuleList.tsx
@@ -1,64 +1,63 @@
import type { SandpackBundlerFiles } from "@codesandbox/sandpack-client";
import * as React from "react";
+import type { SandpackOptions } from "../../types";
+
import { Directory } from "./Directory";
import { File } from "./File";
+import { fromPropsToModules } from "./utils";
+
+import type { SandpackFileExplorerProp } from ".";
-export interface Props {
+export interface ModuleListProps extends SandpackFileExplorerProp {
prefixedPath: string;
files: SandpackBundlerFiles;
selectFile: (path: string) => void;
- activeFile: string;
+ activeFile: NonNullable