@edifice.io/react 2.5.15-develop-b2school.20260327180304 → 2.5.15-develop.20260330155151

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 (77) hide show
  1. package/dist/components/AddAttachments/AddAttachments.d.ts +6 -3
  2. package/dist/components/AddAttachments/AddAttachments.js +17 -29
  3. package/dist/components/AddAttachments/hooks/useFileToAttachment.d.ts +3 -0
  4. package/dist/components/AddAttachments/hooks/useFileToAttachment.js +16 -0
  5. package/dist/components/AddAttachments/models/attachment.d.ts +1 -0
  6. package/dist/components/Tree/components/SortableTree.js +4 -3
  7. package/dist/components/Tree/components/Tree.js +4 -3
  8. package/dist/components/UserRightsList/SaveBookmark.d.ts +5 -0
  9. package/dist/components/UserRightsList/SaveBookmark.js +29 -0
  10. package/dist/components/UserRightsList/UserRightsBookmarkRow.d.ts +11 -0
  11. package/dist/components/UserRightsList/UserRightsBookmarkRow.js +30 -0
  12. package/dist/components/UserRightsList/UserRightsItem.d.ts +13 -0
  13. package/dist/components/UserRightsList/UserRightsItem.js +36 -0
  14. package/dist/components/UserRightsList/UserRightsList.d.ts +19 -0
  15. package/dist/components/UserRightsList/UserRightsList.js +94 -0
  16. package/dist/components/UserRightsList/helpers/rightsHelpers.d.ts +9 -0
  17. package/dist/components/UserRightsList/helpers/rightsHelpers.js +53 -0
  18. package/dist/components/UserRightsList/hooks/useBookmarkEntries.d.ts +19 -0
  19. package/dist/components/UserRightsList/hooks/useBookmarkEntries.js +58 -0
  20. package/dist/components/UserRightsList/hooks/useSharingItems.d.ts +20 -0
  21. package/dist/components/UserRightsList/hooks/useSharingItems.js +57 -0
  22. package/dist/components/UserRightsList/index.d.ts +2 -0
  23. package/dist/components/UserRightsList/types/types.d.ts +34 -0
  24. package/dist/components/UserRightsList/types/types.js +6 -0
  25. package/dist/components/UserSearch/UserSearch.d.ts +7 -0
  26. package/dist/components/UserSearch/UserSearch.js +82 -0
  27. package/dist/components/UserSearch/index.d.ts +3 -0
  28. package/dist/components/UserSearch/types/types.d.ts +24 -0
  29. package/dist/components/UserSearch/types/visible.d.ts +24 -0
  30. package/dist/components/UserSearch/types/visible.js +4 -0
  31. package/dist/components/index.d.ts +2 -0
  32. package/dist/hooks/useDirectory/useDirectory.d.ts +3 -2
  33. package/dist/hooks/useDropzone/useDropzone.js +4 -4
  34. package/dist/icons.js +364 -332
  35. package/dist/index.js +10 -0
  36. package/dist/modules/editor/components/EditorToolbar/EditorToolbar.js +1 -1
  37. package/dist/modules/icons/components/IconBulle.d.ts +7 -0
  38. package/dist/modules/icons/components/IconBulle.js +16 -0
  39. package/dist/modules/icons/components/IconBulleError.d.ts +7 -0
  40. package/dist/modules/icons/components/IconBulleError.js +13 -0
  41. package/dist/modules/icons/components/IconBulleSuccess.d.ts +7 -0
  42. package/dist/modules/icons/components/IconBulleSuccess.js +13 -0
  43. package/dist/modules/icons/components/IconLsuArt.d.ts +7 -0
  44. package/dist/modules/icons/components/IconLsuArt.js +13 -0
  45. package/dist/modules/icons/components/IconLsuCompetenceNumerique.d.ts +7 -0
  46. package/dist/modules/icons/components/IconLsuCompetenceNumerique.js +12 -0
  47. package/dist/modules/icons/components/IconLsuEmc.d.ts +7 -0
  48. package/dist/modules/icons/components/IconLsuEmc.js +13 -0
  49. package/dist/modules/icons/components/IconLsuFrancais.d.ts +7 -0
  50. package/dist/modules/icons/components/IconLsuFrancais.js +13 -0
  51. package/dist/modules/icons/components/IconLsuHistoireGeo.d.ts +7 -0
  52. package/dist/modules/icons/components/IconLsuHistoireGeo.js +12 -0
  53. package/dist/modules/icons/components/IconLsuLangue.d.ts +7 -0
  54. package/dist/modules/icons/components/IconLsuLangue.js +16 -0
  55. package/dist/modules/icons/components/IconLsuLangue2.d.ts +7 -0
  56. package/dist/modules/icons/components/IconLsuLangue2.js +13 -0
  57. package/dist/modules/icons/components/IconLsuMath.d.ts +7 -0
  58. package/dist/modules/icons/components/IconLsuMath.js +16 -0
  59. package/dist/modules/icons/components/IconLsuParcoursEducatif.d.ts +7 -0
  60. package/dist/modules/icons/components/IconLsuParcoursEducatif.js +12 -0
  61. package/dist/modules/icons/components/IconLsuSport.d.ts +7 -0
  62. package/dist/modules/icons/components/IconLsuSport.js +12 -0
  63. package/dist/modules/icons/components/IconLsuSvt.d.ts +7 -0
  64. package/dist/modules/icons/components/IconLsuSvt.js +12 -0
  65. package/dist/modules/icons/components/IconParcoursCitoyen.d.ts +7 -0
  66. package/dist/modules/icons/components/IconParcoursCitoyen.js +14 -0
  67. package/dist/modules/icons/components/IconParcoursSecours.d.ts +7 -0
  68. package/dist/modules/icons/components/IconParcoursSecours.js +14 -0
  69. package/dist/modules/icons/components/index.d.ts +16 -0
  70. package/dist/modules/modals/OnboardingModal/index.d.ts +1 -1
  71. package/dist/types/index.d.ts +1 -0
  72. package/dist/types/sharing.d.ts +8 -0
  73. package/dist/utilities/index.d.ts +1 -0
  74. package/dist/utilities/rotate-transition-style/get-rotate-transition-style.d.ts +5 -0
  75. package/dist/utilities/rotate-transition-style/get-rotate-transition-style.js +12 -0
  76. package/dist/utilities/rotate-transition-style/index.d.ts +1 -0
  77. package/package.json +7 -7
