@edifice.io/react 2.5.5-develop-b2school.20260116084726 → 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.
@@ -5,6 +5,10 @@ export interface ModalProps {
5
5
  * Modal id (useful when multiple modal on the same page)
6
6
  */
7
7
  id: string;
8
+ /**
9
+ * Modal testid
10
+ */
11
+ ['data-testid']?: string;
8
12
  /**
9
13
  * Is Modal Open
10
14
  */
@@ -10,17 +10,18 @@ import ModalSubtitle from "./ModalSubtitle.js";
10
10
  import useClickOutside from "../../hooks/useClickOutside/useClickOutside.js";
11
11
  import useTrapFocus from "../../hooks/useTrapFocus/useTrapFocus.js";
12
12
  import useKeyPress from "../../hooks/useKeyPress/useKeyPress.js";
13
- const Root = /* @__PURE__ */ forwardRef((props, ref) => {
14
- const {
15
- id,
16
- isOpen,
17
- onModalClose,
18
- size = "md",
19
- viewport = !1,
20
- scrollable = !1,
21
- focusId,
22
- children
23
- } = props, ariaLabelId = `aria_label_${id}`, ariaDescriptionId = `aria_desc_${id}`, modalRef = useClickOutside(onModalClose), trapRef = useTrapFocus(isOpen);
13
+ const Root = /* @__PURE__ */ forwardRef(({
14
+ id,
15
+ isOpen,
16
+ onModalClose,
17
+ size = "md",
18
+ viewport = !1,
19
+ scrollable = !1,
20
+ focusId,
21
+ children,
22
+ ...otherDivProps
23
+ }, ref) => {
24
+ const ariaLabelId = `aria_label_${id}`, ariaDescriptionId = `aria_desc_${id}`, modalRef = useClickOutside(onModalClose), trapRef = useTrapFocus(isOpen);
24
25
  useKeyPress(onModalClose, ["Escape"]), useEffect(() => {
25
26
  if (isOpen && (document.body.style.overflow = "hidden", focusId)) {
26
27
  const elem = document.getElementById(focusId);
@@ -54,7 +55,7 @@ const Root = /* @__PURE__ */ forwardRef((props, ref) => {
54
55
  }
55
56
  });
56
57
  return /* @__PURE__ */ jsx(ModalContext.Provider, { value: modalContextValue, children: transition((style, isOpen2) => /* @__PURE__ */ jsxs(Fragment, { children: [
57
- isOpen2 && /* @__PURE__ */ jsx(animated.div, { id, ref, role: "dialog", "aria-modal": "true", "aria-labelledby": ariaLabelId, "aria-describedby": ariaDescriptionId, className: modalClasses, style, tabIndex: -1, children: /* @__PURE__ */ jsx("div", { id: `${id}_ref`, ref: (node) => {
58
+ isOpen2 && /* @__PURE__ */ jsx(animated.div, { id, ref, role: "dialog", "aria-modal": "true", "aria-labelledby": ariaLabelId, "aria-describedby": ariaDescriptionId, className: modalClasses, style, tabIndex: -1, ...otherDivProps, children: /* @__PURE__ */ jsx("div", { id: `${id}_ref`, ref: (node) => {
58
59
  modalRef.current = node, isOpen2 && (trapRef.current = node);
59
60
  }, className: dialogClasses, children: /* @__PURE__ */ jsx("div", { className: "modal-content", children }) }) }),
60
61
  isOpen2 && /* @__PURE__ */ jsx(animated.div, { className: "modal-backdrop fade show", style: {
@@ -50,7 +50,7 @@ const DeleteModal = /* @__PURE__ */ lazy(() => import("./DeleteModal.js")), Comm
50
50
  /* @__PURE__ */ jsx(CommentReplies, { parentComment: comment })
51
51
  ] }),
52
52
  !comment.deleted && /* @__PURE__ */ jsxs(Fragment, { children: [
53
- /* @__PURE__ */ jsxs("div", { className: `${isEditing ? "border rounded-3 p-12 pb-8 d-flex gap-12 bg-gray-200 my-16" : "border rounded-3 p-12 pb-8 d-flex gap-12 mt-16"}`, children: [
53
+ /* @__PURE__ */ jsxs("div", { "data-testid": "div-comment-read", className: `${isEditing ? "border rounded-3 p-12 pb-8 d-flex gap-12 bg-gray-200 my-16" : "border rounded-3 p-12 pb-8 d-flex gap-12 mt-16"}`, children: [
54
54
  /* @__PURE__ */ jsx(CommentAvatar, { id: authorId }),
55
55
  /* @__PURE__ */ jsxs("div", { className: "flex flex-fill", children: [
56
56
  /* @__PURE__ */ jsxs("div", { className: "d-flex align-items-center gap-12", children: [
@@ -67,7 +67,7 @@ const DeleteModal = /* @__PURE__ */ lazy(() => import("./DeleteModal.js")), Comm
67
67
  /* @__PURE__ */ jsx(Button, { variant: "ghost", color: "tertiary", size: "sm", onClick: handleReset, children: t("comment.cancel") }),
68
68
  /* @__PURE__ */ jsxs("div", { className: "d-flex justify-content-end align-items-center gap-4", children: [
69
69
  /* @__PURE__ */ jsx(TextCounter, { content: value, maxLength: options.maxCommentLength }),
70
- /* @__PURE__ */ jsx(Button, { type: "submit", variant: "ghost", size: "sm", leftIcon: /* @__PURE__ */ jsx(SvgIconSave, {}), disabled: !(content != null && content.length), onClick: () => handleUpdateComment(value), children: t("comment.save") })
70
+ /* @__PURE__ */ jsx(Button, { "data-testid": "comment-save", type: "submit", variant: "ghost", size: "sm", leftIcon: /* @__PURE__ */ jsx(SvgIconSave, {}), disabled: !(content != null && content.length), onClick: () => handleUpdateComment(value), children: t("comment.save") })
71
71
  ] })
72
72
  ] })
73
73
  ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -76,10 +76,10 @@ const DeleteModal = /* @__PURE__ */ lazy(() => import("./DeleteModal.js")), Comm
76
76
  }, children: content }),
77
77
  type === "edit" && /* @__PURE__ */ jsxs("div", { className: "ms-n8", children: [
78
78
  !replyTo && options.allowReplies && /* @__PURE__ */ jsx(Button, { variant: "ghost", color: "tertiary", size: "sm", onClick: () => handleReplyToComment(comment.id), children: t("comment.reply") }),
79
- userId === authorId && /* @__PURE__ */ jsx(Button, { variant: "ghost", color: "tertiary", size: "sm", onClick: () => {
79
+ userId === authorId && /* @__PURE__ */ jsx(Button, { "data-testid": "comment-edit", variant: "ghost", color: "tertiary", size: "sm", onClick: () => {
80
80
  handleModifyComment(comment.id), setValue(content);
81
81
  }, children: t("comment.edit") }),
82
- (userId === authorId || (userRights == null ? void 0 : userRights.manager)) && /* @__PURE__ */ jsx(Button, { variant: "ghost", color: "tertiary", size: "sm", onClick: () => setIsDeleteModalOpen(!0), children: t("comment.remove") })
82
+ (userId === authorId || (userRights == null ? void 0 : userRights.manager)) && /* @__PURE__ */ jsx(Button, { "data-testid": "comment-delete", variant: "ghost", color: "tertiary", size: "sm", onClick: () => setIsDeleteModalOpen(!0), children: t("comment.remove") })
83
83
  ] })
84
84
  ] })
85
85
  ] })
@@ -9,17 +9,14 @@ const CommentDate = ({
9
9
  fromNow
10
10
  } = useDate(), {
11
11
  t
12
- } = useTranslation(), getPublishedDate = (date) => t("comment.publish.date", {
13
- date: fromNow(date)
14
- }), getUpdatedDate = (date) => t("comment.update.date", {
15
- date: fromNow(date)
16
- });
17
- return updatedAt ? /* @__PURE__ */ jsxs(Fragment, { children: [
12
+ } = useTranslation();
13
+ return updatedAt || createdAt ? /* @__PURE__ */ jsxs(Fragment, { children: [
18
14
  /* @__PURE__ */ jsx("span", { className: "small text-gray-700", children: "|" }),
19
- /* @__PURE__ */ jsx("span", { className: "small text-gray-700", children: getUpdatedDate(updatedAt) })
20
- ] }) : createdAt ? /* @__PURE__ */ jsxs(Fragment, { children: [
21
- /* @__PURE__ */ jsx("span", { className: "small text-gray-700", children: "|" }),
22
- /* @__PURE__ */ jsx("span", { className: "small text-gray-700", children: getPublishedDate(createdAt) })
15
+ /* @__PURE__ */ jsx("span", { "data-testid": "comment-info-date", className: "small text-gray-700", children: updatedAt ? ((date) => t("comment.update.date", {
16
+ date: fromNow(date)
17
+ }))(updatedAt) : ((date) => t("comment.publish.date", {
18
+ date: fromNow(date)
19
+ }))(createdAt) })
23
20
  ] }) : null;
24
21
  };
25
22
  export {
@@ -4,7 +4,7 @@ const CommentDeleted = () => {
4
4
  const {
5
5
  t
6
6
  } = useTranslation();
7
- return /* @__PURE__ */ jsx("div", { className: "border rounded-3 p-12 pb-8 d-flex gap-12 bg-gray-200 my-16", children: t("comment.deleted") });
7
+ return /* @__PURE__ */ jsx("div", { "data-testid": "div-comment-deleted", className: "border rounded-3 p-12 pb-8 d-flex gap-12 bg-gray-200 my-16", children: t("comment.deleted") });
8
8
  };
9
9
  export {
10
10
  CommentDeleted
@@ -1,4 +1,4 @@
1
1
  export declare const CommentForm: ({ userId, replyTo, }: {
2
2
  userId: string;
3
3
  replyTo?: string;
4
- }) => import("react/jsx-runtime").JSX.Element;
4
+ }) => false | import("react/jsx-runtime").JSX.Element;
@@ -1,11 +1,11 @@
1
- import { jsx, Fragment, jsxs } from "react/jsx-runtime";
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { useState } from "react";
2
3
  import { useTranslation } from "react-i18next";
3
4
  import SvgIconSend from "../../icons/components/IconSend.js";
4
5
  import { useAutosizeTextarea } from "../hooks/useAutosizeTextarea.js";
5
6
  import { useCommentsContext } from "../hooks/useCommentsContext.js";
6
7
  import { CommentAvatar } from "./CommentAvatar.js";
7
8
  import { TextCounter } from "./TextCounter.js";
8
- import { useState } from "react";
9
9
  import Button from "../../../components/Button/Button.js";
10
10
  const CommentForm = ({
11
11
  userId,
@@ -22,19 +22,19 @@ const CommentForm = ({
22
22
  }, handleSubmit = () => {
23
23
  handleCreateComment(content, replyTo), setContent("");
24
24
  };
25
- return /* @__PURE__ */ jsx(Fragment, { children: type === "edit" && /* @__PURE__ */ jsxs("div", { className: "border rounded-3 p-12 pb-8 d-flex gap-12 bg-gray-200", children: [
25
+ return type === "edit" && /* @__PURE__ */ jsxs("div", { "data-testid": "div-comment-create", className: "border rounded-3 p-12 pb-8 d-flex gap-12 bg-gray-200", children: [
26
26
  /* @__PURE__ */ jsx(CommentAvatar, { id: userId }),
27
27
  /* @__PURE__ */ jsxs("div", { className: "d-flex flex-column flex-fill gap-4", children: [
28
- /* @__PURE__ */ jsx("textarea", { id: "add-comment", ref, value: content, className: "form-control", placeholder: t("comment.placeholder.textarea"), maxLength: options.maxCommentLength, onChange: handleChangeContent, onFocus, rows: 1, style: {
28
+ /* @__PURE__ */ jsx("textarea", { id: "add-comment", "data-testid": "comment-form", ref, value: content, className: "form-control", placeholder: t("comment.placeholder.textarea"), maxLength: options.maxCommentLength, onChange: handleChangeContent, onFocus, rows: 1, style: {
29
29
  resize: "none",
30
30
  overflow: "hidden"
31
31
  } }),
32
32
  /* @__PURE__ */ jsxs("div", { className: "d-flex justify-content-end align-items-center gap-4", children: [
33
33
  /* @__PURE__ */ jsx(TextCounter, { content, maxLength: options.maxCommentLength }),
34
- /* @__PURE__ */ jsx(Button, { type: "submit", variant: "ghost", size: "sm", leftIcon: /* @__PURE__ */ jsx(SvgIconSend, {}), disabled: !(content != null && content.length), onClick: handleSubmit, children: t("comment.post") })
34
+ /* @__PURE__ */ jsx(Button, { "data-testid": "comment-publish", type: "submit", variant: "ghost", size: "sm", leftIcon: /* @__PURE__ */ jsx(SvgIconSend, {}), disabled: !(content != null && content.length), onClick: handleSubmit, children: t("comment.post") })
35
35
  ] })
36
36
  ] })
37
- ] }) });
37
+ ] });
38
38
  };
39
39
  export {
40
40
  CommentForm
@@ -1,7 +1,7 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  const CommentTitle = ({
3
3
  children
4
- }) => /* @__PURE__ */ jsx("span", { className: "small text-gray-800", children });
4
+ }) => /* @__PURE__ */ jsx("span", { "data-testid": "comment-info-author", className: "small text-gray-800", children });
5
5
  export {
6
6
  CommentTitle
7
7
  };
@@ -1,11 +1,11 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import { useMemo } from "react";
3
3
  import { CommentForm } from "../components/CommentForm.js";
4
- import { CommentHeader } from "../components/CommentHeader.js";
5
4
  import { CommentList } from "../components/CommentList.js";
6
5
  import { DEFAULT_ALLOW_REPLIES, DEFAULT_ADD_REPLIES, DEFAULT_MAX_REPLIES, DEFAULT_ADD_COMMENTS, DEFAULT_MAX_COMMENTS, DEFAULT_MAX_REPLY_LENGTH, DEFAULT_MAX_COMMENT_LENGTH } from "../constants.js";
7
6
  import { CommentContext } from "../context/Context.js";
8
7
  import { useComments } from "../hooks/useComments.js";
8
+ import Heading from "../../../components/Heading/Heading.js";
9
9
  import Button from "../../../components/Button/Button.js";
10
10
  import EmptyScreen from "../../../components/EmptyScreen/EmptyScreen.js";
11
11
  const CommentProvider = ({
@@ -71,10 +71,10 @@ const CommentProvider = ({
71
71
  [displayedComments, editCommentId, profilesQueries, options]
72
72
  );
73
73
  return /* @__PURE__ */ jsx(CommentContext.Provider, { value: values, children: /* @__PURE__ */ jsxs("div", { className: "my-24", children: [
74
- /* @__PURE__ */ jsx(CommentHeader, { title }),
74
+ /* @__PURE__ */ jsx(Heading, { "data-testid": "comments-info-count-text", level: "h3", headingStyle: "h3", children: title }),
75
75
  /* @__PURE__ */ jsxs("div", { className: "my-24", children: [
76
76
  user && /* @__PURE__ */ jsx(CommentForm, { userId: user.userId }),
77
- profilesQueries.isLoading ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
77
+ !profilesQueries.isLoading && /* @__PURE__ */ jsxs(Fragment, { children: [
78
78
  /* @__PURE__ */ jsx(CommentList, {}),
79
79
  showMoreComments && /* @__PURE__ */ jsx(Button, { variant: "ghost", color: "tertiary", onClick: handleMoreComments, className: "my-16", children: t("comment.more") })
80
80
  ] })
@@ -44,7 +44,7 @@ const OnboardingModal = /* @__PURE__ */ forwardRef(({
44
44
  }, handleCloseWithoutPreference = () => {
45
45
  setIsOpen(!1), setSwiperprogress(0);
46
46
  };
47
- return /* @__PURE__ */ createPortal(/* @__PURE__ */ jsxs(Modal, { id: "onboarding-modal", size: "md", isOpen, focusId: "nextButtonId", onModalClose: handleCloseWithoutPreference, children: [
47
+ return /* @__PURE__ */ createPortal(/* @__PURE__ */ jsxs(Modal, { id: "onboarding-modal", "data-testid": "modal-onboarding", size: "md", isOpen, focusId: "nextButtonId", onModalClose: handleCloseWithoutPreference, children: [
48
48
  /* @__PURE__ */ jsx(Modal.Header, { onModalClose: handleCloseWithoutPreference, centered: !0, children: t(currentTitle || "explorer.modal.onboarding.trash.title") }),
49
49
  /* @__PURE__ */ jsx(Modal.Body, { children: /* @__PURE__ */ jsx(Swiper, { modules: [Pagination], onSwiper: (swiper) => {
50
50
  setSwiperInstance(swiper);
@@ -59,10 +59,10 @@ const OnboardingModal = /* @__PURE__ */ forwardRef(({
59
59
  } })
60
60
  ] }, index)) }) }),
61
61
  /* @__PURE__ */ jsxs(Modal.Footer, { children: [
62
- /* @__PURE__ */ jsx(Button, { type: "button", color: "tertiary", variant: "ghost", onClick: handleCloseWithoutPreference, children: t("explorer.modal.onboarding.trash.later") }),
63
- swiperProgress > 0 && /* @__PURE__ */ jsx(Button, { type: "button", color: "primary", variant: "outline", onClick: () => swiperInstance.slidePrev(), children: t(prevText || "explorer.modal.onboarding.trash.prev") }),
64
- swiperProgress < 1 && /* @__PURE__ */ jsx(Button, { id: "nextButtonId", type: "button", color: "primary", variant: "filled", onClick: () => swiperInstance.slideNext(), children: t(nextText || "explorer.modal.onboarding.trash.next") }),
65
- swiperProgress === 1 && /* @__PURE__ */ jsx(Button, { type: "button", color: "primary", variant: "filled", onClick: () => {
62
+ /* @__PURE__ */ jsx(Button, { "data-testid": "modal-onboarding-later", type: "button", color: "tertiary", variant: "ghost", onClick: handleCloseWithoutPreference, children: t("explorer.modal.onboarding.trash.later") }),
63
+ swiperProgress > 0 && /* @__PURE__ */ jsx(Button, { "data-testid": "modal-onboarding-previous", type: "button", color: "primary", variant: "outline", onClick: () => swiperInstance.slidePrev(), children: t(prevText || "explorer.modal.onboarding.trash.prev") }),
64
+ swiperProgress < 1 && /* @__PURE__ */ jsx(Button, { id: "nextButtonId", "data-testid": "modal-onboarding-next", type: "button", color: "primary", variant: "filled", onClick: () => swiperInstance.slideNext(), children: t(nextText || "explorer.modal.onboarding.trash.next") }),
65
+ swiperProgress === 1 && /* @__PURE__ */ jsx(Button, { "data-testid": "modal-onboarding-close", type: "button", color: "primary", variant: "filled", onClick: () => {
66
66
  isOnboarding ? handleCloseWithPreference() : handleCloseWithoutPreference();
67
67
  }, children: t(closeText || "explorer.modal.onboarding.trash.close") })
68
68
  ] })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edifice.io/react",
3
- "version": "2.5.5-develop-b2school.20260116084726",
3
+ "version": "2.5.5-develop-b2school.20260116160825",
4
4
  "description": "Edifice React Library",
5
5
  "keywords": [
6
6
  "react",
@@ -134,9 +134,9 @@
134
134
  "react-slugify": "^3.0.3",
135
135
  "swiper": "^10.1.0",
136
136
  "ua-parser-js": "^1.0.36",
137
- "@edifice.io/bootstrap": "2.5.5-develop-b2school.20260116084726",
138
- "@edifice.io/tiptap-extensions": "2.5.5-develop-b2school.20260116084726",
139
- "@edifice.io/utilities": "2.5.5-develop-b2school.20260116084726"
137
+ "@edifice.io/bootstrap": "2.5.5-develop-b2school.20260116160825",
138
+ "@edifice.io/utilities": "2.5.5-develop-b2school.20260116160825",
139
+ "@edifice.io/tiptap-extensions": "2.5.5-develop-b2school.20260116160825"
140
140
  },
141
141
  "devDependencies": {
142
142
  "@babel/plugin-transform-react-pure-annotations": "^7.23.3",
@@ -167,8 +167,8 @@
167
167
  "vite": "^5.4.11",
168
168
  "vite-plugin-dts": "^4.1.0",
169
169
  "vite-tsconfig-paths": "^5.0.1",
170
- "@edifice.io/client": "2.5.5-develop-b2school.20260116084726",
171
- "@edifice.io/config": "2.5.5-develop-b2school.20260116084726"
170
+ "@edifice.io/client": "2.5.5-develop-b2school.20260116160825",
171
+ "@edifice.io/config": "2.5.5-develop-b2school.20260116160825"
172
172
  },
173
173
  "peerDependencies": {
174
174
  "@react-spring/web": "^9.7.5",
@@ -1,3 +0,0 @@
1
- export declare const CommentHeader: ({ title }: {
2
- title: string;
3
- }) => import("react/jsx-runtime").JSX.Element;
@@ -1,8 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import Heading from "../../../components/Heading/Heading.js";
3
- const CommentHeader = ({
4
- title
5
- }) => /* @__PURE__ */ jsx(Heading, { level: "h3", headingStyle: "h3", children: title });
6
- export {
7
- CommentHeader
8
- };