@edifice.io/react 2.6.9-develop-pedago.20261013143657 → 2.6.9-develop-integration.20261014184332
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/components/RadioTile/RadioTile.d.ts +35 -0
- package/dist/components/RadioTile/RadioTile.js +22 -0
- package/dist/components/RadioTile/index.d.ts +2 -0
- package/dist/components/Tree/utilities/tree.js +21 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/useGoogleDriveSearch/index.d.ts +1 -0
- package/dist/hooks/useGoogleDriveSearch/useGoogleDriveSearch.d.ts +14 -0
- package/dist/hooks/useGoogleDriveSearch/useGoogleDriveSearch.js +60 -0
- package/dist/hooks/useNextcloudSearch/index.d.ts +1 -0
- package/dist/hooks/useNextcloudSearch/useNextcloudSearch.d.ts +14 -0
- package/dist/hooks/useNextcloudSearch/useNextcloudSearch.js +64 -0
- package/dist/index.js +196 -182
- package/dist/modules/multimedia/FileCard/GoogleDriveFileCard.d.ts +25 -0
- package/dist/modules/multimedia/FileCard/GoogleDriveFileCard.js +102 -0
- package/dist/modules/multimedia/FileCard/NextcloudFileCard.d.ts +25 -0
- package/dist/modules/multimedia/FileCard/NextcloudFileCard.js +102 -0
- package/dist/modules/multimedia/FileCard/index.d.ts +4 -0
- package/dist/modules/multimedia/GoogleDrive/GoogleDrive.d.ts +24 -0
- package/dist/modules/multimedia/GoogleDrive/GoogleDrive.js +100 -0
- package/dist/modules/multimedia/GoogleDrive/index.d.ts +2 -0
- package/dist/modules/multimedia/Linker/InternalLinker/InternalLinker.d.ts +7 -1
- package/dist/modules/multimedia/Linker/InternalLinker/InternalLinker.js +2 -0
- package/dist/modules/multimedia/MediaLibrary/MediaLibrary.d.ts +2 -4
- package/dist/modules/multimedia/MediaLibrary/MediaLibrary.js +48 -14
- package/dist/modules/multimedia/MediaLibrary/MediaLibraryContext.d.ts +0 -4
- package/dist/modules/multimedia/MediaLibrary/innertabs/GoogleDrive.d.ts +1 -0
- package/dist/modules/multimedia/MediaLibrary/innertabs/GoogleDrive.js +61 -0
- package/dist/modules/multimedia/MediaLibrary/innertabs/Nextcloud.d.ts +1 -0
- package/dist/modules/multimedia/MediaLibrary/innertabs/Nextcloud.js +48 -0
- package/dist/modules/multimedia/MediaLibrary/innertabs/Upload.js +1 -2
- package/dist/modules/multimedia/MediaLibrary/innertabs/Workspace.js +0 -3
- package/dist/modules/multimedia/MediaLibrary/innertabs/index.d.ts +2 -0
- package/dist/modules/multimedia/MediaLibrary/innertabs/index.js +4 -0
- package/dist/modules/multimedia/Nextcloud/Nextcloud.d.ts +24 -0
- package/dist/modules/multimedia/Nextcloud/Nextcloud.js +124 -0
- package/dist/modules/multimedia/Nextcloud/index.d.ts +2 -0
- package/dist/modules/multimedia/Workspace/Workspace.js +8 -5
- package/dist/modules/multimedia/index.d.ts +2 -0
- package/dist/multimedia.js +26 -18
- package/package.json +6 -6
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { CSSProperties, InputHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export interface RadioTileProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'children' | 'className' | 'style'> {
|
|
3
|
+
/**
|
|
4
|
+
* Label of the tile. Also used as the accessible name of the radio input.
|
|
5
|
+
*/
|
|
6
|
+
label: ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Optional image: an URL, or any React node (e.g. a background preview).
|
|
9
|
+
*/
|
|
10
|
+
image?: string | ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* Layout of a tile with both an image and a label.
|
|
13
|
+
* Ignored when there is no image or when the label is hidden.
|
|
14
|
+
*/
|
|
15
|
+
orientation?: 'horizontal' | 'vertical';
|
|
16
|
+
/**
|
|
17
|
+
* Visually hide the label (it stays available to screen readers).
|
|
18
|
+
* Use it with an `image` to render an image-only tile.
|
|
19
|
+
*/
|
|
20
|
+
hideLabel?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Additional CSS class names applied to the tile (root element).
|
|
23
|
+
*/
|
|
24
|
+
className?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Inline styles applied to the tile (root element).
|
|
27
|
+
*/
|
|
28
|
+
style?: CSSProperties;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* A radio input presented as a selectable tile, with a label, an image or both.
|
|
32
|
+
* Group tiles together by giving them the same `name`.
|
|
33
|
+
*/
|
|
34
|
+
declare const RadioTile: import('react').ForwardRefExoticComponent<RadioTileProps & import('react').RefAttributes<HTMLInputElement>>;
|
|
35
|
+
export default RadioTile;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
const RadioTile = /* @__PURE__ */ forwardRef(({
|
|
5
|
+
label,
|
|
6
|
+
image,
|
|
7
|
+
orientation = "horizontal",
|
|
8
|
+
hideLabel = !1,
|
|
9
|
+
className,
|
|
10
|
+
style,
|
|
11
|
+
...inputProps
|
|
12
|
+
}, ref) => {
|
|
13
|
+
const hasImage = image != null && image !== !1;
|
|
14
|
+
return /* @__PURE__ */ jsxs("label", { className: clsx("radio-tile", `radio-tile--${hasImage ? hideLabel ? "image" : orientation === "vertical" ? "vertical" : "horizontal" : "text"}`, className), style, children: [
|
|
15
|
+
/* @__PURE__ */ jsx("input", { ref, type: "radio", className: "radio-tile__input visually-hidden", ...inputProps }),
|
|
16
|
+
hasImage && /* @__PURE__ */ jsx("span", { className: "radio-tile__image", children: typeof image == "string" ? /* @__PURE__ */ jsx("img", { src: image, alt: "", loading: "lazy" }) : image }),
|
|
17
|
+
/* @__PURE__ */ jsx("span", { className: clsx("radio-tile__label", hideLabel && "visually-hidden"), children: label })
|
|
18
|
+
] });
|
|
19
|
+
});
|
|
20
|
+
export {
|
|
21
|
+
RadioTile as default
|
|
22
|
+
};
|
|
@@ -16,6 +16,25 @@ function findNodeById(data, id) {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
+
function modifyNode(data, callback) {
|
|
20
|
+
return doModify(data, callback) || data;
|
|
21
|
+
}
|
|
22
|
+
function doModify(current, callback, parent) {
|
|
23
|
+
var _a;
|
|
24
|
+
const result = callback(current, parent);
|
|
25
|
+
if ((_a = result == null ? void 0 : result.children) != null && _a.length) {
|
|
26
|
+
const children = [];
|
|
27
|
+
for (const child of (result == null ? void 0 : result.children) || []) {
|
|
28
|
+
const res = doModify(child, callback, result);
|
|
29
|
+
res && children.push(res);
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
...result,
|
|
33
|
+
children
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
19
38
|
function findPathById(tree, nodeId) {
|
|
20
39
|
let path = [];
|
|
21
40
|
function traverse(node, currentPath) {
|
|
@@ -40,5 +59,6 @@ function findPathById(tree, nodeId) {
|
|
|
40
59
|
}
|
|
41
60
|
export {
|
|
42
61
|
findNodeById,
|
|
43
|
-
findPathById
|
|
62
|
+
findPathById,
|
|
63
|
+
modifyNode
|
|
44
64
|
};
|
|
@@ -45,6 +45,7 @@ export * from './PreventPropagation';
|
|
|
45
45
|
export * from './PromotionCard';
|
|
46
46
|
export * from './Radio';
|
|
47
47
|
export * from './RadioCard';
|
|
48
|
+
export * from './RadioTile';
|
|
48
49
|
export * from './SearchBar';
|
|
49
50
|
export * from './SegmentedControl';
|
|
50
51
|
export * from './Select';
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export * from './useDirectory';
|
|
|
12
12
|
export * from './useDropdown';
|
|
13
13
|
export * from './useDropzone';
|
|
14
14
|
export * from './useEdificeIcons';
|
|
15
|
+
export * from './useGoogleDriveSearch';
|
|
15
16
|
export * from './useHasWorkflow';
|
|
16
17
|
export * from './useHover';
|
|
17
18
|
export * from './useHttpErrorToast';
|
|
@@ -23,6 +24,7 @@ export * from './useIsAdmlcOrAdmc';
|
|
|
23
24
|
export * from './useKeyPress';
|
|
24
25
|
export * from './useLibraryUrl';
|
|
25
26
|
export * from './useMediaLibrary';
|
|
27
|
+
export * from './useNextcloudSearch';
|
|
26
28
|
export * from './usePublicConf';
|
|
27
29
|
export * from './useScreeb';
|
|
28
30
|
export * from './useScrollToTop';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as useGoogleDriveSearch } from './useGoogleDriveSearch';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { GoogleDriveDocument, ID } from '@edifice.io/client';
|
|
2
|
+
import { TreeItem } from '../../components/Tree/types';
|
|
3
|
+
export type GoogleDriveFolderNode = TreeItem & {
|
|
4
|
+
files?: GoogleDriveDocument[];
|
|
5
|
+
};
|
|
6
|
+
export default function useGoogleDriveSearch(rootId: string, rootName: string, userId?: string): {
|
|
7
|
+
root: GoogleDriveFolderNode;
|
|
8
|
+
needsAuth: boolean;
|
|
9
|
+
isCheckingAuth: boolean;
|
|
10
|
+
isAuthError: boolean;
|
|
11
|
+
refetchAuthStatus: () => void;
|
|
12
|
+
loadContent: (folderId?: ID) => void;
|
|
13
|
+
loadError: unknown;
|
|
14
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { useState, useCallback } from "react";
|
|
2
|
+
import { odeServices } from "@edifice.io/client";
|
|
3
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
4
|
+
import { findNodeById, modifyNode } from "../../components/Tree/utilities/tree.js";
|
|
5
|
+
function useGoogleDriveSearch(rootId, rootName, userId) {
|
|
6
|
+
const [root, setRoot] = useState({
|
|
7
|
+
id: rootId,
|
|
8
|
+
name: rootName,
|
|
9
|
+
section: !0
|
|
10
|
+
}), updateFolder = useCallback((folderId, subfolders, files) => {
|
|
11
|
+
setRoot((prev) => {
|
|
12
|
+
const node = findNodeById(prev, folderId);
|
|
13
|
+
if (!node) return prev;
|
|
14
|
+
const children = subfolders.map((f) => {
|
|
15
|
+
var _a;
|
|
16
|
+
const existing = (_a = node.children) == null ? void 0 : _a.find((c) => c.id === f.id);
|
|
17
|
+
return existing ? {
|
|
18
|
+
...existing,
|
|
19
|
+
name: f.name
|
|
20
|
+
} : {
|
|
21
|
+
id: f.id,
|
|
22
|
+
name: f.name
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
return modifyNode(prev, (n) => n.id === node.id ? {
|
|
26
|
+
...n,
|
|
27
|
+
children,
|
|
28
|
+
files
|
|
29
|
+
} : n);
|
|
30
|
+
});
|
|
31
|
+
}, []), queryClient = useQueryClient(), [loadError, setLoadError] = useState(null), loadContent = useCallback(async (folderId) => {
|
|
32
|
+
if (!userId) return;
|
|
33
|
+
const parentId = folderId === rootId ? void 0 : folderId;
|
|
34
|
+
try {
|
|
35
|
+
const payload = await queryClient.fetchQuery({
|
|
36
|
+
queryKey: ["googledrive", "documents", userId, parentId ?? "root"],
|
|
37
|
+
queryFn: () => odeServices.googledrive().listDocuments(userId, parentId),
|
|
38
|
+
staleTime: 6e4
|
|
39
|
+
}), subfolders = [], files = [];
|
|
40
|
+
payload.filter((doc) => doc.id !== parentId).forEach((doc) => {
|
|
41
|
+
doc.isFolder ? subfolders.push(doc) : files.push(doc);
|
|
42
|
+
}), setLoadError(null), updateFolder(folderId, subfolders, files);
|
|
43
|
+
} catch (error) {
|
|
44
|
+
setLoadError(error);
|
|
45
|
+
}
|
|
46
|
+
}, [rootId, userId, queryClient, updateFolder]);
|
|
47
|
+
return {
|
|
48
|
+
root,
|
|
49
|
+
needsAuth: !1,
|
|
50
|
+
isCheckingAuth: !1,
|
|
51
|
+
isAuthError: !1,
|
|
52
|
+
refetchAuthStatus: () => {
|
|
53
|
+
},
|
|
54
|
+
loadContent,
|
|
55
|
+
loadError
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
export {
|
|
59
|
+
useGoogleDriveSearch as default
|
|
60
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as useNextcloudSearch } from './useNextcloudSearch';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ID, NextcloudDocument } from '@edifice.io/client';
|
|
2
|
+
import { TreeItem } from '../../components/Tree/types';
|
|
3
|
+
export type NextcloudFolderNode = TreeItem & {
|
|
4
|
+
files?: NextcloudDocument[];
|
|
5
|
+
};
|
|
6
|
+
export default function useNextcloudSearch(rootId: string, rootName: string, userId?: string): {
|
|
7
|
+
root: NextcloudFolderNode;
|
|
8
|
+
needsAuth: boolean;
|
|
9
|
+
isCheckingAuth: boolean;
|
|
10
|
+
isAuthError: boolean;
|
|
11
|
+
refetchAuthStatus: () => void;
|
|
12
|
+
loadContent: (folderId?: ID) => void;
|
|
13
|
+
loadError: unknown;
|
|
14
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { useState, useCallback } from "react";
|
|
2
|
+
import { odeServices } from "@edifice.io/client";
|
|
3
|
+
import { useQueryClient, useQuery } from "@tanstack/react-query";
|
|
4
|
+
import { findNodeById, modifyNode } from "../../components/Tree/utilities/tree.js";
|
|
5
|
+
function useNextcloudSearch(rootId, rootName, userId) {
|
|
6
|
+
var _a;
|
|
7
|
+
const [root, setRoot] = useState({
|
|
8
|
+
id: rootId,
|
|
9
|
+
name: rootName,
|
|
10
|
+
section: !0
|
|
11
|
+
}), updateFolder = useCallback((folderId, subfolders, files) => {
|
|
12
|
+
setRoot((prev) => {
|
|
13
|
+
const node = findNodeById(prev, folderId);
|
|
14
|
+
if (!node) return prev;
|
|
15
|
+
const children = subfolders.map((f) => {
|
|
16
|
+
var _a2;
|
|
17
|
+
const existing = (_a2 = node.children) == null ? void 0 : _a2.find((c) => c.id === f.path);
|
|
18
|
+
return existing ? {
|
|
19
|
+
...existing,
|
|
20
|
+
name: f.name
|
|
21
|
+
} : {
|
|
22
|
+
id: f.path,
|
|
23
|
+
name: f.name
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
return modifyNode(prev, (n) => n.id === node.id ? {
|
|
27
|
+
...n,
|
|
28
|
+
children,
|
|
29
|
+
files
|
|
30
|
+
} : n);
|
|
31
|
+
});
|
|
32
|
+
}, []), queryClient = useQueryClient(), oauth2StatusQuery = useQuery({
|
|
33
|
+
queryKey: ["nextcloud", "oauth2-status", userId],
|
|
34
|
+
queryFn: () => odeServices.nextcloud().getOauth2Status(userId),
|
|
35
|
+
enabled: !!userId
|
|
36
|
+
}), needsAuth = !((_a = oauth2StatusQuery.data) != null && _a.connected), [loadError, setLoadError] = useState(null), loadContent = useCallback(async (folderId) => {
|
|
37
|
+
if (!userId) return;
|
|
38
|
+
const path = folderId === rootId ? void 0 : folderId;
|
|
39
|
+
try {
|
|
40
|
+
const payload = await queryClient.fetchQuery({
|
|
41
|
+
queryKey: ["nextcloud", "documents", userId, path ?? "/"],
|
|
42
|
+
queryFn: () => odeServices.nextcloud().listDocuments(userId, path),
|
|
43
|
+
staleTime: 6e4
|
|
44
|
+
}), subfolders = [], files = [], currentPath = path ?? "/";
|
|
45
|
+
payload.filter((doc) => doc.path !== currentPath).forEach((doc) => {
|
|
46
|
+
doc.isFolder ? subfolders.push(doc) : files.push(doc);
|
|
47
|
+
}), setLoadError(null), updateFolder(folderId, subfolders, files);
|
|
48
|
+
} catch (error) {
|
|
49
|
+
setLoadError(error);
|
|
50
|
+
}
|
|
51
|
+
}, [rootId, userId, queryClient, updateFolder]);
|
|
52
|
+
return {
|
|
53
|
+
root,
|
|
54
|
+
needsAuth,
|
|
55
|
+
isCheckingAuth: oauth2StatusQuery.isLoading,
|
|
56
|
+
isAuthError: oauth2StatusQuery.isError,
|
|
57
|
+
refetchAuthStatus: oauth2StatusQuery.refetch,
|
|
58
|
+
loadContent,
|
|
59
|
+
loadError
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
export {
|
|
63
|
+
useNextcloudSearch as default
|
|
64
|
+
};
|