@tecsinapse/cortex-react 1.13.8 → 1.14.0-beta.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.
|
@@ -1,28 +1,38 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
3
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var React = require('react');
|
|
4
7
|
var Button = require('../Button.js');
|
|
5
|
-
var reactSpringCarousel = require('react-spring-carousel');
|
|
6
8
|
var io = require('react-icons/io');
|
|
7
9
|
var CarouselItem = require('./CarouselItem.js');
|
|
10
|
+
var useEmblaCarousel = require('embla-carousel-react');
|
|
8
11
|
|
|
9
12
|
const Carousel = ({ images }) => {
|
|
13
|
+
const [emblaRef, emblaApi] = useEmblaCarousel({ loop: true });
|
|
10
14
|
const itemsCarousel = images.map((imageProp, i) => ({
|
|
11
15
|
id: `${imageProp.alt}-${i}`,
|
|
12
16
|
renderItem: /* @__PURE__ */ jsxRuntime.jsx(CarouselItem.CarouselItem, { item: imageProp })
|
|
13
17
|
}));
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
const slideToPrevItem = React.useCallback(() => {
|
|
19
|
+
if (emblaApi) emblaApi.scrollPrev();
|
|
20
|
+
}, [emblaApi]);
|
|
21
|
+
const slideToNextItem = React.useCallback(() => {
|
|
22
|
+
if (emblaApi) emblaApi.scrollNext();
|
|
23
|
+
}, [emblaApi]);
|
|
24
|
+
React.useEffect(() => {
|
|
25
|
+
emblaApi?.reInit();
|
|
26
|
+
}, [emblaApi, images.length]);
|
|
27
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "overflow-hidden w-fit relative", ref: emblaRef, children: [
|
|
28
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex", children: images.map((image, i) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-w-full flex-shrink-0 relative", children: /* @__PURE__ */ jsxRuntime.jsx(CarouselItem.CarouselItem, { item: image }) }, `${image.alt}-${i}`)) }),
|
|
29
|
+
itemsCarousel.length > 1 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
20
30
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
21
31
|
Button.Button,
|
|
22
32
|
{
|
|
23
33
|
type: "button",
|
|
24
34
|
"data-testid": "button-carousel-prev",
|
|
25
|
-
className: "z-
|
|
35
|
+
className: "z-select absolute left-deca top-[50%] transform -translate-y-[50%] p-centi flex",
|
|
26
36
|
size: "square",
|
|
27
37
|
onClick: slideToPrevItem,
|
|
28
38
|
children: /* @__PURE__ */ jsxRuntime.jsx(io.IoIosArrowBack, {})
|
|
@@ -34,14 +44,14 @@ const Carousel = ({ images }) => {
|
|
|
34
44
|
type: "button",
|
|
35
45
|
"data-testid": "button-carousel-next",
|
|
36
46
|
size: "square",
|
|
37
|
-
className: "z-
|
|
47
|
+
className: "z-select absolute right-deca top-[50%] transform -translate-y-[50%] p-centi flex",
|
|
38
48
|
onClick: slideToNextItem,
|
|
39
49
|
children: /* @__PURE__ */ jsxRuntime.jsx(io.IoIosArrowForward, {})
|
|
40
50
|
}
|
|
41
51
|
)
|
|
42
|
-
] })
|
|
43
|
-
carouselFragment
|
|
52
|
+
] })
|
|
44
53
|
] });
|
|
45
54
|
};
|
|
46
55
|
|
|
47
56
|
exports.Carousel = Carousel;
|
|
57
|
+
exports.default = Carousel;
|
|
@@ -5,8 +5,8 @@ var clsx = require('clsx');
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
|
|
7
7
|
const Box = React.forwardRef((props, ref) => {
|
|
8
|
-
const { id, ...rest } = props;
|
|
9
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-tera h-kilo overflow-hidden relative", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8
|
+
const { id, className, ...rest } = props;
|
|
9
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: clsx("w-tera h-kilo border overflow-hidden relative", className), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10
10
|
"input",
|
|
11
11
|
{
|
|
12
12
|
...rest,
|
|
@@ -1,26 +1,34 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { useCallback, useEffect } from 'react';
|
|
2
3
|
import { Button } from '../Button.js';
|
|
3
|
-
import { useSpringCarousel } from 'react-spring-carousel';
|
|
4
4
|
import { IoIosArrowBack, IoIosArrowForward } from 'react-icons/io';
|
|
5
5
|
import { CarouselItem } from './CarouselItem.js';
|
|
6
|
+
import useEmblaCarousel from 'embla-carousel-react';
|
|
6
7
|
|
|
7
8
|
const Carousel = ({ images }) => {
|
|
9
|
+
const [emblaRef, emblaApi] = useEmblaCarousel({ loop: true });
|
|
8
10
|
const itemsCarousel = images.map((imageProp, i) => ({
|
|
9
11
|
id: `${imageProp.alt}-${i}`,
|
|
10
12
|
renderItem: /* @__PURE__ */ jsx(CarouselItem, { item: imageProp })
|
|
11
13
|
}));
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
const slideToPrevItem = useCallback(() => {
|
|
15
|
+
if (emblaApi) emblaApi.scrollPrev();
|
|
16
|
+
}, [emblaApi]);
|
|
17
|
+
const slideToNextItem = useCallback(() => {
|
|
18
|
+
if (emblaApi) emblaApi.scrollNext();
|
|
19
|
+
}, [emblaApi]);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
emblaApi?.reInit();
|
|
22
|
+
}, [emblaApi, images.length]);
|
|
23
|
+
return /* @__PURE__ */ jsxs("div", { className: "overflow-hidden w-fit relative", ref: emblaRef, children: [
|
|
24
|
+
/* @__PURE__ */ jsx("div", { className: "flex", children: images.map((image, i) => /* @__PURE__ */ jsx("div", { className: "min-w-full flex-shrink-0 relative", children: /* @__PURE__ */ jsx(CarouselItem, { item: image }) }, `${image.alt}-${i}`)) }),
|
|
25
|
+
itemsCarousel.length > 1 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
18
26
|
/* @__PURE__ */ jsx(
|
|
19
27
|
Button,
|
|
20
28
|
{
|
|
21
29
|
type: "button",
|
|
22
30
|
"data-testid": "button-carousel-prev",
|
|
23
|
-
className: "z-
|
|
31
|
+
className: "z-select absolute left-deca top-[50%] transform -translate-y-[50%] p-centi flex",
|
|
24
32
|
size: "square",
|
|
25
33
|
onClick: slideToPrevItem,
|
|
26
34
|
children: /* @__PURE__ */ jsx(IoIosArrowBack, {})
|
|
@@ -32,14 +40,13 @@ const Carousel = ({ images }) => {
|
|
|
32
40
|
type: "button",
|
|
33
41
|
"data-testid": "button-carousel-next",
|
|
34
42
|
size: "square",
|
|
35
|
-
className: "z-
|
|
43
|
+
className: "z-select absolute right-deca top-[50%] transform -translate-y-[50%] p-centi flex",
|
|
36
44
|
onClick: slideToNextItem,
|
|
37
45
|
children: /* @__PURE__ */ jsx(IoIosArrowForward, {})
|
|
38
46
|
}
|
|
39
47
|
)
|
|
40
|
-
] })
|
|
41
|
-
carouselFragment
|
|
48
|
+
] })
|
|
42
49
|
] });
|
|
43
50
|
};
|
|
44
51
|
|
|
45
|
-
export { Carousel };
|
|
52
|
+
export { Carousel, Carousel as default };
|
|
@@ -3,8 +3,8 @@ import clsx from 'clsx';
|
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
4
|
|
|
5
5
|
const Box = forwardRef((props, ref) => {
|
|
6
|
-
const { id, ...rest } = props;
|
|
7
|
-
return /* @__PURE__ */ jsx("div", { className: "w-tera h-kilo overflow-hidden relative", children: /* @__PURE__ */ jsx(
|
|
6
|
+
const { id, className, ...rest } = props;
|
|
7
|
+
return /* @__PURE__ */ jsx("div", { className: clsx("w-tera h-kilo border overflow-hidden relative", className), children: /* @__PURE__ */ jsx(
|
|
8
8
|
"input",
|
|
9
9
|
{
|
|
10
10
|
...rest,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tecsinapse/cortex-react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.0-beta.0",
|
|
4
4
|
"description": "React components based in @tecsinapse/cortex-core",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
"@tecsinapse/cortex-core": "1.1.3",
|
|
24
24
|
"clsx": "2.1.1",
|
|
25
25
|
"currency.js": "2.0.4",
|
|
26
|
+
"embla-carousel-react": "^8.6.0",
|
|
26
27
|
"react-aria": "3.38.1",
|
|
27
28
|
"react-dropzone": "14.3.8",
|
|
28
29
|
"react-imask": "7.6.1",
|
|
29
30
|
"react-spring": "9.7.5",
|
|
30
|
-
"react-spring-carousel": "2.0.19",
|
|
31
31
|
"react-stately": "3.36.1",
|
|
32
32
|
"sonner": "1.7.3",
|
|
33
33
|
"uuid": "11.1.0"
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"react-icons": ">=5.2.0",
|
|
48
48
|
"tailwind": ">=3.3.0"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "c6c3c82ea4d5328849d1d80853defbbdd3c41601"
|
|
51
51
|
}
|