@consumidor-positivo/aurora 1.3.3 → 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/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/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
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { c as classNames } from "../../../index-BW2ZU5Hx.js";
|
|
3
|
+
import { Button } from "../../Button/index.es.js";
|
|
4
|
+
import { useRef, useState, useCallback, useEffect } from "react";
|
|
5
|
+
import "../../Icon/index.es.js";
|
|
6
|
+
import { IconChevronLeft } from "../../icons/IconChevronLeft/index.es.js";
|
|
7
|
+
import { IconChevronRight } from "../../icons/IconChevronRight/index.es.js";
|
|
8
|
+
const DRAG_THRESHOLD = 5;
|
|
9
|
+
const DRAGGING_CLASS = "au-carousel__rail--dragging";
|
|
10
|
+
function getPageStarts(rail) {
|
|
11
|
+
const slides = Array.from(rail.children);
|
|
12
|
+
const viewport = rail.clientWidth;
|
|
13
|
+
const starts = [];
|
|
14
|
+
let index = 0;
|
|
15
|
+
while (index < slides.length) {
|
|
16
|
+
const start = slides[index].offsetLeft;
|
|
17
|
+
starts.push(start);
|
|
18
|
+
let next = index + 1;
|
|
19
|
+
while (next < slides.length && slides[next].offsetLeft + slides[next].offsetWidth <= start + viewport + 1) {
|
|
20
|
+
next += 1;
|
|
21
|
+
}
|
|
22
|
+
index = next;
|
|
23
|
+
}
|
|
24
|
+
return starts;
|
|
25
|
+
}
|
|
26
|
+
function getActivePage(rail, starts) {
|
|
27
|
+
if (starts.length === 0) return 0;
|
|
28
|
+
const { scrollLeft } = rail;
|
|
29
|
+
const maxScroll = rail.scrollWidth - rail.clientWidth;
|
|
30
|
+
if (scrollLeft >= maxScroll - 1) return starts.length - 1;
|
|
31
|
+
let nearest = 0;
|
|
32
|
+
starts.forEach((start, index) => {
|
|
33
|
+
if (Math.abs(start - scrollLeft) < Math.abs(starts[nearest] - scrollLeft)) {
|
|
34
|
+
nearest = index;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
return nearest;
|
|
38
|
+
}
|
|
39
|
+
function useCarousel({ draggable, onPageChange }) {
|
|
40
|
+
const railRef = useRef(null);
|
|
41
|
+
const startsRef = useRef([]);
|
|
42
|
+
const pageRef = useRef(0);
|
|
43
|
+
const draggableRef = useRef(draggable);
|
|
44
|
+
const onPageChangeRef = useRef(onPageChange);
|
|
45
|
+
const [page, setPage] = useState(0);
|
|
46
|
+
const [pageCount, setPageCount] = useState(0);
|
|
47
|
+
draggableRef.current = draggable;
|
|
48
|
+
onPageChangeRef.current = onPageChange;
|
|
49
|
+
const goTo = useCallback((target) => {
|
|
50
|
+
const rail = railRef.current;
|
|
51
|
+
const starts = startsRef.current;
|
|
52
|
+
if (!rail || target < 0 || target >= starts.length) return;
|
|
53
|
+
rail.scrollTo({ left: starts[target] });
|
|
54
|
+
}, []);
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
const rail = railRef.current;
|
|
57
|
+
if (!rail) return;
|
|
58
|
+
function setActive(next) {
|
|
59
|
+
var _a;
|
|
60
|
+
if (next === pageRef.current) return;
|
|
61
|
+
pageRef.current = next;
|
|
62
|
+
setPage(next);
|
|
63
|
+
(_a = onPageChangeRef.current) == null ? void 0 : _a.call(onPageChangeRef, next + 1, startsRef.current.length);
|
|
64
|
+
}
|
|
65
|
+
function measure() {
|
|
66
|
+
startsRef.current = getPageStarts(rail);
|
|
67
|
+
setPageCount(startsRef.current.length);
|
|
68
|
+
setActive(getActivePage(rail, startsRef.current));
|
|
69
|
+
}
|
|
70
|
+
let frame = 0;
|
|
71
|
+
function onScroll() {
|
|
72
|
+
cancelAnimationFrame(frame);
|
|
73
|
+
frame = requestAnimationFrame(() => {
|
|
74
|
+
setActive(getActivePage(rail, startsRef.current));
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
let drag = null;
|
|
78
|
+
function suppressClick(event) {
|
|
79
|
+
event.stopPropagation();
|
|
80
|
+
event.preventDefault();
|
|
81
|
+
}
|
|
82
|
+
function onPointerDown(event) {
|
|
83
|
+
if (!draggableRef.current || event.pointerType !== "mouse" || event.button !== 0) return;
|
|
84
|
+
drag = {
|
|
85
|
+
startX: event.clientX,
|
|
86
|
+
scrollLeft: rail.scrollLeft,
|
|
87
|
+
page: pageRef.current,
|
|
88
|
+
moved: false
|
|
89
|
+
};
|
|
90
|
+
rail.setPointerCapture(event.pointerId);
|
|
91
|
+
}
|
|
92
|
+
function onPointerMove(event) {
|
|
93
|
+
if (!drag) return;
|
|
94
|
+
const delta = event.clientX - drag.startX;
|
|
95
|
+
if (!drag.moved) {
|
|
96
|
+
if (Math.abs(delta) < DRAG_THRESHOLD) return;
|
|
97
|
+
drag.moved = true;
|
|
98
|
+
rail.classList.add(DRAGGING_CLASS);
|
|
99
|
+
}
|
|
100
|
+
rail.scrollLeft = drag.scrollLeft - delta;
|
|
101
|
+
}
|
|
102
|
+
function onPointerUp(event) {
|
|
103
|
+
if (!drag) return;
|
|
104
|
+
const { moved, page: from, startX } = drag;
|
|
105
|
+
drag = null;
|
|
106
|
+
if (rail.hasPointerCapture(event.pointerId)) {
|
|
107
|
+
rail.releasePointerCapture(event.pointerId);
|
|
108
|
+
}
|
|
109
|
+
if (!moved) return;
|
|
110
|
+
rail.classList.remove(DRAGGING_CLASS);
|
|
111
|
+
const direction = event.clientX < startX ? 1 : -1;
|
|
112
|
+
const nearest = getActivePage(rail, startsRef.current);
|
|
113
|
+
goTo(nearest === from ? from + direction : nearest);
|
|
114
|
+
rail.addEventListener("click", suppressClick, { capture: true, once: true });
|
|
115
|
+
setTimeout(() => rail.removeEventListener("click", suppressClick, { capture: true }));
|
|
116
|
+
}
|
|
117
|
+
const resizeObserver = typeof ResizeObserver !== "undefined" ? new ResizeObserver(measure) : void 0;
|
|
118
|
+
function observeSlides() {
|
|
119
|
+
resizeObserver == null ? void 0 : resizeObserver.disconnect();
|
|
120
|
+
resizeObserver == null ? void 0 : resizeObserver.observe(rail);
|
|
121
|
+
Array.from(rail.children).forEach((slide) => resizeObserver == null ? void 0 : resizeObserver.observe(slide));
|
|
122
|
+
}
|
|
123
|
+
const mutationObserver = new MutationObserver(() => {
|
|
124
|
+
observeSlides();
|
|
125
|
+
measure();
|
|
126
|
+
});
|
|
127
|
+
measure();
|
|
128
|
+
observeSlides();
|
|
129
|
+
mutationObserver.observe(rail, { childList: true });
|
|
130
|
+
rail.addEventListener("scroll", onScroll, { passive: true });
|
|
131
|
+
rail.addEventListener("pointerdown", onPointerDown);
|
|
132
|
+
rail.addEventListener("pointermove", onPointerMove);
|
|
133
|
+
rail.addEventListener("pointerup", onPointerUp);
|
|
134
|
+
rail.addEventListener("pointercancel", onPointerUp);
|
|
135
|
+
return () => {
|
|
136
|
+
cancelAnimationFrame(frame);
|
|
137
|
+
resizeObserver == null ? void 0 : resizeObserver.disconnect();
|
|
138
|
+
mutationObserver.disconnect();
|
|
139
|
+
rail.removeEventListener("scroll", onScroll);
|
|
140
|
+
rail.removeEventListener("pointerdown", onPointerDown);
|
|
141
|
+
rail.removeEventListener("pointermove", onPointerMove);
|
|
142
|
+
rail.removeEventListener("pointerup", onPointerUp);
|
|
143
|
+
rail.removeEventListener("pointercancel", onPointerUp);
|
|
144
|
+
};
|
|
145
|
+
}, [goTo]);
|
|
146
|
+
return { railRef, page, pageCount, goTo };
|
|
147
|
+
}
|
|
148
|
+
const DEFAULT_GAP = 16;
|
|
149
|
+
function _itemsPerViewStyle(itemsPerView) {
|
|
150
|
+
if (itemsPerView === void 0) return {};
|
|
151
|
+
const { mobile, desktop } = typeof itemsPerView === "number" ? { mobile: itemsPerView, desktop: void 0 } : itemsPerView;
|
|
152
|
+
return {
|
|
153
|
+
...mobile !== void 0 && { "--au-carousel-items": mobile },
|
|
154
|
+
...desktop !== void 0 && { "--au-carousel-items-desktop": desktop }
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
const CarouselRoot = ({
|
|
158
|
+
children,
|
|
159
|
+
navigation = "text",
|
|
160
|
+
negative = false,
|
|
161
|
+
pageLabel = "Página",
|
|
162
|
+
label = "Carrossel",
|
|
163
|
+
gap = DEFAULT_GAP,
|
|
164
|
+
itemsPerView,
|
|
165
|
+
draggable = true,
|
|
166
|
+
onPageChange,
|
|
167
|
+
className,
|
|
168
|
+
"data-testid": dataTestId
|
|
169
|
+
}) => {
|
|
170
|
+
const { railRef, page, pageCount, goTo } = useCarousel({ draggable, onPageChange });
|
|
171
|
+
const hasArrows = navigation !== "only-pin";
|
|
172
|
+
const hasPins = navigation !== "text";
|
|
173
|
+
const total = Math.max(pageCount, 1);
|
|
174
|
+
const status = [pageLabel.trim(), `${page + 1} de ${total}`].filter(Boolean).join(" ");
|
|
175
|
+
const pinLabel = pageLabel.trim() || "Página";
|
|
176
|
+
const classes = classNames("au-carousel", `au-carousel--navigation-${navigation}`, {
|
|
177
|
+
"au-carousel--negative": negative,
|
|
178
|
+
"au-carousel--draggable": draggable,
|
|
179
|
+
"au-carousel--items-per-view": itemsPerView !== void 0,
|
|
180
|
+
[String(className)]: !!className
|
|
181
|
+
});
|
|
182
|
+
const style = {
|
|
183
|
+
"--au-carousel-gap": `${gap}px`,
|
|
184
|
+
..._itemsPerViewStyle(itemsPerView)
|
|
185
|
+
};
|
|
186
|
+
return /* @__PURE__ */ jsxs(
|
|
187
|
+
"div",
|
|
188
|
+
{
|
|
189
|
+
className: classes,
|
|
190
|
+
role: "region",
|
|
191
|
+
"aria-roledescription": "carrossel",
|
|
192
|
+
"aria-label": label,
|
|
193
|
+
style,
|
|
194
|
+
"data-testid": dataTestId,
|
|
195
|
+
children: [
|
|
196
|
+
/* @__PURE__ */ jsx("div", { className: "au-carousel__rail", ref: railRef, children }),
|
|
197
|
+
/* @__PURE__ */ jsxs("div", { className: "au-carousel__nav", hidden: pageCount <= 1, children: [
|
|
198
|
+
hasArrows && /* @__PURE__ */ jsx(
|
|
199
|
+
Button,
|
|
200
|
+
{
|
|
201
|
+
className: "au-carousel__arrow au-carousel__arrow--previous",
|
|
202
|
+
type: "outlined",
|
|
203
|
+
round: true,
|
|
204
|
+
negative,
|
|
205
|
+
disabled: page === 0,
|
|
206
|
+
"aria-label": "Anterior",
|
|
207
|
+
onClick: () => goTo(page - 1),
|
|
208
|
+
children: /* @__PURE__ */ jsx(IconChevronLeft, {})
|
|
209
|
+
}
|
|
210
|
+
),
|
|
211
|
+
/* @__PURE__ */ jsx(
|
|
212
|
+
"span",
|
|
213
|
+
{
|
|
214
|
+
className: classNames("au-carousel__status", {
|
|
215
|
+
"au-carousel__status--hidden": hasPins
|
|
216
|
+
}),
|
|
217
|
+
"aria-live": "polite",
|
|
218
|
+
"aria-atomic": "true",
|
|
219
|
+
children: status
|
|
220
|
+
}
|
|
221
|
+
),
|
|
222
|
+
hasPins && /* @__PURE__ */ jsx("div", { className: "au-carousel__pins", children: Array.from({ length: total }, (_, index) => /* @__PURE__ */ jsx(
|
|
223
|
+
"button",
|
|
224
|
+
{
|
|
225
|
+
type: "button",
|
|
226
|
+
className: classNames("au-carousel__pin", {
|
|
227
|
+
"au-carousel__pin--active": index === page
|
|
228
|
+
}),
|
|
229
|
+
"aria-label": `${pinLabel} ${index + 1}`,
|
|
230
|
+
"aria-current": index === page ? "true" : void 0,
|
|
231
|
+
onClick: () => goTo(index)
|
|
232
|
+
},
|
|
233
|
+
index
|
|
234
|
+
)) }),
|
|
235
|
+
hasArrows && /* @__PURE__ */ jsx(
|
|
236
|
+
Button,
|
|
237
|
+
{
|
|
238
|
+
className: "au-carousel__arrow au-carousel__arrow--next",
|
|
239
|
+
type: "outlined",
|
|
240
|
+
round: true,
|
|
241
|
+
negative,
|
|
242
|
+
disabled: page >= total - 1,
|
|
243
|
+
"aria-label": "Próximo",
|
|
244
|
+
onClick: () => goTo(page + 1),
|
|
245
|
+
children: /* @__PURE__ */ jsx(IconChevronRight, {})
|
|
246
|
+
}
|
|
247
|
+
)
|
|
248
|
+
] })
|
|
249
|
+
]
|
|
250
|
+
}
|
|
251
|
+
);
|
|
252
|
+
};
|
|
253
|
+
export {
|
|
254
|
+
CarouselRoot
|
|
255
|
+
};
|
|
256
|
+
//# sourceMappingURL=index.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../../../../lib/components/Carousel/Root/hooks.ts","../../../../lib/components/Carousel/Root/index.tsx"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react'\n\n/** Pointer travel, in px, before a mouse press becomes a drag (a click below it still reaches the slide). */\nconst DRAG_THRESHOLD = 5\nconst DRAGGING_CLASS = 'au-carousel__rail--dragging'\n\n/**\n * Groups the slides into pages. A page starts at a slide and holds every\n * following slide that still fits, whole, in the rail's visible width.\n * Returns the scroll position of each page (the `offsetLeft` of its first\n * slide, which is also where CSS snaps). The rail is `position: relative`,\n * so `offsetLeft` is measured from the rail itself.\n */\nexport function getPageStarts(rail: HTMLElement): number[] {\n const slides = Array.from(rail.children) as HTMLElement[]\n const viewport = rail.clientWidth\n const starts: number[] = []\n let index = 0\n\n while (index < slides.length) {\n const start = slides[index].offsetLeft\n starts.push(start)\n let next = index + 1\n while (\n next < slides.length &&\n slides[next].offsetLeft + slides[next].offsetWidth <= start + viewport + 1\n ) {\n next += 1\n }\n index = next\n }\n\n return starts\n}\n\n/**\n * The page the rail is scrolled to: the one whose start is nearest to\n * `scrollLeft`, or the last page once the rail cannot scroll any further\n * (its start may lie past the maximum scroll, where the browser clamps it).\n */\nexport function getActivePage(rail: HTMLElement, starts: number[]): number {\n if (starts.length === 0) return 0\n\n const { scrollLeft } = rail\n const maxScroll = rail.scrollWidth - rail.clientWidth\n if (scrollLeft >= maxScroll - 1) return starts.length - 1\n\n let nearest = 0\n starts.forEach((start, index) => {\n if (Math.abs(start - scrollLeft) < Math.abs(starts[nearest] - scrollLeft)) {\n nearest = index\n }\n })\n return nearest\n}\n\ntype UseCarouselArgs = {\n draggable: boolean\n onPageChange?: (page: number, pageCount: number) => void\n}\n\n/**\n * Measures the rail, follows its scroll position and exposes `goTo`. Pages\n * are re-measured when the rail or a slide changes size (ResizeObserver) and\n * when slides are added, removed or replaced (MutationObserver), so a\n * skeleton turning into a card or a tab swapping the list keeps the\n * navigation right. Mouse drag follows the pointer with snapping off and\n * settles on a page on release; touch scrolls natively.\n */\nexport function useCarousel({ draggable, onPageChange }: UseCarouselArgs) {\n const railRef = useRef<HTMLDivElement>(null)\n const startsRef = useRef<number[]>([])\n const pageRef = useRef(0)\n const draggableRef = useRef(draggable)\n const onPageChangeRef = useRef(onPageChange)\n const [page, setPage] = useState(0)\n const [pageCount, setPageCount] = useState(0)\n\n draggableRef.current = draggable\n onPageChangeRef.current = onPageChange\n\n const goTo = useCallback((target: number) => {\n const rail = railRef.current\n const starts = startsRef.current\n if (!rail || target < 0 || target >= starts.length) return\n rail.scrollTo({ left: starts[target] })\n }, [])\n\n useEffect(() => {\n const rail = railRef.current\n if (!rail) return\n\n function setActive(next: number) {\n if (next === pageRef.current) return\n pageRef.current = next\n setPage(next)\n onPageChangeRef.current?.(next + 1, startsRef.current.length)\n }\n\n function measure() {\n startsRef.current = getPageStarts(rail!)\n setPageCount(startsRef.current.length)\n setActive(getActivePage(rail!, startsRef.current))\n }\n\n let frame = 0\n function onScroll() {\n cancelAnimationFrame(frame)\n frame = requestAnimationFrame(() => {\n setActive(getActivePage(rail!, startsRef.current))\n })\n }\n\n let drag: { startX: number; scrollLeft: number; page: number; moved: boolean } | null = null\n\n function suppressClick(event: Event) {\n event.stopPropagation()\n event.preventDefault()\n }\n\n function onPointerDown(event: PointerEvent) {\n if (!draggableRef.current || event.pointerType !== 'mouse' || event.button !== 0) return\n drag = {\n startX: event.clientX,\n scrollLeft: rail!.scrollLeft,\n page: pageRef.current,\n moved: false,\n }\n rail!.setPointerCapture(event.pointerId)\n }\n\n function onPointerMove(event: PointerEvent) {\n if (!drag) return\n const delta = event.clientX - drag.startX\n if (!drag.moved) {\n if (Math.abs(delta) < DRAG_THRESHOLD) return\n drag.moved = true\n rail!.classList.add(DRAGGING_CLASS)\n }\n rail!.scrollLeft = drag.scrollLeft - delta\n }\n\n function onPointerUp(event: PointerEvent) {\n if (!drag) return\n const { moved, page: from, startX } = drag\n drag = null\n if (rail!.hasPointerCapture(event.pointerId)) {\n rail!.releasePointerCapture(event.pointerId)\n }\n if (!moved) return\n\n rail!.classList.remove(DRAGGING_CLASS)\n const direction = event.clientX < startX ? 1 : -1\n const nearest = getActivePage(rail!, startsRef.current)\n goTo(nearest === from ? from + direction : nearest)\n\n // The click that ends a drag must not reach the slide. It fires in the\n // same task as `pointerup`, so the listener is gone by the next one.\n rail!.addEventListener('click', suppressClick, { capture: true, once: true })\n setTimeout(() => rail!.removeEventListener('click', suppressClick, { capture: true }))\n }\n\n const resizeObserver =\n typeof ResizeObserver !== 'undefined' ? new ResizeObserver(measure) : undefined\n\n function observeSlides() {\n resizeObserver?.disconnect()\n resizeObserver?.observe(rail!)\n Array.from(rail!.children).forEach((slide) => resizeObserver?.observe(slide))\n }\n\n const mutationObserver = new MutationObserver(() => {\n observeSlides()\n measure()\n })\n\n measure()\n observeSlides()\n mutationObserver.observe(rail, { childList: true })\n rail.addEventListener('scroll', onScroll, { passive: true })\n rail.addEventListener('pointerdown', onPointerDown)\n rail.addEventListener('pointermove', onPointerMove)\n rail.addEventListener('pointerup', onPointerUp)\n rail.addEventListener('pointercancel', onPointerUp)\n\n return () => {\n cancelAnimationFrame(frame)\n resizeObserver?.disconnect()\n mutationObserver.disconnect()\n rail.removeEventListener('scroll', onScroll)\n rail.removeEventListener('pointerdown', onPointerDown)\n rail.removeEventListener('pointermove', onPointerMove)\n rail.removeEventListener('pointerup', onPointerUp)\n rail.removeEventListener('pointercancel', onPointerUp)\n }\n }, [goTo])\n\n return { railRef, page, pageCount, goTo }\n}\n","import classNames from 'classnames'\nimport { CSSProperties, ReactNode } from 'react'\nimport { Button } from '@components/Button'\nimport { IconChevronLeft, IconChevronRight } from '@components/icons'\nimport { useCarousel } from './hooks'\n\nexport type CarouselNavigation = 'text' | 'pin' | 'only-pin'\n\nexport type CarouselItemsPerView = number | { mobile?: number; desktop?: number }\n\nexport type CarouselRootProps = {\n children: ReactNode\n navigation?: CarouselNavigation\n negative?: boolean\n pageLabel?: string\n label?: string\n gap?: number\n itemsPerView?: CarouselItemsPerView\n draggable?: boolean\n onPageChange?: (page: number, pageCount: number) => void\n className?: string\n 'data-testid'?: string\n}\n\nconst DEFAULT_GAP = 16\n\nfunction _itemsPerViewStyle(itemsPerView?: CarouselItemsPerView): CSSProperties {\n if (itemsPerView === undefined) return {}\n const { mobile, desktop } =\n typeof itemsPerView === 'number' ? { mobile: itemsPerView, desktop: undefined } : itemsPerView\n return {\n ...(mobile !== undefined && { '--au-carousel-items': mobile }),\n ...(desktop !== undefined && { '--au-carousel-items-desktop': desktop }),\n } as CSSProperties\n}\n\nexport const CarouselRoot = ({\n children,\n navigation = 'text',\n negative = false,\n pageLabel = 'Página',\n label = 'Carrossel',\n gap = DEFAULT_GAP,\n itemsPerView,\n draggable = true,\n onPageChange,\n className,\n 'data-testid': dataTestId,\n}: CarouselRootProps) => {\n const { railRef, page, pageCount, goTo } = useCarousel({ draggable, onPageChange })\n\n const hasArrows = navigation !== 'only-pin'\n const hasPins = navigation !== 'text'\n const total = Math.max(pageCount, 1)\n const status = [pageLabel.trim(), `${page + 1} de ${total}`].filter(Boolean).join(' ')\n const pinLabel = pageLabel.trim() || 'Página'\n\n const classes = classNames('au-carousel', `au-carousel--navigation-${navigation}`, {\n 'au-carousel--negative': negative,\n 'au-carousel--draggable': draggable,\n 'au-carousel--items-per-view': itemsPerView !== undefined,\n [String(className)]: !!className,\n })\n\n const style = {\n '--au-carousel-gap': `${gap}px`,\n ..._itemsPerViewStyle(itemsPerView),\n } as CSSProperties\n\n return (\n <div\n className={classes}\n role=\"region\"\n aria-roledescription=\"carrossel\"\n aria-label={label}\n style={style}\n data-testid={dataTestId}>\n <div className=\"au-carousel__rail\" ref={railRef}>\n {children}\n </div>\n\n <div className=\"au-carousel__nav\" hidden={pageCount <= 1}>\n {hasArrows && (\n <Button\n className=\"au-carousel__arrow au-carousel__arrow--previous\"\n type=\"outlined\"\n round\n negative={negative}\n disabled={page === 0}\n aria-label=\"Anterior\"\n onClick={() => goTo(page - 1)}>\n <IconChevronLeft />\n </Button>\n )}\n\n <span\n className={classNames('au-carousel__status', {\n 'au-carousel__status--hidden': hasPins,\n })}\n aria-live=\"polite\"\n aria-atomic=\"true\">\n {status}\n </span>\n\n {hasPins && (\n <div className=\"au-carousel__pins\">\n {Array.from({ length: total }, (_, index) => (\n <button\n key={index}\n type=\"button\"\n className={classNames('au-carousel__pin', {\n 'au-carousel__pin--active': index === page,\n })}\n aria-label={`${pinLabel} ${index + 1}`}\n aria-current={index === page ? 'true' : undefined}\n onClick={() => goTo(index)}\n />\n ))}\n </div>\n )}\n\n {hasArrows && (\n <Button\n className=\"au-carousel__arrow au-carousel__arrow--next\"\n type=\"outlined\"\n round\n negative={negative}\n disabled={page >= total - 1}\n aria-label=\"Próximo\"\n onClick={() => goTo(page + 1)}>\n <IconChevronRight />\n </Button>\n )}\n </div>\n </div>\n )\n}\n"],"names":[],"mappings":";;;;;;;AAGA,MAAM,iBAAiB;AACvB,MAAM,iBAAiB;AAShB,SAAS,cAAc,MAA6B;AACzD,QAAM,SAAS,MAAM,KAAK,KAAK,QAAQ;AACvC,QAAM,WAAW,KAAK;AACtB,QAAM,SAAmB,CAAA;AACzB,MAAI,QAAQ;AAEZ,SAAO,QAAQ,OAAO,QAAQ;AAC5B,UAAM,QAAQ,OAAO,KAAK,EAAE;AAC5B,WAAO,KAAK,KAAK;AACjB,QAAI,OAAO,QAAQ;AACnB,WACE,OAAO,OAAO,UACd,OAAO,IAAI,EAAE,aAAa,OAAO,IAAI,EAAE,eAAe,QAAQ,WAAW,GACzE;AACA,cAAQ;AAAA,IACV;AACA,YAAQ;AAAA,EACV;AAEA,SAAO;AACT;AAOO,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AAA,cACV,MAAK;AAAA,cACL,OAAK;AAAA,cACL;AAAA,cACA,UAAU,SAAS;AAAA,cACnB,cAAW;AAAA,cACX,SAAS,MAAM,KAAK,OAAO,CAAC;AAAA,cAC5B,8BAAC,iBAAA,CAAA,CAAgB;AAAA,YAAA;AAAA,UAAA;AAAA,UAIrB;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAW,WAAW,uBAAuB;AAAA,gBAC3C,+BAA+B;AAAA,cAAA,CAChC;AAAA,cACD,aAAU;AAAA,cACV,eAAY;AAAA,cACX,UAAA;AAAA,YAAA;AAAA,UAAA;AAAA,UAGF,WACC,oBAAC,OAAA,EAAI,WAAU,qBACZ,UAAA,MAAM,KAAK,EAAE,QAAQ,MAAA,GAAS,CAAC,GAAG,UACjC;AAAA,YAAC;AAAA,YAAA;AAAA,cAEC,MAAK;AAAA,cACL,WAAW,WAAW,oBAAoB;AAAA,gBACxC,4BAA4B,UAAU;AAAA,cAAA,CACvC;AAAA,cACD,cAAY,GAAG,QAAQ,IAAI,QAAQ,CAAC;AAAA,cACpC,gBAAc,UAAU,OAAO,SAAS;AAAA,cACxC,SAAS,MAAM,KAAK,KAAK;AAAA,YAAA;AAAA,YAPpB;AAAA,UAAA,CASR,GACH;AAAA,UAGD,aACC;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAU;AAAA,cACV,MAAK;AAAA,cACL,OAAK;AAAA,cACL;AAAA,cACA,UAAU,QAAQ,QAAQ;AAAA,cAC1B,cAAW;AAAA,cACX,SAAS,MAAM,KAAK,OAAO,CAAC;AAAA,cAC5B,8BAAC,kBAAA,CAAA,CAAiB;AAAA,YAAA;AAAA,UAAA;AAAA,QACpB,EAAA,CAEJ;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CarouselItemProps } from './Item';
|
|
2
|
+
import { CarouselRootProps } from './Root';
|
|
3
|
+
export type { CarouselItemsPerView, CarouselNavigation, CarouselRootProps, } from './Root';
|
|
4
|
+
export type { CarouselItemProps } from './Item';
|
|
5
|
+
type Components = {
|
|
6
|
+
Root: React.FC<CarouselRootProps>;
|
|
7
|
+
Item: React.FC<CarouselItemProps>;
|
|
8
|
+
};
|
|
9
|
+
declare const components: Components;
|
|
10
|
+
export { components as Carousel };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CarouselItem } from "./Item/index.es.js";
|
|
2
|
+
import { CarouselRoot } from "./Root/index.es.js";
|
|
3
|
+
import './styles.css';const components = {
|
|
4
|
+
Root: CarouselRoot,
|
|
5
|
+
Item: CarouselItem
|
|
6
|
+
};
|
|
7
|
+
Object.keys(components).forEach((key) => {
|
|
8
|
+
const component = components[key];
|
|
9
|
+
component.displayName = `Carousel.${key}`;
|
|
10
|
+
});
|
|
11
|
+
export {
|
|
12
|
+
components as Carousel
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=index.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../../../lib/components/Carousel/index.tsx"],"sourcesContent":["import { CarouselItem, CarouselItemProps } from './Item'\nimport { CarouselRoot, CarouselRootProps } from './Root'\nimport './styles.scss'\n\nexport type {\n CarouselItemsPerView,\n CarouselNavigation,\n CarouselRootProps,\n} from './Root'\nexport type { CarouselItemProps } from './Item'\n\ntype Components = {\n Root: React.FC<CarouselRootProps>\n Item: React.FC<CarouselItemProps>\n}\n\nconst components: Components = {\n Root: CarouselRoot,\n Item: CarouselItem,\n}\n\nObject.keys(components).forEach((key) => {\n const component = components[key as keyof Components]\n component.displayName = `Carousel.${key}`\n})\n\nexport { components as Carousel }\n"],"names":[],"mappings":";;AAgBA,MAAM,aAAyB;AAAA,EAC7B,MAAM;AAAA,EACN,MAAM;AACR;AAEA,OAAO,KAAK,UAAU,EAAE,QAAQ,CAAC,QAAQ;AACvC,QAAM,YAAY,WAAW,GAAuB;AACpD,YAAU,cAAc,YAAY,GAAG;AACzC,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.au-carousel{
|
|
1
|
+
.au-carousel{--au-carousel-gap: 16px;position:relative}.au-carousel__rail{position:relative;display:flex;gap:var(--au-carousel-gap);overflow-x:auto;overscroll-behavior-x:contain;scroll-snap-type:x mandatory;scrollbar-width:none}.au-carousel__rail::-webkit-scrollbar{display:none}@media(prefers-reduced-motion:no-preference){.au-carousel__rail{scroll-behavior:smooth}}.au-carousel__rail--dragging{scroll-snap-type:none;scroll-behavior:auto;cursor:grabbing;-webkit-user-select:none;user-select:none}.au-carousel--draggable .au-carousel__rail{cursor:grab}.au-carousel__item{flex:0 0 auto;min-width:0;scroll-snap-align:start}.au-carousel--items-per-view .au-carousel__item{flex-basis:calc((100% - var(--au-carousel-gap) * (var(--au-carousel-items) - 1)) / var(--au-carousel-items))}@media(min-width:600px){.au-carousel--items-per-view .au-carousel__item{flex-basis:calc((100% - var(--au-carousel-gap) * (var(--au-carousel-items-desktop, var(--au-carousel-items)) - 1)) / var(--au-carousel-items-desktop, var(--au-carousel-items)))}}.au-carousel__nav{display:flex;align-items:center;justify-content:space-between;gap:16px;width:273px;max-width:100%;margin:24px auto 0}.au-carousel__nav[hidden]{display:none}.au-carousel--navigation-only-pin .au-carousel__nav{justify-content:center;width:auto}.au-carousel__arrow{flex:none}.au-carousel__status{font-family:"Source Sans 3",sans-serif;font-size:16px;font-weight:400;line-height:24px;color:#454a54;text-align:center}.au-carousel__status--hidden{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}.au-carousel--negative .au-carousel__status{color:#fff}.au-carousel__pins{display:flex;align-items:center;gap:8px}.au-carousel__pin{position:relative;width:8px;height:8px;padding:0;border:0;border-radius:999px;background-color:#e2e4e9;cursor:pointer;transition:width .2s ease,background-color .2s ease}.au-carousel__pin:before{content:"";position:absolute;top:-8px;right:-8px;bottom:-8px;left:-8px}.au-carousel__pin:focus-visible{outline:none;box-shadow:0 0 0 2px #fff,0 0 0 4px #0048db}.au-carousel__pin--active{width:38px;background-color:#16181d}.au-carousel--negative .au-carousel__pin{background-color:#fff6}.au-carousel--negative .au-carousel__pin--active{background-color:#fff}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type PaginationProps = {
|
|
2
|
+
currentPage: number;
|
|
3
|
+
totalItems: number;
|
|
4
|
+
pageSize: number;
|
|
5
|
+
pageSizeOptions?: number[];
|
|
6
|
+
showState?: boolean;
|
|
7
|
+
showQuantity?: boolean;
|
|
8
|
+
onPageChange?: (page: number) => void;
|
|
9
|
+
onPageSizeChange?: (pageSize: number) => void;
|
|
10
|
+
itemsPerPageLabel?: string;
|
|
11
|
+
className?: string;
|
|
12
|
+
'data-testid'?: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const Pagination: ({ currentPage, totalItems, pageSize, pageSizeOptions, showState, showQuantity, onPageChange, onPageSizeChange, itemsPerPageLabel, className, "data-testid": dataTestId, }: PaginationProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { c as classNames } from "../../index-BW2ZU5Hx.js";
|
|
3
|
+
import { useId } from "react";
|
|
4
|
+
import { Button } from "../Button/index.es.js";
|
|
5
|
+
import "../Icon/index.es.js";
|
|
6
|
+
import { IconChevronDown } from "../icons/IconChevronDown/index.es.js";
|
|
7
|
+
import { IconChevronLeft } from "../icons/IconChevronLeft/index.es.js";
|
|
8
|
+
import { IconChevronRight } from "../icons/IconChevronRight/index.es.js";
|
|
9
|
+
import './styles.css';const DEFAULT_PAGE_SIZE_OPTIONS = [20, 50, 100];
|
|
10
|
+
const FIRST_PAGE = 1;
|
|
11
|
+
const ELLIPSIS = "ellipsis";
|
|
12
|
+
const VISIBLE_SLOTS = 7;
|
|
13
|
+
const EDGE_RUN = 5;
|
|
14
|
+
const NEIGHBOURS = 1;
|
|
15
|
+
const formatNumber = (value) => new Intl.NumberFormat("pt-BR").format(value);
|
|
16
|
+
function _range(from, to) {
|
|
17
|
+
return Array.from({ length: to - from + 1 }, (_, index) => from + index);
|
|
18
|
+
}
|
|
19
|
+
function _getPageItems(currentPage, totalPages) {
|
|
20
|
+
const lastPage = totalPages;
|
|
21
|
+
const everyPageFits = totalPages <= VISIBLE_SLOTS;
|
|
22
|
+
if (everyPageFits) return _range(FIRST_PAGE, lastPage);
|
|
23
|
+
const startRunEnd = EDGE_RUN;
|
|
24
|
+
const isNearStart = currentPage + NEIGHBOURS <= startRunEnd;
|
|
25
|
+
if (isNearStart) return [..._range(FIRST_PAGE, startRunEnd), ELLIPSIS, lastPage];
|
|
26
|
+
const endRunStart = lastPage - EDGE_RUN + 1;
|
|
27
|
+
const isNearEnd = currentPage - NEIGHBOURS >= endRunStart;
|
|
28
|
+
if (isNearEnd) return [FIRST_PAGE, ELLIPSIS, ..._range(endRunStart, lastPage)];
|
|
29
|
+
return [
|
|
30
|
+
FIRST_PAGE,
|
|
31
|
+
ELLIPSIS,
|
|
32
|
+
..._range(currentPage - NEIGHBOURS, currentPage + NEIGHBOURS),
|
|
33
|
+
ELLIPSIS,
|
|
34
|
+
lastPage
|
|
35
|
+
];
|
|
36
|
+
}
|
|
37
|
+
const Pagination = ({
|
|
38
|
+
currentPage,
|
|
39
|
+
totalItems,
|
|
40
|
+
pageSize,
|
|
41
|
+
pageSizeOptions = DEFAULT_PAGE_SIZE_OPTIONS,
|
|
42
|
+
showState = true,
|
|
43
|
+
showQuantity = true,
|
|
44
|
+
onPageChange,
|
|
45
|
+
onPageSizeChange,
|
|
46
|
+
itemsPerPageLabel = "Itens por página",
|
|
47
|
+
className,
|
|
48
|
+
"data-testid": dataTestId
|
|
49
|
+
}) => {
|
|
50
|
+
const selectId = `au-pagination-page-size-${useId()}`;
|
|
51
|
+
const totalPages = Math.max(1, Math.ceil(totalItems / pageSize));
|
|
52
|
+
const page = Math.min(Math.max(1, currentPage), totalPages);
|
|
53
|
+
const isFirst = page === 1;
|
|
54
|
+
const isLast = page === totalPages;
|
|
55
|
+
const firstItem = totalItems === 0 ? 0 : (page - 1) * pageSize + 1;
|
|
56
|
+
const lastItem = Math.min(page * pageSize, totalItems);
|
|
57
|
+
const options = pageSizeOptions.includes(pageSize) ? pageSizeOptions : [...pageSizeOptions, pageSize].sort((a, b) => a - b);
|
|
58
|
+
function _goTo(next) {
|
|
59
|
+
if (next < 1 || next > totalPages || next === page) return;
|
|
60
|
+
onPageChange == null ? void 0 : onPageChange(next);
|
|
61
|
+
}
|
|
62
|
+
return /* @__PURE__ */ jsxs(
|
|
63
|
+
"nav",
|
|
64
|
+
{
|
|
65
|
+
className: classNames("au-pagination", className),
|
|
66
|
+
"aria-label": "Paginação",
|
|
67
|
+
"data-testid": dataTestId,
|
|
68
|
+
children: [
|
|
69
|
+
showState && /* @__PURE__ */ jsx("span", { className: "au-pagination__state", children: `${formatNumber(firstItem)}-${formatNumber(lastItem)} de ${formatNumber(totalItems)}` }),
|
|
70
|
+
/* @__PURE__ */ jsxs("div", { className: "au-pagination__pages", children: [
|
|
71
|
+
/* @__PURE__ */ jsx(
|
|
72
|
+
Button,
|
|
73
|
+
{
|
|
74
|
+
className: "au-pagination__nav au-pagination__nav--previous",
|
|
75
|
+
type: "outlined",
|
|
76
|
+
round: true,
|
|
77
|
+
disabled: isFirst,
|
|
78
|
+
"aria-label": "Página anterior",
|
|
79
|
+
onClick: () => _goTo(page - 1),
|
|
80
|
+
children: /* @__PURE__ */ jsx(IconChevronLeft, {})
|
|
81
|
+
}
|
|
82
|
+
),
|
|
83
|
+
/* @__PURE__ */ jsx("ul", { className: "au-pagination__list", children: _getPageItems(page, totalPages).map(
|
|
84
|
+
(item, index) => item === "ellipsis" ? /* @__PURE__ */ jsx("li", { className: "au-pagination__item", children: /* @__PURE__ */ jsx("span", { className: "au-pagination__ellipsis", "aria-hidden": "true", children: "..." }) }, `ellipsis-${index}`) : /* @__PURE__ */ jsx("li", { className: "au-pagination__item", children: /* @__PURE__ */ jsx(
|
|
85
|
+
"button",
|
|
86
|
+
{
|
|
87
|
+
type: "button",
|
|
88
|
+
className: classNames("au-pagination__page", {
|
|
89
|
+
"au-pagination__page--active": item === page
|
|
90
|
+
}),
|
|
91
|
+
"aria-current": item === page ? "page" : void 0,
|
|
92
|
+
"aria-label": `Página ${item}`,
|
|
93
|
+
onClick: () => _goTo(item),
|
|
94
|
+
children: item
|
|
95
|
+
}
|
|
96
|
+
) }, item)
|
|
97
|
+
) }),
|
|
98
|
+
/* @__PURE__ */ jsx(
|
|
99
|
+
Button,
|
|
100
|
+
{
|
|
101
|
+
className: "au-pagination__nav au-pagination__nav--next",
|
|
102
|
+
type: "outlined",
|
|
103
|
+
round: true,
|
|
104
|
+
disabled: isLast,
|
|
105
|
+
"aria-label": "Próxima página",
|
|
106
|
+
onClick: () => _goTo(page + 1),
|
|
107
|
+
children: /* @__PURE__ */ jsx(IconChevronRight, {})
|
|
108
|
+
}
|
|
109
|
+
)
|
|
110
|
+
] }),
|
|
111
|
+
showQuantity && /* @__PURE__ */ jsxs("div", { className: "au-pagination__page-size", children: [
|
|
112
|
+
/* @__PURE__ */ jsx(
|
|
113
|
+
"label",
|
|
114
|
+
{
|
|
115
|
+
className: "au-pagination__page-size-label",
|
|
116
|
+
htmlFor: selectId,
|
|
117
|
+
children: itemsPerPageLabel
|
|
118
|
+
}
|
|
119
|
+
),
|
|
120
|
+
/* @__PURE__ */ jsxs("span", { className: "au-pagination__page-size-field", children: [
|
|
121
|
+
/* @__PURE__ */ jsx(
|
|
122
|
+
"select",
|
|
123
|
+
{
|
|
124
|
+
id: selectId,
|
|
125
|
+
className: "au-pagination__page-size-select",
|
|
126
|
+
value: pageSize,
|
|
127
|
+
onChange: (event) => onPageSizeChange == null ? void 0 : onPageSizeChange(Number(event.target.value)),
|
|
128
|
+
children: options.map((option) => /* @__PURE__ */ jsx("option", { value: option, children: option }, option))
|
|
129
|
+
}
|
|
130
|
+
),
|
|
131
|
+
/* @__PURE__ */ jsx(IconChevronDown, {})
|
|
132
|
+
] })
|
|
133
|
+
] })
|
|
134
|
+
]
|
|
135
|
+
}
|
|
136
|
+
);
|
|
137
|
+
};
|
|
138
|
+
export {
|
|
139
|
+
Pagination
|
|
140
|
+
};
|
|
141
|
+
//# sourceMappingURL=index.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../../../lib/components/Pagination/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport { useId } from 'react'\nimport { Button } from '@components/Button'\nimport {\n IconChevronDown,\n IconChevronLeft,\n IconChevronRight,\n} from '@components/icons'\nimport './styles.scss'\n\nexport type PaginationProps = {\n currentPage: number\n totalItems: number\n pageSize: number\n pageSizeOptions?: number[]\n showState?: boolean\n showQuantity?: boolean\n onPageChange?: (page: number) => void\n onPageSizeChange?: (pageSize: number) => void\n itemsPerPageLabel?: string\n className?: string\n 'data-testid'?: string\n}\n\ntype PageItem = number | 'ellipsis'\n\nconst DEFAULT_PAGE_SIZE_OPTIONS = [20, 50, 100]\nconst FIRST_PAGE = 1\nconst ELLIPSIS: PageItem = 'ellipsis'\nconst VISIBLE_SLOTS = 7\nconst EDGE_RUN = 5\nconst NEIGHBOURS = 1\n\nconst formatNumber = (value: number) =>\n new Intl.NumberFormat('pt-BR').format(value)\n\nfunction _range(from: number, to: number) {\n return Array.from({ length: to - from + 1 }, (_, index) => from + index)\n}\n\nfunction _getPageItems(currentPage: number, totalPages: number): PageItem[] {\n const lastPage = totalPages\n\n const everyPageFits = totalPages <= VISIBLE_SLOTS\n if (everyPageFits) return _range(FIRST_PAGE, lastPage)\n\n const startRunEnd = EDGE_RUN\n const isNearStart = currentPage + NEIGHBOURS <= startRunEnd\n if (isNearStart) return [..._range(FIRST_PAGE, startRunEnd), ELLIPSIS, lastPage]\n\n const endRunStart = lastPage - EDGE_RUN + 1\n const isNearEnd = currentPage - NEIGHBOURS >= endRunStart\n if (isNearEnd) return [FIRST_PAGE, ELLIPSIS, ..._range(endRunStart, lastPage)]\n\n return [\n FIRST_PAGE,\n ELLIPSIS,\n ..._range(currentPage - NEIGHBOURS, currentPage + NEIGHBOURS),\n ELLIPSIS,\n lastPage,\n ]\n}\n\nexport const Pagination = ({\n currentPage,\n totalItems,\n pageSize,\n pageSizeOptions = DEFAULT_PAGE_SIZE_OPTIONS,\n showState = true,\n showQuantity = true,\n onPageChange,\n onPageSizeChange,\n itemsPerPageLabel = 'Itens por página',\n className,\n 'data-testid': dataTestId,\n}: PaginationProps) => {\n const selectId = `au-pagination-page-size-${useId()}`\n const totalPages = Math.max(1, Math.ceil(totalItems / pageSize))\n const page = Math.min(Math.max(1, currentPage), totalPages)\n const isFirst = page === 1\n const isLast = page === totalPages\n const firstItem = totalItems === 0 ? 0 : (page - 1) * pageSize + 1\n const lastItem = Math.min(page * pageSize, totalItems)\n const options = pageSizeOptions.includes(pageSize)\n ? pageSizeOptions\n : [...pageSizeOptions, pageSize].sort((a, b) => a - b)\n\n function _goTo(next: number) {\n if (next < 1 || next > totalPages || next === page) return\n onPageChange?.(next)\n }\n\n return (\n <nav\n className={classNames('au-pagination', className)}\n aria-label=\"Paginação\"\n data-testid={dataTestId}>\n {showState && (\n <span className=\"au-pagination__state\">\n {`${formatNumber(firstItem)}-${formatNumber(lastItem)} de ${formatNumber(totalItems)}`}\n </span>\n )}\n\n <div className=\"au-pagination__pages\">\n <Button\n className=\"au-pagination__nav au-pagination__nav--previous\"\n type=\"outlined\"\n round\n disabled={isFirst}\n aria-label=\"Página anterior\"\n onClick={() => _goTo(page - 1)}>\n <IconChevronLeft />\n </Button>\n\n <ul className=\"au-pagination__list\">\n {_getPageItems(page, totalPages).map((item, index) =>\n item === 'ellipsis' ? (\n <li key={`ellipsis-${index}`} className=\"au-pagination__item\">\n <span className=\"au-pagination__ellipsis\" aria-hidden=\"true\">\n ...\n </span>\n </li>\n ) : (\n <li key={item} className=\"au-pagination__item\">\n <button\n type=\"button\"\n className={classNames('au-pagination__page', {\n 'au-pagination__page--active': item === page,\n })}\n aria-current={item === page ? 'page' : undefined}\n aria-label={`Página ${item}`}\n onClick={() => _goTo(item)}>\n {item}\n </button>\n </li>\n ),\n )}\n </ul>\n\n <Button\n className=\"au-pagination__nav au-pagination__nav--next\"\n type=\"outlined\"\n round\n disabled={isLast}\n aria-label=\"Próxima página\"\n onClick={() => _goTo(page + 1)}>\n <IconChevronRight />\n </Button>\n </div>\n\n {showQuantity && (\n <div className=\"au-pagination__page-size\">\n <label\n className=\"au-pagination__page-size-label\"\n htmlFor={selectId}>\n {itemsPerPageLabel}\n </label>\n <span className=\"au-pagination__page-size-field\">\n <select\n id={selectId}\n className=\"au-pagination__page-size-select\"\n value={pageSize}\n onChange={(event) =>\n onPageSizeChange?.(Number(event.target.value))\n }>\n {options.map((option) => (\n <option key={option} value={option}>\n {option}\n </option>\n ))}\n </select>\n <IconChevronDown />\n </span>\n </div>\n )}\n </nav>\n )\n}\n"],"names":[],"mappings":";;;;;;;;AA0BA,MAAM,4BAA4B,CAAC,IAAI,IAAI,GAAG;AAC9C,MAAM,aAAa;AACnB,MAAM,WAAqB;AAC3B,MAAM,gBAAgB;AACtB,MAAM,WAAW;AACjB,MAAM,aAAa;AAEnB,MAAM,eAAe,CAAC,UACpB,IAAI,KAAK,aAAa,OAAO,EAAE,OAAO,KAAK;AAE7C,SAAS,OAAO,MAAc,IAAY;AACxC,SAAO,MAAM,KAAK,EAAE,QAAQ,KAAK,OAAO,EAAA,GAAK,CAAC,GAAG,UAAU,OAAO,KAAK;AACzE;AAEA,SAAS,cAAc,aAAqB,YAAgC;AAC1E,QAAM,WAAW;AAEjB,QAAM,gBAAgB,cAAc;AACpC,MAAI,cAAe,QAAO,OAAO,YAAY,QAAQ;AAErD,QAAM,cAAc;AACpB,QAAM,cAAc,cAAc,cAAc;AAChD,MAAI,oBAAoB,CAAC,GAAG,OAAO,YAAY,WAAW,GAAG,UAAU,QAAQ;AAE/E,QAAM,cAAc,WAAW,WAAW;AAC1C,QAAM,YAAY,cAAc,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UAAA;AAAA,UAEH,qBAAC,QAAA,EAAK,WAAU,kCACd,UAAA;AAAA,YAAA;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,IAAI;AAAA,gBACJ,WAAU;AAAA,gBACV,OAAO;AAAA,gBACP,UAAU,CAAC,UACT,qDAAmB,OAAO,MAAM,OAAO,KAAK;AAAA,gBAE7C,UAAA,QAAQ,IAAI,CAAC,WACZ,oBAAC,YAAoB,OAAO,QACzB,UAAA,OAAA,GADU,MAEb,CACD;AAAA,cAAA;AAAA,YAAA;AAAA,gCAEF,iBAAA,CAAA,CAAgB;AAAA,UAAA,EAAA,CACnB;AAAA,QAAA,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIR;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.au-pagination{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:16px;font-family:"Source Sans 3",sans-serif;font-size:14px;font-weight:400;line-height:22px;color:#454a54}.au-pagination__state{white-space:nowrap}.au-pagination__pages{display:flex;align-items:center;gap:12px}.au-pagination__pages:only-child{margin:0 auto}@media(max-width:599px){.au-pagination__pages{order:-1;width:100%;gap:8px}.au-pagination__list{flex:1;min-width:0;gap:0}.au-pagination__item{flex:1;min-width:0}.au-pagination__page,.au-pagination__ellipsis{width:100%;padding:0}}.au-pagination__nav{padding:8px}.au-pagination__nav .au-icon,.au-pagination__nav .au-icon>svg{width:20px;height:20px}.au-pagination__nav.au-btn--disabled{border-color:#c4c9d4}.au-pagination__nav.au-btn--disabled .au-icon,.au-pagination__nav.au-btn--disabled .au-icon>svg{color:#c4c9d4}.au-pagination__list{display:flex;align-items:center;gap:8px;margin:0;padding:0;list-style:none}.au-pagination__item{display:flex}.au-pagination__page,.au-pagination__ellipsis{display:inline-flex;align-items:center;justify-content:center;width:38px;height:38px;padding:8px;border-radius:8px;font:inherit;color:inherit}.au-pagination__page{border:0;background-color:transparent;cursor:pointer;transition:background-color .2s ease}.au-pagination__page:hover{background-color:#f6f7fa}.au-pagination__page:focus-visible{outline:none;box-shadow:0 0 0 2px #fff,0 0 0 4px #0048db}.au-pagination__page--active,.au-pagination__page--active:hover{background-color:#f2f5fc;color:#0048db;font-weight:600}.au-pagination__page-size{display:inline-flex;align-items:center;gap:8px}.au-pagination__page-size-label{white-space:nowrap;cursor:pointer}.au-pagination__page-size-field{position:relative;display:inline-flex}.au-pagination__page-size-field .au-icon,.au-pagination__page-size-field .au-icon>svg{position:absolute;top:50%;right:12px;width:20px;height:20px;transform:translateY(-50%);color:#454a54;pointer-events:none}.au-pagination__page-size-select{-webkit-appearance:none;-moz-appearance:none;appearance:none;height:38px;padding:0 36px 0 16px;border:1px solid #e2e4e9;border-radius:999px;background-color:#fff;font:inherit;font-weight:600;color:inherit;cursor:pointer;transition:border-color .2s ease}.au-pagination__page-size-select:hover{border-color:#5e6573}.au-pagination__page-size-select:focus-visible{outline:none;border-color:#c4c9d4;box-shadow:0 0 0 2px #fff,0 0 0 4px #0048db}
|
package/dist/main.d.ts
CHANGED
|
@@ -41,10 +41,13 @@ export { PartnerBanner, type PartnerBannerProps } from './components/PartnerBann
|
|
|
41
41
|
export { Transition, type TransitionProps } from './components/Transition';
|
|
42
42
|
export { SpecialButton, type SpecialButtonProps } from './components/SpecialButton';
|
|
43
43
|
export { LinkButton, type LinkButtonProps } from './components/LinkButton';
|
|
44
|
+
export { Pagination, type PaginationProps } from './components/Pagination';
|
|
45
|
+
export { Breadcrumb, type BreadcrumbProps, type BreadcrumbItem, } from './components/Breadcrumb';
|
|
46
|
+
export { Accordion, type AccordionProps, type AccordionVariant, } from './components/Accordion';
|
|
47
|
+
export { Carousel, type CarouselRootProps, type CarouselItemProps, type CarouselNavigation, type CarouselItemsPerView, } from './components/Carousel';
|
|
44
48
|
export type { SpinnerProps } from './components/Spinner';
|
|
45
49
|
export { useDrawer } from './components/Drawer/hooks';
|
|
46
50
|
export * from './components/Logo';
|
|
47
51
|
export * from './components/icons';
|
|
48
52
|
export * from './components/misc';
|
|
49
53
|
export * from './core/tokens';
|
|
50
|
-
export { Carousel } from './components/Prototype/Carousel';
|
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;
|