@tecsinapse/cortex-react 1.12.0 → 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
- if (direction === "horizontal") {
17
- const widthSize = Array.from(
18
- container.current?.children || []
19
- ).reduce((prev, curr) => prev + curr.clientWidth, 0);
20
- setWidth(`${widthSize}px`);
21
- } else {
22
- const heightSize = Array.from(
23
- container.current?.children || []
24
- ).reduce((prev, curr) => prev + curr.clientHeight, 0);
25
- setHeight(`${heightSize}px`);
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",
@@ -1,7 +1,6 @@
1
1
  'use strict';
2
2
 
3
3
  var React = require('react');
4
- var clsx = require('clsx');
5
4
  var Button = require('../Button.js');
6
5
 
7
6
  const CarouselItem = ({ item }) => {
@@ -25,14 +24,21 @@ const CarouselItem = ({ item }) => {
25
24
  {
26
25
  className: "z-absolute absolute top-[50%] transform -translate-y-[50%] left-[10%] mx-deca max-w-[60%]"
27
26
  },
28
- /* @__PURE__ */ React.createElement("p", { className: clsx("text-h2 font-bold"), style: stylesTitle }, item.title.text),
29
27
  /* @__PURE__ */ React.createElement(
30
28
  "p",
31
29
  {
32
- className: "text-white text-h2 font-bold hidden lg:flex",
33
- style: stylesSubTitle
34
- },
35
- item.subtitle.text
30
+ className: "text-h2 font-bold",
31
+ style: stylesTitle,
32
+ dangerouslySetInnerHTML: { __html: item.title.text }
33
+ }
34
+ ),
35
+ /* @__PURE__ */ React.createElement(
36
+ "p",
37
+ {
38
+ className: "text-white text-h2 font-bold hidden lg:block",
39
+ style: stylesSubTitle,
40
+ dangerouslySetInnerHTML: { __html: item.subtitle.text }
41
+ }
36
42
  )
37
43
  ), item.button ? /* @__PURE__ */ React.createElement(
38
44
  "a",
@@ -11,17 +11,34 @@ const AccordionContent = ({
11
11
  const [height, setHeight] = useState(void 0);
12
12
  const { open } = useAccordionContext();
13
13
  useLayoutEffect(() => {
14
- if (direction === "horizontal") {
15
- const widthSize = Array.from(
16
- container.current?.children || []
17
- ).reduce((prev, curr) => prev + curr.clientWidth, 0);
18
- setWidth(`${widthSize}px`);
19
- } else {
20
- const heightSize = Array.from(
21
- container.current?.children || []
22
- ).reduce((prev, curr) => prev + curr.clientHeight, 0);
23
- setHeight(`${heightSize}px`);
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",
@@ -1,5 +1,4 @@
1
1
  import React__default from 'react';
2
- import clsx from 'clsx';
3
2
  import { Button } from '../Button.js';
4
3
 
5
4
  const CarouselItem = ({ item }) => {
@@ -23,14 +22,21 @@ const CarouselItem = ({ item }) => {
23
22
  {
24
23
  className: "z-absolute absolute top-[50%] transform -translate-y-[50%] left-[10%] mx-deca max-w-[60%]"
25
24
  },
26
- /* @__PURE__ */ React__default.createElement("p", { className: clsx("text-h2 font-bold"), style: stylesTitle }, item.title.text),
27
25
  /* @__PURE__ */ React__default.createElement(
28
26
  "p",
29
27
  {
30
- className: "text-white text-h2 font-bold hidden lg:flex",
31
- style: stylesSubTitle
32
- },
33
- item.subtitle.text
28
+ className: "text-h2 font-bold",
29
+ style: stylesTitle,
30
+ dangerouslySetInnerHTML: { __html: item.title.text }
31
+ }
32
+ ),
33
+ /* @__PURE__ */ React__default.createElement(
34
+ "p",
35
+ {
36
+ className: "text-white text-h2 font-bold hidden lg:block",
37
+ style: stylesSubTitle,
38
+ dangerouslySetInnerHTML: { __html: item.subtitle.text }
39
+ }
34
40
  )
35
41
  ), item.button ? /* @__PURE__ */ React__default.createElement(
36
42
  "a",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tecsinapse/cortex-react",
3
- "version": "1.12.0",
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": "05b09b49a5f172cb6057c2686cdfae80bafc0731"
50
+ "gitHead": "509f8fed5849a7a5e3cf6bfa23eba2ef63b45c27"
51
51
  }