@edifice.io/react 2.6.12-develop-integration-crna.20261101211105 → 2.6.12-develop-integration.20261103121816

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 (68) hide show
  1. package/dist/components/Dropdown/Dropdown.js +14 -20
  2. package/dist/components/Dropdown/DropdownContext.d.ts +0 -5
  3. package/dist/components/Dropdown/DropdownMenuGroup.js +6 -23
  4. package/dist/components/Dropdown/DropdownSearchInput.js +8 -16
  5. package/dist/components/Dropdown/DropdownTrigger.js +8 -24
  6. package/dist/components/Dropdown/useDropdownItemFilter.js +2 -2
  7. package/dist/components/Select/Select.d.ts +1 -14
  8. package/dist/components/Select/Select.js +5 -11
  9. package/dist/homepage.js +28 -24
  10. package/dist/hooks/index.d.ts +1 -0
  11. package/dist/hooks/useDropdown/useDropdown.d.ts +0 -5
  12. package/dist/hooks/useDropdown/useDropdown.js +6 -16
  13. package/dist/hooks/useGoogleDriveSearch/index.d.ts +1 -0
  14. package/dist/hooks/useGoogleDriveSearch/useGoogleDriveSearch.d.ts +19 -0
  15. package/dist/hooks/useGoogleDriveSearch/useGoogleDriveSearch.js +60 -0
  16. package/dist/hooks/useNextcloudSearch/useNextcloudSearch.d.ts +1 -1
  17. package/dist/hooks/useNextcloudSearch/useNextcloudSearch.js +2 -2
  18. package/dist/icons-apps.js +184 -182
  19. package/dist/index.js +198 -194
  20. package/dist/modules/editor/components/Editor/Editor.d.ts +7 -0
  21. package/dist/modules/editor/components/Editor/Editor.js +3 -2
  22. package/dist/modules/editor/components/EditorToolbar/EditorToolbar.d.ts +3 -1
  23. package/dist/modules/editor/components/EditorToolbar/EditorToolbar.js +14 -8
  24. package/dist/modules/editor/components/NodeView/ImageNodeView.d.ts +1 -1
  25. package/dist/modules/editor/components/NodeView/ImageNodeView.js +14 -7
  26. package/dist/modules/editor/hooks/useActionOptions.d.ts +1 -1
  27. package/dist/modules/editor/hooks/useActionOptions.js +12 -12
  28. package/dist/modules/editor/hooks/useTipTapEditor.d.ts +2 -1
  29. package/dist/modules/editor/hooks/useTipTapEditor.js +2 -2
  30. package/dist/modules/homepage/components/AlloLycee/AlloLycee.d.ts +11 -0
  31. package/dist/modules/homepage/components/AlloLycee/AlloLycee.js +32 -0
  32. package/dist/modules/homepage/components/AlloLycee/AlloLyceeContainer.d.ts +4 -0
  33. package/dist/modules/homepage/components/AlloLycee/AlloLyceeContainer.js +10 -0
  34. package/dist/modules/homepage/components/AlloLycee/index.d.ts +3 -0
  35. package/dist/modules/homepage/components/Favorites/Favorites.js +4 -1
  36. package/dist/modules/homepage/components/Notifications/components/CommonNotificationItem.js +9 -9
  37. package/dist/modules/homepage/components/Notifications/components/notificationAdapter.d.ts +2 -1
  38. package/dist/modules/homepage/components/Notifications/components/notificationAdapter.js +2 -2
  39. package/dist/modules/homepage/components/index.d.ts +1 -0
  40. package/dist/modules/icons/components/apps/IconElea.d.ts +7 -0
  41. package/dist/modules/icons/components/apps/IconElea.js +23 -0
  42. package/dist/modules/icons/components/apps/index.d.ts +1 -0
  43. package/dist/modules/multimedia/FileCard/GoogleDriveFileCard.d.ts +25 -0
  44. package/dist/modules/multimedia/FileCard/GoogleDriveFileCard.js +102 -0
  45. package/dist/modules/multimedia/FileCard/index.d.ts +2 -0
  46. package/dist/modules/multimedia/GoogleDrive/GoogleDrive.d.ts +24 -0
  47. package/dist/modules/multimedia/GoogleDrive/GoogleDrive.js +103 -0
  48. package/dist/modules/multimedia/GoogleDrive/index.d.ts +2 -0
  49. package/dist/modules/multimedia/Linker/InternalLinker/InternalLinker.d.ts +7 -1
  50. package/dist/modules/multimedia/Linker/InternalLinker/InternalLinker.js +2 -0
  51. package/dist/modules/multimedia/MediaLibrary/MediaLibrary.js +16 -5
  52. package/dist/modules/multimedia/MediaLibrary/innertabs/GoogleDrive.d.ts +1 -0
  53. package/dist/modules/multimedia/MediaLibrary/innertabs/GoogleDrive.js +61 -0
  54. package/dist/modules/multimedia/MediaLibrary/innertabs/index.d.ts +1 -0
  55. package/dist/modules/multimedia/MediaLibrary/innertabs/index.js +2 -0
  56. package/dist/modules/multimedia/Nextcloud/Nextcloud.js +19 -7
  57. package/dist/modules/multimedia/index.d.ts +1 -1
  58. package/dist/multimedia.js +26 -24
  59. package/package.json +6 -6
  60. package/dist/components/Dropdown/useMatchRegistry.d.ts +0 -13
  61. package/dist/components/Dropdown/useMatchRegistry.js +0 -20
  62. package/dist/modules/multimedia/Nextcloud/NextcloudLogin.d.ts +0 -12
  63. package/dist/modules/multimedia/Nextcloud/NextcloudLogin.js +0 -33
  64. package/dist/modules/multimedia/NextcloudFolders/NextcloudFolders.d.ts +0 -12
  65. package/dist/modules/multimedia/NextcloudFolders/NextcloudFolders.js +0 -51
  66. package/dist/modules/multimedia/NextcloudFolders/components/NewFolderForm.d.ts +0 -16
  67. package/dist/modules/multimedia/NextcloudFolders/components/NewFolderForm.js +0 -51
  68. package/dist/modules/multimedia/NextcloudFolders/index.d.ts +0 -1
