@giro-ds/react 6.0.2 → 8.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/dist/index.cjs +347 -180
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +284 -43
- package/dist/index.esm.js +346 -183
- package/dist/index.esm.js.map +1 -1
- package/dist/styles.css +3 -1
- package/package.json +3 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,65 +1,69 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import { Avatar as Avatar$1, Tooltip as Tooltip$1, Checkbox as Checkbox$1, Popover as Popover$1, Label, AlertDialog, RadioGroup, DropdownMenu, Dialog as Dialog$1, Select as Select$1, Toast as Toast$1, Switch as Switch$1 } from 'radix-ui';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import React__default, { useId, useMemo, createContext, useState, useContext, forwardRef, useEffect, useCallback, useRef, memo, useReducer, createElement, isValidElement } from 'react';
|
|
6
|
-
import { SpinnerIos16Regular, ChevronUp16Regular, ChevronLeft16Regular, ChevronRight16Regular, ChevronDown16Regular, Info12Regular, Dismiss16Regular, Calendar16Regular, Search16Regular, ChevronDownRegular, ChevronRight16Filled, Subtract16Regular, Add16Regular, Info20Filled, CheckmarkCircle20Filled, Warning20Filled, Dismiss16Filled } from '@fluentui/react-icons';
|
|
6
|
+
import { SpinnerIos16Regular, ChevronUp16Regular, ChevronLeft16Regular, ChevronRight16Regular, ChevronDown16Regular, Dismiss24Regular, Info12Regular, Dismiss16Regular, Calendar16Regular, Search16Regular, ChevronDownRegular, ChevronRight16Filled, Subtract16Regular, Add16Regular, SearchInfo20Regular, ArrowSortUp16Regular, ArrowSortDown16Regular, ArrowSort16Regular, Info20Filled, CheckmarkCircle20Filled, Warning20Filled, Dismiss16Filled } from '@fluentui/react-icons';
|
|
7
7
|
import { DayPicker } from 'react-day-picker';
|
|
8
8
|
import { format, addDays, addMonths, addWeeks, addYears, differenceInCalendarDays, differenceInCalendarMonths, eachMonthOfInterval, eachYearOfInterval, endOfISOWeek, endOfMonth, endOfWeek, endOfYear, getISOWeek, getMonth, getYear, getWeek, isAfter, isBefore, isDate, isSameDay, isSameMonth, isSameYear, max, min, setMonth, setYear, startOfDay, startOfISOWeek, startOfMonth, startOfWeek, startOfYear } from 'date-fns';
|
|
9
9
|
import { createPortal } from 'react-dom';
|
|
10
|
+
import { useReactTable, getSortedRowModel, getPaginationRowModel, getFilteredRowModel, getCoreRowModel, flexRender } from '@tanstack/react-table';
|
|
11
|
+
export { createColumnHelper as createTableColumnHelper } from '@tanstack/react-table';
|
|
12
|
+
import Skeleton from 'react-loading-skeleton';
|
|
10
13
|
|
|
11
|
-
var styles$
|
|
14
|
+
var styles$s = {"AvatarRoot":"Avatar-module__AvatarRoot___7eNx7","AvatarRoot--sm":"Avatar-module__AvatarRoot--sm___LVHoe","AvatarRoot--lg":"Avatar-module__AvatarRoot--lg___QWux5","AvatarImage":"Avatar-module__AvatarImage___-H6iH","AvatarFallback":"Avatar-module__AvatarFallback___RDyNV"};
|
|
12
15
|
|
|
13
16
|
const Avatar = ({ icon, size = 'lg', src, className, initialLetters, ...rest }) => {
|
|
14
|
-
const AvatarClass = clsx(styles$
|
|
15
|
-
[styles$
|
|
16
|
-
[styles$
|
|
17
|
+
const AvatarClass = clsx(styles$s.AvatarRoot, {
|
|
18
|
+
[styles$s['AvatarRoot--lg']]: size === 'lg',
|
|
19
|
+
[styles$s['AvatarRoot--sm']]: size === 'sm',
|
|
17
20
|
}, className);
|
|
18
|
-
return (
|
|
21
|
+
return (jsxs(Avatar$1.Root, { className: AvatarClass, ...rest, children: [src && (jsx(Avatar$1.Image, { className: styles$s.AvatarImage, src: src, alt: "Avatar" })), jsx(Avatar$1.Fallback, { className: styles$s.AvatarFallback, children: icon || initialLetters })] }));
|
|
19
22
|
};
|
|
20
23
|
|
|
21
|
-
var styles$
|
|
24
|
+
var styles$r = {"badge__status":"Badge-module__badge__status___-u3xv","badge":"Badge-module__badge___ZbEBU","badgeContainer":"Badge-module__badgeContainer___Guw9Z","badge__empty":"Badge-module__badge__empty___u8ccy","badge__flex":"Badge-module__badge__flex___DSJHW","badge__status__empty":"Badge-module__badge__status__empty___h8L4e","badge__status__flex":"Badge-module__badge__status__flex___703Q6","badge__status__filterBadge":"Badge-module__badge__status__filterBadge___DhjGU"};
|
|
22
25
|
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if (!isFinite(inputValue))
|
|
31
|
-
return '';
|
|
32
|
-
if (inputValue < 0)
|
|
33
|
-
return 0;
|
|
34
|
-
if (inputValue === 0)
|
|
35
|
-
return '';
|
|
36
|
-
return inputValue > 99 ? `${99}+` : inputValue;
|
|
26
|
+
const getDisplayValue = (value) => {
|
|
27
|
+
if (value === null || value === undefined)
|
|
28
|
+
return '';
|
|
29
|
+
if (typeof value === 'string') {
|
|
30
|
+
const parsed = Number(value);
|
|
31
|
+
if (isFinite(parsed) && parsed > 0 && String(parsed) === value) {
|
|
32
|
+
return parsed > 99 ? '99+' : value;
|
|
37
33
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
return value;
|
|
35
|
+
}
|
|
36
|
+
if (!isFinite(value) || value <= 0)
|
|
37
|
+
return '';
|
|
38
|
+
return value > 99 ? '99+' : String(value);
|
|
39
|
+
};
|
|
40
|
+
const Badge = ({ children, badgeValue = null, className, id, filterVariant = false, 'aria-label': ariaLabel, ...rest }) => {
|
|
41
|
+
const generatedId = useId();
|
|
42
|
+
const componentId = id || generatedId;
|
|
42
43
|
const displayValue = getDisplayValue(badgeValue);
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
[styles$
|
|
47
|
-
|
|
44
|
+
const isEmpty = displayValue === '';
|
|
45
|
+
if (children) {
|
|
46
|
+
return (jsxs("div", { className: styles$r.badgeContainer, ...rest, children: [jsx("div", { "data-testid": "badge-content", children: children }), jsx("div", { id: componentId, className: clsx(styles$r.badge, {
|
|
47
|
+
[styles$r['badge__empty']]: isEmpty,
|
|
48
|
+
[styles$r['badge__flex']]: displayValue.length >= 2,
|
|
49
|
+
}, className), "data-testid": "badge", children: !isEmpty && jsx("span", { "aria-hidden": !!ariaLabel, children: displayValue }) })] }));
|
|
48
50
|
}
|
|
49
|
-
return (jsx("div", { className:
|
|
50
|
-
[styles$
|
|
51
|
-
|
|
51
|
+
return (jsx("div", { className: styles$r.badgeContainer, children: jsx("div", { className: clsx(styles$r['badge__status'], {
|
|
52
|
+
[styles$r['badge__status__empty']]: isEmpty,
|
|
53
|
+
[styles$r['badge__status__flex']]: displayValue.length >= 2,
|
|
54
|
+
[styles$r['badge__status__filterBadge']]: filterVariant,
|
|
55
|
+
}, className), "data-testid": "badge", children: !isEmpty && (jsx("span", { "aria-hidden": !!ariaLabel, children: displayValue })) }) }));
|
|
52
56
|
};
|
|
53
57
|
|
|
54
|
-
var styles$
|
|
58
|
+
var styles$q = {"tooltipContent":"Tooltip-module__tooltipContent___xycUg","triggerWrapper":"Tooltip-module__triggerWrapper___x83XR"};
|
|
55
59
|
|
|
56
|
-
const Tooltip = ({ children, text, side = 'bottom', align = 'start', maxWidth, sideOffset = 10, ...rest }) => {
|
|
57
|
-
return (jsx(Tooltip$1.Provider, { children: jsxs(Tooltip$1.Root, { children: [jsx(Tooltip$1.Trigger, { asChild: true, children: jsx("span", { className: styles$
|
|
60
|
+
const Tooltip = ({ children, text, side = 'bottom', align = 'start', maxWidth, sideOffset = 10, className, ...rest }) => {
|
|
61
|
+
return (jsx(Tooltip$1.Provider, { children: jsxs(Tooltip$1.Root, { children: [jsx(Tooltip$1.Trigger, { asChild: true, children: jsx("span", { className: styles$q.triggerWrapper, children: children }) }), jsx(Tooltip$1.Portal, { children: jsx(Tooltip$1.Content, { className: clsx(styles$q.tooltipContent, className), side: side, align: align, sideOffset: sideOffset, style: { maxWidth: maxWidth ? `${maxWidth}px` : 'auto' }, ...rest, children: text }) })] }) }));
|
|
58
62
|
};
|
|
59
63
|
|
|
60
|
-
var styles$
|
|
64
|
+
var styles$p = {"button":"Button-module__button___18Bed","button-lg":"Button-module__button-lg___-A8B9","button-sm":"Button-module__button-sm___L7aT7","button-filled":"Button-module__button-filled___IQx1z","button-outlined":"Button-module__button-outlined___hLkLN","button-text":"Button-module__button-text___8GFeA","buttonWithIcon":"Button-module__buttonWithIcon___8ehK1","buttonIconPosition-left":"Button-module__buttonIconPosition-left___uOY6b","buttonIconPosition-right":"Button-module__buttonIconPosition-right___eswRS","buttonIconPosition-both":"Button-module__buttonIconPosition-both___1Lith","buttonNoContent":"Button-module__buttonNoContent___Tc9jk","buttonIconOnly":"Button-module__buttonIconOnly___aifk4","buttonIconLeft":"Button-module__buttonIconLeft___RICR3","buttonIconRight":"Button-module__buttonIconRight___71lu2","buttonFullWidth":"Button-module__buttonFullWidth___tXuVE","disabled":"Button-module__disabled___UzdWL","buttonLoading":"Button-module__buttonLoading___RGdNw","buttonContentHidden":"Button-module__buttonContentHidden___CoCiN","buttonLoadingSpinner":"Button-module__buttonLoadingSpinner___oZxEU","spin":"Button-module__spin___kQKH9"};
|
|
61
65
|
|
|
62
|
-
const Button = React__default.forwardRef(({ as, children, variant = 'filled', iconPosition = 'left', href, to, external = false, target, rel, disabled = false, onClick, size = 'lg', className, type = 'button', id, icon, fullWidth = false, ariaLabel, iconOnly = false, loading = false, tooltipText, tooltipSide = 'top', tooltipAlign = 'center', ...
|
|
66
|
+
const Button = React__default.forwardRef(({ as, children, variant = 'filled', iconPosition = 'left', href, to, external = false, target, rel, disabled = false, onClick, size = 'lg', className, type = 'button', id, icon, fullWidth = false, ariaLabel, iconOnly = false, loading = false, tooltipText, tooltipSide = 'top', tooltipAlign = 'center', ...rest }, ref) => {
|
|
63
67
|
const generatedId = useId();
|
|
64
68
|
const componentId = id || generatedId;
|
|
65
69
|
const getComponent = () => {
|
|
@@ -86,14 +90,14 @@ const Button = React__default.forwardRef(({ as, children, variant = 'filled', ic
|
|
|
86
90
|
'Forneça um ícone via `icon={<MeuIcone />}`.');
|
|
87
91
|
}
|
|
88
92
|
const resolvedIcon = icon;
|
|
89
|
-
const buttonClasses = clsx(styles$
|
|
90
|
-
[styles$
|
|
91
|
-
[styles$
|
|
92
|
-
[styles$
|
|
93
|
-
[styles$
|
|
94
|
-
[styles$
|
|
95
|
-
[styles$
|
|
96
|
-
[styles$
|
|
93
|
+
const buttonClasses = clsx(styles$p.button, styles$p[`button-${variant}`], styles$p[`button-${size}`], {
|
|
94
|
+
[styles$p['disabled']]: disabled,
|
|
95
|
+
[styles$p['buttonLoading']]: loading,
|
|
96
|
+
[styles$p['buttonWithIcon']]: resolvedIcon && !iconOnly,
|
|
97
|
+
[styles$p[`buttonIconPosition-${iconPosition}`]]: resolvedIcon && !iconOnly,
|
|
98
|
+
[styles$p['buttonNoContent']]: resolvedIcon && !hasContent && !iconOnly,
|
|
99
|
+
[styles$p['buttonFullWidth']]: fullWidth,
|
|
100
|
+
[styles$p['buttonIconOnly']]: iconOnly,
|
|
97
101
|
}, className);
|
|
98
102
|
const getAriaLabel = () => {
|
|
99
103
|
if (ariaLabel)
|
|
@@ -119,12 +123,12 @@ const Button = React__default.forwardRef(({ as, children, variant = 'filled', ic
|
|
|
119
123
|
};
|
|
120
124
|
const renderContent = () => {
|
|
121
125
|
if (iconOnly && !loading) {
|
|
122
|
-
return (jsx("span", { className: styles$
|
|
126
|
+
return (jsx("span", { className: styles$p.buttonIconOnly, "aria-hidden": "true", children: resolvedIcon }));
|
|
123
127
|
}
|
|
124
128
|
if (loading) {
|
|
125
|
-
return (jsxs(Fragment, { children: [!iconOnly && (jsxs("span", { className: styles$
|
|
129
|
+
return (jsxs(Fragment, { children: [!iconOnly && (jsxs("span", { className: styles$p.buttonContentHidden, "aria-hidden": "true", children: [resolvedIcon && (iconPosition === 'left' || iconPosition === 'both') && (jsx("span", { className: styles$p.buttonIconLeft, children: resolvedIcon })), children, resolvedIcon && (iconPosition === 'right' || iconPosition === 'both') && (jsx("span", { className: styles$p.buttonIconRight, children: resolvedIcon }))] })), jsx("span", { className: styles$p.buttonLoadingSpinner, "aria-hidden": "true", children: jsx(SpinnerIos16Regular, { "aria-hidden": "true" }) })] }));
|
|
126
130
|
}
|
|
127
|
-
return (jsxs(Fragment, { children: [resolvedIcon && (iconPosition === 'left' || iconPosition === 'both') && (jsx("span", { className: styles$
|
|
131
|
+
return (jsxs(Fragment, { children: [resolvedIcon && (iconPosition === 'left' || iconPosition === 'both') && (jsx("span", { className: styles$p.buttonIconLeft, "aria-hidden": "true", children: resolvedIcon })), children, resolvedIcon && (iconPosition === 'right' || iconPosition === 'both') && (jsx("span", { className: styles$p.buttonIconRight, "aria-hidden": "true", children: resolvedIcon }))] }));
|
|
128
132
|
};
|
|
129
133
|
const baseProps = {
|
|
130
134
|
ref,
|
|
@@ -135,7 +139,7 @@ const Button = React__default.forwardRef(({ as, children, variant = 'filled', ic
|
|
|
135
139
|
'aria-busy': loading || undefined,
|
|
136
140
|
tabIndex: disabled || loading ? -1 : 0,
|
|
137
141
|
onClick: handleClick,
|
|
138
|
-
...
|
|
142
|
+
...rest,
|
|
139
143
|
};
|
|
140
144
|
const getNavigationProps = () => {
|
|
141
145
|
if (href) {
|
|
@@ -2429,7 +2433,7 @@ const ptBR = {
|
|
|
2429
2433
|
},
|
|
2430
2434
|
};
|
|
2431
2435
|
|
|
2432
|
-
var styles$
|
|
2436
|
+
var styles$o = {"root":"Calendar-module__root___vQEhz","day":"Calendar-module__day___dseUA","day_button":"Calendar-module__day_button___r3WNU","caption_label":"Calendar-module__caption_label___Dhkie","button_next":"Calendar-module__button_next___iRaNz","button_previous":"Calendar-module__button_previous___r7JBs","chevron":"Calendar-module__chevron___NPDg-","nav":"Calendar-module__nav___MT3Dm","dropdowns":"Calendar-module__dropdowns___xBVtv","dropdown":"Calendar-module__dropdown___D7OlW","dropdown_root":"Calendar-module__dropdown_root___v4DlK","month_caption":"Calendar-module__month_caption___P3Hlu","month":"Calendar-module__month___0RA-L","months":"Calendar-module__months___rmJdy","month_grid":"Calendar-module__month_grid___f6YkX","weekday":"Calendar-module__weekday___Spb2f","week_number":"Calendar-module__week_number___EXJD9","today":"Calendar-module__today___U36wP","outside":"Calendar-module__outside___UeJFZ","selected":"Calendar-module__selected___5Nryr","disabled":"Calendar-module__disabled___T3658","hidden":"Calendar-module__hidden___uL3uc","range_start":"Calendar-module__range_start___c1eNH","range_middle":"Calendar-module__range_middle___Uv4gt","range_end":"Calendar-module__range_end___4qDh5","focusable":"Calendar-module__focusable___V7w-Q","weeks_before_enter":"Calendar-module__weeks_before_enter___O1ytQ","slide_in_left":"Calendar-module__slide_in_left___hfrfr","weeks_before_exit":"Calendar-module__weeks_before_exit___v7nDr","slide_out_left":"Calendar-module__slide_out_left___kib4j","weeks_after_enter":"Calendar-module__weeks_after_enter___CEtsD","slide_in_right":"Calendar-module__slide_in_right___ldL0M","weeks_after_exit":"Calendar-module__weeks_after_exit___F8Edz","slide_out_right":"Calendar-module__slide_out_right___X2hxE","caption_after_enter":"Calendar-module__caption_after_enter___0ek1H","fade_in":"Calendar-module__fade_in___YyYoZ","caption_after_exit":"Calendar-module__caption_after_exit___RA1iK","fade_out":"Calendar-module__fade_out___lNcmB","caption_before_enter":"Calendar-module__caption_before_enter___j6sMK","caption_before_exit":"Calendar-module__caption_before_exit___rntl-","calendar_grid_wrapper":"Calendar-module__calendar_grid_wrapper___OX0TR","caption_grid_btn":"Calendar-module__caption_grid_btn___qD0-E","caption_year_chevron":"Calendar-module__caption_year_chevron___4ghQV","caption_grid_label":"Calendar-module__caption_grid_label___93Wx4","gridOverlay":"Calendar-module__gridOverlay___Za-y0","gridOverlayCaption":"Calendar-module__gridOverlayCaption___p4OUO","gridOverlayYearsNav":"Calendar-module__gridOverlayYearsNav___U6S-V","gridCells":"Calendar-module__gridCells___Y8DaG","gridCellsYears":"Calendar-module__gridCellsYears___jEV52","gridCell":"Calendar-module__gridCell___RV1co","gridCellActive":"Calendar-module__gridCellActive___UBi5y","gridNavBtn":"Calendar-module__gridNavBtn___Jligz","chevronNavBtnPrev":"Calendar-module__chevronNavBtnPrev___ifEps","chevronNavBtnNext":"Calendar-module__chevronNavBtnNext___qmghm"};
|
|
2433
2437
|
|
|
2434
2438
|
const FLUENT_CHEVRON_MAP = {
|
|
2435
2439
|
down: ChevronDown16Regular,
|
|
@@ -2448,10 +2452,10 @@ const GridMonthCaption = ({ calendarMonth, displayIndex: _displayIndex, ...divPr
|
|
|
2448
2452
|
const date = calendarMonth.date;
|
|
2449
2453
|
const monthLabel = new Intl.DateTimeFormat(intlLocale, { month: "long" }).format(date);
|
|
2450
2454
|
const yearLabel = String(date.getFullYear());
|
|
2451
|
-
return (jsxs("div", { ...divProps, children: [jsx("span", { className: styles$
|
|
2455
|
+
return (jsxs("div", { ...divProps, children: [jsx("span", { className: styles$o.caption_grid_label, children: monthLabel }), jsxs("button", { type: "button", className: styles$o.caption_grid_btn, "aria-pressed": view === "years", onClick: onYearLabelClick, children: [yearLabel, view !== "days" ? (jsx(ChevronUp16Regular, { className: styles$o.caption_year_chevron, "aria-hidden": true })) : (jsx(ChevronDown16Regular, { className: styles$o.caption_year_chevron, "aria-hidden": true }))] })] }));
|
|
2452
2456
|
};
|
|
2453
2457
|
const YEARS_PER_PAGE = 20;
|
|
2454
|
-
const Calendar = ({ selected, currentDate, defaultMonth, startMonth, endMonth, onDaySelect, onDateChange, onClear: _onClear, minDate, maxDate, disabled, format: _format, locale = "pt-br", autoFocus, id, "aria-label": ariaLabel, }) => {
|
|
2458
|
+
const Calendar = ({ selected, currentDate, defaultMonth, startMonth, endMonth, onDaySelect, onDateChange, onClear: _onClear, minDate, maxDate, disabled, format: _format, locale = "pt-br", autoFocus, className, id, "aria-label": ariaLabel, ...rest }) => {
|
|
2455
2459
|
const animate = true;
|
|
2456
2460
|
const [internalSelected, setInternalSelected] = useState(selected ?? undefined);
|
|
2457
2461
|
const [internalDisplayMonth, setInternalDisplayMonth] = useState(() => currentDate ?? defaultMonth ?? new Date());
|
|
@@ -2516,7 +2520,7 @@ const Calendar = ({ selected, currentDate, defaultMonth, startMonth, endMonth, o
|
|
|
2516
2520
|
onYearLabelClick: handleYearLabelClick,
|
|
2517
2521
|
};
|
|
2518
2522
|
const sharedDayPickerProps = {
|
|
2519
|
-
classNames: styles$
|
|
2523
|
+
classNames: styles$o,
|
|
2520
2524
|
animate,
|
|
2521
2525
|
mode: "single",
|
|
2522
2526
|
selected: resolvedSelected,
|
|
@@ -2528,20 +2532,26 @@ const Calendar = ({ selected, currentDate, defaultMonth, startMonth, endMonth, o
|
|
|
2528
2532
|
autoFocus,
|
|
2529
2533
|
"aria-label": ariaLabel,
|
|
2530
2534
|
};
|
|
2531
|
-
return (jsx(GridCtx.Provider, { value: gridCtxValue, children: jsxs("div", { className: styles$
|
|
2535
|
+
return (jsx(GridCtx.Provider, { value: gridCtxValue, children: jsxs("div", { className: clsx(styles$o.calendar_grid_wrapper, className), children: [jsx(DayPicker, { id: id, ...sharedDayPickerProps, ...rest, captionLayout: "label", month: resolvedDisplayMonth, onMonthChange: handleMonthChange, components: { MonthCaption: GridMonthCaption, Chevron: CustomChevron } }), gridView !== "days" && (jsxs("div", { className: `${styles$o.gridOverlay}${gridView === "years" ? ` ${styles$o.gridOverlayYears}` : ""}`, role: "dialog", "aria-modal": "true", "aria-label": gridView === "months" ? "Selecione o mês" : "Selecione o ano", children: [gridView === "months" && (jsxs(Fragment, { children: [jsxs("div", { className: styles$o.gridOverlayCaption, children: [jsx("span", { className: styles$o.caption_grid_label, children: new Intl.DateTimeFormat(intlLocale, { month: "long" }).format(resolvedDisplayMonth) }), jsxs("button", { type: "button", className: styles$o.caption_grid_btn, onClick: () => setGridView("days"), "aria-label": "Fechar sele\u00E7\u00E3o de m\u00EAs", children: [displayedYear, jsx(ChevronUp16Regular, { className: styles$o.caption_year_chevron, "aria-hidden": true })] })] }), jsx("div", { className: styles$o.gridCells, children: monthsGrid.map(({ index, label, disabled: monthDisabled }) => (jsx("button", { type: "button", disabled: monthDisabled, className: `${styles$o.gridCell}${displayedMonthIndex === index ? ` ${styles$o.gridCellActive}` : ""}`, onClick: () => handleGridMonthSelect(index), children: label }, index))) })] })), gridView === "years" && (jsxs(Fragment, { children: [jsxs("div", { className: styles$o.gridOverlayCaption, children: [jsx("span", { className: styles$o.caption_grid_label, children: new Intl.DateTimeFormat(intlLocale, { month: "long" }).format(resolvedDisplayMonth) }), jsxs("button", { type: "button", className: styles$o.caption_grid_btn, onClick: () => setGridView("days"), "aria-label": "Fechar sele\u00E7\u00E3o de ano", children: [displayedYear, jsx(ChevronUp16Regular, { className: styles$o.caption_year_chevron, "aria-hidden": true })] }), jsxs("div", { className: styles$o.gridOverlayYearsNav, children: [jsx("button", { type: "button", className: styles$o.gridNavBtn, disabled: !canGoPrevYears, onClick: () => setYearPageStart((s) => s - YEARS_PER_PAGE), "aria-label": "Anos anteriores", children: jsx(ChevronLeft16Regular, { className: styles$o.chevronNavBtnPrev, "aria-hidden": true }) }), jsx("button", { type: "button", className: styles$o.gridNavBtn, disabled: !canGoNextYears, onClick: () => setYearPageStart((s) => s + YEARS_PER_PAGE), "aria-label": "Pr\u00F3ximos anos", children: jsx(ChevronRight16Regular, { className: styles$o.chevronNavBtnNext, "aria-hidden": true }) })] })] }), jsx("div", { className: `${styles$o.gridCells} ${styles$o.gridCellsYears}`, children: yearsInPage.map((year) => (jsx("button", { type: "button", className: `${styles$o.gridCell}${displayedYear === year ? ` ${styles$o.gridCellActive}` : ""}`, onClick: () => handleGridYearSelect(year), children: year }, year))) })] }))] }))] }) }));
|
|
2532
2536
|
};
|
|
2533
2537
|
|
|
2534
|
-
var styles$
|
|
2538
|
+
var styles$n = {"container":"Callout-module__container___dggFW","withTitle":"Callout-module__withTitle___e-HEg","brand":"Callout-module__brand___YHDPQ","success":"Callout-module__success___RPS0Q","alert":"Callout-module__alert___LVlJM","content":"Callout-module__content___g44Qz","icon":"Callout-module__icon___4CBkz","subcontent":"Callout-module__subcontent___5hz-f","title":"Callout-module__title___IPSdE","text":"Callout-module__text___0Ys48","dismiss":"Callout-module__dismiss___ZaycS"};
|
|
2535
2539
|
|
|
2536
|
-
const Callout = ({
|
|
2540
|
+
const Callout = ({ variant = 'neutral', title, text, icon, onDismiss, dismiss, backgroundColor, textColor, className, id, style, ...rest }) => {
|
|
2541
|
+
if (process.env.NODE_ENV !== 'production' && (text === '' || (typeof text === 'string' && !text.trim()))) {
|
|
2542
|
+
console.warn('[Callout] A prop `text` não pode ser uma string vazia.');
|
|
2543
|
+
}
|
|
2537
2544
|
const generatedId = useId();
|
|
2538
|
-
const titleId =
|
|
2545
|
+
const titleId = `callout-title-${id || generatedId}`;
|
|
2539
2546
|
const componentId = id || generatedId;
|
|
2540
|
-
const
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2547
|
+
const isAlert = variant === 'alert';
|
|
2548
|
+
const containerClass = clsx(styles$n.container, styles$n[variant], { [styles$n.withTitle]: title }, className);
|
|
2549
|
+
const customStyle = {
|
|
2550
|
+
...style,
|
|
2551
|
+
...(backgroundColor && { '--callout-bg': `var(--${backgroundColor})` }),
|
|
2552
|
+
...(textColor && { '--callout-text': `var(--${textColor})` }),
|
|
2553
|
+
};
|
|
2554
|
+
return (jsx("div", { id: componentId, className: containerClass, role: isAlert ? 'alert' : 'status', "aria-live": isAlert ? 'assertive' : 'polite', "aria-labelledby": title ? titleId : undefined, style: customStyle, ...rest, children: jsxs("div", { className: styles$n.content, children: [icon && jsx("span", { className: styles$n.icon, "aria-hidden": "true", children: icon }), jsxs("div", { className: styles$n.subcontent, children: [title && (jsx("span", { id: titleId, className: styles$n.title, children: title })), text && jsx("span", { className: styles$n.text, children: text })] }), dismiss && (jsx("button", { className: styles$n.dismiss, onClick: onDismiss, type: "button", "aria-label": "Fechar", children: jsx(Dismiss24Regular, { "aria-hidden": "true" }) }))] }) }));
|
|
2545
2555
|
};
|
|
2546
2556
|
|
|
2547
2557
|
const CheckSmall = ({ className = '', width = 12, height = 10, fill = 'white', ...restProps }) => {
|
|
@@ -2552,47 +2562,47 @@ const CheckHalf = ({ className = '', width = 16, height = 16, fill = 'white', ..
|
|
|
2552
2562
|
return (jsx("svg", { width: width, height: height, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, "aria-hidden": "true", ...restProps, children: jsx("g", { id: "Icons/check_indeterminate_small", children: jsx("path", { id: "icon", d: "M3 9V7H13V9H3Z", fill: fill }) }) }));
|
|
2553
2563
|
};
|
|
2554
2564
|
|
|
2555
|
-
var styles$
|
|
2565
|
+
var styles$m = {"container":"Checkbox-module__container___pUY-s","root":"Checkbox-module__root___BS5dT","disabled":"Checkbox-module__disabled___WagIC","label":"Checkbox-module__label___JBaRm","indicator":"Checkbox-module__indicator___HXLHH","wrapperCheckbox":"Checkbox-module__wrapperCheckbox___m2qIW"};
|
|
2556
2566
|
|
|
2557
2567
|
const Checkbox = ({ id, label, onCheckedChange, checked, disabled, className, indeterminate = false, ...rest }) => {
|
|
2558
2568
|
const componentId = id || React.useId();
|
|
2559
|
-
return (jsxs("div", { className: clsx(styles$
|
|
2560
|
-
[styles$
|
|
2561
|
-
}), role: "presentation", tabIndex: disabled ? -1 : 0, children: jsx(Checkbox$1.Root, { className: styles$
|
|
2569
|
+
return (jsxs("div", { className: clsx(styles$m.container, className), children: [jsx("div", { className: clsx(styles$m.wrapperCheckbox, {
|
|
2570
|
+
[styles$m.disabled]: disabled,
|
|
2571
|
+
}), role: "presentation", tabIndex: disabled ? -1 : 0, children: jsx(Checkbox$1.Root, { className: styles$m.root, checked: indeterminate ? 'indeterminate' : checked, id: componentId, onCheckedChange: onCheckedChange, disabled: disabled, "data-disabled": disabled, "data-indeterminate": indeterminate, "aria-checked": indeterminate ? 'mixed' : checked ? 'true' : 'false', ...rest, children: jsx(Checkbox$1.Indicator, { className: styles$m.indicator, children: indeterminate ? jsx(CheckHalf, {}) : jsx(CheckSmall, {}) }) }) }), jsx("label", { className: clsx(styles$m.label, { [styles$m.disabled]: disabled }), htmlFor: componentId, children: label })] }));
|
|
2562
2572
|
};
|
|
2563
2573
|
|
|
2564
|
-
var styles$
|
|
2574
|
+
var styles$l = {"chips":"Chips-module__chips___SOvBe","title":"Chips-module__title___ZhuQi","iconLeft":"Chips-module__iconLeft___tPhnw","iconRight":"Chips-module__iconRight___-HxL2","hasLeftIcon":"Chips-module__hasLeftIcon___D3quS","hasRightIcon":"Chips-module__hasRightIcon___ZMx2Y","brand":"Chips-module__brand___q1Gsm","success":"Chips-module__success___UhxQa","alert":"Chips-module__alert___nvPnr","disabled":"Chips-module__disabled___ElWLI"};
|
|
2565
2575
|
|
|
2566
|
-
const Chips = ({ children, leftIcon, rightIcon, variant = 'neutral', disabled = false, backgroundColor, textColor, className, style, ...
|
|
2567
|
-
const chipsClass = clsx(styles$
|
|
2568
|
-
[styles$
|
|
2569
|
-
[styles$
|
|
2570
|
-
[styles$
|
|
2576
|
+
const Chips = ({ children, leftIcon, rightIcon, variant = 'neutral', disabled = false, backgroundColor, textColor, className, style, ...rest }) => {
|
|
2577
|
+
const chipsClass = clsx(styles$l.chips, styles$l[variant], {
|
|
2578
|
+
[styles$l.disabled]: disabled,
|
|
2579
|
+
[styles$l.hasLeftIcon]: leftIcon,
|
|
2580
|
+
[styles$l.hasRightIcon]: rightIcon,
|
|
2571
2581
|
}, className);
|
|
2572
2582
|
const colorStyle = {
|
|
2573
2583
|
...(!disabled && backgroundColor && { '--chips-bg': `var(--${backgroundColor})` }),
|
|
2574
2584
|
...(!disabled && textColor && { '--chips-text': `var(--${textColor})` }),
|
|
2575
2585
|
...style,
|
|
2576
2586
|
};
|
|
2577
|
-
const isInteractive = typeof
|
|
2578
|
-
return (jsxs("div", { className: chipsClass, "aria-disabled": disabled, style: colorStyle, role: isInteractive ? 'button' : undefined, tabIndex: isInteractive ? (disabled ? -1 : 0) : undefined, ...
|
|
2587
|
+
const isInteractive = typeof rest.onClick === 'function';
|
|
2588
|
+
return (jsxs("div", { className: chipsClass, "aria-disabled": disabled, style: colorStyle, role: isInteractive ? 'button' : undefined, tabIndex: isInteractive ? (disabled ? -1 : 0) : undefined, ...rest, children: [leftIcon && (jsx("span", { className: styles$l.iconLeft, "aria-hidden": "true", children: leftIcon })), jsx("span", { className: styles$l.title, children: children }), rightIcon && (jsx("span", { className: styles$l.iconRight, children: rightIcon }))] }));
|
|
2579
2589
|
};
|
|
2580
2590
|
const MemoizedChips = React__default.memo(Chips);
|
|
2581
2591
|
MemoizedChips.displayName = 'Chips';
|
|
2582
2592
|
|
|
2583
|
-
var styles$
|
|
2593
|
+
var styles$k = {"container":"Container-module__container___exPuE"};
|
|
2584
2594
|
|
|
2585
|
-
function Container({ children }) {
|
|
2586
|
-
return (jsx("main", { className:
|
|
2595
|
+
function Container({ children, className }) {
|
|
2596
|
+
return (jsx("main", { className: clsx(styles$k['container'], 'mx-auto', className), children: children }));
|
|
2587
2597
|
}
|
|
2588
2598
|
|
|
2589
|
-
var styles$
|
|
2599
|
+
var styles$j = {"Content":"Popover-module__Content___RIETg"};
|
|
2590
2600
|
|
|
2591
|
-
const Popover = ({ trigger, content, side = "left", align = "start", sideOffset = 8, open, onOpenChange, asAnchor = false, onOpenAutoFocus, onCloseAutoFocus, showArrow = false, }) => {
|
|
2592
|
-
return (jsxs(Popover$1.Root, { open: open, onOpenChange: onOpenChange, children: [asAnchor ? (jsx(Popover$1.Anchor, { asChild: true, children: trigger })) : (jsx(Popover$1.Trigger, { asChild: true, children: trigger })), jsx(Popover$1.Portal, { children: jsxs(Popover$1.Content, { className: styles$
|
|
2601
|
+
const Popover = ({ trigger, content, side = "left", align = "start", sideOffset = 8, open, onOpenChange, asAnchor = false, onOpenAutoFocus, onCloseAutoFocus, showArrow = false, className, ...rest }) => {
|
|
2602
|
+
return (jsxs(Popover$1.Root, { open: open, onOpenChange: onOpenChange, ...rest, children: [asAnchor ? (jsx(Popover$1.Anchor, { asChild: true, children: trigger })) : (jsx(Popover$1.Trigger, { asChild: true, children: trigger })), jsx(Popover$1.Portal, { children: jsxs(Popover$1.Content, { className: clsx(styles$j.Content, className), sideOffset: sideOffset, side: side, align: align, onOpenAutoFocus: asAnchor ? (e) => e.preventDefault() : onOpenAutoFocus, onCloseAutoFocus: asAnchor ? (e) => e.preventDefault() : onCloseAutoFocus, onInteractOutside: asAnchor ? (e) => e.preventDefault() : undefined, children: [content, showArrow && jsx(Popover$1.Arrow, {})] }) })] }));
|
|
2593
2603
|
};
|
|
2594
2604
|
|
|
2595
|
-
var styles$
|
|
2605
|
+
var styles$i = {"container":"TextField-module__container___WJHFR","inputWrapper":"TextField-module__inputWrapper___INjfd","inputContainer":"TextField-module__inputContainer___3EsFJ","icon":"TextField-module__icon___p1vwi","clearButton":"TextField-module__clearButton___kgOot","inputWithIcon":"TextField-module__inputWithIcon___shqkL","helperText":"TextField-module__helperText___d5QGC","error":"TextField-module__error___IGQzp","disabled":"TextField-module__disabled___roIKP"};
|
|
2596
2606
|
|
|
2597
2607
|
const validateInput = ({ value, maxLength, errorMessage, required }) => {
|
|
2598
2608
|
if (required && value.trim() === '') {
|
|
@@ -2604,12 +2614,12 @@ const validateInput = ({ value, maxLength, errorMessage, required }) => {
|
|
|
2604
2614
|
return '';
|
|
2605
2615
|
};
|
|
2606
2616
|
|
|
2607
|
-
var styles$
|
|
2617
|
+
var styles$h = {"labelContainer":"index-module__labelContainer___WGyDF","wrapperLabel":"index-module__wrapperLabel___XJzZO","requiredLabel":"index-module__requiredLabel___7oZkh","infoIcon":"index-module__infoIcon___lClx4","errorIcon":"index-module__errorIcon___yN-lq","disabledIcon":"index-module__disabledIcon___89Os7","errorLabel":"index-module__errorLabel___qa6h6","disabledLabel":"index-module__disabledLabel___U9vL8","disabledContainer":"index-module__disabledContainer___MtOvy"};
|
|
2608
2618
|
|
|
2609
|
-
const LabelComponent = ({ children, htmlFor, required = false, tooltip = false, tooltipText, side = 'bottom', align = 'start', className, error = false, disabled = false }) => (jsxs("div", { className: clsx(styles$
|
|
2610
|
-
styles$
|
|
2619
|
+
const LabelComponent = ({ children, htmlFor, required = false, tooltip = false, tooltipText, side = 'bottom', align = 'start', className, error = false, disabled = false }) => (jsxs("div", { className: clsx(styles$h.labelContainer, disabled && styles$h.disabledContainer), children: [jsxs(Label.Root, { className: clsx(styles$h.wrapperLabel, error && !disabled && styles$h.errorLabel, disabled && styles$h.disabledLabel, className), htmlFor: htmlFor, children: [children, required && jsx("span", { className: styles$h.requiredLabel, children: "*" })] }), tooltip && (jsx(Tooltip, { side: side, align: align, text: tooltipText || '', children: jsx("span", { className: disabled ? styles$h.disabledIcon : error ?
|
|
2620
|
+
styles$h.errorIcon : styles$h.infoIcon, children: jsx(Info12Regular, {}) }) }))] }));
|
|
2611
2621
|
|
|
2612
|
-
const TextField = forwardRef(({ className, value, label, placeholder, type = 'text', onChange, disabled = false, maxLength = 30, required = false, helperText, tooltip = false, tooltipText, side = 'bottom', align = 'start', errorMessage, error, id, icon, onBlur, onFocus, name, persistIcon = false, ...
|
|
2622
|
+
const TextField = forwardRef(({ className, value, label, placeholder, type = 'text', onChange, disabled = false, maxLength = 30, required = false, helperText, tooltip = false, tooltipText, side = 'bottom', align = 'start', errorMessage, error, id, icon, onBlur, onFocus, name, persistIcon = false, ...rest }, ref) => {
|
|
2613
2623
|
const normalizeValue = (val) => {
|
|
2614
2624
|
return val === undefined || val === null ? '' : String(val);
|
|
2615
2625
|
};
|
|
@@ -2669,22 +2679,22 @@ const TextField = forwardRef(({ className, value, label, placeholder, type = 'te
|
|
|
2669
2679
|
: helperText
|
|
2670
2680
|
? `${componentId}-helper`
|
|
2671
2681
|
: undefined;
|
|
2672
|
-
const containerClass = clsx(styles$
|
|
2673
|
-
[styles$
|
|
2674
|
-
[styles$
|
|
2682
|
+
const containerClass = clsx(styles$i.container, {
|
|
2683
|
+
[styles$i.disabled]: disabled,
|
|
2684
|
+
[styles$i.error]: hasError && !disabled,
|
|
2675
2685
|
[className]: className,
|
|
2676
2686
|
});
|
|
2677
|
-
return (jsxs("div", { className: containerClass, children: [label && (jsx(LabelComponent, { htmlFor: componentId, required: required, tooltip: tooltip, tooltipText: tooltipText, side: side, align: align, error: hasError, disabled: disabled, children: label })), jsxs("div", { className: styles$
|
|
2678
|
-
[styles$
|
|
2679
|
-
}) }), showCustomIcon && jsx("span", { className: styles$
|
|
2687
|
+
return (jsxs("div", { className: containerClass, children: [label && (jsx(LabelComponent, { htmlFor: componentId, required: required, tooltip: tooltip, tooltipText: tooltipText, side: side, align: align, error: hasError, disabled: disabled, children: label })), jsxs("div", { className: styles$i.inputWrapper, children: [jsxs("div", { className: styles$i.inputContainer, children: [jsx("input", { ...rest, ref: ref, id: componentId, name: name, type: type, value: inputValue, placeholder: placeholder, onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur, maxLength: maxLength, disabled: disabled, "aria-invalid": hasError, "aria-required": required, "aria-describedby": helperId, className: clsx({
|
|
2688
|
+
[styles$i.inputWithIcon]: showCustomIcon || showClearIcon,
|
|
2689
|
+
}) }), showCustomIcon && jsx("span", { className: styles$i.icon, children: icon }), showClearIcon && (jsx("button", { type: "button", className: styles$i.clearButton, onMouseDown: (e) => {
|
|
2680
2690
|
e.preventDefault();
|
|
2681
2691
|
handleClear();
|
|
2682
|
-
}, "aria-label": "Limpar campo", tabIndex: -1, children: jsx(Dismiss16Regular, {}) }))] }), jsx("span", { id: helperId, className: styles$
|
|
2692
|
+
}, "aria-label": "Limpar campo", tabIndex: -1, children: jsx(Dismiss16Regular, {}) }))] }), jsx("span", { id: helperId, className: styles$i.helperText, "aria-live": hasError ? 'polite' : undefined, children: displayHelperText })] })] }));
|
|
2683
2693
|
});
|
|
2684
2694
|
TextField.displayName = 'TextField';
|
|
2685
2695
|
var TextField$1 = React__default.memo(TextField);
|
|
2686
2696
|
|
|
2687
|
-
var styles$
|
|
2697
|
+
var styles$g = {"datePicker":"DatePicker-module__datePicker___raJYg","textfieldContainer":"DatePicker-module__textfieldContainer___yy8pT","datePickerIcon":"DatePicker-module__datePickerIcon___XCZsn","datePickerIconDisabled":"DatePicker-module__datePickerIconDisabled___BB-Gx"};
|
|
2688
2698
|
|
|
2689
2699
|
function formatDate(date, locale = 'pt-br') {
|
|
2690
2700
|
if (!date || !(date instanceof Date)) {
|
|
@@ -2776,7 +2786,7 @@ function validatePartialDate(value, locale = 'pt-br') {
|
|
|
2776
2786
|
return 'incomplete';
|
|
2777
2787
|
}
|
|
2778
2788
|
|
|
2779
|
-
const DatePicker = ({ locale = 'pt-br', calendarSide = 'bottom', calendarAlign = 'start', helperText, required = false, label = 'Data', value, defaultValue, onChange, disabled = false, error: externalError, minDate, maxDate, 'data-testid': testId, }) => {
|
|
2789
|
+
const DatePicker = ({ locale = 'pt-br', calendarSide = 'bottom', calendarAlign = 'start', helperText, required = false, label = 'Data', value, defaultValue, onChange, disabled = false, error: externalError, minDate, maxDate, 'data-testid': testId, className, ...rest }) => {
|
|
2780
2790
|
const fieldId = useId();
|
|
2781
2791
|
const calendarId = `${fieldId}-calendar`;
|
|
2782
2792
|
const isControlled = value !== undefined;
|
|
@@ -2905,7 +2915,7 @@ const DatePicker = ({ locale = 'pt-br', calendarSide = 'bottom', calendarAlign =
|
|
|
2905
2915
|
}
|
|
2906
2916
|
}
|
|
2907
2917
|
};
|
|
2908
|
-
return (jsx("div", { ref: wrapperRef, className: styles$
|
|
2918
|
+
return (jsx("div", { ref: wrapperRef, className: clsx(styles$g.datePicker, className), ...rest, children: jsx(Popover, { open: showCalendar, onOpenChange: setShowCalendar, asAnchor: true, trigger: jsx(TextField$1, { className: styles$g.textfieldContainer, type: "tel", icon: jsx(Calendar16Regular, { onClick: !disabled ? handleIconClick : undefined, className: clsx(styles$g.datePickerIcon, disabled && styles$g.datePickerIconDisabled) }), onChange: (e) => {
|
|
2909
2919
|
handleTextFieldChange(String(e));
|
|
2910
2920
|
}, onKeyDown: handleKeyDown, onFocus: handleFocus, persistIcon: true, autoComplete: "off", value: displayValue, helperText: !externalError ? (helperText || undefined) : undefined, errorMessage: externalError ? combinedHelperText : undefined, error: hasValidationError ? true : undefined, maxLength: 10, required: required, label: label, disabled: disabled, id: fieldId, "data-testid": testId, placeholder: locale === 'en-us' ? 'MM/DD/YYYY' : 'DD/MM/YYYY', "aria-label": "Open calendar", "aria-expanded": showCalendar, "aria-controls": calendarId, "aria-invalid": hasValidationError, "aria-describedby": externalError ? undefined : (helperText ? `${fieldId}-help` : undefined) }), content: jsx(Calendar, { selected: currentSelectedDate, currentDate: currentDate, onDateChange: setCurrentDate, onDaySelect: handleDaySelect, locale: locale, format: locale === 'en-us' ? 'mm/dd/yyyy' : 'dd/mm/yyyy', minDate: minDate, maxDate: maxDate, id: calendarId, onClear: () => {
|
|
2911
2921
|
handleDateChange(null);
|
|
@@ -2914,13 +2924,13 @@ const DatePicker = ({ locale = 'pt-br', calendarSide = 'bottom', calendarAlign =
|
|
|
2914
2924
|
};
|
|
2915
2925
|
var DatePicker_default = React__default.memo(DatePicker);
|
|
2916
2926
|
|
|
2917
|
-
var styles$
|
|
2927
|
+
var styles$f = {"DialogOverlay":"Dialog-module__DialogOverlay___LEX2O","DialogContent":"Dialog-module__DialogContent___ziVXb","DialogTitle":"Dialog-module__DialogTitle___ay1tD","DialogDescription":"Dialog-module__DialogDescription___odslw","DivButtons":"Dialog-module__DivButtons___BiwX-"};
|
|
2918
2928
|
|
|
2919
|
-
const Dialog = ({ show = false, title, bodyContent, textPrimaryAction, textSecondaryAction, onPrimaryAction, onSecondaryAction, ...
|
|
2929
|
+
const Dialog = ({ show = false, title, bodyContent, textPrimaryAction, textSecondaryAction, onPrimaryAction, onSecondaryAction, className, ...rest }) => (jsx(AlertDialog.Root, { open: show, ...rest, children: jsxs(AlertDialog.Portal, { children: [jsx(AlertDialog.Overlay, { className: styles$f.DialogOverlay }), jsxs(AlertDialog.Content, { className: clsx(styles$f.DialogContent, className), children: [jsx(AlertDialog.Title, { className: styles$f.DialogTitle, children: title }), jsx(AlertDialog.Description, { className: styles$f.DialogDescription, children: bodyContent }), jsxs("div", { className: styles$f.DivButtons, children: [!!(textSecondaryAction && textSecondaryAction.trim()) && (jsx(AlertDialog.Cancel, { asChild: true, children: jsx(Button, { variant: "outlined", ...(onSecondaryAction && { onClick: onSecondaryAction }), children: textSecondaryAction }) })), jsx(AlertDialog.Action, { asChild: true, children: jsx(Button, { variant: "filled", ...(onPrimaryAction && { onClick: onPrimaryAction }), children: textPrimaryAction }) })] })] })] }) }));
|
|
2920
2930
|
|
|
2921
|
-
var styles$
|
|
2931
|
+
var styles$e = {"drawerShadow":"Drawer-module__drawerShadow___0Z6iL","drawerShadow--visible":"Drawer-module__drawerShadow--visible___FspoH","drawerSidebar":"Drawer-module__drawerSidebar___cdyyb","drawerSidebar--open":"Drawer-module__drawerSidebar--open___ee2-Y","drawerSidebar--disabled":"Drawer-module__drawerSidebar--disabled___MYrBI","drawerTitleClose":"Drawer-module__drawerTitleClose___QzqN-","drawerTitle":"Drawer-module__drawerTitle___naMX0","drawerChildren":"Drawer-module__drawerChildren___xGdg9","drawerHeaderContent":"Drawer-module__drawerHeaderContent___NLSwj"};
|
|
2922
2932
|
|
|
2923
|
-
const Drawer = ({ children, headerContent, customWidth = '400px', onClose, title = 'Título', isOpen = false, onOpen, className, id, disabled = false, onOverlayClick, closeOnOverlayClick = true, closeOnEscape = true, }) => {
|
|
2933
|
+
const Drawer = ({ children, headerContent, customWidth = '400px', onClose, title = 'Título', isOpen = false, onOpen, className, id, disabled = false, onOverlayClick, closeOnOverlayClick = true, closeOnEscape = true, ...rest }) => {
|
|
2924
2934
|
const internalClose = useCallback(() => {
|
|
2925
2935
|
if (disabled)
|
|
2926
2936
|
return;
|
|
@@ -2967,17 +2977,17 @@ const Drawer = ({ children, headerContent, customWidth = '400px', onClose, title
|
|
|
2967
2977
|
event.stopPropagation();
|
|
2968
2978
|
internalClose();
|
|
2969
2979
|
};
|
|
2970
|
-
return createPortal(jsxs(Fragment, { children: [jsx("div", { className: clsx(styles$
|
|
2971
|
-
[styles$
|
|
2972
|
-
}), onClick: handleOverlayClick, role: "presentation", "aria-hidden": "true", "data-testid": "drawer-overlay" }), jsxs("div", { className: clsx(styles$
|
|
2973
|
-
[styles$
|
|
2974
|
-
[styles$
|
|
2980
|
+
return createPortal(jsxs(Fragment, { children: [jsx("div", { className: clsx(styles$e['drawerShadow'], {
|
|
2981
|
+
[styles$e['drawerShadow--visible']]: isOpen,
|
|
2982
|
+
}), onClick: handleOverlayClick, role: "presentation", "aria-hidden": "true", "data-testid": "drawer-overlay" }), jsxs("div", { className: clsx(styles$e['drawerSidebar'], {
|
|
2983
|
+
[styles$e['drawerSidebar--open']]: isOpen,
|
|
2984
|
+
[styles$e['drawerSidebar--disabled']]: disabled,
|
|
2975
2985
|
}, className), style: {
|
|
2976
2986
|
'--drawer-custom-width': customWidth,
|
|
2977
|
-
}, onClick: handleDrawerClick, role: "dialog", "aria-modal": "true", "aria-labelledby": id ? `${id}-title` : 'drawer-title', "aria-hidden": !isOpen, "data-testid": "drawer-panel", id: id, children: [jsxs("div", { className: styles$
|
|
2987
|
+
}, onClick: handleDrawerClick, role: "dialog", "aria-modal": "true", "aria-labelledby": id ? `${id}-title` : 'drawer-title', "aria-hidden": !isOpen, "data-testid": "drawer-panel", id: id, ...rest, children: [jsxs("div", { className: styles$e.drawerTitleClose, children: [jsx("div", { className: styles$e.drawerTitle, id: id ? `${id}-title` : 'drawer-title', children: title }), headerContent && (jsx("div", { className: styles$e.drawerHeaderContent, children: headerContent })), jsx(Button, { onClick: handleCloseClick, variant: 'outlined', iconOnly: true, icon: jsx(Dismiss16Regular, {}), size: 'lg', tooltipText: 'Fechar' })] }), jsx("div", { className: styles$e.drawerChildren, "data-testid": "drawer-content", children: children })] })] }), document.body);
|
|
2978
2988
|
};
|
|
2979
2989
|
|
|
2980
|
-
var styles$
|
|
2990
|
+
var styles$d = {"search":"Search-module__search___u3QsV","searchLeftIcon":"Search-module__searchLeftIcon___OKOBq","disabled":"Search-module__disabled___adbxO","inputWithClearIcon":"Search-module__inputWithClearIcon___cqvkq","searchClearIcon":"Search-module__searchClearIcon___qX9-h"};
|
|
2981
2991
|
|
|
2982
2992
|
const Search = React__default.forwardRef(({ placeholder = 'Dica do que deve ser buscado', disabled = false, value, onChange, onKeyDown, onFocus, onBlur, onClear, onClick, onMouseDown, id, className, 'data-testid': testId, ...rest }, ref) => {
|
|
2983
2993
|
const [internalValue, setInternalValue] = useState('');
|
|
@@ -3025,16 +3035,16 @@ const Search = React__default.forwardRef(({ placeholder = 'Dica do que deve ser
|
|
|
3025
3035
|
return;
|
|
3026
3036
|
onKeyDown?.(e);
|
|
3027
3037
|
};
|
|
3028
|
-
return (jsxs("div", { className: clsx(styles$
|
|
3038
|
+
return (jsxs("div", { className: clsx(styles$d.search, { [styles$d.disabled]: disabled }, className), onClick: onClick, onMouseDown: onMouseDown, role: onClick || onMouseDown ? "button" : undefined, tabIndex: onClick || onMouseDown ? 0 : undefined, onKeyDown: onClick || onMouseDown ? (e) => {
|
|
3029
3039
|
if (e.key === 'Enter' || e.key === ' ') {
|
|
3030
3040
|
e.preventDefault();
|
|
3031
3041
|
onClick?.(e);
|
|
3032
3042
|
}
|
|
3033
|
-
} : undefined, children: [jsx("span", { className: clsx(styles$
|
|
3043
|
+
} : undefined, children: [jsx("span", { className: clsx(styles$d.searchLeftIcon, { [styles$d.disabled]: disabled }), tabIndex: -1, role: "presentation", "aria-hidden": "true", children: jsx(Search16Regular, {}) }), jsx("input", { ref: ref, id: inputId, type: "text", placeholder: placeholder, "aria-label": placeholder, value: currentValue || '', onChange: handleChange, onKeyDown: handleKeyDown, disabled: disabled, onFocus: handleFocus, onBlur: handleBlur, "data-testid": testId, ...rest, className: clsx({ [styles$d.inputWithClearIcon]: currentValue && currentValue.length > 0 }) }), currentValue && currentValue.length > 0 && (jsx("span", { className: styles$d.searchClearIcon, "aria-hidden": "true", onClick: clearInputSearch, children: jsx(Dismiss16Regular, {}) }))] }));
|
|
3034
3044
|
});
|
|
3035
3045
|
Search.displayName = 'Search';
|
|
3036
3046
|
|
|
3037
|
-
var styles$
|
|
3047
|
+
var styles$c = {"container":"Filter-module__container___cqntK","panel":"Filter-module__panel___19HqD","search":"Filter-module__search___f0gzj","list":"Filter-module__list___UpBk1","item":"Filter-module__item___oNdeY","itemSelected":"Filter-module__itemSelected___JIpJV","itemText":"Filter-module__itemText___RS--0","itemDisabled":"Filter-module__itemDisabled___X-ktg","itemIcon":"Filter-module__itemIcon___RjJSa","noResults":"Filter-module__noResults___3m6pn","footer":"Filter-module__footer___yYS5j","buttonContent":"Filter-module__buttonContent___28fKe","buttonArrow":"Filter-module__buttonArrow___VJlpc","buttonIcon":"Filter-module__buttonIcon___OOBpZ"};
|
|
3038
3048
|
|
|
3039
3049
|
const Filter = ({ items, type = 'checkbox', selectedIds, onApplyFilter, placeholder = 'Selecionar...', enableSearch = false, buttonText = 'Filter', icon, variant = 'outlined', onOpen, onClose, side = 'bottom', align = 'start', disabled = false, className, selectedDate, onDateSelect, onClearDate, minDate, maxDate, locale = 'pt-br', id, ...rest }) => {
|
|
3040
3050
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -3127,34 +3137,34 @@ const Filter = ({ items, type = 'checkbox', selectedIds, onApplyFilter, placehol
|
|
|
3127
3137
|
return null;
|
|
3128
3138
|
return selectedIds.length - 1;
|
|
3129
3139
|
}, [selectedIds]);
|
|
3130
|
-
const filterClass = clsx(styles$
|
|
3131
|
-
const triggerButton = (jsx(Button, { variant: variant, disabled: disabled, icon: type === 'calendar' ? jsx(Calendar16Regular, {}) : jsx(ChevronDownRegular, {}), iconPosition: "right", size: "lg", children: jsxs("div", { className: styles$
|
|
3132
|
-
const popoverContent = type === 'calendar' ? (jsx(Calendar, { currentDate: currentCalendarDate, selected: selectedDate, onDaySelect: handleDateSelection, onDateChange: handleCalendarNavigation, minDate: minDate, maxDate: maxDate, locale: locale, onClear: handleClear, id: `filter-calendar-${id || ''}`, "aria-label": "Selecionar data para filtro" })) : (jsxs("div", { className: styles$
|
|
3140
|
+
const filterClass = clsx(styles$c.container, className);
|
|
3141
|
+
const triggerButton = (jsx(Button, { variant: variant, disabled: disabled, icon: type === 'calendar' ? jsx(Calendar16Regular, {}) : jsx(ChevronDownRegular, {}), iconPosition: "right", size: "lg", children: jsxs("div", { className: styles$c.buttonContent, children: [icon && jsx("span", { className: styles$c.buttonIcon, children: icon }), jsx("span", { className: styles$c.buttonText, children: buttonDisplayText }), jsx("span", { className: clsx(styles$c.buttonArrow, { [styles$c.buttonArrowOpen]: isOpen }), children: getBadgeValue() && (jsx(Badge, { badgeValue: `+${getBadgeValue()}`, filterVariant: true })) })] }) }));
|
|
3142
|
+
const popoverContent = type === 'calendar' ? (jsx(Calendar, { currentDate: currentCalendarDate, selected: selectedDate, onDaySelect: handleDateSelection, onDateChange: handleCalendarNavigation, minDate: minDate, maxDate: maxDate, locale: locale, onClear: handleClear, id: `filter-calendar-${id || ''}`, "aria-label": "Selecionar data para filtro" })) : (jsxs("div", { className: styles$c.panel, children: [searchVisible && (jsx("div", { className: styles$c.search, children: jsx(Search, { value: searchQuery, placeholder: placeholder, onChange: handleSearchChange, onKeyDown: handleSearchKeyDown, onClear: () => setSearchQuery('') }) })), jsx("ul", { className: styles$c.list, role: "listbox", "aria-multiselectable": type === 'checkbox', children: filteredItems.length > 0 ? (filteredItems.map((item, index) => {
|
|
3133
3143
|
const itemId = item.id || `filter-item-${index}`;
|
|
3134
3144
|
const isSelected = !!tempSelectedItems[itemId];
|
|
3135
|
-
return (jsxs("li", { role: "option", "aria-selected": isSelected, "aria-disabled": item.disabled, className: clsx(styles$
|
|
3136
|
-
[styles$
|
|
3137
|
-
[styles$
|
|
3145
|
+
return (jsxs("li", { role: "option", "aria-selected": isSelected, "aria-disabled": item.disabled, className: clsx(styles$c.item, {
|
|
3146
|
+
[styles$c.itemSelected]: isSelected,
|
|
3147
|
+
[styles$c.itemDisabled]: item.disabled,
|
|
3138
3148
|
}), onMouseDown: (e) => e.preventDefault(), onClick: () => toggleItem(itemId, item), onKeyDown: (e) => {
|
|
3139
3149
|
if (e.key === 'Enter' || e.key === ' ') {
|
|
3140
3150
|
e.preventDefault();
|
|
3141
3151
|
toggleItem(itemId, item);
|
|
3142
3152
|
}
|
|
3143
|
-
}, children: [type === 'checkbox' && (jsx(Checkbox, { checked: isSelected, disabled: item.disabled, label: "" })), type === 'icon' && item.icon && (jsx("span", { className: styles$
|
|
3144
|
-
})) : (jsx("li", { className: styles$
|
|
3153
|
+
}, children: [type === 'checkbox' && (jsx(Checkbox, { checked: isSelected, disabled: item.disabled, label: "" })), type === 'icon' && item.icon && (jsx("span", { className: styles$c.itemIcon, children: item.icon })), jsx("span", { className: styles$c.itemText, children: item.text })] }, itemId));
|
|
3154
|
+
})) : (jsx("li", { className: styles$c.noResults, role: "status", "aria-live": "polite", children: "Nenhum item encontrado" })) }), jsxs("div", { className: styles$c.footer, children: [jsx(Button, { fullWidth: true, variant: "outlined", onClick: handleClearFilter, children: "Limpar" }), jsx(Button, { fullWidth: true, onClick: handleApplyFilter, children: "Aplicar" })] })] }));
|
|
3145
3155
|
return (jsx("div", { className: filterClass, id: id, ...rest, children: jsx(Popover, { open: isOpen, onOpenChange: handleOpenChange, side: side, align: align, onOpenAutoFocus: (e) => e.preventDefault(), trigger: triggerButton, content: popoverContent }) }));
|
|
3146
3156
|
};
|
|
3147
3157
|
|
|
3148
|
-
var styles$
|
|
3158
|
+
var styles$b = {"zds-list-item__container":"ListItem-module__zds-list-item__container___mEIUK","zds-list-item--checkbox":"ListItem-module__zds-list-item--checkbox___wfi9-","zds-list-item--icon":"ListItem-module__zds-list-item--icon___h3Ijt","zds-list-item--radio":"ListItem-module__zds-list-item--radio___2l7mK","zds-list-item--text":"ListItem-module__zds-list-item--text___F0PDx","zds-list-item--hovered":"ListItem-module__zds-list-item--hovered___XrDWn","zds-list-item--disabled":"ListItem-module__zds-list-item--disabled___p1xZF","zds-list-item__wrapper-text":"ListItem-module__zds-list-item__wrapper-text___5-TX2","zds-list-item__wrapper-icon":"ListItem-module__zds-list-item__wrapper-icon___S6Fr1","zds-list-item__title":"ListItem-module__zds-list-item__title___AV7nz","zds-list-item__subtext":"ListItem-module__zds-list-item__subtext___nfXky","zds-list-item__text":"ListItem-module__zds-list-item__text___3y0sB"};
|
|
3149
3159
|
|
|
3150
|
-
var styles$
|
|
3160
|
+
var styles$a = {"root":"Radio-module__root___7ElY2","wrapper":"Radio-module__wrapper___NYQ1y","disabled":"Radio-module__disabled___RZ0be","labelText":"Radio-module__labelText___Wkb41","item":"Radio-module__item___3Kvj7","itemWrapper":"Radio-module__itemWrapper___5KbM1","labelWrapper":"Radio-module__labelWrapper___LOHmJ","indicator":"Radio-module__indicator___TJ5hz"};
|
|
3151
3161
|
|
|
3152
|
-
const Radio = ({ items, onValueChange, defaultValue, name, id, ariaLabel, orientation = 'vertical', ...rest }) => {
|
|
3162
|
+
const Radio = ({ items, onValueChange, defaultValue, name, id, ariaLabel, orientation = 'vertical', className, ...rest }) => {
|
|
3153
3163
|
const componentId = id || useId();
|
|
3154
|
-
return (jsx(RadioGroup.Root, { id: componentId, className: styles$
|
|
3164
|
+
return (jsx(RadioGroup.Root, { id: componentId, className: clsx(styles$a.root, className), defaultValue: defaultValue, onValueChange: onValueChange, name: name, "aria-label": ariaLabel, "data-orientation": orientation, orientation: orientation, ...rest, children: items.map(({ id, value, disabled, label }) => {
|
|
3155
3165
|
const itemKey = id ?? value;
|
|
3156
3166
|
const uniqueId = `${componentId}-item-${value}`;
|
|
3157
|
-
return (jsx("div", { className: clsx(styles$
|
|
3167
|
+
return (jsx("div", { className: clsx(styles$a.wrapper, { [styles$a.disabled]: disabled }), children: jsxs("label", { className: styles$a.labelWrapper, htmlFor: uniqueId, children: [jsx("div", { className: styles$a.itemWrapper, children: jsx(RadioGroup.Item, { disabled: disabled, className: styles$a.item, value: value, id: uniqueId, "data-disabled": disabled, children: jsx(RadioGroup.Indicator, { className: styles$a.indicator }) }) }), jsx("span", { className: styles$a.labelText, children: label })] }) }, itemKey));
|
|
3158
3168
|
}) }));
|
|
3159
3169
|
};
|
|
3160
3170
|
|
|
@@ -3216,24 +3226,24 @@ const ListItem = ({ id, className, variant = 'text', text, name, subText, disabl
|
|
|
3216
3226
|
const currentVariant = validVariants.includes(variant) ? variant : 'text';
|
|
3217
3227
|
switch (currentVariant) {
|
|
3218
3228
|
case 'checkbox':
|
|
3219
|
-
return (jsxs(Fragment, { children: [jsx(Checkbox, { checked: internalChecked, disabled: disabled, onCheckedChange: () => handleCheckboxClick({}) }), jsxs("div", { className: styles$
|
|
3229
|
+
return (jsxs(Fragment, { children: [jsx(Checkbox, { checked: internalChecked, disabled: disabled, onCheckedChange: () => handleCheckboxClick({}) }), jsxs("div", { className: styles$b['zds-list-item__wrapper-text'], children: [jsx("span", { id: `${itemId}-text`, className: styles$b['zds-list-item__text'], onClick: handleCheckboxClick, children: text }), showSubText && subText && (jsx("span", { id: `${itemId}-subtext`, className: styles$b['zds-list-item__subtext'], onClick: handleCheckboxClick, children: subText }))] })] }));
|
|
3220
3230
|
case 'radio':
|
|
3221
|
-
return (jsxs(Fragment, { children: [jsx("div", { className: styles$
|
|
3231
|
+
return (jsxs(Fragment, { children: [jsx("div", { className: styles$b['zds-list-item__wrapper-radio'], children: jsx("span", { className: styles$b['zds-list-item__radio'], "aria-hidden": "true", children: jsx(Radio, { name: name, onValueChange: () => handleRadioClick({}), items: [{
|
|
3222
3232
|
value: value || '',
|
|
3223
3233
|
label: '',
|
|
3224
3234
|
disabled: disabled
|
|
3225
|
-
}], "aria-labelledby": `${itemId}-text` }) }) }), jsxs("div", { className: styles$
|
|
3235
|
+
}], "aria-labelledby": `${itemId}-text` }) }) }), jsxs("div", { className: styles$b['zds-list-item__wrapper-text'], children: [jsx("span", { id: `${itemId}-text`, className: styles$b['zds-list-item__title'], onClick: handleRadioClick, children: text }), showSubText && subText && (jsx("span", { id: `${itemId}-subtext`, className: styles$b['zds-list-item__subtext'], children: subText }))] })] }));
|
|
3226
3236
|
case 'icon':
|
|
3227
|
-
return (jsxs(Fragment, { children: [jsx("div", { className: styles$
|
|
3237
|
+
return (jsxs(Fragment, { children: [jsx("div", { className: styles$b['zds-list-item__wrapper-icon'], children: icon }), jsxs("div", { className: styles$b['zds-list-item__wrapper-text'], children: [jsx("span", { id: `${itemId}-text`, className: styles$b['zds-list-item__title'], onClick: handleTextOrIconClick, children: text }), showSubText && subText && (jsx("span", { id: `${itemId}-subtext`, className: styles$b['zds-list-item__subtext'], children: subText }))] })] }));
|
|
3228
3238
|
case 'text':
|
|
3229
3239
|
default:
|
|
3230
|
-
return (jsxs("div", { className: styles$
|
|
3240
|
+
return (jsxs("div", { className: styles$b['zds-list-item__wrapper-text'], children: [jsx("span", { id: `${itemId}-text`, className: styles$b['zds-list-item__title'], onClick: handleTextOrIconClick, children: text }), showSubText && subText && (jsx("span", { id: `${itemId}-subtext`, className: styles$b['zds-list-item__subtext'], children: subText }))] }));
|
|
3231
3241
|
}
|
|
3232
3242
|
}, [variant, itemId, internalChecked, disabled, handleCheckboxClick, handleRadioClick, handleTextOrIconClick, value, text, showSubText, subText, icon, name]);
|
|
3233
|
-
const listItemClass = clsx(styles$
|
|
3234
|
-
[styles$
|
|
3235
|
-
[styles$
|
|
3236
|
-
[styles$
|
|
3243
|
+
const listItemClass = clsx(styles$b['zds-list-item__container'], {
|
|
3244
|
+
[styles$b[`zds-list-item--${variant}`]]: variant,
|
|
3245
|
+
[styles$b['zds-list-item--disabled']]: disabled,
|
|
3246
|
+
[styles$b['zds-list-item--hovered']]: hovered,
|
|
3237
3247
|
[className || '']: className
|
|
3238
3248
|
});
|
|
3239
3249
|
const getAriaChecked = useCallback(() => {
|
|
@@ -3245,13 +3255,13 @@ const ListItem = ({ id, className, variant = 'text', text, name, subText, disabl
|
|
|
3245
3255
|
return (jsx("li", { className: listItemClass, tabIndex: disabled ? -1 : 0, onKeyDown: handleKeyDown, "aria-selected": variant === 'text' || variant === 'icon' ? internalSelected : undefined, "aria-disabled": disabled, "aria-checked": getAriaChecked(), "aria-labelledby": `${itemId}-text`, "aria-describedby": showSubText && subText ? `${itemId}-subtext` : undefined, "data-testid": "list-item", ...rest, children: renderVariantContent() }));
|
|
3246
3256
|
};
|
|
3247
3257
|
|
|
3248
|
-
var styles$
|
|
3258
|
+
var styles$9 = {"content":"Menu-module__content___pnDF6","subContent":"Menu-module__subContent___O9T-y","itemsWrapper":"Menu-module__itemsWrapper___Fcg71","item":"Menu-module__item___S3HKY","subTrigger":"Menu-module__subTrigger___CdnJE","itemSubText":"Menu-module__itemSubText___U1HFP","itemIcon":"Menu-module__itemIcon___iyxmZ","wrapperText":"Menu-module__wrapperText___PomUe","itemText":"Menu-module__itemText___2fd2B","chevronIcon":"Menu-module__chevronIcon___Gda-U","searchWrapper":"Menu-module__searchWrapper___e0knQ","emptyState":"Menu-module__emptyState___3wh-S","loadingMore":"Menu-module__loadingMore___fUCvH"};
|
|
3249
3259
|
|
|
3250
3260
|
const MenuItem = memo(({ item, isSelected, onSelect }) => {
|
|
3251
3261
|
const handleSelect = () => {
|
|
3252
3262
|
onSelect(item);
|
|
3253
3263
|
};
|
|
3254
|
-
return (jsxs(DropdownMenu.Item, { className: clsx(styles$
|
|
3264
|
+
return (jsxs(DropdownMenu.Item, { className: clsx(styles$9.item), "data-selected": isSelected || undefined, onSelect: handleSelect, disabled: item.disabled, children: [item.icon && jsx("span", { className: styles$9.itemIcon, children: item.icon }), jsxs("div", { className: styles$9.wrapperText, children: [jsx("span", { className: styles$9.itemText, children: item.text }), item.subText && (jsx("span", { className: styles$9.itemSubText, children: item.subText }))] })] }));
|
|
3255
3265
|
});
|
|
3256
3266
|
MenuItem.displayName = 'MenuItem';
|
|
3257
3267
|
|
|
@@ -3473,7 +3483,7 @@ const Menu = ({ items, children, onItemSelect, search, enableInfiniteScroll, onS
|
|
|
3473
3483
|
const renderMenuItem = useCallback((item, key) => {
|
|
3474
3484
|
const hasChildren = item.children && item.children.length > 0;
|
|
3475
3485
|
if (hasChildren) {
|
|
3476
|
-
return (jsxs(DropdownMenu.Sub, { children: [jsxs(DropdownMenu.SubTrigger, { className: styles$
|
|
3486
|
+
return (jsxs(DropdownMenu.Sub, { children: [jsxs(DropdownMenu.SubTrigger, { className: styles$9.subTrigger, disabled: item.disabled, children: [item.icon && (jsx("span", { className: styles$9.itemIcon, children: item.icon })), jsxs("div", { className: styles$9.wrapperText, children: [jsx("span", { className: styles$9.itemText, children: item.text }), item.subText && (jsx("span", { className: styles$9.itemSubText, children: item.subText }))] }), jsx(ChevronRight16Filled, { className: styles$9.chevronIcon })] }), jsx(DropdownMenu.Portal, { children: jsx(DropdownMenu.SubContent, { className: styles$9.subContent, sideOffset: 16, collisionPadding: 20, children: item.children.map((childItem, childIndex) => renderMenuItem(childItem, `${key}-${childIndex}`)) }) })] }, key));
|
|
3477
3487
|
}
|
|
3478
3488
|
return (jsx(MenuItem, { item: item, isSelected: isItemSelected(item), onSelect: handleItemSelect }, key));
|
|
3479
3489
|
}, [handleItemSelect, isItemSelected]);
|
|
@@ -3484,7 +3494,7 @@ const Menu = ({ items, children, onItemSelect, search, enableInfiniteScroll, onS
|
|
|
3484
3494
|
hasReachedEndRef.current = false;
|
|
3485
3495
|
}
|
|
3486
3496
|
};
|
|
3487
|
-
return (jsxs(DropdownMenu.Root, { open: open, onOpenChange: handleOpenChange, children: [jsx(DropdownMenu.Trigger, { asChild: true, children: children }), jsx(DropdownMenu.Portal, { children: jsxs(DropdownMenu.Content, { className: clsx(styles$
|
|
3497
|
+
return (jsxs(DropdownMenu.Root, { open: open, onOpenChange: handleOpenChange, children: [jsx(DropdownMenu.Trigger, { asChild: true, children: children }), jsx(DropdownMenu.Portal, { children: jsxs(DropdownMenu.Content, { className: clsx(styles$9.content, className), sideOffset: 8, align: align, onPointerDown: () => { closedByPointerRef.current = true; }, onInteractOutside: () => { closedByPointerRef.current = true; }, onCloseAutoFocus: (e) => {
|
|
3488
3498
|
if (closedByPointerRef.current) {
|
|
3489
3499
|
e.preventDefault();
|
|
3490
3500
|
closedByPointerRef.current = false;
|
|
@@ -3493,23 +3503,28 @@ const Menu = ({ items, children, onItemSelect, search, enableInfiniteScroll, onS
|
|
|
3493
3503
|
if (search) {
|
|
3494
3504
|
e.stopPropagation();
|
|
3495
3505
|
}
|
|
3496
|
-
}, ...rest, children: [search && (jsx("div", { className: styles$
|
|
3506
|
+
}, ...rest, children: [search && (jsx("div", { className: styles$9.searchWrapper, children: jsx(Search, { placeholder: "Buscar", onChange: handleSearchChange, value: searchInput, onKeyDown: handleSearchKeyDown }) })), jsxs("div", { className: styles$9.itemsWrapper, ref: itemsWrapperRef, style: { maxHeight: maxHeightStyle }, children: [filteredItems.length > 0 ? (filteredItems.map((item, index) => renderMenuItem(item, item.value || item.text || `item-${index}`))) : (jsx("div", { className: styles$9.emptyState, children: "Nenhum item encontrado" })), enableInfiniteScroll && isLoadingMore && (jsx("div", { className: styles$9.loadingMore, children: "Carregando mais itens..." })), enableInfiniteScroll && (jsx("div", { ref: sentinelRef, "data-scroll-sentinel": true, style: { height: '1px', visibility: 'hidden' } }))] })] }) })] }));
|
|
3497
3507
|
};
|
|
3498
3508
|
|
|
3499
|
-
var styles$
|
|
3509
|
+
var styles$8 = {"modalOverlay":"Modal-module__modalOverlay___rI8Wz","modalContent":"Modal-module__modalContent___6Cgb1","modalContent--fullscreen":"Modal-module__modalContent--fullscreen___QeBlG","modalHeader":"Modal-module__modalHeader___IuHIg","modalTitle":"Modal-module__modalTitle___9VDmr","modalBody":"Modal-module__modalBody___ohjQm"};
|
|
3500
3510
|
|
|
3501
|
-
const Modal = ({ isOpen = false, onClose, title, children, headerContent, closeOnOverlayClick = true, className, id, footer, customWidth, fullscreen = false, }) => {
|
|
3511
|
+
const Modal = ({ isOpen = false, onClose, title, children, headerContent, closeOnOverlayClick = true, className, id, footer, customWidth, fullscreen = false, ...rest }) => {
|
|
3512
|
+
const contentRef = React.useRef(null);
|
|
3502
3513
|
const handleOpenChange = (open) => {
|
|
3503
3514
|
if (!open) {
|
|
3504
3515
|
onClose();
|
|
3505
3516
|
}
|
|
3506
3517
|
};
|
|
3507
|
-
|
|
3518
|
+
const handleOpenAutoFocus = (e) => {
|
|
3519
|
+
e.preventDefault();
|
|
3520
|
+
contentRef.current?.focus();
|
|
3521
|
+
};
|
|
3522
|
+
return (jsx(Dialog$1.Root, { open: isOpen, onOpenChange: handleOpenChange, ...rest, children: jsxs(Dialog$1.Portal, { children: [jsx(Dialog$1.Overlay, { className: styles$8.modalOverlay }), jsxs(Dialog$1.Content, { ref: contentRef, className: clsx(styles$8.modalContent, fullscreen && styles$8['modalContent--fullscreen'], className), id: id, style: {
|
|
3508
3523
|
'--modal-custom-width': customWidth,
|
|
3509
|
-
}, onInteractOutside: !closeOnOverlayClick ? (e) => e.preventDefault() : undefined, "aria-labelledby": id ? `${id}-title` : 'modal-title', children: [jsxs("div", { className: styles$
|
|
3524
|
+
}, onInteractOutside: !closeOnOverlayClick ? (e) => e.preventDefault() : undefined, onOpenAutoFocus: handleOpenAutoFocus, "aria-labelledby": id ? `${id}-title` : 'modal-title', tabIndex: -1, children: [jsxs("div", { className: styles$8.modalHeader, children: [title && (jsx(Dialog$1.Title, { className: styles$8.modalTitle, id: id ? `${id}-title` : 'modal-title', children: title })), headerContent && (jsx("div", { children: headerContent })), jsx(Dialog$1.Close, { asChild: true, children: jsx(Button, { variant: "outlined", iconOnly: true, icon: jsx(Dismiss16Regular, {}), size: "lg", tooltipText: 'Fechar' }) })] }), jsx("div", { className: styles$8.modalBody, children: children }), footer && (jsx("div", { className: styles$8.modalFooter, children: footer }))] })] }) }));
|
|
3510
3525
|
};
|
|
3511
3526
|
|
|
3512
|
-
var styles$
|
|
3527
|
+
var styles$7 = {"quantity":"Quantity-module__quantity___-vndR","quantityInput":"Quantity-module__quantityInput___xZG-v","disabled":"Quantity-module__disabled___X6p5l"};
|
|
3513
3528
|
|
|
3514
3529
|
const Quantity = ({ value = 0, onChange, disabled = false, decimal = false, decimalPlaces = 2, size = 'lg', id, valueIncrement = 1, className, inputSize, minValue = 0, maxValue = 9999, decrementAriaLabel = 'Decrease quantity', incrementAriaLabel = 'Increase quantity', inputAriaLabel = 'Quantity', ...rest }) => {
|
|
3515
3530
|
const initialValue = Math.min(Math.max(value, minValue), maxValue);
|
|
@@ -3690,12 +3705,12 @@ const Quantity = ({ value = 0, onChange, disabled = false, decimal = false, deci
|
|
|
3690
3705
|
const inputSizeValue = inputSize !== undefined ? inputSize : Math.max(1, inputValue.length);
|
|
3691
3706
|
const uniqueId = useId();
|
|
3692
3707
|
const inputId = id || uniqueId;
|
|
3693
|
-
return (jsxs("div", { className: clsx(styles$
|
|
3708
|
+
return (jsxs("div", { className: clsx(styles$7.quantity, { [styles$7.disabled]: disabled }, className), ...rest, children: [jsx(Button, { variant: 'outlined', size: size, type: 'button', iconOnly: true, icon: jsx(Subtract16Regular, {}), onClick: decrement, disabled: disabled || isMinValue, "aria-label": decrementAriaLabel, tooltipText: 'Diminuir' }), jsx("input", { ref: inputRef, className: clsx(styles$7.quantityInput, { [styles$7.disabled]: disabled }), type: 'text', value: inputValue, onChange: handleInputChange, onBlur: handleBlur, onKeyDown: handleInputKeyDown, id: inputId, step: stepValue, "aria-label": inputAriaLabel, role: 'spinbutton', "aria-valuenow": internalValue, "aria-valuemin": minValue, "aria-valuemax": maxValue, disabled: disabled, inputMode: decimal ? 'decimal' : 'numeric', size: inputSizeValue }), jsx(Button, { variant: 'outlined', size: size, type: 'button', iconOnly: true, onClick: increment, disabled: disabled || isMaxValue, "aria-label": incrementAriaLabel, icon: jsx(Add16Regular, {}), tooltipText: 'Aumentar' })] }));
|
|
3694
3709
|
};
|
|
3695
3710
|
const memorizedQuantity = React__default.memo(Quantity);
|
|
3696
3711
|
memorizedQuantity.displayName = 'Quantity';
|
|
3697
3712
|
|
|
3698
|
-
var styles$
|
|
3713
|
+
var styles$6 = {"fieldContainer":"Select-module__fieldContainer___zkWSZ","trigger":"Select-module__trigger___xZVUG","disabled":"Select-module__disabled___kkzG-","open":"Select-module__open___bTuTy","error":"Select-module__error___yikGO","hasValue":"Select-module__hasValue___56T9r","triggerText":"Select-module__triggerText___tfXlq","containerLabel":"Select-module__containerLabel___-5qpN","content":"Select-module__content___Eftze","viewport":"Select-module__viewport___mMGOo","group":"Select-module__group___wErLt","container":"Select-module__container___U1UI1","searchWrapper":"Select-module__searchWrapper___H01Wp","item":"Select-module__item___72Rnu","subTitle":"Select-module__subTitle___FdYBH","checkboxItem":"Select-module__checkboxItem___Ehw-a","checkboxContent":"Select-module__checkboxContent___7eKLC","itemWrapper":"Select-module__itemWrapper___nPovg","title":"Select-module__title___bqW3p","icon":"Select-module__icon___RH27W","itemIndicator":"Select-module__itemIndicator___4DBU-","textContent":"Select-module__textContent___k1SLX","helper":"Select-module__helper___pTp7X","errorMessage":"Select-module__errorMessage___--vrn","noResults":"Select-module__noResults___IxsAN","loadingMore":"Select-module__loadingMore___DjAUE","expandableItemContainer":"Select-module__expandableItemContainer___w4ZIb","chevron":"Select-module__chevron___Kgee3","childrenWrapper":"Select-module__childrenWrapper___2NnS-"};
|
|
3699
3714
|
|
|
3700
3715
|
const CheckboxSelectItem = ({ text, subTitle, disabled, checked, onCheckedChange, value, ...restProps }) => {
|
|
3701
3716
|
const itemRef = useRef(null);
|
|
@@ -3739,9 +3754,9 @@ const CheckboxSelectItem = ({ text, subTitle, disabled, checked, onCheckedChange
|
|
|
3739
3754
|
onCheckedChange(!checked);
|
|
3740
3755
|
}
|
|
3741
3756
|
};
|
|
3742
|
-
return (jsx("div", { ref: itemRef, className: clsx(styles$
|
|
3743
|
-
[styles$
|
|
3744
|
-
}), role: "option", "aria-selected": checked, "aria-disabled": disabled, "data-selected": checked, "data-testid": `checkbox-item-${value}`, tabIndex: disabled ? -1 : 0, onKeyDown: handleKeyDown, onClick: handleClick, ...restProps, children: jsx("div", { className: styles$
|
|
3757
|
+
return (jsx("div", { ref: itemRef, className: clsx(styles$6.checkboxItem, {
|
|
3758
|
+
[styles$6.disabled]: disabled,
|
|
3759
|
+
}), role: "option", "aria-selected": checked, "aria-disabled": disabled, "data-selected": checked, "data-testid": `checkbox-item-${value}`, tabIndex: disabled ? -1 : 0, onKeyDown: handleKeyDown, onClick: handleClick, ...restProps, children: jsx("div", { className: styles$6.checkboxContent, children: jsx(Checkbox, { checked: checked, onCheckedChange: handleCheckboxChange, disabled: disabled, label: jsxs("div", { className: styles$6.textContent, children: [jsx("span", { className: styles$6.title, children: text }), subTitle && jsx("div", { className: styles$6.subTitle, children: subTitle })] }) }) }) }));
|
|
3745
3760
|
};
|
|
3746
3761
|
CheckboxSelectItem.displayName = 'CheckboxSelectItem';
|
|
3747
3762
|
|
|
@@ -3759,23 +3774,23 @@ const ExpandableSelectItem = ({ item, variant, onSelect, selectedValues, level =
|
|
|
3759
3774
|
onSelect(item.value);
|
|
3760
3775
|
}
|
|
3761
3776
|
};
|
|
3762
|
-
return (jsxs(Fragment, { children: [jsx("div", { className: styles$
|
|
3763
|
-
[styles$
|
|
3764
|
-
[styles$
|
|
3777
|
+
return (jsxs(Fragment, { children: [jsx("div", { className: styles$6.expandableItemContainer, style: { paddingLeft: `${level * 16}px` }, children: jsxs("div", { className: clsx(styles$6.itemWrapper, {
|
|
3778
|
+
[styles$6.selected]: isSelected && !hasChildren,
|
|
3779
|
+
[styles$6.disabled]: item.disabled,
|
|
3765
3780
|
}), onClick: handleClick, onKeyDown: (e) => {
|
|
3766
3781
|
if (e.key === 'Enter' || e.key === ' ') {
|
|
3767
3782
|
e.preventDefault();
|
|
3768
3783
|
handleClick(e);
|
|
3769
3784
|
}
|
|
3770
|
-
}, role: "button", tabIndex: item.disabled ? -1 : 0, "data-disabled": item.disabled || undefined, "data-selected": isSelected && !hasChildren ? 'true' : undefined, "data-testid": `select-item-${item.value}`, children: [variant === 'icon' && item.icon && (jsx("span", { className: styles$
|
|
3785
|
+
}, role: "button", tabIndex: item.disabled ? -1 : 0, "data-disabled": item.disabled || undefined, "data-selected": isSelected && !hasChildren ? 'true' : undefined, "data-testid": `select-item-${item.value}`, children: [variant === 'icon' && item.icon && (jsx("span", { className: styles$6.icon, children: item.icon })), jsxs("div", { className: styles$6.textContent, children: [jsx("div", { className: styles$6.title, children: item.text }), item.subTitle && jsx("div", { className: styles$6.subTitle, children: item.subTitle })] }), hasChildren && (jsx("span", { className: styles$6.chevron, children: isExpanded ? jsx(ChevronDown16Regular, {}) : jsx(ChevronRight16Regular, {}) }))] }) }), hasChildren && isExpanded && (jsx("div", { className: styles$6.childrenWrapper, children: item.children.map((child) => (jsx(ExpandableSelectItem, { item: child, variant: variant, onSelect: onSelect, selectedValues: selectedValues, level: level + 1 }, child.id || child.value))) }))] }));
|
|
3771
3786
|
};
|
|
3772
3787
|
|
|
3773
3788
|
const SelectItem = React__default.forwardRef(({ text, subTitle, icon, disabled, value, variant, disableFocusOnHover, ...restProps }, ref) => {
|
|
3774
|
-
return (jsxs("div", { className: clsx(styles$
|
|
3775
|
-
[styles$
|
|
3776
|
-
}), "data-disabled": disabled || undefined, "data-testid": `select-item-${value}`, ref: ref, children: [variant === 'icon' && icon && (jsx("span", { className: styles$
|
|
3777
|
-
[styles$
|
|
3778
|
-
}), value: value, disabled: disabled, onPointerMove: disableFocusOnHover ? (e) => e.preventDefault() : undefined, ...restProps, children: [jsx(Select$1.ItemText, { className: styles$
|
|
3789
|
+
return (jsxs("div", { className: clsx(styles$6.itemWrapper, {
|
|
3790
|
+
[styles$6.disabled]: disabled,
|
|
3791
|
+
}), "data-disabled": disabled || undefined, "data-testid": `select-item-${value}`, ref: ref, children: [variant === 'icon' && icon && (jsx("span", { className: styles$6.icon, children: icon })), jsxs(Select$1.Item, { className: clsx(styles$6.item, {
|
|
3792
|
+
[styles$6.disabled]: disabled,
|
|
3793
|
+
}), value: value, disabled: disabled, onPointerMove: disableFocusOnHover ? (e) => e.preventDefault() : undefined, ...restProps, children: [jsx(Select$1.ItemText, { className: styles$6.title, children: text }), subTitle && jsx("div", { className: styles$6.subTitle, children: subTitle }), jsx(Select$1.ItemIndicator, { className: styles$6.itemIndicator })] })] }));
|
|
3779
3794
|
});
|
|
3780
3795
|
SelectItem.displayName = 'SelectItem';
|
|
3781
3796
|
|
|
@@ -4004,7 +4019,7 @@ function useSelectLogic({ value, required = false, search = false, onValueChange
|
|
|
4004
4019
|
};
|
|
4005
4020
|
}
|
|
4006
4021
|
|
|
4007
|
-
const Select = ({ items, onValueChange, onOpenChange, variant, required = false, value, label, helperText, placeholder = 'Selecione', maxWidth, search = false, errorMessage, disabled = false, className, 'aria-label': ariaLabel, 'data-testid': testId, tooltip = false, tooltipText, side = 'bottom', align = 'start', enableInfiniteScroll = false, onScrollEnd, isLoadingMore = false, enableApiSearch = false, onApiSearch, isSearching = false, ...
|
|
4022
|
+
const Select = ({ items, onValueChange, onOpenChange, variant, required = false, value, label, helperText, placeholder = 'Selecione', maxWidth, search = false, errorMessage, disabled = false, className, 'aria-label': ariaLabel, 'data-testid': testId, tooltip = false, tooltipText, side = 'bottom', align = 'start', enableInfiniteScroll = false, onScrollEnd, isLoadingMore = false, enableApiSearch = false, onApiSearch, isSearching = false, ...rest }) => {
|
|
4008
4023
|
const componentId = useId();
|
|
4009
4024
|
const selectId = `select-${componentId}`;
|
|
4010
4025
|
const viewportRef = useRef(null);
|
|
@@ -4084,14 +4099,14 @@ const Select = ({ items, onValueChange, onOpenChange, variant, required = false,
|
|
|
4084
4099
|
onApiSearch('');
|
|
4085
4100
|
}
|
|
4086
4101
|
};
|
|
4087
|
-
return (jsx(Select$1.Root, { value: variant === 'checkbox' || (search && state.isOpen) ? '' : (state.selectedValues[0] || ''), onValueChange: variant === 'checkbox' ? undefined : actions.handleSingleSelect, required: required, open: state.isOpen, onOpenChange: actions.setOpen, disabled: disabled, ...
|
|
4088
|
-
[styles$
|
|
4089
|
-
[styles$
|
|
4090
|
-
[styles$
|
|
4091
|
-
[styles$
|
|
4092
|
-
}), id: selectId, "aria-label": ariaLabel, "data-testid": `${testId}-trigger`, children: [variant === 'checkbox' ? (jsx("span", { className: styles$
|
|
4093
|
-
[styles$
|
|
4094
|
-
}), children: helperText })), state.hasError && state.touched && (jsx("span", { className: styles$
|
|
4102
|
+
return (jsx(Select$1.Root, { value: variant === 'checkbox' || (search && state.isOpen) ? '' : (state.selectedValues[0] || ''), onValueChange: variant === 'checkbox' ? undefined : actions.handleSingleSelect, required: required, open: state.isOpen, onOpenChange: actions.setOpen, disabled: disabled, ...rest, children: jsxs("div", { className: clsx(styles$6.container, className), style: containerStyle, "data-testid": testId, children: [jsx("div", { className: styles$6.fieldContainer, children: jsxs("div", { className: styles$6.containerLabel, children: [jsx(LabelComponent, { htmlFor: selectId, required: required, tooltipText: tooltipText, tooltip: tooltip, side: side, align: align, error: state.hasError && state.touched, disabled: disabled, children: label }), jsxs(Select$1.Trigger, { className: clsx(styles$6.trigger, {
|
|
4103
|
+
[styles$6.error]: state.hasError && state.touched,
|
|
4104
|
+
[styles$6.disabled]: disabled,
|
|
4105
|
+
[styles$6.hasValue]: state.selectedValues.length > 0,
|
|
4106
|
+
[styles$6.open]: state.isOpen,
|
|
4107
|
+
}), id: selectId, "aria-label": ariaLabel, "data-testid": `${testId}-trigger`, children: [variant === 'checkbox' ? (jsx("span", { className: styles$6.triggerText, children: displayText })) : (jsx(Select$1.Value, { placeholder: placeholder, className: styles$6.placeholder, children: displayText })), state.isOpen ? jsx(ChevronUp16Regular, {}) : jsx(ChevronDown16Regular, {})] }), !state.isOpen && helperText && !state.hasError && (jsx("span", { className: clsx(styles$6.helper, {
|
|
4108
|
+
[styles$6.disabled]: disabled
|
|
4109
|
+
}), children: helperText })), state.hasError && state.touched && (jsx("span", { className: styles$6.errorMessage, children: errorMessage || 'Campo obrigatório' }))] }) }), jsx(Select$1.Portal, { children: jsxs(Select$1.Content, { className: styles$6.content, position: "popper", side: "bottom", sideOffset: 8, align: "start", avoidCollisions: true, children: [search && (jsx("div", { className: styles$6.searchWrapper, children: jsx(Search, { ref: refs.searchInputRef, className: styles$6.search, placeholder: "Buscar", value: state.searchInput, onChange: handleSearchChange, onKeyDown: handleSearchKeyDown, onClear: handleClear, "data-testid": `${testId}-search` }) })), jsx(Select$1.Viewport, { ref: viewportRef, className: styles$6.viewport, "data-testid": testId ? `${testId}-viewport` : undefined, children: jsx(Select$1.Group, { className: styles$6.group, children: filteredItems.length === 0 ? (jsx("div", { className: styles$6.noResults, children: "Nenhum resultado encontrado" })) : (jsxs(Fragment, { children: [filteredItems.map((item) => {
|
|
4095
4110
|
const hasChildren = item.children && item.children.length > 0;
|
|
4096
4111
|
if (hasChildren) {
|
|
4097
4112
|
return (jsx(ExpandableSelectItem, { item: item, variant: variant, selectedValues: state.selectedValues, onSelect: (value) => {
|
|
@@ -4105,11 +4120,11 @@ const Select = ({ items, onValueChange, onOpenChange, variant, required = false,
|
|
|
4105
4120
|
} }, item.id || item.value));
|
|
4106
4121
|
}
|
|
4107
4122
|
return variant === 'checkbox' ? (jsx(CheckboxSelectItem, { ...item, checked: state.selectedValues.includes(item.value), onCheckedChange: (checked) => actions.handleMultipleSelect(item.value, checked) }, item.id || item.value)) : (jsx(SelectItem, { ...item, variant: variant, disableFocusOnHover: search }, item.id || item.value));
|
|
4108
|
-
}), enableInfiniteScroll && isLoadingMore && (jsx("div", { className: styles$
|
|
4123
|
+
}), enableInfiniteScroll && isLoadingMore && (jsx("div", { className: styles$6.loadingMore, children: "Carregando mais itens..." }))] })) }) })] }) })] }) }));
|
|
4109
4124
|
};
|
|
4110
4125
|
Select.displayName = 'Select';
|
|
4111
4126
|
|
|
4112
|
-
var styles$
|
|
4127
|
+
var styles$5 = {"tableContainer":"Table-module__tableContainer___cHghX","tableHeader":"Table-module__tableHeader___CFqva","tablePagination":"Table-module__tablePagination___SJ0BH","tableScrollWrapper":"Table-module__tableScrollWrapper___PsYEs","table":"Table-module__table___-ZPCW","tableHead":"Table-module__tableHead___KdeWe","tableTh":"Table-module__tableTh___RhFF-","tableThContent":"Table-module__tableThContent___0gb7Q","tableTd":"Table-module__tableTd___VNUbM","tableHeaderFiltersPlaceholder":"Table-module__tableHeaderFiltersPlaceholder___C0znI","tableBody":"Table-module__tableBody___SgUJp","tableEmpty":"Table-module__tableEmpty___ol2jk","tableEmptyContent":"Table-module__tableEmptyContent___MO1jn","tableEmptyTitle":"Table-module__tableEmptyTitle___XK-SV","tableEmptyCaption":"Table-module__tableEmptyCaption___wZ2Vm","tableRow":"Table-module__tableRow___-jm80","tableEmptyCell":"Table-module__tableEmptyCell___IOaz7","tableHeaderSearch":"Table-module__tableHeaderSearch___dcdu6","tableHeaderSearchContainer":"Table-module__tableHeaderSearchContainer___ViJ-s","tableHeaderFilters":"Table-module__tableHeaderFilters___tVbNC","tableHeaderFilterLabel":"Table-module__tableHeaderFilterLabel___jHUOc","tableHeaderCustomFilters":"Table-module__tableHeaderCustomFilters___Dt8Hm","tableHeaderFiltersContent":"Table-module__tableHeaderFiltersContent___hlOoY","tableHeaderFiltersWrapper":"Table-module__tableHeaderFiltersWrapper___7pUDB","tableHeaderFilterItems":"Table-module__tableHeaderFilterItems___myG2q","tablePaginationSelect":"Table-module__tablePaginationSelect___Ag-s0","tablePaginationInfo":"Table-module__tablePaginationInfo___v6fYn","tablePaginationControls":"Table-module__tablePaginationControls___lKv0K","tablePaginationButton":"Table-module__tablePaginationButton___3opaj"};
|
|
4113
4128
|
|
|
4114
4129
|
/**
|
|
4115
4130
|
* Componente de ícone SVG para estado vazio da tabela
|
|
@@ -4289,13 +4304,13 @@ const Table = ({ columns, dataSource, className, loading = false, rowSelection,
|
|
|
4289
4304
|
}, [columns, rowSelection, isAllSelected, isIndeterminate, toggleAll, selectedSet, toggleRow, dataSource]);
|
|
4290
4305
|
const tableId = useMemo(() => `table-${Math.random().toString(36).substr(2, 9)}`, []);
|
|
4291
4306
|
if (loading) {
|
|
4292
|
-
return (jsx("div", { className: clsx(styles$
|
|
4307
|
+
return (jsx("div", { className: clsx(styles$5.tableContainer, className), children: jsx("div", { className: styles$5.tableLoader, children: jsx(LoaderList, {}) }) }));
|
|
4293
4308
|
}
|
|
4294
|
-
const emptyText = locale?.emptyText || (jsxs("div", { className: styles$
|
|
4295
|
-
return (jsx("div", { className: clsx(styles$
|
|
4309
|
+
const emptyText = locale?.emptyText || (jsxs("div", { className: styles$5.tableEmpty, children: [jsx("div", { className: styles$5.tableEmptyContent, children: jsx(EmptyRows150Color, {}) }), jsxs("div", { className: styles$5.tableEmptyText, children: [jsx("h3", { className: styles$5.tableEmptyTitle, children: "Nenhum dado encontrado" }), jsx("p", { className: styles$5.tableEmptyCaption, children: "Nenhum registro encontrado" })] })] }));
|
|
4310
|
+
return (jsx("div", { className: clsx(styles$5.tableContainer, className), ...rest, children: jsx("div", { className: styles$5.tableScrollWrapper, children: jsxs("table", { className: styles$5.table, role: "table", "aria-label": "Tabela de dados", "aria-describedby": loading ? `${tableId}-loading` : undefined, "aria-rowcount": dataSource.length + 1, children: [jsx("thead", { className: styles$5.tableHead, children: jsx("tr", { children: finalColumns.map((column) => (jsx("th", { className: clsx(styles$5.tableTh, column.align && `text-${column.align}`), style: column.style, children: jsx("div", { className: styles$5.tableThContent, children: column.label }) }, column.key))) }) }), jsx("tbody", { className: styles$5.tableBody, children: dataSource.length > 0 ? (dataSource.map((row, index) => {
|
|
4296
4311
|
const rowProps = onRow?.(row, index) || {};
|
|
4297
|
-
return (jsx("tr", { className: clsx(styles$
|
|
4298
|
-
})) : (jsx("tr", { children: jsx("td", { colSpan: finalColumns.length, className: styles$
|
|
4312
|
+
return (jsx("tr", { className: clsx(styles$5.tableRow, rowProps.className), onClick: rowProps.onClick, onDoubleClick: rowProps.onDoubleClick, children: finalColumns.map((column) => (jsx("td", { className: clsx(styles$5.tableTd, column.align && `text-${column.align}`), children: renderCell(column, row, index) }, column.key))) }, index));
|
|
4313
|
+
})) : (jsx("tr", { children: jsx("td", { colSpan: finalColumns.length, className: styles$5.tableEmptyCell, children: emptyText }) })) })] }) }) }));
|
|
4299
4314
|
};
|
|
4300
4315
|
|
|
4301
4316
|
const isCalendarFilter = (filter) => {
|
|
@@ -4328,7 +4343,7 @@ const TableHeader = ({ searchValue = '', onSearchChange, onSearch, searchPlaceho
|
|
|
4328
4343
|
}
|
|
4329
4344
|
};
|
|
4330
4345
|
const hasFilters = filters || (filterItems && filterItems.length > 0);
|
|
4331
|
-
return (jsxs("div", { className: `${styles$
|
|
4346
|
+
return (jsxs("div", { className: `${styles$5.tableHeader} ${className}`.trim(), ...rest, children: [showSearch && (onSearchChange || onSearch) && (jsx("div", { className: styles$5.tableHeaderSearchContainer, children: jsx(Search, { value: internalSearchValue, onChange: handleInputChange, onKeyDown: handleKeyDown, placeholder: searchPlaceholder, className: styles$5.tableHeaderSearch }) })), showFilters && (jsx("div", { className: styles$5.tableHeaderFilters, children: hasFilters ? (jsxs("div", { className: styles$5.tableHeaderFiltersContent, children: [filters && (jsx("div", { className: styles$5.tableHeaderCustomFilters, children: filters })), jsxs("div", { className: styles$5.tableHeaderFiltersWrapper, children: [jsx("span", { className: styles$5.tableHeaderFilterLabel, children: "Filtros" }), jsx("div", { className: styles$5.tableHeaderFilterItems, children: filterItems && filterItems.map((filterItem, index) => {
|
|
4332
4347
|
const commonProps = {
|
|
4333
4348
|
buttonText: filterItem.buttonText,
|
|
4334
4349
|
icon: filterItem.icon,
|
|
@@ -4347,7 +4362,7 @@ const TableHeader = ({ searchValue = '', onSearchChange, onSearch, searchPlaceho
|
|
|
4347
4362
|
}
|
|
4348
4363
|
console.warn('TableHeader: Tipo de filtro não reconhecido:', filterItem);
|
|
4349
4364
|
return null;
|
|
4350
|
-
}) })] })] })) : (jsx("div", { className: styles$
|
|
4365
|
+
}) })] })] })) : (jsx("div", { className: styles$5.tableHeaderFiltersPlaceholder, children: jsx("span", { children: "Nenhum filtro dispon\u00EDvel" }) })) }))] }));
|
|
4351
4366
|
};
|
|
4352
4367
|
|
|
4353
4368
|
const TablePagination = ({ currentPage, totalItems, itemsPerPage, onPageChange, onItemsPerPageChange, pageSizeOptions = [10, 25, 50, 100], disabled = false, className, ...rest }) => {
|
|
@@ -4370,14 +4385,162 @@ const TablePagination = ({ currentPage, totalItems, itemsPerPage, onPageChange,
|
|
|
4370
4385
|
const newItemsPerPage = Number(event.target.value);
|
|
4371
4386
|
onItemsPerPageChange(newItemsPerPage);
|
|
4372
4387
|
};
|
|
4373
|
-
return (jsxs("div", { className: `${styles$
|
|
4388
|
+
return (jsxs("div", { className: `${styles$5.tablePagination} ${className}`.trim(), ...rest, children: [jsxs("div", { className: styles$5.tablePaginationSelect, children: [jsx("label", { htmlFor: "items-per-page", className: styles$5.tablePaginationLabel, children: "Itens por p\u00E1gina" }), jsx("select", { id: "items-per-page", value: itemsPerPage, onChange: handleItemsPerPageChange, disabled: disabled, className: styles$5.tablePaginationSelectInput, children: pageSizeOptions.map((option) => (jsx("option", { value: option, children: option }, option))) })] }), jsx("div", { className: styles$5.tablePaginationInfo, children: jsx("span", { children: totalItems > 0
|
|
4374
4389
|
? `${startItem}–${endItem} de ${totalItems}`
|
|
4375
|
-
: '0 itens' }) }), jsxs("div", { className: styles$
|
|
4390
|
+
: '0 itens' }) }), jsxs("div", { className: styles$5.tablePaginationControls, children: [jsx("button", { className: styles$5.tablePaginationButton, onClick: handlePrevious, disabled: !canGoPrev, "aria-label": "P\u00E1gina anterior", children: jsx(ChevronLeft16Regular, {}) }), jsx("button", { className: styles$5.tablePaginationButton, onClick: handleNext, disabled: !canGoNext, "aria-label": "Pr\u00F3xima p\u00E1gina", children: jsx(ChevronRight16Regular, {}) })] })] }));
|
|
4391
|
+
};
|
|
4392
|
+
|
|
4393
|
+
var styles$4 = {"wrapper":"Table-module__wrapper___KMc04","tableContainer":"Table-module__tableContainer___byysv","tableHeader":"Table-module__tableHeader___urbxZ","bulkActionsBar":"Table-module__bulkActionsBar___Irfnt","bulkActionsInfo":"Table-module__bulkActionsInfo___pLTb6","bulkActionsClearButton":"Table-module__bulkActionsClearButton___jjQTq","bulkActionsLabel":"Table-module__bulkActionsLabel___QB3N9","bulkActionsButtons":"Table-module__bulkActionsButtons___1anDO","tablePagination":"Table-module__tablePagination___MbqJy","table":"Table-module__table___9xCJC","tableHead":"Table-module__tableHead___oVEa6","tableTh":"Table-module__tableTh___U02-Y","tableThContent":"Table-module__tableThContent___61AqT","tableSortButton":"Table-module__tableSortButton___ZgLkx","tableBody":"Table-module__tableBody___fq4Aa","tableTd":"Table-module__tableTd___OfW9v","tableRow":"Table-module__tableRow___COJNu","checkboxCell":"Table-module__checkboxCell___B9vHM","tableSortIconNeutral":"Table-module__tableSortIconNeutral___uvnHs","tableSortIcon":"Table-module__tableSortIcon___YVa2Q","tableHeaderSearchContainer":"Table-module__tableHeaderSearchContainer___Yy8-s","tableHeaderSearch":"Table-module__tableHeaderSearch___swewU","tableHeaderFilters":"Table-module__tableHeaderFilters___ncatO","tableHeaderFilterLabel":"Table-module__tableHeaderFilterLabel___r3DI-","tableHeaderFilterItems":"Table-module__tableHeaderFilterItems___kQDsY","tablePaginationSelect":"Table-module__tablePaginationSelect___l2aYm","tablePaginationLabel":"Table-module__tablePaginationLabel___S9VOr","tablePaginationSelectInput":"Table-module__tablePaginationSelectInput___wdhOQ","tablePaginationInfo":"Table-module__tablePaginationInfo___r1v8R","tablePaginationControls":"Table-module__tablePaginationControls___IL8rm","tablePaginationButton":"Table-module__tablePaginationButton___SNDQq","tableScrollWrapper":"Table-module__tableScrollWrapper___SvEOw","tableEmptyCell":"Table-module__tableEmptyCell___N5a9t","tableEmpty":"Table-module__tableEmpty___0yPZ0","tableEmptyContent":"Table-module__tableEmptyContent___uNWpN","tableEmptyText":"Table-module__tableEmptyText___7kY7Q","tableEmptyTitle":"Table-module__tableEmptyTitle___Y-7z8","tableEmptyCaption":"Table-module__tableEmptyCaption___4PZ14","tableCellMaxHeight":"Table-module__tableCellMaxHeight___-tcyU"};
|
|
4394
|
+
|
|
4395
|
+
const EmptyState = ({ emptyIcon, emptyTitle, emptyText }) => (jsxs("div", { className: styles$4.tableEmpty, children: [jsx("div", { className: styles$4.tableEmptyContent, children: emptyIcon ?? jsx(SearchInfo20Regular, {}) }), jsxs("div", { className: styles$4.tableEmptyText, children: [jsx("h3", { className: styles$4.tableEmptyTitle, children: emptyTitle ?? 'Nenhum dado encontrado' }), jsx("p", { className: styles$4.tableEmptyCaption, children: emptyText ?? 'Nenhum registro encontrado' })] })] }));
|
|
4396
|
+
|
|
4397
|
+
const TableV2 = ({ columns, data, enableFilters = false, enableRowSelection = false, enableSorting = true, onRowSelectionChange, bulkActions, header, footer, loading = false, emptyIcon, emptyTitle, emptyText, onRow, className, }) => {
|
|
4398
|
+
const [columnFilters, setColumnFilters] = useState([]);
|
|
4399
|
+
const [globalFilter, setGlobalFilter] = useState('');
|
|
4400
|
+
const [rowSelection, setRowSelection] = useState({});
|
|
4401
|
+
const rowSelectionRef = useRef({});
|
|
4402
|
+
rowSelectionRef.current = rowSelection;
|
|
4403
|
+
const lastEmittedSelectionKey = useRef('{}');
|
|
4404
|
+
const [sorting, setSorting] = useState([]);
|
|
4405
|
+
const [pagination, setPagination] = useState({
|
|
4406
|
+
pageIndex: 0,
|
|
4407
|
+
pageSize: footer?.defaultPageSize ?? 10,
|
|
4408
|
+
});
|
|
4409
|
+
const { pageIndex, pageSize } = pagination;
|
|
4410
|
+
const selectionColumn = useMemo(() => ({
|
|
4411
|
+
id: '__select__',
|
|
4412
|
+
size: 48,
|
|
4413
|
+
enableSorting: false,
|
|
4414
|
+
enableColumnFilter: false,
|
|
4415
|
+
header: ({ table: t }) => (jsx("div", { className: styles$4.checkboxCell, children: jsx(Checkbox, { checked: t.getIsAllPageRowsSelected(), indeterminate: t.getIsSomePageRowsSelected(), onCheckedChange: (checked) => t.toggleAllPageRowsSelected(checked) }) })),
|
|
4416
|
+
cell: ({ row }) => (jsx("div", { className: styles$4.checkboxCell, children: jsx(Checkbox, { checked: row.getIsSelected(), onCheckedChange: (checked) => row.toggleSelected(checked) }) })),
|
|
4417
|
+
}), []);
|
|
4418
|
+
const resolvedColumns = useMemo(() => (enableRowSelection ? [selectionColumn, ...columns] : columns), [enableRowSelection, selectionColumn, columns]);
|
|
4419
|
+
const showSearch = !!(header && (header.showSearch ?? true));
|
|
4420
|
+
const table = useReactTable({
|
|
4421
|
+
data,
|
|
4422
|
+
columns: resolvedColumns,
|
|
4423
|
+
defaultColumn: { minSize: 44, size: 0 },
|
|
4424
|
+
state: {
|
|
4425
|
+
...(enableFilters ? { columnFilters } : {}),
|
|
4426
|
+
...(showSearch ? { globalFilter } : {}),
|
|
4427
|
+
...(footer ? { pagination: { pageIndex, pageSize } } : {}),
|
|
4428
|
+
...(enableRowSelection ? { rowSelection } : {}),
|
|
4429
|
+
...(enableSorting ? { sorting } : {}),
|
|
4430
|
+
},
|
|
4431
|
+
onColumnFiltersChange: enableFilters ? setColumnFilters : undefined,
|
|
4432
|
+
onGlobalFilterChange: showSearch ? setGlobalFilter : undefined,
|
|
4433
|
+
onSortingChange: enableSorting ? setSorting : undefined,
|
|
4434
|
+
enableSorting,
|
|
4435
|
+
onRowSelectionChange: enableRowSelection
|
|
4436
|
+
? (updater) => {
|
|
4437
|
+
const prev = rowSelectionRef.current;
|
|
4438
|
+
const next = typeof updater === 'function' ? updater(prev) : updater;
|
|
4439
|
+
const selectionKey = JSON.stringify(next, Object.keys(next).sort());
|
|
4440
|
+
if (selectionKey === lastEmittedSelectionKey.current)
|
|
4441
|
+
return;
|
|
4442
|
+
lastEmittedSelectionKey.current = selectionKey;
|
|
4443
|
+
rowSelectionRef.current = next;
|
|
4444
|
+
setRowSelection(next);
|
|
4445
|
+
if (onRowSelectionChange) {
|
|
4446
|
+
const selectedRows = table
|
|
4447
|
+
.getCoreRowModel()
|
|
4448
|
+
.rows.filter((r) => next[r.id])
|
|
4449
|
+
.map((r) => r.original);
|
|
4450
|
+
onRowSelectionChange(selectedRows);
|
|
4451
|
+
}
|
|
4452
|
+
}
|
|
4453
|
+
: undefined,
|
|
4454
|
+
enableRowSelection,
|
|
4455
|
+
onPaginationChange: footer ? setPagination : undefined,
|
|
4456
|
+
getCoreRowModel: getCoreRowModel(),
|
|
4457
|
+
getFilteredRowModel: enableFilters || showSearch ? getFilteredRowModel() : undefined,
|
|
4458
|
+
getPaginationRowModel: footer ? getPaginationRowModel() : undefined,
|
|
4459
|
+
getSortedRowModel: enableSorting ? getSortedRowModel() : undefined,
|
|
4460
|
+
});
|
|
4461
|
+
const filteredRowCount = table.getFilteredRowModel().rows.length;
|
|
4462
|
+
const effectiveTotalItems = footer
|
|
4463
|
+
? (enableFilters || showSearch) ? filteredRowCount : footer.totalItems
|
|
4464
|
+
: 0;
|
|
4465
|
+
const totalPages = footer ? Math.ceil(effectiveTotalItems / pageSize) : 0;
|
|
4466
|
+
const canGoPrev = pageIndex > 0;
|
|
4467
|
+
const canGoNext = pageIndex + 1 < totalPages;
|
|
4468
|
+
const skeletonRowCount = footer ? pageSize : (data.length > 0 ? data.length : pageSize);
|
|
4469
|
+
const selectedRows = useMemo(() => table
|
|
4470
|
+
.getCoreRowModel()
|
|
4471
|
+
.rows.filter((r) => rowSelection[r.id])
|
|
4472
|
+
.map((r) => r.original), [rowSelection, table]);
|
|
4473
|
+
const selectedCount = selectedRows.length;
|
|
4474
|
+
const showBulkActions = enableRowSelection && !!bulkActions && selectedCount > 0;
|
|
4475
|
+
useEffect(() => {
|
|
4476
|
+
if (enableRowSelection) {
|
|
4477
|
+
table.resetRowSelection();
|
|
4478
|
+
}
|
|
4479
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4480
|
+
}, [pageIndex]);
|
|
4481
|
+
const handleClearSelection = () => {
|
|
4482
|
+
table.resetRowSelection();
|
|
4483
|
+
bulkActions?.onClear?.();
|
|
4484
|
+
};
|
|
4485
|
+
const handlePageSizeChange = (e) => {
|
|
4486
|
+
const size = Number(e.target.value);
|
|
4487
|
+
setPagination({ pageIndex: 0, pageSize: size });
|
|
4488
|
+
footer?.onPageSizeChange?.(size);
|
|
4489
|
+
};
|
|
4490
|
+
return (jsxs("div", { className: clsx(styles$4.wrapper, className), children: [showBulkActions && (jsxs("div", { className: styles$4.bulkActionsBar, children: [jsxs("div", { className: styles$4.bulkActionsInfo, children: [jsx(Button, { variant: "text", iconOnly: true, icon: jsx(Dismiss16Regular, {}), ariaLabel: "Limpar sele\u00E7\u00E3o", onClick: handleClearSelection, className: styles$4.bulkActionsClearButton }), jsx("span", { className: styles$4.bulkActionsLabel, children: bulkActions.label
|
|
4491
|
+
? bulkActions.label(selectedCount, selectedRows)
|
|
4492
|
+
: `${selectedCount} ${selectedCount === 1 ? 'item selecionado' : 'itens selecionados'}` })] }), jsx("div", { className: styles$4.bulkActionsButtons, children: bulkActions.actions.map((action, index) => (jsx(Button, { variant: action.variant ?? 'outlined', type: "button", disabled: action.disabled, onClick: action.onClick, size: "sm", children: action.label }, index))) })] })), header && (jsxs("div", { className: styles$4.tableHeader, children: [showSearch && (jsx("div", { className: styles$4.tableHeaderSearchContainer, children: jsx(Search, { value: globalFilter, onChange: (e) => {
|
|
4493
|
+
setGlobalFilter(e.target.value);
|
|
4494
|
+
if (footer)
|
|
4495
|
+
setPagination((prev) => ({ ...prev, pageIndex: 0 }));
|
|
4496
|
+
}, placeholder: header.searchPlaceholder ?? 'Pesquisar...', className: styles$4.tableHeaderSearch }) })), !!header.filterItems?.length && (jsxs("div", { className: styles$4.tableHeaderFilters, children: [jsx("span", { className: styles$4.tableHeaderFilterLabel, children: "Filtros" }), jsx("div", { className: styles$4.tableHeaderFilterItems, children: header.filterItems.map((filterItem, index) => {
|
|
4497
|
+
const commonProps = {
|
|
4498
|
+
buttonText: filterItem.buttonText,
|
|
4499
|
+
icon: filterItem.icon,
|
|
4500
|
+
side: filterItem.side,
|
|
4501
|
+
align: filterItem.align,
|
|
4502
|
+
disabled: filterItem.disabled,
|
|
4503
|
+
variant: 'outlined',
|
|
4504
|
+
onOpen: () => filterItem.onToggle?.(true),
|
|
4505
|
+
onClose: () => filterItem.onToggle?.(false),
|
|
4506
|
+
};
|
|
4507
|
+
if (filterItem.type === 'calendar') {
|
|
4508
|
+
return (jsx(Filter, { ...commonProps, type: "calendar", selectedDate: filterItem.selectedDate, onDateSelect: filterItem.onDateSelect, onClearDate: filterItem.onClear, minDate: filterItem.minDate, maxDate: filterItem.maxDate, locale: filterItem.locale, placeholder: filterItem.placeholder }, filterItem.id ?? index));
|
|
4509
|
+
}
|
|
4510
|
+
return (jsx(Filter, { ...commonProps, type: filterItem.type, items: filterItem.items, selectedIds: filterItem.selectedIds, onApplyFilter: filterItem.onSelectionChange, placeholder: filterItem.placeholder, enableSearch: filterItem.enableSearch }, filterItem.id ?? index));
|
|
4511
|
+
}) })] }))] })), jsx("div", { className: styles$4.tableContainer, children: jsx("div", { className: styles$4.tableScrollWrapper, children: jsxs("table", { className: styles$4.table, "aria-label": "Tabela de dados", "aria-rowcount": filteredRowCount + 1, children: [jsx("thead", { className: styles$4.tableHead, children: table.getHeaderGroups().map((headerGroup) => (jsx("tr", { children: headerGroup.headers.map((col) => (jsxs("th", { className: styles$4.tableTh, style: {
|
|
4512
|
+
textAlign: col.column.columnDef.meta?.align,
|
|
4513
|
+
width: col.column.columnDef.size || undefined,
|
|
4514
|
+
minWidth: col.column.columnDef.minSize,
|
|
4515
|
+
maxWidth: col.column.columnDef.maxSize !== Number.MAX_SAFE_INTEGER
|
|
4516
|
+
? col.column.columnDef.maxSize
|
|
4517
|
+
: undefined,
|
|
4518
|
+
}, children: [jsx("div", { className: styles$4.tableThContent, children: col.isPlaceholder ? null : col.column.getCanSort() ? (jsxs("button", { type: "button", className: styles$4.tableSortButton, onClick: col.column.getToggleSortingHandler(), "aria-label": `Ordenar por ${typeof col.column.columnDef.header === 'string' ? col.column.columnDef.header : col.id}`, children: [flexRender(col.column.columnDef.header, col.getContext()), col.column.getIsSorted() === 'asc' ? (jsx(ArrowSortUp16Regular, { className: styles$4.tableSortIcon })) : col.column.getIsSorted() === 'desc' ? (jsx(ArrowSortDown16Regular, { className: styles$4.tableSortIcon })) : (jsx(ArrowSort16Regular, { className: clsx(styles$4.tableSortIcon, styles$4.tableSortIconNeutral) }))] })) : (flexRender(col.column.columnDef.header, col.getContext())) }), enableFilters && col.column.getCanFilter() && (jsx("input", { value: col.column.getFilterValue() ?? '', onChange: (e) => col.column.setFilterValue(e.target.value), placeholder: "Filtrar..." }))] }, col.id))) }, headerGroup.id))) }), jsx("tbody", { className: styles$4.tableBody, children: loading ? (Array.from({ length: skeletonRowCount }).map((_, rowIdx) => (jsx("tr", { className: styles$4.tableRow, children: table.getVisibleLeafColumns().map((col) => (jsx("td", { className: styles$4.tableTd, children: jsx(Skeleton, {}) }, col.id))) }, `skeleton-row-${rowIdx}`)))) : table.getRowModel().rows.length > 0 ? (table.getRowModel().rows.map((row, index) => {
|
|
4519
|
+
const rowProps = onRow?.(row.original, index) ?? {};
|
|
4520
|
+
return (jsx("tr", { className: clsx(styles$4.tableRow, rowProps.className), onClick: rowProps.onClick, onDoubleClick: rowProps.onDoubleClick, children: row.getVisibleCells().map((cell) => (jsx("td", { className: styles$4.tableTd, style: {
|
|
4521
|
+
textAlign: cell.column.columnDef.meta?.align,
|
|
4522
|
+
width: cell.column.columnDef.size || undefined,
|
|
4523
|
+
minWidth: cell.column.columnDef.minSize,
|
|
4524
|
+
maxWidth: cell.column.columnDef.maxSize !== Number.MAX_SAFE_INTEGER
|
|
4525
|
+
? cell.column.columnDef.maxSize
|
|
4526
|
+
: undefined,
|
|
4527
|
+
}, children: cell.column.columnDef.meta?.maxHeight ? (jsx("div", { className: styles$4.tableCellMaxHeight, style: { maxHeight: cell.column.columnDef.meta.maxHeight }, children: flexRender(cell.column.columnDef.cell, cell.getContext()) })) : (flexRender(cell.column.columnDef.cell, cell.getContext())) }, cell.id))) }, row.id));
|
|
4528
|
+
})) : (jsx("tr", { children: jsx("td", { colSpan: table.getVisibleLeafColumns().length, className: styles$4.tableEmptyCell, children: jsx(EmptyState, { emptyIcon: emptyIcon, emptyTitle: emptyTitle, emptyText: emptyText }) }) })) })] }) }) }), footer && (jsxs("div", { className: styles$4.tablePagination, children: [jsxs("div", { className: styles$4.tablePaginationSelect, children: [jsx("label", { htmlFor: "tablev2-page-size", className: styles$4.tablePaginationLabel, children: "Itens por p\u00E1gina" }), jsx("select", { id: "tablev2-page-size", value: pageSize, onChange: handlePageSizeChange, className: styles$4.tablePaginationSelectInput, children: (footer.pageSizeOptions ?? [10, 25, 50, 100]).map((opt) => (jsx("option", { value: opt, children: opt }, opt))) })] }), jsx("div", { className: styles$4.tablePaginationInfo, children: jsx("span", { children: totalPages > 0
|
|
4529
|
+
? `${pageIndex + 1} de ${totalPages}`
|
|
4530
|
+
: '0 páginas' }) }), jsxs("div", { className: styles$4.tablePaginationControls, children: [jsx("button", { className: styles$4.tablePaginationButton, onClick: () => {
|
|
4531
|
+
const newPage = pageIndex - 1;
|
|
4532
|
+
setPagination((prev) => ({ ...prev, pageIndex: newPage }));
|
|
4533
|
+
footer?.onPageChange?.(newPage + 1);
|
|
4534
|
+
}, disabled: !canGoPrev, "aria-label": "P\u00E1gina anterior", children: jsx(ChevronLeft16Regular, {}) }), jsx("button", { className: styles$4.tablePaginationButton, onClick: () => {
|
|
4535
|
+
const newPage = pageIndex + 1;
|
|
4536
|
+
setPagination((prev) => ({ ...prev, pageIndex: newPage }));
|
|
4537
|
+
footer?.onPageChange?.(newPage + 1);
|
|
4538
|
+
}, disabled: !canGoNext, "aria-label": "Pr\u00F3xima p\u00E1gina", children: jsx(ChevronRight16Regular, {}) })] })] }))] }));
|
|
4376
4539
|
};
|
|
4377
4540
|
|
|
4378
4541
|
var styles$3 = {"container":"TextArea-module__container___WEBC-","inputWrapper":"TextArea-module__inputWrapper___-omPx","inputContainer":"TextArea-module__inputContainer___0-jKY","footer":"TextArea-module__footer___7XMlj","helperText":"TextArea-module__helperText___709rD","charCount":"TextArea-module__charCount___zdbxM","error":"TextArea-module__error___DWDms","disabled":"TextArea-module__disabled___lHxCa"};
|
|
4379
4542
|
|
|
4380
|
-
const TextArea = forwardRef(({ className, value, label, placeholder, onChange, disabled = false, maxLength, required = false, helperText, tooltip = false, tooltipText, side = 'bottom', align = 'start', errorMessage, error, id, onBlur, onFocus, name, resize = 'vertical', showCharCount = false, height, ...
|
|
4543
|
+
const TextArea = forwardRef(({ className, value, label, placeholder, onChange, disabled = false, maxLength, required = false, helperText, tooltip = false, tooltipText, side = 'bottom', align = 'start', errorMessage, error, id, onBlur, onFocus, name, resize = 'vertical', showCharCount = false, height, ...rest }, ref) => {
|
|
4381
4544
|
const normalizeValue = (val) => {
|
|
4382
4545
|
return val === undefined || val === null ? '' : String(val);
|
|
4383
4546
|
};
|
|
@@ -4415,7 +4578,7 @@ const TextArea = forwardRef(({ className, value, label, placeholder, onChange, d
|
|
|
4415
4578
|
? `${componentId}-helper`
|
|
4416
4579
|
: undefined;
|
|
4417
4580
|
const containerClass = clsx(styles$3.container, disabled && styles$3.disabled, hasError && !disabled && styles$3.error, className);
|
|
4418
|
-
return (jsxs("div", { className: containerClass, children: [label && (jsx(LabelComponent, { htmlFor: componentId, required: required, tooltip: tooltip, tooltipText: tooltipText, side: side, align: align, error: hasError, disabled: disabled, children: label })), jsxs("div", { className: styles$3.inputWrapper, children: [jsx("div", { className: styles$3.inputContainer, children: jsx("textarea", { ...
|
|
4581
|
+
return (jsxs("div", { className: containerClass, children: [label && (jsx(LabelComponent, { htmlFor: componentId, required: required, tooltip: tooltip, tooltipText: tooltipText, side: side, align: align, error: hasError, disabled: disabled, children: label })), jsxs("div", { className: styles$3.inputWrapper, children: [jsx("div", { className: styles$3.inputContainer, children: jsx("textarea", { ...rest, ref: ref, id: componentId, name: name, value: textareaValue, placeholder: placeholder, onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur, maxLength: maxLength, disabled: disabled, "aria-invalid": hasError, "aria-required": required, "aria-describedby": helperId, style: { resize, height } }) }), jsxs("div", { className: styles$3.footer, children: [jsx("span", { id: helperId, className: styles$3.helperText, "aria-live": hasError ? 'polite' : undefined, children: displayHelperText }), showCharCount && maxLength && (jsxs("span", { className: styles$3.charCount, children: [textareaValue.length, "/", maxLength] }))] })] })] }));
|
|
4419
4582
|
});
|
|
4420
4583
|
TextArea.displayName = 'TextArea';
|
|
4421
4584
|
var TextArea_default = React__default.memo(TextArea);
|
|
@@ -4517,7 +4680,7 @@ const useToast = () => {
|
|
|
4517
4680
|
*
|
|
4518
4681
|
* @param props - {@link ToastProps} combinadas com o `id` único do toast
|
|
4519
4682
|
*/
|
|
4520
|
-
const Toast = ({ id, title, duration = 5000, icon, iconClosed = jsx(Dismiss16Filled, {}), automaticClose = true, iconType = "Info", ...
|
|
4683
|
+
const Toast = ({ id, title, duration = 5000, icon, iconClosed = jsx(Dismiss16Filled, {}), automaticClose = true, iconType = "Info", className, ...rest }) => {
|
|
4521
4684
|
const [open, setOpen] = React.useState(false);
|
|
4522
4685
|
const { dismissToast } = useToastContext();
|
|
4523
4686
|
React.useEffect(() => {
|
|
@@ -4542,7 +4705,7 @@ const Toast = ({ id, title, duration = 5000, icon, iconClosed = jsx(Dismiss16Fil
|
|
|
4542
4705
|
displayIcon = jsx(Warning20Filled, {});
|
|
4543
4706
|
}
|
|
4544
4707
|
}
|
|
4545
|
-
return (jsxs(Toast$1.Root, { className: styles$2.toastRoot, open: open, onOpenChange: handleOpenChange, duration: effectiveDuration, ...
|
|
4708
|
+
return (jsxs(Toast$1.Root, { className: clsx(styles$2.toastRoot, className), open: open, onOpenChange: handleOpenChange, duration: effectiveDuration, ...rest, children: [jsx("span", { className: `${styles$2.Icon} ${iconType ? styles$2[`icon${iconType}`] : ''}`, "aria-hidden": "true", children: displayIcon }), jsx("div", { className: styles$2.toastContent, children: jsxs(Toast$1.Title, { className: styles$2.toastTitle, children: [" ", title, " "] }) }), jsxs(Toast$1.Close, { className: styles$2.toastClose, children: [" ", iconClosed, " "] })] }));
|
|
4546
4709
|
};
|
|
4547
4710
|
|
|
4548
4711
|
/**
|
|
@@ -4628,7 +4791,7 @@ ToastContainer.displayName = 'ToastContainer';
|
|
|
4628
4791
|
|
|
4629
4792
|
var styles$1 = {"container":"Switch-module__container___BR1OB","switchRoot":"Switch-module__switchRoot___jz2HD","switchThumb":"Switch-module__switchThumb___X3RL7"};
|
|
4630
4793
|
|
|
4631
|
-
const Switch = ({ disabled = false, defaultChecked = false, checked, onCheckedChange, ...rest }) => (jsx("div", { className: clsx(styles$1.container), children: jsx(Switch$1.Root, { className: styles$1.switchRoot, disabled: disabled, defaultChecked: defaultChecked, checked: checked, onCheckedChange: onCheckedChange, ...rest, children: jsx(Switch$1.Thumb, { className: styles$1.switchThumb }) }) }));
|
|
4794
|
+
const Switch = ({ disabled = false, defaultChecked = false, checked, onCheckedChange, className, ...rest }) => (jsx("div", { className: clsx(styles$1.container, className), children: jsx(Switch$1.Root, { className: styles$1.switchRoot, disabled: disabled, defaultChecked: defaultChecked, checked: checked, onCheckedChange: onCheckedChange, ...rest, children: jsx(Switch$1.Thumb, { className: styles$1.switchThumb }) }) }));
|
|
4632
4795
|
|
|
4633
4796
|
var styles = {"zds-verification-code__container":"VerificationCode-module__zds-verification-code__container___tUNuJ","zds-verification-code__input":"VerificationCode-module__zds-verification-code__input___wDIQ6","zds-verification-code__filled":"VerificationCode-module__zds-verification-code__filled___-2VVb","zds-verification-code__has-error":"VerificationCode-module__zds-verification-code__has-error___eqKAp","zds-verification-code__error":"VerificationCode-module__zds-verification-code__error___T53i5"};
|
|
4634
4797
|
|
|
@@ -5044,5 +5207,5 @@ function useInfiniteScroll({ status, page, lastPage, onLoadMore, threshold = 0.1
|
|
|
5044
5207
|
};
|
|
5045
5208
|
}
|
|
5046
5209
|
|
|
5047
|
-
export { Avatar, Badge, Button, Calendar, Callout, Checkbox, MemoizedChips as Chips, Container, DatePicker_default as DatePicker, Dialog, Drawer, Filter, ListItem, Menu, Modal, Popover, memorizedQuantity as Quantity, Radio, Search, Select, Switch, Table, TableHeader, TablePagination, TextArea_default as TextArea, TextField$1 as TextField, Toast, ToastContainer, ToastProvider, Tooltip, VerificationCode, normalizeText, useApiSimulation, useInfiniteScroll, useToast };
|
|
5210
|
+
export { Avatar, Badge, Button, Calendar, Callout, Checkbox, MemoizedChips as Chips, Container, DatePicker_default as DatePicker, Dialog, Drawer, Filter, ListItem, Menu, Modal, Popover, memorizedQuantity as Quantity, Radio, Search, Select, Switch, Table, TableHeader, TablePagination, TableV2, TextArea_default as TextArea, TextField$1 as TextField, Toast, ToastContainer, ToastProvider, Tooltip, VerificationCode, normalizeText, useApiSimulation, useInfiniteScroll, useToast };
|
|
5048
5211
|
//# sourceMappingURL=index.esm.js.map
|