@giro-ds/react 6.0.1 → 7.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 +342 -180
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +305 -49
- package/dist/index.esm.js +344 -183
- package/dist/index.esm.js.map +1 -1
- package/dist/styles.css +3 -1
- package/package.json +3 -1
package/dist/index.cjs
CHANGED
|
@@ -8,6 +8,8 @@ var reactIcons = require('@fluentui/react-icons');
|
|
|
8
8
|
var reactDayPicker = require('react-day-picker');
|
|
9
9
|
var dateFns = require('date-fns');
|
|
10
10
|
var reactDom = require('react-dom');
|
|
11
|
+
var reactTable = require('@tanstack/react-table');
|
|
12
|
+
var Skeleton = require('react-loading-skeleton');
|
|
11
13
|
|
|
12
14
|
function _interopNamespaceDefault(e) {
|
|
13
15
|
var n = Object.create(null);
|
|
@@ -28,58 +30,59 @@ function _interopNamespaceDefault(e) {
|
|
|
28
30
|
|
|
29
31
|
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
30
32
|
|
|
31
|
-
var styles$
|
|
33
|
+
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"};
|
|
32
34
|
|
|
33
35
|
const Avatar = ({ icon, size = 'lg', src, className, initialLetters, ...rest }) => {
|
|
34
|
-
const AvatarClass = clsx(styles$
|
|
35
|
-
[styles$
|
|
36
|
-
[styles$
|
|
36
|
+
const AvatarClass = clsx(styles$s.AvatarRoot, {
|
|
37
|
+
[styles$s['AvatarRoot--lg']]: size === 'lg',
|
|
38
|
+
[styles$s['AvatarRoot--sm']]: size === 'sm',
|
|
37
39
|
}, className);
|
|
38
|
-
return (jsxRuntime.
|
|
40
|
+
return (jsxRuntime.jsxs(radixUi.Avatar.Root, { className: AvatarClass, ...rest, children: [src && (jsxRuntime.jsx(radixUi.Avatar.Image, { className: styles$s.AvatarImage, src: src, alt: "Avatar" })), jsxRuntime.jsx(radixUi.Avatar.Fallback, { className: styles$s.AvatarFallback, children: icon || initialLetters })] }));
|
|
39
41
|
};
|
|
40
42
|
|
|
41
|
-
var styles$
|
|
43
|
+
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"};
|
|
42
44
|
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
if (!isFinite(inputValue))
|
|
51
|
-
return '';
|
|
52
|
-
if (inputValue < 0)
|
|
53
|
-
return 0;
|
|
54
|
-
if (inputValue === 0)
|
|
55
|
-
return '';
|
|
56
|
-
return inputValue > 99 ? `${99}+` : inputValue;
|
|
45
|
+
const getDisplayValue = (value) => {
|
|
46
|
+
if (value === null || value === undefined)
|
|
47
|
+
return '';
|
|
48
|
+
if (typeof value === 'string') {
|
|
49
|
+
const parsed = Number(value);
|
|
50
|
+
if (isFinite(parsed) && parsed > 0 && String(parsed) === value) {
|
|
51
|
+
return parsed > 99 ? '99+' : value;
|
|
57
52
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
53
|
+
return value;
|
|
54
|
+
}
|
|
55
|
+
if (!isFinite(value) || value <= 0)
|
|
56
|
+
return '';
|
|
57
|
+
return value > 99 ? '99+' : String(value);
|
|
58
|
+
};
|
|
59
|
+
const Badge = ({ children, badgeValue = null, className, id, filterVariant = false, 'aria-label': ariaLabel, ...rest }) => {
|
|
60
|
+
const generatedId = React.useId();
|
|
61
|
+
const componentId = id || generatedId;
|
|
62
62
|
const displayValue = getDisplayValue(badgeValue);
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
[styles$
|
|
67
|
-
|
|
63
|
+
const isEmpty = displayValue === '';
|
|
64
|
+
if (children) {
|
|
65
|
+
return (jsxRuntime.jsxs("div", { className: styles$r.badgeContainer, ...rest, children: [jsxRuntime.jsx("div", { "data-testid": "badge-content", children: children }), jsxRuntime.jsx("div", { id: componentId, className: clsx(styles$r.badge, {
|
|
66
|
+
[styles$r['badge__empty']]: isEmpty,
|
|
67
|
+
[styles$r['badge__flex']]: displayValue.length >= 2,
|
|
68
|
+
}, className), "data-testid": "badge", children: !isEmpty && jsxRuntime.jsx("span", { "aria-hidden": !!ariaLabel, children: displayValue }) })] }));
|
|
68
69
|
}
|
|
69
|
-
return (jsxRuntime.jsx("div", { className:
|
|
70
|
-
[styles$
|
|
71
|
-
|
|
70
|
+
return (jsxRuntime.jsx("div", { className: styles$r.badgeContainer, children: jsxRuntime.jsx("div", { className: clsx(styles$r['badge__status'], {
|
|
71
|
+
[styles$r['badge__status__empty']]: isEmpty,
|
|
72
|
+
[styles$r['badge__status__flex']]: displayValue.length >= 2,
|
|
73
|
+
[styles$r['badge__status__filterBadge']]: filterVariant,
|
|
74
|
+
}, className), "data-testid": "badge", children: !isEmpty && (jsxRuntime.jsx("span", { "aria-hidden": !!ariaLabel, children: displayValue })) }) }));
|
|
72
75
|
};
|
|
73
76
|
|
|
74
|
-
var styles$
|
|
77
|
+
var styles$q = {"tooltipContent":"Tooltip-module__tooltipContent___xycUg","triggerWrapper":"Tooltip-module__triggerWrapper___x83XR"};
|
|
75
78
|
|
|
76
|
-
const Tooltip = ({ children, text, side = 'bottom', align = 'start', maxWidth, sideOffset = 10, ...rest }) => {
|
|
77
|
-
return (jsxRuntime.jsx(radixUi.Tooltip.Provider, { children: jsxRuntime.jsxs(radixUi.Tooltip.Root, { children: [jsxRuntime.jsx(radixUi.Tooltip.Trigger, { asChild: true, children: jsxRuntime.jsx("span", { className: styles$
|
|
79
|
+
const Tooltip = ({ children, text, side = 'bottom', align = 'start', maxWidth, sideOffset = 10, className, ...rest }) => {
|
|
80
|
+
return (jsxRuntime.jsx(radixUi.Tooltip.Provider, { children: jsxRuntime.jsxs(radixUi.Tooltip.Root, { children: [jsxRuntime.jsx(radixUi.Tooltip.Trigger, { asChild: true, children: jsxRuntime.jsx("span", { className: styles$q.triggerWrapper, children: children }) }), jsxRuntime.jsx(radixUi.Tooltip.Portal, { children: jsxRuntime.jsx(radixUi.Tooltip.Content, { className: clsx(styles$q.tooltipContent, className), side: side, align: align, sideOffset: sideOffset, style: { maxWidth: maxWidth ? `${maxWidth}px` : 'auto' }, ...rest, children: text }) })] }) }));
|
|
78
81
|
};
|
|
79
82
|
|
|
80
|
-
var styles$
|
|
83
|
+
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"};
|
|
81
84
|
|
|
82
|
-
const Button = React.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', ...
|
|
85
|
+
const Button = React.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) => {
|
|
83
86
|
const generatedId = React.useId();
|
|
84
87
|
const componentId = id || generatedId;
|
|
85
88
|
const getComponent = () => {
|
|
@@ -106,14 +109,14 @@ const Button = React.forwardRef(({ as, children, variant = 'filled', iconPositio
|
|
|
106
109
|
'Forneça um ícone via `icon={<MeuIcone />}`.');
|
|
107
110
|
}
|
|
108
111
|
const resolvedIcon = icon;
|
|
109
|
-
const buttonClasses = clsx(styles$
|
|
110
|
-
[styles$
|
|
111
|
-
[styles$
|
|
112
|
-
[styles$
|
|
113
|
-
[styles$
|
|
114
|
-
[styles$
|
|
115
|
-
[styles$
|
|
116
|
-
[styles$
|
|
112
|
+
const buttonClasses = clsx(styles$p.button, styles$p[`button-${variant}`], styles$p[`button-${size}`], {
|
|
113
|
+
[styles$p['disabled']]: disabled,
|
|
114
|
+
[styles$p['buttonLoading']]: loading,
|
|
115
|
+
[styles$p['buttonWithIcon']]: resolvedIcon && !iconOnly,
|
|
116
|
+
[styles$p[`buttonIconPosition-${iconPosition}`]]: resolvedIcon && !iconOnly,
|
|
117
|
+
[styles$p['buttonNoContent']]: resolvedIcon && !hasContent && !iconOnly,
|
|
118
|
+
[styles$p['buttonFullWidth']]: fullWidth,
|
|
119
|
+
[styles$p['buttonIconOnly']]: iconOnly,
|
|
117
120
|
}, className);
|
|
118
121
|
const getAriaLabel = () => {
|
|
119
122
|
if (ariaLabel)
|
|
@@ -139,12 +142,12 @@ const Button = React.forwardRef(({ as, children, variant = 'filled', iconPositio
|
|
|
139
142
|
};
|
|
140
143
|
const renderContent = () => {
|
|
141
144
|
if (iconOnly && !loading) {
|
|
142
|
-
return (jsxRuntime.jsx("span", { className: styles$
|
|
145
|
+
return (jsxRuntime.jsx("span", { className: styles$p.buttonIconOnly, "aria-hidden": "true", children: resolvedIcon }));
|
|
143
146
|
}
|
|
144
147
|
if (loading) {
|
|
145
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [!iconOnly && (jsxRuntime.jsxs("span", { className: styles$
|
|
148
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [!iconOnly && (jsxRuntime.jsxs("span", { className: styles$p.buttonContentHidden, "aria-hidden": "true", children: [resolvedIcon && (iconPosition === 'left' || iconPosition === 'both') && (jsxRuntime.jsx("span", { className: styles$p.buttonIconLeft, children: resolvedIcon })), children, resolvedIcon && (iconPosition === 'right' || iconPosition === 'both') && (jsxRuntime.jsx("span", { className: styles$p.buttonIconRight, children: resolvedIcon }))] })), jsxRuntime.jsx("span", { className: styles$p.buttonLoadingSpinner, "aria-hidden": "true", children: jsxRuntime.jsx(reactIcons.SpinnerIos16Regular, { "aria-hidden": "true" }) })] }));
|
|
146
149
|
}
|
|
147
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [resolvedIcon && (iconPosition === 'left' || iconPosition === 'both') && (jsxRuntime.jsx("span", { className: styles$
|
|
150
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [resolvedIcon && (iconPosition === 'left' || iconPosition === 'both') && (jsxRuntime.jsx("span", { className: styles$p.buttonIconLeft, "aria-hidden": "true", children: resolvedIcon })), children, resolvedIcon && (iconPosition === 'right' || iconPosition === 'both') && (jsxRuntime.jsx("span", { className: styles$p.buttonIconRight, "aria-hidden": "true", children: resolvedIcon }))] }));
|
|
148
151
|
};
|
|
149
152
|
const baseProps = {
|
|
150
153
|
ref,
|
|
@@ -155,7 +158,7 @@ const Button = React.forwardRef(({ as, children, variant = 'filled', iconPositio
|
|
|
155
158
|
'aria-busy': loading || undefined,
|
|
156
159
|
tabIndex: disabled || loading ? -1 : 0,
|
|
157
160
|
onClick: handleClick,
|
|
158
|
-
...
|
|
161
|
+
...rest,
|
|
159
162
|
};
|
|
160
163
|
const getNavigationProps = () => {
|
|
161
164
|
if (href) {
|
|
@@ -2449,7 +2452,7 @@ const ptBR = {
|
|
|
2449
2452
|
},
|
|
2450
2453
|
};
|
|
2451
2454
|
|
|
2452
|
-
var styles$
|
|
2455
|
+
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"};
|
|
2453
2456
|
|
|
2454
2457
|
const FLUENT_CHEVRON_MAP = {
|
|
2455
2458
|
down: reactIcons.ChevronDown16Regular,
|
|
@@ -2468,10 +2471,10 @@ const GridMonthCaption = ({ calendarMonth, displayIndex: _displayIndex, ...divPr
|
|
|
2468
2471
|
const date = calendarMonth.date;
|
|
2469
2472
|
const monthLabel = new Intl.DateTimeFormat(intlLocale, { month: "long" }).format(date);
|
|
2470
2473
|
const yearLabel = String(date.getFullYear());
|
|
2471
|
-
return (jsxRuntime.jsxs("div", { ...divProps, children: [jsxRuntime.jsx("span", { className: styles$
|
|
2474
|
+
return (jsxRuntime.jsxs("div", { ...divProps, children: [jsxRuntime.jsx("span", { className: styles$o.caption_grid_label, children: monthLabel }), jsxRuntime.jsxs("button", { type: "button", className: styles$o.caption_grid_btn, "aria-pressed": view === "years", onClick: onYearLabelClick, children: [yearLabel, view !== "days" ? (jsxRuntime.jsx(reactIcons.ChevronUp16Regular, { className: styles$o.caption_year_chevron, "aria-hidden": true })) : (jsxRuntime.jsx(reactIcons.ChevronDown16Regular, { className: styles$o.caption_year_chevron, "aria-hidden": true }))] })] }));
|
|
2472
2475
|
};
|
|
2473
2476
|
const YEARS_PER_PAGE = 20;
|
|
2474
|
-
const Calendar = ({ selected, currentDate, defaultMonth, startMonth, endMonth, onDaySelect, onDateChange, onClear: _onClear, minDate, maxDate, disabled, format: _format, locale = "pt-br", autoFocus, id, "aria-label": ariaLabel, }) => {
|
|
2477
|
+
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 }) => {
|
|
2475
2478
|
const animate = true;
|
|
2476
2479
|
const [internalSelected, setInternalSelected] = React.useState(selected ?? undefined);
|
|
2477
2480
|
const [internalDisplayMonth, setInternalDisplayMonth] = React.useState(() => currentDate ?? defaultMonth ?? new Date());
|
|
@@ -2536,7 +2539,7 @@ const Calendar = ({ selected, currentDate, defaultMonth, startMonth, endMonth, o
|
|
|
2536
2539
|
onYearLabelClick: handleYearLabelClick,
|
|
2537
2540
|
};
|
|
2538
2541
|
const sharedDayPickerProps = {
|
|
2539
|
-
classNames: styles$
|
|
2542
|
+
classNames: styles$o,
|
|
2540
2543
|
animate,
|
|
2541
2544
|
mode: "single",
|
|
2542
2545
|
selected: resolvedSelected,
|
|
@@ -2548,20 +2551,25 @@ const Calendar = ({ selected, currentDate, defaultMonth, startMonth, endMonth, o
|
|
|
2548
2551
|
autoFocus,
|
|
2549
2552
|
"aria-label": ariaLabel,
|
|
2550
2553
|
};
|
|
2551
|
-
return (jsxRuntime.jsx(GridCtx.Provider, { value: gridCtxValue, children: jsxRuntime.jsxs("div", { className: styles$
|
|
2554
|
+
return (jsxRuntime.jsx(GridCtx.Provider, { value: gridCtxValue, children: jsxRuntime.jsxs("div", { className: clsx(styles$o.calendar_grid_wrapper, className), children: [jsxRuntime.jsx(reactDayPicker.DayPicker, { id: id, ...sharedDayPickerProps, ...rest, captionLayout: "label", month: resolvedDisplayMonth, onMonthChange: handleMonthChange, components: { MonthCaption: GridMonthCaption, Chevron: CustomChevron } }), gridView !== "days" && (jsxRuntime.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" && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: styles$o.gridOverlayCaption, children: [jsxRuntime.jsx("span", { className: styles$o.caption_grid_label, children: new Intl.DateTimeFormat(intlLocale, { month: "long" }).format(resolvedDisplayMonth) }), jsxRuntime.jsxs("button", { type: "button", className: styles$o.caption_grid_btn, onClick: () => setGridView("days"), "aria-label": "Fechar sele\u00E7\u00E3o de m\u00EAs", children: [displayedYear, jsxRuntime.jsx(reactIcons.ChevronUp16Regular, { className: styles$o.caption_year_chevron, "aria-hidden": true })] })] }), jsxRuntime.jsx("div", { className: styles$o.gridCells, children: monthsGrid.map(({ index, label, disabled: monthDisabled }) => (jsxRuntime.jsx("button", { type: "button", disabled: monthDisabled, className: `${styles$o.gridCell}${displayedMonthIndex === index ? ` ${styles$o.gridCellActive}` : ""}`, onClick: () => handleGridMonthSelect(index), children: label }, index))) })] })), gridView === "years" && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: styles$o.gridOverlayCaption, children: [jsxRuntime.jsx("span", { className: styles$o.caption_grid_label, children: new Intl.DateTimeFormat(intlLocale, { month: "long" }).format(resolvedDisplayMonth) }), jsxRuntime.jsxs("button", { type: "button", className: styles$o.caption_grid_btn, onClick: () => setGridView("days"), "aria-label": "Fechar sele\u00E7\u00E3o de ano", children: [displayedYear, jsxRuntime.jsx(reactIcons.ChevronUp16Regular, { className: styles$o.caption_year_chevron, "aria-hidden": true })] }), jsxRuntime.jsxs("div", { className: styles$o.gridOverlayYearsNav, children: [jsxRuntime.jsx("button", { type: "button", className: styles$o.gridNavBtn, disabled: !canGoPrevYears, onClick: () => setYearPageStart((s) => s - YEARS_PER_PAGE), "aria-label": "Anos anteriores", children: jsxRuntime.jsx(reactIcons.ChevronLeft16Regular, { className: styles$o.chevronNavBtnPrev, "aria-hidden": true }) }), jsxRuntime.jsx("button", { type: "button", className: styles$o.gridNavBtn, disabled: !canGoNextYears, onClick: () => setYearPageStart((s) => s + YEARS_PER_PAGE), "aria-label": "Pr\u00F3ximos anos", children: jsxRuntime.jsx(reactIcons.ChevronRight16Regular, { className: styles$o.chevronNavBtnNext, "aria-hidden": true }) })] })] }), jsxRuntime.jsx("div", { className: `${styles$o.gridCells} ${styles$o.gridCellsYears}`, children: yearsInPage.map((year) => (jsxRuntime.jsx("button", { type: "button", className: `${styles$o.gridCell}${displayedYear === year ? ` ${styles$o.gridCellActive}` : ""}`, onClick: () => handleGridYearSelect(year), children: year }, year))) })] }))] }))] }) }));
|
|
2552
2555
|
};
|
|
2553
2556
|
|
|
2554
|
-
var styles$
|
|
2557
|
+
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"};
|
|
2555
2558
|
|
|
2556
|
-
const Callout = ({
|
|
2559
|
+
const Callout = ({ variant = 'neutral', title, text, icon, onDismiss, dismiss, backgroundColor, textColor, className, id, ...rest }) => {
|
|
2560
|
+
if (process.env.NODE_ENV !== 'production' && (text === '' || (typeof text === 'string' && !text.trim()))) {
|
|
2561
|
+
console.warn('[Callout] A prop `text` não pode ser uma string vazia.');
|
|
2562
|
+
}
|
|
2557
2563
|
const generatedId = React.useId();
|
|
2558
|
-
const titleId =
|
|
2564
|
+
const titleId = `callout-title-${id || generatedId}`;
|
|
2559
2565
|
const componentId = id || generatedId;
|
|
2560
|
-
const
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2566
|
+
const isAlert = variant === 'alert';
|
|
2567
|
+
const containerClass = clsx(styles$n.container, styles$n[variant], { [styles$n.withTitle]: title }, className);
|
|
2568
|
+
const customStyle = {
|
|
2569
|
+
...(backgroundColor && { '--callout-bg': `var(--${backgroundColor})` }),
|
|
2570
|
+
...(textColor && { '--callout-text': `var(--${textColor})` }),
|
|
2571
|
+
};
|
|
2572
|
+
return (jsxRuntime.jsx("div", { id: componentId, className: containerClass, role: isAlert ? 'alert' : 'status', "aria-live": isAlert ? 'assertive' : 'polite', "aria-labelledby": title ? titleId : undefined, style: customStyle, ...rest, children: jsxRuntime.jsxs("div", { className: styles$n.content, children: [icon && jsxRuntime.jsx("span", { className: styles$n.icon, "aria-hidden": "true", children: icon }), jsxRuntime.jsxs("div", { className: styles$n.subcontent, children: [title && (jsxRuntime.jsx("span", { id: titleId, className: styles$n.title, children: title })), text && jsxRuntime.jsx("span", { className: styles$n.text, children: text })] }), dismiss && (jsxRuntime.jsx("button", { className: styles$n.dismiss, onClick: onDismiss, type: "button", "aria-label": "Fechar", children: jsxRuntime.jsx(reactIcons.Dismiss24Regular, { "aria-hidden": "true" }) }))] }) }));
|
|
2565
2573
|
};
|
|
2566
2574
|
|
|
2567
2575
|
const CheckSmall = ({ className = '', width = 12, height = 10, fill = 'white', ...restProps }) => {
|
|
@@ -2572,47 +2580,47 @@ const CheckHalf = ({ className = '', width = 16, height = 16, fill = 'white', ..
|
|
|
2572
2580
|
return (jsxRuntime.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: jsxRuntime.jsx("g", { id: "Icons/check_indeterminate_small", children: jsxRuntime.jsx("path", { id: "icon", d: "M3 9V7H13V9H3Z", fill: fill }) }) }));
|
|
2573
2581
|
};
|
|
2574
2582
|
|
|
2575
|
-
var styles$
|
|
2583
|
+
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"};
|
|
2576
2584
|
|
|
2577
2585
|
const Checkbox = ({ id, label, onCheckedChange, checked, disabled, className, indeterminate = false, ...rest }) => {
|
|
2578
2586
|
const componentId = id || React__namespace.useId();
|
|
2579
|
-
return (jsxRuntime.jsxs("div", { className: clsx(styles$
|
|
2580
|
-
[styles$
|
|
2581
|
-
}), role: "presentation", tabIndex: disabled ? -1 : 0, children: jsxRuntime.jsx(radixUi.Checkbox.Root, { className: styles$
|
|
2587
|
+
return (jsxRuntime.jsxs("div", { className: clsx(styles$m.container, className), children: [jsxRuntime.jsx("div", { className: clsx(styles$m.wrapperCheckbox, {
|
|
2588
|
+
[styles$m.disabled]: disabled,
|
|
2589
|
+
}), role: "presentation", tabIndex: disabled ? -1 : 0, children: jsxRuntime.jsx(radixUi.Checkbox.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: jsxRuntime.jsx(radixUi.Checkbox.Indicator, { className: styles$m.indicator, children: indeterminate ? jsxRuntime.jsx(CheckHalf, {}) : jsxRuntime.jsx(CheckSmall, {}) }) }) }), jsxRuntime.jsx("label", { className: clsx(styles$m.label, { [styles$m.disabled]: disabled }), htmlFor: componentId, children: label })] }));
|
|
2582
2590
|
};
|
|
2583
2591
|
|
|
2584
|
-
var styles$
|
|
2592
|
+
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"};
|
|
2585
2593
|
|
|
2586
|
-
const Chips = ({ children, leftIcon, rightIcon, variant = 'neutral', disabled = false, backgroundColor, textColor, className, style, ...
|
|
2587
|
-
const chipsClass = clsx(styles$
|
|
2588
|
-
[styles$
|
|
2589
|
-
[styles$
|
|
2590
|
-
[styles$
|
|
2594
|
+
const Chips = ({ children, leftIcon, rightIcon, variant = 'neutral', disabled = false, backgroundColor, textColor, className, style, ...rest }) => {
|
|
2595
|
+
const chipsClass = clsx(styles$l.chips, styles$l[variant], {
|
|
2596
|
+
[styles$l.disabled]: disabled,
|
|
2597
|
+
[styles$l.hasLeftIcon]: leftIcon,
|
|
2598
|
+
[styles$l.hasRightIcon]: rightIcon,
|
|
2591
2599
|
}, className);
|
|
2592
2600
|
const colorStyle = {
|
|
2593
2601
|
...(!disabled && backgroundColor && { '--chips-bg': `var(--${backgroundColor})` }),
|
|
2594
2602
|
...(!disabled && textColor && { '--chips-text': `var(--${textColor})` }),
|
|
2595
2603
|
...style,
|
|
2596
2604
|
};
|
|
2597
|
-
const isInteractive = typeof
|
|
2598
|
-
return (jsxRuntime.jsxs("div", { className: chipsClass, "aria-disabled": disabled, style: colorStyle, role: isInteractive ? 'button' : undefined, tabIndex: isInteractive ? (disabled ? -1 : 0) : undefined, ...
|
|
2605
|
+
const isInteractive = typeof rest.onClick === 'function';
|
|
2606
|
+
return (jsxRuntime.jsxs("div", { className: chipsClass, "aria-disabled": disabled, style: colorStyle, role: isInteractive ? 'button' : undefined, tabIndex: isInteractive ? (disabled ? -1 : 0) : undefined, ...rest, children: [leftIcon && (jsxRuntime.jsx("span", { className: styles$l.iconLeft, "aria-hidden": "true", children: leftIcon })), jsxRuntime.jsx("span", { className: styles$l.title, children: children }), rightIcon && (jsxRuntime.jsx("span", { className: styles$l.iconRight, children: rightIcon }))] }));
|
|
2599
2607
|
};
|
|
2600
2608
|
const MemoizedChips = React.memo(Chips);
|
|
2601
2609
|
MemoizedChips.displayName = 'Chips';
|
|
2602
2610
|
|
|
2603
|
-
var styles$
|
|
2611
|
+
var styles$k = {"container":"Container-module__container___exPuE"};
|
|
2604
2612
|
|
|
2605
|
-
function Container({ children }) {
|
|
2606
|
-
return (jsxRuntime.jsx("main", { className:
|
|
2613
|
+
function Container({ children, className }) {
|
|
2614
|
+
return (jsxRuntime.jsx("main", { className: clsx(styles$k['container'], 'mx-auto', className), children: children }));
|
|
2607
2615
|
}
|
|
2608
2616
|
|
|
2609
|
-
var styles$
|
|
2617
|
+
var styles$j = {"Content":"Popover-module__Content___RIETg"};
|
|
2610
2618
|
|
|
2611
|
-
const Popover = ({ trigger, content, side = "left", align = "start", sideOffset = 8, open, onOpenChange, asAnchor = false, onOpenAutoFocus, onCloseAutoFocus, showArrow = false, }) => {
|
|
2612
|
-
return (jsxRuntime.jsxs(radixUi.Popover.Root, { open: open, onOpenChange: onOpenChange, children: [asAnchor ? (jsxRuntime.jsx(radixUi.Popover.Anchor, { asChild: true, children: trigger })) : (jsxRuntime.jsx(radixUi.Popover.Trigger, { asChild: true, children: trigger })), jsxRuntime.jsx(radixUi.Popover.Portal, { children: jsxRuntime.jsxs(radixUi.Popover.Content, { className: styles$
|
|
2619
|
+
const Popover = ({ trigger, content, side = "left", align = "start", sideOffset = 8, open, onOpenChange, asAnchor = false, onOpenAutoFocus, onCloseAutoFocus, showArrow = false, className, ...rest }) => {
|
|
2620
|
+
return (jsxRuntime.jsxs(radixUi.Popover.Root, { open: open, onOpenChange: onOpenChange, ...rest, children: [asAnchor ? (jsxRuntime.jsx(radixUi.Popover.Anchor, { asChild: true, children: trigger })) : (jsxRuntime.jsx(radixUi.Popover.Trigger, { asChild: true, children: trigger })), jsxRuntime.jsx(radixUi.Popover.Portal, { children: jsxRuntime.jsxs(radixUi.Popover.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 && jsxRuntime.jsx(radixUi.Popover.Arrow, {})] }) })] }));
|
|
2613
2621
|
};
|
|
2614
2622
|
|
|
2615
|
-
var styles$
|
|
2623
|
+
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"};
|
|
2616
2624
|
|
|
2617
2625
|
const validateInput = ({ value, maxLength, errorMessage, required }) => {
|
|
2618
2626
|
if (required && value.trim() === '') {
|
|
@@ -2624,12 +2632,12 @@ const validateInput = ({ value, maxLength, errorMessage, required }) => {
|
|
|
2624
2632
|
return '';
|
|
2625
2633
|
};
|
|
2626
2634
|
|
|
2627
|
-
var styles$
|
|
2635
|
+
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"};
|
|
2628
2636
|
|
|
2629
|
-
const LabelComponent = ({ children, htmlFor, required = false, tooltip = false, tooltipText, side = 'bottom', align = 'start', className, error = false, disabled = false }) => (jsxRuntime.jsxs("div", { className: clsx(styles$
|
|
2630
|
-
styles$
|
|
2637
|
+
const LabelComponent = ({ children, htmlFor, required = false, tooltip = false, tooltipText, side = 'bottom', align = 'start', className, error = false, disabled = false }) => (jsxRuntime.jsxs("div", { className: clsx(styles$h.labelContainer, disabled && styles$h.disabledContainer), children: [jsxRuntime.jsxs(radixUi.Label.Root, { className: clsx(styles$h.wrapperLabel, error && !disabled && styles$h.errorLabel, disabled && styles$h.disabledLabel, className), htmlFor: htmlFor, children: [children, required && jsxRuntime.jsx("span", { className: styles$h.requiredLabel, children: "*" })] }), tooltip && (jsxRuntime.jsx(Tooltip, { side: side, align: align, text: tooltipText || '', children: jsxRuntime.jsx("span", { className: disabled ? styles$h.disabledIcon : error ?
|
|
2638
|
+
styles$h.errorIcon : styles$h.infoIcon, children: jsxRuntime.jsx(reactIcons.Info12Regular, {}) }) }))] }));
|
|
2631
2639
|
|
|
2632
|
-
const TextField$1 = React.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, ...
|
|
2640
|
+
const TextField$1 = React.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) => {
|
|
2633
2641
|
const normalizeValue = (val) => {
|
|
2634
2642
|
return val === undefined || val === null ? '' : String(val);
|
|
2635
2643
|
};
|
|
@@ -2689,22 +2697,22 @@ const TextField$1 = React.forwardRef(({ className, value, label, placeholder, ty
|
|
|
2689
2697
|
: helperText
|
|
2690
2698
|
? `${componentId}-helper`
|
|
2691
2699
|
: undefined;
|
|
2692
|
-
const containerClass = clsx(styles$
|
|
2693
|
-
[styles$
|
|
2694
|
-
[styles$
|
|
2700
|
+
const containerClass = clsx(styles$i.container, {
|
|
2701
|
+
[styles$i.disabled]: disabled,
|
|
2702
|
+
[styles$i.error]: hasError && !disabled,
|
|
2695
2703
|
[className]: className,
|
|
2696
2704
|
});
|
|
2697
|
-
return (jsxRuntime.jsxs("div", { className: containerClass, children: [label && (jsxRuntime.jsx(LabelComponent, { htmlFor: componentId, required: required, tooltip: tooltip, tooltipText: tooltipText, side: side, align: align, error: hasError, disabled: disabled, children: label })), jsxRuntime.jsxs("div", { className: styles$
|
|
2698
|
-
[styles$
|
|
2699
|
-
}) }), showCustomIcon && jsxRuntime.jsx("span", { className: styles$
|
|
2705
|
+
return (jsxRuntime.jsxs("div", { className: containerClass, children: [label && (jsxRuntime.jsx(LabelComponent, { htmlFor: componentId, required: required, tooltip: tooltip, tooltipText: tooltipText, side: side, align: align, error: hasError, disabled: disabled, children: label })), jsxRuntime.jsxs("div", { className: styles$i.inputWrapper, children: [jsxRuntime.jsxs("div", { className: styles$i.inputContainer, children: [jsxRuntime.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({
|
|
2706
|
+
[styles$i.inputWithIcon]: showCustomIcon || showClearIcon,
|
|
2707
|
+
}) }), showCustomIcon && jsxRuntime.jsx("span", { className: styles$i.icon, children: icon }), showClearIcon && (jsxRuntime.jsx("button", { type: "button", className: styles$i.clearButton, onMouseDown: (e) => {
|
|
2700
2708
|
e.preventDefault();
|
|
2701
2709
|
handleClear();
|
|
2702
|
-
}, "aria-label": "Limpar campo", tabIndex: -1, children: jsxRuntime.jsx(reactIcons.Dismiss16Regular, {}) }))] }), jsxRuntime.jsx("span", { id: helperId, className: styles$
|
|
2710
|
+
}, "aria-label": "Limpar campo", tabIndex: -1, children: jsxRuntime.jsx(reactIcons.Dismiss16Regular, {}) }))] }), jsxRuntime.jsx("span", { id: helperId, className: styles$i.helperText, "aria-live": hasError ? 'polite' : undefined, children: displayHelperText })] })] }));
|
|
2703
2711
|
});
|
|
2704
2712
|
TextField$1.displayName = 'TextField';
|
|
2705
2713
|
var TextField = React.memo(TextField$1);
|
|
2706
2714
|
|
|
2707
|
-
var styles$
|
|
2715
|
+
var styles$g = {"datePicker":"DatePicker-module__datePicker___raJYg","textfieldContainer":"DatePicker-module__textfieldContainer___yy8pT","datePickerIcon":"DatePicker-module__datePickerIcon___XCZsn","datePickerIconDisabled":"DatePicker-module__datePickerIconDisabled___BB-Gx"};
|
|
2708
2716
|
|
|
2709
2717
|
function formatDate(date, locale = 'pt-br') {
|
|
2710
2718
|
if (!date || !(date instanceof Date)) {
|
|
@@ -2796,7 +2804,7 @@ function validatePartialDate(value, locale = 'pt-br') {
|
|
|
2796
2804
|
return 'incomplete';
|
|
2797
2805
|
}
|
|
2798
2806
|
|
|
2799
|
-
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, }) => {
|
|
2807
|
+
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 }) => {
|
|
2800
2808
|
const fieldId = React.useId();
|
|
2801
2809
|
const calendarId = `${fieldId}-calendar`;
|
|
2802
2810
|
const isControlled = value !== undefined;
|
|
@@ -2925,7 +2933,7 @@ const DatePicker = ({ locale = 'pt-br', calendarSide = 'bottom', calendarAlign =
|
|
|
2925
2933
|
}
|
|
2926
2934
|
}
|
|
2927
2935
|
};
|
|
2928
|
-
return (jsxRuntime.jsx("div", { ref: wrapperRef, className: styles$
|
|
2936
|
+
return (jsxRuntime.jsx("div", { ref: wrapperRef, className: clsx(styles$g.datePicker, className), ...rest, children: jsxRuntime.jsx(Popover, { open: showCalendar, onOpenChange: setShowCalendar, asAnchor: true, trigger: jsxRuntime.jsx(TextField, { className: styles$g.textfieldContainer, type: "tel", icon: jsxRuntime.jsx(reactIcons.Calendar16Regular, { onClick: !disabled ? handleIconClick : undefined, className: clsx(styles$g.datePickerIcon, disabled && styles$g.datePickerIconDisabled) }), onChange: (e) => {
|
|
2929
2937
|
handleTextFieldChange(String(e));
|
|
2930
2938
|
}, 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: jsxRuntime.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: () => {
|
|
2931
2939
|
handleDateChange(null);
|
|
@@ -2934,13 +2942,13 @@ const DatePicker = ({ locale = 'pt-br', calendarSide = 'bottom', calendarAlign =
|
|
|
2934
2942
|
};
|
|
2935
2943
|
var DatePicker_default = React.memo(DatePicker);
|
|
2936
2944
|
|
|
2937
|
-
var styles$
|
|
2945
|
+
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-"};
|
|
2938
2946
|
|
|
2939
|
-
const Dialog = ({ show = false, title, bodyContent, textPrimaryAction, textSecondaryAction, onPrimaryAction, onSecondaryAction, ...
|
|
2947
|
+
const Dialog = ({ show = false, title, bodyContent, textPrimaryAction, textSecondaryAction, onPrimaryAction, onSecondaryAction, className, ...rest }) => (jsxRuntime.jsx(radixUi.AlertDialog.Root, { open: show, ...rest, children: jsxRuntime.jsxs(radixUi.AlertDialog.Portal, { children: [jsxRuntime.jsx(radixUi.AlertDialog.Overlay, { className: styles$f.DialogOverlay }), jsxRuntime.jsxs(radixUi.AlertDialog.Content, { className: clsx(styles$f.DialogContent, className), children: [jsxRuntime.jsx(radixUi.AlertDialog.Title, { className: styles$f.DialogTitle, children: title }), jsxRuntime.jsx(radixUi.AlertDialog.Description, { className: styles$f.DialogDescription, children: bodyContent }), jsxRuntime.jsxs("div", { className: styles$f.DivButtons, children: [!!(textSecondaryAction && textSecondaryAction.trim()) && (jsxRuntime.jsx(radixUi.AlertDialog.Cancel, { asChild: true, children: jsxRuntime.jsx(Button, { variant: "outlined", ...(onSecondaryAction && { onClick: onSecondaryAction }), children: textSecondaryAction }) })), jsxRuntime.jsx(radixUi.AlertDialog.Action, { asChild: true, children: jsxRuntime.jsx(Button, { variant: "filled", ...(onPrimaryAction && { onClick: onPrimaryAction }), children: textPrimaryAction }) })] })] })] }) }));
|
|
2940
2948
|
|
|
2941
|
-
var styles$
|
|
2949
|
+
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"};
|
|
2942
2950
|
|
|
2943
|
-
const Drawer = ({ children, headerContent, customWidth = '400px', onClose, title = 'Título', isOpen = false, onOpen, className, id, disabled = false, onOverlayClick, closeOnOverlayClick = true, closeOnEscape = true, }) => {
|
|
2951
|
+
const Drawer = ({ children, headerContent, customWidth = '400px', onClose, title = 'Título', isOpen = false, onOpen, className, id, disabled = false, onOverlayClick, closeOnOverlayClick = true, closeOnEscape = true, ...rest }) => {
|
|
2944
2952
|
const internalClose = React.useCallback(() => {
|
|
2945
2953
|
if (disabled)
|
|
2946
2954
|
return;
|
|
@@ -2987,17 +2995,17 @@ const Drawer = ({ children, headerContent, customWidth = '400px', onClose, title
|
|
|
2987
2995
|
event.stopPropagation();
|
|
2988
2996
|
internalClose();
|
|
2989
2997
|
};
|
|
2990
|
-
return reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: clsx(styles$
|
|
2991
|
-
[styles$
|
|
2992
|
-
}), onClick: handleOverlayClick, role: "presentation", "aria-hidden": "true", "data-testid": "drawer-overlay" }), jsxRuntime.jsxs("div", { className: clsx(styles$
|
|
2993
|
-
[styles$
|
|
2994
|
-
[styles$
|
|
2998
|
+
return reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: clsx(styles$e['drawerShadow'], {
|
|
2999
|
+
[styles$e['drawerShadow--visible']]: isOpen,
|
|
3000
|
+
}), onClick: handleOverlayClick, role: "presentation", "aria-hidden": "true", "data-testid": "drawer-overlay" }), jsxRuntime.jsxs("div", { className: clsx(styles$e['drawerSidebar'], {
|
|
3001
|
+
[styles$e['drawerSidebar--open']]: isOpen,
|
|
3002
|
+
[styles$e['drawerSidebar--disabled']]: disabled,
|
|
2995
3003
|
}, className), style: {
|
|
2996
3004
|
'--drawer-custom-width': customWidth,
|
|
2997
|
-
}, onClick: handleDrawerClick, role: "dialog", "aria-modal": "true", "aria-labelledby": id ? `${id}-title` : 'drawer-title', "aria-hidden": !isOpen, "data-testid": "drawer-panel", id: id, children: [jsxRuntime.jsxs("div", { className: styles$
|
|
3005
|
+
}, 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: [jsxRuntime.jsxs("div", { className: styles$e.drawerTitleClose, children: [jsxRuntime.jsx("div", { className: styles$e.drawerTitle, id: id ? `${id}-title` : 'drawer-title', children: title }), headerContent && (jsxRuntime.jsx("div", { className: styles$e.drawerHeaderContent, children: headerContent })), jsxRuntime.jsx(Button, { onClick: handleCloseClick, variant: 'outlined', iconOnly: true, icon: jsxRuntime.jsx(reactIcons.Dismiss16Regular, {}), size: 'lg', tooltipText: 'Fechar' })] }), jsxRuntime.jsx("div", { className: styles$e.drawerChildren, "data-testid": "drawer-content", children: children })] })] }), document.body);
|
|
2998
3006
|
};
|
|
2999
3007
|
|
|
3000
|
-
var styles$
|
|
3008
|
+
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"};
|
|
3001
3009
|
|
|
3002
3010
|
const Search = React.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) => {
|
|
3003
3011
|
const [internalValue, setInternalValue] = React.useState('');
|
|
@@ -3045,16 +3053,16 @@ const Search = React.forwardRef(({ placeholder = 'Dica do que deve ser buscado',
|
|
|
3045
3053
|
return;
|
|
3046
3054
|
onKeyDown?.(e);
|
|
3047
3055
|
};
|
|
3048
|
-
return (jsxRuntime.jsxs("div", { className: clsx(styles$
|
|
3056
|
+
return (jsxRuntime.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) => {
|
|
3049
3057
|
if (e.key === 'Enter' || e.key === ' ') {
|
|
3050
3058
|
e.preventDefault();
|
|
3051
3059
|
onClick?.(e);
|
|
3052
3060
|
}
|
|
3053
|
-
} : undefined, children: [jsxRuntime.jsx("span", { className: clsx(styles$
|
|
3061
|
+
} : undefined, children: [jsxRuntime.jsx("span", { className: clsx(styles$d.searchLeftIcon, { [styles$d.disabled]: disabled }), tabIndex: -1, role: "presentation", "aria-hidden": "true", children: jsxRuntime.jsx(reactIcons.Search16Regular, {}) }), jsxRuntime.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 && (jsxRuntime.jsx("span", { className: styles$d.searchClearIcon, "aria-hidden": "true", onClick: clearInputSearch, children: jsxRuntime.jsx(reactIcons.Dismiss16Regular, {}) }))] }));
|
|
3054
3062
|
});
|
|
3055
3063
|
Search.displayName = 'Search';
|
|
3056
3064
|
|
|
3057
|
-
var styles$
|
|
3065
|
+
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"};
|
|
3058
3066
|
|
|
3059
3067
|
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 }) => {
|
|
3060
3068
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
@@ -3147,34 +3155,34 @@ const Filter = ({ items, type = 'checkbox', selectedIds, onApplyFilter, placehol
|
|
|
3147
3155
|
return null;
|
|
3148
3156
|
return selectedIds.length - 1;
|
|
3149
3157
|
}, [selectedIds]);
|
|
3150
|
-
const filterClass = clsx(styles$
|
|
3151
|
-
const triggerButton = (jsxRuntime.jsx(Button, { variant: variant, disabled: disabled, icon: type === 'calendar' ? jsxRuntime.jsx(reactIcons.Calendar16Regular, {}) : jsxRuntime.jsx(reactIcons.ChevronDownRegular, {}), iconPosition: "right", size: "lg", children: jsxRuntime.jsxs("div", { className: styles$
|
|
3152
|
-
const popoverContent = type === 'calendar' ? (jsxRuntime.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" })) : (jsxRuntime.jsxs("div", { className: styles$
|
|
3158
|
+
const filterClass = clsx(styles$c.container, className);
|
|
3159
|
+
const triggerButton = (jsxRuntime.jsx(Button, { variant: variant, disabled: disabled, icon: type === 'calendar' ? jsxRuntime.jsx(reactIcons.Calendar16Regular, {}) : jsxRuntime.jsx(reactIcons.ChevronDownRegular, {}), iconPosition: "right", size: "lg", children: jsxRuntime.jsxs("div", { className: styles$c.buttonContent, children: [icon && jsxRuntime.jsx("span", { className: styles$c.buttonIcon, children: icon }), jsxRuntime.jsx("span", { className: styles$c.buttonText, children: buttonDisplayText }), jsxRuntime.jsx("span", { className: clsx(styles$c.buttonArrow, { [styles$c.buttonArrowOpen]: isOpen }), children: getBadgeValue() && (jsxRuntime.jsx(Badge, { badgeValue: `+${getBadgeValue()}`, filterVariant: true })) })] }) }));
|
|
3160
|
+
const popoverContent = type === 'calendar' ? (jsxRuntime.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" })) : (jsxRuntime.jsxs("div", { className: styles$c.panel, children: [searchVisible && (jsxRuntime.jsx("div", { className: styles$c.search, children: jsxRuntime.jsx(Search, { value: searchQuery, placeholder: placeholder, onChange: handleSearchChange, onKeyDown: handleSearchKeyDown, onClear: () => setSearchQuery('') }) })), jsxRuntime.jsx("ul", { className: styles$c.list, role: "listbox", "aria-multiselectable": type === 'checkbox', children: filteredItems.length > 0 ? (filteredItems.map((item, index) => {
|
|
3153
3161
|
const itemId = item.id || `filter-item-${index}`;
|
|
3154
3162
|
const isSelected = !!tempSelectedItems[itemId];
|
|
3155
|
-
return (jsxRuntime.jsxs("li", { role: "option", "aria-selected": isSelected, "aria-disabled": item.disabled, className: clsx(styles$
|
|
3156
|
-
[styles$
|
|
3157
|
-
[styles$
|
|
3163
|
+
return (jsxRuntime.jsxs("li", { role: "option", "aria-selected": isSelected, "aria-disabled": item.disabled, className: clsx(styles$c.item, {
|
|
3164
|
+
[styles$c.itemSelected]: isSelected,
|
|
3165
|
+
[styles$c.itemDisabled]: item.disabled,
|
|
3158
3166
|
}), onMouseDown: (e) => e.preventDefault(), onClick: () => toggleItem(itemId, item), onKeyDown: (e) => {
|
|
3159
3167
|
if (e.key === 'Enter' || e.key === ' ') {
|
|
3160
3168
|
e.preventDefault();
|
|
3161
3169
|
toggleItem(itemId, item);
|
|
3162
3170
|
}
|
|
3163
|
-
}, children: [type === 'checkbox' && (jsxRuntime.jsx(Checkbox, { checked: isSelected, disabled: item.disabled, label: "" })), type === 'icon' && item.icon && (jsxRuntime.jsx("span", { className: styles$
|
|
3164
|
-
})) : (jsxRuntime.jsx("li", { className: styles$
|
|
3171
|
+
}, children: [type === 'checkbox' && (jsxRuntime.jsx(Checkbox, { checked: isSelected, disabled: item.disabled, label: "" })), type === 'icon' && item.icon && (jsxRuntime.jsx("span", { className: styles$c.itemIcon, children: item.icon })), jsxRuntime.jsx("span", { className: styles$c.itemText, children: item.text })] }, itemId));
|
|
3172
|
+
})) : (jsxRuntime.jsx("li", { className: styles$c.noResults, role: "status", "aria-live": "polite", children: "Nenhum item encontrado" })) }), jsxRuntime.jsxs("div", { className: styles$c.footer, children: [jsxRuntime.jsx(Button, { fullWidth: true, variant: "outlined", onClick: handleClearFilter, children: "Limpar" }), jsxRuntime.jsx(Button, { fullWidth: true, onClick: handleApplyFilter, children: "Aplicar" })] })] }));
|
|
3165
3173
|
return (jsxRuntime.jsx("div", { className: filterClass, id: id, ...rest, children: jsxRuntime.jsx(Popover, { open: isOpen, onOpenChange: handleOpenChange, side: side, align: align, onOpenAutoFocus: (e) => e.preventDefault(), trigger: triggerButton, content: popoverContent }) }));
|
|
3166
3174
|
};
|
|
3167
3175
|
|
|
3168
|
-
var styles$
|
|
3176
|
+
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"};
|
|
3169
3177
|
|
|
3170
|
-
var styles$
|
|
3178
|
+
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"};
|
|
3171
3179
|
|
|
3172
|
-
const Radio = ({ items, onValueChange, defaultValue, name, id, ariaLabel, orientation = 'vertical', ...rest }) => {
|
|
3180
|
+
const Radio = ({ items, onValueChange, defaultValue, name, id, ariaLabel, orientation = 'vertical', className, ...rest }) => {
|
|
3173
3181
|
const componentId = id || React.useId();
|
|
3174
|
-
return (jsxRuntime.jsx(radixUi.RadioGroup.Root, { id: componentId, className: styles$
|
|
3182
|
+
return (jsxRuntime.jsx(radixUi.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 }) => {
|
|
3175
3183
|
const itemKey = id ?? value;
|
|
3176
3184
|
const uniqueId = `${componentId}-item-${value}`;
|
|
3177
|
-
return (jsxRuntime.jsx("div", { className: clsx(styles$
|
|
3185
|
+
return (jsxRuntime.jsx("div", { className: clsx(styles$a.wrapper, { [styles$a.disabled]: disabled }), children: jsxRuntime.jsxs("label", { className: styles$a.labelWrapper, htmlFor: uniqueId, children: [jsxRuntime.jsx("div", { className: styles$a.itemWrapper, children: jsxRuntime.jsx(radixUi.RadioGroup.Item, { disabled: disabled, className: styles$a.item, value: value, id: uniqueId, "data-disabled": disabled, children: jsxRuntime.jsx(radixUi.RadioGroup.Indicator, { className: styles$a.indicator }) }) }), jsxRuntime.jsx("span", { className: styles$a.labelText, children: label })] }) }, itemKey));
|
|
3178
3186
|
}) }));
|
|
3179
3187
|
};
|
|
3180
3188
|
|
|
@@ -3236,24 +3244,24 @@ const ListItem = ({ id, className, variant = 'text', text, name, subText, disabl
|
|
|
3236
3244
|
const currentVariant = validVariants.includes(variant) ? variant : 'text';
|
|
3237
3245
|
switch (currentVariant) {
|
|
3238
3246
|
case 'checkbox':
|
|
3239
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Checkbox, { checked: internalChecked, disabled: disabled, onCheckedChange: () => handleCheckboxClick({}) }), jsxRuntime.jsxs("div", { className: styles$
|
|
3247
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Checkbox, { checked: internalChecked, disabled: disabled, onCheckedChange: () => handleCheckboxClick({}) }), jsxRuntime.jsxs("div", { className: styles$b['zds-list-item__wrapper-text'], children: [jsxRuntime.jsx("span", { id: `${itemId}-text`, className: styles$b['zds-list-item__text'], onClick: handleCheckboxClick, children: text }), showSubText && subText && (jsxRuntime.jsx("span", { id: `${itemId}-subtext`, className: styles$b['zds-list-item__subtext'], onClick: handleCheckboxClick, children: subText }))] })] }));
|
|
3240
3248
|
case 'radio':
|
|
3241
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: styles$
|
|
3249
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: styles$b['zds-list-item__wrapper-radio'], children: jsxRuntime.jsx("span", { className: styles$b['zds-list-item__radio'], "aria-hidden": "true", children: jsxRuntime.jsx(Radio, { name: name, onValueChange: () => handleRadioClick({}), items: [{
|
|
3242
3250
|
value: value || '',
|
|
3243
3251
|
label: '',
|
|
3244
3252
|
disabled: disabled
|
|
3245
|
-
}], "aria-labelledby": `${itemId}-text` }) }) }), jsxRuntime.jsxs("div", { className: styles$
|
|
3253
|
+
}], "aria-labelledby": `${itemId}-text` }) }) }), jsxRuntime.jsxs("div", { className: styles$b['zds-list-item__wrapper-text'], children: [jsxRuntime.jsx("span", { id: `${itemId}-text`, className: styles$b['zds-list-item__title'], onClick: handleRadioClick, children: text }), showSubText && subText && (jsxRuntime.jsx("span", { id: `${itemId}-subtext`, className: styles$b['zds-list-item__subtext'], children: subText }))] })] }));
|
|
3246
3254
|
case 'icon':
|
|
3247
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: styles$
|
|
3255
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: styles$b['zds-list-item__wrapper-icon'], children: icon }), jsxRuntime.jsxs("div", { className: styles$b['zds-list-item__wrapper-text'], children: [jsxRuntime.jsx("span", { id: `${itemId}-text`, className: styles$b['zds-list-item__title'], onClick: handleTextOrIconClick, children: text }), showSubText && subText && (jsxRuntime.jsx("span", { id: `${itemId}-subtext`, className: styles$b['zds-list-item__subtext'], children: subText }))] })] }));
|
|
3248
3256
|
case 'text':
|
|
3249
3257
|
default:
|
|
3250
|
-
return (jsxRuntime.jsxs("div", { className: styles$
|
|
3258
|
+
return (jsxRuntime.jsxs("div", { className: styles$b['zds-list-item__wrapper-text'], children: [jsxRuntime.jsx("span", { id: `${itemId}-text`, className: styles$b['zds-list-item__title'], onClick: handleTextOrIconClick, children: text }), showSubText && subText && (jsxRuntime.jsx("span", { id: `${itemId}-subtext`, className: styles$b['zds-list-item__subtext'], children: subText }))] }));
|
|
3251
3259
|
}
|
|
3252
3260
|
}, [variant, itemId, internalChecked, disabled, handleCheckboxClick, handleRadioClick, handleTextOrIconClick, value, text, showSubText, subText, icon, name]);
|
|
3253
|
-
const listItemClass = clsx(styles$
|
|
3254
|
-
[styles$
|
|
3255
|
-
[styles$
|
|
3256
|
-
[styles$
|
|
3261
|
+
const listItemClass = clsx(styles$b['zds-list-item__container'], {
|
|
3262
|
+
[styles$b[`zds-list-item--${variant}`]]: variant,
|
|
3263
|
+
[styles$b['zds-list-item--disabled']]: disabled,
|
|
3264
|
+
[styles$b['zds-list-item--hovered']]: hovered,
|
|
3257
3265
|
[className || '']: className
|
|
3258
3266
|
});
|
|
3259
3267
|
const getAriaChecked = React.useCallback(() => {
|
|
@@ -3265,13 +3273,13 @@ const ListItem = ({ id, className, variant = 'text', text, name, subText, disabl
|
|
|
3265
3273
|
return (jsxRuntime.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() }));
|
|
3266
3274
|
};
|
|
3267
3275
|
|
|
3268
|
-
var styles$
|
|
3276
|
+
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"};
|
|
3269
3277
|
|
|
3270
3278
|
const MenuItem = React.memo(({ item, isSelected, onSelect }) => {
|
|
3271
3279
|
const handleSelect = () => {
|
|
3272
3280
|
onSelect(item);
|
|
3273
3281
|
};
|
|
3274
|
-
return (jsxRuntime.jsxs(radixUi.DropdownMenu.Item, { className: clsx(styles$
|
|
3282
|
+
return (jsxRuntime.jsxs(radixUi.DropdownMenu.Item, { className: clsx(styles$9.item), "data-selected": isSelected || undefined, onSelect: handleSelect, disabled: item.disabled, children: [item.icon && jsxRuntime.jsx("span", { className: styles$9.itemIcon, children: item.icon }), jsxRuntime.jsxs("div", { className: styles$9.wrapperText, children: [jsxRuntime.jsx("span", { className: styles$9.itemText, children: item.text }), item.subText && (jsxRuntime.jsx("span", { className: styles$9.itemSubText, children: item.subText }))] })] }));
|
|
3275
3283
|
});
|
|
3276
3284
|
MenuItem.displayName = 'MenuItem';
|
|
3277
3285
|
|
|
@@ -3493,7 +3501,7 @@ const Menu = ({ items, children, onItemSelect, search, enableInfiniteScroll, onS
|
|
|
3493
3501
|
const renderMenuItem = React.useCallback((item, key) => {
|
|
3494
3502
|
const hasChildren = item.children && item.children.length > 0;
|
|
3495
3503
|
if (hasChildren) {
|
|
3496
|
-
return (jsxRuntime.jsxs(radixUi.DropdownMenu.Sub, { children: [jsxRuntime.jsxs(radixUi.DropdownMenu.SubTrigger, { className: styles$
|
|
3504
|
+
return (jsxRuntime.jsxs(radixUi.DropdownMenu.Sub, { children: [jsxRuntime.jsxs(radixUi.DropdownMenu.SubTrigger, { className: styles$9.subTrigger, disabled: item.disabled, children: [item.icon && (jsxRuntime.jsx("span", { className: styles$9.itemIcon, children: item.icon })), jsxRuntime.jsxs("div", { className: styles$9.wrapperText, children: [jsxRuntime.jsx("span", { className: styles$9.itemText, children: item.text }), item.subText && (jsxRuntime.jsx("span", { className: styles$9.itemSubText, children: item.subText }))] }), jsxRuntime.jsx(reactIcons.ChevronRight16Filled, { className: styles$9.chevronIcon })] }), jsxRuntime.jsx(radixUi.DropdownMenu.Portal, { children: jsxRuntime.jsx(radixUi.DropdownMenu.SubContent, { className: styles$9.subContent, sideOffset: 16, collisionPadding: 20, children: item.children.map((childItem, childIndex) => renderMenuItem(childItem, `${key}-${childIndex}`)) }) })] }, key));
|
|
3497
3505
|
}
|
|
3498
3506
|
return (jsxRuntime.jsx(MenuItem, { item: item, isSelected: isItemSelected(item), onSelect: handleItemSelect }, key));
|
|
3499
3507
|
}, [handleItemSelect, isItemSelected]);
|
|
@@ -3504,7 +3512,7 @@ const Menu = ({ items, children, onItemSelect, search, enableInfiniteScroll, onS
|
|
|
3504
3512
|
hasReachedEndRef.current = false;
|
|
3505
3513
|
}
|
|
3506
3514
|
};
|
|
3507
|
-
return (jsxRuntime.jsxs(radixUi.DropdownMenu.Root, { open: open, onOpenChange: handleOpenChange, children: [jsxRuntime.jsx(radixUi.DropdownMenu.Trigger, { asChild: true, children: children }), jsxRuntime.jsx(radixUi.DropdownMenu.Portal, { children: jsxRuntime.jsxs(radixUi.DropdownMenu.Content, { className: clsx(styles$
|
|
3515
|
+
return (jsxRuntime.jsxs(radixUi.DropdownMenu.Root, { open: open, onOpenChange: handleOpenChange, children: [jsxRuntime.jsx(radixUi.DropdownMenu.Trigger, { asChild: true, children: children }), jsxRuntime.jsx(radixUi.DropdownMenu.Portal, { children: jsxRuntime.jsxs(radixUi.DropdownMenu.Content, { className: clsx(styles$9.content, className), sideOffset: 8, align: align, onPointerDown: () => { closedByPointerRef.current = true; }, onInteractOutside: () => { closedByPointerRef.current = true; }, onCloseAutoFocus: (e) => {
|
|
3508
3516
|
if (closedByPointerRef.current) {
|
|
3509
3517
|
e.preventDefault();
|
|
3510
3518
|
closedByPointerRef.current = false;
|
|
@@ -3513,23 +3521,28 @@ const Menu = ({ items, children, onItemSelect, search, enableInfiniteScroll, onS
|
|
|
3513
3521
|
if (search) {
|
|
3514
3522
|
e.stopPropagation();
|
|
3515
3523
|
}
|
|
3516
|
-
}, ...rest, children: [search && (jsxRuntime.jsx("div", { className: styles$
|
|
3524
|
+
}, ...rest, children: [search && (jsxRuntime.jsx("div", { className: styles$9.searchWrapper, children: jsxRuntime.jsx(Search, { placeholder: "Buscar", onChange: handleSearchChange, value: searchInput, onKeyDown: handleSearchKeyDown }) })), jsxRuntime.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}`))) : (jsxRuntime.jsx("div", { className: styles$9.emptyState, children: "Nenhum item encontrado" })), enableInfiniteScroll && isLoadingMore && (jsxRuntime.jsx("div", { className: styles$9.loadingMore, children: "Carregando mais itens..." })), enableInfiniteScroll && (jsxRuntime.jsx("div", { ref: sentinelRef, "data-scroll-sentinel": true, style: { height: '1px', visibility: 'hidden' } }))] })] }) })] }));
|
|
3517
3525
|
};
|
|
3518
3526
|
|
|
3519
|
-
var styles$
|
|
3527
|
+
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"};
|
|
3520
3528
|
|
|
3521
|
-
const Modal = ({ isOpen = false, onClose, title, children, headerContent, closeOnOverlayClick = true, className, id, footer, customWidth, fullscreen = false, }) => {
|
|
3529
|
+
const Modal = ({ isOpen = false, onClose, title, children, headerContent, closeOnOverlayClick = true, className, id, footer, customWidth, fullscreen = false, ...rest }) => {
|
|
3530
|
+
const contentRef = React__namespace.useRef(null);
|
|
3522
3531
|
const handleOpenChange = (open) => {
|
|
3523
3532
|
if (!open) {
|
|
3524
3533
|
onClose();
|
|
3525
3534
|
}
|
|
3526
3535
|
};
|
|
3527
|
-
|
|
3536
|
+
const handleOpenAutoFocus = (e) => {
|
|
3537
|
+
e.preventDefault();
|
|
3538
|
+
contentRef.current?.focus();
|
|
3539
|
+
};
|
|
3540
|
+
return (jsxRuntime.jsx(radixUi.Dialog.Root, { open: isOpen, onOpenChange: handleOpenChange, ...rest, children: jsxRuntime.jsxs(radixUi.Dialog.Portal, { children: [jsxRuntime.jsx(radixUi.Dialog.Overlay, { className: styles$8.modalOverlay }), jsxRuntime.jsxs(radixUi.Dialog.Content, { ref: contentRef, className: clsx(styles$8.modalContent, fullscreen && styles$8['modalContent--fullscreen'], className), id: id, style: {
|
|
3528
3541
|
'--modal-custom-width': customWidth,
|
|
3529
|
-
}, onInteractOutside: !closeOnOverlayClick ? (e) => e.preventDefault() : undefined, "aria-labelledby": id ? `${id}-title` : 'modal-title', children: [jsxRuntime.jsxs("div", { className: styles$
|
|
3542
|
+
}, onInteractOutside: !closeOnOverlayClick ? (e) => e.preventDefault() : undefined, onOpenAutoFocus: handleOpenAutoFocus, "aria-labelledby": id ? `${id}-title` : 'modal-title', tabIndex: -1, children: [jsxRuntime.jsxs("div", { className: styles$8.modalHeader, children: [title && (jsxRuntime.jsx(radixUi.Dialog.Title, { className: styles$8.modalTitle, id: id ? `${id}-title` : 'modal-title', children: title })), headerContent && (jsxRuntime.jsx("div", { children: headerContent })), jsxRuntime.jsx(radixUi.Dialog.Close, { asChild: true, children: jsxRuntime.jsx(Button, { variant: "outlined", iconOnly: true, icon: jsxRuntime.jsx(reactIcons.Dismiss16Regular, {}), size: "lg", tooltipText: 'Fechar' }) })] }), jsxRuntime.jsx("div", { className: styles$8.modalBody, children: children }), footer && (jsxRuntime.jsx("div", { className: styles$8.modalFooter, children: footer }))] })] }) }));
|
|
3530
3543
|
};
|
|
3531
3544
|
|
|
3532
|
-
var styles$
|
|
3545
|
+
var styles$7 = {"quantity":"Quantity-module__quantity___-vndR","quantityInput":"Quantity-module__quantityInput___xZG-v","disabled":"Quantity-module__disabled___X6p5l"};
|
|
3533
3546
|
|
|
3534
3547
|
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 }) => {
|
|
3535
3548
|
const initialValue = Math.min(Math.max(value, minValue), maxValue);
|
|
@@ -3710,12 +3723,12 @@ const Quantity = ({ value = 0, onChange, disabled = false, decimal = false, deci
|
|
|
3710
3723
|
const inputSizeValue = inputSize !== undefined ? inputSize : Math.max(1, inputValue.length);
|
|
3711
3724
|
const uniqueId = React.useId();
|
|
3712
3725
|
const inputId = id || uniqueId;
|
|
3713
|
-
return (jsxRuntime.jsxs("div", { className: clsx(styles$
|
|
3726
|
+
return (jsxRuntime.jsxs("div", { className: clsx(styles$7.quantity, { [styles$7.disabled]: disabled }, className), ...rest, children: [jsxRuntime.jsx(Button, { variant: 'outlined', size: size, type: 'button', iconOnly: true, icon: jsxRuntime.jsx(reactIcons.Subtract16Regular, {}), onClick: decrement, disabled: disabled || isMinValue, "aria-label": decrementAriaLabel, tooltipText: 'Diminuir' }), jsxRuntime.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 }), jsxRuntime.jsx(Button, { variant: 'outlined', size: size, type: 'button', iconOnly: true, onClick: increment, disabled: disabled || isMaxValue, "aria-label": incrementAriaLabel, icon: jsxRuntime.jsx(reactIcons.Add16Regular, {}), tooltipText: 'Aumentar' })] }));
|
|
3714
3727
|
};
|
|
3715
3728
|
const memorizedQuantity = React.memo(Quantity);
|
|
3716
3729
|
memorizedQuantity.displayName = 'Quantity';
|
|
3717
3730
|
|
|
3718
|
-
var styles$
|
|
3731
|
+
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-"};
|
|
3719
3732
|
|
|
3720
3733
|
const CheckboxSelectItem = ({ text, subTitle, disabled, checked, onCheckedChange, value, ...restProps }) => {
|
|
3721
3734
|
const itemRef = React.useRef(null);
|
|
@@ -3759,9 +3772,9 @@ const CheckboxSelectItem = ({ text, subTitle, disabled, checked, onCheckedChange
|
|
|
3759
3772
|
onCheckedChange(!checked);
|
|
3760
3773
|
}
|
|
3761
3774
|
};
|
|
3762
|
-
return (jsxRuntime.jsx("div", { ref: itemRef, className: clsx(styles$
|
|
3763
|
-
[styles$
|
|
3764
|
-
}), 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: jsxRuntime.jsx("div", { className: styles$
|
|
3775
|
+
return (jsxRuntime.jsx("div", { ref: itemRef, className: clsx(styles$6.checkboxItem, {
|
|
3776
|
+
[styles$6.disabled]: disabled,
|
|
3777
|
+
}), 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: jsxRuntime.jsx("div", { className: styles$6.checkboxContent, children: jsxRuntime.jsx(Checkbox, { checked: checked, onCheckedChange: handleCheckboxChange, disabled: disabled, label: jsxRuntime.jsxs("div", { className: styles$6.textContent, children: [jsxRuntime.jsx("span", { className: styles$6.title, children: text }), subTitle && jsxRuntime.jsx("div", { className: styles$6.subTitle, children: subTitle })] }) }) }) }));
|
|
3765
3778
|
};
|
|
3766
3779
|
CheckboxSelectItem.displayName = 'CheckboxSelectItem';
|
|
3767
3780
|
|
|
@@ -3779,23 +3792,23 @@ const ExpandableSelectItem = ({ item, variant, onSelect, selectedValues, level =
|
|
|
3779
3792
|
onSelect(item.value);
|
|
3780
3793
|
}
|
|
3781
3794
|
};
|
|
3782
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: styles$
|
|
3783
|
-
[styles$
|
|
3784
|
-
[styles$
|
|
3795
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: styles$6.expandableItemContainer, style: { paddingLeft: `${level * 16}px` }, children: jsxRuntime.jsxs("div", { className: clsx(styles$6.itemWrapper, {
|
|
3796
|
+
[styles$6.selected]: isSelected && !hasChildren,
|
|
3797
|
+
[styles$6.disabled]: item.disabled,
|
|
3785
3798
|
}), onClick: handleClick, onKeyDown: (e) => {
|
|
3786
3799
|
if (e.key === 'Enter' || e.key === ' ') {
|
|
3787
3800
|
e.preventDefault();
|
|
3788
3801
|
handleClick(e);
|
|
3789
3802
|
}
|
|
3790
|
-
}, 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 && (jsxRuntime.jsx("span", { className: styles$
|
|
3803
|
+
}, 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 && (jsxRuntime.jsx("span", { className: styles$6.icon, children: item.icon })), jsxRuntime.jsxs("div", { className: styles$6.textContent, children: [jsxRuntime.jsx("div", { className: styles$6.title, children: item.text }), item.subTitle && jsxRuntime.jsx("div", { className: styles$6.subTitle, children: item.subTitle })] }), hasChildren && (jsxRuntime.jsx("span", { className: styles$6.chevron, children: isExpanded ? jsxRuntime.jsx(reactIcons.ChevronDown16Regular, {}) : jsxRuntime.jsx(reactIcons.ChevronRight16Regular, {}) }))] }) }), hasChildren && isExpanded && (jsxRuntime.jsx("div", { className: styles$6.childrenWrapper, children: item.children.map((child) => (jsxRuntime.jsx(ExpandableSelectItem, { item: child, variant: variant, onSelect: onSelect, selectedValues: selectedValues, level: level + 1 }, child.id || child.value))) }))] }));
|
|
3791
3804
|
};
|
|
3792
3805
|
|
|
3793
3806
|
const SelectItem = React.forwardRef(({ text, subTitle, icon, disabled, value, variant, disableFocusOnHover, ...restProps }, ref) => {
|
|
3794
|
-
return (jsxRuntime.jsxs("div", { className: clsx(styles$
|
|
3795
|
-
[styles$
|
|
3796
|
-
}), "data-disabled": disabled || undefined, "data-testid": `select-item-${value}`, ref: ref, children: [variant === 'icon' && icon && (jsxRuntime.jsx("span", { className: styles$
|
|
3797
|
-
[styles$
|
|
3798
|
-
}), value: value, disabled: disabled, onPointerMove: disableFocusOnHover ? (e) => e.preventDefault() : undefined, ...restProps, children: [jsxRuntime.jsx(radixUi.Select.ItemText, { className: styles$
|
|
3807
|
+
return (jsxRuntime.jsxs("div", { className: clsx(styles$6.itemWrapper, {
|
|
3808
|
+
[styles$6.disabled]: disabled,
|
|
3809
|
+
}), "data-disabled": disabled || undefined, "data-testid": `select-item-${value}`, ref: ref, children: [variant === 'icon' && icon && (jsxRuntime.jsx("span", { className: styles$6.icon, children: icon })), jsxRuntime.jsxs(radixUi.Select.Item, { className: clsx(styles$6.item, {
|
|
3810
|
+
[styles$6.disabled]: disabled,
|
|
3811
|
+
}), value: value, disabled: disabled, onPointerMove: disableFocusOnHover ? (e) => e.preventDefault() : undefined, ...restProps, children: [jsxRuntime.jsx(radixUi.Select.ItemText, { className: styles$6.title, children: text }), subTitle && jsxRuntime.jsx("div", { className: styles$6.subTitle, children: subTitle }), jsxRuntime.jsx(radixUi.Select.ItemIndicator, { className: styles$6.itemIndicator })] })] }));
|
|
3799
3812
|
});
|
|
3800
3813
|
SelectItem.displayName = 'SelectItem';
|
|
3801
3814
|
|
|
@@ -4024,7 +4037,7 @@ function useSelectLogic({ value, required = false, search = false, onValueChange
|
|
|
4024
4037
|
};
|
|
4025
4038
|
}
|
|
4026
4039
|
|
|
4027
|
-
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, ...
|
|
4040
|
+
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 }) => {
|
|
4028
4041
|
const componentId = React.useId();
|
|
4029
4042
|
const selectId = `select-${componentId}`;
|
|
4030
4043
|
const viewportRef = React.useRef(null);
|
|
@@ -4104,14 +4117,14 @@ const Select = ({ items, onValueChange, onOpenChange, variant, required = false,
|
|
|
4104
4117
|
onApiSearch('');
|
|
4105
4118
|
}
|
|
4106
4119
|
};
|
|
4107
|
-
return (jsxRuntime.jsx(radixUi.Select.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, ...
|
|
4108
|
-
[styles$
|
|
4109
|
-
[styles$
|
|
4110
|
-
[styles$
|
|
4111
|
-
[styles$
|
|
4112
|
-
}), id: selectId, "aria-label": ariaLabel, "data-testid": `${testId}-trigger`, children: [variant === 'checkbox' ? (jsxRuntime.jsx("span", { className: styles$
|
|
4113
|
-
[styles$
|
|
4114
|
-
}), children: helperText })), state.hasError && state.touched && (jsxRuntime.jsx("span", { className: styles$
|
|
4120
|
+
return (jsxRuntime.jsx(radixUi.Select.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: jsxRuntime.jsxs("div", { className: clsx(styles$6.container, className), style: containerStyle, "data-testid": testId, children: [jsxRuntime.jsx("div", { className: styles$6.fieldContainer, children: jsxRuntime.jsxs("div", { className: styles$6.containerLabel, children: [jsxRuntime.jsx(LabelComponent, { htmlFor: selectId, required: required, tooltipText: tooltipText, tooltip: tooltip, side: side, align: align, error: state.hasError && state.touched, disabled: disabled, children: label }), jsxRuntime.jsxs(radixUi.Select.Trigger, { className: clsx(styles$6.trigger, {
|
|
4121
|
+
[styles$6.error]: state.hasError && state.touched,
|
|
4122
|
+
[styles$6.disabled]: disabled,
|
|
4123
|
+
[styles$6.hasValue]: state.selectedValues.length > 0,
|
|
4124
|
+
[styles$6.open]: state.isOpen,
|
|
4125
|
+
}), id: selectId, "aria-label": ariaLabel, "data-testid": `${testId}-trigger`, children: [variant === 'checkbox' ? (jsxRuntime.jsx("span", { className: styles$6.triggerText, children: displayText })) : (jsxRuntime.jsx(radixUi.Select.Value, { placeholder: placeholder, className: styles$6.placeholder, children: displayText })), state.isOpen ? jsxRuntime.jsx(reactIcons.ChevronUp16Regular, {}) : jsxRuntime.jsx(reactIcons.ChevronDown16Regular, {})] }), !state.isOpen && helperText && !state.hasError && (jsxRuntime.jsx("span", { className: clsx(styles$6.helper, {
|
|
4126
|
+
[styles$6.disabled]: disabled
|
|
4127
|
+
}), children: helperText })), state.hasError && state.touched && (jsxRuntime.jsx("span", { className: styles$6.errorMessage, children: errorMessage || 'Campo obrigatório' }))] }) }), jsxRuntime.jsx(radixUi.Select.Portal, { children: jsxRuntime.jsxs(radixUi.Select.Content, { className: styles$6.content, position: "popper", side: "bottom", sideOffset: 8, align: "start", avoidCollisions: true, children: [search && (jsxRuntime.jsx("div", { className: styles$6.searchWrapper, children: jsxRuntime.jsx(Search, { ref: refs.searchInputRef, className: styles$6.search, placeholder: "Buscar", value: state.searchInput, onChange: handleSearchChange, onKeyDown: handleSearchKeyDown, onClear: handleClear, "data-testid": `${testId}-search` }) })), jsxRuntime.jsx(radixUi.Select.Viewport, { ref: viewportRef, className: styles$6.viewport, "data-testid": testId ? `${testId}-viewport` : undefined, children: jsxRuntime.jsx(radixUi.Select.Group, { className: styles$6.group, children: filteredItems.length === 0 ? (jsxRuntime.jsx("div", { className: styles$6.noResults, children: "Nenhum resultado encontrado" })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [filteredItems.map((item) => {
|
|
4115
4128
|
const hasChildren = item.children && item.children.length > 0;
|
|
4116
4129
|
if (hasChildren) {
|
|
4117
4130
|
return (jsxRuntime.jsx(ExpandableSelectItem, { item: item, variant: variant, selectedValues: state.selectedValues, onSelect: (value) => {
|
|
@@ -4125,11 +4138,11 @@ const Select = ({ items, onValueChange, onOpenChange, variant, required = false,
|
|
|
4125
4138
|
} }, item.id || item.value));
|
|
4126
4139
|
}
|
|
4127
4140
|
return variant === 'checkbox' ? (jsxRuntime.jsx(CheckboxSelectItem, { ...item, checked: state.selectedValues.includes(item.value), onCheckedChange: (checked) => actions.handleMultipleSelect(item.value, checked) }, item.id || item.value)) : (jsxRuntime.jsx(SelectItem, { ...item, variant: variant, disableFocusOnHover: search }, item.id || item.value));
|
|
4128
|
-
}), enableInfiniteScroll && isLoadingMore && (jsxRuntime.jsx("div", { className: styles$
|
|
4141
|
+
}), enableInfiniteScroll && isLoadingMore && (jsxRuntime.jsx("div", { className: styles$6.loadingMore, children: "Carregando mais itens..." }))] })) }) })] }) })] }) }));
|
|
4129
4142
|
};
|
|
4130
4143
|
Select.displayName = 'Select';
|
|
4131
4144
|
|
|
4132
|
-
var styles$
|
|
4145
|
+
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"};
|
|
4133
4146
|
|
|
4134
4147
|
/**
|
|
4135
4148
|
* Componente de ícone SVG para estado vazio da tabela
|
|
@@ -4309,13 +4322,13 @@ const Table = ({ columns, dataSource, className, loading = false, rowSelection,
|
|
|
4309
4322
|
}, [columns, rowSelection, isAllSelected, isIndeterminate, toggleAll, selectedSet, toggleRow, dataSource]);
|
|
4310
4323
|
const tableId = React.useMemo(() => `table-${Math.random().toString(36).substr(2, 9)}`, []);
|
|
4311
4324
|
if (loading) {
|
|
4312
|
-
return (jsxRuntime.jsx("div", { className: clsx(styles$
|
|
4325
|
+
return (jsxRuntime.jsx("div", { className: clsx(styles$5.tableContainer, className), children: jsxRuntime.jsx("div", { className: styles$5.tableLoader, children: jsxRuntime.jsx(LoaderList, {}) }) }));
|
|
4313
4326
|
}
|
|
4314
|
-
const emptyText = locale?.emptyText || (jsxRuntime.jsxs("div", { className: styles$
|
|
4315
|
-
return (jsxRuntime.jsx("div", { className: clsx(styles$
|
|
4327
|
+
const emptyText = locale?.emptyText || (jsxRuntime.jsxs("div", { className: styles$5.tableEmpty, children: [jsxRuntime.jsx("div", { className: styles$5.tableEmptyContent, children: jsxRuntime.jsx(EmptyRows150Color, {}) }), jsxRuntime.jsxs("div", { className: styles$5.tableEmptyText, children: [jsxRuntime.jsx("h3", { className: styles$5.tableEmptyTitle, children: "Nenhum dado encontrado" }), jsxRuntime.jsx("p", { className: styles$5.tableEmptyCaption, children: "Nenhum registro encontrado" })] })] }));
|
|
4328
|
+
return (jsxRuntime.jsx("div", { className: clsx(styles$5.tableContainer, className), ...rest, children: jsxRuntime.jsx("div", { className: styles$5.tableScrollWrapper, children: jsxRuntime.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: [jsxRuntime.jsx("thead", { className: styles$5.tableHead, children: jsxRuntime.jsx("tr", { children: finalColumns.map((column) => (jsxRuntime.jsx("th", { className: clsx(styles$5.tableTh, column.align && `text-${column.align}`), style: column.style, children: jsxRuntime.jsx("div", { className: styles$5.tableThContent, children: column.label }) }, column.key))) }) }), jsxRuntime.jsx("tbody", { className: styles$5.tableBody, children: dataSource.length > 0 ? (dataSource.map((row, index) => {
|
|
4316
4329
|
const rowProps = onRow?.(row, index) || {};
|
|
4317
|
-
return (jsxRuntime.jsx("tr", { className: clsx(styles$
|
|
4318
|
-
})) : (jsxRuntime.jsx("tr", { children: jsxRuntime.jsx("td", { colSpan: finalColumns.length, className: styles$
|
|
4330
|
+
return (jsxRuntime.jsx("tr", { className: clsx(styles$5.tableRow, rowProps.className), onClick: rowProps.onClick, onDoubleClick: rowProps.onDoubleClick, children: finalColumns.map((column) => (jsxRuntime.jsx("td", { className: clsx(styles$5.tableTd, column.align && `text-${column.align}`), children: renderCell(column, row, index) }, column.key))) }, index));
|
|
4331
|
+
})) : (jsxRuntime.jsx("tr", { children: jsxRuntime.jsx("td", { colSpan: finalColumns.length, className: styles$5.tableEmptyCell, children: emptyText }) })) })] }) }) }));
|
|
4319
4332
|
};
|
|
4320
4333
|
|
|
4321
4334
|
const isCalendarFilter = (filter) => {
|
|
@@ -4348,7 +4361,7 @@ const TableHeader = ({ searchValue = '', onSearchChange, onSearch, searchPlaceho
|
|
|
4348
4361
|
}
|
|
4349
4362
|
};
|
|
4350
4363
|
const hasFilters = filters || (filterItems && filterItems.length > 0);
|
|
4351
|
-
return (jsxRuntime.jsxs("div", { className: `${styles$
|
|
4364
|
+
return (jsxRuntime.jsxs("div", { className: `${styles$5.tableHeader} ${className}`.trim(), ...rest, children: [showSearch && (onSearchChange || onSearch) && (jsxRuntime.jsx("div", { className: styles$5.tableHeaderSearchContainer, children: jsxRuntime.jsx(Search, { value: internalSearchValue, onChange: handleInputChange, onKeyDown: handleKeyDown, placeholder: searchPlaceholder, className: styles$5.tableHeaderSearch }) })), showFilters && (jsxRuntime.jsx("div", { className: styles$5.tableHeaderFilters, children: hasFilters ? (jsxRuntime.jsxs("div", { className: styles$5.tableHeaderFiltersContent, children: [filters && (jsxRuntime.jsx("div", { className: styles$5.tableHeaderCustomFilters, children: filters })), jsxRuntime.jsxs("div", { className: styles$5.tableHeaderFiltersWrapper, children: [jsxRuntime.jsx("span", { className: styles$5.tableHeaderFilterLabel, children: "Filtros" }), jsxRuntime.jsx("div", { className: styles$5.tableHeaderFilterItems, children: filterItems && filterItems.map((filterItem, index) => {
|
|
4352
4365
|
const commonProps = {
|
|
4353
4366
|
buttonText: filterItem.buttonText,
|
|
4354
4367
|
icon: filterItem.icon,
|
|
@@ -4367,7 +4380,7 @@ const TableHeader = ({ searchValue = '', onSearchChange, onSearch, searchPlaceho
|
|
|
4367
4380
|
}
|
|
4368
4381
|
console.warn('TableHeader: Tipo de filtro não reconhecido:', filterItem);
|
|
4369
4382
|
return null;
|
|
4370
|
-
}) })] })] })) : (jsxRuntime.jsx("div", { className: styles$
|
|
4383
|
+
}) })] })] })) : (jsxRuntime.jsx("div", { className: styles$5.tableHeaderFiltersPlaceholder, children: jsxRuntime.jsx("span", { children: "Nenhum filtro dispon\u00EDvel" }) })) }))] }));
|
|
4371
4384
|
};
|
|
4372
4385
|
|
|
4373
4386
|
const TablePagination = ({ currentPage, totalItems, itemsPerPage, onPageChange, onItemsPerPageChange, pageSizeOptions = [10, 25, 50, 100], disabled = false, className, ...rest }) => {
|
|
@@ -4390,14 +4403,162 @@ const TablePagination = ({ currentPage, totalItems, itemsPerPage, onPageChange,
|
|
|
4390
4403
|
const newItemsPerPage = Number(event.target.value);
|
|
4391
4404
|
onItemsPerPageChange(newItemsPerPage);
|
|
4392
4405
|
};
|
|
4393
|
-
return (jsxRuntime.jsxs("div", { className: `${styles$
|
|
4406
|
+
return (jsxRuntime.jsxs("div", { className: `${styles$5.tablePagination} ${className}`.trim(), ...rest, children: [jsxRuntime.jsxs("div", { className: styles$5.tablePaginationSelect, children: [jsxRuntime.jsx("label", { htmlFor: "items-per-page", className: styles$5.tablePaginationLabel, children: "Itens por p\u00E1gina" }), jsxRuntime.jsx("select", { id: "items-per-page", value: itemsPerPage, onChange: handleItemsPerPageChange, disabled: disabled, className: styles$5.tablePaginationSelectInput, children: pageSizeOptions.map((option) => (jsxRuntime.jsx("option", { value: option, children: option }, option))) })] }), jsxRuntime.jsx("div", { className: styles$5.tablePaginationInfo, children: jsxRuntime.jsx("span", { children: totalItems > 0
|
|
4394
4407
|
? `${startItem}–${endItem} de ${totalItems}`
|
|
4395
|
-
: '0 itens' }) }), jsxRuntime.jsxs("div", { className: styles$
|
|
4408
|
+
: '0 itens' }) }), jsxRuntime.jsxs("div", { className: styles$5.tablePaginationControls, children: [jsxRuntime.jsx("button", { className: styles$5.tablePaginationButton, onClick: handlePrevious, disabled: !canGoPrev, "aria-label": "P\u00E1gina anterior", children: jsxRuntime.jsx(reactIcons.ChevronLeft16Regular, {}) }), jsxRuntime.jsx("button", { className: styles$5.tablePaginationButton, onClick: handleNext, disabled: !canGoNext, "aria-label": "Pr\u00F3xima p\u00E1gina", children: jsxRuntime.jsx(reactIcons.ChevronRight16Regular, {}) })] })] }));
|
|
4409
|
+
};
|
|
4410
|
+
|
|
4411
|
+
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"};
|
|
4412
|
+
|
|
4413
|
+
const EmptyState = ({ emptyIcon, emptyTitle, emptyText }) => (jsxRuntime.jsxs("div", { className: styles$4.tableEmpty, children: [jsxRuntime.jsx("div", { className: styles$4.tableEmptyContent, children: emptyIcon ?? jsxRuntime.jsx(reactIcons.SearchInfo20Regular, {}) }), jsxRuntime.jsxs("div", { className: styles$4.tableEmptyText, children: [jsxRuntime.jsx("h3", { className: styles$4.tableEmptyTitle, children: emptyTitle ?? 'Nenhum dado encontrado' }), jsxRuntime.jsx("p", { className: styles$4.tableEmptyCaption, children: emptyText ?? 'Nenhum registro encontrado' })] })] }));
|
|
4414
|
+
|
|
4415
|
+
const TableV2 = ({ columns, data, enableFilters = false, enableRowSelection = false, enableSorting = true, onRowSelectionChange, bulkActions, header, footer, loading = false, emptyIcon, emptyTitle, emptyText, onRow, className, }) => {
|
|
4416
|
+
const [columnFilters, setColumnFilters] = React.useState([]);
|
|
4417
|
+
const [globalFilter, setGlobalFilter] = React.useState('');
|
|
4418
|
+
const [rowSelection, setRowSelection] = React.useState({});
|
|
4419
|
+
const rowSelectionRef = React.useRef({});
|
|
4420
|
+
rowSelectionRef.current = rowSelection;
|
|
4421
|
+
const lastEmittedSelectionKey = React.useRef('{}');
|
|
4422
|
+
const [sorting, setSorting] = React.useState([]);
|
|
4423
|
+
const [pagination, setPagination] = React.useState({
|
|
4424
|
+
pageIndex: 0,
|
|
4425
|
+
pageSize: footer?.defaultPageSize ?? 10,
|
|
4426
|
+
});
|
|
4427
|
+
const { pageIndex, pageSize } = pagination;
|
|
4428
|
+
const selectionColumn = React.useMemo(() => ({
|
|
4429
|
+
id: '__select__',
|
|
4430
|
+
size: 48,
|
|
4431
|
+
enableSorting: false,
|
|
4432
|
+
enableColumnFilter: false,
|
|
4433
|
+
header: ({ table: t }) => (jsxRuntime.jsx("div", { className: styles$4.checkboxCell, children: jsxRuntime.jsx(Checkbox, { checked: t.getIsAllPageRowsSelected(), indeterminate: t.getIsSomePageRowsSelected(), onCheckedChange: (checked) => t.toggleAllPageRowsSelected(checked) }) })),
|
|
4434
|
+
cell: ({ row }) => (jsxRuntime.jsx("div", { className: styles$4.checkboxCell, children: jsxRuntime.jsx(Checkbox, { checked: row.getIsSelected(), onCheckedChange: (checked) => row.toggleSelected(checked) }) })),
|
|
4435
|
+
}), []);
|
|
4436
|
+
const resolvedColumns = React.useMemo(() => (enableRowSelection ? [selectionColumn, ...columns] : columns), [enableRowSelection, selectionColumn, columns]);
|
|
4437
|
+
const showSearch = !!(header && (header.showSearch ?? true));
|
|
4438
|
+
const table = reactTable.useReactTable({
|
|
4439
|
+
data,
|
|
4440
|
+
columns: resolvedColumns,
|
|
4441
|
+
defaultColumn: { minSize: 44, size: 0 },
|
|
4442
|
+
state: {
|
|
4443
|
+
...(enableFilters ? { columnFilters } : {}),
|
|
4444
|
+
...(showSearch ? { globalFilter } : {}),
|
|
4445
|
+
...(footer ? { pagination: { pageIndex, pageSize } } : {}),
|
|
4446
|
+
...(enableRowSelection ? { rowSelection } : {}),
|
|
4447
|
+
...(enableSorting ? { sorting } : {}),
|
|
4448
|
+
},
|
|
4449
|
+
onColumnFiltersChange: enableFilters ? setColumnFilters : undefined,
|
|
4450
|
+
onGlobalFilterChange: showSearch ? setGlobalFilter : undefined,
|
|
4451
|
+
onSortingChange: enableSorting ? setSorting : undefined,
|
|
4452
|
+
enableSorting,
|
|
4453
|
+
onRowSelectionChange: enableRowSelection
|
|
4454
|
+
? (updater) => {
|
|
4455
|
+
const prev = rowSelectionRef.current;
|
|
4456
|
+
const next = typeof updater === 'function' ? updater(prev) : updater;
|
|
4457
|
+
const selectionKey = JSON.stringify(next, Object.keys(next).sort());
|
|
4458
|
+
if (selectionKey === lastEmittedSelectionKey.current)
|
|
4459
|
+
return;
|
|
4460
|
+
lastEmittedSelectionKey.current = selectionKey;
|
|
4461
|
+
rowSelectionRef.current = next;
|
|
4462
|
+
setRowSelection(next);
|
|
4463
|
+
if (onRowSelectionChange) {
|
|
4464
|
+
const selectedRows = table
|
|
4465
|
+
.getCoreRowModel()
|
|
4466
|
+
.rows.filter((r) => next[r.id])
|
|
4467
|
+
.map((r) => r.original);
|
|
4468
|
+
onRowSelectionChange(selectedRows);
|
|
4469
|
+
}
|
|
4470
|
+
}
|
|
4471
|
+
: undefined,
|
|
4472
|
+
enableRowSelection,
|
|
4473
|
+
onPaginationChange: footer ? setPagination : undefined,
|
|
4474
|
+
getCoreRowModel: reactTable.getCoreRowModel(),
|
|
4475
|
+
getFilteredRowModel: enableFilters || showSearch ? reactTable.getFilteredRowModel() : undefined,
|
|
4476
|
+
getPaginationRowModel: footer ? reactTable.getPaginationRowModel() : undefined,
|
|
4477
|
+
getSortedRowModel: enableSorting ? reactTable.getSortedRowModel() : undefined,
|
|
4478
|
+
});
|
|
4479
|
+
const filteredRowCount = table.getFilteredRowModel().rows.length;
|
|
4480
|
+
const effectiveTotalItems = footer
|
|
4481
|
+
? (enableFilters || showSearch) ? filteredRowCount : footer.totalItems
|
|
4482
|
+
: 0;
|
|
4483
|
+
const totalPages = footer ? Math.ceil(effectiveTotalItems / pageSize) : 0;
|
|
4484
|
+
const canGoPrev = pageIndex > 0;
|
|
4485
|
+
const canGoNext = pageIndex + 1 < totalPages;
|
|
4486
|
+
const skeletonRowCount = footer ? pageSize : (data.length > 0 ? data.length : pageSize);
|
|
4487
|
+
const selectedRows = React.useMemo(() => table
|
|
4488
|
+
.getCoreRowModel()
|
|
4489
|
+
.rows.filter((r) => rowSelection[r.id])
|
|
4490
|
+
.map((r) => r.original), [rowSelection, table]);
|
|
4491
|
+
const selectedCount = selectedRows.length;
|
|
4492
|
+
const showBulkActions = enableRowSelection && !!bulkActions && selectedCount > 0;
|
|
4493
|
+
React.useEffect(() => {
|
|
4494
|
+
if (enableRowSelection) {
|
|
4495
|
+
table.resetRowSelection();
|
|
4496
|
+
}
|
|
4497
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4498
|
+
}, [pageIndex]);
|
|
4499
|
+
const handleClearSelection = () => {
|
|
4500
|
+
table.resetRowSelection();
|
|
4501
|
+
bulkActions?.onClear?.();
|
|
4502
|
+
};
|
|
4503
|
+
const handlePageSizeChange = (e) => {
|
|
4504
|
+
const size = Number(e.target.value);
|
|
4505
|
+
setPagination({ pageIndex: 0, pageSize: size });
|
|
4506
|
+
footer?.onPageSizeChange?.(size);
|
|
4507
|
+
};
|
|
4508
|
+
return (jsxRuntime.jsxs("div", { className: clsx(styles$4.wrapper, className), children: [showBulkActions && (jsxRuntime.jsxs("div", { className: styles$4.bulkActionsBar, children: [jsxRuntime.jsxs("div", { className: styles$4.bulkActionsInfo, children: [jsxRuntime.jsx(Button, { variant: "text", iconOnly: true, icon: jsxRuntime.jsx(reactIcons.Dismiss16Regular, {}), ariaLabel: "Limpar sele\u00E7\u00E3o", onClick: handleClearSelection, className: styles$4.bulkActionsClearButton }), jsxRuntime.jsx("span", { className: styles$4.bulkActionsLabel, children: bulkActions.label
|
|
4509
|
+
? bulkActions.label(selectedCount, selectedRows)
|
|
4510
|
+
: `${selectedCount} ${selectedCount === 1 ? 'item selecionado' : 'itens selecionados'}` })] }), jsxRuntime.jsx("div", { className: styles$4.bulkActionsButtons, children: bulkActions.actions.map((action, index) => (jsxRuntime.jsx(Button, { variant: action.variant ?? 'outlined', type: "button", disabled: action.disabled, onClick: action.onClick, size: "sm", children: action.label }, index))) })] })), header && (jsxRuntime.jsxs("div", { className: styles$4.tableHeader, children: [showSearch && (jsxRuntime.jsx("div", { className: styles$4.tableHeaderSearchContainer, children: jsxRuntime.jsx(Search, { value: globalFilter, onChange: (e) => {
|
|
4511
|
+
setGlobalFilter(e.target.value);
|
|
4512
|
+
if (footer)
|
|
4513
|
+
setPagination((prev) => ({ ...prev, pageIndex: 0 }));
|
|
4514
|
+
}, placeholder: header.searchPlaceholder ?? 'Pesquisar...', className: styles$4.tableHeaderSearch }) })), !!header.filterItems?.length && (jsxRuntime.jsxs("div", { className: styles$4.tableHeaderFilters, children: [jsxRuntime.jsx("span", { className: styles$4.tableHeaderFilterLabel, children: "Filtros" }), jsxRuntime.jsx("div", { className: styles$4.tableHeaderFilterItems, children: header.filterItems.map((filterItem, index) => {
|
|
4515
|
+
const commonProps = {
|
|
4516
|
+
buttonText: filterItem.buttonText,
|
|
4517
|
+
icon: filterItem.icon,
|
|
4518
|
+
side: filterItem.side,
|
|
4519
|
+
align: filterItem.align,
|
|
4520
|
+
disabled: filterItem.disabled,
|
|
4521
|
+
variant: 'outlined',
|
|
4522
|
+
onOpen: () => filterItem.onToggle?.(true),
|
|
4523
|
+
onClose: () => filterItem.onToggle?.(false),
|
|
4524
|
+
};
|
|
4525
|
+
if (filterItem.type === 'calendar') {
|
|
4526
|
+
return (jsxRuntime.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));
|
|
4527
|
+
}
|
|
4528
|
+
return (jsxRuntime.jsx(Filter, { ...commonProps, type: filterItem.type, items: filterItem.items, selectedIds: filterItem.selectedIds, onApplyFilter: filterItem.onSelectionChange, placeholder: filterItem.placeholder, enableSearch: filterItem.enableSearch }, filterItem.id ?? index));
|
|
4529
|
+
}) })] }))] })), jsxRuntime.jsx("div", { className: styles$4.tableContainer, children: jsxRuntime.jsx("div", { className: styles$4.tableScrollWrapper, children: jsxRuntime.jsxs("table", { className: styles$4.table, "aria-label": "Tabela de dados", "aria-rowcount": filteredRowCount + 1, children: [jsxRuntime.jsx("thead", { className: styles$4.tableHead, children: table.getHeaderGroups().map((headerGroup) => (jsxRuntime.jsx("tr", { children: headerGroup.headers.map((col) => (jsxRuntime.jsxs("th", { className: styles$4.tableTh, style: {
|
|
4530
|
+
textAlign: col.column.columnDef.meta?.align,
|
|
4531
|
+
width: col.column.columnDef.size || undefined,
|
|
4532
|
+
minWidth: col.column.columnDef.minSize,
|
|
4533
|
+
maxWidth: col.column.columnDef.maxSize !== Number.MAX_SAFE_INTEGER
|
|
4534
|
+
? col.column.columnDef.maxSize
|
|
4535
|
+
: undefined,
|
|
4536
|
+
}, children: [jsxRuntime.jsx("div", { className: styles$4.tableThContent, children: col.isPlaceholder ? null : col.column.getCanSort() ? (jsxRuntime.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: [reactTable.flexRender(col.column.columnDef.header, col.getContext()), col.column.getIsSorted() === 'asc' ? (jsxRuntime.jsx(reactIcons.ArrowSortUp16Regular, { className: styles$4.tableSortIcon })) : col.column.getIsSorted() === 'desc' ? (jsxRuntime.jsx(reactIcons.ArrowSortDown16Regular, { className: styles$4.tableSortIcon })) : (jsxRuntime.jsx(reactIcons.ArrowSort16Regular, { className: clsx(styles$4.tableSortIcon, styles$4.tableSortIconNeutral) }))] })) : (reactTable.flexRender(col.column.columnDef.header, col.getContext())) }), enableFilters && col.column.getCanFilter() && (jsxRuntime.jsx("input", { value: col.column.getFilterValue() ?? '', onChange: (e) => col.column.setFilterValue(e.target.value), placeholder: "Filtrar..." }))] }, col.id))) }, headerGroup.id))) }), jsxRuntime.jsx("tbody", { className: styles$4.tableBody, children: loading ? (Array.from({ length: skeletonRowCount }).map((_, rowIdx) => (jsxRuntime.jsx("tr", { className: styles$4.tableRow, children: table.getVisibleLeafColumns().map((col) => (jsxRuntime.jsx("td", { className: styles$4.tableTd, children: jsxRuntime.jsx(Skeleton, {}) }, col.id))) }, `skeleton-row-${rowIdx}`)))) : table.getRowModel().rows.length > 0 ? (table.getRowModel().rows.map((row, index) => {
|
|
4537
|
+
const rowProps = onRow?.(row.original, index) ?? {};
|
|
4538
|
+
return (jsxRuntime.jsx("tr", { className: clsx(styles$4.tableRow, rowProps.className), onClick: rowProps.onClick, onDoubleClick: rowProps.onDoubleClick, children: row.getVisibleCells().map((cell) => (jsxRuntime.jsx("td", { className: styles$4.tableTd, style: {
|
|
4539
|
+
textAlign: cell.column.columnDef.meta?.align,
|
|
4540
|
+
width: cell.column.columnDef.size || undefined,
|
|
4541
|
+
minWidth: cell.column.columnDef.minSize,
|
|
4542
|
+
maxWidth: cell.column.columnDef.maxSize !== Number.MAX_SAFE_INTEGER
|
|
4543
|
+
? cell.column.columnDef.maxSize
|
|
4544
|
+
: undefined,
|
|
4545
|
+
}, children: cell.column.columnDef.meta?.maxHeight ? (jsxRuntime.jsx("div", { className: styles$4.tableCellMaxHeight, style: { maxHeight: cell.column.columnDef.meta.maxHeight }, children: reactTable.flexRender(cell.column.columnDef.cell, cell.getContext()) })) : (reactTable.flexRender(cell.column.columnDef.cell, cell.getContext())) }, cell.id))) }, row.id));
|
|
4546
|
+
})) : (jsxRuntime.jsx("tr", { children: jsxRuntime.jsx("td", { colSpan: table.getVisibleLeafColumns().length, className: styles$4.tableEmptyCell, children: jsxRuntime.jsx(EmptyState, { emptyIcon: emptyIcon, emptyTitle: emptyTitle, emptyText: emptyText }) }) })) })] }) }) }), footer && (jsxRuntime.jsxs("div", { className: styles$4.tablePagination, children: [jsxRuntime.jsxs("div", { className: styles$4.tablePaginationSelect, children: [jsxRuntime.jsx("label", { htmlFor: "tablev2-page-size", className: styles$4.tablePaginationLabel, children: "Itens por p\u00E1gina" }), jsxRuntime.jsx("select", { id: "tablev2-page-size", value: pageSize, onChange: handlePageSizeChange, className: styles$4.tablePaginationSelectInput, children: (footer.pageSizeOptions ?? [10, 25, 50, 100]).map((opt) => (jsxRuntime.jsx("option", { value: opt, children: opt }, opt))) })] }), jsxRuntime.jsx("div", { className: styles$4.tablePaginationInfo, children: jsxRuntime.jsx("span", { children: totalPages > 0
|
|
4547
|
+
? `${pageIndex + 1} de ${totalPages}`
|
|
4548
|
+
: '0 páginas' }) }), jsxRuntime.jsxs("div", { className: styles$4.tablePaginationControls, children: [jsxRuntime.jsx("button", { className: styles$4.tablePaginationButton, onClick: () => {
|
|
4549
|
+
const newPage = pageIndex - 1;
|
|
4550
|
+
setPagination((prev) => ({ ...prev, pageIndex: newPage }));
|
|
4551
|
+
footer?.onPageChange?.(newPage + 1);
|
|
4552
|
+
}, disabled: !canGoPrev, "aria-label": "P\u00E1gina anterior", children: jsxRuntime.jsx(reactIcons.ChevronLeft16Regular, {}) }), jsxRuntime.jsx("button", { className: styles$4.tablePaginationButton, onClick: () => {
|
|
4553
|
+
const newPage = pageIndex + 1;
|
|
4554
|
+
setPagination((prev) => ({ ...prev, pageIndex: newPage }));
|
|
4555
|
+
footer?.onPageChange?.(newPage + 1);
|
|
4556
|
+
}, disabled: !canGoNext, "aria-label": "Pr\u00F3xima p\u00E1gina", children: jsxRuntime.jsx(reactIcons.ChevronRight16Regular, {}) })] })] }))] }));
|
|
4396
4557
|
};
|
|
4397
4558
|
|
|
4398
4559
|
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"};
|
|
4399
4560
|
|
|
4400
|
-
const TextArea = React.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, ...
|
|
4561
|
+
const TextArea = React.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) => {
|
|
4401
4562
|
const normalizeValue = (val) => {
|
|
4402
4563
|
return val === undefined || val === null ? '' : String(val);
|
|
4403
4564
|
};
|
|
@@ -4435,7 +4596,7 @@ const TextArea = React.forwardRef(({ className, value, label, placeholder, onCha
|
|
|
4435
4596
|
? `${componentId}-helper`
|
|
4436
4597
|
: undefined;
|
|
4437
4598
|
const containerClass = clsx(styles$3.container, disabled && styles$3.disabled, hasError && !disabled && styles$3.error, className);
|
|
4438
|
-
return (jsxRuntime.jsxs("div", { className: containerClass, children: [label && (jsxRuntime.jsx(LabelComponent, { htmlFor: componentId, required: required, tooltip: tooltip, tooltipText: tooltipText, side: side, align: align, error: hasError, disabled: disabled, children: label })), jsxRuntime.jsxs("div", { className: styles$3.inputWrapper, children: [jsxRuntime.jsx("div", { className: styles$3.inputContainer, children: jsxRuntime.jsx("textarea", { ...
|
|
4599
|
+
return (jsxRuntime.jsxs("div", { className: containerClass, children: [label && (jsxRuntime.jsx(LabelComponent, { htmlFor: componentId, required: required, tooltip: tooltip, tooltipText: tooltipText, side: side, align: align, error: hasError, disabled: disabled, children: label })), jsxRuntime.jsxs("div", { className: styles$3.inputWrapper, children: [jsxRuntime.jsx("div", { className: styles$3.inputContainer, children: jsxRuntime.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 } }) }), jsxRuntime.jsxs("div", { className: styles$3.footer, children: [jsxRuntime.jsx("span", { id: helperId, className: styles$3.helperText, "aria-live": hasError ? 'polite' : undefined, children: displayHelperText }), showCharCount && maxLength && (jsxRuntime.jsxs("span", { className: styles$3.charCount, children: [textareaValue.length, "/", maxLength] }))] })] })] }));
|
|
4439
4600
|
});
|
|
4440
4601
|
TextArea.displayName = 'TextArea';
|
|
4441
4602
|
var TextArea_default = React.memo(TextArea);
|
|
@@ -4537,7 +4698,7 @@ const useToast = () => {
|
|
|
4537
4698
|
*
|
|
4538
4699
|
* @param props - {@link ToastProps} combinadas com o `id` único do toast
|
|
4539
4700
|
*/
|
|
4540
|
-
const Toast = ({ id, title, duration = 5000, icon, iconClosed = jsxRuntime.jsx(reactIcons.Dismiss16Filled, {}), automaticClose = true, iconType = "Info", ...
|
|
4701
|
+
const Toast = ({ id, title, duration = 5000, icon, iconClosed = jsxRuntime.jsx(reactIcons.Dismiss16Filled, {}), automaticClose = true, iconType = "Info", className, ...rest }) => {
|
|
4541
4702
|
const [open, setOpen] = React__namespace.useState(false);
|
|
4542
4703
|
const { dismissToast } = useToastContext();
|
|
4543
4704
|
React__namespace.useEffect(() => {
|
|
@@ -4562,7 +4723,7 @@ const Toast = ({ id, title, duration = 5000, icon, iconClosed = jsxRuntime.jsx(r
|
|
|
4562
4723
|
displayIcon = jsxRuntime.jsx(reactIcons.Warning20Filled, {});
|
|
4563
4724
|
}
|
|
4564
4725
|
}
|
|
4565
|
-
return (jsxRuntime.jsxs(radixUi.Toast.Root, { className: styles$2.toastRoot, open: open, onOpenChange: handleOpenChange, duration: effectiveDuration, ...
|
|
4726
|
+
return (jsxRuntime.jsxs(radixUi.Toast.Root, { className: clsx(styles$2.toastRoot, className), open: open, onOpenChange: handleOpenChange, duration: effectiveDuration, ...rest, children: [jsxRuntime.jsx("span", { className: `${styles$2.Icon} ${iconType ? styles$2[`icon${iconType}`] : ''}`, "aria-hidden": "true", children: displayIcon }), jsxRuntime.jsx("div", { className: styles$2.toastContent, children: jsxRuntime.jsxs(radixUi.Toast.Title, { className: styles$2.toastTitle, children: [" ", title, " "] }) }), jsxRuntime.jsxs(radixUi.Toast.Close, { className: styles$2.toastClose, children: [" ", iconClosed, " "] })] }));
|
|
4566
4727
|
};
|
|
4567
4728
|
|
|
4568
4729
|
/**
|
|
@@ -4648,7 +4809,7 @@ ToastContainer.displayName = 'ToastContainer';
|
|
|
4648
4809
|
|
|
4649
4810
|
var styles$1 = {"container":"Switch-module__container___BR1OB","switchRoot":"Switch-module__switchRoot___jz2HD","switchThumb":"Switch-module__switchThumb___X3RL7"};
|
|
4650
4811
|
|
|
4651
|
-
const Switch = ({ disabled = false, defaultChecked = false, checked, onCheckedChange, ...rest }) => (jsxRuntime.jsx("div", { className: clsx(styles$1.container), children: jsxRuntime.jsx(radixUi.Switch.Root, { className: styles$1.switchRoot, disabled: disabled, defaultChecked: defaultChecked, checked: checked, onCheckedChange: onCheckedChange, ...rest, children: jsxRuntime.jsx(radixUi.Switch.Thumb, { className: styles$1.switchThumb }) }) }));
|
|
4812
|
+
const Switch = ({ disabled = false, defaultChecked = false, checked, onCheckedChange, className, ...rest }) => (jsxRuntime.jsx("div", { className: clsx(styles$1.container, className), children: jsxRuntime.jsx(radixUi.Switch.Root, { className: styles$1.switchRoot, disabled: disabled, defaultChecked: defaultChecked, checked: checked, onCheckedChange: onCheckedChange, ...rest, children: jsxRuntime.jsx(radixUi.Switch.Thumb, { className: styles$1.switchThumb }) }) }));
|
|
4652
4813
|
|
|
4653
4814
|
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"};
|
|
4654
4815
|
|
|
@@ -5088,6 +5249,7 @@ exports.Switch = Switch;
|
|
|
5088
5249
|
exports.Table = Table;
|
|
5089
5250
|
exports.TableHeader = TableHeader;
|
|
5090
5251
|
exports.TablePagination = TablePagination;
|
|
5252
|
+
exports.TableV2 = TableV2;
|
|
5091
5253
|
exports.TextArea = TextArea_default;
|
|
5092
5254
|
exports.TextField = TextField;
|
|
5093
5255
|
exports.Toast = Toast;
|