@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.
Files changed (42) hide show
  1. package/README.md +1 -22
  2. package/astro/Accordion/index.astro +79 -0
  3. package/astro/Breadcrumb/index.astro +124 -0
  4. package/astro/Carousel/Item/index.astro +17 -0
  5. package/astro/Carousel/Root/index.astro +332 -0
  6. package/astro/Pagination/index.astro +296 -0
  7. package/dist/components/Accordion/index.d.ts +23 -0
  8. package/dist/components/Accordion/index.es.js +85 -0
  9. package/dist/components/Accordion/index.es.js.map +1 -0
  10. package/dist/components/Accordion/styles.css +1 -0
  11. package/dist/components/Breadcrumb/index.d.ts +10 -0
  12. package/dist/components/Breadcrumb/index.es.js +112 -0
  13. package/dist/components/Breadcrumb/index.es.js.map +1 -0
  14. package/dist/components/Breadcrumb/styles.css +1 -0
  15. package/dist/components/Carousel/Item/index.d.ts +10 -0
  16. package/dist/components/Carousel/Item/index.es.js +16 -0
  17. package/dist/components/Carousel/Item/index.es.js.map +1 -0
  18. package/dist/components/Carousel/Root/hooks.d.ts +33 -0
  19. package/dist/components/Carousel/Root/index.d.ts +20 -0
  20. package/dist/components/Carousel/Root/index.es.js +256 -0
  21. package/dist/components/Carousel/Root/index.es.js.map +1 -0
  22. package/dist/components/Carousel/index.d.ts +10 -0
  23. package/dist/components/Carousel/index.es.js +14 -0
  24. package/dist/components/Carousel/index.es.js.map +1 -0
  25. package/dist/components/Carousel/styles.css +1 -1
  26. package/dist/components/Pagination/index.d.ts +14 -0
  27. package/dist/components/Pagination/index.es.js +141 -0
  28. package/dist/components/Pagination/index.es.js.map +1 -0
  29. package/dist/components/Pagination/styles.css +1 -0
  30. package/dist/main.d.ts +4 -1
  31. package/dist/main.es.js +7 -1
  32. package/dist/main.es.js.map +1 -1
  33. package/package.json +2 -4
  34. package/dist/components/Prototype/Carousel/Pagination.d.ts +0 -7
  35. package/dist/components/Prototype/Carousel/Scrollbar.d.ts +0 -6
  36. package/dist/components/Prototype/Carousel/helpers.d.ts +0 -1
  37. package/dist/components/Prototype/Carousel/index.d.ts +0 -2
  38. package/dist/components/Prototype/Carousel/index.es.js +0 -469
  39. package/dist/components/Prototype/Carousel/index.es.js.map +0 -1
  40. package/dist/components/Prototype/Carousel/types.d.ts +0 -7
  41. package/dist/components/Prototype/Carousel/useCarousel.d.ts +0 -20
  42. package/dist/components/Prototype/Carousel/useCarouselDrag.d.ts +0 -9