@@ -0,0 +1,57 @@
1
+ import { useState } from "react";
2
+ const useSharingItems = ({
3
+ initialSharings,
4
+ toggleRight,
5
+ applyRight,
6
+ onChange,
7
+ onAddItems,
8
+ onDeleteItems
9
+ }) => {
10
+ const [items, setItems] = useState(initialSharings ?? []);
11
+ return {
12
+ items,
13
+ addItem: (item) => {
14
+ setItems((prev) => {
15
+ if (new Set(prev.map((sharing) => sharing.recipientId)).has(item.recipientId)) return prev;
16
+ const nextItems = [...prev, item];
17
+ return onChange(nextItems), onAddItems([item]), nextItems;
18
+ });
19
+ },
20
+ addItems: (newItems) => {
21
+ setItems((prev) => {
22
+ const existingIds = new Set(prev.map((sharing) => sharing.recipientId)), uniqueItems = newItems.filter((newItem) => !existingIds.has(newItem.recipientId));
23
+ if (uniqueItems.length === 0) return prev;
24
+ const nextItems = [...prev, ...uniqueItems];
25
+ return onChange(nextItems), onAddItems(uniqueItems), nextItems;
26
+ });
27
+ },
28
+ deleteItem: (item) => {
29
+ setItems((prev) => {
30
+ const nextItems = prev.filter((sharing) => sharing.recipientId !== item.recipientId);
31
+ return nextItems.length === prev.length ? prev : (onChange(nextItems), onDeleteItems([item]), nextItems);
32
+ });
33
+ },
34
+ deleteItemsByIds: (ids) => {
35
+ setItems((prev) => {
36
+ const nextItems = prev.filter((sharing) => !ids.has(sharing.recipientId)), removedItems = prev.filter((sharing) => ids.has(sharing.recipientId));
37
+ return onChange(nextItems), onDeleteItems(removedItems), nextItems;
38
+ });
39
+ },
40
+ changeRight: (item, rightName) => {
41
+ const updatedItem = toggleRight(item, rightName);
42
+ setItems((prevItems) => {
43
+ const nextItems = prevItems.map((prevItem) => prevItem.recipientId === item.recipientId ? updatedItem : prevItem);
44
+ return onChange(nextItems), nextItems;
45
+ });
46
+ },
47
+ applyRightToIds: (ids, rightName, shouldAdd) => {
48
+ setItems((prev) => {
49
+ const nextItems = prev.map((sharing) => ids.has(sharing.recipientId) ? applyRight(sharing, rightName, shouldAdd) : sharing);
50
+ return onChange(nextItems), nextItems;
51
+ });
52
+ }
53
+ };
54
+ };
55
+ export {
56
+ useSharingItems
57
+ };
@@ -0,0 +1,2 @@
1
+ export * from './UserRightsList';
2
+ export type { BookmarkInput, BookmarkUser } from './types/types';
@@ -0,0 +1,34 @@
1
+ import { SharingItem } from '../../../types';
2
+ export type { SearchResultType, SharingItem } from '../../../types';
3
+ export type ResourceRightName = 'read' | 'contrib' | 'publish' | 'manager' | 'comment';
4
+ export type ResourceRightDefinition = {
5
+ priority: number;
6
+ default: boolean;
7
+ requires: ResourceRightName[];
8
+ excludes: ResourceRightName[];
9
+ };
10
+ export type ResourceRights = Record<ResourceRightName, ResourceRightDefinition>;
11
+ export interface BookmarkUser {
12
+ id: string;
13
+ displayName: string;
14
+ profile?: string;
15
+ activationCode?: boolean;
16
+ }
17
+ export interface BookmarkInput {
18
+ id: string;
19
+ name: string;
20
+ notVisibleCount?: number;
21
+ groups?: {
22
+ id: string;
23
+ displayName: string;
24
+ }[];
25
+ users: BookmarkUser[];
26
+ }
27
+ export interface BookmarkState {
28
+ id: string;
29
+ name: string;
30
+ permission: string[];
31
+ userIds: string[];
32
+ isExpanded: boolean;
33
+ }
34
+ export declare function isBookmarkInput(item: SharingItem | BookmarkInput): item is BookmarkInput;
@@ -0,0 +1,6 @@
1
+ function isBookmarkInput(item) {
2
+ return "users" in item && Array.isArray(item.users);
3
+ }
4
+ export {
5
+ isBookmarkInput
6
+ };
@@ -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,3 @@
1
+ export * from './UserSearch';
2
+ export * from './types/types';
3
+ export * from './types/visible';
@@ -0,0 +1,24 @@
1
+ import { ReactNode } from 'react';
2
+ import { SearchResultType, SharingItem } from '../../../types';
3
+ import { Visible } from './visible';
4
+ export type { SearchResultType, SharingItem };
5
+ export interface UserSearchProps {
6
+ placeholder?: string;
7
+ isAdmlcOrAdmc?: boolean;
8
+ bookmarks?: Visible[];
9
+ initialSharings?: SharingItem[];
10
+ getSearchResults: (searchInputValue: string) => Promise<SearchResponse>;
11
+ onSearchResultsChange?: (searchResult: Visible) => void;
12
+ }
13
+ export interface UserSearchRef {
14
+ removeSharing: (recipientId: string) => void;
15
+ }
16
+ export interface SearchResponse {
17
+ results: Visible[];
18
+ }
19
+ export interface SearchResultBase {
20
+ id: string;
21
+ displayName: string;
22
+ icon: ReactNode;
23
+ type: SearchResultType;
24
+ }
@@ -0,0 +1,24 @@
1
+ export declare enum VisibleType {
2
+ User = "User",
3
+ Group = "Group",
4
+ ShareBookmark = "ShareBookmark",
5
+ BroadcastGroup = "BroadcastGroup"
6
+ }
7
+ export type Visible = {
8
+ id: string;
9
+ displayName: string;
10
+ type: VisibleType;
11
+ children?: {
12
+ id: string;
13
+ displayName: string;
14
+ }[];
15
+ groupType?: string;
16
+ nbUsers?: number;
17
+ profile?: string;
18
+ relatives?: {
19
+ id: string;
20
+ displayName: string;
21
+ }[];
22
+ structureName?: string;
23
+ usedIn?: ('TO' | 'CC' | 'CCI')[];
24
+ };
@@ -0,0 +1,4 @@
1
+ var VisibleType = /* @__PURE__ */ ((VisibleType2) => (VisibleType2.User = "User", VisibleType2.Group = "Group", VisibleType2.ShareBookmark = "ShareBookmark", VisibleType2.BroadcastGroup = "BroadcastGroup", VisibleType2))(VisibleType || {});
2
+ export {
3
+ VisibleType
4
+ };
@@ -52,4 +52,6 @@ export * from './Toolbar';
52
52
  export * from './Tooltip';
