sample-ui-component-library 0.0.11-dev → 0.0.12-dev
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/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/FileBrowser/FileBrowser.jsx +2 -14
- package/src/components/FileBrowser/Tree/Tree.jsx +1 -1
- package/src/components/FileBrowser/TreeNode/TreeNode.jsx +2 -5
package/package.json
CHANGED
|
@@ -10,7 +10,6 @@ import {
|
|
|
10
10
|
import "./FileBrowser.scss";
|
|
11
11
|
|
|
12
12
|
import { Tree } from "./Tree/Tree";
|
|
13
|
-
import { TreeNodePreview } from "./TreeNode/TreeNode";
|
|
14
13
|
|
|
15
14
|
import { FileBrowserContext } from "./FileBrowserContext";
|
|
16
15
|
|
|
@@ -37,25 +36,14 @@ export const FileBrowser = forwardRef(({onSelectFile}, ref) => {
|
|
|
37
36
|
const selectNode = useCallback((node) => {
|
|
38
37
|
dispatch({ type: "SELECT_NODE", payload: node });
|
|
39
38
|
}, []);
|
|
40
|
-
|
|
41
|
-
const getPreviewElement = useCallback((tabId) => {
|
|
42
|
-
// Get the preview element for a tab by its id for use in drag-and-drop operations.
|
|
43
|
-
const tab = state.flattenedTree.find(t => t.uid === tabId);
|
|
44
|
-
if (!tab) {
|
|
45
|
-
console.error(`getPreviewElement: tab with id ${tabId} not found.`);
|
|
46
|
-
return null;
|
|
47
|
-
}
|
|
48
|
-
return <TreeNodePreview node={tab} />;
|
|
49
|
-
}, [state]);
|
|
50
39
|
|
|
51
40
|
const api = useMemo(() => {
|
|
52
41
|
return {
|
|
53
42
|
state,
|
|
54
43
|
addFileTree,
|
|
55
|
-
selectNode
|
|
56
|
-
getPreviewElement
|
|
44
|
+
selectNode
|
|
57
45
|
};
|
|
58
|
-
}, [state, addFileTree, selectNode
|
|
46
|
+
}, [state, addFileTree, selectNode]);
|
|
59
47
|
|
|
60
48
|
useImperativeHandle(ref, () => api, [api]);
|
|
61
49
|
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { FileCode, ChevronRight, ChevronDown, Braces, FiletypeScss, FiletypeJs, FiletypePy } from "react-bootstrap-icons";
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
DragOverlay,
|
|
6
|
-
useDraggable,
|
|
7
|
-
useDroppable,
|
|
4
|
+
useDraggable
|
|
8
5
|
} from "@dnd-kit/core";
|
|
9
6
|
|
|
10
7
|
import { useFileBrowser } from "../FileBrowser";
|
|
@@ -24,7 +21,7 @@ export const TreeNode = ({ id, node }) => {
|
|
|
24
21
|
data: {
|
|
25
22
|
type: "FileTreeNode",
|
|
26
23
|
node: node,
|
|
27
|
-
preview: <TreeNodePreview node={node}
|
|
24
|
+
preview: <TreeNodePreview node={node} />
|
|
28
25
|
}
|
|
29
26
|
}
|
|
30
27
|
);
|