@giro-ds/react 5.0.1 → 6.0.1
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 +231 -207
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +141 -49
- package/dist/index.esm.js +233 -210
- package/dist/index.esm.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
|
-
import { Avatar as Avatar$1, Tooltip as Tooltip$1, Checkbox as Checkbox$1, Popover as Popover$1, Label, AlertDialog, RadioGroup, DropdownMenu, Select as Select$1, Toast as Toast$1, Switch as Switch$1 } from 'radix-ui';
|
|
3
|
+
import { Avatar as Avatar$1, Tooltip as Tooltip$1, Checkbox as Checkbox$1, Popover as Popover$1, Label, AlertDialog, RadioGroup, DropdownMenu, Dialog as Dialog$1, Select as Select$1, Toast as Toast$1, Switch as Switch$1 } from 'radix-ui';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import React__default, { useId, useMemo, createContext, useState, useContext, forwardRef, useEffect, useCallback, useRef, memo, useReducer, createElement, isValidElement } from 'react';
|
|
6
|
-
import {
|
|
6
|
+
import { SpinnerIos16Regular, ChevronUp16Regular, ChevronLeft16Regular, ChevronRight16Regular, ChevronDown16Regular, Info12Regular, Dismiss16Regular, Calendar16Regular, Search16Regular, ChevronDownRegular, ChevronRight16Filled, Subtract16Regular, Add16Regular, Info20Filled, CheckmarkCircle20Filled, Warning20Filled, Dismiss16Filled } from '@fluentui/react-icons';
|
|
7
7
|
import { DayPicker } from 'react-day-picker';
|
|
8
8
|
import { format, addDays, addMonths, addWeeks, addYears, differenceInCalendarDays, differenceInCalendarMonths, eachMonthOfInterval, eachYearOfInterval, endOfISOWeek, endOfMonth, endOfWeek, endOfYear, getISOWeek, getMonth, getYear, getWeek, isAfter, isBefore, isDate, isSameDay, isSameMonth, isSameYear, max, min, setMonth, setYear, startOfDay, startOfISOWeek, startOfMonth, startOfWeek, startOfYear } from 'date-fns';
|
|
9
9
|
import { createPortal } from 'react-dom';
|
|
10
10
|
|
|
11
|
-
var styles$
|
|
11
|
+
var styles$r = {"AvatarRoot":"Avatar-module__AvatarRoot___7eNx7","AvatarRoot--sm":"Avatar-module__AvatarRoot--sm___LVHoe","AvatarRoot--lg":"Avatar-module__AvatarRoot--lg___QWux5","AvatarImage":"Avatar-module__AvatarImage___-H6iH","AvatarFallback":"Avatar-module__AvatarFallback___RDyNV"};
|
|
12
12
|
|
|
13
13
|
const Avatar = ({ icon, size = 'lg', src, className, initialLetters, ...rest }) => {
|
|
14
|
-
const AvatarClass = clsx(styles$
|
|
15
|
-
[styles$
|
|
16
|
-
[styles$
|
|
14
|
+
const AvatarClass = clsx(styles$r.AvatarRoot, {
|
|
15
|
+
[styles$r['AvatarRoot--lg']]: size === 'lg',
|
|
16
|
+
[styles$r['AvatarRoot--sm']]: size === 'sm',
|
|
17
17
|
}, className);
|
|
18
|
-
return (jsx("div", { children: jsxs(Avatar$1.Root, { className: AvatarClass, ...rest, children: [src && (jsx(Avatar$1.Image, { className: styles$
|
|
18
|
+
return (jsx("div", { children: jsxs(Avatar$1.Root, { className: AvatarClass, ...rest, children: [src && (jsx(Avatar$1.Image, { className: styles$r.AvatarImage, src: src, alt: "Avatar" })), jsx(Avatar$1.Fallback, { className: styles$r.AvatarFallback, children: icon || initialLetters })] }) }));
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
var styles$
|
|
21
|
+
var styles$q = {"zds-badge__container":"Badge-module__zds-badge__container___NMAZD","zds-badge":"Badge-module__zds-badge___TeF7g","zds-badge__status":"Badge-module__zds-badge__status___3rFKE","zds-badge__small":"Badge-module__zds-badge__small___lVA0I","zds-badge__large":"Badge-module__zds-badge__large___yxb6z","zds-badge__status__empty":"Badge-module__zds-badge__status__empty___zWu8n"};
|
|
22
22
|
|
|
23
23
|
const Badge = ({ children, badgeValue = null, type = 'notification', className, id, 'aria-label': ariaLabel, }) => {
|
|
24
24
|
const isEmpty = badgeValue === null || badgeValue === undefined || badgeValue === '';
|
|
@@ -41,23 +41,23 @@ const Badge = ({ children, badgeValue = null, type = 'notification', className,
|
|
|
41
41
|
};
|
|
42
42
|
const displayValue = getDisplayValue(badgeValue);
|
|
43
43
|
if (type === 'notification') {
|
|
44
|
-
return (jsxs("div", { className: clsx(styles$
|
|
45
|
-
[styles$
|
|
46
|
-
[styles$
|
|
47
|
-
}, className), "data-testid": "badge-notification", children: !isEmpty && (jsx("span", { className: styles$
|
|
44
|
+
return (jsxs("div", { className: clsx(styles$q['zds-badge__container']), children: [jsx("div", { id: componentId, className: clsx(styles$q['zds-badge'], {
|
|
45
|
+
[styles$q['zds-badge__small']]: Number(badgeValue) <= 10,
|
|
46
|
+
[styles$q['zds-badge__large']]: Number(badgeValue) > 10,
|
|
47
|
+
}, className), "data-testid": "badge-notification", children: !isEmpty && (jsx("span", { className: styles$q['zds-badge__value'], "aria-hidden": ariaLabel ? 'true' : 'false', children: displayValue })) }), children && (jsx("div", { className: styles$q['zds-badge__content'], "data-testid": "badge-content", children: children }))] }));
|
|
48
48
|
}
|
|
49
|
-
return (jsx("div", { className: clsx(styles$
|
|
50
|
-
[styles$
|
|
51
|
-
}, className), "data-testid": "badge-status", children: !isEmpty && (jsx("span", { className: styles$
|
|
49
|
+
return (jsx("div", { className: clsx(styles$q['zds-badge__container']), children: jsx("div", { className: clsx(styles$q['zds-badge__status'], {
|
|
50
|
+
[styles$q['zds-badge__status__empty']]: isEmpty,
|
|
51
|
+
}, className), "data-testid": "badge-status", children: !isEmpty && (jsx("span", { className: styles$q['zds-badge__status-value'], "aria-hidden": ariaLabel ? 'true' : 'false', children: displayValue })) }) }));
|
|
52
52
|
};
|
|
53
53
|
|
|
54
|
-
var styles$
|
|
54
|
+
var styles$p = {"tooltipContent":"Tooltip-module__tooltipContent___xycUg","triggerWrapper":"Tooltip-module__triggerWrapper___x83XR"};
|
|
55
55
|
|
|
56
56
|
const Tooltip = ({ children, text, side = 'bottom', align = 'start', maxWidth, sideOffset = 10, ...rest }) => {
|
|
57
|
-
return (jsx(Tooltip$1.Provider, { children: jsxs(Tooltip$1.Root, { children: [jsx(Tooltip$1.Trigger, { asChild: true, children: jsx("span", { className: styles$
|
|
57
|
+
return (jsx(Tooltip$1.Provider, { children: jsxs(Tooltip$1.Root, { children: [jsx(Tooltip$1.Trigger, { asChild: true, children: jsx("span", { className: styles$p.triggerWrapper, children: children }) }), jsx(Tooltip$1.Portal, { children: jsx(Tooltip$1.Content, { className: styles$p.tooltipContent, side: side, align: align, sideOffset: sideOffset, style: { maxWidth: maxWidth ? `${maxWidth}px` : 'auto' }, ...rest, children: text }) })] }) }));
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
-
var styles$
|
|
60
|
+
var styles$o = {"button":"Button-module__button___18Bed","button-lg":"Button-module__button-lg___-A8B9","button-sm":"Button-module__button-sm___L7aT7","button-filled":"Button-module__button-filled___IQx1z","button-outlined":"Button-module__button-outlined___hLkLN","button-text":"Button-module__button-text___8GFeA","buttonWithIcon":"Button-module__buttonWithIcon___8ehK1","buttonIconPosition-left":"Button-module__buttonIconPosition-left___uOY6b","buttonIconPosition-right":"Button-module__buttonIconPosition-right___eswRS","buttonIconPosition-both":"Button-module__buttonIconPosition-both___1Lith","buttonNoContent":"Button-module__buttonNoContent___Tc9jk","buttonIconOnly":"Button-module__buttonIconOnly___aifk4","buttonIconLeft":"Button-module__buttonIconLeft___RICR3","buttonIconRight":"Button-module__buttonIconRight___71lu2","buttonFullWidth":"Button-module__buttonFullWidth___tXuVE","disabled":"Button-module__disabled___UzdWL","buttonLoading":"Button-module__buttonLoading___RGdNw","buttonContentHidden":"Button-module__buttonContentHidden___CoCiN","buttonLoadingSpinner":"Button-module__buttonLoadingSpinner___oZxEU","spin":"Button-module__spin___kQKH9"};
|
|
61
61
|
|
|
62
62
|
const Button = React__default.forwardRef(({ as, children, variant = 'filled', iconPosition = 'left', href, to, external = false, target, rel, disabled = false, onClick, size = 'lg', className, type = 'button', id, icon, fullWidth = false, ariaLabel, iconOnly = false, loading = false, tooltipText, tooltipSide = 'top', tooltipAlign = 'center', ...restProps }, ref) => {
|
|
63
63
|
const generatedId = useId();
|
|
@@ -67,35 +67,51 @@ const Button = React__default.forwardRef(({ as, children, variant = 'filled', ic
|
|
|
67
67
|
return as;
|
|
68
68
|
if (href)
|
|
69
69
|
return 'a';
|
|
70
|
-
if (to)
|
|
70
|
+
if (to) {
|
|
71
|
+
if (process.env.NODE_ENV !== 'production' && !as) {
|
|
72
|
+
console.warn('[Button] A prop `to` foi usada sem `as`. ' +
|
|
73
|
+
'Para navegação via roteador (React Router, Next.js, etc.), passe `as={Link}`. ' +
|
|
74
|
+
'Por ora, `to` será tratado como `href` em um <a> nativo.');
|
|
75
|
+
}
|
|
71
76
|
return 'a';
|
|
77
|
+
}
|
|
72
78
|
return 'button';
|
|
73
79
|
};
|
|
74
80
|
const Component = getComponent();
|
|
75
81
|
const hasContent = useMemo(() => {
|
|
76
82
|
return children && React__default.Children.count(children) > 0;
|
|
77
83
|
}, [children]);
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
[styles$
|
|
85
|
-
[styles$
|
|
84
|
+
if (process.env.NODE_ENV !== 'production' && iconOnly && !icon) {
|
|
85
|
+
console.error('[Button] `iconOnly={true}` foi usado sem a prop `icon`. ' +
|
|
86
|
+
'Forneça um ícone via `icon={<MeuIcone />}`.');
|
|
87
|
+
}
|
|
88
|
+
const resolvedIcon = icon;
|
|
89
|
+
const buttonClasses = clsx(styles$o.button, styles$o[`button-${variant}`], styles$o[`button-${size}`], {
|
|
90
|
+
[styles$o['disabled']]: disabled,
|
|
91
|
+
[styles$o['buttonLoading']]: loading,
|
|
92
|
+
[styles$o['buttonWithIcon']]: resolvedIcon && !iconOnly,
|
|
93
|
+
[styles$o[`buttonIconPosition-${iconPosition}`]]: resolvedIcon && !iconOnly,
|
|
94
|
+
[styles$o['buttonNoContent']]: resolvedIcon && !hasContent && !iconOnly,
|
|
95
|
+
[styles$o['buttonFullWidth']]: fullWidth,
|
|
96
|
+
[styles$o['buttonIconOnly']]: iconOnly,
|
|
86
97
|
}, className);
|
|
87
98
|
const getAriaLabel = () => {
|
|
88
99
|
if (ariaLabel)
|
|
89
100
|
return ariaLabel;
|
|
90
|
-
if (iconOnly
|
|
91
|
-
|
|
101
|
+
if (iconOnly) {
|
|
102
|
+
if (tooltipText)
|
|
103
|
+
return tooltipText;
|
|
104
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
105
|
+
console.warn('[Button] Botões icon-only precisam de uma prop `ariaLabel` descritiva. ' +
|
|
106
|
+
'O fallback genérico foi removido pois não comunica intenção. ' +
|
|
107
|
+
'Forneça `ariaLabel` ou `tooltipText` para nomear o botão.');
|
|
108
|
+
}
|
|
109
|
+
return undefined;
|
|
92
110
|
}
|
|
93
|
-
if (typeof children === 'string')
|
|
94
|
-
return children;
|
|
95
111
|
return undefined;
|
|
96
112
|
};
|
|
97
113
|
const handleClick = (e) => {
|
|
98
|
-
if (disabled) {
|
|
114
|
+
if (disabled || loading) {
|
|
99
115
|
e.preventDefault();
|
|
100
116
|
return;
|
|
101
117
|
}
|
|
@@ -103,12 +119,12 @@ const Button = React__default.forwardRef(({ as, children, variant = 'filled', ic
|
|
|
103
119
|
};
|
|
104
120
|
const renderContent = () => {
|
|
105
121
|
if (iconOnly && !loading) {
|
|
106
|
-
return (jsx("span", { className: styles$
|
|
122
|
+
return (jsx("span", { className: styles$o.buttonIconOnly, "aria-hidden": "true", children: resolvedIcon }));
|
|
107
123
|
}
|
|
108
124
|
if (loading) {
|
|
109
|
-
return (jsx("span", { className: styles$
|
|
125
|
+
return (jsxs(Fragment, { children: [!iconOnly && (jsxs("span", { className: styles$o.buttonContentHidden, "aria-hidden": "true", children: [resolvedIcon && (iconPosition === 'left' || iconPosition === 'both') && (jsx("span", { className: styles$o.buttonIconLeft, children: resolvedIcon })), children, resolvedIcon && (iconPosition === 'right' || iconPosition === 'both') && (jsx("span", { className: styles$o.buttonIconRight, children: resolvedIcon }))] })), jsx("span", { className: styles$o.buttonLoadingSpinner, "aria-hidden": "true", children: jsx(SpinnerIos16Regular, { "aria-hidden": "true" }) })] }));
|
|
110
126
|
}
|
|
111
|
-
return (jsxs(Fragment, { children: [resolvedIcon && (iconPosition === 'left' || iconPosition === 'both') && (jsx("span", { className: styles$
|
|
127
|
+
return (jsxs(Fragment, { children: [resolvedIcon && (iconPosition === 'left' || iconPosition === 'both') && (jsx("span", { className: styles$o.buttonIconLeft, "aria-hidden": "true", children: resolvedIcon })), children, resolvedIcon && (iconPosition === 'right' || iconPosition === 'both') && (jsx("span", { className: styles$o.buttonIconRight, "aria-hidden": "true", children: resolvedIcon }))] }));
|
|
112
128
|
};
|
|
113
129
|
const baseProps = {
|
|
114
130
|
ref,
|
|
@@ -116,14 +132,18 @@ const Button = React__default.forwardRef(({ as, children, variant = 'filled', ic
|
|
|
116
132
|
className: buttonClasses,
|
|
117
133
|
'aria-label': getAriaLabel(),
|
|
118
134
|
'aria-disabled': disabled,
|
|
119
|
-
|
|
135
|
+
'aria-busy': loading || undefined,
|
|
136
|
+
tabIndex: disabled || loading ? -1 : 0,
|
|
120
137
|
onClick: handleClick,
|
|
121
138
|
...restProps,
|
|
122
139
|
};
|
|
123
140
|
const getNavigationProps = () => {
|
|
124
141
|
if (href) {
|
|
142
|
+
if (disabled || loading) {
|
|
143
|
+
return { role: 'link' };
|
|
144
|
+
}
|
|
125
145
|
return {
|
|
126
|
-
href
|
|
146
|
+
href,
|
|
127
147
|
target: external || target === '_blank' ? '_blank' : target,
|
|
128
148
|
rel: external || target === '_blank' ? 'noopener noreferrer' : rel,
|
|
129
149
|
};
|
|
@@ -131,11 +151,11 @@ const Button = React__default.forwardRef(({ as, children, variant = 'filled', ic
|
|
|
131
151
|
if (to) {
|
|
132
152
|
if (Component !== 'a') {
|
|
133
153
|
return {
|
|
134
|
-
to: disabled ?
|
|
154
|
+
to: disabled ? undefined : to,
|
|
135
155
|
};
|
|
136
156
|
}
|
|
137
157
|
return {
|
|
138
|
-
href: disabled ?
|
|
158
|
+
href: disabled ? undefined : to,
|
|
139
159
|
};
|
|
140
160
|
}
|
|
141
161
|
if (Component === 'button') {
|
|
@@ -146,7 +166,7 @@ const Button = React__default.forwardRef(({ as, children, variant = 'filled', ic
|
|
|
146
166
|
}
|
|
147
167
|
return {};
|
|
148
168
|
};
|
|
149
|
-
if (iconOnly && !loading) {
|
|
169
|
+
if (iconOnly && tooltipText && !loading) {
|
|
150
170
|
return (jsx(Tooltip, { text: tooltipText, side: tooltipSide, align: tooltipAlign, children: jsx(Component, { ...baseProps, ...getNavigationProps(), children: renderContent() }) }));
|
|
151
171
|
}
|
|
152
172
|
return (jsx(Component, { ...baseProps, ...getNavigationProps(), children: renderContent() }));
|
|
@@ -2409,8 +2429,18 @@ const ptBR = {
|
|
|
2409
2429
|
},
|
|
2410
2430
|
};
|
|
2411
2431
|
|
|
2412
|
-
var styles$
|
|
2432
|
+
var styles$n = {"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"};
|
|
2413
2433
|
|
|
2434
|
+
const FLUENT_CHEVRON_MAP = {
|
|
2435
|
+
down: ChevronDown16Regular,
|
|
2436
|
+
up: ChevronUp16Regular,
|
|
2437
|
+
left: ChevronLeft16Regular,
|
|
2438
|
+
right: ChevronRight16Regular,
|
|
2439
|
+
};
|
|
2440
|
+
const CustomChevron = ({ orientation = "left", className, }) => {
|
|
2441
|
+
const Icon = FLUENT_CHEVRON_MAP[orientation];
|
|
2442
|
+
return jsx(Icon, { className: className, "aria-hidden": true });
|
|
2443
|
+
};
|
|
2414
2444
|
const GridCtx = createContext(null);
|
|
2415
2445
|
const GridMonthCaption = ({ calendarMonth, displayIndex: _displayIndex, ...divProps }) => {
|
|
2416
2446
|
const ctx = useContext(GridCtx);
|
|
@@ -2418,7 +2448,7 @@ const GridMonthCaption = ({ calendarMonth, displayIndex: _displayIndex, ...divPr
|
|
|
2418
2448
|
const date = calendarMonth.date;
|
|
2419
2449
|
const monthLabel = new Intl.DateTimeFormat(intlLocale, { month: "long" }).format(date);
|
|
2420
2450
|
const yearLabel = String(date.getFullYear());
|
|
2421
|
-
return (jsxs("div", { ...divProps, children: [jsx("span", { className: styles$
|
|
2451
|
+
return (jsxs("div", { ...divProps, children: [jsx("span", { className: styles$n.caption_grid_label, children: monthLabel }), jsxs("button", { type: "button", className: styles$n.caption_grid_btn, "aria-pressed": view === "years", onClick: onYearLabelClick, children: [yearLabel, view !== "days" ? (jsx(ChevronUp16Regular, { className: styles$n.caption_year_chevron, "aria-hidden": true })) : (jsx(ChevronDown16Regular, { className: styles$n.caption_year_chevron, "aria-hidden": true }))] })] }));
|
|
2422
2452
|
};
|
|
2423
2453
|
const YEARS_PER_PAGE = 20;
|
|
2424
2454
|
const Calendar = ({ selected, currentDate, defaultMonth, startMonth, endMonth, onDaySelect, onDateChange, onClear: _onClear, minDate, maxDate, disabled, format: _format, locale = "pt-br", autoFocus, id, "aria-label": ariaLabel, }) => {
|
|
@@ -2486,7 +2516,7 @@ const Calendar = ({ selected, currentDate, defaultMonth, startMonth, endMonth, o
|
|
|
2486
2516
|
onYearLabelClick: handleYearLabelClick,
|
|
2487
2517
|
};
|
|
2488
2518
|
const sharedDayPickerProps = {
|
|
2489
|
-
classNames: styles$
|
|
2519
|
+
classNames: styles$n,
|
|
2490
2520
|
animate,
|
|
2491
2521
|
mode: "single",
|
|
2492
2522
|
selected: resolvedSelected,
|
|
@@ -2498,20 +2528,20 @@ const Calendar = ({ selected, currentDate, defaultMonth, startMonth, endMonth, o
|
|
|
2498
2528
|
autoFocus,
|
|
2499
2529
|
"aria-label": ariaLabel,
|
|
2500
2530
|
};
|
|
2501
|
-
return (jsx(GridCtx.Provider, { value: gridCtxValue, children: jsxs("div", { className: styles$
|
|
2531
|
+
return (jsx(GridCtx.Provider, { value: gridCtxValue, children: jsxs("div", { className: styles$n.calendar_grid_wrapper, children: [jsx(DayPicker, { id: id, ...sharedDayPickerProps, captionLayout: "label", month: resolvedDisplayMonth, onMonthChange: handleMonthChange, components: { MonthCaption: GridMonthCaption, Chevron: CustomChevron } }), gridView !== "days" && (jsxs("div", { className: `${styles$n.gridOverlay}${gridView === "years" ? ` ${styles$n.gridOverlayYears}` : ""}`, role: "dialog", "aria-modal": "true", "aria-label": gridView === "months" ? "Selecione o mês" : "Selecione o ano", children: [gridView === "months" && (jsxs(Fragment, { children: [jsxs("div", { className: styles$n.gridOverlayCaption, children: [jsx("span", { className: styles$n.caption_grid_label, children: new Intl.DateTimeFormat(intlLocale, { month: "long" }).format(resolvedDisplayMonth) }), jsxs("button", { type: "button", className: styles$n.caption_grid_btn, onClick: () => setGridView("days"), "aria-label": "Fechar sele\u00E7\u00E3o de m\u00EAs", children: [displayedYear, jsx(ChevronUp16Regular, { className: styles$n.caption_year_chevron, "aria-hidden": true })] })] }), jsx("div", { className: styles$n.gridCells, children: monthsGrid.map(({ index, label, disabled: monthDisabled }) => (jsx("button", { type: "button", disabled: monthDisabled, className: `${styles$n.gridCell}${displayedMonthIndex === index ? ` ${styles$n.gridCellActive}` : ""}`, onClick: () => handleGridMonthSelect(index), children: label }, index))) })] })), gridView === "years" && (jsxs(Fragment, { children: [jsxs("div", { className: styles$n.gridOverlayCaption, children: [jsx("span", { className: styles$n.caption_grid_label, children: new Intl.DateTimeFormat(intlLocale, { month: "long" }).format(resolvedDisplayMonth) }), jsxs("button", { type: "button", className: styles$n.caption_grid_btn, onClick: () => setGridView("days"), "aria-label": "Fechar sele\u00E7\u00E3o de ano", children: [displayedYear, jsx(ChevronUp16Regular, { className: styles$n.caption_year_chevron, "aria-hidden": true })] }), jsxs("div", { className: styles$n.gridOverlayYearsNav, children: [jsx("button", { type: "button", className: styles$n.gridNavBtn, disabled: !canGoPrevYears, onClick: () => setYearPageStart((s) => s - YEARS_PER_PAGE), "aria-label": "Anos anteriores", children: jsx(ChevronLeft16Regular, { className: styles$n.chevronNavBtnPrev, "aria-hidden": true }) }), jsx("button", { type: "button", className: styles$n.gridNavBtn, disabled: !canGoNextYears, onClick: () => setYearPageStart((s) => s + YEARS_PER_PAGE), "aria-label": "Pr\u00F3ximos anos", children: jsx(ChevronRight16Regular, { className: styles$n.chevronNavBtnNext, "aria-hidden": true }) })] })] }), jsx("div", { className: `${styles$n.gridCells} ${styles$n.gridCellsYears}`, children: yearsInPage.map((year) => (jsx("button", { type: "button", className: `${styles$n.gridCell}${displayedYear === year ? ` ${styles$n.gridCellActive}` : ""}`, onClick: () => handleGridYearSelect(year), children: year }, year))) })] }))] }))] }) }));
|
|
2502
2532
|
};
|
|
2503
2533
|
|
|
2504
|
-
var styles$
|
|
2534
|
+
var styles$m = {"zds-callout__container":"Callout-module__zds-callout__container___EoOQd","zds-callout__container__with-title":"Callout-module__zds-callout__container__with-title___NUq2k","zds-callout__neutral":"Callout-module__zds-callout__neutral___ib9gW","zds-callout__brand":"Callout-module__zds-callout__brand___UYVny","zds-callout__color":"Callout-module__zds-callout__color___6ojEV","zds-callout__alert":"Callout-module__zds-callout__alert___gSOsh","zds-callout__success":"Callout-module__zds-callout__success___6W096","zds-callout__title":"Callout-module__zds-callout__title___jmmqj","zds-callout__text":"Callout-module__zds-callout__text___MTO5R","zds-callout__icon":"Callout-module__zds-callout__icon___-CaUD","zds-callout__content":"Callout-module__zds-callout__content___hh0Mj","zds-callout__subcontent":"Callout-module__zds-callout__subcontent___olIpt"};
|
|
2505
2535
|
|
|
2506
2536
|
const Callout = ({ type = 'neutral', title, text, icon, className, id, ...rest }) => {
|
|
2507
2537
|
const generatedId = useId();
|
|
2508
2538
|
const titleId = id || `callout-title-${generatedId}`;
|
|
2509
2539
|
const componentId = id || generatedId;
|
|
2510
|
-
const calloutClass = clsx(styles$
|
|
2511
|
-
[styles$
|
|
2512
|
-
[styles$
|
|
2540
|
+
const calloutClass = clsx(styles$m['zds-callout__container'], styles$m[`zds-callout__${type}`], {
|
|
2541
|
+
[styles$m['zds-callout__container__with-title']]: title,
|
|
2542
|
+
[styles$m['zds-callout__no-icon']]: !icon,
|
|
2513
2543
|
}, className);
|
|
2514
|
-
return (jsx("div", { id: componentId, className: calloutClass, "aria-live": "polite", role: "alert", "aria-labelledby": title ? titleId : undefined, ...rest, children: jsxs("div", { className: styles$
|
|
2544
|
+
return (jsx("div", { id: componentId, className: calloutClass, "aria-live": "polite", role: "alert", "aria-labelledby": title ? titleId : undefined, ...rest, children: jsxs("div", { className: styles$m['zds-callout__content'], children: [icon && jsx("span", { className: styles$m['zds-callout__icon'], children: icon }), jsxs("div", { className: styles$m['zds-callout__subcontent'], children: [title && (jsx("span", { id: titleId, className: styles$m['zds-callout__title'], children: title })), text && jsx("span", { className: styles$m['zds-callout__text'], children: text })] })] }) }));
|
|
2515
2545
|
};
|
|
2516
2546
|
|
|
2517
2547
|
const CheckSmall = ({ className = '', width = 12, height = 10, fill = 'white', ...restProps }) => {
|
|
@@ -2522,45 +2552,47 @@ const CheckHalf = ({ className = '', width = 16, height = 16, fill = 'white', ..
|
|
|
2522
2552
|
return (jsx("svg", { width: width, height: height, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, "aria-hidden": "true", ...restProps, children: jsx("g", { id: "Icons/check_indeterminate_small", children: jsx("path", { id: "icon", d: "M3 9V7H13V9H3Z", fill: fill }) }) }));
|
|
2523
2553
|
};
|
|
2524
2554
|
|
|
2525
|
-
var styles$
|
|
2555
|
+
var styles$l = {"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"};
|
|
2526
2556
|
|
|
2527
2557
|
const Checkbox = ({ id, label, onCheckedChange, checked, disabled, className, indeterminate = false, ...rest }) => {
|
|
2528
2558
|
const componentId = id || React.useId();
|
|
2529
|
-
return (jsxs("div", { className: clsx(styles$
|
|
2530
|
-
[styles$
|
|
2531
|
-
}), role: "presentation", tabIndex: disabled ? -1 : 0, children: jsx(Checkbox$1.Root, { className: styles$
|
|
2559
|
+
return (jsxs("div", { className: clsx(styles$l.container, className), children: [jsx("div", { className: clsx(styles$l.wrapperCheckbox, {
|
|
2560
|
+
[styles$l.disabled]: disabled,
|
|
2561
|
+
}), role: "presentation", tabIndex: disabled ? -1 : 0, children: jsx(Checkbox$1.Root, { className: styles$l.root, checked: checked, id: componentId, onCheckedChange: onCheckedChange, disabled: disabled, "data-disabled": disabled, "data-indeterminate": indeterminate, "aria-checked": indeterminate ? 'mixed' : checked ? 'true' : 'false', ...rest, children: jsx(Checkbox$1.Indicator, { className: styles$l.indicator, children: indeterminate ? jsx(CheckHalf, {}) : jsx(CheckSmall, {}) }) }) }), jsx("label", { className: clsx(styles$l.label, { [styles$l.disabled]: disabled }), htmlFor: componentId, children: label })] }));
|
|
2532
2562
|
};
|
|
2533
2563
|
|
|
2534
|
-
var styles$
|
|
2564
|
+
var styles$k = {"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"};
|
|
2535
2565
|
|
|
2536
|
-
const Chips = ({
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
const chipsClass = clsx(styles$j['zds-chips'], styles$j[`zds-chips--${type}`], {
|
|
2542
|
-
[styles$j['zds-chips--disabled']]: disabled,
|
|
2543
|
-
[styles$j['has-left-icon']]: leftIcon,
|
|
2544
|
-
[styles$j['has-right-icon']]: rightIcon,
|
|
2566
|
+
const Chips = ({ children, leftIcon, rightIcon, variant = 'neutral', disabled = false, backgroundColor, textColor, className, style, ...restProps }) => {
|
|
2567
|
+
const chipsClass = clsx(styles$k.chips, styles$k[variant], {
|
|
2568
|
+
[styles$k.disabled]: disabled,
|
|
2569
|
+
[styles$k.hasLeftIcon]: leftIcon,
|
|
2570
|
+
[styles$k.hasRightIcon]: rightIcon,
|
|
2545
2571
|
}, className);
|
|
2546
|
-
|
|
2572
|
+
const colorStyle = {
|
|
2573
|
+
...(!disabled && backgroundColor && { '--chips-bg': `var(--${backgroundColor})` }),
|
|
2574
|
+
...(!disabled && textColor && { '--chips-text': `var(--${textColor})` }),
|
|
2575
|
+
...style,
|
|
2576
|
+
};
|
|
2577
|
+
const isInteractive = typeof restProps.onClick === 'function';
|
|
2578
|
+
return (jsxs("div", { className: chipsClass, "aria-disabled": disabled, style: colorStyle, role: isInteractive ? 'button' : undefined, tabIndex: isInteractive ? (disabled ? -1 : 0) : undefined, ...restProps, children: [leftIcon && (jsx("span", { className: styles$k.iconLeft, "aria-hidden": "true", children: leftIcon })), jsx("span", { className: styles$k.title, children: children }), rightIcon && (jsx("span", { className: styles$k.iconRight, children: rightIcon }))] }));
|
|
2547
2579
|
};
|
|
2548
2580
|
const MemoizedChips = React__default.memo(Chips);
|
|
2549
2581
|
MemoizedChips.displayName = 'Chips';
|
|
2550
2582
|
|
|
2551
|
-
var styles$
|
|
2583
|
+
var styles$j = {"container":"Container-module__container___exPuE"};
|
|
2552
2584
|
|
|
2553
2585
|
function Container({ children }) {
|
|
2554
|
-
return (jsx("main", { className: `${styles$
|
|
2586
|
+
return (jsx("main", { className: `${styles$j['container']} mx-auto`, children: children }));
|
|
2555
2587
|
}
|
|
2556
2588
|
|
|
2557
|
-
var styles$
|
|
2589
|
+
var styles$i = {"Content":"Popover-module__Content___RIETg"};
|
|
2558
2590
|
|
|
2559
2591
|
const Popover = ({ trigger, content, side = "left", align = "start", sideOffset = 8, open, onOpenChange, asAnchor = false, onOpenAutoFocus, onCloseAutoFocus, showArrow = false, }) => {
|
|
2560
|
-
return (jsxs(Popover$1.Root, { open: open, onOpenChange: onOpenChange, children: [asAnchor ? (jsx(Popover$1.Anchor, { asChild: true, children: trigger })) : (jsx(Popover$1.Trigger, { asChild: true, children: trigger })), jsx(Popover$1.Portal, { children: jsxs(Popover$1.Content, { className: styles$
|
|
2592
|
+
return (jsxs(Popover$1.Root, { open: open, onOpenChange: onOpenChange, children: [asAnchor ? (jsx(Popover$1.Anchor, { asChild: true, children: trigger })) : (jsx(Popover$1.Trigger, { asChild: true, children: trigger })), jsx(Popover$1.Portal, { children: jsxs(Popover$1.Content, { className: styles$i.Content, sideOffset: sideOffset, side: side, align: align, onOpenAutoFocus: asAnchor ? (e) => e.preventDefault() : onOpenAutoFocus, onCloseAutoFocus: asAnchor ? (e) => e.preventDefault() : onCloseAutoFocus, onInteractOutside: asAnchor ? (e) => e.preventDefault() : undefined, children: [content, showArrow && jsx(Popover$1.Arrow, {})] }) })] }));
|
|
2561
2593
|
};
|
|
2562
2594
|
|
|
2563
|
-
var styles$
|
|
2595
|
+
var styles$h = {"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"};
|
|
2564
2596
|
|
|
2565
2597
|
const validateInput = ({ value, maxLength, errorMessage, required }) => {
|
|
2566
2598
|
if (required && value.trim() === '') {
|
|
@@ -2572,10 +2604,10 @@ const validateInput = ({ value, maxLength, errorMessage, required }) => {
|
|
|
2572
2604
|
return '';
|
|
2573
2605
|
};
|
|
2574
2606
|
|
|
2575
|
-
var styles$
|
|
2607
|
+
var styles$g = {"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"};
|
|
2576
2608
|
|
|
2577
|
-
const LabelComponent = ({ children, htmlFor, required = false, tooltip = false, tooltipText, side = 'bottom', align = 'start', className, error = false, disabled = false }) => (jsxs("div", { className: clsx(styles$
|
|
2578
|
-
styles$
|
|
2609
|
+
const LabelComponent = ({ children, htmlFor, required = false, tooltip = false, tooltipText, side = 'bottom', align = 'start', className, error = false, disabled = false }) => (jsxs("div", { className: clsx(styles$g.labelContainer, disabled && styles$g.disabledContainer), children: [jsxs(Label.Root, { className: clsx(styles$g.wrapperLabel, error && !disabled && styles$g.errorLabel, disabled && styles$g.disabledLabel, className), htmlFor: htmlFor, children: [children, required && jsx("span", { className: styles$g.requiredLabel, children: "*" })] }), tooltip && (jsx(Tooltip, { side: side, align: align, text: tooltipText || '', children: jsx("span", { className: disabled ? styles$g.disabledIcon : error ?
|
|
2610
|
+
styles$g.errorIcon : styles$g.infoIcon, children: jsx(Info12Regular, {}) }) }))] }));
|
|
2579
2611
|
|
|
2580
2612
|
const TextField = forwardRef(({ className, value, label, placeholder, type = 'text', onChange, disabled = false, maxLength = 30, required = false, helperText, tooltip = false, tooltipText, side = 'bottom', align = 'start', errorMessage, error, id, icon, onBlur, onFocus, name, persistIcon = false, ...inputProps }, ref) => {
|
|
2581
2613
|
const normalizeValue = (val) => {
|
|
@@ -2637,22 +2669,22 @@ const TextField = forwardRef(({ className, value, label, placeholder, type = 'te
|
|
|
2637
2669
|
: helperText
|
|
2638
2670
|
? `${componentId}-helper`
|
|
2639
2671
|
: undefined;
|
|
2640
|
-
const containerClass = clsx(styles$
|
|
2641
|
-
[styles$
|
|
2642
|
-
[styles$
|
|
2672
|
+
const containerClass = clsx(styles$h.container, {
|
|
2673
|
+
[styles$h.disabled]: disabled,
|
|
2674
|
+
[styles$h.error]: hasError && !disabled,
|
|
2643
2675
|
[className]: className,
|
|
2644
2676
|
});
|
|
2645
|
-
return (jsxs("div", { className: containerClass, children: [label && (jsx(LabelComponent, { htmlFor: componentId, required: required, tooltip: tooltip, tooltipText: tooltipText, side: side, align: align, error: hasError, disabled: disabled, children: label })), jsxs("div", { className: styles$
|
|
2646
|
-
[styles$
|
|
2647
|
-
}) }), showCustomIcon && jsx("span", { className: styles$
|
|
2677
|
+
return (jsxs("div", { className: containerClass, children: [label && (jsx(LabelComponent, { htmlFor: componentId, required: required, tooltip: tooltip, tooltipText: tooltipText, side: side, align: align, error: hasError, disabled: disabled, children: label })), jsxs("div", { className: styles$h.inputWrapper, children: [jsxs("div", { className: styles$h.inputContainer, children: [jsx("input", { ...inputProps, 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({
|
|
2678
|
+
[styles$h.inputWithIcon]: showCustomIcon || showClearIcon,
|
|
2679
|
+
}) }), showCustomIcon && jsx("span", { className: styles$h.icon, children: icon }), showClearIcon && (jsx("button", { type: "button", className: styles$h.clearButton, onMouseDown: (e) => {
|
|
2648
2680
|
e.preventDefault();
|
|
2649
2681
|
handleClear();
|
|
2650
|
-
}, "aria-label": "Limpar campo", tabIndex: -1, children: jsx(Dismiss16Regular, {}) }))] }), jsx("span", { id: helperId, className: styles$
|
|
2682
|
+
}, "aria-label": "Limpar campo", tabIndex: -1, children: jsx(Dismiss16Regular, {}) }))] }), jsx("span", { id: helperId, className: styles$h.helperText, "aria-live": hasError ? 'polite' : undefined, children: displayHelperText })] })] }));
|
|
2651
2683
|
});
|
|
2652
2684
|
TextField.displayName = 'TextField';
|
|
2653
2685
|
var TextField$1 = React__default.memo(TextField);
|
|
2654
2686
|
|
|
2655
|
-
var styles$
|
|
2687
|
+
var styles$f = {"datePicker":"DatePicker-module__datePicker___raJYg","textfieldContainer":"DatePicker-module__textfieldContainer___yy8pT","datePickerIcon":"DatePicker-module__datePickerIcon___XCZsn","datePickerIconDisabled":"DatePicker-module__datePickerIconDisabled___BB-Gx"};
|
|
2656
2688
|
|
|
2657
2689
|
function formatDate(date, locale = 'pt-br') {
|
|
2658
2690
|
if (!date || !(date instanceof Date)) {
|
|
@@ -2873,20 +2905,20 @@ const DatePicker = ({ locale = 'pt-br', calendarSide = 'bottom', calendarAlign =
|
|
|
2873
2905
|
}
|
|
2874
2906
|
}
|
|
2875
2907
|
};
|
|
2876
|
-
return (jsx("div", { ref: wrapperRef, className: styles$
|
|
2908
|
+
return (jsx("div", { ref: wrapperRef, className: styles$f.datePicker, children: jsx(Popover, { open: showCalendar, onOpenChange: setShowCalendar, asAnchor: true, trigger: jsx(TextField$1, { className: styles$f.textfieldContainer, type: "tel", icon: jsx(Calendar16Regular, { onClick: !disabled ? handleIconClick : undefined, className: clsx(styles$f.datePickerIcon, disabled && styles$f.datePickerIconDisabled) }), onChange: (e) => {
|
|
2877
2909
|
handleTextFieldChange(String(e));
|
|
2878
|
-
}, onKeyDown: handleKeyDown, onFocus: handleFocus, persistIcon: true, autoComplete: "off", value: displayValue, helperText:
|
|
2910
|
+
}, onKeyDown: handleKeyDown, onFocus: handleFocus, persistIcon: true, autoComplete: "off", value: displayValue, helperText: !externalError ? (helperText || undefined) : undefined, errorMessage: externalError ? combinedHelperText : undefined, error: hasValidationError ? true : undefined, maxLength: 10, required: required, label: label, disabled: disabled, id: fieldId, "data-testid": testId, placeholder: locale === 'en-us' ? 'MM/DD/YYYY' : 'DD/MM/YYYY', "aria-label": "Open calendar", "aria-expanded": showCalendar, "aria-controls": calendarId, "aria-invalid": hasValidationError, "aria-describedby": externalError ? undefined : (helperText ? `${fieldId}-help` : undefined) }), content: jsx(Calendar, { selected: currentSelectedDate, currentDate: currentDate, onDateChange: setCurrentDate, onDaySelect: handleDaySelect, locale: locale, format: locale === 'en-us' ? 'mm/dd/yyyy' : 'dd/mm/yyyy', minDate: minDate, maxDate: maxDate, id: calendarId, onClear: () => {
|
|
2879
2911
|
handleDateChange(null);
|
|
2880
2912
|
setCurrentDate(new Date());
|
|
2881
2913
|
} }), side: calendarSide, align: calendarAlign, sideOffset: 8 }) }));
|
|
2882
2914
|
};
|
|
2883
2915
|
var DatePicker_default = React__default.memo(DatePicker);
|
|
2884
2916
|
|
|
2885
|
-
var styles$
|
|
2917
|
+
var styles$e = {"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-"};
|
|
2886
2918
|
|
|
2887
|
-
const Dialog = ({ show = false, title, bodyContent, textPrimaryAction, textSecondaryAction, onPrimaryAction, onSecondaryAction, ...restProps }) => (jsx(AlertDialog.Root, { open: show, ...restProps, children: jsxs(AlertDialog.Portal, { children: [jsx(AlertDialog.Overlay, { className: styles$
|
|
2919
|
+
const Dialog = ({ show = false, title, bodyContent, textPrimaryAction, textSecondaryAction, onPrimaryAction, onSecondaryAction, ...restProps }) => (jsx(AlertDialog.Root, { open: show, ...restProps, children: jsxs(AlertDialog.Portal, { children: [jsx(AlertDialog.Overlay, { className: styles$e.DialogOverlay }), jsxs(AlertDialog.Content, { className: styles$e.DialogContent, children: [jsx(AlertDialog.Title, { className: styles$e.DialogTitle, children: title }), jsx(AlertDialog.Description, { className: styles$e.DialogDescription, children: bodyContent }), jsxs("div", { className: styles$e.DivButtons, children: [!!(textSecondaryAction && textSecondaryAction.trim()) && (jsx(AlertDialog.Cancel, { asChild: true, children: jsx(Button, { variant: "outlined", ...(onSecondaryAction && { onClick: onSecondaryAction }), children: textSecondaryAction }) })), jsx(AlertDialog.Action, { asChild: true, children: jsx(Button, { variant: "filled", ...(onPrimaryAction && { onClick: onPrimaryAction }), children: textPrimaryAction }) })] })] })] }) }));
|
|
2888
2920
|
|
|
2889
|
-
var styles$
|
|
2921
|
+
var styles$d = {"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"};
|
|
2890
2922
|
|
|
2891
2923
|
const Drawer = ({ children, headerContent, customWidth = '400px', onClose, title = 'Título', isOpen = false, onOpen, className, id, disabled = false, onOverlayClick, closeOnOverlayClick = true, closeOnEscape = true, }) => {
|
|
2892
2924
|
const internalClose = useCallback(() => {
|
|
@@ -2935,17 +2967,17 @@ const Drawer = ({ children, headerContent, customWidth = '400px', onClose, title
|
|
|
2935
2967
|
event.stopPropagation();
|
|
2936
2968
|
internalClose();
|
|
2937
2969
|
};
|
|
2938
|
-
return createPortal(jsxs(Fragment, { children: [jsx("div", { className: clsx(styles$
|
|
2939
|
-
[styles$
|
|
2940
|
-
}), onClick: handleOverlayClick, role: "presentation", "aria-hidden": "true", "data-testid": "drawer-overlay" }), jsxs("div", { className: clsx(styles$
|
|
2941
|
-
[styles$
|
|
2942
|
-
[styles$
|
|
2970
|
+
return createPortal(jsxs(Fragment, { children: [jsx("div", { className: clsx(styles$d['drawerShadow'], {
|
|
2971
|
+
[styles$d['drawerShadow--visible']]: isOpen,
|
|
2972
|
+
}), onClick: handleOverlayClick, role: "presentation", "aria-hidden": "true", "data-testid": "drawer-overlay" }), jsxs("div", { className: clsx(styles$d['drawerSidebar'], {
|
|
2973
|
+
[styles$d['drawerSidebar--open']]: isOpen,
|
|
2974
|
+
[styles$d['drawerSidebar--disabled']]: disabled,
|
|
2943
2975
|
}, className), style: {
|
|
2944
2976
|
'--drawer-custom-width': customWidth,
|
|
2945
|
-
}, onClick: handleDrawerClick, role: "dialog", "aria-modal": "true", "aria-labelledby": id ? `${id}-title` : 'drawer-title', "aria-hidden": !isOpen, "data-testid": "drawer-panel", id: id, children: [jsxs("div", { className: styles$
|
|
2977
|
+
}, onClick: handleDrawerClick, role: "dialog", "aria-modal": "true", "aria-labelledby": id ? `${id}-title` : 'drawer-title', "aria-hidden": !isOpen, "data-testid": "drawer-panel", id: id, children: [jsxs("div", { className: styles$d.drawerTitleClose, children: [jsx("div", { className: styles$d.drawerTitle, id: id ? `${id}-title` : 'drawer-title', children: title }), headerContent && (jsx("div", { className: styles$d.drawerHeaderContent, children: headerContent })), jsx(Button, { onClick: handleCloseClick, variant: 'outlined', iconOnly: true, icon: jsx(Dismiss16Regular, {}), size: 'lg', tooltipText: 'Fechar' })] }), jsx("div", { className: styles$d.drawerChildren, "data-testid": "drawer-content", children: children })] })] }), document.body);
|
|
2946
2978
|
};
|
|
2947
2979
|
|
|
2948
|
-
var styles$
|
|
2980
|
+
var styles$c = {"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"};
|
|
2949
2981
|
|
|
2950
2982
|
const Search = React__default.forwardRef(({ placeholder = 'Dica do que deve ser buscado', disabled = false, value, onChange, onKeyDown, onFocus, onBlur, onClear, onClick, onMouseDown, id, className, 'data-testid': testId, ...rest }, ref) => {
|
|
2951
2983
|
const [internalValue, setInternalValue] = useState('');
|
|
@@ -2993,16 +3025,16 @@ const Search = React__default.forwardRef(({ placeholder = 'Dica do que deve ser
|
|
|
2993
3025
|
return;
|
|
2994
3026
|
onKeyDown?.(e);
|
|
2995
3027
|
};
|
|
2996
|
-
return (jsxs("div", { className: clsx(styles$
|
|
3028
|
+
return (jsxs("div", { className: clsx(styles$c.search, { [styles$c.disabled]: disabled }, className), onClick: onClick, onMouseDown: onMouseDown, role: onClick || onMouseDown ? "button" : undefined, tabIndex: onClick || onMouseDown ? 0 : undefined, onKeyDown: onClick || onMouseDown ? (e) => {
|
|
2997
3029
|
if (e.key === 'Enter' || e.key === ' ') {
|
|
2998
3030
|
e.preventDefault();
|
|
2999
3031
|
onClick?.(e);
|
|
3000
3032
|
}
|
|
3001
|
-
} : undefined, children: [jsx("span", { className: clsx(styles$
|
|
3033
|
+
} : undefined, children: [jsx("span", { className: clsx(styles$c.searchLeftIcon, { [styles$c.disabled]: disabled }), tabIndex: -1, role: "presentation", "aria-hidden": "true", children: jsx(Search16Regular, {}) }), jsx("input", { ref: ref, id: inputId, type: "text", placeholder: placeholder, "aria-label": placeholder, value: currentValue || '', onChange: handleChange, onKeyDown: handleKeyDown, disabled: disabled, onFocus: handleFocus, onBlur: handleBlur, "data-testid": testId, ...rest, className: clsx({ [styles$c.inputWithClearIcon]: currentValue && currentValue.length > 0 }) }), currentValue && currentValue.length > 0 && (jsx("span", { className: styles$c.searchClearIcon, "aria-hidden": "true", onClick: clearInputSearch, children: jsx(Dismiss16Regular, {}) }))] }));
|
|
3002
3034
|
});
|
|
3003
3035
|
Search.displayName = 'Search';
|
|
3004
3036
|
|
|
3005
|
-
var styles$
|
|
3037
|
+
var styles$b = {"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"};
|
|
3006
3038
|
|
|
3007
3039
|
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 }) => {
|
|
3008
3040
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -3095,34 +3127,34 @@ const Filter = ({ items, type = 'checkbox', selectedIds, onApplyFilter, placehol
|
|
|
3095
3127
|
return null;
|
|
3096
3128
|
return selectedIds.length - 1;
|
|
3097
3129
|
}, [selectedIds]);
|
|
3098
|
-
const filterClass = clsx(styles$
|
|
3099
|
-
const triggerButton = (jsx(Button, { variant: variant, disabled: disabled, icon: type === 'calendar' ? jsx(Calendar16Regular, {}) : jsx(ChevronDownRegular, {}), iconPosition: "right", size: "lg", children: jsxs("div", { className: styles$
|
|
3100
|
-
const popoverContent = type === 'calendar' ? (jsx(Calendar, { currentDate: currentCalendarDate, selected: selectedDate, onDaySelect: handleDateSelection, onDateChange: handleCalendarNavigation, minDate: minDate, maxDate: maxDate, locale: locale, onClear: handleClear, id: `filter-calendar-${id || ''}`, "aria-label": "Selecionar data para filtro" })) : (jsxs("div", { className: styles$
|
|
3130
|
+
const filterClass = clsx(styles$b.container, className);
|
|
3131
|
+
const triggerButton = (jsx(Button, { variant: variant, disabled: disabled, icon: type === 'calendar' ? jsx(Calendar16Regular, {}) : jsx(ChevronDownRegular, {}), iconPosition: "right", size: "lg", children: jsxs("div", { className: styles$b.buttonContent, children: [icon && jsx("span", { className: styles$b.buttonIcon, children: icon }), jsx("span", { className: styles$b.buttonText, children: buttonDisplayText }), jsx("span", { className: clsx(styles$b.buttonArrow, { [styles$b.buttonArrowOpen]: isOpen }), children: getBadgeValue() && (jsx(Badge, { badgeValue: `+${getBadgeValue()}`, type: "status" })) })] }) }));
|
|
3132
|
+
const popoverContent = type === 'calendar' ? (jsx(Calendar, { currentDate: currentCalendarDate, selected: selectedDate, onDaySelect: handleDateSelection, onDateChange: handleCalendarNavigation, minDate: minDate, maxDate: maxDate, locale: locale, onClear: handleClear, id: `filter-calendar-${id || ''}`, "aria-label": "Selecionar data para filtro" })) : (jsxs("div", { className: styles$b.panel, children: [searchVisible && (jsx("div", { className: styles$b.search, children: jsx(Search, { value: searchQuery, placeholder: placeholder, onChange: handleSearchChange, onKeyDown: handleSearchKeyDown, onClear: () => setSearchQuery('') }) })), jsx("ul", { className: styles$b.list, role: "listbox", "aria-multiselectable": type === 'checkbox', children: filteredItems.length > 0 ? (filteredItems.map((item, index) => {
|
|
3101
3133
|
const itemId = item.id || `filter-item-${index}`;
|
|
3102
3134
|
const isSelected = !!tempSelectedItems[itemId];
|
|
3103
|
-
return (jsxs("li", { role: "option", "aria-selected": isSelected, "aria-disabled": item.disabled, className: clsx(styles$
|
|
3104
|
-
[styles$
|
|
3105
|
-
[styles$
|
|
3135
|
+
return (jsxs("li", { role: "option", "aria-selected": isSelected, "aria-disabled": item.disabled, className: clsx(styles$b.item, {
|
|
3136
|
+
[styles$b.itemSelected]: isSelected,
|
|
3137
|
+
[styles$b.itemDisabled]: item.disabled,
|
|
3106
3138
|
}), onMouseDown: (e) => e.preventDefault(), onClick: () => toggleItem(itemId, item), onKeyDown: (e) => {
|
|
3107
3139
|
if (e.key === 'Enter' || e.key === ' ') {
|
|
3108
3140
|
e.preventDefault();
|
|
3109
3141
|
toggleItem(itemId, item);
|
|
3110
3142
|
}
|
|
3111
|
-
}, children: [type === 'checkbox' && (jsx(Checkbox, { checked: isSelected, disabled: item.disabled, label: "" })), type === 'icon' && item.icon && (jsx("span", { className: styles$
|
|
3112
|
-
})) : (jsx("li", { className: styles$
|
|
3143
|
+
}, children: [type === 'checkbox' && (jsx(Checkbox, { checked: isSelected, disabled: item.disabled, label: "" })), type === 'icon' && item.icon && (jsx("span", { className: styles$b.itemIcon, children: item.icon })), jsx("span", { className: styles$b.itemText, children: item.text })] }, itemId));
|
|
3144
|
+
})) : (jsx("li", { className: styles$b.noResults, role: "status", "aria-live": "polite", children: "Nenhum item encontrado" })) }), jsxs("div", { className: styles$b.footer, children: [jsx(Button, { fullWidth: true, variant: "outlined", onClick: handleClearFilter, children: "Limpar" }), jsx(Button, { fullWidth: true, onClick: handleApplyFilter, children: "Aplicar" })] })] }));
|
|
3113
3145
|
return (jsx("div", { className: filterClass, id: id, ...rest, children: jsx(Popover, { open: isOpen, onOpenChange: handleOpenChange, side: side, align: align, onOpenAutoFocus: (e) => e.preventDefault(), trigger: triggerButton, content: popoverContent }) }));
|
|
3114
3146
|
};
|
|
3115
3147
|
|
|
3116
|
-
var styles$
|
|
3148
|
+
var styles$a = {"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"};
|
|
3117
3149
|
|
|
3118
|
-
var styles$
|
|
3150
|
+
var styles$9 = {"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"};
|
|
3119
3151
|
|
|
3120
3152
|
const Radio = ({ items, onValueChange, defaultValue, name, id, ariaLabel, orientation = 'vertical', ...rest }) => {
|
|
3121
3153
|
const componentId = id || useId();
|
|
3122
|
-
return (jsx(RadioGroup.Root, { id: componentId, className: styles$
|
|
3154
|
+
return (jsx(RadioGroup.Root, { id: componentId, className: styles$9.root, defaultValue: defaultValue, onValueChange: onValueChange, name: name, "aria-label": ariaLabel, "data-orientation": orientation, orientation: orientation, ...rest, children: items.map(({ id, value, disabled, label }) => {
|
|
3123
3155
|
const itemKey = id ?? value;
|
|
3124
3156
|
const uniqueId = `${componentId}-item-${value}`;
|
|
3125
|
-
return (jsx("div", { className: clsx(styles$
|
|
3157
|
+
return (jsx("div", { className: clsx(styles$9.wrapper, { [styles$9.disabled]: disabled }), children: jsxs("label", { className: styles$9.labelWrapper, htmlFor: uniqueId, children: [jsx("div", { className: styles$9.itemWrapper, children: jsx(RadioGroup.Item, { disabled: disabled, className: styles$9.item, value: value, id: uniqueId, "data-disabled": disabled, children: jsx(RadioGroup.Indicator, { className: styles$9.indicator }) }) }), jsx("span", { className: styles$9.labelText, children: label })] }) }, itemKey));
|
|
3126
3158
|
}) }));
|
|
3127
3159
|
};
|
|
3128
3160
|
|
|
@@ -3184,24 +3216,24 @@ const ListItem = ({ id, className, variant = 'text', text, name, subText, disabl
|
|
|
3184
3216
|
const currentVariant = validVariants.includes(variant) ? variant : 'text';
|
|
3185
3217
|
switch (currentVariant) {
|
|
3186
3218
|
case 'checkbox':
|
|
3187
|
-
return (jsxs(Fragment, { children: [jsx(Checkbox, { checked: internalChecked, disabled: disabled, onCheckedChange: () => handleCheckboxClick({}) }), jsxs("div", { className: styles$
|
|
3219
|
+
return (jsxs(Fragment, { children: [jsx(Checkbox, { checked: internalChecked, disabled: disabled, onCheckedChange: () => handleCheckboxClick({}) }), jsxs("div", { className: styles$a['zds-list-item__wrapper-text'], children: [jsx("span", { id: `${itemId}-text`, className: styles$a['zds-list-item__text'], onClick: handleCheckboxClick, children: text }), showSubText && subText && (jsx("span", { id: `${itemId}-subtext`, className: styles$a['zds-list-item__subtext'], onClick: handleCheckboxClick, children: subText }))] })] }));
|
|
3188
3220
|
case 'radio':
|
|
3189
|
-
return (jsxs(Fragment, { children: [jsx("div", { className: styles$
|
|
3221
|
+
return (jsxs(Fragment, { children: [jsx("div", { className: styles$a['zds-list-item__wrapper-radio'], children: jsx("span", { className: styles$a['zds-list-item__radio'], "aria-hidden": "true", children: jsx(Radio, { name: name, onValueChange: () => handleRadioClick({}), items: [{
|
|
3190
3222
|
value: value || '',
|
|
3191
3223
|
label: '',
|
|
3192
3224
|
disabled: disabled
|
|
3193
|
-
}], "aria-labelledby": `${itemId}-text` }) }) }), jsxs("div", { className: styles$
|
|
3225
|
+
}], "aria-labelledby": `${itemId}-text` }) }) }), jsxs("div", { className: styles$a['zds-list-item__wrapper-text'], children: [jsx("span", { id: `${itemId}-text`, className: styles$a['zds-list-item__title'], onClick: handleRadioClick, children: text }), showSubText && subText && (jsx("span", { id: `${itemId}-subtext`, className: styles$a['zds-list-item__subtext'], children: subText }))] })] }));
|
|
3194
3226
|
case 'icon':
|
|
3195
|
-
return (jsxs(Fragment, { children: [jsx("div", { className: styles$
|
|
3227
|
+
return (jsxs(Fragment, { children: [jsx("div", { className: styles$a['zds-list-item__wrapper-icon'], children: icon }), jsxs("div", { className: styles$a['zds-list-item__wrapper-text'], children: [jsx("span", { id: `${itemId}-text`, className: styles$a['zds-list-item__title'], onClick: handleTextOrIconClick, children: text }), showSubText && subText && (jsx("span", { id: `${itemId}-subtext`, className: styles$a['zds-list-item__subtext'], children: subText }))] })] }));
|
|
3196
3228
|
case 'text':
|
|
3197
3229
|
default:
|
|
3198
|
-
return (jsxs("div", { className: styles$
|
|
3230
|
+
return (jsxs("div", { className: styles$a['zds-list-item__wrapper-text'], children: [jsx("span", { id: `${itemId}-text`, className: styles$a['zds-list-item__title'], onClick: handleTextOrIconClick, children: text }), showSubText && subText && (jsx("span", { id: `${itemId}-subtext`, className: styles$a['zds-list-item__subtext'], children: subText }))] }));
|
|
3199
3231
|
}
|
|
3200
3232
|
}, [variant, itemId, internalChecked, disabled, handleCheckboxClick, handleRadioClick, handleTextOrIconClick, value, text, showSubText, subText, icon, name]);
|
|
3201
|
-
const listItemClass = clsx(styles$
|
|
3202
|
-
[styles$
|
|
3203
|
-
[styles$
|
|
3204
|
-
[styles$
|
|
3233
|
+
const listItemClass = clsx(styles$a['zds-list-item__container'], {
|
|
3234
|
+
[styles$a[`zds-list-item--${variant}`]]: variant,
|
|
3235
|
+
[styles$a['zds-list-item--disabled']]: disabled,
|
|
3236
|
+
[styles$a['zds-list-item--hovered']]: hovered,
|
|
3205
3237
|
[className || '']: className
|
|
3206
3238
|
});
|
|
3207
3239
|
const getAriaChecked = useCallback(() => {
|
|
@@ -3213,13 +3245,13 @@ const ListItem = ({ id, className, variant = 'text', text, name, subText, disabl
|
|
|
3213
3245
|
return (jsx("li", { className: listItemClass, tabIndex: disabled ? -1 : 0, onKeyDown: handleKeyDown, "aria-selected": variant === 'text' || variant === 'icon' ? internalSelected : undefined, "aria-disabled": disabled, "aria-checked": getAriaChecked(), "aria-labelledby": `${itemId}-text`, "aria-describedby": showSubText && subText ? `${itemId}-subtext` : undefined, "data-testid": "list-item", ...rest, children: renderVariantContent() }));
|
|
3214
3246
|
};
|
|
3215
3247
|
|
|
3216
|
-
var styles$
|
|
3248
|
+
var styles$8 = {"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"};
|
|
3217
3249
|
|
|
3218
3250
|
const MenuItem = memo(({ item, isSelected, onSelect }) => {
|
|
3219
3251
|
const handleSelect = () => {
|
|
3220
3252
|
onSelect(item);
|
|
3221
3253
|
};
|
|
3222
|
-
return (jsxs(DropdownMenu.Item, { className: clsx(styles$
|
|
3254
|
+
return (jsxs(DropdownMenu.Item, { className: clsx(styles$8.item), "data-selected": isSelected || undefined, onSelect: handleSelect, disabled: item.disabled, children: [item.icon && jsx("span", { className: styles$8.itemIcon, children: item.icon }), jsxs("div", { className: styles$8.wrapperText, children: [jsx("span", { className: styles$8.itemText, children: item.text }), item.subText && (jsx("span", { className: styles$8.itemSubText, children: item.subText }))] })] }));
|
|
3223
3255
|
});
|
|
3224
3256
|
MenuItem.displayName = 'MenuItem';
|
|
3225
3257
|
|
|
@@ -3441,72 +3473,84 @@ const Menu = ({ items, children, onItemSelect, search, enableInfiniteScroll, onS
|
|
|
3441
3473
|
const renderMenuItem = useCallback((item, key) => {
|
|
3442
3474
|
const hasChildren = item.children && item.children.length > 0;
|
|
3443
3475
|
if (hasChildren) {
|
|
3444
|
-
return (jsxs(DropdownMenu.Sub, { children: [jsxs(DropdownMenu.SubTrigger, { className: styles$
|
|
3476
|
+
return (jsxs(DropdownMenu.Sub, { children: [jsxs(DropdownMenu.SubTrigger, { className: styles$8.subTrigger, disabled: item.disabled, children: [item.icon && (jsx("span", { className: styles$8.itemIcon, children: item.icon })), jsxs("div", { className: styles$8.wrapperText, children: [jsx("span", { className: styles$8.itemText, children: item.text }), item.subText && (jsx("span", { className: styles$8.itemSubText, children: item.subText }))] }), jsx(ChevronRight16Filled, { className: styles$8.chevronIcon })] }), jsx(DropdownMenu.Portal, { children: jsx(DropdownMenu.SubContent, { className: styles$8.subContent, sideOffset: 16, collisionPadding: 20, children: item.children.map((childItem, childIndex) => renderMenuItem(childItem, `${key}-${childIndex}`)) }) })] }, key));
|
|
3445
3477
|
}
|
|
3446
3478
|
return (jsx(MenuItem, { item: item, isSelected: isItemSelected(item), onSelect: handleItemSelect }, key));
|
|
3447
3479
|
}, [handleItemSelect, isItemSelected]);
|
|
3480
|
+
const closedByPointerRef = useRef(false);
|
|
3448
3481
|
const handleOpenChange = (newOpen) => {
|
|
3449
3482
|
setOpen(newOpen);
|
|
3450
3483
|
if (!newOpen) {
|
|
3451
3484
|
hasReachedEndRef.current = false;
|
|
3452
3485
|
}
|
|
3453
3486
|
};
|
|
3454
|
-
return (jsxs(DropdownMenu.Root, { open: open, onOpenChange: handleOpenChange, children: [jsx(DropdownMenu.Trigger, { asChild: true, children: children }), jsx(DropdownMenu.Portal, { children: jsxs(DropdownMenu.Content, { className: clsx(styles$
|
|
3487
|
+
return (jsxs(DropdownMenu.Root, { open: open, onOpenChange: handleOpenChange, children: [jsx(DropdownMenu.Trigger, { asChild: true, children: children }), jsx(DropdownMenu.Portal, { children: jsxs(DropdownMenu.Content, { className: clsx(styles$8.content, className), sideOffset: 8, align: align, onPointerDown: () => { closedByPointerRef.current = true; }, onInteractOutside: () => { closedByPointerRef.current = true; }, onCloseAutoFocus: (e) => {
|
|
3488
|
+
if (closedByPointerRef.current) {
|
|
3489
|
+
e.preventDefault();
|
|
3490
|
+
closedByPointerRef.current = false;
|
|
3491
|
+
}
|
|
3492
|
+
}, onKeyDown: (e) => {
|
|
3455
3493
|
if (search) {
|
|
3456
3494
|
e.stopPropagation();
|
|
3457
3495
|
}
|
|
3458
|
-
}, ...rest, children: [search && (jsx("div", { className: styles$
|
|
3496
|
+
}, ...rest, children: [search && (jsx("div", { className: styles$8.searchWrapper, children: jsx(Search, { placeholder: "Buscar", onChange: handleSearchChange, value: searchInput, onKeyDown: handleSearchKeyDown }) })), jsxs("div", { className: styles$8.itemsWrapper, ref: itemsWrapperRef, style: { maxHeight: maxHeightStyle }, children: [filteredItems.length > 0 ? (filteredItems.map((item, index) => renderMenuItem(item, item.value || item.text || `item-${index}`))) : (jsx("div", { className: styles$8.emptyState, children: "Nenhum item encontrado" })), enableInfiniteScroll && isLoadingMore && (jsx("div", { className: styles$8.loadingMore, children: "Carregando mais itens..." })), enableInfiniteScroll && (jsx("div", { ref: sentinelRef, "data-scroll-sentinel": true, style: { height: '1px', visibility: 'hidden' } }))] })] }) })] }));
|
|
3497
|
+
};
|
|
3498
|
+
|
|
3499
|
+
var styles$7 = {"modalOverlay":"Modal-module__modalOverlay___rI8Wz","modalContent":"Modal-module__modalContent___6Cgb1","modalContent--fullscreen":"Modal-module__modalContent--fullscreen___QeBlG","modalHeader":"Modal-module__modalHeader___IuHIg","modalTitle":"Modal-module__modalTitle___9VDmr","modalBody":"Modal-module__modalBody___ohjQm"};
|
|
3500
|
+
|
|
3501
|
+
const Modal = ({ isOpen = false, onClose, title, children, headerContent, closeOnOverlayClick = true, className, id, footer, customWidth, fullscreen = false, }) => {
|
|
3502
|
+
const handleOpenChange = (open) => {
|
|
3503
|
+
if (!open) {
|
|
3504
|
+
onClose();
|
|
3505
|
+
}
|
|
3506
|
+
};
|
|
3507
|
+
return (jsx(Dialog$1.Root, { open: isOpen, onOpenChange: handleOpenChange, children: jsxs(Dialog$1.Portal, { children: [jsx(Dialog$1.Overlay, { className: styles$7.modalOverlay }), jsxs(Dialog$1.Content, { className: clsx(styles$7.modalContent, fullscreen && styles$7['modalContent--fullscreen'], className), id: id, style: {
|
|
3508
|
+
'--modal-custom-width': customWidth,
|
|
3509
|
+
}, onInteractOutside: !closeOnOverlayClick ? (e) => e.preventDefault() : undefined, "aria-labelledby": id ? `${id}-title` : 'modal-title', children: [jsxs("div", { className: styles$7.modalHeader, children: [title && (jsx(Dialog$1.Title, { className: styles$7.modalTitle, id: id ? `${id}-title` : 'modal-title', children: title })), headerContent && (jsx("div", { children: headerContent })), jsx(Dialog$1.Close, { asChild: true, children: jsx(Button, { variant: "outlined", iconOnly: true, icon: jsx(Dismiss16Regular, {}), size: "lg", tooltipText: 'Fechar' }) })] }), jsx("div", { className: styles$7.modalBody, children: children }), footer && (jsx("div", { className: styles$7.modalFooter, children: footer }))] })] }) }));
|
|
3459
3510
|
};
|
|
3460
3511
|
|
|
3461
|
-
var styles$6 = {"
|
|
3512
|
+
var styles$6 = {"quantity":"Quantity-module__quantity___-vndR","quantityInput":"Quantity-module__quantityInput___xZG-v","disabled":"Quantity-module__disabled___X6p5l"};
|
|
3462
3513
|
|
|
3463
|
-
const Quantity = ({
|
|
3464
|
-
const
|
|
3465
|
-
const [
|
|
3466
|
-
const [inputValue, setInputValue] = useState(decimal
|
|
3467
|
-
? (isControlled ? controlledValue : defaultValue).toFixed(decimalPlaces)
|
|
3468
|
-
: String(isControlled ? controlledValue : defaultValue));
|
|
3514
|
+
const Quantity = ({ value = 0, onChange, disabled = false, decimal = false, decimalPlaces = 2, size = 'lg', id, valueIncrement = 1, className, inputSize, minValue = 0, maxValue = 9999, decrementAriaLabel = 'Decrease quantity', incrementAriaLabel = 'Increase quantity', inputAriaLabel = 'Quantity', ...rest }) => {
|
|
3515
|
+
const initialValue = Math.min(Math.max(value, minValue), maxValue);
|
|
3516
|
+
const [internalValue, setInternalValue] = useState(initialValue);
|
|
3517
|
+
const [inputValue, setInputValue] = useState(decimal ? initialValue.toFixed(decimalPlaces) : String(initialValue));
|
|
3469
3518
|
const inputRef = useRef(null);
|
|
3470
|
-
const stepValue =
|
|
3471
|
-
const
|
|
3472
|
-
const
|
|
3473
|
-
const validateProps = (decimalPlaces,
|
|
3519
|
+
const stepValue = valueIncrement !== undefined ? valueIncrement : decimal ? Math.pow(10, -decimalPlaces) : 1;
|
|
3520
|
+
const isMinValue = useMemo(() => internalValue <= minValue, [internalValue, minValue]);
|
|
3521
|
+
const isMaxValue = useMemo(() => internalValue >= maxValue, [internalValue, maxValue]);
|
|
3522
|
+
const validateProps = (decimalPlaces, valueIncrement) => {
|
|
3474
3523
|
if (decimalPlaces !== undefined && (decimalPlaces < 1 || decimalPlaces > 10)) {
|
|
3475
3524
|
console.warn('decimalPlaces deve estar entre 1 e 10');
|
|
3476
3525
|
}
|
|
3477
|
-
if (
|
|
3478
|
-
console.warn('
|
|
3526
|
+
if (valueIncrement !== undefined && valueIncrement <= 0) {
|
|
3527
|
+
console.warn('valueIncrement deve ser maior que 0');
|
|
3479
3528
|
}
|
|
3480
3529
|
};
|
|
3481
3530
|
useEffect(() => {
|
|
3482
|
-
validateProps(decimalPlaces,
|
|
3531
|
+
validateProps(decimalPlaces, valueIncrement);
|
|
3483
3532
|
}, []);
|
|
3484
3533
|
useEffect(() => {
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
}, [controlledValue, decimal, decimalPlaces, isControlled]);
|
|
3534
|
+
const clamped = Math.min(Math.max(value, minValue), maxValue);
|
|
3535
|
+
setInternalValue(clamped);
|
|
3536
|
+
setInputValue(decimal ? clamped.toFixed(decimalPlaces) : String(clamped));
|
|
3537
|
+
}, [value, minValue, maxValue, decimal, decimalPlaces]);
|
|
3490
3538
|
const increment = useCallback(() => {
|
|
3491
3539
|
if (disabled)
|
|
3492
3540
|
return;
|
|
3493
|
-
const newValue =
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
setInputValue(decimal ? newValue.toFixed(decimalPlaces) : String(newValue));
|
|
3497
|
-
}
|
|
3541
|
+
const newValue = Math.min(maxValue, internalValue + stepValue);
|
|
3542
|
+
setInternalValue(newValue);
|
|
3543
|
+
setInputValue(decimal ? newValue.toFixed(decimalPlaces) : String(newValue));
|
|
3498
3544
|
onChange?.(newValue);
|
|
3499
|
-
}, [disabled,
|
|
3545
|
+
}, [disabled, internalValue, stepValue, decimal, decimalPlaces, onChange, maxValue]);
|
|
3500
3546
|
const decrement = useCallback(() => {
|
|
3501
3547
|
if (disabled)
|
|
3502
3548
|
return;
|
|
3503
|
-
const newValue = Math.max(
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
setInputValue(decimal ? newValue.toFixed(decimalPlaces) : String(newValue));
|
|
3507
|
-
}
|
|
3549
|
+
const newValue = Math.max(minValue, internalValue - stepValue);
|
|
3550
|
+
setInternalValue(newValue);
|
|
3551
|
+
setInputValue(decimal ? newValue.toFixed(decimalPlaces) : String(newValue));
|
|
3508
3552
|
onChange?.(newValue);
|
|
3509
|
-
}, [disabled,
|
|
3553
|
+
}, [disabled, internalValue, stepValue, decimal, decimalPlaces, onChange, minValue]);
|
|
3510
3554
|
const filterInput = useCallback((inputValue) => {
|
|
3511
3555
|
if (decimal) {
|
|
3512
3556
|
let filtered = inputValue.replace(/[^\d.]/g, '');
|
|
@@ -3534,9 +3578,6 @@ const Quantity = ({ defaultValue = 0, value: controlledValue, onChange, disabled
|
|
|
3534
3578
|
const filteredValue = filterInput(rawValue);
|
|
3535
3579
|
setInputValue(filteredValue);
|
|
3536
3580
|
if (filteredValue === '' || filteredValue === '.') {
|
|
3537
|
-
if (!isControlled) {
|
|
3538
|
-
setValue(0);
|
|
3539
|
-
}
|
|
3540
3581
|
onChange?.(0);
|
|
3541
3582
|
return;
|
|
3542
3583
|
}
|
|
@@ -3546,31 +3587,24 @@ const Quantity = ({ defaultValue = 0, value: controlledValue, onChange, disabled
|
|
|
3546
3587
|
}
|
|
3547
3588
|
const parsedValue = parseFloat(filteredValue);
|
|
3548
3589
|
if (!isNaN(parsedValue)) {
|
|
3549
|
-
if (!isControlled) {
|
|
3550
|
-
setValue(parsedValue);
|
|
3551
|
-
}
|
|
3552
3590
|
onChange?.(parsedValue);
|
|
3553
3591
|
}
|
|
3554
3592
|
}
|
|
3555
3593
|
else {
|
|
3556
3594
|
const parsedValue = parseInt(filteredValue, 10);
|
|
3557
3595
|
if (!isNaN(parsedValue)) {
|
|
3558
|
-
const validValue = Math.min(parsedValue,
|
|
3559
|
-
if (!isControlled) {
|
|
3560
|
-
setValue(validValue);
|
|
3561
|
-
}
|
|
3596
|
+
const validValue = Math.min(Math.max(parsedValue, minValue), maxValue);
|
|
3562
3597
|
onChange?.(validValue);
|
|
3563
3598
|
}
|
|
3564
3599
|
}
|
|
3565
|
-
}, [disabled, decimal,
|
|
3600
|
+
}, [disabled, decimal, filterInput, onChange, minValue, maxValue]);
|
|
3566
3601
|
const handleBlur = useCallback(() => {
|
|
3567
3602
|
if (disabled)
|
|
3568
3603
|
return;
|
|
3569
3604
|
const currentValue = inputValue.trim();
|
|
3570
3605
|
if (decimal) {
|
|
3571
3606
|
if (currentValue === '' || currentValue === '.') {
|
|
3572
|
-
|
|
3573
|
-
setInputValue(resetValue.toFixed(decimalPlaces));
|
|
3607
|
+
setInputValue(internalValue.toFixed(decimalPlaces));
|
|
3574
3608
|
return;
|
|
3575
3609
|
}
|
|
3576
3610
|
if (currentValue.endsWith('.')) {
|
|
@@ -3578,46 +3612,40 @@ const Quantity = ({ defaultValue = 0, value: controlledValue, onChange, disabled
|
|
|
3578
3612
|
if (!isNaN(baseValue)) {
|
|
3579
3613
|
const formattedValue = baseValue.toFixed(decimalPlaces);
|
|
3580
3614
|
setInputValue(formattedValue);
|
|
3581
|
-
|
|
3582
|
-
setValue(baseValue);
|
|
3583
|
-
}
|
|
3615
|
+
setInternalValue(baseValue);
|
|
3584
3616
|
onChange?.(baseValue);
|
|
3585
3617
|
}
|
|
3586
3618
|
return;
|
|
3587
3619
|
}
|
|
3588
3620
|
const parsedValue = parseFloat(currentValue);
|
|
3589
3621
|
if (!isNaN(parsedValue)) {
|
|
3590
|
-
const normalizedValue = Math.max(
|
|
3622
|
+
const normalizedValue = Math.min(Math.max(parsedValue, minValue), maxValue);
|
|
3591
3623
|
const formattedValue = normalizedValue.toFixed(decimalPlaces);
|
|
3592
3624
|
setInputValue(formattedValue);
|
|
3593
|
-
|
|
3594
|
-
setValue(normalizedValue);
|
|
3595
|
-
}
|
|
3625
|
+
setInternalValue(normalizedValue);
|
|
3596
3626
|
onChange?.(normalizedValue);
|
|
3597
3627
|
}
|
|
3598
3628
|
else {
|
|
3599
|
-
setInputValue(
|
|
3629
|
+
setInputValue(internalValue.toFixed(decimalPlaces));
|
|
3600
3630
|
}
|
|
3601
3631
|
}
|
|
3602
3632
|
else {
|
|
3603
3633
|
if (currentValue === '') {
|
|
3604
|
-
setInputValue(String(
|
|
3634
|
+
setInputValue(String(internalValue));
|
|
3605
3635
|
return;
|
|
3606
3636
|
}
|
|
3607
3637
|
const parsedValue = parseInt(currentValue, 10);
|
|
3608
3638
|
if (isNaN(parsedValue)) {
|
|
3609
|
-
setInputValue(String(
|
|
3639
|
+
setInputValue(String(internalValue));
|
|
3610
3640
|
}
|
|
3611
3641
|
else {
|
|
3612
|
-
const normalizedValue = Math.
|
|
3642
|
+
const normalizedValue = Math.min(Math.max(parsedValue, minValue), maxValue);
|
|
3613
3643
|
setInputValue(String(normalizedValue));
|
|
3614
|
-
|
|
3615
|
-
setValue(normalizedValue);
|
|
3616
|
-
}
|
|
3644
|
+
setInternalValue(normalizedValue);
|
|
3617
3645
|
onChange?.(normalizedValue);
|
|
3618
3646
|
}
|
|
3619
3647
|
}
|
|
3620
|
-
}, [disabled, decimal, inputValue, decimalPlaces,
|
|
3648
|
+
}, [disabled, decimal, inputValue, decimalPlaces, internalValue, onChange, minValue, maxValue]);
|
|
3621
3649
|
const handleInputKeyDown = useCallback((e) => {
|
|
3622
3650
|
if (disabled)
|
|
3623
3651
|
return;
|
|
@@ -3639,40 +3667,35 @@ const Quantity = ({ defaultValue = 0, value: controlledValue, onChange, disabled
|
|
|
3639
3667
|
case 'Escape':
|
|
3640
3668
|
e.preventDefault();
|
|
3641
3669
|
if (inputRef.current) {
|
|
3642
|
-
setInputValue(decimal ?
|
|
3670
|
+
setInputValue(decimal ? internalValue.toFixed(decimalPlaces) : String(internalValue));
|
|
3643
3671
|
inputRef.current.blur();
|
|
3644
3672
|
}
|
|
3645
3673
|
break;
|
|
3646
3674
|
case 'Home':
|
|
3647
3675
|
e.preventDefault();
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
setValue(minValue);
|
|
3651
|
-
setInputValue(decimal ? minValue.toFixed(decimalPlaces) : String(minValue));
|
|
3652
|
-
}
|
|
3676
|
+
setInternalValue(minValue);
|
|
3677
|
+
setInputValue(decimal ? minValue.toFixed(decimalPlaces) : String(minValue));
|
|
3653
3678
|
onChange?.(minValue);
|
|
3654
3679
|
break;
|
|
3655
3680
|
case 'End':
|
|
3656
3681
|
if (!decimal) {
|
|
3657
3682
|
e.preventDefault();
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
setValue(maxValue);
|
|
3661
|
-
setInputValue(String(maxValue));
|
|
3662
|
-
}
|
|
3683
|
+
setInternalValue(maxValue);
|
|
3684
|
+
setInputValue(String(maxValue));
|
|
3663
3685
|
onChange?.(maxValue);
|
|
3664
3686
|
}
|
|
3665
3687
|
break;
|
|
3666
3688
|
}
|
|
3667
|
-
}, [disabled, increment, decrement, decimal, decimalPlaces,
|
|
3689
|
+
}, [disabled, increment, decrement, decimal, decimalPlaces, onChange, internalValue, minValue, maxValue]);
|
|
3690
|
+
const inputSizeValue = inputSize !== undefined ? inputSize : Math.max(1, inputValue.length);
|
|
3668
3691
|
const uniqueId = useId();
|
|
3669
3692
|
const inputId = id || uniqueId;
|
|
3670
|
-
return (jsxs("div", { className: clsx(styles$6
|
|
3693
|
+
return (jsxs("div", { className: clsx(styles$6.quantity, { [styles$6.disabled]: disabled }, className), ...rest, children: [jsx(Button, { variant: 'outlined', size: size, type: 'button', iconOnly: true, icon: jsx(Subtract16Regular, {}), onClick: decrement, disabled: disabled || isMinValue, "aria-label": decrementAriaLabel, tooltipText: 'Diminuir' }), jsx("input", { ref: inputRef, className: clsx(styles$6.quantityInput, { [styles$6.disabled]: disabled }), type: 'text', value: inputValue, onChange: handleInputChange, onBlur: handleBlur, onKeyDown: handleInputKeyDown, id: inputId, step: stepValue, "aria-label": inputAriaLabel, role: 'spinbutton', "aria-valuenow": internalValue, "aria-valuemin": minValue, "aria-valuemax": maxValue, disabled: disabled, inputMode: decimal ? 'decimal' : 'numeric', size: inputSizeValue }), jsx(Button, { variant: 'outlined', size: size, type: 'button', iconOnly: true, onClick: increment, disabled: disabled || isMaxValue, "aria-label": incrementAriaLabel, icon: jsx(Add16Regular, {}), tooltipText: 'Aumentar' })] }));
|
|
3671
3694
|
};
|
|
3672
3695
|
const memorizedQuantity = React__default.memo(Quantity);
|
|
3673
3696
|
memorizedQuantity.displayName = 'Quantity';
|
|
3674
3697
|
|
|
3675
|
-
var styles$5 = {"fieldContainer":"
|
|
3698
|
+
var styles$5 = {"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-"};
|
|
3676
3699
|
|
|
3677
3700
|
const CheckboxSelectItem = ({ text, subTitle, disabled, checked, onCheckedChange, value, ...restProps }) => {
|
|
3678
3701
|
const itemRef = useRef(null);
|
|
@@ -3747,12 +3770,12 @@ const ExpandableSelectItem = ({ item, variant, onSelect, selectedValues, level =
|
|
|
3747
3770
|
}, role: "button", tabIndex: item.disabled ? -1 : 0, "data-disabled": item.disabled || undefined, "data-selected": isSelected && !hasChildren ? 'true' : undefined, "data-testid": `select-item-${item.value}`, children: [variant === 'icon' && item.icon && (jsx("span", { className: styles$5.icon, children: item.icon })), jsxs("div", { className: styles$5.textContent, children: [jsx("div", { className: styles$5.title, children: item.text }), item.subTitle && jsx("div", { className: styles$5.subTitle, children: item.subTitle })] }), hasChildren && (jsx("span", { className: styles$5.chevron, children: isExpanded ? jsx(ChevronDown16Regular, {}) : jsx(ChevronRight16Regular, {}) }))] }) }), hasChildren && isExpanded && (jsx("div", { className: styles$5.childrenWrapper, children: item.children.map((child) => (jsx(ExpandableSelectItem, { item: child, variant: variant, onSelect: onSelect, selectedValues: selectedValues, level: level + 1 }, child.id || child.value))) }))] }));
|
|
3748
3771
|
};
|
|
3749
3772
|
|
|
3750
|
-
const SelectItem = React__default.forwardRef(({ text, subTitle, icon, disabled, value, variant, ...restProps }, ref) => {
|
|
3773
|
+
const SelectItem = React__default.forwardRef(({ text, subTitle, icon, disabled, value, variant, disableFocusOnHover, ...restProps }, ref) => {
|
|
3751
3774
|
return (jsxs("div", { className: clsx(styles$5.itemWrapper, {
|
|
3752
3775
|
[styles$5.disabled]: disabled,
|
|
3753
3776
|
}), "data-disabled": disabled || undefined, "data-testid": `select-item-${value}`, ref: ref, children: [variant === 'icon' && icon && (jsx("span", { className: styles$5.icon, children: icon })), jsxs(Select$1.Item, { className: clsx(styles$5.item, {
|
|
3754
3777
|
[styles$5.disabled]: disabled,
|
|
3755
|
-
}), value: value, disabled: disabled, ...restProps, children: [jsx(Select$1.ItemText, { className: styles$5.title, children: text }), subTitle && jsx("div", { className: styles$5.subTitle, children: subTitle }), jsx(Select$1.ItemIndicator, { className: styles$5.itemIndicator })] })] }));
|
|
3778
|
+
}), value: value, disabled: disabled, onPointerMove: disableFocusOnHover ? (e) => e.preventDefault() : undefined, ...restProps, children: [jsx(Select$1.ItemText, { className: styles$5.title, children: text }), subTitle && jsx("div", { className: styles$5.subTitle, children: subTitle }), jsx(Select$1.ItemIndicator, { className: styles$5.itemIndicator })] })] }));
|
|
3756
3779
|
});
|
|
3757
3780
|
SelectItem.displayName = 'SelectItem';
|
|
3758
3781
|
|
|
@@ -4061,14 +4084,14 @@ const Select = ({ items, onValueChange, onOpenChange, variant, required = false,
|
|
|
4061
4084
|
onApiSearch('');
|
|
4062
4085
|
}
|
|
4063
4086
|
};
|
|
4064
|
-
return (jsx(Select$1.Root, { value: variant === 'checkbox' ? '' : (state.selectedValues[0] || ''), onValueChange: variant === 'checkbox' ? undefined : actions.handleSingleSelect, required: required, open: state.isOpen, onOpenChange: actions.setOpen, disabled: disabled, ...restProps, children: jsxs("div", { className: clsx(styles$5.container, className), style: containerStyle, "data-testid": testId, children: [jsx("div", { className: styles$5.fieldContainer, children: jsxs("div", { className: styles$5.containerLabel, children: [jsx(LabelComponent, { htmlFor: selectId, required: required, tooltipText: tooltipText, tooltip: tooltip, side: side, align: align, error: state.hasError && state.touched, disabled: disabled, children: label }), jsxs(Select$1.Trigger, { className: clsx(styles$5.trigger, {
|
|
4087
|
+
return (jsx(Select$1.Root, { value: variant === 'checkbox' || (search && state.isOpen) ? '' : (state.selectedValues[0] || ''), onValueChange: variant === 'checkbox' ? undefined : actions.handleSingleSelect, required: required, open: state.isOpen, onOpenChange: actions.setOpen, disabled: disabled, ...restProps, children: jsxs("div", { className: clsx(styles$5.container, className), style: containerStyle, "data-testid": testId, children: [jsx("div", { className: styles$5.fieldContainer, children: jsxs("div", { className: styles$5.containerLabel, children: [jsx(LabelComponent, { htmlFor: selectId, required: required, tooltipText: tooltipText, tooltip: tooltip, side: side, align: align, error: state.hasError && state.touched, disabled: disabled, children: label }), jsxs(Select$1.Trigger, { className: clsx(styles$5.trigger, {
|
|
4065
4088
|
[styles$5.error]: state.hasError && state.touched,
|
|
4066
4089
|
[styles$5.disabled]: disabled,
|
|
4067
4090
|
[styles$5.hasValue]: state.selectedValues.length > 0,
|
|
4068
4091
|
[styles$5.open]: state.isOpen,
|
|
4069
4092
|
}), id: selectId, "aria-label": ariaLabel, "data-testid": `${testId}-trigger`, children: [variant === 'checkbox' ? (jsx("span", { className: styles$5.triggerText, children: displayText })) : (jsx(Select$1.Value, { placeholder: placeholder, className: styles$5.placeholder, children: displayText })), state.isOpen ? jsx(ChevronUp16Regular, {}) : jsx(ChevronDown16Regular, {})] }), !state.isOpen && helperText && !state.hasError && (jsx("span", { className: clsx(styles$5.helper, {
|
|
4070
4093
|
[styles$5.disabled]: disabled
|
|
4071
|
-
}), children: helperText })), state.hasError && state.touched && (jsx("span", { className: styles$5.errorMessage, children: errorMessage || 'Campo obrigatório' }))] }) }), jsx(Select$1.Portal, { children: jsxs(Select$1.Content, { className: styles$5.content, position: "popper", side: "bottom", sideOffset: 8, align: "start", avoidCollisions: true, children: [search && (jsx("div", { className: styles$5.searchWrapper, children: jsx(Search, { ref: refs.searchInputRef, className: styles$5.search, placeholder: "Buscar", value: state.searchInput, onChange: handleSearchChange, onKeyDown: handleSearchKeyDown, onClear: handleClear, "data-testid": `${testId}-search` }) })), jsx(Select$1.Viewport, { ref: viewportRef, className: styles$5.viewport, children: jsx(Select$1.Group, { className: styles$5.group, children: filteredItems.length === 0 ? (jsx("div", { className: styles$5.noResults, children: "Nenhum resultado encontrado" })) : (jsxs(Fragment, { children: [filteredItems.map((item) => {
|
|
4094
|
+
}), children: helperText })), state.hasError && state.touched && (jsx("span", { className: styles$5.errorMessage, children: errorMessage || 'Campo obrigatório' }))] }) }), jsx(Select$1.Portal, { children: jsxs(Select$1.Content, { className: styles$5.content, position: "popper", side: "bottom", sideOffset: 8, align: "start", avoidCollisions: true, children: [search && (jsx("div", { className: styles$5.searchWrapper, children: jsx(Search, { ref: refs.searchInputRef, className: styles$5.search, placeholder: "Buscar", value: state.searchInput, onChange: handleSearchChange, onKeyDown: handleSearchKeyDown, onClear: handleClear, "data-testid": `${testId}-search` }) })), jsx(Select$1.Viewport, { ref: viewportRef, className: styles$5.viewport, "data-testid": testId ? `${testId}-viewport` : undefined, children: jsx(Select$1.Group, { className: styles$5.group, children: filteredItems.length === 0 ? (jsx("div", { className: styles$5.noResults, children: "Nenhum resultado encontrado" })) : (jsxs(Fragment, { children: [filteredItems.map((item) => {
|
|
4072
4095
|
const hasChildren = item.children && item.children.length > 0;
|
|
4073
4096
|
if (hasChildren) {
|
|
4074
4097
|
return (jsx(ExpandableSelectItem, { item: item, variant: variant, selectedValues: state.selectedValues, onSelect: (value) => {
|
|
@@ -4081,12 +4104,12 @@ const Select = ({ items, onValueChange, onOpenChange, variant, required = false,
|
|
|
4081
4104
|
}
|
|
4082
4105
|
} }, item.id || item.value));
|
|
4083
4106
|
}
|
|
4084
|
-
return variant === 'checkbox' ? (jsx(CheckboxSelectItem, { ...item, checked: state.selectedValues.includes(item.value), onCheckedChange: (checked) => actions.handleMultipleSelect(item.value, checked) }, item.id || item.value)) : (jsx(SelectItem, { ...item, variant: variant }, item.id || item.value));
|
|
4107
|
+
return variant === 'checkbox' ? (jsx(CheckboxSelectItem, { ...item, checked: state.selectedValues.includes(item.value), onCheckedChange: (checked) => actions.handleMultipleSelect(item.value, checked) }, item.id || item.value)) : (jsx(SelectItem, { ...item, variant: variant, disableFocusOnHover: search }, item.id || item.value));
|
|
4085
4108
|
}), enableInfiniteScroll && isLoadingMore && (jsx("div", { className: styles$5.loadingMore, children: "Carregando mais itens..." }))] })) }) })] }) })] }) }));
|
|
4086
4109
|
};
|
|
4087
4110
|
Select.displayName = 'Select';
|
|
4088
4111
|
|
|
4089
|
-
var styles$4 = {"
|
|
4112
|
+
var styles$4 = {"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"};
|
|
4090
4113
|
|
|
4091
4114
|
/**
|
|
4092
4115
|
* Componente de ícone SVG para estado vazio da tabela
|
|
@@ -4266,13 +4289,13 @@ const Table = ({ columns, dataSource, className, loading = false, rowSelection,
|
|
|
4266
4289
|
}, [columns, rowSelection, isAllSelected, isIndeterminate, toggleAll, selectedSet, toggleRow, dataSource]);
|
|
4267
4290
|
const tableId = useMemo(() => `table-${Math.random().toString(36).substr(2, 9)}`, []);
|
|
4268
4291
|
if (loading) {
|
|
4269
|
-
return (jsx("div", { className: clsx(styles$4
|
|
4292
|
+
return (jsx("div", { className: clsx(styles$4.tableContainer, className), children: jsx("div", { className: styles$4.tableLoader, children: jsx(LoaderList, {}) }) }));
|
|
4270
4293
|
}
|
|
4271
|
-
const emptyText = locale?.emptyText || (jsxs("div", { className: styles$4
|
|
4272
|
-
return (jsx("div", { className: clsx(styles$4
|
|
4294
|
+
const emptyText = locale?.emptyText || (jsxs("div", { className: styles$4.tableEmpty, children: [jsx("div", { className: styles$4.tableEmptyContent, children: jsx(EmptyRows150Color, {}) }), jsxs("div", { className: styles$4.tableEmptyText, children: [jsx("h3", { className: styles$4.tableEmptyTitle, children: "Nenhum dado encontrado" }), jsx("p", { className: styles$4.tableEmptyCaption, children: "Nenhum registro encontrado" })] })] }));
|
|
4295
|
+
return (jsx("div", { className: clsx(styles$4.tableContainer, className), ...rest, children: jsx("div", { className: styles$4.tableScrollWrapper, children: jsxs("table", { className: styles$4.table, role: "table", "aria-label": "Tabela de dados", "aria-describedby": loading ? `${tableId}-loading` : undefined, "aria-rowcount": dataSource.length + 1, children: [jsx("thead", { className: styles$4.tableHead, children: jsx("tr", { children: finalColumns.map((column) => (jsx("th", { className: clsx(styles$4.tableTh, column.align && `text-${column.align}`), style: column.style, children: jsx("div", { className: styles$4.tableThContent, children: column.label }) }, column.key))) }) }), jsx("tbody", { className: styles$4.tableBody, children: dataSource.length > 0 ? (dataSource.map((row, index) => {
|
|
4273
4296
|
const rowProps = onRow?.(row, index) || {};
|
|
4274
|
-
return (jsx("tr", { className: clsx(styles$4
|
|
4275
|
-
})) : (jsx("tr", { children: jsx("td", { colSpan: finalColumns.length, className: styles$4
|
|
4297
|
+
return (jsx("tr", { className: clsx(styles$4.tableRow, rowProps.className), onClick: rowProps.onClick, onDoubleClick: rowProps.onDoubleClick, children: finalColumns.map((column) => (jsx("td", { className: clsx(styles$4.tableTd, column.align && `text-${column.align}`), children: renderCell(column, row, index) }, column.key))) }, index));
|
|
4298
|
+
})) : (jsx("tr", { children: jsx("td", { colSpan: finalColumns.length, className: styles$4.tableEmptyCell, children: emptyText }) })) })] }) }) }));
|
|
4276
4299
|
};
|
|
4277
4300
|
|
|
4278
4301
|
const isCalendarFilter = (filter) => {
|
|
@@ -4305,7 +4328,7 @@ const TableHeader = ({ searchValue = '', onSearchChange, onSearch, searchPlaceho
|
|
|
4305
4328
|
}
|
|
4306
4329
|
};
|
|
4307
4330
|
const hasFilters = filters || (filterItems && filterItems.length > 0);
|
|
4308
|
-
return (jsxs("div", { className: `${styles$4
|
|
4331
|
+
return (jsxs("div", { className: `${styles$4.tableHeader} ${className}`.trim(), ...rest, children: [showSearch && (onSearchChange || onSearch) && (jsx("div", { className: styles$4.tableHeaderSearchContainer, children: jsx(Search, { value: internalSearchValue, onChange: handleInputChange, onKeyDown: handleKeyDown, placeholder: searchPlaceholder, className: styles$4.tableHeaderSearch }) })), showFilters && (jsx("div", { className: styles$4.tableHeaderFilters, children: hasFilters ? (jsxs("div", { className: styles$4.tableHeaderFiltersContent, children: [filters && (jsx("div", { className: styles$4.tableHeaderCustomFilters, children: filters })), jsxs("div", { className: styles$4.tableHeaderFiltersWrapper, children: [jsx("span", { className: styles$4.tableHeaderFilterLabel, children: "Filtros" }), jsx("div", { className: styles$4.tableHeaderFilterItems, children: filterItems && filterItems.map((filterItem, index) => {
|
|
4309
4332
|
const commonProps = {
|
|
4310
4333
|
buttonText: filterItem.buttonText,
|
|
4311
4334
|
icon: filterItem.icon,
|
|
@@ -4324,7 +4347,7 @@ const TableHeader = ({ searchValue = '', onSearchChange, onSearch, searchPlaceho
|
|
|
4324
4347
|
}
|
|
4325
4348
|
console.warn('TableHeader: Tipo de filtro não reconhecido:', filterItem);
|
|
4326
4349
|
return null;
|
|
4327
|
-
}) })] })] })) : (jsx("div", { className: styles$4
|
|
4350
|
+
}) })] })] })) : (jsx("div", { className: styles$4.tableHeaderFiltersPlaceholder, children: jsx("span", { children: "Nenhum filtro dispon\u00EDvel" }) })) }))] }));
|
|
4328
4351
|
};
|
|
4329
4352
|
|
|
4330
4353
|
const TablePagination = ({ currentPage, totalItems, itemsPerPage, onPageChange, onItemsPerPageChange, pageSizeOptions = [10, 25, 50, 100], disabled = false, className, ...rest }) => {
|
|
@@ -4347,9 +4370,9 @@ const TablePagination = ({ currentPage, totalItems, itemsPerPage, onPageChange,
|
|
|
4347
4370
|
const newItemsPerPage = Number(event.target.value);
|
|
4348
4371
|
onItemsPerPageChange(newItemsPerPage);
|
|
4349
4372
|
};
|
|
4350
|
-
return (jsxs("div", { className: `${styles$4
|
|
4373
|
+
return (jsxs("div", { className: `${styles$4.tablePagination} ${className}`.trim(), ...rest, children: [jsxs("div", { className: styles$4.tablePaginationSelect, children: [jsx("label", { htmlFor: "items-per-page", className: styles$4.tablePaginationLabel, children: "Itens por p\u00E1gina" }), jsx("select", { id: "items-per-page", value: itemsPerPage, onChange: handleItemsPerPageChange, disabled: disabled, className: styles$4.tablePaginationSelectInput, children: pageSizeOptions.map((option) => (jsx("option", { value: option, children: option }, option))) })] }), jsx("div", { className: styles$4.tablePaginationInfo, children: jsx("span", { children: totalItems > 0
|
|
4351
4374
|
? `${startItem}–${endItem} de ${totalItems}`
|
|
4352
|
-
: '0 itens' }) }), jsxs("div", { className: styles$4
|
|
4375
|
+
: '0 itens' }) }), jsxs("div", { className: styles$4.tablePaginationControls, children: [jsx("button", { className: styles$4.tablePaginationButton, onClick: handlePrevious, disabled: !canGoPrev, "aria-label": "P\u00E1gina anterior", children: jsx(ChevronLeft16Regular, {}) }), jsx("button", { className: styles$4.tablePaginationButton, onClick: handleNext, disabled: !canGoNext, "aria-label": "Pr\u00F3xima p\u00E1gina", children: jsx(ChevronRight16Regular, {}) })] })] }));
|
|
4353
4376
|
};
|
|
4354
4377
|
|
|
4355
4378
|
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"};
|
|
@@ -5021,5 +5044,5 @@ function useInfiniteScroll({ status, page, lastPage, onLoadMore, threshold = 0.1
|
|
|
5021
5044
|
};
|
|
5022
5045
|
}
|
|
5023
5046
|
|
|
5024
|
-
export { Avatar, Badge, Button, Calendar, Callout, Checkbox, MemoizedChips as Chips, Container, DatePicker_default as DatePicker, Dialog, Drawer, Filter, ListItem, Menu, Popover, memorizedQuantity as Quantity, Radio, Search, Select, Switch, Table, TableHeader, TablePagination, TextArea_default as TextArea, TextField$1 as TextField, Toast, ToastContainer, ToastProvider, Tooltip, VerificationCode, normalizeText, useApiSimulation, useInfiniteScroll, useToast };
|
|
5047
|
+
export { Avatar, Badge, Button, Calendar, Callout, Checkbox, MemoizedChips as Chips, Container, DatePicker_default as DatePicker, Dialog, Drawer, Filter, ListItem, Menu, Modal, Popover, memorizedQuantity as Quantity, Radio, Search, Select, Switch, Table, TableHeader, TablePagination, TextArea_default as TextArea, TextField$1 as TextField, Toast, ToastContainer, ToastProvider, Tooltip, VerificationCode, normalizeText, useApiSimulation, useInfiniteScroll, useToast };
|
|
5025
5048
|
//# sourceMappingURL=index.esm.js.map
|