53
53
  export * from './Tree';
54
54
  export * from './TreeView';
55
+ export * from './UserRightsList';
56
+ export * from './UserSearch';
55
57
  export * from './VisuallyHidden';
@@ -1,6 +1,7 @@
1
1
  import { ID } from '@edifice.io/client';
2
+ import { AvatarType } from '../../types';
2
3
  declare const useDirectory: () => {
3
- getAvatarURL: (userId: ID, type: "user" | "group") => string | undefined;
4
- getUserbookURL: (userId: ID, type: "user" | "group") => string;
4
+ getAvatarURL: (userId: ID, type: AvatarType) => string | undefined;
5
+ getUserbookURL: (userId: ID, type: AvatarType) => string;
5
6
  };
6
7
  export default useDirectory;
@@ -35,11 +35,11 @@ const useDropzone = (props) => {
35
35
  }, convertHEICImages = async (files2) => {
36
36
  if (files2 === null || files2.length === 0)
37
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)
38
+ let heicToLib;
39
+ return files2.some((file) => HEIC_MIME_TYPES.includes(file.type)) && (heicToLib = await import("heic-to")), Promise.all(files2.map(async (file) => {
40
+ if (heicToLib && heicToLib.isHeic(file))
41
41
  try {
42
- const converted = await heic2any({
42
+ const converted = await heicToLib.heicTo({
43
43
  blob: file,
44
44
  toType: "image/jpeg"
45
45
  });