@@ -1,5 +1,5 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { forwardRef, useState, useImperativeHandle, useCallback, useMemo, useEffect } from "react";
2
+ import { forwardRef, useState, useRef, useCallback, useImperativeHandle, useMemo, useEffect } from "react";
3
3
  import clsx from "clsx";
4
4
  import useDropdown from "../../hooks/useDropdown/useDropdown.js";
5
5
  import DropdownCheckboxItem from "./DropdownCheckboxItem.js";
@@ -11,7 +11,6 @@ import DropdownRadioItem from "./DropdownRadioItem.js";
11
11
  import DropdownSearchInput from "./DropdownSearchInput.js";
12
12
  import DropdownSeparator from "./DropdownSeparator.js";
13
13
  import DropdownTrigger from "./DropdownTrigger.js";
14
- import { useMatchRegistry } from "./useMatchRegistry.js";
15
14
  import useClickOutside from "../../hooks/useClickOutside/useClickOutside.js";
16
15
  const Root = /* @__PURE__ */ forwardRef(({
17
16
  children,
@@ -26,11 +25,15 @@ const Root = /* @__PURE__ */ forwardRef(({
26
25
  openOnSpace = !0,
27
26
  focusOnMouseEnter = !0
28
27
  }, refDropdown) => {
29
- const [searchQuery, setSearchQuery] = useState(""), [hasSearchInput, setHasSearchInput] = useState(!1), {
30
- hasMatches,
31
- reportMatch,
32
- unregisterMatch
33
- } = useMatchRegistry(), {
28
+ const [searchQuery, setSearchQuery] = useState(""), [hasMatches, setHasMatches] = useState(!0), matchMapRef = useRef(/* @__PURE__ */ new Map()), reportMatch = useCallback((id, isMatch) => {
29
+ matchMapRef.current.set(id, isMatch);
30
+ const next = [...matchMapRef.current.values()].some(Boolean);
31
+ setHasMatches((prev) => prev !== next ? next : prev);
32
+ }, []), unregisterMatch = useCallback((id) => {
33
+ matchMapRef.current.delete(id);
34
+ const next = matchMapRef.current.size === 0 || [...matchMapRef.current.values()].some(Boolean);
35
+ setHasMatches((prev) => prev !== next ? next : prev);
36
+ }, []), {
34
37
  visible,
35
38
  isFocused,
36
39
  triggerProps,
@@ -40,7 +43,6 @@ const Root = /* @__PURE__ */ forwardRef(({
40
43
  setVisible,
41
44
  menuRef,
42
45
  triggerRef,
43
- searchInputRef,
44
46
  closeDropdown,
45
47
  openDropdown
46
48
  } = useDropdown(placement, extraTriggerKeyDownHandler, isTriggerHovered, focusOnVisible, openOnSpace, focusOnMouseEnter);
@@ -55,38 +57,30 @@ const Root = /* @__PURE__ */ forwardRef(({
55
57
  }));
56
58
  const ref = useClickOutside(() => {
57
59
  setVisible(!1);
58
- }), [rootElement, setRootElement] = useState(null), rootRef = useCallback((node) => {
59
- ref.current = node, setRootElement(node);
60
- }, [ref]), value = useMemo(() => ({
60
+ }), value = useMemo(() => ({
61
61
  visible,
62
62
  isFocused,
63
63
  triggerProps,
64
64
  menuProps,
65
65
  itemProps,
66
66
  itemRefs,
67
- searchInputRef,
68
67
  block,
69
68
  setVisible,
70
69
  openDropdown,
71
70
  closeDropdown,
72
71
  searchQuery,
73
72
  setSearchQuery,
74
- hasSearchInput,
75
- setHasSearchInput,
76
- rootElement,
77
73
  hasMatches,
78
74
  reportMatch,
79
75
  unregisterMatch
80
- }), [visible, isFocused, triggerProps, menuProps, itemProps, itemRefs, searchInputRef, block, setVisible, openDropdown, closeDropdown, searchQuery, hasSearchInput, rootElement, hasMatches, reportMatch, unregisterMatch]), dropdown = clsx("dropdown", {
76
+ }), [visible, isFocused, triggerProps, menuProps, itemProps, itemRefs, block, setVisible, openDropdown, closeDropdown, searchQuery, hasMatches, reportMatch, unregisterMatch]), dropdown = clsx("dropdown", {
81
77
  "w-100": block,
82
78
  "dropdown-nowrap": noWrap,
83
- overflow,
84
- // The search input is positioned over the trigger, within the root box.
85
- "dropdown-searching": hasSearchInput
79
+ overflow
86
80
  });
87
81
  return useEffect(() => {
88
82
  onToggle == null || onToggle(visible), visible || setSearchQuery("");
89
- }, [visible]), /* @__PURE__ */ jsx(DropdownContext.Provider, { value, children: /* @__PURE__ */ jsx("div", { ref: rootRef, className: dropdown, children: typeof children == "function" ? children(triggerProps, itemRefs, setVisible) : children }) });
83
+ }, [visible]), /* @__PURE__ */ jsx(DropdownContext.Provider, { value, children: /* @__PURE__ */ jsx("div", { ref, className: dropdown, children: typeof children == "function" ? children(triggerProps, itemRefs, setVisible) : children }) });
90
84
  }), Dropdown = Object.assign(Root, {
91
85
  Trigger: DropdownTrigger,
92
86
  Menu: DropdownMenu,
@@ -4,11 +4,6 @@ export interface DropdownContextProps extends OmittedProps {
4
4
  block?: boolean;
5
5
  searchQuery: string;
6
6
  setSearchQuery: (query: string) => void;
7
- /** True while a `Dropdown.SearchInput` is displayed in place of the trigger. */
8
- hasSearchInput: boolean;
9
- setHasSearchInput: (hasSearchInput: boolean) => void;
10
- /** Dropdown root element, where the search input is displayed over the trigger. */
11
- rootElement: HTMLDivElement | null;
12
7
  hasMatches: boolean;
13
8
  reportMatch: (id: string, isMatch: boolean) => void;
14
9
  unregisterMatch: (id: string) => void;
@@ -1,29 +1,12 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { forwardRef, useContext, useCallback, useMemo } from "react";
3
- import { DropdownContext } from "./DropdownContext.js";
4
- import { useMatchRegistry } from "./useMatchRegistry.js";
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
5
3
  const DropdownMenuGroup = /* @__PURE__ */ forwardRef(({
6
4
  label,
7
5
  children
8
- }, forwardRef2) => {
9
- const context = useContext(DropdownContext), {
10
- hasMatches,
11
- reportMatch,
12
- unregisterMatch
13
- } = useMatchRegistry(), parentReportMatch = context == null ? void 0 : context.reportMatch, parentUnregisterMatch = context == null ? void 0 : context.unregisterMatch, groupReportMatch = useCallback((id, isMatch) => {
14
- reportMatch(id, isMatch), parentReportMatch == null || parentReportMatch(id, isMatch);
15
- }, [reportMatch, parentReportMatch]), groupUnregisterMatch = useCallback((id) => {
16
- unregisterMatch(id), parentUnregisterMatch == null || parentUnregisterMatch(id);
17
- }, [unregisterMatch, parentUnregisterMatch]), groupContext = useMemo(() => context && {
18
- ...context,
19
- reportMatch: groupReportMatch,
20
- unregisterMatch: groupUnregisterMatch
21
- }, [context, groupReportMatch, groupUnregisterMatch]);
22
- return /* @__PURE__ */ jsx(DropdownContext.Provider, { value: groupContext, children: /* @__PURE__ */ jsxs("div", { ref: forwardRef2, role: "group", hidden: !hasMatches, children: [
23
- /* @__PURE__ */ jsx("span", { className: "small px-4", children: /* @__PURE__ */ jsx("strong", { children: label }) }),
24
- children
25
- ] }) });
26
- });
6
+ }, forwardRef2) => /* @__PURE__ */ jsxs("div", { ref: forwardRef2, role: "group", children: [
7
+ /* @__PURE__ */ jsx("span", { className: "small px-4", children: /* @__PURE__ */ jsx("strong", { children: label }) }),
8
+ children
9
+ ] }));
27
10
  export {
28
11
  DropdownMenuGroup as default
29
12
  };
@@ -1,6 +1,4 @@
1
- import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
- import { useCallback } from "react";
3
- import { createPortal } from "react-dom";
1
+ import { jsxs, jsx } from "react/jsx-runtime";
4
2
  import { useDropdownContext } from "./DropdownContext.js";
5
3
  import SearchBar from "../SearchBar/SearchBar.js";
6
4
  const DropdownSearchInput = ({
@@ -11,21 +9,15 @@ const DropdownSearchInput = ({
11
9
  const {
12
10
  searchQuery,
13
11
  setSearchQuery,
14
- hasMatches,
15
- searchInputRef,
16
- setHasSearchInput,
17
- rootElement,
18
- itemProps
19
- } = useDropdownContext(), registerSearchInput = useCallback((node) => {
20
- searchInputRef.current = (node == null ? void 0 : node.querySelector("input")) ?? null, setHasSearchInput(!!node);
21
- }, [searchInputRef, setHasSearchInput]);
22
- return /* @__PURE__ */ jsxs(Fragment, { children: [
23
- rootElement && /* @__PURE__ */ createPortal(/* @__PURE__ */ jsx("div", { ref: registerSearchInput, className: "dropdown-search position-absolute top-0 start-0 w-100 h-100 z-1", children: /* @__PURE__ */ jsx(SearchBar, { isVariant: !0, clearable: !0, size: "md", className: "h-100", placeholder, value: searchQuery, onChange: (e) => {
12
+ hasMatches
13
+ } = useDropdownContext();
14
+ return /* @__PURE__ */ jsxs("div", { className: "px-8 pb-8", children: [
15
+ /* @__PURE__ */ jsx(SearchBar, { isVariant: !0, clearable: !0, size: "md", placeholder, value: searchQuery, onChange: (e) => {
24
16
  setSearchQuery(e.target.value), onSearch == null || onSearch(e.target.value);
25
17
  }, onKeyDown: (e) => {
26
- (e.key === "ArrowDown" || e.key === "Escape" || e.key === "Tab" && e.shiftKey) && itemProps.onMenuItemKeyDown(e), ["ArrowUp", "ArrowDown", "Enter", " "].includes(e.key) && e.stopPropagation();
27
- } }) }), rootElement),
28
- searchQuery && !hasMatches && /* @__PURE__ */ jsx("p", { className: "body-2 text-gray-700 text-center my-8", children: noResultsLabel })
18
+ ["ArrowUp", "ArrowDown", "Enter", " "].includes(e.key) && e.stopPropagation();
19
+ } }),
20
+ searchQuery && !hasMatches && /* @__PURE__ */ jsx("p", { className: "body-2 text-gray-700 text-center mt-8 mb-0", children: noResultsLabel })
29
21
  ] });
30
22
  };
31
23
  export {
@@ -23,30 +23,14 @@ const DropdownTrigger = /* @__PURE__ */ forwardRef(({
23
23
  }, forwardRef2) => {
24
24
  const {
25
25
  triggerProps,
26
- block,
27
- visible,
28
- hasSearchInput
29
- } = useDropdownContext(), className = clsx(
30
- "dropdown-toggle ",
31
- size,
32
- variant,
33
- {
34
- "w-100": block
35
- },
36
- // The open menu covers the trigger with its search input: hide the trigger
37
- // without removing it, so it keeps its place and can take the focus back.
38
- {
39
- "opacity-0": visible && hasSearchInput
40
- },
41
- triggerProps.className,
42
- restProps.className,
43
- {
44
- "rounded-pill": pill
45
- },
46
- {
47
- "base-shade": baseShade
48
- }
49
- ), style = {
26
+ block
27
+ } = useDropdownContext(), className = clsx("dropdown-toggle ", size, variant, {
28
+ "w-100": block
29
+ }, triggerProps.className, restProps.className, {
30
+ "rounded-pill": pill
31
+ }, {
32
+ "base-shade": baseShade
33
+ }), style = {
50
34
  ...outerBorderColor && {
51
35
  outline: `${outerBorderWidth}px solid var(--edifice-${outerBorderColor})`,
52
36
  outlineOffset: outerBorderOffset
@@ -1,11 +1,11 @@
1
1
  import { useId, useLayoutEffect } from "react";
2
2
  import { useDropdownContext } from "./DropdownContext.js";
3
- const normalize = (value) => value.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), useDropdownItemFilter = (searchValue) => {
3
+ const useDropdownItemFilter = (searchValue) => {
4
4
  const {
5
5
  searchQuery,
6
6
  reportMatch,
7
7
  unregisterMatch
8
- } = useDropdownContext(), id = useId(), isFiltered = searchValue !== void 0 && searchQuery !== "" && !normalize(searchValue).includes(normalize(searchQuery));
8
+ } = useDropdownContext(), id = useId(), isFiltered = searchValue !== void 0 && searchQuery !== "" && !searchValue.toLowerCase().includes(searchQuery.toLowerCase());
9
9
  return useLayoutEffect(() => {
10
10
  if (searchValue !== void 0)
11
11
  return reportMatch(id, !isFiltered), () => unregisterMatch(id);
@@ -35,26 +35,13 @@ export interface SelectProps extends Omit<DropdownProps, 'children'>, Omit<Dropd
35
35
  * Default value
36
36
  */
37
37
  defaultValue?: string;
38
- /**
39
- * Filter the options with a search input:
40
- * when the menu opens, the trigger turns into a search field.
41
- */
42
- searchable?: boolean;
43
- /**
44
- * Placeholder of the search input (with `searchable`)
45
- */
46
- searchPlaceholder?: string;
47
- /**
48
- * Label shown when no option matches the search (with `searchable`)
49
- */
50
- noResultsLabel?: string;
51
38
  }
52
39
  /**
53
40
  *
54
41
  * Select component is based on Dropdown Component. It extends `Dropdown` and `Dropdown.Trigger` props `block`, `overflow`, `icon`, `variant`, `size`, `disabled`
55
42
  */
56
43
  declare const Select: {
57
- ({ selectedValue, icon, options, overflow, block, variant, size, disabled, placeholderOption, onValueChange, defaultValue, searchable, searchPlaceholder, noResultsLabel, }: SelectProps): import("react/jsx-runtime").JSX.Element;
44
+ ({ selectedValue, icon, options, overflow, block, variant, size, disabled, placeholderOption, onValueChange, defaultValue, }: SelectProps): import("react/jsx-runtime").JSX.Element;
58
45
  displayName: string;
59
46
  };
60
47
  export default Select;
@@ -14,10 +14,7 @@ const Select = ({
14
14
  disabled,
15
15
  placeholderOption,
16
16
  onValueChange,
17
- defaultValue,
18
- searchable,
19
- searchPlaceholder,
20
- noResultsLabel
17
+ defaultValue
21
18
  }) => {
22
19
  const [localValue, setLocalValue] = useState(), {
23
20
  t
@@ -38,13 +35,10 @@ const Select = ({
38
35
  const label = typeof localValue == "object" ? localValue.label : localValue, iconChange = typeof localValue == "object" ? localValue.icon : void 0;
39
36
  return /* @__PURE__ */ jsxs(Dropdown, { overflow, block, children: [
40
37
  /* @__PURE__ */ jsx(SelectTrigger, { icon: iconChange || icon, label: /* @__PURE__ */ jsx("span", { className: "text-truncate", children: t(label || placeholderOption) }), variant, size, disabled }),
41
- /* @__PURE__ */ jsxs(Dropdown.Menu, { role: "listbox", children: [
42
- searchable && /* @__PURE__ */ jsx(Dropdown.SearchInput, { placeholder: searchPlaceholder, noResultsLabel }),
43
- options == null ? void 0 : options.map((option) => {
44
- const value = typeof option == "object" ? option.value : option, label2 = typeof option == "object" ? option.label : option, icon2 = typeof option == "object" ? option.icon : void 0;
45
- return /* @__PURE__ */ jsx(Dropdown.Item, { type: "action", onClick: () => setLocalValue(option), icon: icon2, searchValue: searchable ? label2 : void 0, children: label2 }, value);
46
- })
47
- ] })
38
+ /* @__PURE__ */ jsx(Dropdown.Menu, { role: "listbox", children: options == null ? void 0 : options.map((option) => {
39
+ const value = typeof option == "object" ? option.value : option, label2 = typeof option == "object" ? option.label : option, icon2 = typeof option == "object" ? option.icon : void 0;
40
+ return /* @__PURE__ */ jsx(Dropdown.Item, { type: "action", onClick: () => setLocalValue(option), icon: icon2, children: label2 }, value);
41
+ }) })
48
42
  ] });
49
43
  };
50
44
  export {
package/dist/homepage.js CHANGED
@@ -1,16 +1,18 @@
1
- import { default as default2 } from "./modules/homepage/components/Communities/Communities.js";
2
- import { default as default3 } from "./modules/homepage/components/Communities/CommunityItem.js";
3
- import { default as default4 } from "./modules/homepage/components/Communities/CommunitiesSkeleton.js";
4
- import { default as default5 } from "./modules/homepage/components/Header/Header.js";
5
- import { default as default6 } from "./modules/homepage/components/HomeCard/HomeCard.js";
6
- import { default as default7 } from "./modules/homepage/components/LastInfos/LastInfos.js";
7
- import { default as default8 } from "./modules/homepage/components/MessageFlashList/MessageFlash.js";
8
- import { default as default9 } from "./modules/homepage/components/MessageFlashList/MessageFlashList.js";
9
- import { default as default10 } from "./modules/homepage/components/Notifications/NotificationItem.js";
10
- import { default as default11 } from "./modules/homepage/components/Notifications/NotificationList.js";
1
+ import { default as default2 } from "./modules/homepage/components/AlloLycee/AlloLycee.js";
2
+ import { default as default3 } from "./modules/homepage/components/Communities/Communities.js";
3
+ import { default as default4 } from "./modules/homepage/components/Communities/CommunityItem.js";
4
+ import { default as default5 } from "./modules/homepage/components/Communities/CommunitiesSkeleton.js";
5
+ import { default as default6 } from "./modules/homepage/components/Header/Header.js";
6
+ import { default as default7 } from "./modules/homepage/components/HomeCard/HomeCard.js";
7
+ import { default as default8 } from "./modules/homepage/components/LastInfos/LastInfos.js";
8
+ import { default as default9 } from "./modules/homepage/components/MessageFlashList/MessageFlash.js";
9
+ import { default as default10 } from "./modules/homepage/components/MessageFlashList/MessageFlashList.js";
10
+ import { default as default11 } from "./modules/homepage/components/Notifications/NotificationItem.js";
11
+ import { default as default12 } from "./modules/homepage/components/Notifications/NotificationList.js";
11
12
  import { NotificationListContainer } from "./modules/homepage/components/Notifications/NotificationListContainer.js";
12
- import { default as default12 } from "./modules/homepage/components/SchoolSpace/SchoolSpace.js";
13
- import { default as default13 } from "./modules/homepage/components/UserSpace/UserSpace.js";
13
+ import { default as default13 } from "./modules/homepage/components/SchoolSpace/SchoolSpace.js";
14
+ import { default as default14 } from "./modules/homepage/components/UserSpace/UserSpace.js";
15
+ import { AlloLyceeContainer } from "./modules/homepage/components/AlloLycee/AlloLyceeContainer.js";
14
16
  import { COMMUNITIES_PREVIEW_SIZE, useCommunities } from "./modules/homepage/components/Communities/useCommunities.js";
15
17
  import { CommunitiesContainer } from "./modules/homepage/components/Communities/CommunitiesContainer.js";
16
18
  import { Favorites } from "./modules/homepage/components/Favorites/Favorites.js";
@@ -26,32 +28,34 @@ import { UsefulLinksContainer } from "./modules/homepage/components/UsefulLinks/
26
28
  import { UsefulLinksModal } from "./modules/homepage/components/UsefulLinks/UsefulLinksModal.js";
27
29
  import { UserSpaceContainer } from "./modules/homepage/components/UserSpace/UserSpaceContainer.js";
28
30
  export {
31
+ default2 as AlloLycee,
32
+ AlloLyceeContainer,
29
33
  COMMUNITIES_PREVIEW_SIZE,
30
- default2 as Communities,
34
+ default3 as Communities,
31
35
  CommunitiesContainer,
32
- default3 as CommunitiesItem,
33
- default4 as CommunitiesSkeleton,
36
+ default4 as CommunitiesItem,
37
+ default5 as CommunitiesSkeleton,
34
38
  Favorites,
35
39
  FavoritesContainer,
36
- default5 as Header,
37
- default6 as HomeCard,
38
- default7 as LastInfos,
40
+ default6 as Header,
41
+ default7 as HomeCard,
42
+ default8 as LastInfos,
39
43
  LastInfosContainer,
40
44
  LastInfosList,
41
45
  LinkForm,
42
46
  MAX_USEFUL_LINKS,
43
- default8 as MessageFlash,
44
- default9 as MessageFlashList,
47
+ default9 as MessageFlash,
48
+ default10 as MessageFlashList,
45
49
  MessageFlashListContainer,
46
- default10 as NotificationItem,
47
- default11 as NotificationList,
50
+ default11 as NotificationItem,
51
+ default12 as NotificationList,
48
52
  NotificationListContainer,
49
- default12 as SchoolSpace,
53
+ default13 as SchoolSpace,
50
54
  SchoolSpaceContainer,
51
55
  UsefulLinks,
52
56
  UsefulLinksContainer,
53
57
  UsefulLinksModal,
54
- default13 as UserSpace,
58
+ default14 as UserSpace,
55
59
  UserSpaceContainer,
56
60
  useCommunities,
57
61
  useUsefulLinksContainer
@@ -13,6 +13,7 @@ export * from './useDirectory';
13
13
  export * from './useDropdown';
14
14
  export * from './useDropzone';
15
15
  export * from './useEdificeIcons';
16
+ export * from './useGoogleDriveSearch';
16
17
  export * from './useHasWorkflow';
17
18
  export * from './useHover';
18
19
  export * from './useHttpErrorToast';
@@ -23,11 +23,6 @@ export interface UseDropdownProps {
23
23
  }>;
24
24
  triggerRef: MutableRefObject<HTMLButtonElement | null>;
25
25
  menuRef: MutableRefObject<HTMLUListElement | null>;
26
- /**
27
- * Search input displayed in place of the trigger while the menu is open, if any.
28
- * When set, it gets the focus on open and is reachable from the items with the keyboard.
29
- */
30
- searchInputRef: MutableRefObject<HTMLInputElement | null>;
31
26
  triggerProps: Record<string, any>;
32
27
  menuProps: Record<string, any>;
33
28
  itemProps: Record<string, any>;
@@ -2,7 +2,7 @@ import { useId, useState, useRef, useEffect, useCallback } from "react";
2
2
  import { useFloating, autoUpdate, offset, size, flip, useHover, safePolygon } from "@floating-ui/react";
3
3
  import { mergeRefs } from "../../utilities/refs/ref.js";
4
4
  const useDropdown = (placement, extraTriggerKeyDownHandler, isTriggerHovered = !1, focusOnVisible = !0, openOnSpace = !0, focusOnMouseEnter = !0) => {
5
- const id = useId(), [visible, setVisible] = useState(!1), [activeIndex, setActiveIndex] = useState(-1), [isFocused, setIsFocused] = useState(null), searchInputRef = useRef(null), {
5
+ const id = useId(), [visible, setVisible] = useState(!1), [activeIndex, setActiveIndex] = useState(-1), [isFocused, setIsFocused] = useState(null), {
6
6
  refs,
7
7
  floatingStyles,
8
8
  context
@@ -30,14 +30,9 @@ const useDropdown = (placement, extraTriggerKeyDownHandler, isTriggerHovered = !
30
30
  },
31
31
  handleClose: safePolygon()
32
32
  });
33
- const menuRef = useRef(null), triggerRef = useRef(null), itemRefs = useRef({}), focusSearchInput = () => {
34
- var _a;
35
- setActiveIndex(-1), setIsFocused(null), (_a = searchInputRef.current) == null || _a.focus({
36
- preventScroll: !0
37
- });
38
- };
33
+ const menuRef = useRef(null), triggerRef = useRef(null), itemRefs = useRef({});
39
34
  useEffect(() => {
40
- visible && searchInputRef.current && focusOnVisible ? focusSearchInput() : visible && menuRef.current && focusOnVisible ? (menuRef.current.focus(), setActiveIndex(0)) : (setActiveIndex(-1), itemRefs.current = {});
35
+ visible && menuRef.current && focusOnVisible ? (menuRef.current.focus(), setActiveIndex(0)) : (setActiveIndex(-1), itemRefs.current = {});
41
36
  }, [visible]), useEffect(() => {
42
37
  if (activeIndex !== -1) {
43
38
  const filteredItems = Object.values(itemRefs.current).filter((item) => !!item);
@@ -54,14 +49,10 @@ const useDropdown = (placement, extraTriggerKeyDownHandler, isTriggerHovered = !
54
49
  }, [activeIndex]);
55
50
  const visibleItemCount = () => Object.values(itemRefs.current).filter(Boolean).length, nextItem = () => {
56
51
  const count = visibleItemCount();
57
- count !== 0 && setActiveIndex((prevIndex) => (prevIndex + 1) % count);
52
+ setActiveIndex((prevIndex) => (prevIndex + 1) % count);
58
53
  }, previousItem = () => {
59
- if (activeIndex === 0 && searchInputRef.current) {
60
- focusSearchInput();
61
- return;
62
- }
63
54
  const count = visibleItemCount();
64
- count !== 0 && setActiveIndex((prevIndex) => (prevIndex - 1 + count) % count);
55
+ setActiveIndex((prevIndex) => (prevIndex - 1 + count) % count);
65
56
  }, firstItem = () => {
66
57
  setActiveIndex(0);
67
58
  }, lastItem = () => {
@@ -114,7 +105,7 @@ const useDropdown = (placement, extraTriggerKeyDownHandler, isTriggerHovered = !
114
105
  break;
115
106
  case " ":
116
107
  case "Enter":
117
- activeIndex !== -1 && (Object.values(itemRefs.current).filter(Boolean)[activeIndex].getAttribute("role") === "menuitem" && triggerRef.current && (triggerRef.current.focus(), setVisible(!1)), onSuccess == null || onSuccess()), flag = !0;
108
+ activeIndex !== -1 && (Object.values(itemRefs.current)[activeIndex].getAttribute("role") === "menuitem" && triggerRef.current && (triggerRef.current.focus(), setVisible(!1)), onSuccess == null || onSuccess()), flag = !0;
118
109
  break;
119
110
  case "ArrowDown":
120
111
  case "Down":
@@ -142,7 +133,6 @@ const useDropdown = (placement, extraTriggerKeyDownHandler, isTriggerHovered = !
142
133
  itemRefs,
143
134
  triggerRef,
144
135
  menuRef,
145
- searchInputRef,
146
136
  /* TriggerProps to spread to any Trigger component */
147
137
  triggerProps: {
148
138
  ref: mergeRefs(triggerRef, refs.setReference),
@@ -0,0 +1 @@
1
+ export { default as useGoogleDriveSearch } from './useGoogleDriveSearch';
@@ -0,0 +1,19 @@
1
+ import { GoogleDriveDocument, ID } from '@edifice.io/client';
2
+ import { TreeItem } from '../../components/Tree/types';
3
+ export type GoogleDriveFolderNode = TreeItem & {
4
+ files?: GoogleDriveDocument[];
5
+ };
6
+ /**
7
+ * Which documents a search browses from its root: the user's own Drive, or
8
+ * the documents other users shared with them.
9
+ */
10
+ export type GoogleDriveSearchFilter = 'mydrive' | 'shared';
11
+ export default function useGoogleDriveSearch(rootId: string, rootName: string, userId?: string, filter?: GoogleDriveSearchFilter): {
12
+ root: GoogleDriveFolderNode;
13
+ needsAuth: boolean;
14
+ isCheckingAuth: boolean;
15
+ isAuthError: boolean;
16
+ refetchAuthStatus: () => void;
17
+ loadContent: (folderId?: ID) => void;
18
+ loadError: unknown;
19
+ };
@@ -0,0 +1,60 @@
1
+ import { useState, useCallback } from "react";
2
+ import { odeServices } from "@edifice.io/client";
3
+ import { useQueryClient } from "@tanstack/react-query";
4
+ import { findNodeById, modifyNode } from "../../components/Tree/utilities/tree.js";
5
+ function useGoogleDriveSearch(rootId, rootName, userId, filter = "mydrive") {
6
+ const [root, setRoot] = useState({
7
+ id: rootId,
8
+ name: rootName,
9
+ section: !0
10
+ }), updateFolder = useCallback((folderId, subfolders, files) => {
11
+ setRoot((prev) => {
12
+ const node = findNodeById(prev, folderId);
13
+ if (!node) return prev;
14
+ const children = subfolders.map((f) => {
15
+ var _a;
16
+ const existing = (_a = node.children) == null ? void 0 : _a.find((c) => c.id === f.id);
17
+ return existing ? {
18
+ ...existing,
19
+ name: f.name
20
+ } : {
21
+ id: f.id,
22
+ name: f.name
23
+ };
24
+ });
25
+ return modifyNode(prev, (n) => n.id === node.id ? {
26
+ ...n,
27
+ children,
28
+ files
29
+ } : n);
30
+ });
31
+ }, []), queryClient = useQueryClient(), [loadError, setLoadError] = useState(null), loadContent = useCallback(async (folderId) => {
32
+ if (!userId) return;
33
+ const parentId = folderId === rootId ? void 0 : folderId, isSharedRoot = filter === "shared" && !parentId;
34
+ try {
35
+ const payload = await queryClient.fetchQuery({
36
+ queryKey: ["googledrive", "documents", userId, isSharedRoot ? "shared" : parentId ?? "root"],
37
+ queryFn: () => isSharedRoot ? odeServices.googledrive().listSharedDocuments(userId) : odeServices.googledrive().listDocuments(userId, parentId),
38
+ staleTime: 6e4
39
+ }), subfolders = [], files = [];
40
+ payload.filter((doc) => doc.id !== parentId).forEach((doc) => {
41
+ doc.isFolder ? doc.canCopyToWorkspace && subfolders.push(doc) : files.push(doc);
42
+ }), setLoadError(null), updateFolder(folderId, subfolders, files);
43
+ } catch (error) {
44
+ setLoadError(error);
45
+ }
46
+ }, [rootId, userId, filter, queryClient, updateFolder]);
47
+ return {
48
+ root,
49
+ needsAuth: !1,
50
+ isCheckingAuth: !1,
51
+ isAuthError: !1,
52
+ refetchAuthStatus: () => {
53
+ },
54
+ loadContent,
55
+ loadError
56
+ };
57
+ }
58
+ export {
59
+ useGoogleDriveSearch as default
60
+ };
@@ -9,6 +9,6 @@ export default function useNextcloudSearch(rootId: string, rootName: string, use
9
9
  isCheckingAuth: boolean;
10
10
  isAuthError: boolean;
11
11
  refetchAuthStatus: () => void;
12
- loadContent: (folderId?: ID, force?: boolean) => void;
12
+ loadContent: (folderId?: ID) => void;
13
13
  loadError: unknown;
14
14
  };
@@ -33,14 +33,14 @@ function useNextcloudSearch(rootId, rootName, userId) {
33
33
  queryKey: ["nextcloud", "oauth2-status", userId],
34
34
  queryFn: () => odeServices.nextcloud().getOauth2Status(userId),
35
35
  enabled: !!userId
36
- }), needsAuth = !((_a = oauth2StatusQuery.data) != null && _a.connected), [loadError, setLoadError] = useState(null), loadContent = useCallback(async (folderId, force = !1) => {
36
+ }), needsAuth = !((_a = oauth2StatusQuery.data) != null && _a.connected), [loadError, setLoadError] = useState(null), loadContent = useCallback(async (folderId) => {
37
37
  if (!userId) return;
38
38
  const path = folderId === rootId ? void 0 : folderId;
39
39
  try {
40
40
  const payload = await queryClient.fetchQuery({
41
41
  queryKey: ["nextcloud", "documents", userId, path ?? "/"],
42
42
  queryFn: () => odeServices.nextcloud().listDocuments(userId, path),
43
- staleTime: force ? 0 : 6e4
43
+ staleTime: 6e4
44
44
  }), subfolders = [], files = [], currentPath = path ?? "/";
45
45
  payload.filter((doc) => doc.path !== currentPath).forEach((doc) => {
46
46
  doc.isFolder ? subfolders.push(doc) : files.push(doc);