@edifice.io/react 2.3.1-develop-b2school-actualites.20250916153920 → 2.3.1-develop-b2school.20250917113642

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.
@@ -1,56 +0,0 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
2
- import { useState, useEffect } from "react";
3
- import clsx from "clsx";
4
- import { getThumbnail } from "@edifice.io/utilities";
5
- import { useTranslation } from "react-i18next";
6
- import Image from "../../../../components/Image/Image.js";
7
- const EditorPreview = ({
8
- content,
9
- variant = "outline",
10
- onDetailClick,
11
- onMediaClick,
12
- maxMediaDisplayed = 3
13
- }) => {
14
- const {
15
- t
16
- } = useTranslation(), [summaryContent, setSummaryContent] = useState(""), [medias, setMedias] = useState([]), borderClass = clsx(variant === "outline" && "border rounded-3 py-12 px-16"), hasMediaCallback = onDetailClick || onMediaClick, handleMediaClick = (e) => {
17
- onMediaClick && (e.stopPropagation(), onMediaClick());
18
- };
19
- return useEffect(() => {
20
- const contentHTML = content;
21
- if (contentHTML) {
22
- const doc = new DOMParser().parseFromString(contentHTML, "text/html"), mediaElements = Array.from(doc.querySelectorAll("img, video, iframe, audio, embed"));
23
- setMedias(mediaElements.filter((el) => el.tagName.toLowerCase() === "img").map((el) => {
24
- const image = el;
25
- return image.src ? {
26
- url: getThumbnail(image.src, 0, 300),
27
- alt: image.alt
28
- } : {
29
- url: "",
30
- alt: ""
31
- };
32
- })), mediaElements.forEach((el) => {
33
- var _a;
34
- return (_a = el.parentNode) == null ? void 0 : _a.removeChild(el);
35
- }), setSummaryContent(doc.body.textContent || "");
36
- }
37
- }, [content]), /* @__PURE__ */ jsxs("div", { className: borderClass, "data-testid": "editor-preview", onClick: onDetailClick, tabIndex: onDetailClick ? -1 : void 0, role: onDetailClick ? "button" : void 0, children: [
38
- /* @__PURE__ */ jsx("div", { className: "flex-fill text-truncate text-truncate-2 post-preview-content overflow-hidden", children: summaryContent }),
39
- /* @__PURE__ */ jsx("div", { onClick: handleMediaClick, tabIndex: hasMediaCallback ? -1 : void 0, role: hasMediaCallback ? "button" : void 0, className: "d-flex align-items-center justify-content-center gap-24 px-32 pt-16", children: medias.slice(0, maxMediaDisplayed).map((media, index) => /* @__PURE__ */ jsxs("div", { className: clsx("position-relative col-12 col-md-4 ", {
40
- "d-none d-md-block": index >= 1
41
- }), style: {
42
- maxWidth: "150px"
43
- }, children: [
44
- /* @__PURE__ */ jsx(Image, { alt: media.alt, objectFit: "cover", ratio: "16", className: "rounded", src: media.url, sizes: "" }),
45
- (index === 0 || index === 2) && medias.length - (index + 1) > 0 && /* @__PURE__ */ jsx("div", { className: clsx("position-absolute top-0 bottom-0 start-0 end-0 d-flex justify-content-center align-items-center rounded text-light bg-dark bg-opacity-50", {
46
- "d-flex d-md-none": index === 0,
47
- "d-none d-md-flex": index === 2
48
- }), children: t("editor.preview.moreMedia", {
49
- mediaCount: medias.length - (index + 1)
50
- }) })
51
- ] }, media.url)) })
52
- ] });
53
- };
54
- export {
55
- EditorPreview as default
56
- };
@@ -1,8 +0,0 @@
1
- /**
2
- * Editor component properties
3
- */
4
- export interface EditorPreviewSkeletonProps {
5
- variant?: 'outline' | 'ghost';
6
- }
7
- declare const EditorPreview: ({ variant }: EditorPreviewSkeletonProps) => import("react/jsx-runtime").JSX.Element;
8
- export default EditorPreview;
@@ -1,24 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import clsx from "clsx";
3
- import TextSkeleton from "../../../../components/Skeleton/TextSkeleton.js";
4
- import Image from "../../../../components/Image/Image.js";
5
- const EditorPreview = ({
6
- variant = "outline"
7
- }) => {
8
- const borderClass = clsx(variant === "outline" && "border rounded-3"), contentClass = clsx("mt-16", variant === "outline" && "my-12 mx-16");
9
- return /* @__PURE__ */ jsx("div", { className: borderClass, "data-testid": "editor-preview", children: /* @__PURE__ */ jsxs("div", { className: contentClass, children: [
10
- /* @__PURE__ */ jsx(TextSkeleton, { className: "col-12" }),
11
- /* @__PURE__ */ jsx(TextSkeleton, { className: "col-12" }),
12
- /* @__PURE__ */ jsxs("div", { className: "d-flex justify-content-center gap-24 px-32 pt-16", children: [
13
- /* @__PURE__ */ jsx("div", { style: {
14
- maxWidth: "150px"
15
- }, className: "col-12 col-md-4", children: /* @__PURE__ */ jsx(Image, { alt: "", objectFit: "cover", ratio: "16", className: "rounded placeholder", src: "", sizes: "" }) }),
16
- /* @__PURE__ */ jsx("div", { style: {
17
- maxWidth: "150px"
18
- }, className: "col-12 col-md-4", children: /* @__PURE__ */ jsx(Image, { alt: "", objectFit: "cover", ratio: "16", className: "rounded placeholder", src: "", sizes: "" }) })
19
- ] })
20
- ] }) });
21
- };
22
- export {
23
- EditorPreview as default
24
- };
@@ -1,7 +0,0 @@
1
- import { SVGProps } from 'react';
2
- interface SVGRProps {
3
- title?: string;
4
- titleId?: string;
5
- }
6
- declare const SvgIconClockAlert: ({ title, titleId, ...props }: SVGProps<SVGSVGElement> & SVGRProps) => import("react/jsx-runtime").JSX.Element;
7
- export default SvgIconClockAlert;
@@ -1,17 +0,0 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
2
- const SvgIconClockAlert = ({
3
- title,
4
- titleId,
5
- ...props
6
- }) => /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", fill: "none", viewBox: "0 0 24 24", "aria-hidden": "true", "aria-labelledby": titleId, ...props, children: [
7
- title ? /* @__PURE__ */ jsx("title", { id: titleId, children: title }) : null,
8
- /* @__PURE__ */ jsxs("g", { fill: "currentColor", clipPath: "url(#icon-clock-alert_svg__a)", children: [
9
- /* @__PURE__ */ jsx("path", { d: "M0 10.075C0 4.51 4.51 0 10.075 0c4.573 0 8.431 3.046 9.663 7.217a1 1 0 0 1-1.918.566A8.075 8.075 0 1 0 7.783 17.82a1 1 0 0 1-.566 1.918C3.046 18.506 0 14.648 0 10.075" }),
10
- /* @__PURE__ */ jsx("path", { d: "M10.075 4.108a1 1 0 0 1 1 1v5.43a1 1 0 0 1-.357.767L7.83 13.728a1 1 0 1 1-1.286-1.532l2.53-2.123V5.108a1 1 0 0 1 1-1M17 13.3a1 1 0 0 1 1 1v2.2a1 1 0 1 1-2 0v-2.2a1 1 0 0 1 1-1M17 18.4a1 1 0 1 0 0 2h.006a1 1 0 1 0 0-2z" }),
11
- /* @__PURE__ */ jsx("path", { fillRule: "evenodd", d: "M17 10a7 7 0 1 0 0 14 7 7 0 0 0 0-14m-5 7a5 5 0 1 1 10 0 5 5 0 0 1-10 0", clipRule: "evenodd" })
12
- ] }),
13
- /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: "icon-clock-alert_svg__a", children: /* @__PURE__ */ jsx("path", { fill: "#fff", d: "M0 0h24v24H0z" }) }) })
14
- ] });
15
- export {
16
- SvgIconClockAlert as default
17
- };