@tecsinapse/cortex-react 1.12.1 → 1.12.3
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/cjs/components/Accordion/Content.js +28 -11
- package/dist/cjs/components/Carousel/Carousel.js +4 -8
- package/dist/cjs/components/Carousel/CarouselItem.js +1 -3
- package/dist/esm/components/Accordion/Content.js +28 -11
- package/dist/esm/components/Carousel/Carousel.js +4 -8
- package/dist/esm/components/Carousel/CarouselItem.js +1 -3
- package/package.json +2 -2
|
@@ -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",
|
|
@@ -20,10 +20,8 @@ const Carousel = ({ images }) => {
|
|
|
20
20
|
{
|
|
21
21
|
type: "button",
|
|
22
22
|
"data-testid": "button-carousel-prev",
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
className: "z-absolute absolute left-deca top-[50%] transform -translate-y-[50%] p-centi hidden lg:flex"
|
|
26
|
-
},
|
|
23
|
+
className: "z-absolute absolute left-deca top-[50%] transform -translate-y-[50%] p-centi hidden lg:flex",
|
|
24
|
+
size: "square",
|
|
27
25
|
onClick: slideToPrevItem
|
|
28
26
|
},
|
|
29
27
|
/* @__PURE__ */ React.createElement(io.IoIosArrowBack, null)
|
|
@@ -32,10 +30,8 @@ const Carousel = ({ images }) => {
|
|
|
32
30
|
{
|
|
33
31
|
type: "button",
|
|
34
32
|
"data-testid": "button-carousel-next",
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
className: "z-absolute absolute right-deca top-[50%] transform -translate-y-[50%] p-centi hidden lg:flex"
|
|
38
|
-
},
|
|
33
|
+
size: "square",
|
|
34
|
+
className: "z-absolute absolute right-deca top-[50%] transform -translate-y-[50%] p-centi hidden lg:flex",
|
|
39
35
|
onClick: slideToNextItem
|
|
40
36
|
},
|
|
41
37
|
/* @__PURE__ */ React.createElement(io.IoIosArrowForward, null)
|
|
@@ -53,9 +53,7 @@ const CarouselItem = ({ item }) => {
|
|
|
53
53
|
{
|
|
54
54
|
type: "button",
|
|
55
55
|
"data-testid": "button-link-carousel",
|
|
56
|
-
|
|
57
|
-
className: "z-absolute absolute bottom-deca left-[10%]"
|
|
58
|
-
}
|
|
56
|
+
className: "z-absolute absolute bottom-deca left-[10%]"
|
|
59
57
|
},
|
|
60
58
|
item.button.title
|
|
61
59
|
)
|
|
@@ -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",
|
|
@@ -18,10 +18,8 @@ const Carousel = ({ images }) => {
|
|
|
18
18
|
{
|
|
19
19
|
type: "button",
|
|
20
20
|
"data-testid": "button-carousel-prev",
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
className: "z-absolute absolute left-deca top-[50%] transform -translate-y-[50%] p-centi hidden lg:flex"
|
|
24
|
-
},
|
|
21
|
+
className: "z-absolute absolute left-deca top-[50%] transform -translate-y-[50%] p-centi hidden lg:flex",
|
|
22
|
+
size: "square",
|
|
25
23
|
onClick: slideToPrevItem
|
|
26
24
|
},
|
|
27
25
|
/* @__PURE__ */ React__default.createElement(IoIosArrowBack, null)
|
|
@@ -30,10 +28,8 @@ const Carousel = ({ images }) => {
|
|
|
30
28
|
{
|
|
31
29
|
type: "button",
|
|
32
30
|
"data-testid": "button-carousel-next",
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
className: "z-absolute absolute right-deca top-[50%] transform -translate-y-[50%] p-centi hidden lg:flex"
|
|
36
|
-
},
|
|
31
|
+
size: "square",
|
|
32
|
+
className: "z-absolute absolute right-deca top-[50%] transform -translate-y-[50%] p-centi hidden lg:flex",
|
|
37
33
|
onClick: slideToNextItem
|
|
38
34
|
},
|
|
39
35
|
/* @__PURE__ */ React__default.createElement(IoIosArrowForward, null)
|
|
@@ -51,9 +51,7 @@ const CarouselItem = ({ item }) => {
|
|
|
51
51
|
{
|
|
52
52
|
type: "button",
|
|
53
53
|
"data-testid": "button-link-carousel",
|
|
54
|
-
|
|
55
|
-
className: "z-absolute absolute bottom-deca left-[10%]"
|
|
56
|
-
}
|
|
54
|
+
className: "z-absolute absolute bottom-deca left-[10%]"
|
|
57
55
|
},
|
|
58
56
|
item.button.title
|
|
59
57
|
)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tecsinapse/cortex-react",
|
|
3
|
-
"version": "1.12.
|
|
3
|
+
"version": "1.12.3",
|
|
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": "645721229663f033e51773fd612a0fce2a3686c3"
|
|
51
51
|
}
|