@edifice.io/react 2.5.13-develop-b2school.20260313184353 → 2.5.13-develop-pedago.20260316113612
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/_virtual/common.js +4 -0
- package/dist/_virtual/de_DE.js +4 -0
- package/dist/_virtual/de_DE2.js +4 -0
- package/dist/_virtual/de_DE3.js +4 -0
- package/dist/_virtual/de_DE4.js +4 -0
- package/dist/_virtual/de_DE5.js +4 -0
- package/dist/_virtual/de_DE6.js +4 -0
- package/dist/_virtual/defineProperty.js +4 -0
- package/dist/_virtual/es_ES.js +4 -0
- package/dist/_virtual/es_ES2.js +4 -0
- package/dist/_virtual/es_ES3.js +4 -0
- package/dist/_virtual/es_ES4.js +4 -0
- package/dist/_virtual/es_ES5.js +4 -0
- package/dist/_virtual/es_ES6.js +4 -0
- package/dist/_virtual/fr_FR.js +4 -0
- package/dist/_virtual/fr_FR2.js +4 -0
- package/dist/_virtual/fr_FR3.js +4 -0
- package/dist/_virtual/fr_FR4.js +4 -0
- package/dist/_virtual/fr_FR5.js +4 -0
- package/dist/_virtual/fr_FR6.js +4 -0
- package/dist/_virtual/interopRequireDefault.js +4 -0
- package/dist/_virtual/it_IT.js +4 -0
- package/dist/_virtual/it_IT2.js +4 -0
- package/dist/_virtual/it_IT3.js +4 -0
- package/dist/_virtual/it_IT4.js +4 -0
- package/dist/_virtual/it_IT5.js +4 -0
- package/dist/_virtual/it_IT6.js +4 -0
- package/dist/_virtual/objectSpread2.js +4 -0
- package/dist/_virtual/pt_PT.js +4 -0
- package/dist/_virtual/pt_PT2.js +4 -0
- package/dist/_virtual/pt_PT3.js +4 -0
- package/dist/_virtual/pt_PT4.js +4 -0
- package/dist/_virtual/pt_PT5.js +4 -0
- package/dist/_virtual/pt_PT6.js +4 -0
- package/dist/_virtual/toPrimitive.js +4 -0
- package/dist/_virtual/toPropertyKey.js +4 -0
- package/dist/_virtual/typeof.js +4 -0
- package/dist/components/AddAttachments/AddAttachments.d.ts +6 -3
- package/dist/components/AddAttachments/AddAttachments.js +17 -29
- package/dist/components/AddAttachments/hooks/useFileToAttachment.d.ts +3 -0
- package/dist/components/AddAttachments/hooks/useFileToAttachment.js +16 -0
- package/dist/components/AddAttachments/models/attachment.d.ts +1 -0
- package/dist/components/Badge/Badge.js +1 -0
- package/dist/components/Layout/components/WidgetApps.js +2 -2
- package/dist/components/MediaViewer/PdfViewer.js +4 -14
- package/dist/components/SegmentedControl/SegmentedControl.d.ts +0 -8
- package/dist/components/SegmentedControl/SegmentedControl.js +6 -12
- package/dist/components/UserSearch/UserSearch.d.ts +7 -0
- package/dist/components/UserSearch/UserSearch.js +82 -0
- package/dist/components/UserSearch/index.d.ts +3 -0
- package/dist/components/UserSearch/types/types.d.ts +29 -0
- package/dist/components/UserSearch/types/visible.d.ts +24 -0
- package/dist/components/UserSearch/types/visible.js +4 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/hooks/useConversation/useConversation.js +4 -2
- package/dist/hooks/useDropzone/useDropzone.js +4 -4
- package/dist/hooks/usePreferences/usePreferences.d.ts +3 -3
- package/dist/hooks/useToast/useToast.js +5 -5
- package/dist/index.js +6 -0
- package/dist/modules/modals/OnboardingModal/OnboardingModal.d.ts +2 -28
- package/dist/modules/modals/OnboardingModal/OnboardingModal.js +9 -13
- package/dist/modules/modals/OnboardingModal/useOnboardingModal.d.ts +1 -4
- package/dist/modules/modals/OnboardingModal/useOnboardingModal.js +20 -28
- package/dist/modules/modals/ShareModal/ShareResources.js +1 -1
- package/dist/node_modules/.pnpm/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/defineProperty.js +18 -0
- package/dist/node_modules/.pnpm/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/interopRequireDefault.js +13 -0
- package/dist/node_modules/.pnpm/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/objectSpread2.js +31 -0
- package/dist/node_modules/.pnpm/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/toPrimitive.js +20 -0
- package/dist/node_modules/.pnpm/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/toPropertyKey.js +15 -0
- package/dist/node_modules/.pnpm/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/typeof.js +16 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/calendar/locale/de_DE.js +11 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/calendar/locale/es_ES.js +11 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/calendar/locale/fr_FR.js +11 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/calendar/locale/it_IT.js +11 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/calendar/locale/pt_PT.js +11 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/date-picker/locale/de_DE.js +22 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/date-picker/locale/es_ES.js +22 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/date-picker/locale/fr_FR.js +27 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/date-picker/locale/it_IT.js +20 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/date-picker/locale/pt_PT.js +45 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/locale/de_DE.js +145 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/locale/es_ES.js +145 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/locale/fr_FR.js +144 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/locale/it_IT.js +156 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/locale/pt_PT.js +158 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/time-picker/locale/de_DE.js +10 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/time-picker/locale/es_ES.js +10 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/time-picker/locale/fr_FR.js +10 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/time-picker/locale/it_IT.js +10 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/time-picker/locale/pt_PT.js +10 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/locale/de_DE.js +8 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/locale/es_ES.js +8 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/locale/fr_FR.js +8 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/locale/it_IT.js +8 -0
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/locale/pt_PT.js +8 -0
- package/dist/node_modules/.pnpm/rc-pagination@5.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-pagination/lib/locale/de_DE.js +21 -0
- package/dist/node_modules/.pnpm/rc-pagination@5.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-pagination/lib/locale/es_ES.js +21 -0
- package/dist/node_modules/.pnpm/rc-pagination@5.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-pagination/lib/locale/fr_FR.js +21 -0
- package/dist/node_modules/.pnpm/rc-pagination@5.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-pagination/lib/locale/it_IT.js +21 -0
- package/dist/node_modules/.pnpm/rc-pagination@5.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-pagination/lib/locale/pt_PT.js +21 -0
- package/dist/node_modules/.pnpm/rc-picker@4.11.3_dayjs@1.11.19_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-picker/lib/locale/common.js +14 -0
- package/dist/node_modules/.pnpm/rc-picker@4.11.3_dayjs@1.11.19_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-picker/lib/locale/de_DE.js +37 -0
- package/dist/node_modules/.pnpm/rc-picker@4.11.3_dayjs@1.11.19_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-picker/lib/locale/es_ES.js +37 -0
- package/dist/node_modules/.pnpm/rc-picker@4.11.3_dayjs@1.11.19_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-picker/lib/locale/fr_FR.js +38 -0
- package/dist/node_modules/.pnpm/rc-picker@4.11.3_dayjs@1.11.19_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-picker/lib/locale/it_IT.js +37 -0
- package/dist/node_modules/.pnpm/rc-picker@4.11.3_dayjs@1.11.19_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-picker/lib/locale/pt_PT.js +39 -0
- package/dist/providers/AntThemeProvider/AntProvider.js +5 -5
- package/package.json +7 -7
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { Attachment } from './models/attachment';
|
|
2
|
+
export type SingleAttachmentType = Attachment;
|
|
3
|
+
export { useFileToAttachment } from './hooks/useFileToAttachment';
|
|
2
4
|
export interface AddAttachmentsProps {
|
|
3
5
|
attachments: Attachment[];
|
|
4
|
-
|
|
5
|
-
|
|
6
|
+
onChange?: (attachments: Attachment[]) => void;
|
|
7
|
+
onFilesSelected?: (files: File[]) => void;
|
|
8
|
+
onRemoveAttachment?: (attachmentId: string) => void;
|
|
6
9
|
editMode?: boolean;
|
|
7
10
|
isMutating?: boolean;
|
|
8
11
|
onCopyToWorkspace?: (attachments: Attachment[], folderId: string) => Promise<boolean>;
|
|
@@ -12,7 +15,7 @@ export interface AddAttachmentsProps {
|
|
|
12
15
|
downloadAllUrl?: string;
|
|
13
16
|
}
|
|
14
17
|
export declare const AddAttachments: {
|
|
15
|
-
({ attachments, onFilesSelected, onRemoveAttachment, editMode, isMutating, onCopyToWorkspace, getDownloadUrl, downloadAllUrl, }: AddAttachmentsProps): import("react/jsx-runtime").JSX.Element | null;
|
|
18
|
+
({ attachments, onChange, onFilesSelected, onRemoveAttachment, editMode, isMutating, onCopyToWorkspace, getDownloadUrl, downloadAllUrl, }: AddAttachmentsProps): import("react/jsx-runtime").JSX.Element | null;
|
|
16
19
|
displayName: string;
|
|
17
20
|
};
|
|
18
21
|
export default AddAttachments;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
2
|
import clsx from "clsx";
|
|
3
|
-
import { useRef, useState
|
|
3
|
+
import { useRef, useState } from "react";
|
|
4
4
|
import { useTranslation } from "react-i18next";
|
|
5
5
|
import SvgIconDelete from "../../modules/icons/components/IconDelete.js";
|
|
6
6
|
import SvgIconDownload from "../../modules/icons/components/IconDownload.js";
|
|
@@ -8,22 +8,13 @@ import SvgIconFolderAdd from "../../modules/icons/components/IconFolderAdd.js";
|
|
|
8
8
|
import SvgIconPlus from "../../modules/icons/components/IconPlus.js";
|
|
9
9
|
import { AddAttachmentToWorkspaceModal } from "./components/AddAttachmentToWorkspaceModal.js";
|
|
10
10
|
import { SingleAttachment } from "./components/SingleAttachment.js";
|
|
11
|
+
import { useFileToAttachment } from "./hooks/useFileToAttachment.js";
|
|
11
12
|
import Flex from "../Flex/Flex.js";
|
|
12
13
|
import IconButton from "../Button/IconButton.js";
|
|
13
14
|
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
15
|
const AddAttachments = ({
|
|
26
16
|
attachments,
|
|
17
|
+
onChange,
|
|
27
18
|
onFilesSelected,
|
|
28
19
|
onRemoveAttachment,
|
|
29
20
|
editMode = !1,
|
|
@@ -34,10 +25,8 @@ const AddAttachments = ({
|
|
|
34
25
|
}) => {
|
|
35
26
|
const {
|
|
36
27
|
t
|
|
37
|
-
} = useTranslation(), inputRef = useRef(null),
|
|
38
|
-
if (
|
|
39
|
-
attachments.length > prevAttachmentsLengthRef.current && setOptimisticAttachments([]), prevAttachmentsLengthRef.current = attachments.length;
|
|
40
|
-
}, [attachments.length]), !editMode && !displayedAttachments.length) return null;
|
|
28
|
+
} = useTranslation(), inputRef = useRef(null), fileToAttachment = useFileToAttachment(), [attachmentsToAddToWorkspace, setAttachmentsToAddToWorkspace] = useState(void 0);
|
|
29
|
+
if (!editMode && !attachments.length) return null;
|
|
41
30
|
const resetInputValue = () => {
|
|
42
31
|
inputRef.current && (inputRef.current.value = "");
|
|
43
32
|
}, handleAttachClick = () => {
|
|
@@ -46,36 +35,34 @@ const AddAttachments = ({
|
|
|
46
35
|
}, handleFileChange = (event) => {
|
|
47
36
|
const files = Array.from(event.target.files ?? []);
|
|
48
37
|
if (files.length > 0) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
setOptimisticAttachments((prev) => [...prev, ...newOptimistic]);
|
|
38
|
+
const newAttachments = files.map(fileToAttachment);
|
|
39
|
+
onChange == null || onChange([...attachments, ...newAttachments]), onFilesSelected == null || onFilesSelected(files);
|
|
52
40
|
}
|
|
53
41
|
resetInputValue();
|
|
54
42
|
}, handleDetachAllClick = () => {
|
|
55
|
-
|
|
56
|
-
onRemoveAttachment(attachment.id);
|
|
57
|
-
}), resetInputValue();
|
|
43
|
+
onChange == null || onChange([]), attachments.forEach((a) => onRemoveAttachment == null ? void 0 : onRemoveAttachment(a.id)), resetInputValue();
|
|
58
44
|
}, handleDetachClick = (attachmentId) => {
|
|
59
|
-
|
|
45
|
+
const next = attachments.filter((a) => a.id !== attachmentId);
|
|
46
|
+
onChange == null || onChange(next), onRemoveAttachment == null || onRemoveAttachment(attachmentId), resetInputValue();
|
|
60
47
|
}, handleCopyToWorkspace = (attachments2) => {
|
|
61
48
|
setAttachmentsToAddToWorkspace(attachments2);
|
|
62
49
|
}, className = clsx("bg-gray-200 rounded px-12 py-8 message-attachments align-self-start gap-8 d-flex flex-column mw-100", {
|
|
63
50
|
"border add-attachments-edit mx-16": editMode
|
|
64
51
|
});
|
|
65
52
|
return /* @__PURE__ */ jsxs("div", { className, "data-drag-handle": !0, children: [
|
|
66
|
-
!!
|
|
53
|
+
!!attachments.length && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
67
54
|
/* @__PURE__ */ jsxs(Flex, { direction: "row", align: "center", justify: "between", className: "border-bottom", children: [
|
|
68
55
|
/* @__PURE__ */ jsx("span", { className: "caption fw-bold my-8", children: t("attachments") }),
|
|
69
|
-
|
|
70
|
-
onCopyToWorkspace && /* @__PURE__ */ jsx(IconButton, { title: t("conversation.copy.all.toworkspace"), color: "tertiary", type: "button", icon: /* @__PURE__ */ jsx(SvgIconFolderAdd, {}), onClick: () => handleCopyToWorkspace(
|
|
56
|
+
attachments.length > 1 && /* @__PURE__ */ jsxs("div", { children: [
|
|
57
|
+
onCopyToWorkspace && /* @__PURE__ */ jsx(IconButton, { title: t("conversation.copy.all.toworkspace"), color: "tertiary", type: "button", icon: /* @__PURE__ */ jsx(SvgIconFolderAdd, {}), onClick: () => handleCopyToWorkspace(attachments), variant: "ghost" }),
|
|
71
58
|
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
59
|
editMode && /* @__PURE__ */ jsx(IconButton, { title: t("remove.all.attachment"), color: "danger", type: "button", icon: /* @__PURE__ */ jsx(SvgIconDelete, {}), variant: "ghost", onClick: handleDetachAllClick, disabled: isMutating })
|
|
73
60
|
] })
|
|
74
61
|
] }),
|
|
75
|
-
/* @__PURE__ */ jsx("ul", { className: "d-flex gap-8 flex-column list-unstyled m-0", children:
|
|
62
|
+
/* @__PURE__ */ jsx("ul", { className: "d-flex gap-8 flex-column list-unstyled m-0", children: attachments.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}-${attachment.name}`)) })
|
|
76
63
|
] }),
|
|
77
64
|
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") }),
|
|
65
|
+
/* @__PURE__ */ jsx(Button, { color: "secondary", variant: "ghost", isLoading: isMutating, onClick: handleAttachClick, disabled: isMutating, className: "align-self-start", leftIcon: /* @__PURE__ */ jsx(SvgIconPlus, {}), "data-testid": "common-add-attachments-button-add-attachment", children: t("add.attachment") }),
|
|
79
66
|
/* @__PURE__ */ jsx("input", { ref: inputRef, multiple: !0, type: "file", name: "attachment-input", id: "attachment-input", onChange: handleFileChange, hidden: !0 })
|
|
80
67
|
] }),
|
|
81
68
|
onCopyToWorkspace && !!attachmentsToAddToWorkspace && /* @__PURE__ */ jsx(AddAttachmentToWorkspaceModal, { isOpen: !0, onModalClose: () => setAttachmentsToAddToWorkspace(void 0), attachments: attachmentsToAddToWorkspace, onCopyToWorkspace })
|
|
@@ -83,5 +70,6 @@ const AddAttachments = ({
|
|
|
83
70
|
};
|
|
84
71
|
export {
|
|
85
72
|
AddAttachments,
|
|
86
|
-
AddAttachments as default
|
|
73
|
+
AddAttachments as default,
|
|
74
|
+
useFileToAttachment
|
|
87
75
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useCallback } from "react";
|
|
2
|
+
function useFileToAttachment() {
|
|
3
|
+
return useCallback((file) => ({
|
|
4
|
+
id: `${file.name}-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
|
|
5
|
+
charset: "UTF-8",
|
|
6
|
+
contentTransferEncoding: "binary",
|
|
7
|
+
contentType: file.type || "application/octet-stream",
|
|
8
|
+
filename: file.name,
|
|
9
|
+
name: file.name,
|
|
10
|
+
size: file.size,
|
|
11
|
+
file
|
|
12
|
+
}), []);
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
useFileToAttachment
|
|
16
|
+
};
|
|
@@ -21,6 +21,7 @@ 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);
|
|
24
25
|
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);
|
|
25
26
|
return /* @__PURE__ */ jsxs("span", { ref, className: classes, ...restProps, children: [
|
|
26
27
|
variant.type === "chip" && /* @__PURE__ */ jsx("div", { className: "d-flex fw-800 align-items-center", children }),
|
|
@@ -11,10 +11,10 @@ const WidgetAppsFooter = () => {
|
|
|
11
11
|
}) => {
|
|
12
12
|
const {
|
|
13
13
|
t
|
|
14
|
-
} = useTranslation()
|
|
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,
|
|
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.category === "connector" ? "_blank" : void 0, rel: appToOpenOnBlank.includes(app.name) || app.isExternal || app.category === "connector" ? "noopener noreferrer" : void 0, children: /* @__PURE__ */ jsx(AppIcon, { app, size: "32" }) }, index))
|
|
18
18
|
] });
|
|
19
19
|
};
|
|
20
20
|
export {
|
|
@@ -1,27 +1,17 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useRef
|
|
2
|
+
import { useState, useRef } from "react";
|
|
3
|
+
import { Document, Page } from "react-pdf";
|
|
3
4
|
import LoadingScreen from "../LoadingScreen/LoadingScreen.js";
|
|
4
5
|
function PdfViewer({
|
|
5
6
|
mediaUrl,
|
|
6
7
|
scale
|
|
7
8
|
}) {
|
|
8
|
-
const [numPages, setNumPages] = useState(null),
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
(async () => {
|
|
11
|
-
try {
|
|
12
|
-
const reactPdf = await import("react-pdf");
|
|
13
|
-
setDocument(() => reactPdf.Document), setPage(() => reactPdf.Page), setIsLoading(!1);
|
|
14
|
-
} catch (error) {
|
|
15
|
-
console.error("Failed to load react-pdf:", error);
|
|
16
|
-
}
|
|
17
|
-
})();
|
|
18
|
-
}, []);
|
|
19
|
-
const onDocumentLoadSuccess = ({
|
|
9
|
+
const [numPages, setNumPages] = useState(null), pagesRef = useRef([]), onDocumentLoadSuccess = ({
|
|
20
10
|
numPages: numPages2
|
|
21
11
|
}) => {
|
|
22
12
|
setNumPages(numPages2);
|
|
23
13
|
};
|
|
24
|
-
return
|
|
14
|
+
return /* @__PURE__ */ jsx("div", { style: {
|
|
25
15
|
width: `calc(600px * ${scale})`,
|
|
26
16
|
height: "calc(100vh - 52px)",
|
|
27
17
|
overflowY: "auto",
|
|
@@ -27,14 +27,6 @@ export interface SegmentedControlProps extends Omit<React.HTMLAttributes<HTMLDiv
|
|
|
27
27
|
* Selected value
|
|
28
28
|
*/
|
|
29
29
|
value?: string;
|
|
30
|
-
/**
|
|
31
|
-
* Variant of the segmented control, affecting its styling.
|
|
32
|
-
* - 'default': standard segmented control with borders.
|
|
33
|
-
* - 'ghost': borderless segmented control, relying on background and text color for distinction.
|
|
34
|
-
*
|
|
35
|
-
* @default 'default'
|
|
36
|
-
*/
|
|
37
|
-
variant?: 'default' | 'ghost';
|
|
38
30
|
/**
|
|
39
31
|
* Callback called when value changes
|
|
40
32
|
*/
|
|
@@ -1,26 +1,20 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Segmented } from "antd";
|
|
3
|
-
import clsx from "clsx";
|
|
4
2
|
import { forwardRef } from "react";
|
|
3
|
+
import { Segmented } from "antd";
|
|
5
4
|
const SegmentedControl = /* @__PURE__ */ forwardRef(({
|
|
6
5
|
options,
|
|
7
6
|
value,
|
|
8
7
|
onChange,
|
|
9
|
-
variant = "default",
|
|
10
|
-
className,
|
|
11
8
|
...htmlProps
|
|
12
9
|
}, ref) => {
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}), antProps = {
|
|
19
|
-
options: transformedOptions,
|
|
10
|
+
const antProps = {
|
|
11
|
+
options: options.map((option) => ({
|
|
12
|
+
...option,
|
|
13
|
+
label: /* @__PURE__ */ jsx("span", { "data-testid": `segmented-option-${option.value}`, children: option.label })
|
|
14
|
+
})),
|
|
20
15
|
value,
|
|
21
16
|
onChange,
|
|
22
17
|
ref,
|
|
23
|
-
className: classNames,
|
|
24
18
|
...htmlProps
|
|
25
19
|
};
|
|
26
20
|
return /* @__PURE__ */ jsx(Segmented, { ...antProps });
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { UserSearchProps, UserSearchRef } from './types/types';
|
|
2
|
+
/**
|
|
3
|
+
* User search component with combobox UI. Supports users, groups and bookmarks,
|
|
4
|
+
* debounced search, and optional sharing/selection tracking.
|
|
5
|
+
* Loading state is managed internally during getSearchResults calls.
|
|
6
|
+
*/
|
|
7
|
+
export declare const UserSearch: import('react').ForwardRefExoticComponent<UserSearchProps & import('react').RefAttributes<UserSearchRef>>;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useState, useEffect, useCallback, useImperativeHandle } from "react";
|
|
3
|
+
import SvgIconBookmark from "../../modules/icons/components/IconBookmark.js";
|
|
4
|
+
import SvgIconGroupAvatar from "../../modules/icons/components/IconGroupAvatar.js";
|
|
5
|
+
import SvgIconUser from "../../modules/icons/components/IconUser.js";
|
|
6
|
+
import { VisibleType } from "./types/visible.js";
|
|
7
|
+
import useDebounce from "../../hooks/useDebounce/useDebounce.js";
|
|
8
|
+
import Combobox from "../Combobox/Combobox.js";
|
|
9
|
+
function buildSharedItemsCacheFromInitialSharings(initialSharings) {
|
|
10
|
+
return new Map(initialSharings.map((item) => [item.recipientId, {
|
|
11
|
+
id: item.recipientId,
|
|
12
|
+
displayName: item.displayName,
|
|
13
|
+
type: item.recipientType === "user" ? VisibleType.User : item.recipientType === "group" ? VisibleType.Group : VisibleType.ShareBookmark
|
|
14
|
+
}]));
|
|
15
|
+
}
|
|
16
|
+
const UserSearch = /* @__PURE__ */ forwardRef(({
|
|
17
|
+
placeholder = "Rechercher un utilisateur",
|
|
18
|
+
isAdmlcOrAdmc = !1,
|
|
19
|
+
bookmarks = [],
|
|
20
|
+
initialSharings = [],
|
|
21
|
+
getSearchResults,
|
|
22
|
+
onSearchResultsChange
|
|
23
|
+
}, ref) => {
|
|
24
|
+
const [searchResults, setSearchResults] = useState(bookmarks), [searchInputValue, setSearchInputValue] = useState(""), debouncedSearchInputValue = useDebounce(searchInputValue, 500), [sharingsIds, setSharingsIds] = useState(new Set(initialSharings.map((item) => item.recipientId))), [sharedItemsCache, setSharedItemsCache] = useState(() => buildSharedItemsCacheFromInitialSharings(initialSharings)), [isLoading, setIsLoading] = useState(!1), searchMinLength = isAdmlcOrAdmc ? 3 : 1, getIcon = (type) => {
|
|
25
|
+
switch (type) {
|
|
26
|
+
case VisibleType.User:
|
|
27
|
+
return /* @__PURE__ */ jsx(SvgIconUser, {});
|
|
28
|
+
case VisibleType.Group:
|
|
29
|
+
case VisibleType.BroadcastGroup:
|
|
30
|
+
return /* @__PURE__ */ jsx(SvgIconGroupAvatar, {});
|
|
31
|
+
case VisibleType.ShareBookmark:
|
|
32
|
+
return /* @__PURE__ */ jsx(SvgIconBookmark, {});
|
|
33
|
+
default:
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
}, searchResultsToOptions = (searchResults2) => searchResults2.map((result) => ({
|
|
37
|
+
value: result.id,
|
|
38
|
+
label: result.displayName,
|
|
39
|
+
icon: getIcon(result.type)
|
|
40
|
+
})), filterResults = (results) => results.filter((result) => !sharingsIds.has(result.id));
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
let cancelled = !1;
|
|
43
|
+
async function getResults() {
|
|
44
|
+
setIsLoading(!0);
|
|
45
|
+
try {
|
|
46
|
+
const response = await getSearchResults(debouncedSearchInputValue);
|
|
47
|
+
if (!cancelled) {
|
|
48
|
+
const rawResults = [...bookmarks, ...response.results];
|
|
49
|
+
setSearchResults(filterResults(rawResults));
|
|
50
|
+
}
|
|
51
|
+
} catch {
|
|
52
|
+
cancelled || setSearchResults(filterResults(bookmarks));
|
|
53
|
+
} finally {
|
|
54
|
+
cancelled || setIsLoading(!1);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return debouncedSearchInputValue.length >= searchMinLength ? getResults() : setSearchResults(filterResults(bookmarks)), () => {
|
|
58
|
+
cancelled = !0, setIsLoading(!1);
|
|
59
|
+
};
|
|
60
|
+
}, [debouncedSearchInputValue]);
|
|
61
|
+
const handleSearchInputChange = (event) => {
|
|
62
|
+
setSearchInputValue(event.target.value);
|
|
63
|
+
}, handleRemoveSharing = useCallback((recipientId) => {
|
|
64
|
+
setSharingsIds((prev) => {
|
|
65
|
+
const next = new Set(prev);
|
|
66
|
+
return next.delete(recipientId), next;
|
|
67
|
+
});
|
|
68
|
+
const cached = sharedItemsCache.get(recipientId);
|
|
69
|
+
cached && setSearchResults((prev) => prev.some((r) => r.id === recipientId) ? prev : [...prev, cached]);
|
|
70
|
+
}, [sharedItemsCache]);
|
|
71
|
+
useImperativeHandle(ref, () => ({
|
|
72
|
+
removeSharing: handleRemoveSharing
|
|
73
|
+
}), [handleRemoveSharing]);
|
|
74
|
+
const handleSearchResultsChange = (model) => {
|
|
75
|
+
const searchResultId = model[0], searchResult = searchResults.find((result) => result.id === searchResultId);
|
|
76
|
+
searchResult && (setSharingsIds((prev) => /* @__PURE__ */ new Set([...prev, searchResult.id])), setSharedItemsCache((prev) => new Map(prev).set(searchResult.id, searchResult)), setSearchResults((prev) => prev.filter((result) => result.id !== searchResult.id)), onSearchResultsChange == null || onSearchResultsChange(searchResult));
|
|
77
|
+
};
|
|
78
|
+
return /* @__PURE__ */ jsx(Combobox, { "data-testid": "common-user-search-input-search", value: searchInputValue, placeholder, isLoading, noResult: searchResults.length === 0, options: searchResultsToOptions(searchResults), searchMinLength, onSearchInputChange: handleSearchInputChange, onSearchResultsChange: handleSearchResultsChange });
|
|
79
|
+
});
|
|
80
|
+
export {
|
|
81
|
+
UserSearch
|
|
82
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { Visible } from './visible';
|
|
3
|
+
export interface UserSearchProps {
|
|
4
|
+
placeholder?: string;
|
|
5
|
+
isAdmlcOrAdmc?: boolean;
|
|
6
|
+
bookmarks?: Visible[];
|
|
7
|
+
initialSharings?: SharingItem[];
|
|
8
|
+
getSearchResults: (searchInputValue: string) => Promise<SearchResponse>;
|
|
9
|
+
onSearchResultsChange?: (searchResult: Visible) => void;
|
|
10
|
+
}
|
|
11
|
+
export interface UserSearchRef {
|
|
12
|
+
removeSharing: (recipientId: string) => void;
|
|
13
|
+
}
|
|
14
|
+
export interface SearchResponse {
|
|
15
|
+
results: Visible[];
|
|
16
|
+
}
|
|
17
|
+
export type SearchResultType = 'user' | 'group' | 'bookmark';
|
|
18
|
+
export interface SearchResultBase {
|
|
19
|
+
id: string;
|
|
20
|
+
displayName: string;
|
|
21
|
+
icon: ReactNode;
|
|
22
|
+
type: SearchResultType;
|
|
23
|
+
}
|
|
24
|
+
export interface SharingItem {
|
|
25
|
+
recipientId: string;
|
|
26
|
+
recipientType: SearchResultType;
|
|
27
|
+
permission: string[];
|
|
28
|
+
displayName: string;
|
|
29
|
+
}
|