@edifice.io/react 2.5.10 → 2.5.12-develop-enabling.20260224121421
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/AddAttachments/AddAttachments.d.ts +18 -0
- package/dist/components/AddAttachments/AddAttachments.js +87 -0
- package/dist/components/AddAttachments/components/AddAttachmentToWorkspaceModal.d.ts +9 -0
- package/dist/components/AddAttachments/components/AddAttachmentToWorkspaceModal.js +41 -0
- package/dist/components/AddAttachments/components/SingleAttachment.d.ts +13 -0
- package/dist/components/AddAttachments/components/SingleAttachment.js +27 -0
- package/dist/components/AddAttachments/index.d.ts +2 -0
- package/dist/components/AddAttachments/models/attachment.d.ts +9 -0
- package/dist/components/Badge/Badge.js +1 -11
- package/dist/components/Card/Card.js +1 -1
- package/dist/components/Combobox/Combobox.js +1 -1
- package/dist/components/Dropdown/Dropdown.js +1 -1
- package/dist/components/Form/FormControl.js +1 -1
- package/dist/components/Layout/components/WidgetApps.js +1 -1
- package/dist/components/Modal/Modal.js +1 -1
- package/dist/components/PreventPropagation/PreventPropagation.js +1 -1
- package/dist/components/PromotionCard/PromotionCard.js +1 -1
- package/dist/components/SearchBar/SearchBar.d.ts +2 -2
- package/dist/components/Table/components/Table.js +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/hooks/useConf/useConf.d.ts +1 -1
- package/dist/hooks/useDropdown/useDropdown.js +2 -0
- package/dist/hooks/useSession/useSession.d.ts +1 -1
- package/dist/hooks/useThumbnail/useThumbnail.d.ts +1 -1
- package/dist/hooks/useThumbnail/useThumbnail.js +5 -1
- package/dist/hooks/useUpload/useUpload.js +2 -5
- package/dist/hooks/useWorkspaceFolders/useWorkspaceFolders.d.ts +12 -0
- package/dist/hooks/useWorkspaceFolders/useWorkspaceFolders.js +1 -1
- package/dist/icons.js +302 -298
- package/dist/index.js +2 -0
- package/dist/modules/editor/components/Editor/EditorPreview.js +1 -1
- package/dist/modules/icons/components/IconCollect.d.ts +7 -0
- package/dist/modules/icons/components/IconCollect.js +12 -0
- package/dist/modules/icons/components/IconSubmission.d.ts +7 -0
- package/dist/modules/icons/components/IconSubmission.js +12 -0
- package/dist/modules/icons/components/index.d.ts +2 -0
- package/dist/modules/modals/ResourceModal/ResourceModal.d.ts +1 -1
- package/dist/modules/modals/ResourceModal/hooks/useUpdateMutation.d.ts +1 -1
- package/dist/modules/modals/ShareModal/ShareResources.d.ts +4 -53
- package/dist/modules/modals/ShareModal/apps/ShareBlog.d.ts +1 -1
- package/dist/modules/modals/ShareModal/hooks/useShareBookmark.js +2 -1
- package/dist/modules/modals/ShareModal/hooks/useShareMutation.d.ts +1 -1
- package/dist/modules/multimedia/MediaLibrary/MediaLibrary.js +1 -0
- package/dist/node_modules/.pnpm/{antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1 → antd@5.29.1_react-dom@18.3.1_react@18.3.1__react@18.3.1}/node_modules/antd/lib/date-picker/locale/de_DE.js +2 -2
- package/dist/node_modules/.pnpm/{antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1 → antd@5.29.1_react-dom@18.3.1_react@18.3.1__react@18.3.1}/node_modules/antd/lib/date-picker/locale/es_ES.js +2 -2
- package/dist/node_modules/.pnpm/{antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1 → antd@5.29.1_react-dom@18.3.1_react@18.3.1__react@18.3.1}/node_modules/antd/lib/date-picker/locale/fr_FR.js +2 -2
- package/dist/node_modules/.pnpm/{antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1 → antd@5.29.1_react-dom@18.3.1_react@18.3.1__react@18.3.1}/node_modules/antd/lib/date-picker/locale/it_IT.js +2 -2
- package/dist/node_modules/.pnpm/{antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1 → antd@5.29.1_react-dom@18.3.1_react@18.3.1__react@18.3.1}/node_modules/antd/lib/date-picker/locale/pt_PT.js +2 -2
- package/dist/providers/AntThemeProvider/AntProvider.js +5 -5
- package/dist/providers/EdificeClientProvider/EdificeClientProvider.context.d.ts +1 -1
- package/dist/types/color.d.ts +3 -0
- package/dist/utilities/react-query/react-query-utils.d.ts +1 -1
- package/package.json +50 -50
- /package/dist/node_modules/.pnpm/{antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1 → antd@5.29.1_react-dom@18.3.1_react@18.3.1__react@18.3.1}/node_modules/antd/lib/calendar/locale/de_DE.js +0 -0
- /package/dist/node_modules/.pnpm/{antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1 → antd@5.29.1_react-dom@18.3.1_react@18.3.1__react@18.3.1}/node_modules/antd/lib/calendar/locale/es_ES.js +0 -0
- /package/dist/node_modules/.pnpm/{antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1 → antd@5.29.1_react-dom@18.3.1_react@18.3.1__react@18.3.1}/node_modules/antd/lib/calendar/locale/fr_FR.js +0 -0
- /package/dist/node_modules/.pnpm/{antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1 → antd@5.29.1_react-dom@18.3.1_react@18.3.1__react@18.3.1}/node_modules/antd/lib/calendar/locale/it_IT.js +0 -0
- /package/dist/node_modules/.pnpm/{antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1 → antd@5.29.1_react-dom@18.3.1_react@18.3.1__react@18.3.1}/node_modules/antd/lib/calendar/locale/pt_PT.js +0 -0
- /package/dist/node_modules/.pnpm/{antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1 → antd@5.29.1_react-dom@18.3.1_react@18.3.1__react@18.3.1}/node_modules/antd/lib/locale/de_DE.js +0 -0
- /package/dist/node_modules/.pnpm/{antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1 → antd@5.29.1_react-dom@18.3.1_react@18.3.1__react@18.3.1}/node_modules/antd/lib/locale/es_ES.js +0 -0
- /package/dist/node_modules/.pnpm/{antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1 → antd@5.29.1_react-dom@18.3.1_react@18.3.1__react@18.3.1}/node_modules/antd/lib/locale/fr_FR.js +0 -0
- /package/dist/node_modules/.pnpm/{antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1 → antd@5.29.1_react-dom@18.3.1_react@18.3.1__react@18.3.1}/node_modules/antd/lib/locale/it_IT.js +0 -0
- /package/dist/node_modules/.pnpm/{antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1 → antd@5.29.1_react-dom@18.3.1_react@18.3.1__react@18.3.1}/node_modules/antd/lib/locale/pt_PT.js +0 -0
- /package/dist/node_modules/.pnpm/{antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1 → antd@5.29.1_react-dom@18.3.1_react@18.3.1__react@18.3.1}/node_modules/antd/lib/time-picker/locale/de_DE.js +0 -0
- /package/dist/node_modules/.pnpm/{antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1 → antd@5.29.1_react-dom@18.3.1_react@18.3.1__react@18.3.1}/node_modules/antd/lib/time-picker/locale/es_ES.js +0 -0
- /package/dist/node_modules/.pnpm/{antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1 → antd@5.29.1_react-dom@18.3.1_react@18.3.1__react@18.3.1}/node_modules/antd/lib/time-picker/locale/fr_FR.js +0 -0
- /package/dist/node_modules/.pnpm/{antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1 → antd@5.29.1_react-dom@18.3.1_react@18.3.1__react@18.3.1}/node_modules/antd/lib/time-picker/locale/it_IT.js +0 -0
- /package/dist/node_modules/.pnpm/{antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1 → antd@5.29.1_react-dom@18.3.1_react@18.3.1__react@18.3.1}/node_modules/antd/lib/time-picker/locale/pt_PT.js +0 -0
- /package/dist/node_modules/.pnpm/{antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1 → antd@5.29.1_react-dom@18.3.1_react@18.3.1__react@18.3.1}/node_modules/antd/locale/de_DE.js +0 -0
- /package/dist/node_modules/.pnpm/{antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1 → antd@5.29.1_react-dom@18.3.1_react@18.3.1__react@18.3.1}/node_modules/antd/locale/es_ES.js +0 -0
- /package/dist/node_modules/.pnpm/{antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1 → antd@5.29.1_react-dom@18.3.1_react@18.3.1__react@18.3.1}/node_modules/antd/locale/fr_FR.js +0 -0
- /package/dist/node_modules/.pnpm/{antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1 → antd@5.29.1_react-dom@18.3.1_react@18.3.1__react@18.3.1}/node_modules/antd/locale/it_IT.js +0 -0
- /package/dist/node_modules/.pnpm/{antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1 → antd@5.29.1_react-dom@18.3.1_react@18.3.1__react@18.3.1}/node_modules/antd/locale/pt_PT.js +0 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Attachment } from './models/attachment';
|
|
2
|
+
export interface AddAttachmentsProps {
|
|
3
|
+
attachments: Attachment[];
|
|
4
|
+
onFilesSelected: (files: File[]) => void;
|
|
5
|
+
onRemoveAttachment: (attachmentId: string) => void;
|
|
6
|
+
editMode?: boolean;
|
|
7
|
+
isMutating?: boolean;
|
|
8
|
+
onCopyToWorkspace?: (attachments: Attachment[], folderId: string) => Promise<boolean>;
|
|
9
|
+
/** Si fourni, chaque pièce jointe affiche un bouton télécharger avec l'URL retournée. */
|
|
10
|
+
getDownloadUrl?: (attachmentId: string) => string;
|
|
11
|
+
/** Si fourni et qu'il y a plusieurs pièces jointes, affiche un bouton « télécharger tout ». */
|
|
12
|
+
downloadAllUrl?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const AddAttachments: {
|
|
15
|
+
({ attachments, onFilesSelected, onRemoveAttachment, editMode, isMutating, onCopyToWorkspace, getDownloadUrl, downloadAllUrl, }: AddAttachmentsProps): import("react/jsx-runtime").JSX.Element | null;
|
|
16
|
+
displayName: string;
|
|
17
|
+
};
|
|
18
|
+
export default AddAttachments;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import { useRef, useState, useEffect } from "react";
|
|
4
|
+
import { useTranslation } from "react-i18next";
|
|
5
|
+
import SvgIconDelete from "../../modules/icons/components/IconDelete.js";
|
|
6
|
+
import SvgIconDownload from "../../modules/icons/components/IconDownload.js";
|
|
7
|
+
import SvgIconFolderAdd from "../../modules/icons/components/IconFolderAdd.js";
|
|
8
|
+
import SvgIconPlus from "../../modules/icons/components/IconPlus.js";
|
|
9
|
+
import { AddAttachmentToWorkspaceModal } from "./components/AddAttachmentToWorkspaceModal.js";
|
|
10
|
+
import { SingleAttachment } from "./components/SingleAttachment.js";
|
|
11
|
+
import Flex from "../Flex/Flex.js";
|
|
12
|
+
import IconButton from "../Button/IconButton.js";
|
|
13
|
+
import Button from "../Button/Button.js";
|
|
14
|
+
function fileToAttachment(file) {
|
|
15
|
+
return {
|
|
16
|
+
id: `${file.name}-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
|
|
17
|
+
charset: "UTF-8",
|
|
18
|
+
contentTransferEncoding: "binary",
|
|
19
|
+
contentType: file.type || "application/octet-stream",
|
|
20
|
+
filename: file.name,
|
|
21
|
+
name: file.name,
|
|
22
|
+
size: file.size
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
const AddAttachments = ({
|
|
26
|
+
attachments,
|
|
27
|
+
onFilesSelected,
|
|
28
|
+
onRemoveAttachment,
|
|
29
|
+
editMode = !1,
|
|
30
|
+
isMutating = !1,
|
|
31
|
+
onCopyToWorkspace,
|
|
32
|
+
getDownloadUrl,
|
|
33
|
+
downloadAllUrl
|
|
34
|
+
}) => {
|
|
35
|
+
const {
|
|
36
|
+
t
|
|
37
|
+
} = useTranslation(), inputRef = useRef(null), [optimisticAttachments, setOptimisticAttachments] = useState([]), [attachmentsToAddToWorkspace, setAttachmentsToAddToWorkspace] = useState(void 0), prevAttachmentsLengthRef = useRef(attachments.length), displayedAttachments = [...attachments, ...optimisticAttachments];
|
|
38
|
+
if (useEffect(() => {
|
|
39
|
+
attachments.length > prevAttachmentsLengthRef.current && setOptimisticAttachments([]), prevAttachmentsLengthRef.current = attachments.length;
|
|
40
|
+
}, [attachments.length]), !editMode && !displayedAttachments.length) return null;
|
|
41
|
+
const resetInputValue = () => {
|
|
42
|
+
inputRef.current && (inputRef.current.value = "");
|
|
43
|
+
}, handleAttachClick = () => {
|
|
44
|
+
var _a;
|
|
45
|
+
return (_a = inputRef == null ? void 0 : inputRef.current) == null ? void 0 : _a.click();
|
|
46
|
+
}, handleFileChange = (event) => {
|
|
47
|
+
const files = Array.from(event.target.files ?? []);
|
|
48
|
+
if (files.length > 0) {
|
|
49
|
+
onFilesSelected(files);
|
|
50
|
+
const newOptimistic = files.map(fileToAttachment);
|
|
51
|
+
setOptimisticAttachments((prev) => [...prev, ...newOptimistic]);
|
|
52
|
+
}
|
|
53
|
+
resetInputValue();
|
|
54
|
+
}, handleDetachAllClick = () => {
|
|
55
|
+
setOptimisticAttachments([]), attachments.forEach((attachment) => {
|
|
56
|
+
onRemoveAttachment(attachment.id);
|
|
57
|
+
}), resetInputValue();
|
|
58
|
+
}, handleDetachClick = (attachmentId) => {
|
|
59
|
+
optimisticAttachments.some((attachment) => attachment.id === attachmentId) ? setOptimisticAttachments((prev) => prev.filter((attachment) => attachment.id !== attachmentId)) : onRemoveAttachment(attachmentId), resetInputValue();
|
|
60
|
+
}, handleCopyToWorkspace = (attachments2) => {
|
|
61
|
+
setAttachmentsToAddToWorkspace(attachments2);
|
|
62
|
+
}, className = clsx("bg-gray-200 rounded px-12 py-8 message-attachments align-self-start gap-8 d-flex flex-column mw-100", {
|
|
63
|
+
"border add-attachments-edit mx-16": editMode
|
|
64
|
+
});
|
|
65
|
+
return /* @__PURE__ */ jsxs("div", { className, "data-drag-handle": !0, children: [
|
|
66
|
+
!!displayedAttachments.length && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
67
|
+
/* @__PURE__ */ jsxs(Flex, { direction: "row", align: "center", justify: "between", className: "border-bottom", children: [
|
|
68
|
+
/* @__PURE__ */ jsx("span", { className: "caption fw-bold my-8", children: t("attachments") }),
|
|
69
|
+
displayedAttachments.length > 1 && /* @__PURE__ */ jsxs("div", { children: [
|
|
70
|
+
onCopyToWorkspace && /* @__PURE__ */ jsx(IconButton, { title: t("conversation.copy.all.toworkspace"), color: "tertiary", type: "button", icon: /* @__PURE__ */ jsx(SvgIconFolderAdd, {}), onClick: () => handleCopyToWorkspace(displayedAttachments), variant: "ghost" }),
|
|
71
|
+
downloadAllUrl && /* @__PURE__ */ jsx("a", { href: downloadAllUrl, download: !0, children: /* @__PURE__ */ jsx(IconButton, { title: t("download.all.attachment"), color: "tertiary", type: "button", icon: /* @__PURE__ */ jsx(SvgIconDownload, {}), variant: "ghost" }) }),
|
|
72
|
+
editMode && /* @__PURE__ */ jsx(IconButton, { title: t("remove.all.attachment"), color: "danger", type: "button", icon: /* @__PURE__ */ jsx(SvgIconDelete, {}), variant: "ghost", onClick: handleDetachAllClick, disabled: isMutating })
|
|
73
|
+
] })
|
|
74
|
+
] }),
|
|
75
|
+
/* @__PURE__ */ jsx("ul", { className: "d-flex gap-8 flex-column list-unstyled m-0", children: displayedAttachments.map((attachment) => /* @__PURE__ */ jsx("li", { className: "mw-100", children: /* @__PURE__ */ jsx(SingleAttachment, { attachment, editMode, onDelete: handleDetachClick, onCopyToWorkspace: onCopyToWorkspace ? (attachment2) => handleCopyToWorkspace([attachment2]) : void 0, getDownloadUrl, disabled: isMutating }) }, attachment.id)) })
|
|
76
|
+
] }),
|
|
77
|
+
editMode && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
78
|
+
/* @__PURE__ */ jsx(Button, { color: "secondary", variant: "ghost", isLoading: isMutating, onClick: handleAttachClick, disabled: isMutating, className: "align-self-start", leftIcon: /* @__PURE__ */ jsx(SvgIconPlus, {}), children: t("add.attachment") }),
|
|
79
|
+
/* @__PURE__ */ jsx("input", { ref: inputRef, multiple: !0, type: "file", name: "attachment-input", id: "attachment-input", onChange: handleFileChange, hidden: !0 })
|
|
80
|
+
] }),
|
|
81
|
+
onCopyToWorkspace && !!attachmentsToAddToWorkspace && /* @__PURE__ */ jsx(AddAttachmentToWorkspaceModal, { isOpen: !0, onModalClose: () => setAttachmentsToAddToWorkspace(void 0), attachments: attachmentsToAddToWorkspace, onCopyToWorkspace })
|
|
82
|
+
] });
|
|
83
|
+
};
|
|
84
|
+
export {
|
|
85
|
+
AddAttachments,
|
|
86
|
+
AddAttachments as default
|
|
87
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Attachment } from '../models/attachment';
|
|
2
|
+
interface AddAttachmentToWorkspaceModalProps {
|
|
3
|
+
attachments: Attachment[];
|
|
4
|
+
onModalClose: () => void;
|
|
5
|
+
isOpen?: boolean;
|
|
6
|
+
onCopyToWorkspace: (attachments: Attachment[], folderId: string) => Promise<boolean>;
|
|
7
|
+
}
|
|
8
|
+
export declare function AddAttachmentToWorkspaceModal({ attachments, isOpen, onModalClose, onCopyToWorkspace, }: AddAttachmentToWorkspaceModalProps): import('react').ReactPortal;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect } from "react";
|
|
3
|
+
import { createPortal } from "react-dom";
|
|
4
|
+
import { toast } from "react-hot-toast";
|
|
5
|
+
import { useTranslation } from "react-i18next";
|
|
6
|
+
import Modal from "../../Modal/Modal.js";
|
|
7
|
+
import WorkspaceFolders from "../../../modules/multimedia/WorkspaceFolders/WorkspaceFolders.js";
|
|
8
|
+
import Button from "../../Button/Button.js";
|
|
9
|
+
function AddAttachmentToWorkspaceModal({
|
|
10
|
+
attachments,
|
|
11
|
+
isOpen = !1,
|
|
12
|
+
onModalClose,
|
|
13
|
+
onCopyToWorkspace
|
|
14
|
+
}) {
|
|
15
|
+
const {
|
|
16
|
+
t
|
|
17
|
+
} = useTranslation(), [selectedFolderIdToCopyFile, setSelectedFolderIdToCopyFile] = useState(void 0), [isLoading, setIsLoading] = useState(!1), [disabled, setDisabled] = useState(!1), handleFolderSelected = (folderId, canCopyFileInto) => {
|
|
18
|
+
setSelectedFolderIdToCopyFile(canCopyFileInto ? folderId : void 0);
|
|
19
|
+
}, handleAddAttachmentToWorkspace = async () => {
|
|
20
|
+
if (selectedFolderIdToCopyFile === void 0) return;
|
|
21
|
+
setIsLoading(!0), await onCopyToWorkspace(attachments, selectedFolderIdToCopyFile) ? onModalClose() : toast.error(t("attachments.add.to.folder.modal.error")), setIsLoading(!1);
|
|
22
|
+
};
|
|
23
|
+
return useEffect(() => {
|
|
24
|
+
setDisabled(selectedFolderIdToCopyFile === void 0);
|
|
25
|
+
}, [selectedFolderIdToCopyFile]), /* @__PURE__ */ createPortal(/* @__PURE__ */ jsxs(Modal, { isOpen, onModalClose, id: "add-attachment-to-workspace-modal", size: "md", children: [
|
|
26
|
+
/* @__PURE__ */ jsx(Modal.Header, { onModalClose, children: t("attachments.add.to.folder.modal.title") }),
|
|
27
|
+
/* @__PURE__ */ jsx(Modal.Body, { children: /* @__PURE__ */ jsxs("div", { className: "d-flex flex-column gap-12", children: [
|
|
28
|
+
/* @__PURE__ */ jsx("p", { children: t("attachments.add.to.folder.modal.description", {
|
|
29
|
+
count: attachments.length
|
|
30
|
+
}) }),
|
|
31
|
+
/* @__PURE__ */ jsx(WorkspaceFolders, { onFolderSelected: handleFolderSelected })
|
|
32
|
+
] }) }),
|
|
33
|
+
/* @__PURE__ */ jsxs(Modal.Footer, { children: [
|
|
34
|
+
/* @__PURE__ */ jsx(Button, { type: "button", color: "tertiary", variant: "ghost", onClick: onModalClose, children: t("attachments.add.to.folder.modal.cancel") }),
|
|
35
|
+
/* @__PURE__ */ jsx(Button, { color: "primary", variant: "filled", onClick: handleAddAttachmentToWorkspace, disabled: isLoading || disabled, isLoading, children: t("attachments.add.to.folder.modal.add") })
|
|
36
|
+
] })
|
|
37
|
+
] }), document.getElementById("portal"));
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
AddAttachmentToWorkspaceModal
|
|
41
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Attachment } from '../models/attachment';
|
|
2
|
+
export interface SingleAttachmentProps {
|
|
3
|
+
attachment: Attachment;
|
|
4
|
+
onDelete: (attachmentId: string) => void;
|
|
5
|
+
editMode?: boolean;
|
|
6
|
+
/** Si fourni, affiche le bouton « copier vers l'espace » et appelle ce callback au clic. */
|
|
7
|
+
onCopyToWorkspace?: (attachment: Attachment) => void;
|
|
8
|
+
/** Si fourni, affiche le bouton télécharger avec l'URL retournée. */
|
|
9
|
+
getDownloadUrl?: (attachmentId: string) => string;
|
|
10
|
+
/** Désactive les boutons d'action (ex. pendant une suppression). */
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare function SingleAttachment({ attachment, onDelete, editMode, onCopyToWorkspace, getDownloadUrl, disabled, }: SingleAttachmentProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import SvgIconDelete from "../../../modules/icons/components/IconDelete.js";
|
|
3
|
+
import SvgIconDownload from "../../../modules/icons/components/IconDownload.js";
|
|
4
|
+
import SvgIconFolderAdd from "../../../modules/icons/components/IconFolderAdd.js";
|
|
5
|
+
import { useTranslation } from "react-i18next";
|
|
6
|
+
import Attachment from "../../Attachment/Attachment.js";
|
|
7
|
+
import IconButton from "../../Button/IconButton.js";
|
|
8
|
+
function SingleAttachment({
|
|
9
|
+
attachment,
|
|
10
|
+
onDelete,
|
|
11
|
+
editMode = !1,
|
|
12
|
+
onCopyToWorkspace,
|
|
13
|
+
getDownloadUrl,
|
|
14
|
+
disabled = !1
|
|
15
|
+
}) {
|
|
16
|
+
const {
|
|
17
|
+
t
|
|
18
|
+
} = useTranslation(), downloadUrl = getDownloadUrl == null ? void 0 : getDownloadUrl(attachment.id);
|
|
19
|
+
return /* @__PURE__ */ jsx(Attachment, { name: attachment.filename, options: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
20
|
+
onCopyToWorkspace && /* @__PURE__ */ jsx(IconButton, { title: t("conversation.copy.toworkspace"), color: "tertiary", type: "button", icon: /* @__PURE__ */ jsx(SvgIconFolderAdd, {}), variant: "ghost", onClick: () => onCopyToWorkspace(attachment), disabled }),
|
|
21
|
+
downloadUrl !== void 0 && /* @__PURE__ */ jsx("a", { href: downloadUrl, download: !0, children: /* @__PURE__ */ jsx(IconButton, { title: t("download.attachment"), color: "tertiary", type: "button", icon: /* @__PURE__ */ jsx(SvgIconDownload, {}), variant: "ghost", disabled }) }),
|
|
22
|
+
editMode && /* @__PURE__ */ jsx(IconButton, { title: t("remove.attachment"), color: "danger", type: "button", icon: /* @__PURE__ */ jsx(SvgIconDelete, {}), variant: "ghost", onClick: () => onDelete(attachment.id), disabled })
|
|
23
|
+
] }) });
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
SingleAttachment
|
|
27
|
+
};
|
|
@@ -21,18 +21,8 @@ const Badge = /* @__PURE__ */ forwardRef(({
|
|
|
21
21
|
const colorAppClassName = getIconClass(variant.app), backgroundLightAppClassName = getBackgroundLightIconClass(variant.app), borderAppClassName = getBorderIconClass(variant.app);
|
|
22
22
|
badgeColorClassName = `${colorAppClassName} ${backgroundLightAppClassName} ${borderAppClassName}`;
|
|
23
23
|
}
|
|
24
|
-
console.log(badgeColorClassName);
|
|
25
24
|
const classes = clsx("badge rounded-pill", (variant.type === "content" || variant.type === "user") && "background" in variant ? "bg-gray-200" : (variant.type === "content" || variant.type === "user") && !("background" in variant) ? "border border-0" : "", variant.type === "content" && `text-${variant.level}`, variant.type === "notification" && `badge-notification bg-${variant.level} text-light border border-0`, variant.type === "user" && `badge-profile-${variant.profile.toLowerCase()}`, variant.type === "link" && "badge-link border border-0", variant.type === "chip" && "bg-gray-200", variant.type === "beta" && badgeColorClassName, className);
|
|
26
|
-
return /* @__PURE__ */ jsxs("span", { ref, className: classes,
|
|
27
|
-
if (variant.type !== "beta") return;
|
|
28
|
-
const color = variant.color ?? "#000000";
|
|
29
|
-
return {
|
|
30
|
-
borderColor: color,
|
|
31
|
-
color,
|
|
32
|
-
backgroundColor: `${color}10`
|
|
33
|
-
// the 2 last hexadecimal numbers are for opacity
|
|
34
|
-
};
|
|
35
|
-
})(), ...restProps, children: [
|
|
25
|
+
return /* @__PURE__ */ jsxs("span", { ref, className: classes, ...restProps, children: [
|
|
36
26
|
variant.type === "chip" && /* @__PURE__ */ jsx("div", { className: "d-flex fw-800 align-items-center", children }),
|
|
37
27
|
variant.type === "beta" && (children ?? "BÊTA"),
|
|
38
28
|
variant.type !== "chip" && variant.type !== "beta" && children
|
|
@@ -39,7 +39,7 @@ const Root = /* @__PURE__ */ forwardRef(({
|
|
|
39
39
|
/* @__PURE__ */ jsx(Card.Header, {}),
|
|
40
40
|
typeof children == "function" ? children(appCode) : children
|
|
41
41
|
] }) });
|
|
42
|
-
}), Card =
|
|
42
|
+
}), Card = Object.assign(Root, {
|
|
43
43
|
Title: CardTitle,
|
|
44
44
|
Text: CardText,
|
|
45
45
|
Image: CardImage,
|
|
@@ -53,7 +53,7 @@ const ComboboxComponent = /* @__PURE__ */ forwardRef(({
|
|
|
53
53
|
}, value, variant, renderInputGroup, renderSelectedItems, hasDefault: !!options.length, onFocus, onBlur, inputRef }),
|
|
54
54
|
/* @__PURE__ */ jsx(Dropdown.Menu, { "data-testid": "combobox-search-menu", children: renderContent() })
|
|
55
55
|
] });
|
|
56
|
-
}), Combobox =
|
|
56
|
+
}), Combobox = Object.assign(ComboboxComponent, {
|
|
57
57
|
Trigger: ComboboxTrigger
|
|
58
58
|
});
|
|
59
59
|
export {
|
|
@@ -67,7 +67,7 @@ const Root = /* @__PURE__ */ forwardRef(({
|
|
|
67
67
|
return useEffect(() => {
|
|
68
68
|
onToggle == null || onToggle(visible);
|
|
69
69
|
}, [visible]), /* @__PURE__ */ jsx(DropdownContext.Provider, { value, children: /* @__PURE__ */ jsx("div", { ref, className: dropdown, children: typeof children == "function" ? children(triggerProps, itemRefs, setVisible) : children }) });
|
|
70
|
-
}), Dropdown =
|
|
70
|
+
}), Dropdown = Object.assign(Root, {
|
|
71
71
|
Trigger: DropdownTrigger,
|
|
72
72
|
Menu: DropdownMenu,
|
|
73
73
|
Item: DropdownItem,
|
|
@@ -22,7 +22,7 @@ const Root = /* @__PURE__ */ forwardRef(({
|
|
|
22
22
|
status
|
|
23
23
|
}), [id, isOptional, isReadOnly, isRequired, status]);
|
|
24
24
|
return /* @__PURE__ */ jsx(Context.Provider, { value: values, children: /* @__PURE__ */ jsx("div", { ref, className, ...restProps, children }) });
|
|
25
|
-
}), FormControl =
|
|
25
|
+
}), FormControl = Object.assign(Root, {
|
|
26
26
|
Label,
|
|
27
27
|
Input,
|
|
28
28
|
Text: FormText
|
|
@@ -14,7 +14,7 @@ const WidgetAppsFooter = () => {
|
|
|
14
14
|
} = useTranslation();
|
|
15
15
|
return /* @__PURE__ */ jsxs("div", { className: "widget-body d-flex flex-wrap", children: [
|
|
16
16
|
!bookmarkedApps.length && /* @__PURE__ */ jsx("div", { className: "text-dark", children: t("navbar.myapps.more") }),
|
|
17
|
-
bookmarkedApps.slice(0, 6).map((app, index) => /* @__PURE__ */ jsx("a", { href: app.address, className: "bookmarked-app", target: appToOpenOnBlank.includes(app.name) || app.isExternal || app.
|
|
17
|
+
bookmarkedApps.slice(0, 6).map((app, index) => /* @__PURE__ */ jsx("a", { href: app.address, className: "bookmarked-app", target: appToOpenOnBlank.includes(app.name) || app.isExternal || app.target === "_blank" ? "_blank" : void 0, rel: appToOpenOnBlank.includes(app.name) || app.isExternal || app.target === "_blank" ? "noopener noreferrer" : void 0, children: /* @__PURE__ */ jsx(AppIcon, { app, size: "32" }) }, index))
|
|
18
18
|
] });
|
|
19
19
|
};
|
|
20
20
|
export {
|
|
@@ -3,7 +3,7 @@ const Root = ({
|
|
|
3
3
|
children
|
|
4
4
|
}) => /* @__PURE__ */ jsx("div", { onClick: (e) => {
|
|
5
5
|
e.stopPropagation();
|
|
6
|
-
}, children }), PreventPropagation =
|
|
6
|
+
}, children }), PreventPropagation = Object.assign(Root, {});
|
|
7
7
|
export {
|
|
8
8
|
PreventPropagation as default
|
|
9
9
|
};
|
|
@@ -17,7 +17,7 @@ const Root = ({
|
|
|
17
17
|
borderColor,
|
|
18
18
|
backgroundColor
|
|
19
19
|
}, children });
|
|
20
|
-
}, PromotionCard =
|
|
20
|
+
}, PromotionCard = Object.assign(Root, {
|
|
21
21
|
Header: PromotionCardHeader,
|
|
22
22
|
Body: PromotionCardBody,
|
|
23
23
|
Icon: PromotionCardIcon,
|
|
@@ -3,7 +3,7 @@ import { Size } from '../../types';
|
|
|
3
3
|
/**
|
|
4
4
|
* Base props shared by both SearchBar variants
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
interface BaseProps extends Omit<React.ComponentPropsWithoutRef<'input'>, 'size'> {
|
|
7
7
|
/**
|
|
8
8
|
* String or template literal key for i18next translation
|
|
9
9
|
*/
|
|
@@ -67,7 +67,7 @@ type DynamicSearchBar = {
|
|
|
67
67
|
/**
|
|
68
68
|
* Props for the SearchBar component
|
|
69
69
|
*/
|
|
70
|
-
|
|
70
|
+
type Props = DefaultSearchBar | DynamicSearchBar;
|
|
71
71
|
export type SearchBarProps = BaseProps & Props;
|
|
72
72
|
/**
|
|
73
73
|
* SearchBar component to handle dynamic or static search input
|
|
@@ -13,7 +13,7 @@ const Root = /* @__PURE__ */ forwardRef(({
|
|
|
13
13
|
overflowY: "auto"
|
|
14
14
|
} : {}, children: /* @__PURE__ */ jsx("table", { ref, className: "table align-middle mb-0", style: {
|
|
15
15
|
overflow: maxHeight ? "visible" : "hidden"
|
|
16
|
-
}, children }) })), Table =
|
|
16
|
+
}, children }) })), Table = Object.assign(Root, {
|
|
17
17
|
Thead: TableThead,
|
|
18
18
|
Th: TableTh,
|
|
19
19
|
Tbody: TableTbody,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { App, IGetConf } from '@edifice.io/client';
|
|
2
2
|
export default function useConf({ appCode }: {
|
|
3
3
|
appCode: App;
|
|
4
|
-
}): import('
|
|
4
|
+
}): import('../../../node_modules/@tanstack/react-query').UseQueryResult<IGetConf, Error>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { IGetSession } from '@edifice.io/client';
|
|
2
|
-
export default function useSession(): import('
|
|
2
|
+
export default function useSession(): import('../../../node_modules/@tanstack/react-query').UseQueryResult<IGetSession, Error>;
|
|
@@ -10,5 +10,5 @@ type LazyLoadOptions = {
|
|
|
10
10
|
* with respect to the [`intersectionOptions`](https://github.com/thebuilder/react-intersection-observer/tree/dceba7f52aebea4d62d539bc55a1db129226bb6c?tab=readme-ov-file#options)
|
|
11
11
|
* @return `true` if `src` is available, or false otherwise, or `null` while not tested.
|
|
12
12
|
*/
|
|
13
|
-
export default function useThumbnail(src: string, options?: LazyLoadOptions): boolean | null;
|
|
13
|
+
export default function useThumbnail(src: string | null | undefined, options?: LazyLoadOptions): boolean | null;
|
|
14
14
|
export {};
|
|
@@ -13,6 +13,10 @@ function useThumbnail(src, options) {
|
|
|
13
13
|
(_a = options == null ? void 0 : options.ref) != null && _a.current && (inViewRef == null || inViewRef(options.ref.current));
|
|
14
14
|
}, [options == null ? void 0 : options.ref, inViewRef]), useEffect(() => {
|
|
15
15
|
if ((options == null ? void 0 : options.ref) === void 0 || inView) {
|
|
16
|
+
if (!src) {
|
|
17
|
+
setStatus(!1);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
16
20
|
const img = new Image();
|
|
17
21
|
return img.src = src, img.onload = () => {
|
|
18
22
|
setStatus(!0);
|
|
@@ -22,7 +26,7 @@ function useThumbnail(src, options) {
|
|
|
22
26
|
img.onload = null, img.onerror = null, setStatus(null);
|
|
23
27
|
};
|
|
24
28
|
}
|
|
25
|
-
}, [inView]), status;
|
|
29
|
+
}, [inView, src]), status;
|
|
26
30
|
}
|
|
27
31
|
export {
|
|
28
32
|
useThumbnail as default
|
|
@@ -87,11 +87,8 @@ const useUpload = (visibility, application = "media-library") => {
|
|
|
87
87
|
children: [],
|
|
88
88
|
created: /* @__PURE__ */ new Date(),
|
|
89
89
|
_shared: [],
|
|
90
|
-
|
|
91
|
-
owner:
|
|
92
|
-
userId: "",
|
|
93
|
-
displayName: ""
|
|
94
|
-
}
|
|
90
|
+
isShared: !1,
|
|
91
|
+
owner: ""
|
|
95
92
|
};
|
|
96
93
|
throw uploadResponse.state === "error" ? new Error(uploadResponse.code || "Error while uploading video") : new Error("Video encoding is still running");
|
|
97
94
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { WorkspaceElement } from '@edifice.io/client';
|
|
2
|
+
export interface CreateFolderParams {
|
|
3
|
+
folderName: string;
|
|
4
|
+
folderParentId?: string;
|
|
5
|
+
}
|
|
6
|
+
declare function useWorkspaceFolders(): {
|
|
7
|
+
folders: WorkspaceElement[];
|
|
8
|
+
createFolderMutation: import('../../../node_modules/@tanstack/react-query').UseMutationResult<any, Error, CreateFolderParams, unknown>;
|
|
9
|
+
canCopyFileIntoFolder: (folderId: string) => boolean;
|
|
10
|
+
isLoading: boolean;
|
|
11
|
+
};
|
|
12
|
+
export default useWorkspaceFolders;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { odeServices } from "@edifice.io/client";
|
|
2
2
|
import { useQueryClient, useQuery, useMutation } from "@tanstack/react-query";
|
|
3
3
|
import { useMemo, useCallback } from "react";
|
|
4
|
-
import { useEdificeClient } from "../../providers/EdificeClientProvider/EdificeClientProvider.hook.js";
|
|
5
4
|
import { useTranslation } from "react-i18next";
|
|
5
|
+
import { useEdificeClient } from "../../providers/EdificeClientProvider/EdificeClientProvider.hook.js";
|
|
6
6
|
import useToast from "../useToast/useToast.js";
|
|
7
7
|
function useWorkspaceFolders() {
|
|
8
8
|
const queryClient = useQueryClient(), {
|