@tecsinapse/cortex-react 1.12.1 → 1.12.2
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.
|
@@ -13,17 +13,34 @@ const AccordionContent = ({
|
|
|
13
13
|
const [height, setHeight] = React.useState(void 0);
|
|
14
14
|
const { open } = context.useAccordionContext();
|
|
15
15
|
React.useLayoutEffect(() => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
16
|
+
const getChildrenDimensions = () => {
|
|
17
|
+
if (!container.current) return;
|
|
18
|
+
const childrenArray2 = Array.from(
|
|
19
|
+
container.current.children || []
|
|
20
|
+
);
|
|
21
|
+
if (direction === "horizontal") {
|
|
22
|
+
const widthSize = childrenArray2.reduce(
|
|
23
|
+
(prev, curr) => prev + curr.clientWidth,
|
|
24
|
+
0
|
|
25
|
+
);
|
|
26
|
+
setWidth(`${widthSize}px`);
|
|
27
|
+
} else {
|
|
28
|
+
const heightSize = childrenArray2.reduce(
|
|
29
|
+
(prev, curr) => prev + curr.clientHeight,
|
|
30
|
+
0
|
|
31
|
+
);
|
|
32
|
+
setHeight(`${heightSize}px`);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
getChildrenDimensions();
|
|
36
|
+
const observer = new ResizeObserver(() => {
|
|
37
|
+
getChildrenDimensions();
|
|
38
|
+
});
|
|
39
|
+
const childrenArray = Array.from(container.current?.children || []);
|
|
40
|
+
childrenArray.forEach((el) => observer.observe(el));
|
|
41
|
+
return () => {
|
|
42
|
+
observer.disconnect();
|
|
43
|
+
};
|
|
27
44
|
}, [direction]);
|
|
28
45
|
return /* @__PURE__ */ React.createElement(
|
|
29
46
|
"div",
|
|
@@ -11,17 +11,34 @@ const AccordionContent = ({
|
|
|
11
11
|
const [height, setHeight] = useState(void 0);
|
|
12
12
|
const { open } = useAccordionContext();
|
|
13
13
|
useLayoutEffect(() => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
14
|
+
const getChildrenDimensions = () => {
|
|
15
|
+
if (!container.current) return;
|
|
16
|
+
const childrenArray2 = Array.from(
|
|
17
|
+
container.current.children || []
|
|
18
|
+
);
|
|
19
|
+
if (direction === "horizontal") {
|
|
20
|
+
const widthSize = childrenArray2.reduce(
|
|
21
|
+
(prev, curr) => prev + curr.clientWidth,
|
|
22
|
+
0
|
|
23
|
+
);
|
|
24
|
+
setWidth(`${widthSize}px`);
|
|
25
|
+
} else {
|
|
26
|
+
const heightSize = childrenArray2.reduce(
|
|
27
|
+
(prev, curr) => prev + curr.clientHeight,
|
|
28
|
+
0
|
|
29
|
+
);
|
|
30
|
+
setHeight(`${heightSize}px`);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
getChildrenDimensions();
|
|
34
|
+
const observer = new ResizeObserver(() => {
|
|
35
|
+
getChildrenDimensions();
|
|
36
|
+
});
|
|
37
|
+
const childrenArray = Array.from(container.current?.children || []);
|
|
38
|
+
childrenArray.forEach((el) => observer.observe(el));
|
|
39
|
+
return () => {
|
|
40
|
+
observer.disconnect();
|
|
41
|
+
};
|
|
25
42
|
}, [direction]);
|
|
26
43
|
return /* @__PURE__ */ React__default.createElement(
|
|
27
44
|
"div",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tecsinapse/cortex-react",
|
|
3
|
-
"version": "1.12.
|
|
3
|
+
"version": "1.12.2",
|
|
4
4
|
"description": "React components based in @tecsinapse/cortex-core",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"react-icons": ">=5.2.0",
|
|
48
48
|
"tailwind": ">=3.3.0"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "509f8fed5849a7a5e3cf6bfa23eba2ef63b45c27"
|
|
51
51
|
}
|