@edifice.io/react 2.2.8-develop-b2school.20250602164507 → 2.2.8-develop.20250605102441
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.
- package/dist/components/Button/Button.d.ts +1 -1
- package/dist/components/Button/Button.js +1 -1
- package/dist/components/Button/IconButton.js +1 -1
- package/dist/components/Combobox/Combobox.d.ts +5 -60
- package/dist/components/Combobox/Combobox.js +7 -18
- package/dist/components/Combobox/ComboboxTrigger.d.ts +3 -34
- package/dist/components/Combobox/ComboboxTrigger.js +8 -33
- package/dist/components/Dropdown/Dropdown.d.ts +2 -10
- package/dist/components/Dropdown/Dropdown.js +3 -5
- package/dist/components/Dropdown/DropdownItem.d.ts +1 -5
- package/dist/components/Dropdown/DropdownItem.js +1 -4
- package/dist/components/Dropdown/DropdownTrigger.js +1 -5
- package/dist/components/Input/Input.d.ts +0 -4
- package/dist/components/Input/Input.js +5 -21
- package/dist/components/Layout/components/Header.js +1 -1
- package/dist/components/List/List.d.ts +1 -16
- package/dist/components/List/List.js +26 -30
- package/dist/components/Modal/ModalHeader.js +2 -2
- package/dist/components/SearchBar/SearchBar.d.ts +1 -1
- package/dist/components/SearchBar/SearchBar.js +1 -3
- package/dist/components/Tabs/components/Tabs.d.ts +1 -1
- package/dist/components/Tabs/components/TabsItem.d.ts +5 -1
- package/dist/components/Tabs/components/TabsItem.js +6 -1
- package/dist/components/Toolbar/Toolbar.d.ts +0 -4
- package/dist/components/Toolbar/Toolbar.js +3 -8
- package/dist/components/Tree/components/Tree.js +2 -1
- package/dist/components/Tree/hooks/useTree.d.ts +1 -0
- package/dist/components/Tree/hooks/useTree.js +25 -2
- package/dist/components/Tree/types/index.d.ts +4 -0
- package/dist/editor.js +24 -28
- package/dist/hooks/index.d.ts +0 -1
- package/dist/hooks/useCheckable/useCheckable.js +3 -10
- package/dist/hooks/useConversation/useConversation.d.ts +1 -1
- package/dist/hooks/useConversation/useConversation.js +17 -13
- package/dist/hooks/useDate/useDate.d.ts +0 -1
- package/dist/hooks/useDate/useDate.js +27 -33
- package/dist/hooks/useDropdown/useDropdown.d.ts +1 -2
- package/dist/hooks/useDropdown/useDropdown.js +3 -5
- package/dist/hooks/useDropzone/useDropzone.js +1 -1
- package/dist/hooks/useHttpErrorToast/useHttpErrorToast.js +3 -12
- package/dist/icons.js +216 -236
- package/dist/index.d.ts +0 -1
- package/dist/index.js +20 -50
- package/dist/modals.js +14 -16
- package/dist/modules/editor/components/Editor/Editor.d.ts +1 -8
- package/dist/modules/editor/components/Editor/Editor.js +3 -7
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.DropdownMenu.js +1 -1
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.PlusMenu.js +1 -1
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.TextSize.js +2 -2
- package/dist/modules/editor/components/EditorToolbar/EditorToolbar.Typography.js +2 -2
- package/dist/modules/editor/components/NodeView/index.d.ts +1 -2
- package/dist/modules/editor/components/Renderer/index.d.ts +1 -2
- package/dist/modules/editor/components/Toolbar/TableToolbar.AddMenu.js +33 -12
- package/dist/modules/editor/components/Toolbar/TableToolbar.DelMenu.js +28 -11
- package/dist/modules/editor/hooks/useTipTapEditor.d.ts +2 -6
- package/dist/modules/editor/hooks/useTipTapEditor.js +2 -2
- package/dist/modules/icons/components/index.d.ts +0 -10
- package/dist/modules/modals/OnboardingModal/OnboardingModal.d.ts +5 -9
- package/dist/modules/modals/OnboardingModal/OnboardingModal.js +4 -5
- package/dist/modules/modals/index.d.ts +0 -1
- package/dist/modules/multimedia/index.d.ts +0 -1
- package/dist/multimedia.js +1 -3
- package/package.json +6 -6
- package/dist/hooks/useWorkspaceFolders/index.d.ts +0 -3
- package/dist/hooks/useWorkspaceFolders/useWorkspaceFolders.js +0 -54
- package/dist/hooks/useWorkspaceFolders/useWorkspaceFoldersTree.d.ts +0 -13
- package/dist/hooks/useWorkspaceFolders/useWorkspaceFoldersTree.js +0 -51
- package/dist/modules/editor/components/NodeView/ConversationHistoryNodeView.d.ts +0 -2
- package/dist/modules/editor/components/NodeView/ConversationHistoryNodeView.js +0 -10
- package/dist/modules/editor/components/Renderer/ConversationHistoryRenderer.d.ts +0 -8
- package/dist/modules/editor/components/Renderer/ConversationHistoryRenderer.js +0 -28
- package/dist/modules/icons/components/IconFolderAdd.d.ts +0 -7
- package/dist/modules/icons/components/IconFolderAdd.js +0 -13
- package/dist/modules/icons/components/IconFolderDelete.d.ts +0 -7
- package/dist/modules/icons/components/IconFolderDelete.js +0 -12
- package/dist/modules/icons/components/IconGlobe2.d.ts +0 -7
- package/dist/modules/icons/components/IconGlobe2.js +0 -16
- package/dist/modules/icons/components/IconGroupAvatar.d.ts +0 -7
- package/dist/modules/icons/components/IconGroupAvatar.js +0 -12
- package/dist/modules/icons/components/IconMailRecall.d.ts +0 -7
- package/dist/modules/icons/components/IconMailRecall.js +0 -13
- package/dist/modules/icons/components/IconQuestionMark.d.ts +0 -7
- package/dist/modules/icons/components/IconQuestionMark.js +0 -13
- package/dist/modules/icons/components/IconReadMail.d.ts +0 -7
- package/dist/modules/icons/components/IconReadMail.js +0 -16
- package/dist/modules/icons/components/IconSignature.d.ts +0 -7
- package/dist/modules/icons/components/IconSignature.js +0 -13
- package/dist/modules/icons/components/IconUndoAll.d.ts +0 -7
- package/dist/modules/icons/components/IconUndoAll.js +0 -14
- package/dist/modules/icons/components/IconUnreadMail.d.ts +0 -7
- package/dist/modules/icons/components/IconUnreadMail.js +0 -16
- package/dist/modules/modals/ConfirmModal/ConfirmModal.d.ts +0 -47
- package/dist/modules/modals/ConfirmModal/ConfirmModal.js +0 -37
- package/dist/modules/modals/ConfirmModal/index.d.ts +0 -1
- package/dist/modules/multimedia/WorkspaceFolders/WorkspaceFolders.d.ts +0 -8
- package/dist/modules/multimedia/WorkspaceFolders/WorkspaceFolders.js +0 -55
- package/dist/modules/multimedia/WorkspaceFolders/components/NewFolderForm.d.ts +0 -16
- package/dist/modules/multimedia/WorkspaceFolders/components/NewFolderForm.js +0 -39
- package/dist/modules/multimedia/WorkspaceFolders/index.d.ts +0 -1
|
@@ -8,6 +8,10 @@ export interface TabsItemProps {
|
|
|
8
8
|
* Item icon
|
|
9
9
|
*/
|
|
10
10
|
icon: ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* Item badge
|
|
13
|
+
*/
|
|
14
|
+
badge?: ReactNode;
|
|
11
15
|
/**
|
|
12
16
|
* Item label
|
|
13
17
|
*/
|
|
@@ -18,7 +22,7 @@ export interface TabsItemProps {
|
|
|
18
22
|
content: ReactNode;
|
|
19
23
|
}
|
|
20
24
|
declare const TabsItem: {
|
|
21
|
-
({ icon, label, id, order, }: TabsItemProps & {
|
|
25
|
+
({ icon, badge, label, id, order, }: TabsItemProps & {
|
|
22
26
|
order: number;
|
|
23
27
|
}): import("react/jsx-runtime").JSX.Element;
|
|
24
28
|
displayName: string;
|
|
@@ -4,6 +4,7 @@ import { useTranslation } from "react-i18next";
|
|
|
4
4
|
import { useTabsContext } from "../context/TabsContext.js";
|
|
5
5
|
const TabsItem = ({
|
|
6
6
|
icon,
|
|
7
|
+
badge,
|
|
7
8
|
label,
|
|
8
9
|
id,
|
|
9
10
|
order
|
|
@@ -18,7 +19,11 @@ const TabsItem = ({
|
|
|
18
19
|
} = useTranslation(), classes = clsx("nav-link d-inline-flex gap-8 border-0", activeTab === id ? "selected" : "");
|
|
19
20
|
return /* @__PURE__ */ jsx("li", { className: "nav-item flex-shrink-0", role: "presentation", children: /* @__PURE__ */ jsxs("button", { ref: (el) => tabsRef.current[order] = el, type: "button", id: `tab-${id}`, className: classes, onClick: () => setSelectedTab(id), onKeyDown: (event) => onKeyDown(event), role: "tab", "aria-controls": `tabpanel-${id}`, "aria-selected": activeTab === id, tabIndex: activeTab === id ? 0 : -1, children: [
|
|
20
21
|
icon,
|
|
21
|
-
/* @__PURE__ */
|
|
22
|
+
/* @__PURE__ */ jsxs("small", { children: [
|
|
23
|
+
t(label),
|
|
24
|
+
" ",
|
|
25
|
+
badge
|
|
26
|
+
] })
|
|
22
27
|
] }) });
|
|
23
28
|
};
|
|
24
29
|
export {
|
|
@@ -71,10 +71,6 @@ export interface ToolbarProps extends React.ComponentPropsWithRef<'div'> {
|
|
|
71
71
|
* Accept optional children
|
|
72
72
|
*/
|
|
73
73
|
children?: ReactNode;
|
|
74
|
-
/**
|
|
75
|
-
* Hide labels on mobile
|
|
76
|
-
*/
|
|
77
|
-
shouldHideLabelsOnMobile?: boolean;
|
|
78
74
|
}
|
|
79
75
|
export declare const Toolbar: import('react').ForwardRefExoticComponent<Omit<ToolbarProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
80
76
|
export default Toolbar;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useState, useRef, useEffect, createElement } from "react";
|
|
3
3
|
import clsx from "clsx";
|
|
4
|
-
import useBreakpoint from "../../hooks/useBreakpoint/useBreakpoint.js";
|
|
5
4
|
import { mergeRefs } from "../../utilities/refs/ref.js";
|
|
6
5
|
import Tooltip from "../Tooltip/Tooltip.js";
|
|
7
6
|
import Button from "../Button/Button.js";
|
|
@@ -13,12 +12,9 @@ const Toolbar = /* @__PURE__ */ forwardRef(({
|
|
|
13
12
|
align = "space",
|
|
14
13
|
isBlock = !1,
|
|
15
14
|
ariaControls,
|
|
16
|
-
className
|
|
17
|
-
shouldHideLabelsOnMobile = !1
|
|
15
|
+
className
|
|
18
16
|
}, ref) => {
|
|
19
|
-
const [firstFocusableItemIndex, setFirstFocusableItemIndex] = useState(0), [a11yNavigationItems, setA11yNavigationItems] = useState([]), [firstA11yNavigationItem, setFirstA11yNavigationItem] = useState(), [lastA11yNavigationItem, setA11yNavigationLastItem] = useState(), divToolbarRef = useRef(), {
|
|
20
|
-
lg
|
|
21
|
-
} = useBreakpoint(), classes = clsx("toolbar z-1000 bg-white", className, {
|
|
17
|
+
const [firstFocusableItemIndex, setFirstFocusableItemIndex] = useState(0), [a11yNavigationItems, setA11yNavigationItems] = useState([]), [firstA11yNavigationItem, setFirstA11yNavigationItem] = useState(), [lastA11yNavigationItem, setA11yNavigationLastItem] = useState(), divToolbarRef = useRef(), classes = clsx("toolbar z-1000 bg-white", className, {
|
|
22
18
|
default: variant === "default",
|
|
23
19
|
"no-shadow": variant === "no-shadow",
|
|
24
20
|
"d-flex": isBlock,
|
|
@@ -61,12 +57,11 @@ const Toolbar = /* @__PURE__ */ forwardRef(({
|
|
|
61
57
|
};
|
|
62
58
|
return /* @__PURE__ */ jsx("div", { ref: mergeRefs(ref, divToolbarRef), className: classes, role: "toolbar", "aria-label": "Text Formatting", "aria-controls": ariaControls, onFocus: handleFocus, onBlur: handleBlur, children: items.map((item, index) => {
|
|
63
59
|
if (item.visibility === "hide") return null;
|
|
64
|
-
const hideLabel = shouldHideLabelsOnMobile && !lg;
|
|
65
60
|
switch (item.type) {
|
|
66
61
|
case "divider":
|
|
67
62
|
return /* @__PURE__ */ jsx("div", { className: "toolbar-divider" }, item.name ?? index);
|
|
68
63
|
case "button":
|
|
69
|
-
return /* @__PURE__ */ jsx(Tooltip, { message:
|
|
64
|
+
return /* @__PURE__ */ jsx(Tooltip, { message: renderTooltipMessage(item), placement: renderTooltipPosition(item), children: /* @__PURE__ */ createElement(Button, { ...item.props, key: item.name ?? index, color: item.props.color ? item.props.color : "tertiary", variant: "ghost", tabIndex: index === firstFocusableItemIndex ? 0 : -1, onKeyDown: handleKeyDown }) }, item.name ?? index);
|
|
70
65
|
case "icon":
|
|
71
66
|
return /* @__PURE__ */ jsx(Tooltip, { message: renderTooltipMessage(item), placement: renderTooltipPosition(item), children: /* @__PURE__ */ createElement(IconButton, { ...item.props, key: item.name ?? index, color: item.props.color ? item.props.color : "tertiary", variant: item.props.variant ? item.props.variant : "ghost", tabIndex: index === firstFocusableItemIndex ? 0 : -1, onKeyDown: handleKeyDown }) }, item.name ?? index);
|
|
72
67
|
case "dropdown":
|
|
@@ -19,6 +19,7 @@ const Tree = ({
|
|
|
19
19
|
const {
|
|
20
20
|
selectedNodeId,
|
|
21
21
|
expandedNodes,
|
|
22
|
+
siblingsNodes,
|
|
22
23
|
handleItemClick,
|
|
23
24
|
handleFoldUnfold
|
|
24
25
|
} = useTree({
|
|
@@ -30,7 +31,7 @@ const Tree = ({
|
|
|
30
31
|
onTreeItemFold,
|
|
31
32
|
onTreeItemUnfold
|
|
32
33
|
});
|
|
33
|
-
return /* @__PURE__ */ jsx("div", { className: "treeview", children: /* @__PURE__ */ jsx("ul", { role: "tree", className: "m-0 p-0", children: Array.isArray(nodes) ? nodes.map((node) => /* @__PURE__ */ jsx(TreeNode, { node, showIcon, selectedNodeId, expandedNodes, onTreeItemClick: handleItemClick, onToggleNode: handleFoldUnfold, renderNode }, node.id)) : /* @__PURE__ */ jsx(TreeNode, { node: nodes, selectedNodeId, expandedNodes, showIcon, onTreeItemClick: handleItemClick, onToggleNode: handleFoldUnfold }) }) });
|
|
34
|
+
return /* @__PURE__ */ jsx("div", { className: "treeview", children: /* @__PURE__ */ jsx("ul", { role: "tree", className: "m-0 p-0", children: Array.isArray(nodes) ? nodes.map((node) => /* @__PURE__ */ jsx(TreeNode, { node, showIcon, selectedNodeId, expandedNodes, siblingsNodes, onTreeItemClick: handleItemClick, onToggleNode: handleFoldUnfold, renderNode }, node.id)) : /* @__PURE__ */ jsx(TreeNode, { node: nodes, selectedNodeId, expandedNodes, siblingsNodes, showIcon, onTreeItemClick: handleItemClick, onToggleNode: handleFoldUnfold }) }) });
|
|
34
35
|
}, TreeNode = /* @__PURE__ */ forwardRef(({
|
|
35
36
|
node,
|
|
36
37
|
selectedNodeId,
|
|
@@ -23,6 +23,7 @@ export declare const useTree: ({ data, externalSelectedNodeId, draggedNode, shou
|
|
|
23
23
|
}) => {
|
|
24
24
|
selectedNodeId: string | null | undefined;
|
|
25
25
|
expandedNodes: Set<string>;
|
|
26
|
+
siblingsNodes: import('react').MutableRefObject<Set<string>>;
|
|
26
27
|
draggedNodeId: string | undefined;
|
|
27
28
|
handleItemClick: (nodeId: string) => void;
|
|
28
29
|
handleFoldUnfold: (nodeId: string) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useState, useEffect } from "react";
|
|
1
|
+
import { useState, useRef, useEffect } from "react";
|
|
2
2
|
import { findNodeById, findPathById } from "../utilities/tree.js";
|
|
3
3
|
const useTree = ({
|
|
4
4
|
data,
|
|
@@ -9,11 +9,33 @@ const useTree = ({
|
|
|
9
9
|
onTreeItemFold,
|
|
10
10
|
onTreeItemClick
|
|
11
11
|
}) => {
|
|
12
|
-
const [internalSelectedNodeId, setInternalSelectedNodeId] = useState(void 0), [expandedNodes, setExpandedNodes] = useState(/* @__PURE__ */ new Set()), [draggedNodeId, setDraggedNodeId] = useState(void 0), selectedNodeId = internalSelectedNodeId ?? externalSelectedNodeId
|
|
12
|
+
const [internalSelectedNodeId, setInternalSelectedNodeId] = useState(void 0), [expandedNodes, setExpandedNodes] = useState(/* @__PURE__ */ new Set()), siblingsNodes = useRef(/* @__PURE__ */ new Set()), [draggedNodeId, setDraggedNodeId] = useState(void 0), selectedNodeId = internalSelectedNodeId ?? externalSelectedNodeId;
|
|
13
|
+
function addNodesWithSiblingHavingChildren(data2) {
|
|
14
|
+
var _a;
|
|
15
|
+
Array.isArray(data2) ? data2.forEach((node) => {
|
|
16
|
+
const resultSet = new Set(siblingsNodes.current);
|
|
17
|
+
data2.filter(({
|
|
18
|
+
id
|
|
19
|
+
}) => id !== node.id).some((sibling) => sibling.children && sibling.children.length > 0) && resultSet.add(node.id), node.children && node.children.length > 0 && node.children.forEach((child) => {
|
|
20
|
+
var _a2;
|
|
21
|
+
const childSiblings = (_a2 = node.children) == null ? void 0 : _a2.filter(({
|
|
22
|
+
id
|
|
23
|
+
}) => id !== child.id);
|
|
24
|
+
(childSiblings == null ? void 0 : childSiblings.some((sibling) => sibling.children && sibling.children.length > 0)) && resultSet.add(child.id), addNodesWithSiblingHavingChildren(child);
|
|
25
|
+
});
|
|
26
|
+
}) : (_a = data2.children) == null || _a.forEach((child) => {
|
|
27
|
+
var _a2;
|
|
28
|
+
const resultSet = new Set(siblingsNodes.current), siblings = (_a2 = data2.children) == null ? void 0 : _a2.filter((c) => c.id !== child.id);
|
|
29
|
+
(siblings == null ? void 0 : siblings.some((sibling) => sibling.children && sibling.children.length > 0)) && (resultSet.add(child.id), siblingsNodes.current = resultSet), addNodesWithSiblingHavingChildren(child);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
const expandAllNodes = (shouldExpandAllNodes2) => {
|
|
13
33
|
const initExpandedNodes = new Set("");
|
|
14
34
|
data && Array.isArray(data) && shouldExpandAllNodes2 && (data.forEach((node) => initExpandedNodes.add(node.id)), setExpandedNodes(initExpandedNodes));
|
|
15
35
|
};
|
|
16
36
|
useEffect(() => {
|
|
37
|
+
data && addNodesWithSiblingHavingChildren(data);
|
|
38
|
+
}, [data]), useEffect(() => {
|
|
17
39
|
draggedNode != null && draggedNode.isOver && draggedNode.isTreeview ? (draggedNode.overId && handleItemDrag(draggedNode.overId), setDraggedNodeId(draggedNode.overId)) : setDraggedNodeId(void 0);
|
|
18
40
|
}, [draggedNode]), useEffect(() => {
|
|
19
41
|
shouldExpandAllNodes && expandAllNodes(shouldExpandAllNodes);
|
|
@@ -51,6 +73,7 @@ const useTree = ({
|
|
|
51
73
|
return {
|
|
52
74
|
selectedNodeId,
|
|
53
75
|
expandedNodes,
|
|
76
|
+
siblingsNodes,
|
|
54
77
|
draggedNodeId,
|
|
55
78
|
handleItemClick,
|
|
56
79
|
handleFoldUnfold,
|
|
@@ -115,6 +115,10 @@ export interface TreeNodeProps extends ComponentPropsWithRef<'li'>, SharedTreePr
|
|
|
115
115
|
* Nodes expanded (opened)
|
|
116
116
|
*/
|
|
117
117
|
expandedNodes: Set<string>;
|
|
118
|
+
/**
|
|
119
|
+
* Siblings nodes
|
|
120
|
+
*/
|
|
121
|
+
siblingsNodes?: React.MutableRefObject<Set<string>>;
|
|
118
122
|
/**
|
|
119
123
|
* Node is a child
|
|
120
124
|
*/
|
package/dist/editor.js
CHANGED
|
@@ -2,21 +2,19 @@ import { EditorContent, Editor, useEditor } from "@tiptap/react";
|
|
|
2
2
|
import { default as default2 } from "@tiptap/starter-kit";
|
|
3
3
|
import { default as default3 } from "./modules/editor/components/Editor/Editor.js";
|
|
4
4
|
import { default as default4 } from "./modules/editor/components/BubbleMenuEditImage/BubbleMenuEditImage.js";
|
|
5
|
-
import { default as default5 } from "./modules/editor/components/NodeView/
|
|
6
|
-
import { default as default6 } from "./modules/editor/components/NodeView/
|
|
7
|
-
import { default as default7 } from "./modules/editor/components/NodeView/
|
|
8
|
-
import { default as default8 } from "./modules/editor/components/NodeView/
|
|
9
|
-
import { default as default9 } from "./modules/editor/components/NodeView/
|
|
10
|
-
import { default as default10 } from "./modules/editor/components/NodeView/
|
|
11
|
-
import { default as default11 } from "./modules/editor/components/
|
|
5
|
+
import { default as default5 } from "./modules/editor/components/NodeView/AudioNodeView.js";
|
|
6
|
+
import { default as default6 } from "./modules/editor/components/NodeView/AttachmentNodeView.js";
|
|
7
|
+
import { default as default7 } from "./modules/editor/components/NodeView/ImageNodeView.js";
|
|
8
|
+
import { default as default8 } from "./modules/editor/components/NodeView/LinkerNodeView.js";
|
|
9
|
+
import { default as default9 } from "./modules/editor/components/NodeView/VideoNodeView.js";
|
|
10
|
+
import { default as default10 } from "./modules/editor/components/NodeView/InformationPaneNodeView.js";
|
|
11
|
+
import { default as default11 } from "./modules/editor/components/Renderer/AudioRenderer.js";
|
|
12
12
|
import { default as default12 } from "./modules/editor/components/Renderer/AttachmentRenderer.js";
|
|
13
|
-
import { default as default13 } from "./modules/editor/components/Renderer/
|
|
14
|
-
import { default as default14 } from "./modules/editor/components/Renderer/
|
|
15
|
-
import { default as default15 } from "./modules/editor/components/Renderer/
|
|
16
|
-
import { default as default16 } from "./modules/editor/components/
|
|
17
|
-
import { default as default17 } from "./modules/editor/components/
|
|
18
|
-
import { default as default18 } from "./modules/editor/components/Toolbar/TableToolbar.js";
|
|
19
|
-
import { default as default19 } from "./modules/editor/components/Toolbar/LinkToolbar.js";
|
|
13
|
+
import { default as default13 } from "./modules/editor/components/Renderer/LinkerRenderer.js";
|
|
14
|
+
import { default as default14 } from "./modules/editor/components/Renderer/MediaRenderer.js";
|
|
15
|
+
import { default as default15 } from "./modules/editor/components/Renderer/InformationPaneRenderer.js";
|
|
16
|
+
import { default as default16 } from "./modules/editor/components/Toolbar/TableToolbar.js";
|
|
17
|
+
import { default as default17 } from "./modules/editor/components/Toolbar/LinkToolbar.js";
|
|
20
18
|
import { EditorToolbar } from "./modules/editor/components/EditorToolbar/EditorToolbar.js";
|
|
21
19
|
import { useActionOptions } from "./modules/editor/hooks/useActionOptions.js";
|
|
22
20
|
import { useCommentEditor } from "./modules/editor/hooks/useCommentEditor.js";
|
|
@@ -32,28 +30,26 @@ import { useSpeechSynthetisis } from "./modules/editor/hooks/useSpeechSynthetisi
|
|
|
32
30
|
import { useTipTapEditor } from "./modules/editor/hooks/useTipTapEditor.js";
|
|
33
31
|
import { useCantooEditor } from "./modules/editor/hooks/useCantooEditor.js";
|
|
34
32
|
export {
|
|
35
|
-
|
|
33
|
+
default6 as AttachmentNodeView,
|
|
36
34
|
default12 as AttachmentRenderer,
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
default5 as AudioNodeView,
|
|
36
|
+
default11 as AudioRenderer,
|
|
39
37
|
default4 as BubbleMenuEditImage,
|
|
40
|
-
default7 as ConversationHistoryNodeView,
|
|
41
|
-
default14 as ConversationHistoryRenderer,
|
|
42
38
|
default3 as Editor,
|
|
43
39
|
EditorContent,
|
|
44
40
|
EditorContext,
|
|
45
41
|
Editor as EditorInstance,
|
|
46
42
|
EditorToolbar,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
43
|
+
default7 as ImageNodeView,
|
|
44
|
+
default10 as InformationPaneNodeView,
|
|
45
|
+
default15 as InformationPaneRenderer,
|
|
46
|
+
default17 as LinkToolbar,
|
|
47
|
+
default8 as LinkerNodeView,
|
|
48
|
+
default13 as LinkerRenderer,
|
|
49
|
+
default14 as MediaRenderer,
|
|
54
50
|
default2 as StarterKit,
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
default16 as TableToolbar,
|
|
52
|
+
default9 as VideoNodeView,
|
|
57
53
|
useActionOptions,
|
|
58
54
|
useCantooEditor,
|
|
59
55
|
useCommentEditor,
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -29,7 +29,6 @@ export * from './useUpload';
|
|
|
29
29
|
export * from './useUploadFiles';
|
|
30
30
|
export * from './useUser';
|
|
31
31
|
export * from './useWorkspaceFile';
|
|
32
|
-
export * from './useWorkspaceFolders';
|
|
33
32
|
export * from './useWorkspaceSearch';
|
|
34
33
|
export * from './useXitiTrackPageLoad';
|
|
35
34
|
export * from './useZendeskGuide';
|
|
@@ -1,20 +1,13 @@
|
|
|
1
|
-
import { useState
|
|
1
|
+
import { useState } from "react";
|
|
2
2
|
const useCheckable = (data) => {
|
|
3
|
-
const [selectedItems, setSelectedItems] = useState([])
|
|
4
|
-
useEffect(() => {
|
|
5
|
-
if (data) {
|
|
6
|
-
const validSelectedItems = selectedItems.filter((id) => data.some((item) => item._id === id));
|
|
7
|
-
validSelectedItems.length !== selectedItems.length && setSelectedItems(validSelectedItems);
|
|
8
|
-
}
|
|
9
|
-
}, [data]);
|
|
10
|
-
const handleOnSelectItem = (itemId) => {
|
|
3
|
+
const [selectedItems, setSelectedItems] = useState([]), handleOnSelectItem = (itemId) => {
|
|
11
4
|
setSelectedItems((currentSelection) => {
|
|
12
5
|
const newSelection = [...currentSelection];
|
|
13
6
|
return newSelection.includes(itemId) ? newSelection.splice(newSelection.indexOf(itemId), 1) : newSelection.push(itemId), newSelection;
|
|
14
7
|
});
|
|
15
8
|
}, handleOnSelectAllItems = (deselect) => {
|
|
16
9
|
setSelectedItems(() => deselect ? [] : (data == null ? void 0 : data.map((item) => item._id)) ?? []);
|
|
17
|
-
}, allItemsSelected = (selectedItems == null ? void 0 : selectedItems.length) === (data == null ? void 0 : data.length)
|
|
10
|
+
}, allItemsSelected = (selectedItems == null ? void 0 : selectedItems.length) === (data == null ? void 0 : data.length), isIndeterminate = data ? (selectedItems == null ? void 0 : selectedItems.length) > 0 && (selectedItems == null ? void 0 : selectedItems.length) < (data == null ? void 0 : data.length) : !1;
|
|
18
11
|
return {
|
|
19
12
|
selectedItems,
|
|
20
13
|
allItemsSelected,
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import { useState, useEffect } from "react";
|
|
2
2
|
import { odeServices } from "@edifice.io/client";
|
|
3
|
-
import { useQuery } from "@tanstack/react-query";
|
|
4
3
|
import useHasWorkflow from "../useHasWorkflow/useHasWorkflow.js";
|
|
5
4
|
const useConversation = () => {
|
|
6
|
-
const zimbraWorkflow = useHasWorkflow("fr.openent.zimbra.controllers.ZimbraController|view"), zimbraPreauth = useHasWorkflow("fr.openent.zimbra.controllers.ZimbraController|preauth"), [msgLink, setMsgLink] = useState(""), queryParams = {
|
|
5
|
+
const zimbraWorkflow = useHasWorkflow("fr.openent.zimbra.controllers.ZimbraController|view"), zimbraPreauth = useHasWorkflow("fr.openent.zimbra.controllers.ZimbraController|preauth"), [messages, setMessages] = useState(0), [msgLink, setMsgLink] = useState(""), queryParams = {
|
|
7
6
|
unread: !0,
|
|
8
7
|
_: (/* @__PURE__ */ new Date()).getTime()
|
|
9
|
-
}, {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
8
|
+
}, refreshMails = async () => {
|
|
9
|
+
const url = zimbraWorkflow ? "/zimbra/count/INBOX" : "/conversation/count/INBOX";
|
|
10
|
+
try {
|
|
11
|
+
const {
|
|
12
|
+
count
|
|
13
|
+
} = await odeServices.http().get(url, {
|
|
14
|
+
queryParams
|
|
15
|
+
});
|
|
16
|
+
setMessages(count ?? 0);
|
|
17
|
+
} catch (error) {
|
|
18
|
+
console.error(error), setMessages(0);
|
|
19
|
+
}
|
|
20
|
+
}, goToMessagerie = async () => {
|
|
19
21
|
const defaultLink = "/zimbra/zimbra";
|
|
20
22
|
try {
|
|
21
23
|
const {
|
|
@@ -27,9 +29,11 @@ const useConversation = () => {
|
|
|
27
29
|
}
|
|
28
30
|
};
|
|
29
31
|
return useEffect(() => {
|
|
32
|
+
refreshMails();
|
|
33
|
+
}, []), useEffect(() => {
|
|
30
34
|
goToMessagerie();
|
|
31
35
|
}, []), {
|
|
32
|
-
messages
|
|
36
|
+
messages,
|
|
33
37
|
msgLink,
|
|
34
38
|
zimbraWorkflow
|
|
35
39
|
};
|
|
@@ -11,5 +11,4 @@ export type CoreDate = IsoDate | MongoDate | NumberDate;
|
|
|
11
11
|
export default function useDate(): {
|
|
12
12
|
fromNow: (date: CoreDate | NumberDate) => string;
|
|
13
13
|
formatDate: (date: CoreDate, format?: string) => string;
|
|
14
|
-
formatTimeAgo: (date: CoreDate | NumberDate) => string;
|
|
15
14
|
};
|
|
@@ -9,16 +9,13 @@ import "dayjs/locale/fr.js";
|
|
|
9
9
|
import "dayjs/locale/it.js";
|
|
10
10
|
import "dayjs/locale/pt.js";
|
|
11
11
|
import { useEdificeClient } from "../../providers/EdificeClientProvider/EdificeClientProvider.hook.js";
|
|
12
|
-
import { useTranslation } from "react-i18next";
|
|
13
12
|
dayjs.extend(relativeTime);
|
|
14
13
|
dayjs.extend(customParseFormat);
|
|
15
14
|
dayjs.extend(localizedFormat);
|
|
16
15
|
function useDate() {
|
|
17
16
|
const {
|
|
18
17
|
currentLanguage
|
|
19
|
-
} = useEdificeClient(), {
|
|
20
|
-
t
|
|
21
|
-
} = useTranslation(), parseDate = useCallback((date, lang) => {
|
|
18
|
+
} = useEdificeClient(), parseDate = useCallback((date, lang) => {
|
|
22
19
|
if (date.length < 11) return dayjs(date, ["YYYY-MM-DD"], lang);
|
|
23
20
|
if (date.split("").findIndex((char) => "0" > char || char > "9") < 0)
|
|
24
21
|
return dayjs(Number.parseInt(date)).locale(currentLanguage);
|
|
@@ -26,44 +23,41 @@ function useDate() {
|
|
|
26
23
|
let day = dayjs(date).locale(currentLanguage);
|
|
27
24
|
return day.isValid() || (day = dayjs(date, ["YYYY-MM-DD HH:mm:ss.SSS"]).locale(currentLanguage)), day;
|
|
28
25
|
}
|
|
29
|
-
}, [currentLanguage]),
|
|
26
|
+
}, [currentLanguage]), fromNow = useCallback((date) => {
|
|
30
27
|
let computedDate = dayjs();
|
|
31
28
|
try {
|
|
32
|
-
return typeof date > "u" ?
|
|
29
|
+
return typeof date > "u" ? "" : (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.isValid() ? computedDate.fromNow() : "");
|
|
33
30
|
} catch (error) {
|
|
34
|
-
console.error(error);
|
|
31
|
+
return console.error(error), "";
|
|
35
32
|
}
|
|
36
|
-
return computedDate;
|
|
37
|
-
}, [currentLanguage, parseDate]), formatTimeAgo = useCallback((date) => {
|
|
38
|
-
const computedDate = toComputedDate(date);
|
|
39
|
-
if (!(computedDate != null && computedDate.isValid())) return "";
|
|
40
|
-
const now = dayjs();
|
|
41
|
-
return computedDate.isSame(now, "date") ? now.diff(computedDate, "hours") <= 3 ? computedDate.fromNow() : computedDate.format(t("date.format.currentDay")) : computedDate.isSame(now.subtract(1, "day"), "date") ? t("date.format.yesterday") : now.diff(computedDate, "days") <= 7 ? computedDate.format(t("date.format.currentWeek")) : computedDate.isSame(now, "year") ? computedDate.format(t("date.format.currentYear")) : computedDate.format(t("date.format.previousYear"));
|
|
42
|
-
}, [currentLanguage, parseDate]), fromNow = useCallback((date) => {
|
|
43
|
-
const computedDate = toComputedDate(date);
|
|
44
|
-
return computedDate != null && computedDate.isValid() ? computedDate.fromNow() : "";
|
|
45
33
|
}, [currentLanguage, parseDate]), formatDate = useCallback((date, format = "short") => {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
34
|
+
let computedDate = dayjs();
|
|
35
|
+
try {
|
|
36
|
+
if (typeof date > "u")
|
|
37
|
+
return "";
|
|
38
|
+
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));
|
|
39
|
+
let dayjsFormat = "";
|
|
40
|
+
switch (format) {
|
|
41
|
+
case "short":
|
|
42
|
+
dayjsFormat = "L";
|
|
43
|
+
break;
|
|
44
|
+
case "long":
|
|
45
|
+
dayjsFormat = "LL";
|
|
46
|
+
break;
|
|
47
|
+
case "abbr":
|
|
48
|
+
dayjsFormat = "ll";
|
|
49
|
+
break;
|
|
50
|
+
default:
|
|
51
|
+
dayjsFormat = format;
|
|
52
|
+
}
|
|
53
|
+
return computedDate.isValid() ? computedDate.locale(currentLanguage).format(dayjsFormat) : "";
|
|
54
|
+
} catch (error) {
|
|
55
|
+
return console.error(error), "";
|
|
60
56
|
}
|
|
61
|
-
return computedDate != null && computedDate.isValid() ? computedDate.locale(currentLanguage).format(dayjsFormat) : "";
|
|
62
57
|
}, [currentLanguage, parseDate]);
|
|
63
58
|
return {
|
|
64
59
|
fromNow,
|
|
65
|
-
formatDate
|
|
66
|
-
formatTimeAgo
|
|
60
|
+
formatDate
|
|
67
61
|
};
|
|
68
62
|
}
|
|
69
63
|
export {
|
|
@@ -27,7 +27,6 @@ export interface UseDropdownProps {
|
|
|
27
27
|
menuProps: Record<string, any>;
|
|
28
28
|
itemProps: Record<string, any>;
|
|
29
29
|
setVisible: Dispatch<SetStateAction<boolean>>;
|
|
30
|
-
openOnSpace?: boolean;
|
|
31
30
|
}
|
|
32
|
-
declare const useDropdown: (placement: Placement | undefined, extraTriggerKeyDownHandler?: (event: React.KeyboardEvent<HTMLButtonElement>) => void, isTriggerHovered?: boolean
|
|
31
|
+
declare const useDropdown: (placement: Placement | undefined, extraTriggerKeyDownHandler?: (event: React.KeyboardEvent<HTMLButtonElement>) => void, isTriggerHovered?: boolean) => UseDropdownProps;
|
|
33
32
|
export default useDropdown;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useId, useState, useRef, useEffect, useCallback } from "react";
|
|
2
2
|
import { useFloating, offset, size, flip, autoUpdate, useHover, safePolygon } from "@floating-ui/react";
|
|
3
3
|
import { mergeRefs } from "../../utilities/refs/ref.js";
|
|
4
|
-
const useDropdown = (placement, extraTriggerKeyDownHandler, isTriggerHovered = !1
|
|
4
|
+
const useDropdown = (placement, extraTriggerKeyDownHandler, isTriggerHovered = !1) => {
|
|
5
5
|
const id = useId(), [visible, setVisible] = useState(!1), [activeIndex, setActiveIndex] = useState(-1), [isFocused, setIsFocused] = useState(null), {
|
|
6
6
|
refs,
|
|
7
7
|
floatingStyles,
|
|
@@ -11,7 +11,7 @@ const useDropdown = (placement, extraTriggerKeyDownHandler, isTriggerHovered = !
|
|
|
11
11
|
open: visible,
|
|
12
12
|
onOpenChange: setVisible,
|
|
13
13
|
whileElementsMounted: autoUpdate,
|
|
14
|
-
middleware: [offset(
|
|
14
|
+
middleware: [offset(4), size({
|
|
15
15
|
apply({
|
|
16
16
|
rects,
|
|
17
17
|
elements
|
|
@@ -32,7 +32,7 @@ const useDropdown = (placement, extraTriggerKeyDownHandler, isTriggerHovered = !
|
|
|
32
32
|
});
|
|
33
33
|
const menuRef = useRef(null), triggerRef = useRef(null), itemRefs = useRef({});
|
|
34
34
|
useEffect(() => {
|
|
35
|
-
visible
|
|
35
|
+
visible ? menuRef.current && (menuRef.current.focus(), setActiveIndex(0)) : (setActiveIndex(-1), itemRefs.current = {});
|
|
36
36
|
}, [visible]), useEffect(() => {
|
|
37
37
|
if (activeIndex !== -1) {
|
|
38
38
|
const currentItem = Object.values(itemRefs.current)[activeIndex];
|
|
@@ -66,8 +66,6 @@ const useDropdown = (placement, extraTriggerKeyDownHandler, isTriggerHovered = !
|
|
|
66
66
|
switch (event.code) {
|
|
67
67
|
case " ":
|
|
68
68
|
case "Space":
|
|
69
|
-
if (!openOnSpace)
|
|
70
|
-
break;
|
|
71
69
|
case "Enter":
|
|
72
70
|
case "ArrowDown":
|
|
73
71
|
case "Down":
|
|
@@ -24,7 +24,7 @@ const useDropzone = (props) => {
|
|
|
24
24
|
}
|
|
25
25
|
return filteredFiles;
|
|
26
26
|
}, addFiles = (files2) => {
|
|
27
|
-
let filesToAdd = files2.map((file) => (
|
|
27
|
+
let filesToAdd = files2.sort((a, b) => b.lastModified - a.lastModified).map((file) => (
|
|
28
28
|
// #WB-3377: Remove special characters from the file name. (it can cause issues with vertx which replace it or remove it)
|
|
29
29
|
new File([file], file.name.replace(/[!:,;="']/g, ""), {
|
|
30
30
|
type: file.type
|
|
@@ -8,19 +8,10 @@ const useHttpErrorToast = (options) => {
|
|
|
8
8
|
} = useTranslation();
|
|
9
9
|
return useEffect(() => {
|
|
10
10
|
const subscription = odeServices.notify().events().subscribe(LAYER_NAME.TRANSPORT, (event) => {
|
|
11
|
-
var _a;
|
|
12
|
-
|
|
13
|
-
const {
|
|
14
|
-
response
|
|
15
|
-
} = event.data, i18nKey = (
|
|
16
|
-
// The payload may include the i18n key of the error message to show,
|
|
17
|
-
((_a = event.data.payload) == null ? void 0 : _a.error) || // otherwise, try showing the translation of some known HTTP error code.
|
|
18
|
-
([400, 401, 403, 404, 408, 413, 500, 504].includes(response == null ? void 0 : response.status) ? `e${event.data.response.status}` : void 0) || // otherwise try showing the statusText (may be technical, in english),
|
|
19
|
-
(response == null ? void 0 : response.statusText)
|
|
20
|
-
);
|
|
21
|
-
typeof i18nKey == "string" && (message.current = t(i18nKey), toast.error(/* @__PURE__ */ React.createElement("div", {
|
|
11
|
+
var _a, _b;
|
|
12
|
+
message.current = t(((_b = (_a = event == null ? void 0 : event.data) == null ? void 0 : _a.payload) == null ? void 0 : _b.error) || event.data.response.statusText), toast.error(/* @__PURE__ */ React.createElement("div", {
|
|
22
13
|
children: [message.current]
|
|
23
|
-
}), options)
|
|
14
|
+
}), options);
|
|
24
15
|
});
|
|
25
16
|
return () => subscription.revoke();
|
|
26
17
|
}, [t, toast]), message.current;
|