@edifice.io/react 2.0.0-develop-pedago.7 → 2.0.0
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.
|
@@ -32,7 +32,7 @@ const AppIcon = /* @__PURE__ */ forwardRef(({
|
|
|
32
32
|
...iconSizes,
|
|
33
33
|
...iconVariant,
|
|
34
34
|
...iconFits,
|
|
35
|
-
[`bg-light-${appCode}`]:
|
|
35
|
+
[`bg-light-${appCode}`]: !isContain,
|
|
36
36
|
[`color-app-${appCode}`]: appCode
|
|
37
37
|
}, className), IconComponent = iconsApps[`Icon${appCode.split("-").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("")}`] ?? SvgIconPlaceholder;
|
|
38
38
|
if (isIconURL) {
|
|
@@ -11,7 +11,6 @@ import SvgIconRafterRight from "../../../modules/icons/components/IconRafterRigh
|
|
|
11
11
|
import { useTree } from "../hooks/useTree.js";
|
|
12
12
|
import { useTreeSortable } from "../hooks/useTreeSortable.js";
|
|
13
13
|
import { flattenNodes } from "../utilities/tree-sortable.js";
|
|
14
|
-
import { mergeRefs } from "../../../utilities/refs/ref.js";
|
|
15
14
|
const SortableTree = ({
|
|
16
15
|
nodes,
|
|
17
16
|
selectedNodeId: externalSelectedNodeId,
|
|
@@ -74,7 +73,7 @@ const SortableTree = ({
|
|
|
74
73
|
renderNode,
|
|
75
74
|
onTreeItemClick,
|
|
76
75
|
onToggleNode
|
|
77
|
-
}
|
|
76
|
+
}) => {
|
|
78
77
|
const {
|
|
79
78
|
t
|
|
80
79
|
} = useTranslation(), selected = selectedNodeId === node.id, expanded = expandedNodes.has(node.id), animateLayoutChanges = ({
|
|
@@ -94,7 +93,7 @@ const SortableTree = ({
|
|
|
94
93
|
transform: CSS.Translate.toString(transform),
|
|
95
94
|
transition
|
|
96
95
|
}, treeItemClasses = {
|
|
97
|
-
action: clsx("action-container d-flex align-items-center gap-8 px-
|
|
96
|
+
action: clsx("action-container d-flex align-items-center gap-8 px-8", {
|
|
98
97
|
"drag-focus": focused,
|
|
99
98
|
"border border-secondary rounded rounded-2 shadow bg-white": isDragging,
|
|
100
99
|
display: expanded ? "block" : "none"
|
|
@@ -109,7 +108,7 @@ const SortableTree = ({
|
|
|
109
108
|
}, handleItemToggleKeyDown = (event) => {
|
|
110
109
|
(event.code === "Enter" || event.code === "Space") && (event.preventDefault(), event.stopPropagation(), onToggleNode == null || onToggleNode(node.id));
|
|
111
110
|
}, spaceGestion = () => isDragging ? isChild ? depth === 1 ? `${indentationWidth * depth}px` : "0px" : `${indentationWidth * depth}px` : isChild ? "20px" : null;
|
|
112
|
-
return /* @__PURE__ */ jsx("li", { ref:
|
|
111
|
+
return /* @__PURE__ */ jsx("li", { ref: setNodeRef, id: `treeitem-${node.id}`, role: "treeitem", "aria-selected": selected, "aria-expanded": expanded, style: {
|
|
113
112
|
...style,
|
|
114
113
|
marginLeft: spaceGestion()
|
|
115
114
|
}, ...listeners, children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", { className: treeItemClasses.action, children: [
|
|
@@ -15,11 +15,7 @@ const useTreeSortable = ({
|
|
|
15
15
|
const activationConstraint = {
|
|
16
16
|
delay: 200,
|
|
17
17
|
tolerance: 5
|
|
18
|
-
}, indicator = !1, indentationWidth = 64, flattenedTree = useMemo(
|
|
19
|
-
() => flattenTree(items, null),
|
|
20
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
21
|
-
[items]
|
|
22
|
-
), activeItem = activeId ? flattenedTree.find(({
|
|
18
|
+
}, indicator = !1, indentationWidth = 64, flattenedTree = useMemo(() => flattenTree(items, null), [items]), activeItem = activeId ? flattenedTree.find(({
|
|
23
19
|
id
|
|
24
20
|
}) => id === activeId) : null, projected = activeId && overId ? getProjection(flattenedTree, activeId, overId, offsetLeft, indentationWidth) : null;
|
|
25
21
|
function handleDragStart(event) {
|
|
@@ -34,13 +34,13 @@ function getIndicesToUpdate(activeNode, activeNodeIndex, flattenedTree, projecte
|
|
|
34
34
|
}
|
|
35
35
|
function flattenTree(tree, parentId, depth = 0) {
|
|
36
36
|
return tree.reduce((acc, node) => (acc.push({
|
|
37
|
+
...node,
|
|
37
38
|
id: node.id,
|
|
38
39
|
name: node.name,
|
|
39
40
|
parentId: parentId ?? null,
|
|
40
41
|
position: node.position ?? void 0,
|
|
41
42
|
depth: depth ?? 0,
|
|
42
|
-
children: node.children
|
|
43
|
-
isVisible: node.isVisible
|
|
43
|
+
children: node.children
|
|
44
44
|
}), node.children && node.children.length > 0 && (acc = acc.concat(flattenTree(node.children, node.id, depth + 1))), acc), []);
|
|
45
45
|
}
|
|
46
46
|
function flattenNodes(nodes, expandedNodes) {
|
|
@@ -48,6 +48,7 @@ function flattenNodes(nodes, expandedNodes) {
|
|
|
48
48
|
var _a;
|
|
49
49
|
const isExpanded = expandedNodes.has(node.id) && node.children && node.children.length > 0;
|
|
50
50
|
return acc.push({
|
|
51
|
+
...node,
|
|
51
52
|
id: node.id,
|
|
52
53
|
name: node.name,
|
|
53
54
|
isChild,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edifice.io/react",
|
|
3
|
-
"version": "2.0.0
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Edifice React Library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -119,9 +119,9 @@
|
|
|
119
119
|
"react-slugify": "^3.0.3",
|
|
120
120
|
"swiper": "^10.1.0",
|
|
121
121
|
"ua-parser-js": "^1.0.36",
|
|
122
|
-
"@edifice.io/bootstrap": "2.0.0
|
|
123
|
-
"@edifice.io/tiptap-extensions": "2.0.0
|
|
124
|
-
"@edifice.io/utilities": "2.0.0
|
|
122
|
+
"@edifice.io/bootstrap": "2.0.0",
|
|
123
|
+
"@edifice.io/tiptap-extensions": "2.0.0",
|
|
124
|
+
"@edifice.io/utilities": "2.0.0"
|
|
125
125
|
},
|
|
126
126
|
"devDependencies": {
|
|
127
127
|
"@babel/plugin-transform-react-pure-annotations": "^7.23.3",
|
|
@@ -147,7 +147,7 @@
|
|
|
147
147
|
"typescript-eslint": "^8.8.1",
|
|
148
148
|
"vite": "^5.4.11",
|
|
149
149
|
"vite-plugin-dts": "^4.1.0",
|
|
150
|
-
"@edifice.io/client": "2.0.0
|
|
150
|
+
"@edifice.io/client": "2.0.0"
|
|
151
151
|
},
|
|
152
152
|
"peerDependencies": {
|
|
153
153
|
"@react-spring/web": "^9.7.5",
|