@edifice.io/react 2.5.9-develop.20260130161524 → 2.5.9

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.
Files changed (41) hide show
  1. package/README.md +0 -5
  2. package/dist/components/DatePicker/DatePicker.js +3 -6
  3. package/dist/components/Layout/components/WidgetApps.js +2 -2
  4. package/dist/components/Modal/Modal.d.ts +0 -4
  5. package/dist/components/Modal/Modal.js +12 -13
  6. package/dist/hooks/useConversation/useConversation.js +1 -3
  7. package/dist/hooks/useDate/useDate.d.ts +1 -5
  8. package/dist/hooks/useDate/useDate.js +2 -18
  9. package/dist/hooks/useDropzone/useDropzone.js +16 -21
  10. package/dist/icons.js +350 -356
  11. package/dist/modules/audience/ViewsCounter.d.ts +17 -3
  12. package/dist/modules/audience/ViewsCounter.js +7 -9
  13. package/dist/modules/comments/components/Comment.js +4 -4
  14. package/dist/modules/comments/components/CommentDate.js +10 -7
  15. package/dist/modules/comments/components/CommentDeleted.js +1 -1
  16. package/dist/modules/comments/components/CommentForm.d.ts +1 -1
  17. package/dist/modules/comments/components/CommentForm.js +6 -6
  18. package/dist/modules/comments/components/CommentHeader.d.ts +3 -0
  19. package/dist/modules/comments/components/CommentHeader.js +8 -0
  20. package/dist/modules/comments/components/CommentTitle.js +1 -1
  21. package/dist/modules/comments/provider/CommentProvider.js +4 -4
  22. package/dist/modules/comments/types.d.ts +1 -3
  23. package/dist/modules/icons/components/index.d.ts +0 -3
  24. package/dist/modules/modals/OnboardingModal/OnboardingModal.js +5 -5
  25. package/dist/modules/modals/ShareModal/ShareResources.d.ts +0 -3
  26. package/dist/modules/modals/ShareModal/ShareResources.js +5 -9
  27. package/package.json +6 -6
  28. package/dist/_virtual/isSameOrAfter.js +0 -4
  29. package/dist/_virtual/isToday.js +0 -4
  30. package/dist/components/DatePicker/DatePicker.d.ts +0 -57
  31. package/dist/modules/icons/components/IconAdjustSettings.d.ts +0 -7
  32. package/dist/modules/icons/components/IconAdjustSettings.js +0 -12
  33. package/dist/modules/icons/components/IconCalendarEdit.d.ts +0 -7
  34. package/dist/modules/icons/components/IconCalendarEdit.js +0 -12
  35. package/dist/modules/icons/components/IconLabel.d.ts +0 -7
  36. package/dist/modules/icons/components/IconLabel.js +0 -12
  37. package/dist/node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/isSameOrAfter.js +0 -18
  38. package/dist/node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/isToday.js +0 -19
  39. package/dist/utilities/mime-types/index.d.ts +0 -1
  40. package/dist/utilities/mime-types/mime-types-utils.d.ts +0 -1
  41. package/dist/utilities/mime-types/mime-types-utils.js +0 -4
