@consumidor-positivo/aurora 1.3.2 → 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.
- package/README.md +1 -22
- package/astro/Accordion/index.astro +79 -0
- package/astro/Breadcrumb/index.astro +124 -0
- package/astro/Carousel/Item/index.astro +17 -0
- package/astro/Carousel/Root/index.astro +332 -0
- package/astro/Header/NavbarLink/index.astro +2 -1
- package/astro/Pagination/index.astro +296 -0
- package/dist/components/Accordion/index.d.ts +23 -0
- package/dist/components/Accordion/index.es.js +85 -0
- package/dist/components/Accordion/index.es.js.map +1 -0
- package/dist/components/Accordion/styles.css +1 -0
- package/dist/components/Breadcrumb/index.d.ts +10 -0
- package/dist/components/Breadcrumb/index.es.js +112 -0
- package/dist/components/Breadcrumb/index.es.js.map +1 -0
- package/dist/components/Breadcrumb/styles.css +1 -0
- package/dist/components/Carousel/Item/index.d.ts +10 -0
- package/dist/components/Carousel/Item/index.es.js +16 -0
- package/dist/components/Carousel/Item/index.es.js.map +1 -0
- package/dist/components/Carousel/Root/hooks.d.ts +33 -0
- package/dist/components/Carousel/Root/index.d.ts +20 -0
- package/dist/components/Carousel/Root/index.es.js +256 -0
- package/dist/components/Carousel/Root/index.es.js.map +1 -0
- package/dist/components/Carousel/index.d.ts +10 -0
- package/dist/components/Carousel/index.es.js +14 -0
- package/dist/components/Carousel/index.es.js.map +1 -0
- package/dist/components/Carousel/styles.css +1 -1
- package/dist/components/Header/NavbarLink/index.es.js +2 -1
- package/dist/components/Header/NavbarLink/index.es.js.map +1 -1
- package/dist/components/Header/styles.css +1 -1
- package/dist/components/Pagination/index.d.ts +14 -0
- package/dist/components/Pagination/index.es.js +141 -0
- package/dist/components/Pagination/index.es.js.map +1 -0
- package/dist/components/Pagination/styles.css +1 -0
- package/dist/main.d.ts +4 -1
- package/dist/main.es.js +7 -1
- package/dist/main.es.js.map +1 -1
- package/package.json +2 -4
- package/dist/components/Prototype/Carousel/Pagination.d.ts +0 -7
- package/dist/components/Prototype/Carousel/Scrollbar.d.ts +0 -6
- package/dist/components/Prototype/Carousel/helpers.d.ts +0 -1
- package/dist/components/Prototype/Carousel/index.d.ts +0 -2
- package/dist/components/Prototype/Carousel/index.es.js +0 -469
- package/dist/components/Prototype/Carousel/index.es.js.map +0 -1
- package/dist/components/Prototype/Carousel/types.d.ts +0 -7
- package/dist/components/Prototype/Carousel/useCarousel.d.ts +0 -20
- package/dist/components/Prototype/Carousel/useCarouselDrag.d.ts +0 -9
package/dist/main.es.js
CHANGED
|
@@ -41,6 +41,10 @@ import { PartnerBanner } from "./components/PartnerBanner/index.es.js";
|
|
|
41
41
|
import { Transition } from "./components/Transition/index.es.js";
|
|
42
42
|
import { SpecialButton } from "./components/SpecialButton/index.es.js";
|
|
43
43
|
import { LinkButton } from "./components/LinkButton/index.es.js";
|
|
44
|
+
import { Pagination } from "./components/Pagination/index.es.js";
|
|
45
|
+
import { Breadcrumb } from "./components/Breadcrumb/index.es.js";
|
|
46
|
+
import { Accordion } from "./components/Accordion/index.es.js";
|
|
47
|
+
import { Carousel } from "./components/Carousel/index.es.js";
|
|
44
48
|
import { useState } from "react";
|
|
45
49
|
import { L, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s } from "./BadgeWhite-CkZPPGmT.js";
|
|
46
50
|
import { IconActivity } from "./components/icons/IconActivity/index.es.js";
|
|
@@ -372,7 +376,6 @@ import { IconZoomOut } from "./components/icons/IconZoomOut/index.es.js";
|
|
|
372
376
|
import { IconSocialGoogle } from "./components/icons/IconSocialGoogle/index.es.js";
|
|
373
377
|
import { C, D, E, W, I, S, T } from "./react-if.esm-Cozt8l48.js";
|
|
374
378
|
import { BORDER_RADIUS_BIG, BORDER_RADIUS_MEDIUM, BORDER_RADIUS_PILL, BORDER_RADIUS_SMALL, BREAKPOINT_LG, BREAKPOINT_MD, BREAKPOINT_SM, BREAKPOINT_XLG, BREAKPOINT_XSM, COLOR_BRAND_BLUE_00, COLOR_BRAND_BLUE_10, COLOR_BRAND_BLUE_20, COLOR_BRAND_BLUE_30, COLOR_BRAND_BLUE_40, COLOR_BRAND_BLUE_50, COLOR_BRAND_BLUE_60, COLOR_BRAND_CYAN_10, COLOR_BRAND_CYAN_20, COLOR_BRAND_CYAN_30, COLOR_BRAND_CYAN_40, COLOR_BRAND_CYAN_50, COLOR_BRAND_CYAN_60, COLOR_BRAND_EMERALD_10, COLOR_BRAND_EMERALD_20, COLOR_BRAND_EMERALD_30, COLOR_BRAND_EMERALD_40, COLOR_BRAND_EMERALD_50, COLOR_BRAND_EMERALD_60, COLOR_ERROR_00, COLOR_ERROR_10, COLOR_ERROR_20, COLOR_ERROR_30, COLOR_ERROR_40, COLOR_ERROR_50, COLOR_ERROR_60, COLOR_INFO_00, COLOR_INFO_10, COLOR_INFO_20, COLOR_INFO_30, COLOR_INFO_40, COLOR_INFO_50, COLOR_INFO_60, COLOR_NEUTRAL_00, COLOR_NEUTRAL_10, COLOR_NEUTRAL_20, COLOR_NEUTRAL_30, COLOR_NEUTRAL_40, COLOR_NEUTRAL_50, COLOR_NEUTRAL_60, COLOR_NEUTRAL_70, COLOR_SUCCESS_00, COLOR_SUCCESS_10, COLOR_SUCCESS_20, COLOR_SUCCESS_30, COLOR_SUCCESS_40, COLOR_SUCCESS_50, COLOR_SUCCESS_60, COLOR_WARNING_00, COLOR_WARNING_10, COLOR_WARNING_20, COLOR_WARNING_30, COLOR_WARNING_40, COLOR_WARNING_50, COLOR_WARNING_60, CONTAINER_SIZE, FONT_BODY, FONT_SIZE_H1, FONT_SIZE_H2, FONT_SIZE_H3, FONT_SIZE_H4, FONT_SIZE_H5, FONT_SIZE_H6, FONT_SIZE_P1, FONT_SIZE_P2, FONT_SIZE_P3, FONT_SIZE_P4, FONT_TITLE, FONT_WEIGHT_BOLD, FONT_WEIGHT_MEDIUM, FONT_WEIGHT_REGULAR, FONT_WEIGHT_SEMIBOLD, OPACITY_00, OPACITY_10, OPACITY_20, OPACITY_30, OPACITY_40, SHADOW_01, SHADOW_02, SHADOW_03, SHADOW_04, SPACING_050, SPACING_100, SPACING_200, SPACING_300, SPACING_400, SPACING_500, SPACING_600, SPACING_700, SPACING_800, SPACING_900 } from "./astro/tokens/index.es.js";
|
|
375
|
-
import { Carousel } from "./components/Prototype/Carousel/index.es.js";
|
|
376
379
|
function useDrawer(props) {
|
|
377
380
|
const [drawerOpen, setDrawerOpen] = useState(props);
|
|
378
381
|
function handleOpenDrawer(name) {
|
|
@@ -389,6 +392,7 @@ function useDrawer(props) {
|
|
|
389
392
|
};
|
|
390
393
|
}
|
|
391
394
|
export {
|
|
395
|
+
Accordion,
|
|
392
396
|
AdBox,
|
|
393
397
|
Alert,
|
|
394
398
|
BORDER_RADIUS_BIG,
|
|
@@ -402,6 +406,7 @@ export {
|
|
|
402
406
|
BREAKPOINT_XSM,
|
|
403
407
|
BadgeInfo,
|
|
404
408
|
BadgeState,
|
|
409
|
+
Breadcrumb,
|
|
405
410
|
Button,
|
|
406
411
|
COLOR_BRAND_BLUE_00,
|
|
407
412
|
COLOR_BRAND_BLUE_10,
|
|
@@ -853,6 +858,7 @@ export {
|
|
|
853
858
|
OPACITY_20,
|
|
854
859
|
OPACITY_30,
|
|
855
860
|
OPACITY_40,
|
|
861
|
+
Pagination,
|
|
856
862
|
PartnerBanner,
|
|
857
863
|
PasswordField,
|
|
858
864
|
ProfileNav,
|
package/dist/main.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.es.js","sources":["../lib/components/Drawer/hooks.ts"],"sourcesContent":["import { useState } from 'react'\n\ntype UseDrawerProps = Record<string, boolean>\n\nexport function useDrawer(props: UseDrawerProps) {\n const [drawerOpen, setDrawerOpen] = useState<UseDrawerProps>(props)\n\n function handleOpenDrawer(name: string) {\n setDrawerOpen((prev) => {\n return {\n ...prev,\n [name]: !prev[name],\n }\n })\n }\n\n return {\n handleOpenDrawer,\n drawerOpen,\n }\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"main.es.js","sources":["../lib/components/Drawer/hooks.ts"],"sourcesContent":["import { useState } from 'react'\n\ntype UseDrawerProps = Record<string, boolean>\n\nexport function useDrawer(props: UseDrawerProps) {\n const [drawerOpen, setDrawerOpen] = useState<UseDrawerProps>(props)\n\n function handleOpenDrawer(name: string) {\n setDrawerOpen((prev) => {\n return {\n ...prev,\n [name]: !prev[name],\n }\n })\n }\n\n return {\n handleOpenDrawer,\n drawerOpen,\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIO,SAAS,UAAU,OAAuB;AAC/C,QAAM,CAAC,YAAY,aAAa,IAAI,SAAyB,KAAK;AAElE,WAAS,iBAAiB,MAAc;AACtC,kBAAc,CAAC,SAAS;AACtB,aAAO;AAAA,QACL,GAAG;AAAA,QACH,CAAC,IAAI,GAAG,CAAC,KAAK,IAAI;AAAA,MAAA;AAAA,IAEtB,CAAC;AAAA,EACH;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EAAA;AAEJ;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@consumidor-positivo/aurora",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.0.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/AcordoCertoBR/aurora"
|
|
@@ -61,8 +61,7 @@
|
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
63
|
"react": ">=18.0.0",
|
|
64
|
-
"react-dom": ">=18.0.0"
|
|
65
|
-
"react-snap-carousel": ">=0.3.0"
|
|
64
|
+
"react-dom": ">=18.0.0"
|
|
66
65
|
},
|
|
67
66
|
"dependencies": {
|
|
68
67
|
"dotenv": "16.6.1",
|
|
@@ -109,7 +108,6 @@
|
|
|
109
108
|
"prettier": "3.8.3",
|
|
110
109
|
"react": ">=18.3.1",
|
|
111
110
|
"react-dom": ">=18.3.1",
|
|
112
|
-
"react-snap-carousel": "0.5.1",
|
|
113
111
|
"rimraf": "6.1.3",
|
|
114
112
|
"rollup-plugin-css-only": "4.5.5",
|
|
115
113
|
"sass": "1.99.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function isMobile(): boolean | undefined;
|
|
@@ -1,469 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { c as classNames } from "../../../index-BW2ZU5Hx.js";
|
|
3
|
-
import { useRef, useEffect, useState, useCallback, useMemo, useLayoutEffect } from "react";
|
|
4
|
-
import { Conditional } from "../../misc/Conditional/index.es.js";
|
|
5
|
-
import { Text } from "../../Text/index.es.js";
|
|
6
|
-
import { Button } from "../../Button/index.es.js";
|
|
7
|
-
import "../../Icon/index.es.js";
|
|
8
|
-
import { IconChevronLeft } from "../../icons/IconChevronLeft/index.es.js";
|
|
9
|
-
import { IconChevronRight } from "../../icons/IconChevronRight/index.es.js";
|
|
10
|
-
import '../../Carousel/styles.css';const Scrollbar = ({ pageToEnterIndex, pages }) => {
|
|
11
|
-
const scrollTrail = useRef(null);
|
|
12
|
-
const scrollbar = useRef(null);
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
if (!scrollTrail.current || !scrollbar.current) return;
|
|
15
|
-
const trailSize = scrollTrail.current.offsetWidth;
|
|
16
|
-
const barSize = scrollbar.current.offsetWidth;
|
|
17
|
-
const availableScrollSpace = trailSize - barSize;
|
|
18
|
-
const currentPercentage = (pageToEnterIndex + 1) / pages.length;
|
|
19
|
-
const scrollDistance = currentPercentage * availableScrollSpace;
|
|
20
|
-
const barTranslate = pageToEnterIndex === 0 ? 0 : scrollDistance;
|
|
21
|
-
scrollbar.current.style.transform = `translateX(${barTranslate}px)`;
|
|
22
|
-
}, [pages, pageToEnterIndex]);
|
|
23
|
-
return /* @__PURE__ */ jsx("div", { className: "au-carousel__scrollbar", ref: scrollTrail, children: /* @__PURE__ */ jsx("div", { className: "au-carousel__scrollbar-scroll", ref: scrollbar }) });
|
|
24
|
-
};
|
|
25
|
-
const isClient = () => !!(typeof window !== "undefined" && window.document && window.document.createElement);
|
|
26
|
-
function isMobile() {
|
|
27
|
-
if (!isClient()) return;
|
|
28
|
-
return !!window.matchMedia("screen and (max-width:767px)").matches;
|
|
29
|
-
}
|
|
30
|
-
const Pagination = ({
|
|
31
|
-
pageToEnterIndex,
|
|
32
|
-
pages,
|
|
33
|
-
mobileText
|
|
34
|
-
}) => {
|
|
35
|
-
return /* @__PURE__ */ jsx("div", { className: "au-carousel__pagination", children: /* @__PURE__ */ jsxs(Text, { color: "secondary", weight: "regular", children: [
|
|
36
|
-
/* @__PURE__ */ jsx(
|
|
37
|
-
Conditional,
|
|
38
|
-
{
|
|
39
|
-
condition: !isMobile(),
|
|
40
|
-
renderIf: "Página",
|
|
41
|
-
renderElse: mobileText
|
|
42
|
-
}
|
|
43
|
-
),
|
|
44
|
-
" ",
|
|
45
|
-
/* @__PURE__ */ jsxs("b", { children: [
|
|
46
|
-
pageToEnterIndex + 1,
|
|
47
|
-
" de ",
|
|
48
|
-
pages.length
|
|
49
|
-
] })
|
|
50
|
-
] }) });
|
|
51
|
-
};
|
|
52
|
-
var useIsomorphicLayoutEffect = typeof document !== "undefined" ? useLayoutEffect : useEffect;
|
|
53
|
-
var useSnapCarousel = ({
|
|
54
|
-
axis = "x",
|
|
55
|
-
initialPages = []
|
|
56
|
-
} = {}) => {
|
|
57
|
-
const dimension = axis === "x" ? "width" : "height";
|
|
58
|
-
const scrollDimension = axis === "x" ? "scrollWidth" : "scrollHeight";
|
|
59
|
-
const clientDimension = axis === "x" ? "clientWidth" : "clientHeight";
|
|
60
|
-
const nearSidePos = axis === "x" ? "left" : "top";
|
|
61
|
-
const farSidePos = axis === "x" ? "right" : "bottom";
|
|
62
|
-
const scrollPos = axis === "x" ? "scrollLeft" : "scrollTop";
|
|
63
|
-
const [scrollEl, setScrollEl] = useState(null);
|
|
64
|
-
const [{ pages, activePageIndex }, setCarouselState] = useState({
|
|
65
|
-
pages: initialPages,
|
|
66
|
-
activePageIndex: 0
|
|
67
|
-
});
|
|
68
|
-
const refreshActivePage = useCallback(
|
|
69
|
-
(pages2) => {
|
|
70
|
-
if (!scrollEl) {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
const hasScrolledToEnd = Math.floor(scrollEl[scrollDimension] - scrollEl[scrollPos]) <= scrollEl[clientDimension];
|
|
74
|
-
if (hasScrolledToEnd) {
|
|
75
|
-
setCarouselState({ pages: pages2, activePageIndex: pages2.length - 1 });
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
const items = Array.from(scrollEl.children);
|
|
79
|
-
const scrollPort = scrollEl.getBoundingClientRect();
|
|
80
|
-
const offsets = pages2.map((page) => {
|
|
81
|
-
const leadIndex = page[0];
|
|
82
|
-
const leadEl = items[leadIndex];
|
|
83
|
-
assert(leadEl instanceof HTMLElement, "Expected HTMLElement");
|
|
84
|
-
const scrollSpacing = getEffectiveScrollSpacing(
|
|
85
|
-
scrollEl,
|
|
86
|
-
leadEl,
|
|
87
|
-
nearSidePos
|
|
88
|
-
);
|
|
89
|
-
const rect = leadEl.getBoundingClientRect();
|
|
90
|
-
const offset = rect[nearSidePos] - scrollPort[nearSidePos] - scrollSpacing;
|
|
91
|
-
return Math.abs(offset);
|
|
92
|
-
});
|
|
93
|
-
const minOffset = Math.min(...offsets);
|
|
94
|
-
const nextActivePageIndex = offsets.indexOf(minOffset);
|
|
95
|
-
setCarouselState({ pages: pages2, activePageIndex: nextActivePageIndex });
|
|
96
|
-
},
|
|
97
|
-
[scrollEl, clientDimension, nearSidePos, scrollDimension, scrollPos]
|
|
98
|
-
);
|
|
99
|
-
const refresh = useCallback(() => {
|
|
100
|
-
if (!scrollEl) {
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
const items = Array.from(scrollEl.children);
|
|
104
|
-
const scrollPort = scrollEl.getBoundingClientRect();
|
|
105
|
-
let currPageStartPos;
|
|
106
|
-
const pages2 = items.reduce((acc, item, i) => {
|
|
107
|
-
assert(item instanceof HTMLElement, "Expected HTMLElement");
|
|
108
|
-
const currPage = acc[acc.length - 1];
|
|
109
|
-
const rect = getOffsetRect(item, item.parentElement);
|
|
110
|
-
if (!currPage || item.dataset.shouldSnap === "true" || rect[farSidePos] - currPageStartPos > Math.ceil(scrollPort[dimension])) {
|
|
111
|
-
acc.push([i]);
|
|
112
|
-
const scrollSpacing = getEffectiveScrollSpacing(
|
|
113
|
-
scrollEl,
|
|
114
|
-
item,
|
|
115
|
-
nearSidePos
|
|
116
|
-
);
|
|
117
|
-
currPageStartPos = rect[nearSidePos] - scrollSpacing;
|
|
118
|
-
} else {
|
|
119
|
-
currPage.push(i);
|
|
120
|
-
}
|
|
121
|
-
return acc;
|
|
122
|
-
}, []);
|
|
123
|
-
refreshActivePage(pages2);
|
|
124
|
-
}, [refreshActivePage, scrollEl, dimension, farSidePos, nearSidePos]);
|
|
125
|
-
useIsomorphicLayoutEffect(() => {
|
|
126
|
-
refresh();
|
|
127
|
-
}, [refresh]);
|
|
128
|
-
useEffect(() => {
|
|
129
|
-
const handle = () => {
|
|
130
|
-
refresh();
|
|
131
|
-
};
|
|
132
|
-
window.addEventListener("resize", handle);
|
|
133
|
-
window.addEventListener("orientationchange", handle);
|
|
134
|
-
return () => {
|
|
135
|
-
window.removeEventListener("resize", handle);
|
|
136
|
-
window.removeEventListener("orientationchange", handle);
|
|
137
|
-
};
|
|
138
|
-
}, [refresh]);
|
|
139
|
-
useEffect(() => {
|
|
140
|
-
if (!scrollEl) {
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
const handle = () => {
|
|
144
|
-
refreshActivePage(pages);
|
|
145
|
-
};
|
|
146
|
-
scrollEl.addEventListener("scroll", handle);
|
|
147
|
-
return () => {
|
|
148
|
-
scrollEl.removeEventListener("scroll", handle);
|
|
149
|
-
};
|
|
150
|
-
}, [refreshActivePage, pages, scrollEl]);
|
|
151
|
-
const handleGoTo = (index, opts) => {
|
|
152
|
-
if (!scrollEl) {
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
const page = pages[index];
|
|
156
|
-
if (!page) {
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
const items = Array.from(scrollEl.children);
|
|
160
|
-
const leadIndex = page[0];
|
|
161
|
-
const leadEl = items[leadIndex];
|
|
162
|
-
if (!(leadEl instanceof HTMLElement)) {
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
const scrollSpacing = getEffectiveScrollSpacing(
|
|
166
|
-
scrollEl,
|
|
167
|
-
leadEl,
|
|
168
|
-
nearSidePos
|
|
169
|
-
);
|
|
170
|
-
const behavior = (opts == null ? void 0 : opts.behavior) || "smooth";
|
|
171
|
-
scrollEl.scrollTo({
|
|
172
|
-
behavior,
|
|
173
|
-
[nearSidePos]: getOffsetRect(leadEl, leadEl.parentElement)[nearSidePos] - scrollSpacing
|
|
174
|
-
});
|
|
175
|
-
};
|
|
176
|
-
const handlePrev = (opts) => {
|
|
177
|
-
handleGoTo(activePageIndex - 1, opts);
|
|
178
|
-
};
|
|
179
|
-
const handleNext = (opts) => {
|
|
180
|
-
handleGoTo(activePageIndex + 1, opts);
|
|
181
|
-
};
|
|
182
|
-
const snapPointIndexes = useMemo(
|
|
183
|
-
() => new Set(pages.map((page) => page[0])),
|
|
184
|
-
[pages]
|
|
185
|
-
);
|
|
186
|
-
const hasPrevPage = activePageIndex > 0;
|
|
187
|
-
const hasNextPage = activePageIndex < pages.length - 1;
|
|
188
|
-
return {
|
|
189
|
-
hasPrevPage,
|
|
190
|
-
hasNextPage,
|
|
191
|
-
prev: handlePrev,
|
|
192
|
-
next: handleNext,
|
|
193
|
-
goTo: handleGoTo,
|
|
194
|
-
refresh,
|
|
195
|
-
pages,
|
|
196
|
-
activePageIndex,
|
|
197
|
-
snapPointIndexes,
|
|
198
|
-
scrollRef: setScrollEl
|
|
199
|
-
};
|
|
200
|
-
};
|
|
201
|
-
var getOffsetRect = (el, relativeTo) => {
|
|
202
|
-
const rect = _getOffsetRect(el);
|
|
203
|
-
if (!relativeTo) {
|
|
204
|
-
return rect;
|
|
205
|
-
}
|
|
206
|
-
const relativeRect = _getOffsetRect(relativeTo);
|
|
207
|
-
return {
|
|
208
|
-
left: rect.left - relativeRect.left,
|
|
209
|
-
top: rect.top - relativeRect.top,
|
|
210
|
-
right: rect.right - relativeRect.left,
|
|
211
|
-
bottom: rect.bottom - relativeRect.top,
|
|
212
|
-
width: rect.width,
|
|
213
|
-
height: rect.height
|
|
214
|
-
};
|
|
215
|
-
};
|
|
216
|
-
var _getOffsetRect = (el) => {
|
|
217
|
-
const rect = el.getBoundingClientRect();
|
|
218
|
-
let scrollLeft = 0;
|
|
219
|
-
let scrollTop = 0;
|
|
220
|
-
let parentEl = el.parentElement;
|
|
221
|
-
while (parentEl) {
|
|
222
|
-
scrollLeft += parentEl.scrollLeft;
|
|
223
|
-
scrollTop += parentEl.scrollTop;
|
|
224
|
-
parentEl = parentEl.parentElement;
|
|
225
|
-
}
|
|
226
|
-
const left = rect.left + scrollLeft;
|
|
227
|
-
const top = rect.top + scrollTop;
|
|
228
|
-
return {
|
|
229
|
-
left,
|
|
230
|
-
top,
|
|
231
|
-
right: left + rect.width,
|
|
232
|
-
bottom: top + rect.height,
|
|
233
|
-
width: rect.width,
|
|
234
|
-
height: rect.height
|
|
235
|
-
};
|
|
236
|
-
};
|
|
237
|
-
var getScrollPaddingUsedValue = (el, pos) => {
|
|
238
|
-
const style = window.getComputedStyle(el);
|
|
239
|
-
const scrollPadding = style.getPropertyValue(`scroll-padding-${pos}`) || "0px";
|
|
240
|
-
if (scrollPadding === "auto") {
|
|
241
|
-
return 0;
|
|
242
|
-
}
|
|
243
|
-
const invalidMsg = `Unsupported scroll padding value, expected <length> or <percentage> value, received ${scrollPadding}`;
|
|
244
|
-
if (scrollPadding.endsWith("px")) {
|
|
245
|
-
const value = parseInt(scrollPadding);
|
|
246
|
-
assert(!Number.isNaN(value), invalidMsg);
|
|
247
|
-
return value;
|
|
248
|
-
}
|
|
249
|
-
if (scrollPadding.endsWith("%")) {
|
|
250
|
-
const value = parseInt(scrollPadding);
|
|
251
|
-
assert(!Number.isNaN(value), invalidMsg);
|
|
252
|
-
return el.clientWidth / 100 * value;
|
|
253
|
-
}
|
|
254
|
-
throw new RSCError(invalidMsg);
|
|
255
|
-
};
|
|
256
|
-
var getScrollMarginUsedValue = (el, pos) => {
|
|
257
|
-
const style = window.getComputedStyle(el);
|
|
258
|
-
const scrollMargin = style.getPropertyValue(`scroll-margin-${pos}`) || "0px";
|
|
259
|
-
const invalidMsg = `Unsupported scroll margin value, expected <length> value, received ${scrollMargin}`;
|
|
260
|
-
assert(scrollMargin.endsWith("px"), invalidMsg);
|
|
261
|
-
const value = parseInt(scrollMargin);
|
|
262
|
-
assert(!Number.isNaN(value), invalidMsg);
|
|
263
|
-
return value;
|
|
264
|
-
};
|
|
265
|
-
var getEffectiveScrollSpacing = (scrollEl, itemEl, pos) => {
|
|
266
|
-
const scrollPadding = getScrollPaddingUsedValue(scrollEl, pos);
|
|
267
|
-
const scrollMargin = getScrollMarginUsedValue(itemEl, pos);
|
|
268
|
-
const rect = getOffsetRect(itemEl, itemEl.parentElement);
|
|
269
|
-
return Math.min(scrollPadding + scrollMargin, rect[pos]);
|
|
270
|
-
};
|
|
271
|
-
function assert(value, message) {
|
|
272
|
-
if (value) {
|
|
273
|
-
return;
|
|
274
|
-
}
|
|
275
|
-
throw new RSCError(message);
|
|
276
|
-
}
|
|
277
|
-
var RSCError = class extends Error {
|
|
278
|
-
constructor(message) {
|
|
279
|
-
super(`[react-snap-carousel]: ${message}`);
|
|
280
|
-
}
|
|
281
|
-
};
|
|
282
|
-
function useCarouselDrag({ goPrevious, goNext }) {
|
|
283
|
-
const [isPressing, setIsPressing] = useState(false);
|
|
284
|
-
const [dragStartPosition, setDragStartPosition] = useState(0);
|
|
285
|
-
function handleStartDrag(e) {
|
|
286
|
-
if (isMobile()) return;
|
|
287
|
-
setIsPressing(true);
|
|
288
|
-
document.addEventListener("mouseup", handleRelease);
|
|
289
|
-
setDragStartPosition(e.clientX);
|
|
290
|
-
}
|
|
291
|
-
function handleRelease() {
|
|
292
|
-
document.removeEventListener("mouseup", handleRelease);
|
|
293
|
-
setIsPressing(false);
|
|
294
|
-
setDragStartPosition(0);
|
|
295
|
-
}
|
|
296
|
-
function handleMouseMove(e) {
|
|
297
|
-
if (isMobile() || !isMobile() && !isPressing) return;
|
|
298
|
-
const currentX = e.clientX;
|
|
299
|
-
if (currentX > dragStartPosition) {
|
|
300
|
-
goPrevious();
|
|
301
|
-
} else if (currentX < dragStartPosition) {
|
|
302
|
-
goNext();
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
return {
|
|
306
|
-
handleMouseMove,
|
|
307
|
-
handleStartDrag
|
|
308
|
-
};
|
|
309
|
-
}
|
|
310
|
-
function useCarousel({ items }) {
|
|
311
|
-
const {
|
|
312
|
-
scrollRef,
|
|
313
|
-
pages,
|
|
314
|
-
activePageIndex,
|
|
315
|
-
hasPrevPage,
|
|
316
|
-
hasNextPage,
|
|
317
|
-
prev,
|
|
318
|
-
next,
|
|
319
|
-
snapPointIndexes,
|
|
320
|
-
refresh
|
|
321
|
-
} = useSnapCarousel({ axis: "x" });
|
|
322
|
-
const showControls = snapPointIndexes.size > 1;
|
|
323
|
-
const [numberOfItems, setNumberOfItems] = useState(items.length);
|
|
324
|
-
const [nextPage, setNextPage] = useState(0);
|
|
325
|
-
const railRef = useRef(null);
|
|
326
|
-
const rootRef = useRef(null);
|
|
327
|
-
const { handleMouseMove, handleStartDrag } = useCarouselDrag({
|
|
328
|
-
goNext,
|
|
329
|
-
goPrevious
|
|
330
|
-
});
|
|
331
|
-
useEffect(() => {
|
|
332
|
-
if (items.length !== numberOfItems) {
|
|
333
|
-
refresh();
|
|
334
|
-
setNumberOfItems(items.length);
|
|
335
|
-
}
|
|
336
|
-
}, [items]);
|
|
337
|
-
function setRef(el) {
|
|
338
|
-
scrollRef(el);
|
|
339
|
-
railRef.current = el;
|
|
340
|
-
}
|
|
341
|
-
function goNext() {
|
|
342
|
-
const nextIndex = activePageIndex + 1;
|
|
343
|
-
setNextPage(nextIndex);
|
|
344
|
-
next();
|
|
345
|
-
}
|
|
346
|
-
function goPrevious() {
|
|
347
|
-
setNextPage(activePageIndex === 0 ? activePageIndex : activePageIndex - 1);
|
|
348
|
-
prev();
|
|
349
|
-
}
|
|
350
|
-
return {
|
|
351
|
-
rootRef,
|
|
352
|
-
setRef,
|
|
353
|
-
nextPage,
|
|
354
|
-
pages,
|
|
355
|
-
railRef,
|
|
356
|
-
hasPrevPage,
|
|
357
|
-
hasNextPage,
|
|
358
|
-
goPrevious,
|
|
359
|
-
goNext,
|
|
360
|
-
snapPointIndexes,
|
|
361
|
-
activePageIndex,
|
|
362
|
-
handleMouseMove,
|
|
363
|
-
handleStartDrag,
|
|
364
|
-
showControls
|
|
365
|
-
};
|
|
366
|
-
}
|
|
367
|
-
const Carousel = ({
|
|
368
|
-
items,
|
|
369
|
-
type,
|
|
370
|
-
mobileText = "",
|
|
371
|
-
draggable = true,
|
|
372
|
-
"data-testid": dataTestId
|
|
373
|
-
}) => {
|
|
374
|
-
const {
|
|
375
|
-
rootRef,
|
|
376
|
-
setRef,
|
|
377
|
-
snapPointIndexes,
|
|
378
|
-
activePageIndex,
|
|
379
|
-
pages,
|
|
380
|
-
hasPrevPage,
|
|
381
|
-
goPrevious,
|
|
382
|
-
hasNextPage,
|
|
383
|
-
goNext,
|
|
384
|
-
handleStartDrag,
|
|
385
|
-
handleMouseMove,
|
|
386
|
-
showControls
|
|
387
|
-
} = useCarousel({
|
|
388
|
-
items
|
|
389
|
-
});
|
|
390
|
-
const cl = classNames("au-carousel", { "au-carousel--draggable": draggable });
|
|
391
|
-
return /* @__PURE__ */ jsxs("div", { className: cl, ref: rootRef, "data-testid": dataTestId, children: [
|
|
392
|
-
/* @__PURE__ */ jsx(
|
|
393
|
-
"ul",
|
|
394
|
-
{
|
|
395
|
-
className: "au-carousel__rail",
|
|
396
|
-
ref: setRef,
|
|
397
|
-
onMouseDown: draggable ? handleStartDrag : void 0,
|
|
398
|
-
onMouseMove: draggable ? handleMouseMove : void 0,
|
|
399
|
-
children: items.map((item, i) => {
|
|
400
|
-
const key = `au-${item.key || i}`;
|
|
401
|
-
return /* @__PURE__ */ jsx(
|
|
402
|
-
"li",
|
|
403
|
-
{
|
|
404
|
-
className: classNames("au-carousel__item", {
|
|
405
|
-
"au-carousel__item--snap": snapPointIndexes.has(i)
|
|
406
|
-
}),
|
|
407
|
-
"data-key": key,
|
|
408
|
-
children: item
|
|
409
|
-
},
|
|
410
|
-
key
|
|
411
|
-
);
|
|
412
|
-
})
|
|
413
|
-
}
|
|
414
|
-
),
|
|
415
|
-
/* @__PURE__ */ jsx(
|
|
416
|
-
Conditional,
|
|
417
|
-
{
|
|
418
|
-
condition: showControls,
|
|
419
|
-
renderIf: /* @__PURE__ */ jsxs("div", { className: "au-carousel__actions", children: [
|
|
420
|
-
type === "scrollbar" && /* @__PURE__ */ jsx(Scrollbar, { pageToEnterIndex: activePageIndex, pages }),
|
|
421
|
-
type === "pages" && /* @__PURE__ */ jsx(
|
|
422
|
-
Pagination,
|
|
423
|
-
{
|
|
424
|
-
pageToEnterIndex: activePageIndex,
|
|
425
|
-
pages,
|
|
426
|
-
mobileText
|
|
427
|
-
}
|
|
428
|
-
),
|
|
429
|
-
/* @__PURE__ */ jsxs(
|
|
430
|
-
"div",
|
|
431
|
-
{
|
|
432
|
-
className: classNames("au-carousel__btns", {
|
|
433
|
-
"au-carousel__btns--pages": type === "pages"
|
|
434
|
-
}),
|
|
435
|
-
children: [
|
|
436
|
-
/* @__PURE__ */ jsx(
|
|
437
|
-
Button,
|
|
438
|
-
{
|
|
439
|
-
round: true,
|
|
440
|
-
type: "outlined",
|
|
441
|
-
disabled: !hasPrevPage,
|
|
442
|
-
onClick: goPrevious,
|
|
443
|
-
"aria-label": "Anterior",
|
|
444
|
-
children: /* @__PURE__ */ jsx(IconChevronLeft, { "aria-hidden": "true" })
|
|
445
|
-
}
|
|
446
|
-
),
|
|
447
|
-
/* @__PURE__ */ jsx(
|
|
448
|
-
Button,
|
|
449
|
-
{
|
|
450
|
-
round: true,
|
|
451
|
-
type: "outlined",
|
|
452
|
-
disabled: !hasNextPage,
|
|
453
|
-
onClick: goNext,
|
|
454
|
-
"aria-label": "Próximo",
|
|
455
|
-
children: /* @__PURE__ */ jsx(IconChevronRight, { "aria-hidden": "true" })
|
|
456
|
-
}
|
|
457
|
-
)
|
|
458
|
-
]
|
|
459
|
-
}
|
|
460
|
-
)
|
|
461
|
-
] })
|
|
462
|
-
}
|
|
463
|
-
)
|
|
464
|
-
] });
|
|
465
|
-
};
|
|
466
|
-
export {
|
|
467
|
-
Carousel
|
|
468
|
-
};
|
|
469
|
-
//# sourceMappingURL=index.es.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.js","sources":["../../../../lib/components/Prototype/Carousel/Scrollbar.tsx","../../../../lib/components/Prototype/Carousel/helpers.ts","../../../../lib/components/Prototype/Carousel/Pagination.tsx","../../../../node_modules/react-snap-carousel/dist/use-snap-carousel.mjs","../../../../lib/components/Prototype/Carousel/useCarouselDrag.ts","../../../../lib/components/Prototype/Carousel/useCarousel.ts","../../../../lib/components/Prototype/Carousel/index.tsx"],"sourcesContent":["import { useEffect, useRef } from 'react';\n\ntype ScrollbarProps = {\n pages: number[][];\n pageToEnterIndex: number;\n};\n\nexport const Scrollbar = ({ pageToEnterIndex, pages }: ScrollbarProps) => {\n const scrollTrail = useRef<HTMLDivElement>(null);\n const scrollbar = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (!scrollTrail.current || !scrollbar.current) return;\n const trailSize = scrollTrail.current.offsetWidth;\n const barSize = scrollbar.current.offsetWidth;\n const availableScrollSpace = trailSize - barSize;\n\n const currentPercentage = (pageToEnterIndex + 1) / pages.length;\n const scrollDistance = currentPercentage * availableScrollSpace;\n\n const barTranslate = pageToEnterIndex === 0 ? 0 : scrollDistance;\n scrollbar.current.style.transform = `translateX(${barTranslate}px)`;\n }, [pages, pageToEnterIndex]);\n\n return (\n <div className=\"au-carousel__scrollbar\" ref={scrollTrail}>\n <div className=\"au-carousel__scrollbar-scroll\" ref={scrollbar}></div>\n </div>\n );\n};\n","//TODO remove\n\nconst isClient = () =>\n !!(\n typeof window !== 'undefined' &&\n window.document &&\n window.document.createElement\n )\n\nexport function isMobile() {\n if (!isClient()) return\n return !!window.matchMedia('screen and (max-width:767px)').matches\n}\n","import { Conditional } from '@components/misc'\nimport { isMobile } from './helpers'\nimport { Text } from '@components/Text'\n\ntype PaginationProps = {\n pages: number[][]\n pageToEnterIndex: number\n mobileText: string\n}\n\nexport const Pagination = ({\n pageToEnterIndex,\n pages,\n mobileText,\n}: PaginationProps) => {\n return (\n <div className=\"au-carousel__pagination\">\n <Text color=\"secondary\" weight=\"regular\">\n <Conditional\n condition={!isMobile()}\n renderIf={'Página'}\n renderElse={mobileText}\n />{' '}\n <b>\n {pageToEnterIndex + 1} de {pages.length}\n </b>\n </Text>\n </div>\n )\n}\n","// src/use-snap-carousel.tsx\nimport { useState, useCallback, useEffect as useEffect2, useMemo } from \"react\";\n\n// src/use-isomorphic-layout-effect.tsx\nimport { useEffect, useLayoutEffect } from \"react\";\nvar useIsomorphicLayoutEffect = typeof document !== \"undefined\" ? useLayoutEffect : useEffect;\n\n// src/use-snap-carousel.tsx\nvar useSnapCarousel = ({\n axis = \"x\",\n initialPages = []\n} = {}) => {\n const dimension = axis === \"x\" ? \"width\" : \"height\";\n const scrollDimension = axis === \"x\" ? \"scrollWidth\" : \"scrollHeight\";\n const clientDimension = axis === \"x\" ? \"clientWidth\" : \"clientHeight\";\n const nearSidePos = axis === \"x\" ? \"left\" : \"top\";\n const farSidePos = axis === \"x\" ? \"right\" : \"bottom\";\n const scrollPos = axis === \"x\" ? \"scrollLeft\" : \"scrollTop\";\n const [scrollEl, setScrollEl] = useState(null);\n const [{ pages, activePageIndex }, setCarouselState] = useState({\n pages: initialPages,\n activePageIndex: 0\n });\n const refreshActivePage = useCallback(\n (pages2) => {\n if (!scrollEl) {\n return;\n }\n const hasScrolledToEnd = Math.floor(scrollEl[scrollDimension] - scrollEl[scrollPos]) <= scrollEl[clientDimension];\n if (hasScrolledToEnd) {\n setCarouselState({ pages: pages2, activePageIndex: pages2.length - 1 });\n return;\n }\n const items = Array.from(scrollEl.children);\n const scrollPort = scrollEl.getBoundingClientRect();\n const offsets = pages2.map((page) => {\n const leadIndex = page[0];\n const leadEl = items[leadIndex];\n assert(leadEl instanceof HTMLElement, \"Expected HTMLElement\");\n const scrollSpacing = getEffectiveScrollSpacing(\n scrollEl,\n leadEl,\n nearSidePos\n );\n const rect = leadEl.getBoundingClientRect();\n const offset = rect[nearSidePos] - scrollPort[nearSidePos] - scrollSpacing;\n return Math.abs(offset);\n });\n const minOffset = Math.min(...offsets);\n const nextActivePageIndex = offsets.indexOf(minOffset);\n setCarouselState({ pages: pages2, activePageIndex: nextActivePageIndex });\n },\n [scrollEl, clientDimension, nearSidePos, scrollDimension, scrollPos]\n );\n const refresh = useCallback(() => {\n if (!scrollEl) {\n return;\n }\n const items = Array.from(scrollEl.children);\n const scrollPort = scrollEl.getBoundingClientRect();\n let currPageStartPos;\n const pages2 = items.reduce((acc, item, i) => {\n assert(item instanceof HTMLElement, \"Expected HTMLElement\");\n const currPage = acc[acc.length - 1];\n const rect = getOffsetRect(item, item.parentElement);\n if (!currPage || item.dataset.shouldSnap === \"true\" || rect[farSidePos] - currPageStartPos > Math.ceil(scrollPort[dimension])) {\n acc.push([i]);\n const scrollSpacing = getEffectiveScrollSpacing(\n scrollEl,\n item,\n nearSidePos\n );\n currPageStartPos = rect[nearSidePos] - scrollSpacing;\n } else {\n currPage.push(i);\n }\n return acc;\n }, []);\n refreshActivePage(pages2);\n }, [refreshActivePage, scrollEl, dimension, farSidePos, nearSidePos]);\n useIsomorphicLayoutEffect(() => {\n refresh();\n }, [refresh]);\n useEffect2(() => {\n const handle = () => {\n refresh();\n };\n window.addEventListener(\"resize\", handle);\n window.addEventListener(\"orientationchange\", handle);\n return () => {\n window.removeEventListener(\"resize\", handle);\n window.removeEventListener(\"orientationchange\", handle);\n };\n }, [refresh]);\n useEffect2(() => {\n if (!scrollEl) {\n return;\n }\n const handle = () => {\n refreshActivePage(pages);\n };\n scrollEl.addEventListener(\"scroll\", handle);\n return () => {\n scrollEl.removeEventListener(\"scroll\", handle);\n };\n }, [refreshActivePage, pages, scrollEl]);\n const handleGoTo = (index, opts) => {\n if (!scrollEl) {\n return;\n }\n const page = pages[index];\n if (!page) {\n return;\n }\n const items = Array.from(scrollEl.children);\n const leadIndex = page[0];\n const leadEl = items[leadIndex];\n if (!(leadEl instanceof HTMLElement)) {\n return;\n }\n const scrollSpacing = getEffectiveScrollSpacing(\n scrollEl,\n leadEl,\n nearSidePos\n );\n const behavior = (opts == null ? void 0 : opts.behavior) || \"smooth\";\n scrollEl.scrollTo({\n behavior,\n [nearSidePos]: getOffsetRect(leadEl, leadEl.parentElement)[nearSidePos] - scrollSpacing\n });\n };\n const handlePrev = (opts) => {\n handleGoTo(activePageIndex - 1, opts);\n };\n const handleNext = (opts) => {\n handleGoTo(activePageIndex + 1, opts);\n };\n const snapPointIndexes = useMemo(\n () => new Set(pages.map((page) => page[0])),\n [pages]\n );\n const hasPrevPage = activePageIndex > 0;\n const hasNextPage = activePageIndex < pages.length - 1;\n return {\n hasPrevPage,\n hasNextPage,\n prev: handlePrev,\n next: handleNext,\n goTo: handleGoTo,\n refresh,\n pages,\n activePageIndex,\n snapPointIndexes,\n scrollRef: setScrollEl\n };\n};\nvar getOffsetRect = (el, relativeTo) => {\n const rect = _getOffsetRect(el);\n if (!relativeTo) {\n return rect;\n }\n const relativeRect = _getOffsetRect(relativeTo);\n return {\n left: rect.left - relativeRect.left,\n top: rect.top - relativeRect.top,\n right: rect.right - relativeRect.left,\n bottom: rect.bottom - relativeRect.top,\n width: rect.width,\n height: rect.height\n };\n};\nvar _getOffsetRect = (el) => {\n const rect = el.getBoundingClientRect();\n let scrollLeft = 0;\n let scrollTop = 0;\n let parentEl = el.parentElement;\n while (parentEl) {\n scrollLeft += parentEl.scrollLeft;\n scrollTop += parentEl.scrollTop;\n parentEl = parentEl.parentElement;\n }\n const left = rect.left + scrollLeft;\n const top = rect.top + scrollTop;\n return {\n left,\n top,\n right: left + rect.width,\n bottom: top + rect.height,\n width: rect.width,\n height: rect.height\n };\n};\nvar getScrollPaddingUsedValue = (el, pos) => {\n const style = window.getComputedStyle(el);\n const scrollPadding = style.getPropertyValue(`scroll-padding-${pos}`) || \"0px\";\n if (scrollPadding === \"auto\") {\n return 0;\n }\n const invalidMsg = `Unsupported scroll padding value, expected <length> or <percentage> value, received ${scrollPadding}`;\n if (scrollPadding.endsWith(\"px\")) {\n const value = parseInt(scrollPadding);\n assert(!Number.isNaN(value), invalidMsg);\n return value;\n }\n if (scrollPadding.endsWith(\"%\")) {\n const value = parseInt(scrollPadding);\n assert(!Number.isNaN(value), invalidMsg);\n return el.clientWidth / 100 * value;\n }\n throw new RSCError(invalidMsg);\n};\nvar getScrollMarginUsedValue = (el, pos) => {\n const style = window.getComputedStyle(el);\n const scrollMargin = style.getPropertyValue(`scroll-margin-${pos}`) || \"0px\";\n const invalidMsg = `Unsupported scroll margin value, expected <length> value, received ${scrollMargin}`;\n assert(scrollMargin.endsWith(\"px\"), invalidMsg);\n const value = parseInt(scrollMargin);\n assert(!Number.isNaN(value), invalidMsg);\n return value;\n};\nvar getEffectiveScrollSpacing = (scrollEl, itemEl, pos) => {\n const scrollPadding = getScrollPaddingUsedValue(scrollEl, pos);\n const scrollMargin = getScrollMarginUsedValue(itemEl, pos);\n const rect = getOffsetRect(itemEl, itemEl.parentElement);\n return Math.min(scrollPadding + scrollMargin, rect[pos]);\n};\nfunction assert(value, message) {\n if (value) {\n return;\n }\n throw new RSCError(message);\n}\nvar RSCError = class extends Error {\n constructor(message) {\n super(`[react-snap-carousel]: ${message}`);\n }\n};\nexport {\n useSnapCarousel\n};\n","import { isMobile } from './helpers'\nimport { useState } from 'react'\n\ntype UseCarouselDragArgs = {\n goPrevious: () => void\n goNext: () => void\n}\n\nexport function useCarouselDrag({ goPrevious, goNext }: UseCarouselDragArgs) {\n const [isPressing, setIsPressing] = useState(false)\n const [dragStartPosition, setDragStartPosition] = useState(0)\n\n function handleStartDrag(e: React.MouseEvent<HTMLUListElement, MouseEvent>) {\n if (isMobile()) return\n setIsPressing(true)\n document.addEventListener('mouseup', handleRelease)\n setDragStartPosition(e.clientX)\n }\n\n function handleRelease() {\n document.removeEventListener('mouseup', handleRelease)\n setIsPressing(false)\n setDragStartPosition(0)\n }\n\n function handleMouseMove(e: React.MouseEvent<HTMLUListElement, MouseEvent>) {\n if (isMobile() || (!isMobile() && !isPressing)) return\n\n const currentX = e.clientX\n if (currentX > dragStartPosition) {\n goPrevious()\n } else if (currentX < dragStartPosition) {\n goNext()\n }\n }\n\n return {\n handleMouseMove,\n handleStartDrag,\n }\n}\n","import { useEffect, useRef, useState } from 'react'\nimport { SnapCarouselResult, useSnapCarousel } from 'react-snap-carousel'\nimport { useCarouselDrag } from './useCarouselDrag'\n\ntype UseCarouselArgs = {\n items: unknown[]\n}\n\nexport default function useCarousel({ items }: UseCarouselArgs) {\n const {\n scrollRef,\n pages,\n activePageIndex,\n hasPrevPage,\n hasNextPage,\n prev,\n next,\n snapPointIndexes,\n refresh,\n }: SnapCarouselResult = useSnapCarousel({ axis: 'x' })\n const showControls = snapPointIndexes.size > 1\n const [numberOfItems, setNumberOfItems] = useState(items.length)\n const [nextPage, setNextPage] = useState(0)\n const railRef = useRef<HTMLElement | null>(null)\n const rootRef = useRef<HTMLDivElement | null>(null)\n const { handleMouseMove, handleStartDrag } = useCarouselDrag({\n goNext,\n goPrevious,\n })\n\n useEffect(() => {\n if (items.length !== numberOfItems) {\n refresh()\n setNumberOfItems(items.length)\n }\n }, [items])\n\n function setRef(el: HTMLElement | null) {\n scrollRef(el)\n railRef.current = el\n }\n\n function goNext() {\n const nextIndex = activePageIndex + 1\n setNextPage(nextIndex)\n next()\n }\n\n function goPrevious() {\n setNextPage(activePageIndex === 0 ? activePageIndex : activePageIndex - 1)\n prev()\n }\n\n return {\n rootRef,\n setRef,\n nextPage,\n pages,\n railRef,\n hasPrevPage,\n hasNextPage,\n goPrevious,\n goNext,\n snapPointIndexes,\n activePageIndex,\n handleMouseMove,\n handleStartDrag,\n showControls,\n }\n}\n","/**\n * Carousel Component\n * \n * @requires react-snap-carousel\n * This component requires the 'react-snap-carousel' package to be installed.\n * Install it using: npm install react-snap-carousel\n */\n\nimport classNames from 'classnames'\nimport { Scrollbar } from './Scrollbar'\nimport { Pagination } from './Pagination'\nimport useCarousel from './useCarousel'\nimport { CarouselProps } from './types'\n\nimport { Button } from '@components/Button'\nimport { Conditional } from '@components/misc'\nimport { IconChevronLeft, IconChevronRight } from '@components/icons'\n\nimport './styles.scss'\n\nexport const Carousel = ({\n items,\n type,\n mobileText = '',\n draggable = true,\n 'data-testid': dataTestId,\n}: CarouselProps) => {\n const {\n rootRef,\n setRef,\n snapPointIndexes,\n activePageIndex,\n pages,\n hasPrevPage,\n goPrevious,\n hasNextPage,\n goNext,\n handleStartDrag,\n handleMouseMove,\n showControls,\n } = useCarousel({\n items,\n })\n\n const cl = classNames('au-carousel', { 'au-carousel--draggable': draggable })\n return (\n <div className={cl} ref={rootRef} data-testid={dataTestId}>\n <ul\n className=\"au-carousel__rail\"\n ref={setRef}\n onMouseDown={draggable ? handleStartDrag : undefined}\n onMouseMove={draggable ? handleMouseMove : undefined}>\n {items.map((item, i) => {\n const key = `au-${item.key || i}`\n return (\n <li\n className={classNames('au-carousel__item', {\n 'au-carousel__item--snap': snapPointIndexes.has(i),\n })}\n data-key={key}\n key={key}>\n {item}\n </li>\n )\n })}\n </ul>\n\n <Conditional\n condition={showControls}\n renderIf={\n <div className=\"au-carousel__actions\">\n {type === 'scrollbar' && (\n <Scrollbar pageToEnterIndex={activePageIndex} pages={pages} />\n )}\n\n {type === 'pages' && (\n <Pagination\n pageToEnterIndex={activePageIndex}\n pages={pages}\n mobileText={mobileText}\n />\n )}\n\n <div\n className={classNames('au-carousel__btns', {\n 'au-carousel__btns--pages': type === 'pages',\n })}>\n <Button\n round\n type=\"outlined\"\n disabled={!hasPrevPage}\n onClick={goPrevious}\n aria-label=\"Anterior\">\n <IconChevronLeft aria-hidden=\"true\" />\n </Button>\n <Button\n round\n type=\"outlined\"\n disabled={!hasNextPage}\n onClick={goNext}\n aria-label=\"Próximo\">\n <IconChevronRight aria-hidden=\"true\" />\n </Button>\n </div>\n </div>\n }\n />\n </div>\n )\n}\n"],"names":["useEffect2"],"mappings":";;;;;;;;;AAOO,MAAM,YAAY,CAAC,EAAE,kBAAkB,YAA4B;AACxE,QAAM,cAAc,OAAuB,IAAI;AAC/C,QAAM,YAAY,OAAuB,IAAI;AAE7C,YAAU,MAAM;AACd,QAAI,CAAC,YAAY,WAAW,CAAC,UAAU,QAAS;AAChD,UAAM,YAAY,YAAY,QAAQ;AACtC,UAAM,UAAU,UAAU,QAAQ;AAClC,UAAM,uBAAuB,YAAY;AAEzC,UAAM,qBAAqB,mBAAmB,KAAK,MAAM;AAC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AAAA,kBAAA;AAAA,oBACC,OAAK;AAAA,oBACL,MAAK;AAAA,oBACL,UAAU,CAAC;AAAA,oBACX,SAAS;AAAA,oBACT,cAAW;AAAA,oBACX,UAAA,oBAAC,iBAAA,EAAgB,eAAY,OAAA,CAAO;AAAA,kBAAA;AAAA,gBAAA;AAAA,gBAEtC;AAAA,kBAAC;AAAA,kBAAA;AAAA,oBACC,OAAK;AAAA,oBACL,MAAK;AAAA,oBACL,UAAU,CAAC;AAAA,oBACX,SAAS;AAAA,oBACT,cAAW;AAAA,oBACX,UAAA,oBAAC,kBAAA,EAAiB,eAAY,OAAA,CAAO;AAAA,kBAAA;AAAA,gBAAA;AAAA,cACvC;AAAA,YAAA;AAAA,UAAA;AAAA,QACF,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAEJ,GACF;AAEJ;","x_google_ignoreList":[3]}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
type UseCarouselArgs = {
|
|
2
|
-
items: unknown[];
|
|
3
|
-
};
|
|
4
|
-
export default function useCarousel({ items }: UseCarouselArgs): {
|
|
5
|
-
rootRef: import('react').MutableRefObject<HTMLDivElement | null>;
|
|
6
|
-
setRef: (el: HTMLElement | null) => void;
|
|
7
|
-
nextPage: number;
|
|
8
|
-
pages: number[][];
|
|
9
|
-
railRef: import('react').MutableRefObject<HTMLElement | null>;
|
|
10
|
-
hasPrevPage: boolean;
|
|
11
|
-
hasNextPage: boolean;
|
|
12
|
-
goPrevious: () => void;
|
|
13
|
-
goNext: () => void;
|
|
14
|
-
snapPointIndexes: Set<number>;
|
|
15
|
-
activePageIndex: number;
|
|
16
|
-
handleMouseMove: (e: import('react').MouseEvent<HTMLUListElement, MouseEvent>) => void;
|
|
17
|
-
handleStartDrag: (e: import('react').MouseEvent<HTMLUListElement, MouseEvent>) => void;
|
|
18
|
-
showControls: boolean;
|
|
19
|
-
};
|
|
20
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
type UseCarouselDragArgs = {
|
|
2
|
-
goPrevious: () => void;
|
|
3
|
-
goNext: () => void;
|
|
4
|
-
};
|
|
5
|
-
export declare function useCarouselDrag({ goPrevious, goNext }: UseCarouselDragArgs): {
|
|
6
|
-
handleMouseMove: (e: React.MouseEvent<HTMLUListElement, MouseEvent>) => void;
|
|
7
|
-
handleStartDrag: (e: React.MouseEvent<HTMLUListElement, MouseEvent>) => void;
|
|
8
|
-
};
|
|
9
|
-
export {};
|