@canonical/react-ds-app-launchpad 0.9.0-experimental.4 → 0.9.0-experimental.6
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/esm/ui/FileTree/Context.js +4 -0
- package/dist/esm/ui/FileTree/Context.js.map +1 -0
- package/dist/esm/ui/FileTree/Provider.js +74 -0
- package/dist/esm/ui/FileTree/Provider.js.map +1 -0
- package/dist/esm/ui/FileTree/common/File/File.js +12 -0
- package/dist/esm/ui/FileTree/common/File/File.js.map +1 -0
- package/dist/esm/ui/FileTree/common/File/index.js +4 -0
- package/dist/esm/ui/FileTree/common/File/index.js.map +1 -0
- package/dist/esm/ui/FileTree/common/File/types.js +2 -0
- package/dist/esm/ui/FileTree/common/File/types.js.map +1 -0
- package/dist/esm/ui/FileTree/common/Folder/Folder.js +12 -0
- package/dist/esm/ui/FileTree/common/Folder/Folder.js.map +1 -0
- package/dist/esm/ui/FileTree/common/Folder/index.js +4 -0
- package/dist/esm/ui/FileTree/common/Folder/index.js.map +1 -0
- package/dist/esm/ui/FileTree/common/Folder/types.js +2 -0
- package/dist/esm/ui/FileTree/common/Folder/types.js.map +1 -0
- package/dist/esm/ui/FileTree/common/IndentationBlock/IndentationBlock.js +16 -0
- package/dist/esm/ui/FileTree/common/IndentationBlock/IndentationBlock.js.map +1 -0
- package/dist/esm/ui/FileTree/common/IndentationBlock/index.js +4 -0
- package/dist/esm/ui/FileTree/common/IndentationBlock/index.js.map +1 -0
- package/dist/esm/ui/FileTree/common/IndentationBlock/types.js +2 -0
- package/dist/esm/ui/FileTree/common/IndentationBlock/types.js.map +1 -0
- package/dist/esm/ui/FileTree/common/Node/Context.js +10 -0
- package/dist/esm/ui/FileTree/common/Node/Context.js.map +1 -0
- package/dist/esm/ui/FileTree/common/Node/Provider.js +163 -0
- package/dist/esm/ui/FileTree/common/Node/Provider.js.map +1 -0
- package/dist/esm/ui/FileTree/common/Node/hooks/index.js +2 -0
- package/dist/esm/ui/FileTree/common/Node/hooks/index.js.map +1 -0
- package/dist/esm/ui/FileTree/common/Node/hooks/useNode.js +12 -0
- package/dist/esm/ui/FileTree/common/Node/hooks/useNode.js.map +1 -0
- package/dist/esm/ui/FileTree/common/Node/index.js +4 -0
- package/dist/esm/ui/FileTree/common/Node/index.js.map +1 -0
- package/dist/esm/ui/FileTree/common/Node/types.js +2 -0
- package/dist/esm/ui/FileTree/common/Node/types.js.map +1 -0
- package/dist/esm/ui/FileTree/common/SearchBox/SearchBox.js +31 -0
- package/dist/esm/ui/FileTree/common/SearchBox/SearchBox.js.map +1 -0
- package/dist/esm/ui/FileTree/common/SearchBox/index.js +4 -0
- package/dist/esm/ui/FileTree/common/SearchBox/index.js.map +1 -0
- package/dist/esm/ui/FileTree/common/SearchBox/types.js +2 -0
- package/dist/esm/ui/FileTree/common/SearchBox/types.js.map +1 -0
- package/dist/esm/ui/FileTree/common/TreeView/TreeView.js +60 -0
- package/dist/esm/ui/FileTree/common/TreeView/TreeView.js.map +1 -0
- package/dist/esm/ui/FileTree/common/TreeView/index.js +4 -0
- package/dist/esm/ui/FileTree/common/TreeView/index.js.map +1 -0
- package/dist/esm/ui/FileTree/common/TreeView/types.js +2 -0
- package/dist/esm/ui/FileTree/common/TreeView/types.js.map +1 -0
- package/dist/esm/ui/FileTree/common/index.js +5 -0
- package/dist/esm/ui/FileTree/common/index.js.map +1 -0
- package/dist/esm/ui/FileTree/hooks/index.js +2 -0
- package/dist/esm/ui/FileTree/hooks/index.js.map +1 -0
- package/dist/esm/ui/FileTree/hooks/useFileTree.js +11 -0
- package/dist/esm/ui/FileTree/hooks/useFileTree.js.map +1 -0
- package/dist/esm/ui/FileTree/index.js +10 -0
- package/dist/esm/ui/FileTree/index.js.map +1 -0
- package/dist/esm/ui/FileTree/styles.css +47 -0
- package/dist/esm/ui/FileTree/types.js +2 -0
- package/dist/esm/ui/FileTree/types.js.map +1 -0
- package/dist/esm/ui/FileTree/utils/hashNodeName.js +11 -0
- package/dist/esm/ui/FileTree/utils/hashNodeName.js.map +1 -0
- package/dist/esm/ui/FileTree/utils/index.js +2 -0
- package/dist/esm/ui/FileTree/utils/index.js.map +1 -0
- package/dist/esm/ui/RelativeTime/RelativeTime.js +66 -0
- package/dist/esm/ui/RelativeTime/RelativeTime.js.map +1 -0
- package/dist/esm/ui/RelativeTime/index.js +4 -0
- package/dist/esm/ui/RelativeTime/index.js.map +1 -0
- package/dist/esm/ui/RelativeTime/types.js +2 -0
- package/dist/esm/ui/RelativeTime/types.js.map +1 -0
- package/dist/esm/ui/RelativeTime/utils/constants.js +6 -0
- package/dist/esm/ui/RelativeTime/utils/constants.js.map +1 -0
- package/dist/esm/ui/RelativeTime/utils/formatHumanTime.js +43 -0
- package/dist/esm/ui/RelativeTime/utils/formatHumanTime.js.map +1 -0
- package/dist/esm/ui/RelativeTime/utils/getOptimalUpdateInterval.js +24 -0
- package/dist/esm/ui/RelativeTime/utils/getOptimalUpdateInterval.js.map +1 -0
- package/dist/esm/ui/RelativeTime/utils/index.js +4 -0
- package/dist/esm/ui/RelativeTime/utils/index.js.map +1 -0
- package/dist/esm/ui/RelativeTime/utils/parseInstant.js +22 -0
- package/dist/esm/ui/RelativeTime/utils/parseInstant.js.map +1 -0
- package/dist/types/ui/FileTree/Context.d.ts +4 -0
- package/dist/types/ui/FileTree/Context.d.ts.map +1 -0
- package/dist/types/ui/FileTree/Provider.d.ts +7 -0
- package/dist/types/ui/FileTree/Provider.d.ts.map +1 -0
- package/dist/types/ui/FileTree/common/File/File.d.ts +10 -0
- package/dist/types/ui/FileTree/common/File/File.d.ts.map +1 -0
- package/dist/types/ui/FileTree/common/File/index.d.ts +3 -0
- package/dist/types/ui/FileTree/common/File/index.d.ts.map +1 -0
- package/dist/types/ui/FileTree/common/File/types.d.ts +16 -0
- package/dist/types/ui/FileTree/common/File/types.d.ts.map +1 -0
- package/dist/types/ui/FileTree/common/Folder/Folder.d.ts +10 -0
- package/dist/types/ui/FileTree/common/Folder/Folder.d.ts.map +1 -0
- package/dist/types/ui/FileTree/common/Folder/index.d.ts +3 -0
- package/dist/types/ui/FileTree/common/Folder/index.d.ts.map +1 -0
- package/dist/types/ui/FileTree/common/Folder/types.d.ts +16 -0
- package/dist/types/ui/FileTree/common/Folder/types.d.ts.map +1 -0
- package/dist/types/ui/FileTree/common/IndentationBlock/IndentationBlock.d.ts +10 -0
- package/dist/types/ui/FileTree/common/IndentationBlock/IndentationBlock.d.ts.map +1 -0
- package/dist/types/ui/FileTree/common/IndentationBlock/index.d.ts +3 -0
- package/dist/types/ui/FileTree/common/IndentationBlock/index.d.ts.map +1 -0
- package/dist/types/ui/FileTree/common/IndentationBlock/types.d.ts +12 -0
- package/dist/types/ui/FileTree/common/IndentationBlock/types.d.ts.map +1 -0
- package/dist/types/ui/FileTree/common/Node/Context.d.ts +5 -0
- package/dist/types/ui/FileTree/common/Node/Context.d.ts.map +1 -0
- package/dist/types/ui/FileTree/common/Node/Provider.d.ts +6 -0
- package/dist/types/ui/FileTree/common/Node/Provider.d.ts.map +1 -0
- package/dist/types/ui/FileTree/common/Node/hooks/index.d.ts +2 -0
- package/dist/types/ui/FileTree/common/Node/hooks/index.d.ts.map +1 -0
- package/dist/types/ui/FileTree/common/Node/hooks/useNode.d.ts +3 -0
- package/dist/types/ui/FileTree/common/Node/hooks/useNode.d.ts.map +1 -0
- package/dist/types/ui/FileTree/common/Node/index.d.ts +5 -0
- package/dist/types/ui/FileTree/common/Node/index.d.ts.map +1 -0
- package/dist/types/ui/FileTree/common/Node/types.d.ts +28 -0
- package/dist/types/ui/FileTree/common/Node/types.d.ts.map +1 -0
- package/dist/types/ui/FileTree/common/SearchBox/SearchBox.d.ts +10 -0
- package/dist/types/ui/FileTree/common/SearchBox/SearchBox.d.ts.map +1 -0
- package/dist/types/ui/FileTree/common/SearchBox/index.d.ts +3 -0
- package/dist/types/ui/FileTree/common/SearchBox/index.d.ts.map +1 -0
- package/dist/types/ui/FileTree/common/SearchBox/types.d.ts +12 -0
- package/dist/types/ui/FileTree/common/SearchBox/types.d.ts.map +1 -0
- package/dist/types/ui/FileTree/common/TreeView/TreeView.d.ts +16 -0
- package/dist/types/ui/FileTree/common/TreeView/TreeView.d.ts.map +1 -0
- package/dist/types/ui/FileTree/common/TreeView/index.d.ts +3 -0
- package/dist/types/ui/FileTree/common/TreeView/index.d.ts.map +1 -0
- package/dist/types/ui/FileTree/common/TreeView/types.d.ts +20 -0
- package/dist/types/ui/FileTree/common/TreeView/types.d.ts.map +1 -0
- package/dist/types/ui/FileTree/common/index.d.ts +5 -0
- package/dist/types/ui/FileTree/common/index.d.ts.map +1 -0
- package/dist/types/ui/FileTree/hooks/index.d.ts +2 -0
- package/dist/types/ui/FileTree/hooks/index.d.ts.map +1 -0
- package/dist/types/ui/FileTree/hooks/useFileTree.d.ts +3 -0
- package/dist/types/ui/FileTree/hooks/useFileTree.d.ts.map +1 -0
- package/dist/types/ui/FileTree/index.d.ts +5 -0
- package/dist/types/ui/FileTree/index.d.ts.map +1 -0
- package/dist/types/ui/FileTree/types.d.ts +69 -0
- package/dist/types/ui/FileTree/types.d.ts.map +1 -0
- package/dist/types/ui/FileTree/utils/hashNodeName.d.ts +3 -0
- package/dist/types/ui/FileTree/utils/hashNodeName.d.ts.map +1 -0
- package/dist/types/ui/FileTree/utils/index.d.ts +2 -0
- package/dist/types/ui/FileTree/utils/index.d.ts.map +1 -0
- package/dist/types/ui/RelativeTime/RelativeTime.d.ts +11 -0
- package/dist/types/ui/RelativeTime/RelativeTime.d.ts.map +1 -0
- package/dist/types/ui/RelativeTime/index.d.ts +3 -0
- package/dist/types/ui/RelativeTime/index.d.ts.map +1 -0
- package/dist/types/ui/RelativeTime/types.d.ts +36 -0
- package/dist/types/ui/RelativeTime/types.d.ts.map +1 -0
- package/dist/types/ui/RelativeTime/utils/constants.d.ts +6 -0
- package/dist/types/ui/RelativeTime/utils/constants.d.ts.map +1 -0
- package/dist/types/ui/RelativeTime/utils/formatHumanTime.d.ts +21 -0
- package/dist/types/ui/RelativeTime/utils/formatHumanTime.d.ts.map +1 -0
- package/dist/types/ui/RelativeTime/utils/getOptimalUpdateInterval.d.ts +8 -0
- package/dist/types/ui/RelativeTime/utils/getOptimalUpdateInterval.d.ts.map +1 -0
- package/dist/types/ui/RelativeTime/utils/index.d.ts +4 -0
- package/dist/types/ui/RelativeTime/utils/index.d.ts.map +1 -0
- package/dist/types/ui/RelativeTime/utils/parseInstant.d.ts +9 -0
- package/dist/types/ui/RelativeTime/utils/parseInstant.d.ts.map +1 -0
- package/package.json +4 -3
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Context.js","sourceRoot":"","sources":["../../../../src/ui/FileTree/Context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGtC,MAAM,OAAO,GAAG,aAAa,CAAwB,IAAI,CAAC,CAAC;AAE3D,eAAe,OAAO,CAAC"}
|
@@ -0,0 +1,74 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { useCallback, useEffect, useRef } from "react";
|
3
|
+
import Context from "./Context.js";
|
4
|
+
import "./styles.css";
|
5
|
+
const componentCssClassName = "ds file-tree";
|
6
|
+
export const dataPathHash = "data-path-hash";
|
7
|
+
const Provider = ({ id, className, style, children, ...contextOptions }) => {
|
8
|
+
const fileTreeRef = useRef(null);
|
9
|
+
const handleFocusNextNode = useCallback((direction) => {
|
10
|
+
if (!fileTreeRef.current)
|
11
|
+
return;
|
12
|
+
const currentNode = fileTreeRef.current.querySelector(`[${dataPathHash}]:focus`);
|
13
|
+
const currentNodeHash = currentNode?.getAttribute(dataPathHash);
|
14
|
+
if (!currentNodeHash)
|
15
|
+
return;
|
16
|
+
const nextNode = direction === "up"
|
17
|
+
? fileTreeRef.current.querySelector(`[${dataPathHash}]:has(+ [${dataPathHash}="${currentNodeHash}"])`)
|
18
|
+
: fileTreeRef.current.querySelector(`[${dataPathHash}="${currentNodeHash}"] + [${dataPathHash}]`);
|
19
|
+
if (!nextNode || !currentNode)
|
20
|
+
return;
|
21
|
+
nextNode.focus();
|
22
|
+
currentNode.setAttribute("tabindex", "-1");
|
23
|
+
nextNode.setAttribute("tabindex", "0");
|
24
|
+
}, []);
|
25
|
+
const handleFocusEndNode = useCallback((end) => {
|
26
|
+
if (!fileTreeRef.current)
|
27
|
+
return;
|
28
|
+
const endNode = fileTreeRef.current.querySelector(`[${dataPathHash}]:${end === "start" ? "first" : "last"}-of-type`);
|
29
|
+
const currentNode = fileTreeRef.current.querySelector(`[${dataPathHash}]:focus`);
|
30
|
+
if (!endNode || !currentNode)
|
31
|
+
return;
|
32
|
+
endNode.focus();
|
33
|
+
currentNode.setAttribute("tabindex", "-1");
|
34
|
+
endNode.setAttribute("tabindex", "0");
|
35
|
+
}, []);
|
36
|
+
const handleFocusNextSiblingCharacter = useCallback((character) => {
|
37
|
+
if (!fileTreeRef.current)
|
38
|
+
return;
|
39
|
+
const currentNode = fileTreeRef.current.querySelector(`[${dataPathHash}]:focus`);
|
40
|
+
if (!currentNode)
|
41
|
+
return;
|
42
|
+
const currentNodeHash = currentNode.getAttribute(dataPathHash);
|
43
|
+
if (!currentNodeHash)
|
44
|
+
return;
|
45
|
+
const matchingNodes = Array.from(fileTreeRef.current.querySelectorAll(`[data-name^="${character}"]`));
|
46
|
+
const currentNodeIndex = matchingNodes.findIndex((node) => node === currentNode);
|
47
|
+
const nextNodeWithCharacter = matchingNodes.at((currentNodeIndex + 1) % matchingNodes.length);
|
48
|
+
if (!nextNodeWithCharacter)
|
49
|
+
return;
|
50
|
+
nextNodeWithCharacter.focus();
|
51
|
+
currentNode.setAttribute("tabindex", "-1");
|
52
|
+
nextNodeWithCharacter.setAttribute("tabindex", "0");
|
53
|
+
}, []);
|
54
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: on search query change, the first node may be filtered out
|
55
|
+
useEffect(() => {
|
56
|
+
if (!fileTreeRef.current)
|
57
|
+
return;
|
58
|
+
const nodes = Array.from(fileTreeRef.current.querySelectorAll(`[${dataPathHash}][tabindex='0']`));
|
59
|
+
for (const node of nodes) {
|
60
|
+
node.setAttribute("tabindex", "-1");
|
61
|
+
}
|
62
|
+
const firstNode = fileTreeRef.current.querySelector(`[${dataPathHash}]:not([hidden])`);
|
63
|
+
firstNode?.setAttribute("tabindex", "0");
|
64
|
+
}, [contextOptions.searchQuery, contextOptions.selectedFile]);
|
65
|
+
return (_jsx(Context.Provider, { value: {
|
66
|
+
...contextOptions,
|
67
|
+
expandable: contextOptions.expandable ?? false,
|
68
|
+
focusNextNode: handleFocusNextNode,
|
69
|
+
focusEndNode: handleFocusEndNode,
|
70
|
+
focusNextSiblingCharacter: handleFocusNextSiblingCharacter,
|
71
|
+
}, children: _jsx("ul", { id: id, style: style, className: [componentCssClassName, className].filter(Boolean).join(" "), ref: fileTreeRef, role: "tree", children: children }) }));
|
72
|
+
};
|
73
|
+
export default Provider;
|
74
|
+
//# sourceMappingURL=Provider.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Provider.js","sourceRoot":"","sources":["../../../../src/ui/FileTree/Provider.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,cAAc,CAAC;AAGtB,MAAM,qBAAqB,GAAG,cAAc,CAAC;AAC7C,MAAM,CAAC,MAAM,YAAY,GAAG,gBAAgB,CAAC;AAE7C,MAAM,QAAQ,GAAG,CAAC,EAChB,EAAE,EACF,SAAS,EACT,KAAK,EACL,QAAQ,EACR,GAAG,cAAc,EACD,EAAsB,EAAE;IACxC,MAAM,WAAW,GAAG,MAAM,CAAmB,IAAI,CAAC,CAAC;IAEnD,MAAM,mBAAmB,GACvB,WAAW,CAAC,CAAC,SAAS,EAAE,EAAE;QACxB,IAAI,CAAC,WAAW,CAAC,OAAO;YAAE,OAAO;QACjC,MAAM,WAA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IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QACtC,CAAC;QACD,MAAM,SAAS,GAAG,WAAW,CAAC,OAAO,CAAC,aAAa,CACjD,IAAI,YAAY,iBAAiB,CAClC,CAAC;QACF,SAAS,EAAE,YAAY,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;IAC3C,CAAC,EAAE,CAAC,cAAc,CAAC,WAAW,EAAE,cAAc,CAAC,YAAY,CAAC,CAAC,CAAC;IAE9D,OAAO,CACL,KAAC,OAAO,CAAC,QAAQ,IACf,KAAK,EAAE;YACL,GAAG,cAAc;YACjB,UAAU,EAAE,cAAc,CAAC,UAAU,IAAI,KAAK;YAC9C,aAAa,EAAE,mBAAmB;YAClC,YAAY,EAAE,kBAAkB;YAChC,yBAAyB,EAAE,+BAA+B;SAC3D,YAED,aACE,EAAE,EAAE,EAAE,EACN,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EACvE,GAAG,EAAE,WAAW,EAChB,IAAI,EAAC,MAAM,YAEV,QAAQ,GACN,GACY,CACpB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { Node } from "../Node/index.js";
|
3
|
+
import "./styles.css";
|
4
|
+
/**
|
5
|
+
* description of the File component
|
6
|
+
* @returns {React.ReactElement} - Rendered File
|
7
|
+
*/
|
8
|
+
const File = ({ id, className, style, name, marker, }) => {
|
9
|
+
return (_jsx(Node, { id: id, className: className, style: style, name: name, nodeType: "file", marker: marker }));
|
10
|
+
};
|
11
|
+
export default File;
|
12
|
+
//# sourceMappingURL=File.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"File.js","sourceRoot":"","sources":["../../../../../../src/ui/FileTree/common/File/File.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,cAAc,CAAC;AAGtB;;;GAGG;AACH,MAAM,IAAI,GAAG,CAAC,EACZ,EAAE,EACF,SAAS,EACT,KAAK,EACL,IAAI,EACJ,MAAM,GACI,EAAsB,EAAE;IAClC,OAAO,CACL,KAAC,IAAI,IACH,EAAE,EAAE,EAAE,EACN,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,IAAI,EACV,QAAQ,EAAC,MAAM,EACf,MAAM,EAAE,MAAM,GACd,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/ui/FileTree/common/File/index.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,WAAW,CAAC;AAC5C,cAAc,YAAY,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../src/ui/FileTree/common/File/types.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { Node } from "../Node/index.js";
|
3
|
+
import "./styles.css";
|
4
|
+
/**
|
5
|
+
* description of the Folder component
|
6
|
+
* @returns {React.ReactElement} - Rendered Folder
|
7
|
+
*/
|
8
|
+
const Folder = ({ id, children, className, style, name, defaultOpen, }) => {
|
9
|
+
return (_jsx(Node, { id: id, className: className, style: style, name: name, nodeType: "folder", defaultOpen: defaultOpen, children: children }));
|
10
|
+
};
|
11
|
+
export default Folder;
|
12
|
+
//# sourceMappingURL=Folder.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Folder.js","sourceRoot":"","sources":["../../../../../../src/ui/FileTree/common/Folder/Folder.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,cAAc,CAAC;AAGtB;;;GAGG;AACH,MAAM,MAAM,GAAG,CAAC,EACd,EAAE,EACF,QAAQ,EACR,SAAS,EACT,KAAK,EACL,IAAI,EACJ,WAAW,GACC,EAAsB,EAAE;IACpC,OAAO,CACL,KAAC,IAAI,IACH,EAAE,EAAE,EAAE,EACN,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,IAAI,EACV,QAAQ,EAAC,QAAQ,EACjB,WAAW,EAAE,WAAW,YAEvB,QAAQ,GACJ,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/ui/FileTree/common/Folder/index.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC;AAChD,cAAc,YAAY,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../src/ui/FileTree/common/Folder/types.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { useId } from "react";
|
3
|
+
import "./styles.css";
|
4
|
+
const componentCssClassName = "ds indentation-block";
|
5
|
+
/**
|
6
|
+
* description of the IndentationBlock component
|
7
|
+
* @returns {React.ReactElement} - Rendered IndentationBlock
|
8
|
+
*/
|
9
|
+
const IndentationBlock = ({ id, className, style, depth, }) => {
|
10
|
+
const uid = useId();
|
11
|
+
return (_jsxs("div", { id: id, style: style, className: [componentCssClassName, className].filter(Boolean).join(" "), children: [Array.from({ length: depth }).map((_, index) => (
|
12
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: index is prefixed with a uid
|
13
|
+
_jsx("div", { className: "indent-block", children: "\u00A0" }, `${uid}-${index}`))), depth === 0 && _jsx("div", { className: "indent-block empty", children: "\u00A0" })] }));
|
14
|
+
};
|
15
|
+
export default IndentationBlock;
|
16
|
+
//# sourceMappingURL=IndentationBlock.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"IndentationBlock.js","sourceRoot":"","sources":["../../../../../../src/ui/FileTree/common/IndentationBlock/IndentationBlock.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,cAAc,CAAC;AAGtB,MAAM,qBAAqB,GAAG,sBAAsB,CAAC;AAErD;;;GAGG;AACH,MAAM,gBAAgB,GAAG,CAAC,EACxB,EAAE,EACF,SAAS,EACT,KAAK,EACL,KAAK,GACiB,EAA6B,EAAE;IACrD,MAAM,GAAG,GAAG,KAAK,EAAE,CAAC;IAEpB,OAAO,CACL,eACE,EAAE,EAAE,EAAE,EACN,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,aAEtE,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC;YAC/C,6EAA6E;YAC7E,cAA6B,SAAS,EAAC,cAAc,wBAA3C,GAAG,GAAG,IAAI,KAAK,EAAE,CAErB,CACP,CAAC,EACD,KAAK,KAAK,CAAC,IAAI,cAAK,SAAS,EAAC,oBAAoB,uBAAa,IAC5D,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/ui/FileTree/common/IndentationBlock/index.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACpE,cAAc,YAAY,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../src/ui/FileTree/common/IndentationBlock/types.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { createContext } from "react";
|
2
|
+
export const rootLevelEmptyContext = {
|
3
|
+
depth: 0,
|
4
|
+
path: "",
|
5
|
+
addChildNode: () => { },
|
6
|
+
childNodes: [],
|
7
|
+
};
|
8
|
+
const Context = createContext(rootLevelEmptyContext);
|
9
|
+
export default Context;
|
10
|
+
//# sourceMappingURL=Context.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Context.js","sourceRoot":"","sources":["../../../../../../src/ui/FileTree/common/Node/Context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGtC,MAAM,CAAC,MAAM,qBAAqB,GAAmB;IACnD,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,EAAE;IACR,YAAY,EAAE,GAAG,EAAE,GAAE,CAAC;IACtB,UAAU,EAAE,EAAE;CACf,CAAC;AAEF,MAAM,OAAO,GAAG,aAAa,CAAiB,qBAAqB,CAAC,CAAC;AAErE,eAAe,OAAO,CAAC"}
|
@@ -0,0 +1,163 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
3
|
+
import { dataPathHash } from "../../Provider.js";
|
4
|
+
import { useFileTree } from "../../hooks/index.js";
|
5
|
+
import { hashNodeName } from "../../utils/index.js";
|
6
|
+
import { IndentationBlock } from "../IndentationBlock/index.js";
|
7
|
+
import Context from "./Context.js";
|
8
|
+
import { useNode } from "./hooks/index.js";
|
9
|
+
import "./styles.css";
|
10
|
+
const componentCssClassName = "ds node";
|
11
|
+
const expandedCssClassName = "expanded";
|
12
|
+
const expandableCssClassName = "expandable";
|
13
|
+
const selectableCssClassName = "selectable";
|
14
|
+
const Provider = ({ id, className, style, children, name, marker, ...nodeOptions }) => {
|
15
|
+
const { expandable, searchQuery, selectedFile, onSelectFile, focusNextNode, focusEndNode, focusNextSiblingCharacter, } = useFileTree();
|
16
|
+
const nodeRef = useRef({
|
17
|
+
name,
|
18
|
+
path: "",
|
19
|
+
type: nodeOptions.nodeType,
|
20
|
+
});
|
21
|
+
const { depth, path: parentPath, addChildNode } = useNode();
|
22
|
+
const [childNodes, setChildNodes] = useState([]);
|
23
|
+
const [isExpanded, setIsExpanded] = useState(nodeOptions.nodeType === "folder" && nodeOptions.defaultOpen);
|
24
|
+
const path = useMemo(() => `${parentPath}/${name}`, [parentPath, name]);
|
25
|
+
const isSelected = useMemo(() => selectedFile?.path === path, [selectedFile, path]);
|
26
|
+
const matchesQuery = useCallback((query, target) => {
|
27
|
+
return target.toLowerCase().includes(query.toLowerCase());
|
28
|
+
}, []);
|
29
|
+
const fileMatchesSearchQuery = useCallback((node) => {
|
30
|
+
if (!searchQuery)
|
31
|
+
return true;
|
32
|
+
// check if path matches in case of files
|
33
|
+
if (node.type === "file") {
|
34
|
+
return matchesQuery(searchQuery, node.name);
|
35
|
+
}
|
36
|
+
// check if any child/grandchild matches in case of folders
|
37
|
+
return (matchesQuery(searchQuery, node.name) ||
|
38
|
+
node.children?.some(fileMatchesSearchQuery));
|
39
|
+
}, [searchQuery, matchesQuery]);
|
40
|
+
const shouldHideNode = useMemo(() => {
|
41
|
+
if (!searchQuery)
|
42
|
+
return false;
|
43
|
+
return !fileMatchesSearchQuery(nodeRef.current);
|
44
|
+
}, [searchQuery, fileMatchesSearchQuery]);
|
45
|
+
const handleClick = useCallback((_event) => {
|
46
|
+
switch (nodeOptions.nodeType) {
|
47
|
+
case "folder":
|
48
|
+
if (expandable) {
|
49
|
+
setIsExpanded((prev) => !prev);
|
50
|
+
}
|
51
|
+
break;
|
52
|
+
case "file":
|
53
|
+
onSelectFile?.({
|
54
|
+
name,
|
55
|
+
path,
|
56
|
+
type: nodeOptions.nodeType,
|
57
|
+
});
|
58
|
+
break;
|
59
|
+
}
|
60
|
+
}, [nodeOptions.nodeType, onSelectFile, name, path, expandable]);
|
61
|
+
const handleKeyDown = (event) => {
|
62
|
+
if (event.ctrlKey || event.altKey || event.shiftKey || event.metaKey)
|
63
|
+
return;
|
64
|
+
if (event.key.match(/^[a-zA-Z0-9]$/)) {
|
65
|
+
focusNextSiblingCharacter(event.key);
|
66
|
+
event.preventDefault();
|
67
|
+
}
|
68
|
+
switch (event.key) {
|
69
|
+
case "ArrowRight":
|
70
|
+
if (!isExpanded && nodeOptions.nodeType === "folder" && expandable) {
|
71
|
+
setIsExpanded(true);
|
72
|
+
event.preventDefault();
|
73
|
+
}
|
74
|
+
else {
|
75
|
+
focusNextNode("down");
|
76
|
+
event.preventDefault();
|
77
|
+
}
|
78
|
+
break;
|
79
|
+
case "ArrowLeft":
|
80
|
+
if (isExpanded && nodeOptions.nodeType === "folder" && expandable) {
|
81
|
+
setIsExpanded(false);
|
82
|
+
event.preventDefault();
|
83
|
+
}
|
84
|
+
else {
|
85
|
+
focusNextNode("up");
|
86
|
+
event.preventDefault();
|
87
|
+
}
|
88
|
+
break;
|
89
|
+
case "ArrowDown":
|
90
|
+
focusNextNode("down");
|
91
|
+
event.preventDefault();
|
92
|
+
break;
|
93
|
+
case "ArrowUp":
|
94
|
+
focusNextNode("up");
|
95
|
+
event.preventDefault();
|
96
|
+
break;
|
97
|
+
case "Home":
|
98
|
+
focusEndNode("start");
|
99
|
+
event.preventDefault();
|
100
|
+
break;
|
101
|
+
case "End":
|
102
|
+
focusEndNode("end");
|
103
|
+
event.preventDefault();
|
104
|
+
break;
|
105
|
+
case "Enter":
|
106
|
+
case " ":
|
107
|
+
if (nodeOptions.nodeType === "file") {
|
108
|
+
onSelectFile?.({
|
109
|
+
name,
|
110
|
+
path,
|
111
|
+
type: nodeOptions.nodeType,
|
112
|
+
});
|
113
|
+
}
|
114
|
+
event.preventDefault();
|
115
|
+
break;
|
116
|
+
}
|
117
|
+
};
|
118
|
+
// update parent's childNodes with the current node object reference
|
119
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: the nodeRef.current is updated only once
|
120
|
+
useEffect(() => {
|
121
|
+
if (nodeRef.current) {
|
122
|
+
addChildNode(nodeRef.current);
|
123
|
+
}
|
124
|
+
}, []);
|
125
|
+
// update the node object information when the information changes
|
126
|
+
useEffect(() => {
|
127
|
+
if (nodeRef.current) {
|
128
|
+
nodeRef.current.path = path;
|
129
|
+
if (nodeRef.current.type === "folder") {
|
130
|
+
nodeRef.current.children = childNodes;
|
131
|
+
}
|
132
|
+
}
|
133
|
+
}, [path, childNodes]);
|
134
|
+
return (_jsxs(Context.Provider, { value: {
|
135
|
+
depth: depth + 1,
|
136
|
+
path,
|
137
|
+
addChildNode: (node) => setChildNodes((prev) => [...prev, node]),
|
138
|
+
childNodes,
|
139
|
+
}, children: [!shouldHideNode && (_jsxs("li", { id: id, style: style, [dataPathHash]: hashNodeName(path), "data-name": name, className: [
|
140
|
+
componentCssClassName,
|
141
|
+
className,
|
142
|
+
nodeOptions.nodeType,
|
143
|
+
isExpanded && expandedCssClassName,
|
144
|
+
nodeOptions.nodeType === "folder" &&
|
145
|
+
expandable &&
|
146
|
+
expandableCssClassName,
|
147
|
+
nodeOptions.nodeType === "file" &&
|
148
|
+
onSelectFile !== undefined &&
|
149
|
+
selectableCssClassName,
|
150
|
+
]
|
151
|
+
.filter(Boolean)
|
152
|
+
.join(" "), role: "treeitem", "aria-expanded": nodeOptions.nodeType === "folder" ? isExpanded : undefined, "aria-selected": isSelected, tabIndex: -1, onClick: handleClick, onKeyDown: handleKeyDown, children: [_jsx(IndentationBlock, { depth: depth }), _jsx("div", { className: [
|
153
|
+
"icon",
|
154
|
+
nodeOptions.nodeType,
|
155
|
+
isExpanded && expandedCssClassName,
|
156
|
+
]
|
157
|
+
.filter(Boolean)
|
158
|
+
.join(" ") }), _jsx("span", { className: "nodename", children: name }), marker && _jsx("div", { className: "marker", children: marker })] })), nodeOptions.nodeType === "folder" &&
|
159
|
+
(isExpanded || expandable === false) &&
|
160
|
+
children] }));
|
161
|
+
};
|
162
|
+
export default Provider;
|
163
|
+
//# sourceMappingURL=Provider.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Provider.js","sourceRoot":"","sources":["../../../../../../src/ui/FileTree/common/Node/Provider.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,cAAc,CAAC;AAGtB,MAAM,qBAAqB,GAAG,SAAS,CAAC;AACxC,MAAM,oBAAoB,GAAG,UAAU,CAAC;AACxC,MAAM,sBAAsB,GAAG,YAAY,CAAC;AAC5C,MAAM,sBAAsB,GAAG,YAAY,CAAC;AAE5C,MAAM,QAAQ,GAAG,CAAC,EAChB,EAAE,EACF,SAAS,EACT,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,MAAM,EACN,GAAG,WAAW,EACA,EAA6B,EAAE;IAC7C,MAAM,EACJ,UAAU,EACV,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,yBAAyB,GAC1B,GAAG,WAA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C,QAAQ,KAAK,MAAM;wBAC7B,YAAY,KAAK,SAAS;wBAC1B,sBAAsB;iBACzB;qBACE,MAAM,CAAC,OAAO,CAAC;qBACf,IAAI,CAAC,GAAG,CAAC,EACZ,IAAI,EAAC,UAAU,mBAEb,WAAW,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,mBAE7C,UAAU,EACzB,QAAQ,EAAE,CAAC,CAAC,EACZ,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,aAAa,aAExB,KAAC,gBAAgB,IAAC,KAAK,EAAE,KAAK,GAAI,EAClC,cACE,SAAS,EAAE;4BACT,MAAM;4BACN,WAAW,CAAC,QAAQ;4BACpB,UAAU,IAAI,oBAAoB;yBACnC;6BACE,MAAM,CAAC,OAAO,CAAC;6BACf,IAAI,CAAC,GAAG,CAAC,GACZ,EACF,eAAM,SAAS,EAAC,UAAU,YAAE,IAAI,GAAQ,EACvC,MAAM,IAAI,cAAK,SAAS,EAAC,QAAQ,YAAE,MAAM,GAAO,IAC9C,CACN,EACA,WAAW,CAAC,QAAQ,KAAK,QAAQ;gBAChC,CAAC,UAAU,IAAI,UAAU,KAAK,KAAK,CAAC;gBACpC,QAAQ,IACO,CACpB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../src/ui/FileTree/common/Node/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,cAAc,CAAC"}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { useContext } from "react";
|
2
|
+
import Context, { rootLevelEmptyContext } from "../Context.js";
|
3
|
+
const useNode = () => {
|
4
|
+
const context = useContext(Context);
|
5
|
+
if (!context) {
|
6
|
+
// if no folder parent is found, that means file is at root level
|
7
|
+
return rootLevelEmptyContext;
|
8
|
+
}
|
9
|
+
return context;
|
10
|
+
};
|
11
|
+
export default useNode;
|
12
|
+
//# sourceMappingURL=useNode.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useNode.js","sourceRoot":"","sources":["../../../../../../../src/ui/FileTree/common/Node/hooks/useNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,OAAO,EAAE,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAE/D,MAAM,OAAO,GAAG,GAAG,EAAE;IACnB,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IACpC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,iEAAiE;QACjE,OAAO,qBAAqB,CAAC;IAC/B,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/ui/FileTree/common/Node/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,cAAc,CAAC;AAClD,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,eAAe,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../src/ui/FileTree/common/Node/types.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { useCallback } from "react";
|
3
|
+
import useFileTree from "../../hooks/useFileTree.js";
|
4
|
+
import "./styles.css";
|
5
|
+
const componentCssClassName = "ds search-box";
|
6
|
+
/**
|
7
|
+
* description of the SearchBox component
|
8
|
+
* @returns {React.ReactElement} - Rendered SearchBox
|
9
|
+
*/
|
10
|
+
const SearchBox = ({ id, children, className, style, }) => {
|
11
|
+
const { searchQuery, onSearch } = useFileTree();
|
12
|
+
if (!onSearch) {
|
13
|
+
return null;
|
14
|
+
}
|
15
|
+
const handleSearch = useCallback((event) => {
|
16
|
+
event.preventDefault();
|
17
|
+
const formData = new FormData(event.currentTarget);
|
18
|
+
onSearch(formData.get("search"));
|
19
|
+
}, [onSearch]);
|
20
|
+
const handleReset = useCallback((event) => {
|
21
|
+
event.preventDefault();
|
22
|
+
onSearch("");
|
23
|
+
}, [onSearch]);
|
24
|
+
const handleInputUpdate = useCallback((event) => {
|
25
|
+
onSearch(event.currentTarget.value);
|
26
|
+
event.preventDefault();
|
27
|
+
}, [onSearch]);
|
28
|
+
return (_jsxs("form", { id: id, style: style, className: [componentCssClassName, className].filter(Boolean).join(" "), onSubmit: handleSearch, onReset: handleReset, children: [_jsx("input", { value: searchQuery, onChange: handleInputUpdate, name: "search", className: "input", type: "search", placeholder: "Search", required: true, autoComplete: "off" }), _jsx("button", { type: "reset", className: "reset", children: _jsx("span", { className: "icon" }) }), _jsx("button", { type: "submit", className: "search", children: _jsx("span", { className: "icon" }) })] }));
|
29
|
+
};
|
30
|
+
export default SearchBox;
|
31
|
+
//# sourceMappingURL=SearchBox.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"SearchBox.js","sourceRoot":"","sources":["../../../../../../src/ui/FileTree/common/SearchBox/SearchBox.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,WAAW,MAAM,4BAA4B,CAAC;AACrD,OAAO,cAAc,CAAC;AAGtB,MAAM,qBAAqB,GAAG,eAAe,CAAC;AAE9C;;;GAGG;AACH,MAAM,SAAS,GAAG,CAAC,EACjB,EAAE,EACF,QAAQ,EACR,SAAS,EACT,KAAK,GACU,EAA6B,EAAE;IAC9C,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,WAAW,EAAE,CAAC;IAChD,IAAI,CAAC,QAAQ,E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AClB,EACT,iBAAQ,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAC,QAAQ,YACtC,eAAM,SAAS,EAAC,MAAM,GAAG,GAClB,IACJ,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/ui/FileTree/common/SearchBox/index.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACtD,cAAc,YAAY,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../src/ui/FileTree/common/SearchBox/types.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,60 @@
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
2
|
+
import { useCallback, useId, useMemo } from "react";
|
3
|
+
import File from "../File/File.js";
|
4
|
+
import Folder from "../Folder/Folder.js";
|
5
|
+
/**
|
6
|
+
* Render a tree view of the given file tree data
|
7
|
+
*
|
8
|
+
* @example
|
9
|
+
* <FileTree>
|
10
|
+
* <FileTree.SearchBox />
|
11
|
+
* <FileTree.TreeView tree={treeData} />
|
12
|
+
* </FileTree>
|
13
|
+
*
|
14
|
+
* @returns {React.ReactElement} - Rendered TreeView
|
15
|
+
*/
|
16
|
+
const TreeView = ({ tree, sortAlphabetically, defaultCollapsed = false, }) => {
|
17
|
+
const uid = useId();
|
18
|
+
const renderNode = useCallback((node, basePath = "") => {
|
19
|
+
const path = `${basePath}/${node.name}`;
|
20
|
+
switch (node.type) {
|
21
|
+
case "folder":
|
22
|
+
return (_jsx(Folder, { name: node.name, defaultOpen: !defaultCollapsed, children: node.children?.map((child) => renderNode(child, path)) }, `${uid}-${path}`));
|
23
|
+
case "file":
|
24
|
+
return (_jsx(File, { name: node.name, marker: node.marker }, `${uid}-${path}`));
|
25
|
+
}
|
26
|
+
}, [defaultCollapsed, uid]);
|
27
|
+
const sortedTree = useCallback((tree) => {
|
28
|
+
return [...tree]
|
29
|
+
.sort((a, b) => {
|
30
|
+
// folders first
|
31
|
+
if (a.type === "folder" && b.type === "file") {
|
32
|
+
return -1;
|
33
|
+
}
|
34
|
+
if (a.type === "file" && b.type === "folder") {
|
35
|
+
return 1;
|
36
|
+
}
|
37
|
+
// sort alphabetically
|
38
|
+
return a.name.localeCompare(b.name);
|
39
|
+
})
|
40
|
+
.map((node) => {
|
41
|
+
if (node.type === "folder" && node.children) {
|
42
|
+
// sort recursively folder children
|
43
|
+
return {
|
44
|
+
...node,
|
45
|
+
children: sortedTree(node.children),
|
46
|
+
};
|
47
|
+
}
|
48
|
+
return node;
|
49
|
+
});
|
50
|
+
}, []);
|
51
|
+
const treeNode = useMemo(() => {
|
52
|
+
if (sortAlphabetically) {
|
53
|
+
return sortedTree(tree).map((node) => renderNode(node));
|
54
|
+
}
|
55
|
+
return tree.map((node) => renderNode(node));
|
56
|
+
}, [tree, sortAlphabetically, renderNode, sortedTree]);
|
57
|
+
return _jsx(_Fragment, { children: treeNode });
|
58
|
+
};
|
59
|
+
export default TreeView;
|
60
|
+
//# sourceMappingURL=TreeView.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"TreeView.js","sourceRoot":"","sources":["../../../../../../src/ui/FileTree/common/TreeView/TreeView.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEpD,OAAO,IAAI,MAAM,iBAAiB,CAAC;AACnC,OAAO,MAAM,MAAM,qBAAqB,CAAC;AAGzC;;;;;;;;;;GAUG;AACH,MAAM,QAAQ,GAAG,CAAC,EAChB,IAAI,EACJ,kBAAkB,EAClB,gBAAgB,GAAG,KAAK,GACV,EAAsB,EAAE;IACtC,MAAM,GAAG,GAAG,KAAK,EAAE,CAAC;IAEpB,MAAM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AC,CAAC;QACtC,CAAC,CAAC;aACD,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;YACZ,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;gBAC5C,mCAAmC;gBACnC,OAAO;oBACL,GAAG,IAAI;oBACP,QAAQ,EAAE,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC;iBACpC,CAAC;YACJ,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;IACP,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,EAAE;QAC5B,IAAI,kBAAkB,EAAE,CAAC;YACvB,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;QAC1D,CAAC;QACD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9C,CAAC,EAAE,CAAC,IAAI,EAAE,kBAAkB,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC;IACvD,OAAO,4BAAG,QAAQ,GAAI,CAAC;AACzB,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/ui/FileTree/common/TreeView/index.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAC;AACpD,cAAc,YAAY,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../src/ui/FileTree/common/TreeView/types.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/ui/FileTree/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/ui/FileTree/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { useContext } from "react";
|
2
|
+
import Context from "../Context.js";
|
3
|
+
const useFileTree = () => {
|
4
|
+
const context = useContext(Context);
|
5
|
+
if (!context) {
|
6
|
+
throw new Error("useFileTree must be used within a FileTree component");
|
7
|
+
}
|
8
|
+
return context;
|
9
|
+
};
|
10
|
+
export default useFileTree;
|
11
|
+
//# sourceMappingURL=useFileTree.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useFileTree.js","sourceRoot":"","sources":["../../../../../src/ui/FileTree/hooks/useFileTree.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,OAAO,MAAM,eAAe,CAAC;AAEpC,MAAM,WAAW,GAAG,GAAG,EAAE;IACvB,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IACpC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;IAC1E,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC"}
|