package/README.md CHANGED
@@ -105,11 +105,6 @@ export interface ButtonProps {
105
105
  export * from './Button';
106
106
  ```
107
107
 
108
- ## Adding Icons
109
-
110
- https://edifice-community.atlassian.net/wiki/spaces/ODE/pages/4371611649/Overview#Ajout-de-l%E2%80%99ic%C3%B4ne
111
-
112
108
  ## Dev
113
109
 
114
110
  You can build your component using `Storybook`. See [README](../../docs//README.md)
115
-
@@ -16,8 +16,7 @@ const DatePicker = /* @__PURE__ */ forwardRef(({
16
16
  onChange,
17
17
  dateFormat = "DD / MM / YYYY",
18
18
  minDate,
19
- maxDate,
20
- ...htmlProps
19
+ maxDate
21
20
  }, ref) => {
22
21
  const handleChange = (date) => {
23
22
  onChange == null || onChange(date ? date.toDate() : void 0);
@@ -27,11 +26,9 @@ const DatePicker = /* @__PURE__ */ forwardRef(({
27
26
  format: dateFormat,
28
27
  minDate: minDate ? dayjs(minDate) : void 0,
29
28
  maxDate: maxDate ? dayjs(maxDate) : void 0,
30
- ref,
31
- // Cast necessary because AntDatePicker expects a specific type, but our API exposes only HTMLElement to avoid dependency on Ant Design-specific features.
32
- ...htmlProps
29
+ ref
33
30
  };
34
- return /* @__PURE__ */ jsx(DatePicker$1, { ...antProps, getPopupContainer: (triggerNode) => triggerNode.parentElement || document.body });
31
+ return /* @__PURE__ */ jsx(DatePicker$1, { ...antProps });
35
32
  });
36
33
  export {
37
34
  DatePicker as default
@@ -6,7 +6,7 @@ const WidgetAppsFooter = () => {
6
6
  t
7
7
  } = useTranslation();
8
8
  return /* @__PURE__ */ jsx("div", { className: "widget-footer", children: /* @__PURE__ */ jsx("div", { className: "widget-footer-action", children: /* @__PURE__ */ jsx("a", { href: "/welcome", className: "link", children: t("plus") }) }) });
9
- }, appToOpenOnBlank = ["Administration"], WidgetAppsBody = ({
9
+ }, WidgetAppsBody = ({
10
10
  bookmarkedApps
11
11
  }) => {
12
12
  const {
@@ -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.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))
17
+ bookmarkedApps.slice(0, 6).map((app, index) => /* @__PURE__ */ jsx("a", { href: app.address, className: "bookmarked-app", target: app.isExternal || app.category === "connector" ? "_blank" : void 0, children: /* @__PURE__ */ jsx(AppIcon, { app, size: "32" }) }, index))
18
18
  ] });
19
19
  };
20
20
  export {
@@ -5,10 +5,6 @@ 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;
12
8
  /**
13
9
  * Is Modal Open
14
10
  */
@@ -10,18 +10,17 @@ 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(({
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);
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);
25
24
  useKeyPress(onModalClose, ["Escape"]), useEffect(() => {
26
25
  if (isOpen && (document.body.style.overflow = "hidden", focusId)) {
27
26
  const elem = document.getElementById(focusId);
@@ -55,7 +54,7 @@ const Root = /* @__PURE__ */ forwardRef(({
55
54
  }
56
55
  });
57
56
  return /* @__PURE__ */ jsx(ModalContext.Provider, { value: modalContextValue, children: transition((style, isOpen2) => /* @__PURE__ */ jsxs(Fragment, { children: [
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) => {
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) => {
59
58
  modalRef.current = node, isOpen2 && (trapRef.current = node);
60
59
  }, className: dialogClasses, children: /* @__PURE__ */ jsx("div", { className: "modal-content", children }) }) }),
61
60
  isOpen2 && /* @__PURE__ */ jsx(animated.div, { className: "modal-backdrop fade show", style: {
@@ -6,9 +6,7 @@ const useConversation = () => {
6
6
  const zimbraWorkflow = useHasWorkflow("fr.openent.zimbra.controllers.ZimbraController|view"), zimbraPreauth = useHasWorkflow("fr.openent.zimbra.controllers.ZimbraController|preauth"), [msgLink, setMsgLink] = useState(""), queryParams = {
7
7
  unread: !0,
8
8
  _: (/* @__PURE__ */ new Date()).getTime()
9
- };
10
- zimbraWorkflow || (queryParams.queryparam_token = (/* @__PURE__ */ new Date()).getTime());
11
- const {
9
+ }, {
12
10
  data: messages
13
11
  } = useQuery({
14
12
  queryKey: ["folder", "count", "inbox"],
@@ -1,11 +1,10 @@
1
- import { OpUnitType } from 'dayjs';
2
1
  export type MongoDate = {
3
2
  $date: number | string;
4
3
  };
5
4
  export type IsoDate = string;
6
5
  export type NumberDate = number;
7
6
  /** Date formats we are going to deal with. */
8
- export type CoreDate = IsoDate | MongoDate | NumberDate | Date;
7
+ export type CoreDate = IsoDate | MongoDate | NumberDate;
9
8
  /**
10
9
  * Custom React hook for date parsing, formatting, and localization.
11
10
  *
@@ -26,7 +25,4 @@ export default function useDate(): {
26
25
  fromNow: (date: CoreDate) => string;
27
26
  formatDate: (date: CoreDate, format?: string) => string;
28
27
  formatTimeAgo: (date: CoreDate) => string;
29
- dateIsSame: (date: CoreDate, date2: CoreDate, unit?: OpUnitType) => boolean;
30
- dateIsSameOrAfter: (date: CoreDate, date2: CoreDate, unit?: OpUnitType) => boolean;
31
- dateIsToday: (date: CoreDate) => boolean;
32
28
  };
@@ -1,7 +1,5 @@
1
1
  import { useCallback } from "react";
2
2
  import dayjs from "dayjs";
3
- import isSameOrAfter from "../../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/isSameOrAfter.js";
4
- import isToday from "../../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/isToday.js";
5
3
  import customParseFormat from "dayjs/plugin/customParseFormat.js";
6
4
  import localizedFormat from "dayjs/plugin/localizedFormat.js";
7
5
  import relativeTime from "dayjs/plugin/relativeTime.js";
@@ -15,8 +13,6 @@ import { useEdificeClient } from "../../providers/EdificeClientProvider/EdificeC
15
13
  dayjs.extend(relativeTime);
16
14
  dayjs.extend(customParseFormat);
17
15
  dayjs.extend(localizedFormat);
18
- dayjs.extend(isSameOrAfter);
19
- dayjs.extend(isToday);
20
16
  function useDate() {
21
17
  const {
22
18
  currentLanguage
@@ -33,7 +29,7 @@ function useDate() {
33
29
  }, [currentLanguage]), toComputedDate = useCallback((date) => {
34
30
  let computedDate = dayjs();
35
31
  try {
36
- return typeof date > "u" ? void 0 : (typeof date == "string" ? computedDate = parseDate(date) : date instanceof Date ? computedDate = dayjs(date).locale(currentLanguage) : typeof date == "number" ? computedDate = dayjs(date).locale(currentLanguage) : typeof date.$date == "number" ? computedDate = dayjs(new Date(date.$date)).locale(currentLanguage) : typeof date.$date == "string" && (computedDate = parseDate(date.$date)), computedDate);
32
+ return typeof date > "u" ? void 0 : (typeof date == "string" ? computedDate = parseDate(date) : typeof date == "number" ? computedDate = dayjs(date).locale(currentLanguage) : typeof date.$date == "number" ? computedDate = dayjs(new Date(date.$date)).locale(currentLanguage) : typeof date.$date == "string" && (computedDate = parseDate(date.$date)), computedDate);
37
33
  } catch (error) {
38
34
  console.error(error);
39
35
  }
@@ -63,23 +59,11 @@ function useDate() {
63
59
  dayjsFormat = format;
64
60
  }
65
61
  return computedDate != null && computedDate.isValid() ? computedDate.locale(currentLanguage).format(dayjsFormat) : "";
66
- }, [currentLanguage, parseDate]), dateIsSame = useCallback((date, date2, unit = "day") => {
67
- const computedDate = toComputedDate(date), computedDate2 = toComputedDate(date2);
68
- return (computedDate == null ? void 0 : computedDate.isSame(computedDate2, unit)) ?? !1;
69
- }, [currentLanguage, parseDate]), dateIsSameOrAfter = useCallback((date, date2, unit = "day") => {
70
- const computedDate = toComputedDate(date), computedDate2 = toComputedDate(date2);
71
- return (computedDate == null ? void 0 : computedDate.isSameOrAfter(computedDate2, unit)) ?? !1;
72
- }, [currentLanguage, parseDate]), dateIsToday = useCallback((date) => {
73
- const computedDate = toComputedDate(date);
74
- return (computedDate == null ? void 0 : computedDate.isToday()) ?? !1;
75
62
  }, [currentLanguage, parseDate]);
76
63
  return {
77
64
  fromNow,
78
65
  formatDate,
79
- formatTimeAgo,
80
- dateIsSame,
81
- dateIsSameOrAfter,
82
- dateIsToday
66
+ formatTimeAgo
83
67
  };
84
68
  }
85
69
  export {
@@ -1,5 +1,5 @@
1
1
  import { useState, useRef } from "react";
2
- import { HEIC_MIME_TYPES } from "../../utilities/mime-types/mime-types-utils.js";
2
+ import heic2any from "heic2any";
3
3
  const useDropzone = (props) => {
4
4
  const [dragging, setDragging] = useState(!1), [files, setFiles] = useState([]), inputRef = useRef(null), addFile = (file) => {
5
5
  addFiles([file]);
@@ -32,26 +32,21 @@ const useDropzone = (props) => {
32
32
  })
33
33
  ));
34
34
  filesToAdd.reverse(), props != null && props.forceFilters ? (filesToAdd = applyInputFiltersOn(filesToAdd), filesToAdd && filesToAdd.length && setFiles((prevFiles) => [...prevFiles, ...filesToAdd])) : setFiles((prevFiles) => [...prevFiles, ...files2]);
35
- }, convertHEICImages = async (files2) => {
36
- if (files2 === null || files2.length === 0)
37
- return [];
38
- let heic2any;
39
- return files2.some((file) => HEIC_MIME_TYPES.includes(file.type)) && (heic2any = (await import("heic2any")).default), Promise.all(files2.map(async (file) => {
40
- if (HEIC_MIME_TYPES.includes(file.type) && heic2any)
41
- try {
42
- const converted = await heic2any({
43
- blob: file,
44
- toType: "image/jpeg"
45
- });
46
- return new File([converted], file.name.replace(/\.(heic|heif)$/i, ".jpeg"), {
47
- type: "image/jpeg"
48
- });
49
- } catch (error) {
50
- return console.error(`Failed to convert HEIC image: ${file.name}`, error), file;
51
- }
52
- return file;
53
- }));
54
- }, cleanFiles = () => {
35
+ }, convertHEICImages = async (files2) => Promise.all(files2.map(async (file) => {
36
+ if (file.type === "image/heic" || file.type === "image/heif")
37
+ try {
38
+ const converted = await heic2any({
39
+ blob: file,
40
+ toType: "image/jpeg"
41
+ });
42
+ return new File([converted], file.name.replace(/\.(heic|heif)$/i, ".jpeg"), {
43
+ type: "image/jpeg"
44
+ });
45
+ } catch (error) {
46
+ return console.error(`Failed to convert HEIC image: ${file.name}`, error), file;
47
+ }
48
+ return file;
49
+ })), cleanFiles = () => {
55
50
  setFiles([]);
56
51
  }, handleOnChange = (event) => {
57
52
  const files2 = event.target.files;