@edifice.io/react 2.5.5-develop-pedago.20260115154750 → 2.5.5-develop-b2school.20260116160825
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/Badge/Badge.d.ts +4 -7
- package/dist/components/Badge/Badge.js +11 -14
- package/dist/components/DatePicker/DatePicker.d.ts +57 -0
- package/dist/components/DatePicker/DatePicker.js +6 -3
- package/dist/components/Modal/Modal.d.ts +4 -0
- package/dist/components/Modal/Modal.js +13 -12
- package/dist/components/index.d.ts +0 -1
- package/dist/hooks/useDropzone/useDropzone.js +21 -16
- package/dist/hooks/useEdificeIcons/useEdificeIcons.d.ts +0 -1
- package/dist/hooks/useEdificeIcons/useEdificeIcons.js +0 -5
- package/dist/index.js +154 -156
- package/dist/modules/comments/components/Comment.js +4 -4
- package/dist/modules/comments/components/CommentDate.js +7 -10
- package/dist/modules/comments/components/CommentDeleted.js +1 -1
- package/dist/modules/comments/components/CommentForm.d.ts +1 -1
- package/dist/modules/comments/components/CommentForm.js +6 -6
- package/dist/modules/comments/components/CommentTitle.js +1 -1
- package/dist/modules/comments/provider/CommentProvider.js +3 -3
- package/dist/modules/modals/OnboardingModal/OnboardingModal.js +5 -5
- package/dist/utilities/mime-types/index.d.ts +1 -0
- package/dist/utilities/mime-types/mime-types-utils.d.ts +1 -0
- package/dist/utilities/mime-types/mime-types-utils.js +4 -0
- package/package.json +6 -7
- package/dist/components/MediaViewer/MediaViewer.d.ts +0 -17
- package/dist/components/MediaViewer/MediaViewer.js +0 -36
- package/dist/components/MediaViewer/MediaWrapper.d.ts +0 -7
- package/dist/components/MediaViewer/MediaWrapper.js +0 -72
- package/dist/components/MediaViewer/PdfViewer.d.ts +0 -4
- package/dist/components/MediaViewer/PdfViewer.js +0 -26
- package/dist/components/MediaViewer/ToolbarViewer.d.ts +0 -7
- package/dist/components/MediaViewer/ToolbarViewer.js +0 -41
- package/dist/components/MediaViewer/ToolbarZoom.d.ts +0 -4
- package/dist/components/MediaViewer/ToolbarZoom.js +0 -19
- package/dist/components/MediaViewer/index.d.ts +0 -2
- package/dist/components/SmartEllipsis/SmartEllipsis.d.ts +0 -5
- package/dist/components/SmartEllipsis/SmartEllipsis.js +0 -21
- package/dist/components/SmartEllipsis/index.d.ts +0 -2
- package/dist/hooks/useZoom/index.d.ts +0 -1
- package/dist/hooks/useZoom/useZoom.d.ts +0 -7
- package/dist/hooks/useZoom/useZoom.js +0 -14
- package/dist/modules/comments/components/CommentHeader.d.ts +0 -3
- package/dist/modules/comments/components/CommentHeader.js +0 -8
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { MediaLibraryType } from 'src/modules/multimedia';
|
|
2
|
-
export interface MediaProps {
|
|
3
|
-
name: string;
|
|
4
|
-
url: string;
|
|
5
|
-
type: MediaLibraryType;
|
|
6
|
-
mimeType?: string;
|
|
7
|
-
}
|
|
8
|
-
interface MediaViewerProps {
|
|
9
|
-
onClose: () => void;
|
|
10
|
-
media: MediaProps[];
|
|
11
|
-
indexMedia?: number;
|
|
12
|
-
}
|
|
13
|
-
declare const MediaViewer: {
|
|
14
|
-
({ onClose, media, indexMedia }: MediaViewerProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
-
displayName: string;
|
|
16
|
-
};
|
|
17
|
-
export default MediaViewer;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Carousel } from "antd";
|
|
3
|
-
import ToolbarZoom from "./ToolbarZoom.js";
|
|
4
|
-
import useZoom from "../../hooks/useZoom/useZoom.js";
|
|
5
|
-
import ToolbarViewer from "./ToolbarViewer.js";
|
|
6
|
-
import { useState, useEffect } from "react";
|
|
7
|
-
import { MediaWrapper } from "./MediaWrapper.js";
|
|
8
|
-
import Flex from "../Flex/Flex.js";
|
|
9
|
-
const MediaViewer = ({
|
|
10
|
-
onClose,
|
|
11
|
-
media,
|
|
12
|
-
indexMedia = 0
|
|
13
|
-
}) => {
|
|
14
|
-
const {
|
|
15
|
-
zoomIn,
|
|
16
|
-
zoomOut,
|
|
17
|
-
setScale,
|
|
18
|
-
scale
|
|
19
|
-
} = useZoom(1), [currentIndex, setCurrentIndex] = useState(indexMedia);
|
|
20
|
-
return useEffect(() => {
|
|
21
|
-
setCurrentIndex(indexMedia);
|
|
22
|
-
}, [indexMedia]), /* @__PURE__ */ jsxs("div", { className: "media-viewer", children: [
|
|
23
|
-
/* @__PURE__ */ jsx(ToolbarViewer, { onClose, mediaUrl: media[currentIndex].url, mediaName: media[currentIndex].name, nbMedia: media.length, currentIndex }),
|
|
24
|
-
/* @__PURE__ */ jsx(Flex, { className: "media-viewer-inner-overlay", onClick: onClose, children: /* @__PURE__ */ jsxs("div", { className: "media-viewer-inner", onClick: (e) => e.stopPropagation(), children: [
|
|
25
|
-
/* @__PURE__ */ jsx(Carousel, { initialSlide: indexMedia, dots: !1, arrows: !0, draggable: !0, infinite: !1, afterChange: (current) => {
|
|
26
|
-
setCurrentIndex(current);
|
|
27
|
-
}, beforeChange: () => {
|
|
28
|
-
setScale(1);
|
|
29
|
-
}, children: media.map((item, index) => /* @__PURE__ */ jsx("div", { className: "viewer-slide", children: /* @__PURE__ */ jsx(MediaWrapper, { mediaUrl: item.url, mediaType: item.type, mimeType: item.mimeType, scale: index === currentIndex ? scale : 1 }) }, index)) }),
|
|
30
|
-
/* @__PURE__ */ jsx(ToolbarZoom, { zoomIn, zoomOut })
|
|
31
|
-
] }) })
|
|
32
|
-
] });
|
|
33
|
-
};
|
|
34
|
-
export {
|
|
35
|
-
MediaViewer as default
|
|
36
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { MediaLibraryType } from 'src/modules/multimedia';
|
|
2
|
-
export declare const MediaWrapper: ({ mediaUrl, mediaType, mimeType, scale, }: {
|
|
3
|
-
mediaUrl: string;
|
|
4
|
-
mediaType: MediaLibraryType;
|
|
5
|
-
mimeType?: string;
|
|
6
|
-
scale?: number;
|
|
7
|
-
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import SvgIconTextPage from "../../modules/icons/components/IconTextPage.js";
|
|
3
|
-
import SvgIconLink from "../../modules/icons/components/IconLink.js";
|
|
4
|
-
import SvgIconHeadphone from "../../modules/icons/components/IconHeadphone.js";
|
|
5
|
-
import SvgIconDownload from "../../modules/icons/components/IconDownload.js";
|
|
6
|
-
import SvgIconExternalLink from "../../modules/icons/components/IconExternalLink.js";
|
|
7
|
-
import { useTranslation } from "react-i18next";
|
|
8
|
-
import PdfViewer from "./PdfViewer.js";
|
|
9
|
-
import Flex from "../Flex/Flex.js";
|
|
10
|
-
import Button from "../Button/Button.js";
|
|
11
|
-
import Image from "../Image/Image.js";
|
|
12
|
-
const MediaWrapper = ({
|
|
13
|
-
mediaUrl,
|
|
14
|
-
mediaType,
|
|
15
|
-
mimeType,
|
|
16
|
-
scale
|
|
17
|
-
}) => {
|
|
18
|
-
const {
|
|
19
|
-
t
|
|
20
|
-
} = useTranslation(), imageMediaStyle = {
|
|
21
|
-
flex: "none",
|
|
22
|
-
height: "100%",
|
|
23
|
-
transform: `scale(${scale})`,
|
|
24
|
-
maxHeight: "70vh"
|
|
25
|
-
}, audioStyle = {
|
|
26
|
-
width: "100%",
|
|
27
|
-
maxWidth: "500px"
|
|
28
|
-
}, videoMediaStyle = {
|
|
29
|
-
height: "100%",
|
|
30
|
-
objectFit: "cover",
|
|
31
|
-
transform: `scale(${scale})`
|
|
32
|
-
}, iframeMediaStyle = {
|
|
33
|
-
width: "100%",
|
|
34
|
-
height: "600px",
|
|
35
|
-
maxWidth: "900px",
|
|
36
|
-
transform: `scale(${scale})`
|
|
37
|
-
};
|
|
38
|
-
switch (mediaType) {
|
|
39
|
-
case "image":
|
|
40
|
-
return /* @__PURE__ */ jsx(Image, { className: "rounded-2", src: mediaUrl, alt: mediaType, width: "100%", objectFit: "contain", style: imageMediaStyle });
|
|
41
|
-
case "audio":
|
|
42
|
-
return /* @__PURE__ */ jsxs(Flex, { direction: "column", align: "center", style: {
|
|
43
|
-
height: "200px"
|
|
44
|
-
}, children: [
|
|
45
|
-
/* @__PURE__ */ jsx(Flex, { justify: "center", align: "center", className: "bg-gray-300 h-100 w-100 rounded-2 mb-8", style: {
|
|
46
|
-
maxWidth: "500px"
|
|
47
|
-
}, children: /* @__PURE__ */ jsx(SvgIconHeadphone, { width: 40, height: 40, color: "#B0B0B0" }) }),
|
|
48
|
-
/* @__PURE__ */ jsx("audio", { src: mediaUrl, className: "media-audio", controls: !0, style: audioStyle })
|
|
49
|
-
] });
|
|
50
|
-
case "video":
|
|
51
|
-
return /* @__PURE__ */ jsx(Flex, { justify: "center", align: "center", children: /* @__PURE__ */ jsx("video", { src: mediaUrl, controls: !0, className: "media-video", style: videoMediaStyle }) });
|
|
52
|
-
case "embedder":
|
|
53
|
-
return /* @__PURE__ */ jsx(Flex, { justify: "center", align: "center", children: /* @__PURE__ */ jsx("iframe", { title: "Embedded media content", src: mediaUrl, className: "media-video", style: iframeMediaStyle }) });
|
|
54
|
-
case "hyperlink":
|
|
55
|
-
case "attachment":
|
|
56
|
-
return mimeType && mimeType === "application/pdf" ? /* @__PURE__ */ jsx(PdfViewer, { mediaUrl, scale }) : /* @__PURE__ */ jsxs(Flex, { direction: "column", align: "center", children: [
|
|
57
|
-
/* @__PURE__ */ jsx(Flex, { justify: "center", align: "center", className: "bg-gray-300 w-100 rounded-2 mb-8", style: {
|
|
58
|
-
maxWidth: "500px",
|
|
59
|
-
height: "200px"
|
|
60
|
-
}, children: mediaType === "hyperlink" ? /* @__PURE__ */ jsx(SvgIconLink, { width: 40, height: 40, color: "#B0B0B0" }) : /* @__PURE__ */ jsx(SvgIconTextPage, { width: 40, height: 40, color: "#B0B0B0" }) }),
|
|
61
|
-
/* @__PURE__ */ jsx("a", { className: "w-100 d-flex justify-content-center", href: mediaUrl, download: mediaType !== "hyperlink", target: "_blank", rel: "noopener noreferrer", children: /* @__PURE__ */ jsx(Button, { className: "w-100", style: {
|
|
62
|
-
height: "40px",
|
|
63
|
-
maxWidth: "500px"
|
|
64
|
-
}, leftIcon: mediaType === "hyperlink" ? /* @__PURE__ */ jsx(SvgIconExternalLink, {}) : /* @__PURE__ */ jsx(SvgIconDownload, {}), color: "tertiary", children: t(mediaType === "hyperlink" ? "mediaWrapper.attachment.open" : "mediaWrapper.attachment.download") }) })
|
|
65
|
-
] });
|
|
66
|
-
default:
|
|
67
|
-
return null;
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
export {
|
|
71
|
-
MediaWrapper
|
|
72
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useRef } from "react";
|
|
3
|
-
import { Document, Page } from "react-pdf";
|
|
4
|
-
import LoadingScreen from "../LoadingScreen/LoadingScreen.js";
|
|
5
|
-
function PdfViewer({
|
|
6
|
-
mediaUrl,
|
|
7
|
-
scale
|
|
8
|
-
}) {
|
|
9
|
-
const [numPages, setNumPages] = useState(null), pagesRef = useRef([]), onDocumentLoadSuccess = ({
|
|
10
|
-
numPages: numPages2
|
|
11
|
-
}) => {
|
|
12
|
-
setNumPages(numPages2);
|
|
13
|
-
};
|
|
14
|
-
return /* @__PURE__ */ jsx("div", { style: {
|
|
15
|
-
width: `calc(600px * ${scale})`,
|
|
16
|
-
height: "calc(100vh - 52px)",
|
|
17
|
-
overflowY: "auto",
|
|
18
|
-
marginTop: "20px"
|
|
19
|
-
}, children: /* @__PURE__ */ jsx(Document, { file: mediaUrl, onLoadSuccess: onDocumentLoadSuccess, loading: /* @__PURE__ */ jsx(LoadingScreen, {}), children: Array.from(new Array(numPages), (_, index) => /* @__PURE__ */ jsx("div", { ref: (el) => pagesRef.current[index] = el, style: {
|
|
20
|
-
marginBottom: 32,
|
|
21
|
-
transformOrigin: "top center"
|
|
22
|
-
}, children: /* @__PURE__ */ jsx(Page, { className: "pdf-page", pageNumber: index + 1, renderTextLayer: !1, renderAnnotationLayer: !1, width: 600 * (scale ?? 1), loading: /* @__PURE__ */ jsx(LoadingScreen, {}) }) }, index)) }) });
|
|
23
|
-
}
|
|
24
|
-
export {
|
|
25
|
-
PdfViewer as default
|
|
26
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect } from "react";
|
|
3
|
-
import SvgIconClose from "../../modules/icons/components/IconClose.js";
|
|
4
|
-
import SvgIconDownload from "../../modules/icons/components/IconDownload.js";
|
|
5
|
-
import SvgIconExternalLink from "../../modules/icons/components/IconExternalLink.js";
|
|
6
|
-
import Flex from "../Flex/Flex.js";
|
|
7
|
-
import IconButton from "../Button/IconButton.js";
|
|
8
|
-
import SmartEllipsis from "../SmartEllipsis/SmartEllipsis.js";
|
|
9
|
-
function ToolbarViewer({
|
|
10
|
-
onClose,
|
|
11
|
-
mediaName,
|
|
12
|
-
mediaUrl,
|
|
13
|
-
nbMedia,
|
|
14
|
-
currentIndex
|
|
15
|
-
}) {
|
|
16
|
-
return useEffect(() => {
|
|
17
|
-
const handleKeyDown = (e) => {
|
|
18
|
-
e.key === "Escape" && onClose();
|
|
19
|
-
};
|
|
20
|
-
return window.addEventListener("keydown", handleKeyDown), () => {
|
|
21
|
-
window.removeEventListener("keydown", handleKeyDown);
|
|
22
|
-
};
|
|
23
|
-
}, [onClose]), /* @__PURE__ */ jsxs(Flex, { className: "media-viewer-toolbar p-8", align: "center", children: [
|
|
24
|
-
/* @__PURE__ */ jsxs(Flex, { gap: "8", align: "center", style: {
|
|
25
|
-
minWidth: "50%"
|
|
26
|
-
}, children: [
|
|
27
|
-
/* @__PURE__ */ jsx(IconButton, { icon: /* @__PURE__ */ jsx(SvgIconClose, { color: "#fff" }), onClick: onClose, variant: "ghost" }),
|
|
28
|
-
/* @__PURE__ */ jsx(SmartEllipsis, { text: mediaName })
|
|
29
|
-
] }),
|
|
30
|
-
/* @__PURE__ */ jsxs(Flex, { gap: "8", align: "center", justify: "between", className: "w-100", children: [
|
|
31
|
-
nbMedia ? /* @__PURE__ */ jsx("p", { children: `${currentIndex + 1}/${nbMedia} ` }) : /* @__PURE__ */ jsx("p", { children: `${currentIndex + 1}` }),
|
|
32
|
-
mediaUrl && /* @__PURE__ */ jsxs(Flex, { className: "ms-8", gap: "8", align: "center", children: [
|
|
33
|
-
/* @__PURE__ */ jsx("a", { href: mediaUrl, download: !0, target: "_blank", rel: "noopener noreferrer", children: /* @__PURE__ */ jsx(IconButton, { icon: /* @__PURE__ */ jsx(SvgIconDownload, { color: "#fff" }), variant: "ghost" }) }),
|
|
34
|
-
/* @__PURE__ */ jsx("a", { href: mediaUrl, target: "_blank", rel: "noopener noreferrer", children: /* @__PURE__ */ jsx(IconButton, { icon: /* @__PURE__ */ jsx(SvgIconExternalLink, { color: "#fff" }), variant: "ghost" }) })
|
|
35
|
-
] })
|
|
36
|
-
] })
|
|
37
|
-
] });
|
|
38
|
-
}
|
|
39
|
-
export {
|
|
40
|
-
ToolbarViewer as default
|
|
41
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import SvgIconMinus from "../../modules/icons/components/IconMinus.js";
|
|
3
|
-
import SvgIconPlus from "../../modules/icons/components/IconPlus.js";
|
|
4
|
-
import SvgIconZoomIn from "../../modules/icons/components/IconZoomIn.js";
|
|
5
|
-
import Flex from "../Flex/Flex.js";
|
|
6
|
-
import IconButton from "../Button/IconButton.js";
|
|
7
|
-
function ToolbarZoom({
|
|
8
|
-
zoomIn,
|
|
9
|
-
zoomOut
|
|
10
|
-
}) {
|
|
11
|
-
return /* @__PURE__ */ jsx(Flex, { justify: "center", className: "media-viewer-toolbar-zoom-container", children: /* @__PURE__ */ jsxs(Flex, { gap: "4", className: "p-12 media-viewer-toolbar-zoom", align: "center", children: [
|
|
12
|
-
/* @__PURE__ */ jsx(IconButton, { variant: "ghost", icon: /* @__PURE__ */ jsx(SvgIconMinus, { color: "#fff" }), onClick: zoomOut }),
|
|
13
|
-
/* @__PURE__ */ jsx(SvgIconZoomIn, { color: "#fff", className: "m-4" }),
|
|
14
|
-
/* @__PURE__ */ jsx(IconButton, { variant: "ghost", icon: /* @__PURE__ */ jsx(SvgIconPlus, { color: "#fff" }), onClick: zoomIn })
|
|
15
|
-
] }) });
|
|
16
|
-
}
|
|
17
|
-
export {
|
|
18
|
-
ToolbarZoom as default
|
|
19
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useRef, useState, useEffect } from "react";
|
|
3
|
-
function SmartEllipsis({
|
|
4
|
-
text
|
|
5
|
-
}) {
|
|
6
|
-
const ref = useRef(null), [displayText, setDisplayText] = useState(text), updateText = () => {
|
|
7
|
-
const el = ref.current;
|
|
8
|
-
if (el)
|
|
9
|
-
if (el.textContent = text, el.scrollWidth > el.clientWidth) {
|
|
10
|
-
let startText = text.slice(0, Math.ceil(text.length / 2)), endText = text.slice(Math.ceil(text.length / 2));
|
|
11
|
-
for (; startText.length > 1 && endText.length > 1 && el.scrollWidth > el.clientWidth; )
|
|
12
|
-
startText = startText.slice(0, -1), endText = endText.slice(1), el.textContent = `${startText}…${endText}`;
|
|
13
|
-
setDisplayText(el.textContent);
|
|
14
|
-
} else
|
|
15
|
-
setDisplayText(text);
|
|
16
|
-
};
|
|
17
|
-
return useEffect(() => (updateText(), window.addEventListener("resize", updateText), () => window.removeEventListener("resize", updateText)), [text]), /* @__PURE__ */ jsx("span", { ref, className: "smart-ellipsis", children: displayText });
|
|
18
|
-
}
|
|
19
|
-
export {
|
|
20
|
-
SmartEllipsis as default
|
|
21
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as useZoom } from './useZoom';
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export default function useZoom(initialScale?: number, maxScale?: number, minScale?: number, step?: number): {
|
|
2
|
-
scale: number;
|
|
3
|
-
zoomIn: () => void;
|
|
4
|
-
zoomOut: () => void;
|
|
5
|
-
resetZoom: () => void;
|
|
6
|
-
setScale: import('react').Dispatch<import('react').SetStateAction<number>>;
|
|
7
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { useState } from "react";
|
|
2
|
-
function useZoom(initialScale = 1, maxScale = 2, minScale = 0.5, step = 0.5) {
|
|
3
|
-
const [scale, setScale] = useState(initialScale);
|
|
4
|
-
return {
|
|
5
|
-
scale,
|
|
6
|
-
zoomIn: () => setScale((prev) => Math.min(prev + step, maxScale)),
|
|
7
|
-
zoomOut: () => setScale((prev) => Math.max(prev - step, minScale)),
|
|
8
|
-
resetZoom: () => setScale(initialScale),
|
|
9
|
-
setScale
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
export {
|
|
13
|
-
useZoom as default
|
|
14
|
-
};
|