@@ -0,0 +1,296 @@
1
+ ---
2
+ import type { HTMLAttributes } from 'astro/types'
3
+ import Button from '../Button/index.astro'
4
+ import IconChevronDown from '../icons/default/IconChevronDown.astro'
5
+ import IconChevronLeft from '../icons/default/IconChevronLeft.astro'
6
+ import IconChevronRight from '../icons/default/IconChevronRight.astro'
7
+ import '../../dist/components/Pagination/styles.css'
8
+
9
+ /**
10
+ * Same markup as the React `Pagination`. React is controlled (`currentPage`
11
+ * and `pageSize` come from the app); here they are the initial state and the
12
+ * inline controller keeps the DOM in step after each click, as if the app had
13
+ * passed the new values back: it rebuilds the page list, the state text and
14
+ * the arrows, and emits `au:pagechange` (`detail.page`) and
15
+ * `au:pagesizechange` (`detail.pageSize`) from the root in place of
16
+ * `onPageChange` / `onPageSizeChange`. On a page size change the current page
17
+ * is kept when it still exists and clamped to the last page otherwise.
18
+ * `data-total-items` and `data-page-size` on the root are controller wiring
19
+ * (the page size select may be hidden), and the initial `<option>` carries
20
+ * `selected` (React sets the value as a property). The select id is generated
21
+ * per render, as React generates its own. Other HTML attributes land on the
22
+ * `<nav>`.
23
+ */
24
+ export type Props = HTMLAttributes<'nav'> & {
25
+ /** Initial page, starting at 1. Clamped to the number of pages. */
26
+ currentPage: number
27
+ /** Total number of items across all pages. */
28
+ totalItems: number
29
+ /** Initial items per page. */
30
+ pageSize: number
31
+ /** Options offered in the "items per page" select. */
32
+ pageSizeOptions?: number[]
33
+ /** Figma "Show State": the "1-20 de 2.000" text. */
34
+ showState?: boolean
35
+ /** Figma "Show Quantity": the items per page select. */
36
+ showQuantity?: boolean
37
+ /** Text before the page size select. */
38
+ itemsPerPageLabel?: string
39
+ }
40
+
41
+ const {
42
+ currentPage,
43
+ totalItems,
44
+ pageSize,
45
+ pageSizeOptions = [20, 50, 100],
46
+ showState = true,
47
+ showQuantity = true,
48
+ itemsPerPageLabel = 'Itens por página',
49
+ class: className,
50
+ ...rest
51
+ } = Astro.props
52
+
53
+ type PageItem = number | 'ellipsis'
54
+
55
+ const range = (from: number, to: number) =>
56
+ Array.from({ length: to - from + 1 }, (_, index) => from + index)
57
+
58
+ const formatNumber = (value: number) => new Intl.NumberFormat('pt-BR').format(value)
59
+
60
+ const FIRST_PAGE = 1
61
+ const ELLIPSIS: PageItem = 'ellipsis'
62
+ /** The navigation always shows this many positions, so its width never changes. */
63
+ const VISIBLE_SLOTS = 7
64
+ /** Pages shown in a row at the start (`1 2 3 4 5 … N`) or at the end (`1 … N-4 … N`). */
65
+ const EDGE_RUN = 5
66
+ /** Pages shown on each side of the current one in the middle (`1 … 49 50 51 … N`). */
67
+ const NEIGHBOURS = 1
68
+
69
+ function getPageItems(currentPage: number, totalPages: number): PageItem[] {
70
+ const lastPage = totalPages
71
+
72
+ const everyPageFits = totalPages <= VISIBLE_SLOTS
73
+ if (everyPageFits) return range(FIRST_PAGE, lastPage)
74
+
75
+ const startRunEnd = EDGE_RUN
76
+ const isNearStart = currentPage + NEIGHBOURS <= startRunEnd
77
+ if (isNearStart) return [...range(FIRST_PAGE, startRunEnd), ELLIPSIS, lastPage]
78
+
79
+ const endRunStart = lastPage - EDGE_RUN + 1
80
+ const isNearEnd = currentPage - NEIGHBOURS >= endRunStart
81
+ if (isNearEnd) return [FIRST_PAGE, ELLIPSIS, ...range(endRunStart, lastPage)]
82
+
83
+ return [
84
+ FIRST_PAGE,
85
+ ELLIPSIS,
86
+ ...range(currentPage - NEIGHBOURS, currentPage + NEIGHBOURS),
87
+ ELLIPSIS,
88
+ lastPage,
89
+ ]
90
+ }
91
+
92
+ const selectId = `au-pagination-page-size-${crypto.randomUUID().slice(0, 8)}`
93
+ const totalPages = Math.max(1, Math.ceil(totalItems / pageSize))
94
+ const page = Math.min(Math.max(1, currentPage), totalPages)
95
+ const isFirst = page === 1
96
+ const isLast = page === totalPages
97
+ const firstItem = totalItems === 0 ? 0 : (page - 1) * pageSize + 1
98
+ const lastItem = Math.min(page * pageSize, totalItems)
99
+ const options = pageSizeOptions.includes(pageSize)
100
+ ? pageSizeOptions
101
+ : [...pageSizeOptions, pageSize].sort((a, b) => a - b)
102
+ ---
103
+
104
+ <nav
105
+ class:list={['au-pagination', className]}
106
+ aria-label="Paginação"
107
+ data-element="au-pagination"
108
+ data-total-items={totalItems}
109
+ data-page-size={pageSize}
110
+ {...rest}>
111
+ {showState && <span class="au-pagination__state">{`${formatNumber(firstItem)}-${formatNumber(lastItem)} de ${formatNumber(totalItems)}`}</span>}
112
+
113
+ <div class="au-pagination__pages">
114
+ <Button
115
+ class="au-pagination__nav au-pagination__nav--previous"
116
+ type="outlined"
117
+ round
118
+ disabled={isFirst}
119
+ aria-label="Página anterior">
120
+ <IconChevronLeft />
121
+ </Button>
122
+
123
+ <ul class="au-pagination__list">
124
+ {
125
+ getPageItems(page, totalPages).map((item) =>
126
+ item === 'ellipsis' ? (
127
+ <li class="au-pagination__item">
128
+ <span class="au-pagination__ellipsis" aria-hidden="true">...</span>
129
+ </li>
130
+ ) : (
131
+ <li class="au-pagination__item">
132
+ <button
133
+ type="button"
134
+ class:list={[
135
+ 'au-pagination__page',
136
+ item === page && 'au-pagination__page--active',
137
+ ]}
138
+ aria-current={item === page ? 'page' : undefined}
139
+ aria-label={`Página ${item}`}>{item}</button>
140
+ </li>
141
+ ),
142
+ )
143
+ }
144
+ </ul>
145
+
146
+ <Button
147
+ class="au-pagination__nav au-pagination__nav--next"
148
+ type="outlined"
149
+ round
150
+ disabled={isLast}
151
+ aria-label="Próxima página">
152
+ <IconChevronRight />
153
+ </Button>
154
+ </div>
155
+
156
+ {
157
+ showQuantity && (
158
+ <div class="au-pagination__page-size">
159
+ <label class="au-pagination__page-size-label" for={selectId}>{itemsPerPageLabel}</label>
160
+ <span class="au-pagination__page-size-field">
161
+ <select id={selectId} class="au-pagination__page-size-select">
162
+ {options.map((option) => <option value={option} selected={option === pageSize}>{option}</option>)}
163
+ </select>
164
+ <IconChevronDown />
165
+ </span>
166
+ </div>
167
+ )
168
+ }
169
+ </nav>
170
+
171
+ <script>
172
+ import { elementController } from '@consumidor-positivo/aurora/astro/runtime'
173
+
174
+ type PageItem = number | 'ellipsis'
175
+
176
+ const range = (from: number, to: number) =>
177
+ Array.from({ length: to - from + 1 }, (_, index) => from + index)
178
+
179
+ const formatNumber = (value: number) => new Intl.NumberFormat('pt-BR').format(value)
180
+
181
+ const FIRST_PAGE = 1
182
+ const ELLIPSIS: PageItem = 'ellipsis'
183
+ /** The navigation always shows this many positions, so its width never changes. */
184
+ const VISIBLE_SLOTS = 7
185
+ /** Pages shown in a row at the start (`1 2 3 4 5 … N`) or at the end (`1 … N-4 … N`). */
186
+ const EDGE_RUN = 5
187
+ /** Pages shown on each side of the current one in the middle (`1 … 49 50 51 … N`). */
188
+ const NEIGHBOURS = 1
189
+
190
+ function getPageItems(currentPage: number, totalPages: number): PageItem[] {
191
+ const lastPage = totalPages
192
+
193
+ const everyPageFits = totalPages <= VISIBLE_SLOTS
194
+ if (everyPageFits) return range(FIRST_PAGE, lastPage)
195
+
196
+ const startRunEnd = EDGE_RUN
197
+ const isNearStart = currentPage + NEIGHBOURS <= startRunEnd
198
+ if (isNearStart) return [...range(FIRST_PAGE, startRunEnd), ELLIPSIS, lastPage]
199
+
200
+ const endRunStart = lastPage - EDGE_RUN + 1
201
+ const isNearEnd = currentPage - NEIGHBOURS >= endRunStart
202
+ if (isNearEnd) return [FIRST_PAGE, ELLIPSIS, ...range(endRunStart, lastPage)]
203
+
204
+ return [
205
+ FIRST_PAGE,
206
+ ELLIPSIS,
207
+ ...range(currentPage - NEIGHBOURS, currentPage + NEIGHBOURS),
208
+ ELLIPSIS,
209
+ lastPage,
210
+ ]
211
+ }
212
+
213
+ elementController('au-pagination', ({ root, query, on, emit }) => {
214
+ const totalItems = Number(root.dataset.totalItems ?? 0)
215
+ const state = query<HTMLElement>('.au-pagination__state')
216
+ const list = query<HTMLElement>('.au-pagination__list')
217
+ const previous = query<HTMLButtonElement>('.au-pagination__nav--previous')
218
+ const next = query<HTMLButtonElement>('.au-pagination__nav--next')
219
+ const select = query<HTMLSelectElement>('.au-pagination__page-size-select')
220
+ if (!list || !previous || !next) return
221
+
222
+ let page = Number(
223
+ query<HTMLElement>('.au-pagination__page--active')?.textContent ?? 1,
224
+ )
225
+ let pageSize = Number(select?.value ?? root.dataset.pageSize ?? 1)
226
+
227
+ const totalPages = () => Math.max(1, Math.ceil(totalItems / pageSize))
228
+
229
+ function setArrow(button: HTMLButtonElement, disabled: boolean) {
230
+ button.disabled = disabled
231
+ button.classList.toggle('au-btn--disabled', disabled)
232
+ }
233
+
234
+ function pageItem(item: PageItem) {
235
+ const li = document.createElement('li')
236
+ li.className = 'au-pagination__item'
237
+
238
+ if (item === 'ellipsis') {
239
+ const span = document.createElement('span')
240
+ span.className = 'au-pagination__ellipsis'
241
+ span.setAttribute('aria-hidden', 'true')
242
+ span.textContent = '...'
243
+ li.append(span)
244
+ return li
245
+ }
246
+
247
+ const button = document.createElement('button')
248
+ button.type = 'button'
249
+ button.className = 'au-pagination__page'
250
+ if (item === page) {
251
+ button.classList.add('au-pagination__page--active')
252
+ button.setAttribute('aria-current', 'page')
253
+ }
254
+ button.setAttribute('aria-label', `Página ${item}`)
255
+ button.textContent = String(item)
256
+ li.append(button)
257
+ return li
258
+ }
259
+
260
+ function render() {
261
+ const total = totalPages()
262
+ const firstItem = totalItems === 0 ? 0 : (page - 1) * pageSize + 1
263
+ const lastItem = Math.min(page * pageSize, totalItems)
264
+
265
+ if (state) {
266
+ state.textContent = `${formatNumber(firstItem)}-${formatNumber(lastItem)} de ${formatNumber(totalItems)}`
267
+ }
268
+ list!.replaceChildren(...getPageItems(page, total).map(pageItem))
269
+ setArrow(previous!, page === 1)
270
+ setArrow(next!, page === total)
271
+ }
272
+
273
+ function goTo(target: number) {
274
+ if (target < 1 || target > totalPages() || target === page) return
275
+ page = target
276
+ render()
277
+ emit('au:pagechange', { page })
278
+ }
279
+
280
+ on('click', (event) => {
281
+ const target = event.target as Element | null
282
+ if (target?.closest('.au-pagination__nav--previous')) return goTo(page - 1)
283
+ if (target?.closest('.au-pagination__nav--next')) return goTo(page + 1)
284
+ const button = target?.closest<HTMLButtonElement>('.au-pagination__page')
285
+ if (button) goTo(Number(button.textContent))
286
+ })
287
+
288
+ on('change', (event) => {
289
+ if (!select || event.target !== select) return
290
+ pageSize = Number(select.value)
291
+ page = Math.min(page, totalPages())
292
+ render()
293
+ emit('au:pagesizechange', { pageSize })
294
+ })
295
+ })
296
+ </script>
@@ -0,0 +1,23 @@
1
+ import { ReactNode } from 'react';
2
+ export type AccordionVariant = 'container' | 'row';
3
+ export type AccordionProps = {
4
+ /** Text shown in the header. */
5
+ label: string;
6
+ /**
7
+ * Figma "Type": `container` (default) is a card with border and rounded
8
+ * corners; `row` is a flat line separated from the next one by a bottom
9
+ * divider. Keep one type per group.
10
+ */
11
+ variant?: AccordionVariant;
12
+ /** Controlled state. Leave undefined to let the accordion manage itself. */
13
+ open?: boolean;
14
+ /** Initial state when uncontrolled. */
15
+ defaultOpen?: boolean;
16
+ /** Called with the next state on every header click. */
17
+ onToggle?: (open: boolean) => void;
18
+ /** Free content of the panel: text or any Aurora component. */
19
+ children: ReactNode;
20
+ className?: string;
21
+ 'data-testid'?: string;
22
+ };
23
+ export declare const Accordion: ({ label, variant, open, defaultOpen, onToggle, children, className, "data-testid": dataTestId, }: AccordionProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,85 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { c as classNames } from "../../index-BW2ZU5Hx.js";
3
+ import { useId, useState } from "react";
4
+ import "../Icon/index.es.js";
5
+ import { IconMinusCircle } from "../icons/IconMinusCircle/index.es.js";
6
+ import { IconPlusCircle } from "../icons/IconPlusCircle/index.es.js";
7
+ import './styles.css';const Accordion = ({
8
+ label,
9
+ variant = "container",
10
+ open,
11
+ defaultOpen = false,
12
+ onToggle,
13
+ children,
14
+ className,
15
+ "data-testid": dataTestId
16
+ }) => {
17
+ const id = useId();
18
+ const [internalOpen, setInternalOpen] = useState(defaultOpen);
19
+ const isOpen = open ?? internalOpen;
20
+ const headerId = `au-accordion-header-${id}`;
21
+ const panelId = `au-accordion-panel-${id}`;
22
+ function _toggle() {
23
+ const next = !isOpen;
24
+ if (open === void 0) setInternalOpen(next);
25
+ onToggle == null ? void 0 : onToggle(next);
26
+ }
27
+ return /* @__PURE__ */ jsxs(
28
+ "div",
29
+ {
30
+ className: classNames(
31
+ "au-accordion",
32
+ `au-accordion--${variant}`,
33
+ { "au-accordion--open": isOpen },
34
+ className
35
+ ),
36
+ "data-testid": dataTestId,
37
+ children: [
38
+ /* @__PURE__ */ jsxs(
39
+ "button",
40
+ {
41
+ type: "button",
42
+ id: headerId,
43
+ className: "au-accordion__header",
44
+ "aria-expanded": isOpen,
45
+ "aria-controls": panelId,
46
+ onClick: _toggle,
47
+ children: [
48
+ /* @__PURE__ */ jsx("span", { className: "au-accordion__label", children: label }),
49
+ /* @__PURE__ */ jsx(
50
+ "span",
51
+ {
52
+ className: "au-accordion__icon au-accordion__icon--closed",
53
+ "aria-hidden": "true",
54
+ children: /* @__PURE__ */ jsx(IconPlusCircle, {})
55
+ }
56
+ ),
57
+ /* @__PURE__ */ jsx(
58
+ "span",
59
+ {
60
+ className: "au-accordion__icon au-accordion__icon--open",
61
+ "aria-hidden": "true",
62
+ children: /* @__PURE__ */ jsx(IconMinusCircle, {})
63
+ }
64
+ )
65
+ ]
66
+ }
67
+ ),
68
+ /* @__PURE__ */ jsx(
69
+ "div",
70
+ {
71
+ id: panelId,
72
+ className: "au-accordion__panel",
73
+ role: "region",
74
+ "aria-labelledby": headerId,
75
+ children: /* @__PURE__ */ jsx("div", { className: "au-accordion__panel-body", children: /* @__PURE__ */ jsx("div", { className: "au-accordion__panel-content", children }) })
76
+ }
77
+ )
78
+ ]
79
+ }
80
+ );
81
+ };
82
+ export {
83
+ Accordion
84
+ };
85
+ //# sourceMappingURL=index.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.es.js","sources":["../../../lib/components/Accordion/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport { ReactNode, useId, useState } from 'react'\nimport { IconMinusCircle, IconPlusCircle } from '@components/icons'\nimport './styles.scss'\n\nexport type AccordionVariant = 'container' | 'row'\n\nexport type AccordionProps = {\n /** Text shown in the header. */\n label: string\n /**\n * Figma \"Type\": `container` (default) is a card with border and rounded\n * corners; `row` is a flat line separated from the next one by a bottom\n * divider. Keep one type per group.\n */\n variant?: AccordionVariant\n /** Controlled state. Leave undefined to let the accordion manage itself. */\n open?: boolean\n /** Initial state when uncontrolled. */\n defaultOpen?: boolean\n /** Called with the next state on every header click. */\n onToggle?: (open: boolean) => void\n /** Free content of the panel: text or any Aurora component. */\n children: ReactNode\n className?: string\n 'data-testid'?: string\n}\n\nexport const Accordion = ({\n label,\n variant = 'container',\n open,\n defaultOpen = false,\n onToggle,\n children,\n className,\n 'data-testid': dataTestId,\n}: AccordionProps) => {\n const id = useId()\n const [internalOpen, setInternalOpen] = useState(defaultOpen)\n const isOpen = open ?? internalOpen\n const headerId = `au-accordion-header-${id}`\n const panelId = `au-accordion-panel-${id}`\n\n function _toggle() {\n const next = !isOpen\n if (open === undefined) setInternalOpen(next)\n onToggle?.(next)\n }\n\n return (\n <div\n className={classNames(\n 'au-accordion',\n `au-accordion--${variant}`,\n { 'au-accordion--open': isOpen },\n className,\n )}\n data-testid={dataTestId}>\n <button\n type=\"button\"\n id={headerId}\n className=\"au-accordion__header\"\n aria-expanded={isOpen}\n aria-controls={panelId}\n onClick={_toggle}>\n <span className=\"au-accordion__label\">{label}</span>\n <span\n className=\"au-accordion__icon au-accordion__icon--closed\"\n aria-hidden=\"true\">\n <IconPlusCircle />\n </span>\n <span\n className=\"au-accordion__icon au-accordion__icon--open\"\n aria-hidden=\"true\">\n <IconMinusCircle />\n </span>\n </button>\n <div\n id={panelId}\n className=\"au-accordion__panel\"\n role=\"region\"\n aria-labelledby={headerId}>\n <div className=\"au-accordion__panel-body\">\n <div className=\"au-accordion__panel-content\">{children}</div>\n </div>\n </div>\n </div>\n )\n}\n"],"names":[],"mappings":";;;;;;AA4BO,MAAM,YAAY,CAAC;AAAA,EACxB;AAAA,EACA,UAAU;AAAA,EACV;AAAA,EACA,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AACjB,MAAsB;AACpB,QAAM,KAAK,MAAA;AACX,QAAM,CAAC,cAAc,eAAe,IAAI,SAAS,WAAW;AAC5D,QAAM,SAAS,QAAQ;AACvB,QAAM,WAAW,uBAAuB,EAAE;AAC1C,QAAM,UAAU,sBAAsB,EAAE;AAExC,WAAS,UAAU;AACjB,UAAM,OAAO,CAAC;AACd,QAAI,SAAS,OAAW,iBAAgB,IAAI;AAC5C,yCAAW;AAAA,EACb;AAEA,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA,iBAAiB,OAAO;AAAA,QACxB,EAAE,sBAAsB,OAAA;AAAA,QACxB;AAAA,MAAA;AAAA,MAEF,eAAa;AAAA,MACb,UAAA;AAAA,QAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,IAAI;AAAA,YACJ,WAAU;AAAA,YACV,iBAAe;AAAA,YACf,iBAAe;AAAA,YACf,SAAS;AAAA,YACT,UAAA;AAAA,cAAA,oBAAC,QAAA,EAAK,WAAU,uBAAuB,UAAA,OAAM;AAAA,cAC7C;AAAA,gBAAC;AAAA,gBAAA;AAAA,kBACC,WAAU;AAAA,kBACV,eAAY;AAAA,kBACZ,8BAAC,gBAAA,CAAA,CAAe;AAAA,gBAAA;AAAA,cAAA;AAAA,cAElB;AAAA,gBAAC;AAAA,gBAAA;AAAA,kBACC,WAAU;AAAA,kBACV,eAAY;AAAA,kBACZ,8BAAC,iBAAA,CAAA,CAAgB;AAAA,gBAAA;AAAA,cAAA;AAAA,YACnB;AAAA,UAAA;AAAA,QAAA;AAAA,QAEF;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,IAAI;AAAA,YACJ,WAAU;AAAA,YACV,MAAK;AAAA,YACL,mBAAiB;AAAA,YACjB,UAAA,oBAAC,SAAI,WAAU,4BACb,8BAAC,OAAA,EAAI,WAAU,+BAA+B,SAAA,CAAS,EAAA,CACzD;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAAA;AAGN;"}
@@ -0,0 +1 @@
1
+ .au-accordion{border:1px solid #e2e4e9;border-radius:16px;background-color:#fff;font-family:"Source Sans 3",sans-serif;transition:border-color .3s ease}.au-accordion--open{border-color:#0048db}.au-accordion--container+.au-accordion--container{margin-top:16px}.au-accordion--row{border-width:0 0 1px;border-radius:0}.au-accordion--row.au-accordion--open{border-color:#e2e4e9}.au-accordion__header{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;padding:16px 24px;border:0;border-radius:inherit;background-color:transparent;font-family:inherit;font-size:16px;font-weight:600;line-height:24px;color:#16181d;text-align:left;cursor:pointer}.au-accordion__header:focus-visible{outline:none;box-shadow:inset 0 0 0 2px #0048db}.au-accordion__label{flex:1}.au-accordion__icon{display:flex}.au-accordion__icon .au-icon,.au-accordion__icon .au-icon>svg{width:20px;height:20px;color:#0048db}.au-accordion__icon--open,.au-accordion--open .au-accordion__icon--closed{display:none}.au-accordion--open .au-accordion__icon--open{display:flex}.au-accordion__panel{display:grid;grid-template-rows:0fr;visibility:hidden;transition:grid-template-rows .3s ease,visibility 0s linear .3s}.au-accordion--open .au-accordion__panel{grid-template-rows:1fr;visibility:visible;transition:grid-template-rows .3s ease,visibility 0s}.au-accordion__panel-body{min-height:0;overflow:hidden}.au-accordion__panel-content{padding:16px 24px;border-top:1px solid #e2e4e9;font-size:16px;font-weight:400;line-height:24px;color:#454a54}.au-accordion--row .au-accordion__panel-content{padding-top:12px;padding-bottom:12px}@media(prefers-reduced-motion:reduce){.au-accordion,.au-accordion__panel{transition:none}}
@@ -0,0 +1,10 @@
1
+ export type BreadcrumbItem = {
2
+ label: string;
3
+ href?: string;
4
+ };
5
+ export type BreadcrumbProps = {
6
+ items: BreadcrumbItem[];
7
+ className?: string;
8
+ 'data-testid'?: string;
9
+ };
10
+ export declare const Breadcrumb: ({ items, className, "data-testid": dataTestId, }: BreadcrumbProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,112 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { c as classNames } from "../../index-BW2ZU5Hx.js";
3
+ import { useState, useRef, useId, useEffect, Fragment } from "react";
4
+ import { LinkButton } from "../LinkButton/index.es.js";
5
+ import "../Icon/index.es.js";
6
+ import { IconChevronLeft } from "../icons/IconChevronLeft/index.es.js";
7
+ import { IconMoreHorizontal } from "../icons/IconMoreHorizontal/index.es.js";
8
+ import './styles.css';const MIN_ITEMS_TO_COLLAPSE = 5;
9
+ const Breadcrumb = ({
10
+ items,
11
+ className,
12
+ "data-testid": dataTestId
13
+ }) => {
14
+ const [isOpen, setIsOpen] = useState(false);
15
+ const collapseRef = useRef(null);
16
+ const menuId = `au-breadcrumb-menu-${useId()}`;
17
+ const lastIndex = items.length - 1;
18
+ const current = items[lastIndex];
19
+ const parent = items.length > 1 ? items[lastIndex - 1] : void 0;
20
+ const shouldCollapse = items.length >= MIN_ITEMS_TO_COLLAPSE;
21
+ const hiddenItems = shouldCollapse ? items.slice(1, lastIndex - 1) : [];
22
+ const visibleItems = shouldCollapse ? [items[0], parent] : items.slice(0, lastIndex);
23
+ useEffect(() => {
24
+ if (!isOpen) return;
25
+ function _close(event) {
26
+ var _a;
27
+ if (event instanceof KeyboardEvent && event.key !== "Escape") return;
28
+ if (event instanceof MouseEvent && ((_a = collapseRef.current) == null ? void 0 : _a.contains(event.target))) {
29
+ return;
30
+ }
31
+ setIsOpen(false);
32
+ }
33
+ document.addEventListener("click", _close);
34
+ document.addEventListener("keydown", _close);
35
+ return () => {
36
+ document.removeEventListener("click", _close);
37
+ document.removeEventListener("keydown", _close);
38
+ };
39
+ }, [isOpen]);
40
+ const collapse = shouldCollapse && /* @__PURE__ */ jsxs(
41
+ "li",
42
+ {
43
+ ref: collapseRef,
44
+ className: "au-breadcrumb__item au-breadcrumb__item--collapse",
45
+ children: [
46
+ /* @__PURE__ */ jsx(
47
+ "button",
48
+ {
49
+ type: "button",
50
+ className: classNames("au-breadcrumb__ellipsis", {
51
+ "au-breadcrumb__ellipsis--open": isOpen
52
+ }),
53
+ "aria-label": "Mostrar níveis ocultos",
54
+ "aria-expanded": isOpen,
55
+ "aria-haspopup": "true",
56
+ "aria-controls": menuId,
57
+ onClick: () => setIsOpen((open) => !open),
58
+ children: /* @__PURE__ */ jsx(IconMoreHorizontal, {})
59
+ }
60
+ ),
61
+ /* @__PURE__ */ jsx("ul", { id: menuId, className: "au-breadcrumb__menu", hidden: !isOpen, children: hiddenItems.map((item) => /* @__PURE__ */ jsx(
62
+ "li",
63
+ {
64
+ className: "au-breadcrumb__menu-item",
65
+ children: /* @__PURE__ */ jsx("a", { className: "au-breadcrumb__menu-link", href: item.href, children: item.label })
66
+ },
67
+ `${item.label}-${item.href}`
68
+ )) })
69
+ ]
70
+ }
71
+ );
72
+ return /* @__PURE__ */ jsxs(
73
+ "nav",
74
+ {
75
+ className: classNames("au-breadcrumb", className),
76
+ "aria-label": "Breadcrumb",
77
+ "data-testid": dataTestId,
78
+ children: [
79
+ /* @__PURE__ */ jsxs("ol", { className: "au-breadcrumb__list", children: [
80
+ visibleItems.map((item, index) => /* @__PURE__ */ jsxs(Fragment, { children: [
81
+ index === 1 && collapse,
82
+ /* @__PURE__ */ jsx("li", { className: "au-breadcrumb__item", children: item.href ? /* @__PURE__ */ jsx(LinkButton, { as: "a", href: item.href, size: "small", children: item.label }) : /* @__PURE__ */ jsx("span", { className: "au-breadcrumb__text", children: item.label }) })
83
+ ] }, `${item.label}-${item.href}`)),
84
+ /* @__PURE__ */ jsx("li", { className: "au-breadcrumb__item au-breadcrumb__item--current", children: /* @__PURE__ */ jsx(
85
+ "span",
86
+ {
87
+ className: "au-breadcrumb__current",
88
+ "aria-current": "page",
89
+ title: current.label,
90
+ children: current.label
91
+ }
92
+ ) })
93
+ ] }),
94
+ (parent == null ? void 0 : parent.href) && /* @__PURE__ */ jsx(
95
+ LinkButton,
96
+ {
97
+ as: "a",
98
+ href: parent.href,
99
+ size: "small",
100
+ iconLeft: /* @__PURE__ */ jsx(IconChevronLeft, {}),
101
+ className: "au-breadcrumb__back",
102
+ children: parent.label
103
+ }
104
+ )
105
+ ]
106
+ }
107
+ );
108
+ };
109
+ export {
110
+ Breadcrumb
111
+ };
112
+ //# sourceMappingURL=index.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.es.js","sources":["../../../lib/components/Breadcrumb/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport { Fragment, useEffect, useId, useRef, useState } from 'react'\nimport { LinkButton } from '@components/LinkButton'\nimport { IconChevronLeft, IconMoreHorizontal } from '@components/icons'\nimport './styles.scss'\n\nexport type BreadcrumbItem = {\n label: string\n href?: string\n}\n\nexport type BreadcrumbProps = {\n items: BreadcrumbItem[]\n className?: string\n 'data-testid'?: string\n}\n\nconst MIN_ITEMS_TO_COLLAPSE = 5\n\nexport const Breadcrumb = ({\n items,\n className,\n 'data-testid': dataTestId,\n}: BreadcrumbProps) => {\n const [isOpen, setIsOpen] = useState(false)\n const collapseRef = useRef<HTMLLIElement>(null)\n const menuId = `au-breadcrumb-menu-${useId()}`\n\n const lastIndex = items.length - 1\n const current = items[lastIndex]\n const parent = items.length > 1 ? items[lastIndex - 1] : undefined\n const shouldCollapse = items.length >= MIN_ITEMS_TO_COLLAPSE\n const hiddenItems = shouldCollapse ? items.slice(1, lastIndex - 1) : []\n const visibleItems = shouldCollapse\n ? [items[0], parent!]\n : items.slice(0, lastIndex)\n\n useEffect(() => {\n if (!isOpen) return\n\n function _close(event: MouseEvent | KeyboardEvent) {\n if (event instanceof KeyboardEvent && event.key !== 'Escape') return\n if (\n event instanceof MouseEvent &&\n collapseRef.current?.contains(event.target as Node)\n ) {\n return\n }\n setIsOpen(false)\n }\n\n document.addEventListener('click', _close)\n document.addEventListener('keydown', _close)\n return () => {\n document.removeEventListener('click', _close)\n document.removeEventListener('keydown', _close)\n }\n }, [isOpen])\n\n const collapse = shouldCollapse && (\n <li\n ref={collapseRef}\n className=\"au-breadcrumb__item au-breadcrumb__item--collapse\">\n <button\n type=\"button\"\n className={classNames('au-breadcrumb__ellipsis', {\n 'au-breadcrumb__ellipsis--open': isOpen,\n })}\n aria-label=\"Mostrar níveis ocultos\"\n aria-expanded={isOpen}\n aria-haspopup=\"true\"\n aria-controls={menuId}\n onClick={() => setIsOpen((open) => !open)}>\n <IconMoreHorizontal />\n </button>\n <ul id={menuId} className=\"au-breadcrumb__menu\" hidden={!isOpen}>\n {hiddenItems.map((item) => (\n <li\n key={`${item.label}-${item.href}`}\n className=\"au-breadcrumb__menu-item\">\n <a className=\"au-breadcrumb__menu-link\" href={item.href}>\n {item.label}\n </a>\n </li>\n ))}\n </ul>\n </li>\n )\n\n return (\n <nav\n className={classNames('au-breadcrumb', className)}\n aria-label=\"Breadcrumb\"\n data-testid={dataTestId}>\n <ol className=\"au-breadcrumb__list\">\n {visibleItems.map((item, index) => (\n <Fragment key={`${item.label}-${item.href}`}>\n {index === 1 && collapse}\n <li className=\"au-breadcrumb__item\">\n {item.href ? (\n <LinkButton as=\"a\" href={item.href} size=\"small\">\n {item.label}\n </LinkButton>\n ) : (\n <span className=\"au-breadcrumb__text\">{item.label}</span>\n )}\n </li>\n </Fragment>\n ))}\n\n <li className=\"au-breadcrumb__item au-breadcrumb__item--current\">\n <span\n className=\"au-breadcrumb__current\"\n aria-current=\"page\"\n title={current.label}>\n {current.label}\n </span>\n </li>\n </ol>\n\n {parent?.href && (\n <LinkButton\n as=\"a\"\n href={parent.href}\n size=\"small\"\n iconLeft={<IconChevronLeft />}\n className=\"au-breadcrumb__back\">\n {parent.label}\n </LinkButton>\n )}\n </nav>\n )\n}\n"],"names":[],"mappings":"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"}
@@ -0,0 +1 @@
1
+ .au-breadcrumb{font-family:"Source Sans 3",sans-serif;font-size:14px;font-weight:400;line-height:22px;color:#5e6573}.au-breadcrumb__list{display:none;align-items:center;min-height:24px;gap:12px;margin:0;padding:0;list-style:none}@media(min-width:600px){.au-breadcrumb__list{display:flex}}.au-breadcrumb__item{position:relative;display:flex;align-items:center;gap:12px;min-width:0}.au-breadcrumb__item+.au-breadcrumb__item:before{content:"";flex-shrink:0;width:2px;height:2px;border-radius:50%;background-color:#5e6573}.au-breadcrumb__item--current{flex:1}.au-breadcrumb__text{white-space:nowrap}.au-breadcrumb__current{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.au-breadcrumb__ellipsis{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:4px;border:0;border-radius:8px;background-color:transparent;cursor:pointer;transition:background-color .2s ease}.au-breadcrumb__ellipsis .au-icon,.au-breadcrumb__ellipsis .au-icon>svg{width:16px;height:16px;color:#0048db}.au-breadcrumb__ellipsis:hover,.au-breadcrumb__ellipsis--open{background-color:#f2f5fc}.au-breadcrumb__ellipsis:focus-visible{outline:none;box-shadow:0 0 0 2px #fff,0 0 0 4px #0048db}.au-breadcrumb__menu{position:absolute;top:calc(100% + 4px);left:0;z-index:10;min-width:200px;margin:0;padding:0;border:1px solid #e2e4e9;border-radius:8px;background-color:#fff;box-shadow:0 8px 24px #7686ad14,0 4px 4px #0048db0a;list-style:none}.au-breadcrumb__menu[hidden]{display:none}.au-breadcrumb__menu-link{display:block;padding:12px 16px;color:#16181d;text-decoration:none;white-space:nowrap;transition:background-color .2s ease}.au-breadcrumb__menu-link:hover{background-color:#f6f7fa}.au-breadcrumb__menu-link:focus-visible{outline:none;background-color:#f2f5fc}.au-breadcrumb__menu-item:first-child .au-breadcrumb__menu-link{border-radius:8px 8px 0 0}.au-breadcrumb__menu-item:last-child .au-breadcrumb__menu-link{border-radius:0 0 8px 8px}.au-breadcrumb__back{padding:16px 0}@media(min-width:600px){.au-breadcrumb__back{display:none}}
@@ -0,0 +1,10 @@
1
+ import { HTMLAttributes } from 'react';
2
+ export type CarouselItemProps = HTMLAttributes<HTMLDivElement> & {
3
+ 'data-testid'?: string;
4
+ };
5
+ /**
6
+ * One slide. Keeps its own width unless the `Carousel.Root` sets
7
+ * `itemsPerView`; the rail snaps to its start. Every HTML attribute lands on
8
+ * the slide, so a `data-*` can anchor the app's own visibility tracking.
9
+ */
10
+ export declare const CarouselItem: ({ className, children, ...rest }: CarouselItemProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,16 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { c as classNames } from "../../../index-BW2ZU5Hx.js";
3
+ const CarouselItem = ({ className, children, ...rest }) => /* @__PURE__ */ jsx(
4
+ "div",
5
+ {
6
+ className: classNames("au-carousel__item", className),
7
+ role: "group",
8
+ "aria-roledescription": "slide",
9
+ ...rest,
10
+ children
11
+ }
12
+ );
13
+ export {
14
+ CarouselItem
15
+ };
16
+ //# sourceMappingURL=index.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.es.js","sources":["../../../../lib/components/Carousel/Item/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport { HTMLAttributes } from 'react'\n\nexport type CarouselItemProps = HTMLAttributes<HTMLDivElement> & {\n 'data-testid'?: string\n}\n\n/**\n * One slide. Keeps its own width unless the `Carousel.Root` sets\n * `itemsPerView`; the rail snaps to its start. Every HTML attribute lands on\n * the slide, so a `data-*` can anchor the app's own visibility tracking.\n */\nexport const CarouselItem = ({ className, children, ...rest }: CarouselItemProps) => (\n <div\n className={classNames('au-carousel__item', className)}\n role=\"group\"\n aria-roledescription=\"slide\"\n {...rest}>\n {children}\n </div>\n)\n"],"names":[],"mappings":";;AAYO,MAAM,eAAe,CAAC,EAAE,WAAW,UAAU,GAAG,WACrD;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAW,WAAW,qBAAqB,SAAS;AAAA,IACpD,MAAK;AAAA,IACL,wBAAqB;AAAA,IACpB,GAAG;AAAA,IACH;AAAA,EAAA;AACH;"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Groups the slides into pages. A page starts at a slide and holds every
3
+ * following slide that still fits, whole, in the rail's visible width.
4
+ * Returns the scroll position of each page (the `offsetLeft` of its first
5
+ * slide, which is also where CSS snaps). The rail is `position: relative`,
6
+ * so `offsetLeft` is measured from the rail itself.
7
+ */
8
+ export declare function getPageStarts(rail: HTMLElement): number[];
9
+ /**
10
+ * The page the rail is scrolled to: the one whose start is nearest to
11
+ * `scrollLeft`, or the last page once the rail cannot scroll any further
12
+ * (its start may lie past the maximum scroll, where the browser clamps it).
13
+ */
14
+ export declare function getActivePage(rail: HTMLElement, starts: number[]): number;
15
+ type UseCarouselArgs = {
16
+ draggable: boolean;
17
+ onPageChange?: (page: number, pageCount: number) => void;
18
+ };
19
+ /**
20
+ * Measures the rail, follows its scroll position and exposes `goTo`. Pages
21
+ * are re-measured when the rail or a slide changes size (ResizeObserver) and
22
+ * when slides are added, removed or replaced (MutationObserver), so a
23
+ * skeleton turning into a card or a tab swapping the list keeps the
24
+ * navigation right. Mouse drag follows the pointer with snapping off and
25
+ * settles on a page on release; touch scrolls natively.
26
+ */
27
+ export declare function useCarousel({ draggable, onPageChange }: UseCarouselArgs): {
28
+ railRef: import('react').RefObject<HTMLDivElement>;
29
+ page: number;
30
+ pageCount: number;
31
+ goTo: (target: number) => void;
32
+ };
33
+ export {};
@@ -0,0 +1,20 @@
1
+ import { ReactNode } from 'react';
2
+ export type CarouselNavigation = 'text' | 'pin' | 'only-pin';
3
+ export type CarouselItemsPerView = number | {
4
+ mobile?: number;
5
+ desktop?: number;
6
+ };
7
+ export type CarouselRootProps = {
8
+ children: ReactNode;
9
+ navigation?: CarouselNavigation;
10
+ negative?: boolean;
11
+ pageLabel?: string;
12
+ label?: string;
13
+ gap?: number;
14
+ itemsPerView?: CarouselItemsPerView;
15
+ draggable?: boolean;
16
+ onPageChange?: (page: number, pageCount: number) => void;
17
+ className?: string;
18
+ 'data-testid'?: string;
19
+ };
20
+ export declare const CarouselRoot: ({ children, navigation, negative, pageLabel, label, gap, itemsPerView, draggable, onPageChange, className, "data-testid": dataTestId, }: CarouselRootProps) => import("react/jsx-runtime").JSX.Element;