import { type ReactNode } from 'react'; import { type RowAction } from '../list/index.js'; import type { IFileExplorerClient, IFileExplorerProvider } from './lib/fileExplorer.js'; import type { ExplorerObject, TreeNode, TStorage, TStorageGroup } from './lib/types.js'; /** How the explorer moves between folders and files. */ type ExplorerNavigation = { /** The URL of a path, for a host that keeps the path in its URL. Rows, the * tree, the trail and each row menu's "Open folder" are then links through * the host's router (`useLink`), so a path opens in a new tab, shows its * URL and can be copied, and back and forward move between paths. */ pathHref: (path: string) => string; /** Moves to a path without a link: from the keyboard, a delete, an upload. * Absent, the explorer goes to `pathHref(path)` through the provider's * `navigation.goTo`. */ onPathChange?: ((path: string) => void) | undefined; } | { pathHref?: undefined; onPathChange: (path: string) => void; }; type IFileExplorerProps = ExplorerNavigation & { storages: TStorage[]; /** Resolves the storage's injected provider pair; the host owns caching. */ getProviderAndClient: (storage: TStorage) => Promise<{ provider: IFileExplorerProvider | null; client: IFileExplorerClient | null; }>; onRefresh?: () => void; /** Handles activating a file instead of previewing it. Lets a host embed the * explorer as a file picker (the notebook editor opens .ipynb this way); * return false to fall through to the built-in preview. */ onOpenFile?: ((node: TreeNode, storage: TStorage | undefined) => boolean) | undefined; showUserHierarchy?: boolean; storageGroups?: readonly TStorageGroup[] | undefined; viewer?: string | undefined; groups?: { name: string; id?: string | undefined; }[] | undefined; groupsLoading?: boolean; selectedPath: string; /** Renders only the tree, for a host that embeds it as a navigator and owns * the pane beside it (the notebooks page puts its editor there). The host * also owns the width, so the tree fills its container instead of carrying * its own resize handle. */ treeOnly?: boolean; /** Changes when the host has written into the selected folder outside the * explorer's own upload flow, so the folder is re-listed and shows the file. */ refreshKey?: unknown; /** Seeds the expanded folders on mount, so a host can restore the tree's open * state across reloads. Read once; the explorer owns the set from then on. */ initialExpandedPaths?: readonly string[]; /** Fires whenever the expanded folders change, for the host to persist. */ onExpandedPathsChange?: (paths: string[]) => void; /** URIs that name an object, shown on its details and offered under Copy; * the first is what Copy URI copies. None hides them. */ objectUris?: ((storage: TStorage, key: string) => string[]) | undefined; /** A shell command that downloads files, offered beside the browser * download. An empty command hides it for that selection. */ downloadCommand?: { label: string; build: (objects: ExplorerObject[]) => string; } | undefined; /** Host actions for a row's menu, placed after the built-in ones and before Copy. */ extraRowActions?: ((node: TreeNode, storage: TStorage | undefined) => RowAction[]) | undefined; /** Host content for the selected folder's header, before its badges. */ headerAccessory?: ((node: TreeNode, storage: TStorage | undefined) => ReactNode) | undefined; /** A crumb's label in the selected folder's trail; undefined keeps its name. */ crumbLabel?: ((node: TreeNode, storage: TStorage | undefined) => string | undefined) | undefined; }; export default function FileExplorer({ storages, onRefresh, refreshKey, onOpenFile, showUserHierarchy, storageGroups, viewer, groups, groupsLoading, selectedPath, onPathChange, pathHref, getProviderAndClient, treeOnly, initialExpandedPaths, onExpandedPathsChange, objectUris, downloadCommand, extraRowActions, headerAccessory, crumbLabel, }: IFileExplorerProps): import("react").JSX.Element; export {};