@giro-ds/react 9.1.0 → 11.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +232 -182
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +56 -90
- package/dist/index.esm.js +232 -183
- package/dist/index.esm.js.map +1 -1
- package/dist/styles.css +3 -3
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -12,17 +12,17 @@ import { useReactTable, getSortedRowModel, getCoreRowModel, flexRender } from '@
|
|
|
12
12
|
export { createColumnHelper as createTableColumnHelper } from '@tanstack/react-table';
|
|
13
13
|
import Skeleton from 'react-loading-skeleton';
|
|
14
14
|
|
|
15
|
-
var styles$
|
|
15
|
+
var styles$u = {"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"};
|
|
16
16
|
|
|
17
17
|
const Avatar = ({ icon, size = 'lg', src, className, initialLetters, ...rest }) => {
|
|
18
|
-
const AvatarClass = clsx(styles$
|
|
19
|
-
[styles$
|
|
20
|
-
[styles$
|
|
18
|
+
const AvatarClass = clsx(styles$u.AvatarRoot, {
|
|
19
|
+
[styles$u['AvatarRoot--lg']]: size === 'lg',
|
|
20
|
+
[styles$u['AvatarRoot--sm']]: size === 'sm',
|
|
21
21
|
}, className);
|
|
22
|
-
return (jsxs(Avatar$1.Root, { className: AvatarClass, ...rest, children: [src && (jsx(Avatar$1.Image, { className: styles$
|
|
22
|
+
return (jsxs(Avatar$1.Root, { className: AvatarClass, ...rest, children: [src && (jsx(Avatar$1.Image, { className: styles$u.AvatarImage, src: src, alt: "Avatar" })), jsx(Avatar$1.Fallback, { className: styles$u.AvatarFallback, children: icon || initialLetters })] }));
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
var styles$
|
|
25
|
+
var styles$t = {"badge__status":"Badge-module__badge__status___-u3xv","badge":"Badge-module__badge___ZbEBU","badgeContainer":"Badge-module__badgeContainer___Guw9Z","badge__empty":"Badge-module__badge__empty___u8ccy","badge__flex":"Badge-module__badge__flex___DSJHW","badge__status__empty":"Badge-module__badge__status__empty___h8L4e","badge__status__flex":"Badge-module__badge__status__flex___703Q6","badge__status__filterBadge":"Badge-module__badge__status__filterBadge___DhjGU"};
|
|
26
26
|
|
|
27
27
|
const getDisplayValue = (value) => {
|
|
28
28
|
if (value === null || value === undefined)
|
|
@@ -44,25 +44,25 @@ const Badge = ({ children, badgeValue = null, className, id, filterVariant = fal
|
|
|
44
44
|
const displayValue = getDisplayValue(badgeValue);
|
|
45
45
|
const isEmpty = displayValue === '';
|
|
46
46
|
if (children) {
|
|
47
|
-
return (jsxs("div", { className: styles$
|
|
48
|
-
[styles$
|
|
49
|
-
[styles$
|
|
47
|
+
return (jsxs("div", { className: styles$t.badgeContainer, ...rest, children: [jsx("div", { "data-testid": "badge-content", children: children }), jsx("div", { id: componentId, className: clsx(styles$t.badge, {
|
|
48
|
+
[styles$t['badge__empty']]: isEmpty,
|
|
49
|
+
[styles$t['badge__flex']]: displayValue.length >= 2,
|
|
50
50
|
}, className), "data-testid": "badge", children: !isEmpty && jsx("span", { "aria-hidden": !!ariaLabel, children: displayValue }) })] }));
|
|
51
51
|
}
|
|
52
|
-
return (jsx("div", { className: styles$
|
|
53
|
-
[styles$
|
|
54
|
-
[styles$
|
|
55
|
-
[styles$
|
|
52
|
+
return (jsx("div", { className: styles$t.badgeContainer, children: jsx("div", { className: clsx(styles$t['badge__status'], {
|
|
53
|
+
[styles$t['badge__status__empty']]: isEmpty,
|
|
54
|
+
[styles$t['badge__status__flex']]: displayValue.length >= 2,
|
|
55
|
+
[styles$t['badge__status__filterBadge']]: filterVariant,
|
|
56
56
|
}, className), "data-testid": "badge", children: !isEmpty && (jsx("span", { "aria-hidden": !!ariaLabel, children: displayValue })) }) }));
|
|
57
57
|
};
|
|
58
58
|
|
|
59
|
-
var styles$
|
|
59
|
+
var styles$s = {"tooltipContent":"Tooltip-module__tooltipContent___xycUg","triggerWrapper":"Tooltip-module__triggerWrapper___x83XR"};
|
|
60
60
|
|
|
61
61
|
const Tooltip = ({ children, text, side = 'bottom', align = 'start', maxWidth, sideOffset = 10, className, ...rest }) => {
|
|
62
|
-
return (jsx(Tooltip$1.Provider, { children: jsxs(Tooltip$1.Root, { children: [jsx(Tooltip$1.Trigger, { asChild: true, children: jsx("span", { className: styles$
|
|
62
|
+
return (jsx(Tooltip$1.Provider, { children: jsxs(Tooltip$1.Root, { children: [jsx(Tooltip$1.Trigger, { asChild: true, children: jsx("span", { className: styles$s.triggerWrapper, children: children }) }), jsx(Tooltip$1.Portal, { children: jsx(Tooltip$1.Content, { className: clsx(styles$s.tooltipContent, className), side: side, align: align, sideOffset: sideOffset, style: { maxWidth: maxWidth ? `${maxWidth}px` : 'auto' }, ...rest, children: text }) })] }) }));
|
|
63
63
|
};
|
|
64
64
|
|
|
65
|
-
var styles$
|
|
65
|
+
var styles$r = {"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"};
|
|
66
66
|
|
|
67
67
|
const Button = React__default.forwardRef(({ as, children, variant = 'filled', iconPosition = 'left', href, to, external = false, target, rel, disabled = false, onClick, size = 'lg', scale = 1, className, type = 'button', id, icon, fullWidth = false, ariaLabel, iconOnly = false, loading = false, tooltipText, tooltipSide = 'top', tooltipAlign = 'center', ...rest }, ref) => {
|
|
68
68
|
const generatedId = useId();
|
|
@@ -91,19 +91,14 @@ const Button = React__default.forwardRef(({ as, children, variant = 'filled', ic
|
|
|
91
91
|
'Forneça um ícone via `icon={<MeuIcone />}`.');
|
|
92
92
|
}
|
|
93
93
|
const resolvedIcon = icon;
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
[styles$
|
|
101
|
-
[styles$
|
|
102
|
-
[styles$q['buttonWithIcon']]: resolvedIcon && !iconOnly,
|
|
103
|
-
[styles$q[`buttonIconPosition-${iconPosition}`]]: resolvedIcon && !iconOnly,
|
|
104
|
-
[styles$q['buttonNoContent']]: resolvedIcon && !hasContent && !iconOnly,
|
|
105
|
-
[styles$q['buttonFullWidth']]: fullWidth,
|
|
106
|
-
[styles$q['buttonIconOnly']]: iconOnly,
|
|
94
|
+
const buttonClasses = clsx(styles$r.button, styles$r[`button-${variant}`], styles$r[`button-${size}`], {
|
|
95
|
+
[styles$r['disabled']]: disabled,
|
|
96
|
+
[styles$r['buttonLoading']]: loading,
|
|
97
|
+
[styles$r['buttonWithIcon']]: resolvedIcon && !iconOnly,
|
|
98
|
+
[styles$r[`buttonIconPosition-${iconPosition}`]]: resolvedIcon && !iconOnly,
|
|
99
|
+
[styles$r['buttonNoContent']]: resolvedIcon && !hasContent && !iconOnly,
|
|
100
|
+
[styles$r['buttonFullWidth']]: fullWidth,
|
|
101
|
+
[styles$r['buttonIconOnly']]: iconOnly,
|
|
107
102
|
}, className);
|
|
108
103
|
const getAriaLabel = () => {
|
|
109
104
|
if (ariaLabel)
|
|
@@ -129,13 +124,14 @@ const Button = React__default.forwardRef(({ as, children, variant = 'filled', ic
|
|
|
129
124
|
};
|
|
130
125
|
const renderContent = () => {
|
|
131
126
|
if (iconOnly && !loading) {
|
|
132
|
-
return (jsx("span", { className: styles$
|
|
127
|
+
return (jsx("span", { className: styles$r.buttonIconOnly, "aria-hidden": "true", children: resolvedIcon }));
|
|
133
128
|
}
|
|
134
129
|
if (loading) {
|
|
135
|
-
return (jsxs(Fragment, { children: [!iconOnly && (jsxs("span", { className: styles$
|
|
130
|
+
return (jsxs(Fragment, { children: [!iconOnly && (jsxs("span", { className: styles$r.buttonContentHidden, "aria-hidden": "true", children: [resolvedIcon && (iconPosition === 'left' || iconPosition === 'both') && (jsx("span", { className: styles$r.buttonIconLeft, children: resolvedIcon })), children, resolvedIcon && (iconPosition === 'right' || iconPosition === 'both') && (jsx("span", { className: styles$r.buttonIconRight, children: resolvedIcon }))] })), jsx("span", { className: styles$r.buttonLoadingSpinner, "aria-hidden": "true", children: jsx(SpinnerIos16Regular, { "aria-hidden": "true" }) })] }));
|
|
136
131
|
}
|
|
137
|
-
return (jsxs(Fragment, { children: [resolvedIcon && (iconPosition === 'left' || iconPosition === 'both') && (jsx("span", { className: styles$
|
|
132
|
+
return (jsxs(Fragment, { children: [resolvedIcon && (iconPosition === 'left' || iconPosition === 'both') && (jsx("span", { className: styles$r.buttonIconLeft, "aria-hidden": "true", children: resolvedIcon })), children, resolvedIcon && (iconPosition === 'right' || iconPosition === 'both') && (jsx("span", { className: styles$r.buttonIconRight, "aria-hidden": "true", children: resolvedIcon }))] }));
|
|
138
133
|
};
|
|
134
|
+
const { style: externalStyle, ...otherRest } = rest;
|
|
139
135
|
const baseProps = {
|
|
140
136
|
ref,
|
|
141
137
|
id: componentId,
|
|
@@ -145,7 +141,11 @@ const Button = React__default.forwardRef(({ as, children, variant = 'filled', ic
|
|
|
145
141
|
'aria-busy': loading || undefined,
|
|
146
142
|
tabIndex: disabled || loading ? -1 : 0,
|
|
147
143
|
onClick: handleClick,
|
|
148
|
-
...
|
|
144
|
+
...otherRest,
|
|
145
|
+
style: {
|
|
146
|
+
'--giro-scale': scale,
|
|
147
|
+
...externalStyle,
|
|
148
|
+
},
|
|
149
149
|
};
|
|
150
150
|
const getNavigationProps = () => {
|
|
151
151
|
if (href) {
|
|
@@ -2439,7 +2439,7 @@ const ptBR = {
|
|
|
2439
2439
|
},
|
|
2440
2440
|
};
|
|
2441
2441
|
|
|
2442
|
-
var styles$
|
|
2442
|
+
var styles$q = {"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","chevron_wrapper":"Calendar-module__chevron_wrapper___BfN9a"};
|
|
2443
2443
|
|
|
2444
2444
|
const FLUENT_CHEVRON_MAP = {
|
|
2445
2445
|
down: ChevronDown16Regular,
|
|
@@ -2449,7 +2449,7 @@ const FLUENT_CHEVRON_MAP = {
|
|
|
2449
2449
|
};
|
|
2450
2450
|
const CustomChevron = ({ orientation = "left", className, }) => {
|
|
2451
2451
|
const Icon = FLUENT_CHEVRON_MAP[orientation];
|
|
2452
|
-
return jsx(Icon, { className: className, "aria-hidden": true });
|
|
2452
|
+
return jsx("span", { className: styles$q.chevron_wrapper, children: jsx(Icon, { className: className, "aria-hidden": true }) });
|
|
2453
2453
|
};
|
|
2454
2454
|
const GridCtx = createContext(null);
|
|
2455
2455
|
const GridMonthCaption = ({ calendarMonth, displayIndex: _displayIndex, ...divProps }) => {
|
|
@@ -2458,10 +2458,10 @@ const GridMonthCaption = ({ calendarMonth, displayIndex: _displayIndex, ...divPr
|
|
|
2458
2458
|
const date = calendarMonth.date;
|
|
2459
2459
|
const monthLabel = new Intl.DateTimeFormat(intlLocale, { month: "long" }).format(date);
|
|
2460
2460
|
const yearLabel = String(date.getFullYear());
|
|
2461
|
-
return (jsxs("div", { ...divProps, children: [jsx("span", { className: styles$
|
|
2461
|
+
return (jsxs("div", { ...divProps, children: [jsx("span", { className: styles$q.caption_grid_label, children: monthLabel }), jsxs("button", { type: "button", className: styles$q.caption_grid_btn, "aria-pressed": view === "years", onClick: onYearLabelClick, children: [yearLabel, view !== "days" ? (jsx("span", { className: styles$q.chevron_wrapper, children: jsx(ChevronUp16Regular, { className: styles$q.caption_year_chevron, "aria-hidden": true }) })) : (jsx("span", { className: styles$q.chevron_wrapper, children: jsx(ChevronDown16Regular, { className: styles$q.caption_year_chevron, "aria-hidden": true }) }))] })] }));
|
|
2462
2462
|
};
|
|
2463
2463
|
const YEARS_PER_PAGE = 20;
|
|
2464
|
-
const Calendar = ({ selected, currentDate, defaultMonth, startMonth, endMonth, onDaySelect, onDateChange, onClear: _onClear, minDate, maxDate, disabled, format: _format, locale = "pt-br", autoFocus, className, scale = 1, id, "aria-label": ariaLabel, ...rest }) => {
|
|
2464
|
+
const Calendar = ({ selected, currentDate, defaultMonth, startMonth, endMonth, onDaySelect, onDateChange, onClear: _onClear, minDate, maxDate, disabled, format: _format, locale = "pt-br", autoFocus, className, style, scale = 1, id, "aria-label": ariaLabel, ...rest }) => {
|
|
2465
2465
|
const animate = true;
|
|
2466
2466
|
const [internalSelected, setInternalSelected] = useState(selected ?? undefined);
|
|
2467
2467
|
const [internalDisplayMonth, setInternalDisplayMonth] = useState(() => currentDate ?? defaultMonth ?? new Date());
|
|
@@ -2526,7 +2526,7 @@ const Calendar = ({ selected, currentDate, defaultMonth, startMonth, endMonth, o
|
|
|
2526
2526
|
onYearLabelClick: handleYearLabelClick,
|
|
2527
2527
|
};
|
|
2528
2528
|
const sharedDayPickerProps = {
|
|
2529
|
-
classNames: styles$
|
|
2529
|
+
classNames: styles$q,
|
|
2530
2530
|
animate,
|
|
2531
2531
|
mode: "single",
|
|
2532
2532
|
selected: resolvedSelected,
|
|
@@ -2538,15 +2538,11 @@ const Calendar = ({ selected, currentDate, defaultMonth, startMonth, endMonth, o
|
|
|
2538
2538
|
autoFocus,
|
|
2539
2539
|
"aria-label": ariaLabel,
|
|
2540
2540
|
};
|
|
2541
|
-
const
|
|
2542
|
-
|
|
2543
|
-
1.5: 'scale-1-5',
|
|
2544
|
-
2: 'scale-2-0',
|
|
2545
|
-
}[scale];
|
|
2546
|
-
return (jsx(GridCtx.Provider, { value: gridCtxValue, children: jsxs("div", { className: clsx(styles$p.calendar_grid_wrapper, scaleClass, className), children: [jsx(DayPicker, { id: id, ...sharedDayPickerProps, ...rest, captionLayout: "label", month: resolvedDisplayMonth, onMonthChange: handleMonthChange, components: { MonthCaption: GridMonthCaption, Chevron: CustomChevron } }), gridView !== "days" && (jsxs("div", { className: `${styles$p.gridOverlay}${gridView === "years" ? ` ${styles$p.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$p.gridOverlayCaption, children: [jsx("span", { className: styles$p.caption_grid_label, children: new Intl.DateTimeFormat(intlLocale, { month: "long" }).format(resolvedDisplayMonth) }), jsxs("button", { type: "button", className: styles$p.caption_grid_btn, onClick: () => setGridView("days"), "aria-label": "Fechar sele\u00E7\u00E3o de m\u00EAs", children: [displayedYear, jsx(ChevronUp16Regular, { className: styles$p.caption_year_chevron, "aria-hidden": true })] })] }), jsx("div", { className: styles$p.gridCells, children: monthsGrid.map(({ index, label, disabled: monthDisabled }) => (jsx("button", { type: "button", disabled: monthDisabled, className: `${styles$p.gridCell}${displayedMonthIndex === index ? ` ${styles$p.gridCellActive}` : ""}`, onClick: () => handleGridMonthSelect(index), children: label }, index))) })] })), gridView === "years" && (jsxs(Fragment, { children: [jsxs("div", { className: styles$p.gridOverlayCaption, children: [jsx("span", { className: styles$p.caption_grid_label, children: new Intl.DateTimeFormat(intlLocale, { month: "long" }).format(resolvedDisplayMonth) }), jsxs("button", { type: "button", className: styles$p.caption_grid_btn, onClick: () => setGridView("days"), "aria-label": "Fechar sele\u00E7\u00E3o de ano", children: [displayedYear, jsx(ChevronUp16Regular, { className: styles$p.caption_year_chevron, "aria-hidden": true })] }), jsxs("div", { className: styles$p.gridOverlayYearsNav, children: [jsx("button", { type: "button", className: styles$p.gridNavBtn, disabled: !canGoPrevYears, onClick: () => setYearPageStart((s) => s - YEARS_PER_PAGE), "aria-label": "Anos anteriores", children: jsx(ChevronLeft16Regular, { className: styles$p.chevronNavBtnPrev, "aria-hidden": true }) }), jsx("button", { type: "button", className: styles$p.gridNavBtn, disabled: !canGoNextYears, onClick: () => setYearPageStart((s) => s + YEARS_PER_PAGE), "aria-label": "Pr\u00F3ximos anos", children: jsx(ChevronRight16Regular, { className: styles$p.chevronNavBtnNext, "aria-hidden": true }) })] })] }), jsx("div", { className: `${styles$p.gridCells} ${styles$p.gridCellsYears}`, children: yearsInPage.map((year) => (jsx("button", { type: "button", className: `${styles$p.gridCell}${displayedYear === year ? ` ${styles$p.gridCellActive}` : ""}`, onClick: () => handleGridYearSelect(year), children: year }, year))) })] }))] }))] }) }));
|
|
2541
|
+
const containerStyle = { '--giro-scale': scale };
|
|
2542
|
+
return (jsx(GridCtx.Provider, { value: gridCtxValue, children: jsxs("div", { className: clsx(styles$q.calendar_grid_wrapper, className), style: { ...containerStyle, ...style }, children: [jsx(DayPicker, { id: id, ...sharedDayPickerProps, ...rest, captionLayout: "label", month: resolvedDisplayMonth, onMonthChange: handleMonthChange, components: { MonthCaption: GridMonthCaption, Chevron: CustomChevron } }), gridView !== "days" && (jsxs("div", { className: `${styles$q.gridOverlay}${gridView === "years" ? ` ${styles$q.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$q.gridOverlayCaption, children: [jsx("span", { className: styles$q.caption_grid_label, children: new Intl.DateTimeFormat(intlLocale, { month: "long" }).format(resolvedDisplayMonth) }), jsxs("button", { type: "button", className: styles$q.caption_grid_btn, onClick: () => setGridView("days"), "aria-label": "Fechar sele\u00E7\u00E3o de m\u00EAs", children: [displayedYear, jsx("span", { className: styles$q.chevron_wrapper, children: jsx(ChevronUp16Regular, { className: styles$q.caption_year_chevron, "aria-hidden": true }) })] })] }), jsx("div", { className: styles$q.gridCells, children: monthsGrid.map(({ index, label, disabled: monthDisabled }) => (jsx("button", { type: "button", disabled: monthDisabled, className: `${styles$q.gridCell}${displayedMonthIndex === index ? ` ${styles$q.gridCellActive}` : ""}`, onClick: () => handleGridMonthSelect(index), children: label }, index))) })] })), gridView === "years" && (jsxs(Fragment, { children: [jsxs("div", { className: styles$q.gridOverlayCaption, children: [jsx("span", { className: styles$q.caption_grid_label, children: new Intl.DateTimeFormat(intlLocale, { month: "long" }).format(resolvedDisplayMonth) }), jsxs("button", { type: "button", className: styles$q.caption_grid_btn, onClick: () => setGridView("days"), "aria-label": "Fechar sele\u00E7\u00E3o de ano", children: [displayedYear, jsx("span", { className: styles$q.chevron_wrapper, children: jsx(ChevronUp16Regular, { className: styles$q.caption_year_chevron, "aria-hidden": true }) })] }), jsxs("div", { className: styles$q.gridOverlayYearsNav, children: [jsx("button", { type: "button", className: styles$q.gridNavBtn, disabled: !canGoPrevYears, onClick: () => setYearPageStart((s) => s - YEARS_PER_PAGE), "aria-label": "Anos anteriores", children: jsx("span", { className: styles$q.chevron_wrapper, children: jsx(ChevronLeft16Regular, { className: styles$q.chevronNavBtnPrev, "aria-hidden": true }) }) }), jsx("button", { type: "button", className: styles$q.gridNavBtn, disabled: !canGoNextYears, onClick: () => setYearPageStart((s) => s + YEARS_PER_PAGE), "aria-label": "Pr\u00F3ximos anos", children: jsx("span", { className: styles$q.chevron_wrapper, children: jsx(ChevronRight16Regular, { className: styles$q.chevronNavBtnNext, "aria-hidden": true }) }) })] })] }), jsx("div", { className: `${styles$q.gridCells} ${styles$q.gridCellsYears}`, children: yearsInPage.map((year) => (jsx("button", { type: "button", className: `${styles$q.gridCell}${displayedYear === year ? ` ${styles$q.gridCellActive}` : ""}`, onClick: () => handleGridYearSelect(year), children: year }, year))) })] }))] }))] }) }));
|
|
2547
2543
|
};
|
|
2548
2544
|
|
|
2549
|
-
var styles$
|
|
2545
|
+
var styles$p = {"container":"Callout-module__container___dggFW","withTitle":"Callout-module__withTitle___e-HEg","brand":"Callout-module__brand___YHDPQ","success":"Callout-module__success___RPS0Q","alert":"Callout-module__alert___LVlJM","content":"Callout-module__content___g44Qz","icon":"Callout-module__icon___4CBkz","subcontent":"Callout-module__subcontent___5hz-f","title":"Callout-module__title___IPSdE","text":"Callout-module__text___0Ys48","dismiss":"Callout-module__dismiss___ZaycS"};
|
|
2550
2546
|
|
|
2551
2547
|
const Callout = ({ variant = 'neutral', title, text, icon, onDismiss, dismiss, backgroundColor, textColor, className, id, style, ...rest }) => {
|
|
2552
2548
|
if (process.env.NODE_ENV !== 'production' && (text === '' || (typeof text === 'string' && !text.trim()))) {
|
|
@@ -2556,15 +2552,21 @@ const Callout = ({ variant = 'neutral', title, text, icon, onDismiss, dismiss, b
|
|
|
2556
2552
|
const titleId = `callout-title-${id || generatedId}`;
|
|
2557
2553
|
const componentId = id || generatedId;
|
|
2558
2554
|
const isAlert = variant === 'alert';
|
|
2559
|
-
const containerClass = clsx(styles$
|
|
2555
|
+
const containerClass = clsx(styles$p.container, styles$p[variant], { [styles$p.withTitle]: title }, className);
|
|
2560
2556
|
const customStyle = {
|
|
2561
2557
|
...style,
|
|
2562
2558
|
...(backgroundColor && { '--callout-bg': `var(--${backgroundColor})` }),
|
|
2563
2559
|
...(textColor && { '--callout-text': `var(--${textColor})` }),
|
|
2564
2560
|
};
|
|
2565
|
-
return (jsx("div", { id: componentId, className: containerClass, role: isAlert ? 'alert' : 'status', "aria-live": isAlert ? 'assertive' : 'polite', "aria-labelledby": title ? titleId : undefined, style: customStyle, ...rest, children: jsxs("div", { className: styles$
|
|
2561
|
+
return (jsx("div", { id: componentId, className: containerClass, role: isAlert ? 'alert' : 'status', "aria-live": isAlert ? 'assertive' : 'polite', "aria-labelledby": title ? titleId : undefined, style: customStyle, ...rest, children: jsxs("div", { className: styles$p.content, children: [icon && jsx("span", { className: styles$p.icon, "aria-hidden": "true", children: icon }), jsxs("div", { className: styles$p.subcontent, children: [title && (jsx("span", { id: titleId, className: styles$p.title, children: title })), text && jsx("span", { className: styles$p.text, children: text })] }), dismiss && (jsx("button", { className: styles$p.dismiss, onClick: onDismiss, type: "button", "aria-label": "Fechar", children: jsx(Dismiss24Regular, { "aria-hidden": "true" }) }))] }) }));
|
|
2566
2562
|
};
|
|
2567
2563
|
|
|
2564
|
+
var styles$o = {"card":"Card-module__card___LzN-3","card--hoverable":"Card-module__card--hoverable___orpJZ"};
|
|
2565
|
+
|
|
2566
|
+
function Card({ children, className, hoverable }) {
|
|
2567
|
+
return (jsx("main", { className: clsx(styles$o['card'], hoverable && styles$o['card--hoverable'], className), children: children }));
|
|
2568
|
+
}
|
|
2569
|
+
|
|
2568
2570
|
const CheckSmall = ({ className = '', width = 12, height = 10, fill = 'white', ...restProps }) => {
|
|
2569
2571
|
return (jsx("svg", { width: width, height: height, viewBox: "0 0 12 10", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, "aria-hidden": "true", ...restProps, children: jsx("path", { d: "M4 9.4L0 5.4L1.4 4L4 6.6L10.6 0L12 1.4L4 9.4Z", fill: fill }) }));
|
|
2570
2572
|
};
|
|
@@ -2575,14 +2577,9 @@ const CheckHalf = ({ className = '', width = 16, height = 16, fill = 'white', ..
|
|
|
2575
2577
|
|
|
2576
2578
|
var styles$n = {"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"};
|
|
2577
2579
|
|
|
2578
|
-
const Checkbox = ({ id, label, onCheckedChange, checked, disabled, className, scale = 1, indeterminate = false, ...rest }) => {
|
|
2580
|
+
const Checkbox = ({ id, label, onCheckedChange, checked, disabled, className, style, scale = 1, indeterminate = false, ...rest }) => {
|
|
2579
2581
|
const componentId = id || React.useId();
|
|
2580
|
-
|
|
2581
|
-
1: 'scale-1-0',
|
|
2582
|
-
1.5: 'scale-1-5',
|
|
2583
|
-
2: 'scale-2-0',
|
|
2584
|
-
}[scale];
|
|
2585
|
-
return (jsxs("div", { className: clsx(styles$n.container, scaleClass, className), children: [jsx("div", { className: clsx(styles$n.wrapperCheckbox, {
|
|
2582
|
+
return (jsxs("div", { className: clsx(styles$n.container, className), style: { '--giro-scale': scale, ...style }, children: [jsx("div", { className: clsx(styles$n.wrapperCheckbox, {
|
|
2586
2583
|
[styles$n.disabled]: disabled,
|
|
2587
2584
|
}), role: "presentation", tabIndex: disabled ? -1 : 0, children: jsx(Checkbox$1.Root, { className: styles$n.root, checked: indeterminate ? 'indeterminate' : checked, id: componentId, onCheckedChange: onCheckedChange, disabled: disabled, "data-disabled": disabled, "data-indeterminate": indeterminate, "aria-checked": indeterminate ? 'mixed' : checked ? 'true' : 'false', ...rest, children: jsx(Checkbox$1.Indicator, { className: styles$n.indicator, children: indeterminate ? jsx(CheckHalf, {}) : jsx(CheckSmall, {}) }) }) }), jsx("label", { className: clsx(styles$n.label, { [styles$n.disabled]: disabled }), htmlFor: componentId, children: label })] }));
|
|
2588
2585
|
};
|
|
@@ -2590,17 +2587,13 @@ const Checkbox = ({ id, label, onCheckedChange, checked, disabled, className, sc
|
|
|
2590
2587
|
var styles$m = {"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"};
|
|
2591
2588
|
|
|
2592
2589
|
const Chips = ({ children, leftIcon, rightIcon, variant = 'neutral', disabled = false, backgroundColor, textColor, scale = 1, className, style, ...rest }) => {
|
|
2593
|
-
const
|
|
2594
|
-
1: 'scale-1-0',
|
|
2595
|
-
1.5: 'scale-1-5',
|
|
2596
|
-
2: 'scale-2-0',
|
|
2597
|
-
}[scale];
|
|
2598
|
-
const chipsClass = clsx(styles$m.chips, styles$m[variant], scaleClass, {
|
|
2590
|
+
const chipsClass = clsx(styles$m.chips, styles$m[variant], {
|
|
2599
2591
|
[styles$m.disabled]: disabled,
|
|
2600
2592
|
[styles$m.hasLeftIcon]: leftIcon,
|
|
2601
2593
|
[styles$m.hasRightIcon]: rightIcon,
|
|
2602
2594
|
}, className);
|
|
2603
2595
|
const colorStyle = {
|
|
2596
|
+
'--giro-scale': scale,
|
|
2604
2597
|
...(!disabled && backgroundColor && { '--chips-bg': `var(--${backgroundColor})` }),
|
|
2605
2598
|
...(!disabled && textColor && { '--chips-text': `var(--${textColor})` }),
|
|
2606
2599
|
...style,
|
|
@@ -2650,18 +2643,18 @@ const ICON_KEY_MAP = {
|
|
|
2650
2643
|
const SHARED_DISPLAY = {
|
|
2651
2644
|
'{capslock}': iconSlot('capslock'),
|
|
2652
2645
|
'{numbers}': '123',
|
|
2653
|
-
'{abc}': '
|
|
2646
|
+
'{abc}': 'Abc',
|
|
2654
2647
|
'{alt}': '.?!',
|
|
2655
2648
|
'{alt2}': '#+=',
|
|
2656
2649
|
'{emoticon}': iconSlot('emoji'),
|
|
2657
2650
|
'{shift}': iconSlot('shift'),
|
|
2658
2651
|
'{shiftactivated}': iconSlot('shiftactivated'),
|
|
2659
2652
|
'{enter}': 'Enter',
|
|
2660
|
-
'{bksp}':
|
|
2653
|
+
'{bksp}': iconSlot('bksp'),
|
|
2661
2654
|
'{altright}': '.?123',
|
|
2662
2655
|
'{downkeyboard}': iconSlot('downkeyboard'),
|
|
2663
2656
|
'{space}': ' ',
|
|
2664
|
-
'{default}': '
|
|
2657
|
+
'{default}': 'Abc',
|
|
2665
2658
|
};
|
|
2666
2659
|
const LAYOUT_DISPLAY = {
|
|
2667
2660
|
default: SHARED_DISPLAY,
|
|
@@ -2675,40 +2668,40 @@ const removeKeyFromLayout = (layout, key) => Object.fromEntries(Object.entries(l
|
|
|
2675
2668
|
rows.map((row) => row.split(key).join(' ').replace(/\s+/g, ' ').trim()),
|
|
2676
2669
|
]));
|
|
2677
2670
|
const QWERTY_LOWERCASE = [
|
|
2678
|
-
'
|
|
2679
|
-
'
|
|
2680
|
-
'a s d f g h j k l ç
|
|
2681
|
-
'{shift} z x c v b n m
|
|
2682
|
-
'{numbers} {alt} {space}
|
|
2671
|
+
'1 2 3 4 5 6 7 8 9 0',
|
|
2672
|
+
'q w e r t y u i o p',
|
|
2673
|
+
'a s d f g h j k l ç',
|
|
2674
|
+
'{shift} z x c v b n m {bksp}',
|
|
2675
|
+
'{numbers} {alt} {space} . {enter}',
|
|
2683
2676
|
];
|
|
2684
2677
|
const NUMPAD = ['1 2 3', '4 5 6', '7 8 9', '{bksp} 0 {abc}'];
|
|
2685
2678
|
const SHARED_LAYOUTS = {
|
|
2686
2679
|
shift: [
|
|
2687
|
-
'
|
|
2688
|
-
'
|
|
2689
|
-
'A S D F G H J K L Ç
|
|
2690
|
-
'{capslock} Z X C V B N M
|
|
2691
|
-
'{numbers} {alt} {emoticon} {space}
|
|
2680
|
+
'1 2 3 4 5 6 7 8 9 0',
|
|
2681
|
+
'Q W E R T Y U I O P',
|
|
2682
|
+
'A S D F G H J K L Ç',
|
|
2683
|
+
'{capslock} Z X C V B N M {bksp}',
|
|
2684
|
+
'{numbers} {alt} {emoticon} {space} . {enter}',
|
|
2692
2685
|
],
|
|
2693
2686
|
caps: [
|
|
2694
|
-
'
|
|
2695
|
-
'
|
|
2696
|
-
'A S D F G H J K L Ç
|
|
2697
|
-
'{shiftactivated} Z X C V B N M
|
|
2698
|
-
'{numbers} {alt} {emoticon} {space}
|
|
2687
|
+
'1 2 3 4 5 6 7 8 9 0',
|
|
2688
|
+
'Q W E R T Y U I O P',
|
|
2689
|
+
'A S D F G H J K L Ç',
|
|
2690
|
+
'{shiftactivated} Z X C V B N M {bksp}',
|
|
2691
|
+
'{numbers} {alt} {emoticon} {space} . {enter}',
|
|
2699
2692
|
],
|
|
2700
2693
|
numbers: NUMPAD,
|
|
2701
2694
|
alt: [
|
|
2702
2695
|
'1 2 3 4 5 6 7 8 9 0',
|
|
2703
2696
|
`- / : ; ( ) $ & @ "`,
|
|
2704
2697
|
'{alt2} . , ? ! ´ {bksp}',
|
|
2705
|
-
'{default} {emoticon} {space} {
|
|
2698
|
+
'{default} {emoticon} {space} {enter}',
|
|
2706
2699
|
],
|
|
2707
2700
|
alt2: [
|
|
2708
2701
|
'[ ] { } # % ^ * + =',
|
|
2709
2702
|
'_ \\ | ~ < > ¢ £ ¥ •',
|
|
2710
2703
|
`{alt} . , ? ! ' {bksp}`,
|
|
2711
|
-
'{default} {emoticon} {space} {
|
|
2704
|
+
'{default} {emoticon} {space} {enter}',
|
|
2712
2705
|
],
|
|
2713
2706
|
emoticon: [
|
|
2714
2707
|
'😀 😊 😅 😂 🙂 😉 😍 😛 😠 😎 {bksp}',
|
|
@@ -2767,20 +2760,20 @@ const SHIFT_TOGGLES = {
|
|
|
2767
2760
|
alt2: 'alt',
|
|
2768
2761
|
};
|
|
2769
2762
|
|
|
2770
|
-
var styles$j = {"container":"VirtualKeyboard-module__container___A-e0I","
|
|
2763
|
+
var styles$j = {"container":"VirtualKeyboard-module__container___A-e0I","layout--numeric":"VirtualKeyboard-module__layout--numeric___zfd7G","layout--default":"VirtualKeyboard-module__layout--default___qyY1b","mode--fixed":"VirtualKeyboard-module__mode--fixed___1eFY1","textFieldContainer":"VirtualKeyboard-module__textFieldContainer___XxGen","keyboardWrapper":"VirtualKeyboard-module__keyboardWrapper___jryTf","overlay":"VirtualKeyboard-module__overlay___a5y7i","overlayOpen":"VirtualKeyboard-module__overlayOpen___hREu-","textFieldWrapper":"VirtualKeyboard-module__textFieldWrapper___bmi-z","keyPreview":"VirtualKeyboard-module__keyPreview___oWaO1","accentMenu":"VirtualKeyboard-module__accentMenu___A6tTy","accentMenuRow":"VirtualKeyboard-module__accentMenuRow___3kbvT","accentOption":"VirtualKeyboard-module__accentOption___ao-Ta"};
|
|
2771
2764
|
|
|
2772
2765
|
const LONG_PRESS_DELAY_MS = 400;
|
|
2773
2766
|
const ACCENT_OPTIONS = {
|
|
2774
|
-
a: ['á', 'à', 'â', 'ã', 'ä', 'å', 'æ'],
|
|
2775
|
-
e: ['é', 'è', 'ê', 'ë'],
|
|
2776
|
-
i: ['í', 'ì', 'î', 'ï'],
|
|
2777
|
-
o: ['ó', 'ò', 'ô', 'õ', 'ö', 'ø', 'œ', '
|
|
2778
|
-
u: ['ú', 'ù', 'û', 'ü'],
|
|
2779
|
-
y: ['ý', 'ÿ'],
|
|
2780
|
-
n: ['ñ'],
|
|
2781
|
-
c: ['ç'],
|
|
2782
|
-
'?': ['¿'],
|
|
2783
|
-
'!': ['¡'],
|
|
2767
|
+
a: ['a', 'á', 'à', 'â', 'ã', 'ä', 'å', 'æ', '@', 'ª'],
|
|
2768
|
+
e: ['e', 'é', 'è', 'ê', 'ë', 'ę', 'ē', 'ė', '€'],
|
|
2769
|
+
i: ['i', 'í', 'ì', 'î', 'ï', 'ī', 'į', 'ı'],
|
|
2770
|
+
o: ['o', 'ó', 'ò', 'ô', 'õ', 'ö', 'ō', 'ø', 'œ', 'º'],
|
|
2771
|
+
u: ['u', 'ú', 'ù', 'û', 'ü', 'ū', 'ů', 'ű'],
|
|
2772
|
+
y: ['y', 'ý', 'ÿ', 'ŷ', 'ȳ'],
|
|
2773
|
+
n: ['n', 'ñ'],
|
|
2774
|
+
c: ['c', 'ç'],
|
|
2775
|
+
'?': ['?', '¿'],
|
|
2776
|
+
'!': ['!', '¡'],
|
|
2784
2777
|
};
|
|
2785
2778
|
/**
|
|
2786
2779
|
* Componente VirtualKeyboard — teclado virtual on-screen para entradas controladas.
|
|
@@ -2816,6 +2809,7 @@ const VirtualKeyboard = ({ variant = 'native', type = 'default', value = '', onC
|
|
|
2816
2809
|
const visualType = NATIVE_LAYOUT_KEYS.has(type) ? type : 'default';
|
|
2817
2810
|
const [isOpen, setIsOpen] = useState(variant !== 'native');
|
|
2818
2811
|
const hideTimeoutRef = useRef(null);
|
|
2812
|
+
const scrollTimeoutRef = useRef(null);
|
|
2819
2813
|
const longPressTimeoutRef = useRef(null);
|
|
2820
2814
|
const suppressNextInputRef = useRef(null);
|
|
2821
2815
|
const heldAccentKeyRef = useRef(null);
|
|
@@ -2825,9 +2819,12 @@ const VirtualKeyboard = ({ variant = 'native', type = 'default', value = '', onC
|
|
|
2825
2819
|
const keyboardInstanceRef = useRef(null);
|
|
2826
2820
|
const accentMenuRef = useRef(null);
|
|
2827
2821
|
const accentButtonRef = useRef(null);
|
|
2828
|
-
const accentMenuOpenRef = useRef(false);
|
|
2829
2822
|
const valueRef = useRef(value);
|
|
2830
2823
|
const [iconSlots, setIconSlots] = useState([]);
|
|
2824
|
+
const [keyPreview, setKeyPreview] = useState(null);
|
|
2825
|
+
const [keyPreviewOffsetX, setKeyPreviewOffsetX] = useState(0);
|
|
2826
|
+
const keyPreviewRef = useRef(null);
|
|
2827
|
+
const [containerWidth, setContainerWidth] = useState(Infinity);
|
|
2831
2828
|
useEffect(() => {
|
|
2832
2829
|
valueRef.current = value;
|
|
2833
2830
|
}, [value]);
|
|
@@ -2861,6 +2858,17 @@ const VirtualKeyboard = ({ variant = 'native', type = 'default', value = '', onC
|
|
|
2861
2858
|
}
|
|
2862
2859
|
}, 150);
|
|
2863
2860
|
}, [variant, targetRef]);
|
|
2861
|
+
const scrollTargetIntoView = useCallback(() => {
|
|
2862
|
+
const targetEl = targetRef?.current;
|
|
2863
|
+
if (!targetEl)
|
|
2864
|
+
return;
|
|
2865
|
+
const keyboardHeight = keyboardWrapperRef.current?.offsetHeight ?? 0;
|
|
2866
|
+
const rect = targetEl.getBoundingClientRect();
|
|
2867
|
+
const visibleBottom = window.innerHeight - keyboardHeight - 8;
|
|
2868
|
+
if (rect.bottom > visibleBottom) {
|
|
2869
|
+
window.scrollBy({ top: rect.bottom - visibleBottom, behavior: 'smooth' });
|
|
2870
|
+
}
|
|
2871
|
+
}, [targetRef]);
|
|
2864
2872
|
useEffect(() => {
|
|
2865
2873
|
if (variant !== 'native')
|
|
2866
2874
|
return;
|
|
@@ -2872,7 +2880,10 @@ const VirtualKeyboard = ({ variant = 'native', type = 'default', value = '', onC
|
|
|
2872
2880
|
const handleFocus = () => {
|
|
2873
2881
|
if (hideTimeoutRef.current !== null)
|
|
2874
2882
|
clearTimeout(hideTimeoutRef.current);
|
|
2883
|
+
if (scrollTimeoutRef.current !== null)
|
|
2884
|
+
clearTimeout(scrollTimeoutRef.current);
|
|
2875
2885
|
setIsOpen(true);
|
|
2886
|
+
scrollTimeoutRef.current = setTimeout(scrollTargetIntoView, 50);
|
|
2876
2887
|
};
|
|
2877
2888
|
const handleBlur = () => {
|
|
2878
2889
|
scheduleHideIfBlurred();
|
|
@@ -2884,8 +2895,26 @@ const VirtualKeyboard = ({ variant = 'native', type = 'default', value = '', onC
|
|
|
2884
2895
|
el.removeEventListener('blur', handleBlur);
|
|
2885
2896
|
if (hideTimeoutRef.current !== null)
|
|
2886
2897
|
clearTimeout(hideTimeoutRef.current);
|
|
2898
|
+
if (scrollTimeoutRef.current !== null)
|
|
2899
|
+
clearTimeout(scrollTimeoutRef.current);
|
|
2887
2900
|
};
|
|
2888
|
-
}, [variant, targetRef, scheduleHideIfBlurred]);
|
|
2901
|
+
}, [variant, targetRef, scheduleHideIfBlurred, scrollTargetIntoView]);
|
|
2902
|
+
useEffect(() => {
|
|
2903
|
+
if (variant !== 'native')
|
|
2904
|
+
return;
|
|
2905
|
+
const wrapper = keyboardWrapperRef.current;
|
|
2906
|
+
if (!wrapper)
|
|
2907
|
+
return;
|
|
2908
|
+
const preventIOSBlur = (event) => {
|
|
2909
|
+
const targetEl = event.target;
|
|
2910
|
+
!!targetEl.closest('.hg-button');
|
|
2911
|
+
event.preventDefault();
|
|
2912
|
+
};
|
|
2913
|
+
wrapper.addEventListener('touchstart', preventIOSBlur, { passive: false });
|
|
2914
|
+
return () => {
|
|
2915
|
+
wrapper.removeEventListener('touchstart', preventIOSBlur);
|
|
2916
|
+
};
|
|
2917
|
+
}, [variant]);
|
|
2889
2918
|
useEffect(() => {
|
|
2890
2919
|
setLayoutName('default');
|
|
2891
2920
|
setCapsLockOn(false);
|
|
@@ -2921,6 +2950,21 @@ const VirtualKeyboard = ({ variant = 'native', type = 'default', value = '', onC
|
|
|
2921
2950
|
document.removeEventListener('keydown', handleEscape);
|
|
2922
2951
|
};
|
|
2923
2952
|
}, [accentMenu, closeAccentMenu]);
|
|
2953
|
+
useLayoutEffect(() => {
|
|
2954
|
+
if (!keyPreview || !keyPreviewRef.current)
|
|
2955
|
+
return;
|
|
2956
|
+
const margin = 8;
|
|
2957
|
+
const rect = keyPreviewRef.current.getBoundingClientRect();
|
|
2958
|
+
if (rect.width <= 0 || rect.height <= 0)
|
|
2959
|
+
return;
|
|
2960
|
+
const minCenter = margin + rect.width / 2;
|
|
2961
|
+
const maxCenter = window.innerWidth - margin - rect.width / 2;
|
|
2962
|
+
const clampedCenter = Math.min(maxCenter, Math.max(minCenter, keyPreview.left));
|
|
2963
|
+
const nextOffset = clampedCenter - keyPreview.left;
|
|
2964
|
+
if (Math.abs(nextOffset - keyPreviewOffsetX) > 0.5) {
|
|
2965
|
+
setKeyPreviewOffsetX(nextOffset);
|
|
2966
|
+
}
|
|
2967
|
+
}, [keyPreview, keyPreviewOffsetX]);
|
|
2924
2968
|
useLayoutEffect(() => {
|
|
2925
2969
|
if (!accentMenu || !accentMenuRef.current)
|
|
2926
2970
|
return;
|
|
@@ -2936,6 +2980,16 @@ const VirtualKeyboard = ({ variant = 'native', type = 'default', value = '', onC
|
|
|
2936
2980
|
setAccentMenuOffsetX(nextOffset);
|
|
2937
2981
|
}
|
|
2938
2982
|
}, [accentMenu, accentMenuOffsetX]);
|
|
2983
|
+
useEffect(() => {
|
|
2984
|
+
const wrapper = keyboardWrapperRef.current;
|
|
2985
|
+
if (!wrapper)
|
|
2986
|
+
return;
|
|
2987
|
+
const ro = new ResizeObserver((entries) => {
|
|
2988
|
+
setContainerWidth(entries[0]?.contentRect.width ?? Infinity);
|
|
2989
|
+
});
|
|
2990
|
+
ro.observe(wrapper);
|
|
2991
|
+
return () => ro.disconnect();
|
|
2992
|
+
}, []);
|
|
2939
2993
|
useEffect(() => {
|
|
2940
2994
|
if (!keyboardWrapperRef.current)
|
|
2941
2995
|
return;
|
|
@@ -2963,13 +3017,8 @@ const VirtualKeyboard = ({ variant = 'native', type = 'default', value = '', onC
|
|
|
2963
3017
|
suppressNextInputRef.current = null;
|
|
2964
3018
|
clearLongPressTimeout();
|
|
2965
3019
|
}, [layoutName, type, closeAccentMenu, clearLongPressTimeout]);
|
|
2966
|
-
useEffect(() => {
|
|
2967
|
-
accentMenuOpenRef.current = !!accentMenu;
|
|
2968
|
-
}, [accentMenu]);
|
|
2969
3020
|
useEffect(() => {
|
|
2970
3021
|
const updateAccentPosition = () => {
|
|
2971
|
-
if (!accentMenuOpenRef.current)
|
|
2972
|
-
return;
|
|
2973
3022
|
const btn = accentButtonRef.current;
|
|
2974
3023
|
if (!btn)
|
|
2975
3024
|
return;
|
|
@@ -2994,20 +3043,31 @@ const VirtualKeyboard = ({ variant = 'native', type = 'default', value = '', onC
|
|
|
2994
3043
|
const buttonEl = event.target.closest('.hg-button');
|
|
2995
3044
|
if (!buttonEl || !keyboardWrapper.contains(buttonEl))
|
|
2996
3045
|
return;
|
|
3046
|
+
event.preventDefault();
|
|
2997
3047
|
const sourceKey = buttonEl.getAttribute('data-skbtn') ?? '';
|
|
2998
3048
|
heldAccentKeyRef.current = null;
|
|
2999
3049
|
longPressTriggeredRef.current = false;
|
|
3050
|
+
if (sourceKey && !sourceKey.startsWith('{') && type !== 'numeric' && containerWidth <= 768) {
|
|
3051
|
+
const buttonRect = buttonEl.getBoundingClientRect();
|
|
3052
|
+
setKeyPreviewOffsetX(0);
|
|
3053
|
+
setKeyPreview({
|
|
3054
|
+
char: sourceKey,
|
|
3055
|
+
top: buttonRect.top - 4,
|
|
3056
|
+
left: buttonRect.left + buttonRect.width / 2,
|
|
3057
|
+
});
|
|
3058
|
+
}
|
|
3000
3059
|
if (!sourceKey || sourceKey.startsWith('{'))
|
|
3001
3060
|
return;
|
|
3061
|
+
heldAccentKeyRef.current = sourceKey;
|
|
3062
|
+
clearLongPressTimeout();
|
|
3002
3063
|
const accentOptions = ACCENT_OPTIONS[sourceKey.toLowerCase()];
|
|
3003
3064
|
if (!accentOptions)
|
|
3004
3065
|
return;
|
|
3005
|
-
heldAccentKeyRef.current = sourceKey;
|
|
3006
|
-
clearLongPressTimeout();
|
|
3007
3066
|
longPressTimeoutRef.current = setTimeout(() => {
|
|
3008
3067
|
const buttonRect = buttonEl.getBoundingClientRect();
|
|
3009
3068
|
const isUpperCaseKey = sourceKey === sourceKey.toUpperCase();
|
|
3010
3069
|
longPressTriggeredRef.current = true;
|
|
3070
|
+
setKeyPreview(null);
|
|
3011
3071
|
accentButtonRef.current = buttonEl;
|
|
3012
3072
|
setAccentMenu({
|
|
3013
3073
|
sourceKey,
|
|
@@ -3020,11 +3080,12 @@ const VirtualKeyboard = ({ variant = 'native', type = 'default', value = '', onC
|
|
|
3020
3080
|
setAccentMenuOffsetX(0);
|
|
3021
3081
|
suppressNextInputRef.current = sourceKey;
|
|
3022
3082
|
}, LONG_PRESS_DELAY_MS);
|
|
3023
|
-
}, [clearLongPressTimeout]);
|
|
3083
|
+
}, [clearLongPressTimeout, type, containerWidth]);
|
|
3024
3084
|
const handleLongPressEnd = useCallback(() => {
|
|
3025
3085
|
const heldKey = heldAccentKeyRef.current;
|
|
3026
3086
|
const longPressTriggered = longPressTriggeredRef.current;
|
|
3027
3087
|
const baseLayout = type === 'numeric' ? 'abc' : 'default';
|
|
3088
|
+
setKeyPreview(null);
|
|
3028
3089
|
isKeyboardInteractingRef.current = false;
|
|
3029
3090
|
clearLongPressTimeout();
|
|
3030
3091
|
if (heldKey && !longPressTriggered) {
|
|
@@ -3185,6 +3246,17 @@ const VirtualKeyboard = ({ variant = 'native', type = 'default', value = '', onC
|
|
|
3185
3246
|
return;
|
|
3186
3247
|
onChange?.(input);
|
|
3187
3248
|
}, [maxLength, onChange, syncKeyboardInput]);
|
|
3249
|
+
const portalSizes = useMemo(() => {
|
|
3250
|
+
if (containerWidth <= 360)
|
|
3251
|
+
return { preview: 42, option: 44, fontSize: 'var(--font-size-16)' };
|
|
3252
|
+
if (containerWidth <= 390)
|
|
3253
|
+
return { preview: 44, option: 44, fontSize: 'var(--font-size-18)' };
|
|
3254
|
+
if (containerWidth <= 480)
|
|
3255
|
+
return { preview: 46, option: 46, fontSize: 'var(--font-size-20)' };
|
|
3256
|
+
if (containerWidth <= 768)
|
|
3257
|
+
return { preview: 48, option: 48, fontSize: undefined };
|
|
3258
|
+
return { preview: 50, option: 50, fontSize: undefined };
|
|
3259
|
+
}, [containerWidth]);
|
|
3188
3260
|
const keyboardDisplay = useMemo(() => {
|
|
3189
3261
|
const baseDisplay = LAYOUT_DISPLAY[visualType];
|
|
3190
3262
|
if (!baseDisplay)
|
|
@@ -3216,21 +3288,31 @@ const VirtualKeyboard = ({ variant = 'native', type = 'default', value = '', onC
|
|
|
3216
3288
|
}
|
|
3217
3289
|
return createPortal(createElement(Icon), slot, `icon-${key}`);
|
|
3218
3290
|
});
|
|
3219
|
-
})(),
|
|
3291
|
+
})(), keyPreview && typeof document !== 'undefined' && createPortal(jsx("div", { ref: keyPreviewRef, className: styles$j.keyPreview, style: {
|
|
3292
|
+
top: keyPreview.top,
|
|
3293
|
+
left: keyPreview.left + keyPreviewOffsetX,
|
|
3294
|
+
width: portalSizes.preview,
|
|
3295
|
+
height: portalSizes.preview,
|
|
3296
|
+
...(portalSizes.fontSize ? { fontSize: portalSizes.fontSize } : {}),
|
|
3297
|
+
}, "aria-hidden": true, children: keyPreview.char }), document.body), accentMenu && (typeof document !== 'undefined' &&
|
|
3220
3298
|
createPortal(jsx("div", { ref: accentMenuRef, className: styles$j.accentMenu, style: {
|
|
3221
3299
|
top: accentMenu.top,
|
|
3222
3300
|
left: accentMenu.left + accentMenuOffsetX,
|
|
3223
|
-
}, role: "listbox", "aria-label": `Opcoes de acento para ${accentMenu.sourceKey}`, children: accentMenu.options.map((option) => (jsx("button", { type: "button", className: styles$j.accentOption,
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3301
|
+
}, role: "listbox", "aria-label": `Opcoes de acento para ${accentMenu.sourceKey}`, children: Array.from({ length: Math.ceil(accentMenu.options.length / 5) }, (_, rowIndex) => accentMenu.options.slice(rowIndex * 5, rowIndex * 5 + 5)).map((rowOptions, rowIndex) => (jsx("div", { className: styles$j.accentMenuRow, children: rowOptions.map((option) => (jsx("button", { type: "button", className: styles$j.accentOption, style: {
|
|
3302
|
+
minWidth: portalSizes.option,
|
|
3303
|
+
height: portalSizes.option,
|
|
3304
|
+
...(portalSizes.fontSize ? { fontSize: portalSizes.fontSize } : {}),
|
|
3305
|
+
}, onPointerDown: (event) => {
|
|
3306
|
+
event.preventDefault();
|
|
3307
|
+
event.stopPropagation();
|
|
3308
|
+
}, onClick: () => handleAccentSelect(option), children: option }, `${accentMenu.sourceKey}-${option}`))) }, rowIndex))) }), document.body))] })) : null;
|
|
3227
3309
|
if (variant === 'native' && typeof document !== 'undefined') {
|
|
3228
3310
|
return createPortal(jsx("div", { id: id, className: clsx(styles$j.overlay, { [styles$j.overlayOpen]: isOpen }, styles$j[`layout--${visualType}`], className), children: keyboardEl }), document.body);
|
|
3229
3311
|
}
|
|
3230
|
-
return (jsxs("div", { id: id, className: clsx(styles$j.container, styles$j[`mode--${variant}`], styles$j[`layout--${visualType}`], className), children: [variant === 'fixed' && (jsx("div", { className: styles$j.textFieldContainer, children: jsx(TextField$1, { placeholder: textFieldPlaceholder, value: value, onChange: onChange, helperText: helperText, error: error, errorMessage: errorMessage, readOnly: true, maxLength: maxLength, attachedToVirtualKeyboard: true, className: styles$j.textFieldWrapper }) })), keyboardEl] }));
|
|
3312
|
+
return (jsxs("div", { id: id, className: clsx(styles$j.container, styles$j[`mode--${variant}`], styles$j[`layout--${visualType}`], className), children: [variant === 'fixed' && (jsx("div", { className: styles$j.textFieldContainer, children: jsx(TextField$1, { placeholder: textFieldPlaceholder, value: value, onChange: onChange, helperText: helperText, error: error, errorMessage: errorMessage, readOnly: true, disableAutoComplete: true, maxLength: maxLength, attachedToVirtualKeyboard: true, className: styles$j.textFieldWrapper }) })), keyboardEl] }));
|
|
3231
3313
|
};
|
|
3232
3314
|
|
|
3233
|
-
var styles$i = {"container":"TextField-module__container___WJHFR","inputWrapper":"TextField-module__inputWrapper___INjfd","inputContainer":"TextField-module__inputContainer___3EsFJ","icon":"TextField-module__icon___p1vwi","clearButton":"TextField-module__clearButton___kgOot","inputWithIcon":"TextField-module__inputWithIcon___shqkL","helperText":"TextField-module__helperText___d5QGC","error":"TextField-module__error___IGQzp","disabled":"TextField-module__disabled___roIKP","attachedToVirtualKeyboard":"TextField-module__attachedToVirtualKeyboard___fuO2O","errorWithMessage":"TextField-module__errorWithMessage___m-5AA"};
|
|
3315
|
+
var styles$i = {"container":"TextField-module__container___WJHFR","inputWrapper":"TextField-module__inputWrapper___INjfd","inputContainer":"TextField-module__inputContainer___3EsFJ","icon":"TextField-module__icon___p1vwi","clearButton":"TextField-module__clearButton___kgOot","inputWithIcon":"TextField-module__inputWithIcon___shqkL","helperText":"TextField-module__helperText___d5QGC","error":"TextField-module__error___IGQzp","disabled":"TextField-module__disabled___roIKP","attachedToVirtualKeyboard":"TextField-module__attachedToVirtualKeyboard___fuO2O","errorWithMessage":"TextField-module__errorWithMessage___m-5AA","clearButtonIcon":"TextField-module__clearButtonIcon___Z2iyc"};
|
|
3234
3316
|
|
|
3235
3317
|
const validateInput = ({ value, maxLength, errorMessage, required }) => {
|
|
3236
3318
|
if (required && value.trim() === '') {
|
|
@@ -3244,8 +3326,11 @@ const validateInput = ({ value, maxLength, errorMessage, required }) => {
|
|
|
3244
3326
|
|
|
3245
3327
|
var styles$h = {"labelContainer":"index-module__labelContainer___WGyDF","wrapperLabel":"index-module__wrapperLabel___XJzZO","requiredLabel":"index-module__requiredLabel___7oZkh","infoIcon":"index-module__infoIcon___lClx4","errorIcon":"index-module__errorIcon___yN-lq","disabledIcon":"index-module__disabledIcon___89Os7","errorLabel":"index-module__errorLabel___qa6h6","disabledLabel":"index-module__disabledLabel___U9vL8","disabledContainer":"index-module__disabledContainer___MtOvy"};
|
|
3246
3328
|
|
|
3247
|
-
const LabelComponent = ({ children, htmlFor, required = false, tooltip = false, tooltipText, side = 'bottom', align = 'start', className, error = false, disabled = false }) => {
|
|
3248
|
-
const
|
|
3329
|
+
const LabelComponent = ({ children, htmlFor, required = false, tooltip = false, tooltipText, side = 'bottom', align = 'start', className, error = false, disabled = false, scale = 1, }) => {
|
|
3330
|
+
const containerStyle = {
|
|
3331
|
+
'--giro-scale': scale,
|
|
3332
|
+
};
|
|
3333
|
+
const container = (jsxs("div", { className: clsx(styles$h.labelContainer, disabled && styles$h.disabledContainer), style: containerStyle, children: [jsxs(Label.Root, { className: clsx(styles$h.wrapperLabel, error && !disabled && styles$h.errorLabel, disabled && styles$h.disabledLabel, className), htmlFor: htmlFor, children: [children, required && jsx("span", { className: styles$h.requiredLabel, children: "*" })] }), tooltip && (jsx("span", { className: disabled ? styles$h.disabledIcon : error ?
|
|
3249
3334
|
styles$h.errorIcon : styles$h.infoIcon, children: jsx(Info12Regular, {}) }))] }));
|
|
3250
3335
|
if (tooltip) {
|
|
3251
3336
|
return (jsx(Tooltip, { side: side, align: align, text: tooltipText || '', children: container }));
|
|
@@ -3253,7 +3338,7 @@ const LabelComponent = ({ children, htmlFor, required = false, tooltip = false,
|
|
|
3253
3338
|
return container;
|
|
3254
3339
|
};
|
|
3255
3340
|
|
|
3256
|
-
const TextField = forwardRef(({ className, value, label, placeholder, type = 'text', onChange, disabled = false, maxLength
|
|
3341
|
+
const TextField = forwardRef(({ className, style, value, label, placeholder, type = 'text', onChange, disabled = false, maxLength, required = false, helperText, tooltip = false, tooltipText, tooltipSide = 'bottom', tooltipAlign = 'start', errorMessage, error, id, icon, scale = 1, onBlur, onFocus, name, persistIcon = false, virtualKeyboard, attachedToVirtualKeyboard, disableAutoComplete = false, ...rest }, ref) => {
|
|
3257
3342
|
const normalizeValue = (val) => {
|
|
3258
3343
|
return val === undefined || val === null ? '' : String(val);
|
|
3259
3344
|
};
|
|
@@ -3313,24 +3398,20 @@ const TextField = forwardRef(({ className, value, label, placeholder, type = 'te
|
|
|
3313
3398
|
: helperText
|
|
3314
3399
|
? `${componentId}-helper`
|
|
3315
3400
|
: undefined;
|
|
3316
|
-
const
|
|
3317
|
-
|
|
3318
|
-
1.5: 'scale-1-5',
|
|
3319
|
-
2: 'scale-2-0',
|
|
3320
|
-
}[scale];
|
|
3321
|
-
const containerClass = clsx(styles$i.container, scaleClass, {
|
|
3322
|
-
[styles$i.disabled]: disabled,
|
|
3323
|
-
[styles$i.error]: hasError && !disabled,
|
|
3324
|
-
[styles$i.errorWithMessage]: Boolean(error) && Boolean(errorMessage) && !disabled,
|
|
3401
|
+
const containerStyle = { '--giro-scale': scale };
|
|
3402
|
+
const containerClass = clsx(styles$i.container, {
|
|
3325
3403
|
[styles$i.attachedToVirtualKeyboard]: attachedToVirtualKeyboard,
|
|
3404
|
+
[styles$i.disabled]: disabled,
|
|
3405
|
+
[styles$i.error]: error,
|
|
3406
|
+
[styles$i.errorWithMessage]: !!errorMessage,
|
|
3326
3407
|
[className]: className,
|
|
3327
3408
|
});
|
|
3328
|
-
return (jsxs("div", { className: containerClass, children: [label && (jsx(LabelComponent, { htmlFor: componentId, required: required, tooltip: tooltip, tooltipText: tooltipText, side:
|
|
3409
|
+
return (jsxs("div", { className: containerClass, style: { ...containerStyle, ...style }, children: [label && (jsx(LabelComponent, { scale: scale, htmlFor: componentId, required: required, tooltip: tooltip, tooltipText: tooltipText, side: tooltipSide, align: tooltipAlign, error: hasError, disabled: disabled, children: label })), jsxs("div", { className: styles$i.inputWrapper, children: [jsxs("div", { className: styles$i.inputContainer, children: [jsx("input", { ...rest, ref: setInputRefs, 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, inputMode: (virtualKeyboard === 'default' || virtualKeyboard === 'numeric') ? 'none' : rest.inputMode, autoComplete: (disableAutoComplete || virtualKeyboard === 'default' || virtualKeyboard === 'numeric') ? 'off' : rest.autoComplete, className: clsx({
|
|
3329
3410
|
[styles$i.inputWithIcon]: showCustomIcon || showClearIcon,
|
|
3330
3411
|
}) }), showCustomIcon && jsx("span", { className: styles$i.icon, children: icon }), showClearIcon && (jsx("button", { type: "button", className: styles$i.clearButton, onMouseDown: (e) => {
|
|
3331
3412
|
e.preventDefault();
|
|
3332
3413
|
handleClear();
|
|
3333
|
-
}, "aria-label": "Limpar campo", tabIndex: -1, children: jsx(Dismiss16Regular, {}) }))] }), (errorMessage || inputError || helperText) && (jsx("span", { id: helperId, className: styles$i.helperText, "aria-live": hasError ? 'polite' : undefined, children: displayHelperText }))] }), virtualKeyboard && (jsx("div", { className: "virtualKeyboardWrapper", children: jsx(VirtualKeyboard, { variant: "native", type:
|
|
3414
|
+
}, "aria-label": "Limpar campo", tabIndex: -1, children: jsx("span", { className: styles$i.clearButtonIcon, children: jsx(Dismiss16Regular, {}) }) }))] }), ((error && errorMessage) || inputError || helperText) && (jsx("span", { id: helperId, className: styles$i.helperText, "aria-live": hasError ? 'polite' : undefined, children: displayHelperText }))] }), (virtualKeyboard === 'default' || virtualKeyboard === 'numeric') && (jsx("div", { className: "virtualKeyboardWrapper", children: jsx(VirtualKeyboard, { variant: "native", type: virtualKeyboard, value: inputValue, maxLength: maxLength, targetRef: inputRef, onChange: (val) => {
|
|
3334
3415
|
if (!disabled && (!maxLength || val.length <= maxLength)) {
|
|
3335
3416
|
setInputValue(val);
|
|
3336
3417
|
onChange?.(val);
|
|
@@ -3432,9 +3513,10 @@ function validatePartialDate(value, locale = 'pt-br') {
|
|
|
3432
3513
|
return 'incomplete';
|
|
3433
3514
|
}
|
|
3434
3515
|
|
|
3435
|
-
const DatePicker = ({ locale = 'pt-br', calendarSide = 'bottom', calendarAlign = 'start', helperText, required = false, label = 'Data', value, defaultValue, onChange, disabled = false, error: externalError, minDate, maxDate, 'data-testid': testId,
|
|
3516
|
+
const DatePicker = ({ locale = 'pt-br', calendarSide = 'bottom', calendarAlign = 'start', helperText, required = false, label = 'Data', value, defaultValue, onChange, disabled = false, error: externalError, minDate, maxDate, 'data-testid': testId, scale = 1, className, style, ...rest }) => {
|
|
3436
3517
|
const fieldId = useId();
|
|
3437
3518
|
const calendarId = `${fieldId}-calendar`;
|
|
3519
|
+
const containerStyle = { '--giro-scale': scale };
|
|
3438
3520
|
const isControlled = value !== undefined;
|
|
3439
3521
|
const [internalDate, setInternalDate] = useState(defaultValue || null);
|
|
3440
3522
|
const [tempInputValue, setTempInputValue] = useState('');
|
|
@@ -3449,11 +3531,6 @@ const DatePicker = ({ locale = 'pt-br', calendarSide = 'bottom', calendarAlign =
|
|
|
3449
3531
|
const combinedHelperText = externalError && helperText
|
|
3450
3532
|
? `${helperText} • ${externalError}`
|
|
3451
3533
|
: externalError || helperText || '';
|
|
3452
|
-
const scaleClass = {
|
|
3453
|
-
1: 'scale-1-0',
|
|
3454
|
-
1.5: 'scale-1-5',
|
|
3455
|
-
2: 'scale-2-0',
|
|
3456
|
-
}[datePickerScale];
|
|
3457
3534
|
useEffect(() => {
|
|
3458
3535
|
function handleClickOutside(event) {
|
|
3459
3536
|
const target = event.target;
|
|
@@ -3566,9 +3643,9 @@ const DatePicker = ({ locale = 'pt-br', calendarSide = 'bottom', calendarAlign =
|
|
|
3566
3643
|
}
|
|
3567
3644
|
}
|
|
3568
3645
|
};
|
|
3569
|
-
return (jsx("div", { ref: wrapperRef, className: clsx(styles$g.datePicker,
|
|
3646
|
+
return (jsx("div", { ref: wrapperRef, className: clsx(styles$g.datePicker, className), style: { ...containerStyle, ...style }, ...rest, children: jsx(Popover, { open: showCalendar, onOpenChange: setShowCalendar, asAnchor: true, trigger: jsx(TextField$1, { className: styles$g.textfieldContainer, type: "tel", icon: jsx(Calendar16Regular, { onClick: !disabled ? handleIconClick : undefined, className: clsx(styles$g.datePickerIcon, disabled && styles$g.datePickerIconDisabled) }), onChange: (e) => {
|
|
3570
3647
|
handleTextFieldChange(String(e));
|
|
3571
|
-
}, 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, scale:
|
|
3648
|
+
}, 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, scale: scale, 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, scale: scale, id: calendarId, onClear: () => {
|
|
3572
3649
|
handleDateChange(null);
|
|
3573
3650
|
setCurrentDate(new Date());
|
|
3574
3651
|
} }), side: calendarSide, align: calendarAlign, sideOffset: 8 }) }));
|
|
@@ -3662,18 +3739,13 @@ const Combined = ({ buttonText = 'Filtrar', icon, variant = 'outlined', disabled
|
|
|
3662
3739
|
|
|
3663
3740
|
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"};
|
|
3664
3741
|
|
|
3665
|
-
const Search = React__default.forwardRef(({ placeholder = 'Dica do que deve ser buscado', disabled = false, value, onChange, onKeyDown, onFocus, onBlur, onClear, onClick, onMouseDown, searchMode = 'instant', onSearch, id, scale = 1, className,
|
|
3742
|
+
const Search = React__default.forwardRef(({ placeholder = 'Dica do que deve ser buscado', disabled = false, value, onChange, onKeyDown, onFocus, onBlur, onClear, onClick, onMouseDown, searchMode = 'instant', onSearch, id, scale = 1, className, style, virtualKeyboard, 'data-testid': testId, ...rest }, ref) => {
|
|
3666
3743
|
const [internalValue, setInternalValue] = useState('');
|
|
3667
3744
|
const { internalRef: inputRef, setRefs: setInputRefs } = useInputKeyboardValue(ref);
|
|
3668
3745
|
const isControlled = value !== undefined && onChange !== undefined;
|
|
3669
3746
|
const currentValue = isControlled ? value : internalValue;
|
|
3670
3747
|
const generatedId = useId();
|
|
3671
3748
|
const inputId = id || generatedId;
|
|
3672
|
-
const scaleClass = {
|
|
3673
|
-
1: 'scale-1-0',
|
|
3674
|
-
1.5: 'scale-1-5',
|
|
3675
|
-
2: 'scale-2-0',
|
|
3676
|
-
}[scale];
|
|
3677
3749
|
const handleChange = (e) => {
|
|
3678
3750
|
if (disabled)
|
|
3679
3751
|
return;
|
|
@@ -3720,12 +3792,12 @@ const Search = React__default.forwardRef(({ placeholder = 'Dica do que deve ser
|
|
|
3720
3792
|
}
|
|
3721
3793
|
onKeyDown?.(e);
|
|
3722
3794
|
};
|
|
3723
|
-
return (jsxs("div", { className: clsx(styles$c.search,
|
|
3795
|
+
return (jsxs("div", { className: clsx(styles$c.search, { [styles$c.disabled]: disabled }, className), style: { '--giro-scale': scale, ...style }, onClick: onClick, onMouseDown: onMouseDown, role: onClick || onMouseDown ? "button" : undefined, tabIndex: onClick || onMouseDown ? 0 : undefined, onKeyDown: onClick || onMouseDown ? (e) => {
|
|
3724
3796
|
if (e.key === 'Enter' || e.key === ' ') {
|
|
3725
3797
|
e.preventDefault();
|
|
3726
3798
|
onClick?.(e);
|
|
3727
3799
|
}
|
|
3728
|
-
} : 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: setInputRefs, 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, inputMode: virtualKeyboard ? 'none' : rest.inputMode, 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, {}) })), virtualKeyboard && (jsx("div", { className: "virtualKeyboardWrapper", children: jsx(VirtualKeyboard, { variant: "native", type:
|
|
3800
|
+
} : 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: setInputRefs, 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, inputMode: (virtualKeyboard === 'default' || virtualKeyboard === 'numeric') ? 'none' : rest.inputMode, 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, {}) })), (virtualKeyboard === 'default' || virtualKeyboard === 'numeric') && (jsx("div", { className: "virtualKeyboardWrapper", children: jsx(VirtualKeyboard, { variant: "native", type: virtualKeyboard, value: currentValue || '', targetRef: inputRef, onChange: (val) => {
|
|
3729
3801
|
if (disabled)
|
|
3730
3802
|
return;
|
|
3731
3803
|
if (isControlled) {
|
|
@@ -3862,15 +3934,10 @@ var styles$b = {"zds-list-item__container":"ListItem-module__zds-list-item__cont
|
|
|
3862
3934
|
|
|
3863
3935
|
var styles$a = {"root":"Radio-module__root___7ElY2","wrapper":"Radio-module__wrapper___NYQ1y","disabled":"Radio-module__disabled___RZ0be","labelText":"Radio-module__labelText___Wkb41","item":"Radio-module__item___3Kvj7","itemWrapper":"Radio-module__itemWrapper___5KbM1","labelWrapper":"Radio-module__labelWrapper___LOHmJ","indicator":"Radio-module__indicator___TJ5hz"};
|
|
3864
3936
|
|
|
3865
|
-
const Radio = ({ items, onValueChange, defaultValue, name, id, ariaLabel, orientation = 'vertical', scale = 1, className, ...rest }) => {
|
|
3937
|
+
const Radio = ({ items, onValueChange, defaultValue, name, id, ariaLabel, orientation = 'vertical', scale = 1, className, style, ...rest }) => {
|
|
3866
3938
|
const generatedId = useId();
|
|
3867
3939
|
const componentId = id || generatedId;
|
|
3868
|
-
|
|
3869
|
-
1: 'scale-1-0',
|
|
3870
|
-
1.5: 'scale-1-5',
|
|
3871
|
-
2: 'scale-2-0',
|
|
3872
|
-
}[scale];
|
|
3873
|
-
return (jsx(RadioGroup.Root, { id: componentId, className: clsx(styles$a.root, scaleClass, className), defaultValue: defaultValue, onValueChange: onValueChange, name: name, "aria-label": ariaLabel, "data-orientation": orientation, orientation: orientation, ...rest, children: items.map(({ id, value, disabled, label }) => {
|
|
3940
|
+
return (jsx(RadioGroup.Root, { id: componentId, className: clsx(styles$a.root, className), style: { '--giro-scale': scale, ...style }, defaultValue: defaultValue, onValueChange: onValueChange, name: name, "aria-label": ariaLabel, "data-orientation": orientation, orientation: orientation, ...rest, children: items.map(({ id, value, disabled, label }) => {
|
|
3874
3941
|
const itemKey = id ?? value;
|
|
3875
3942
|
const uniqueId = `${componentId}-item-${value}`;
|
|
3876
3943
|
return (jsx("div", { className: clsx(styles$a.wrapper, { [styles$a.disabled]: disabled }), children: jsxs("label", { className: styles$a.labelWrapper, htmlFor: uniqueId, children: [jsx("div", { className: styles$a.itemWrapper, children: jsx(RadioGroup.Item, { disabled: disabled, className: styles$a.item, value: value, id: uniqueId, "data-disabled": disabled, children: jsx(RadioGroup.Indicator, { className: styles$a.indicator }) }) }), jsx("span", { className: styles$a.labelText, children: label })] }) }, itemKey));
|
|
@@ -4091,7 +4158,7 @@ const useSearchLogic = ({ items, searchValue, searchTerm, enableApiSearch, onApi
|
|
|
4091
4158
|
return { filteredItems: filteredItems() };
|
|
4092
4159
|
};
|
|
4093
4160
|
|
|
4094
|
-
const Menu = ({ items, children, onItemSelect, search, enableInfiniteScroll, onScrollEnd, isLoadingMore, onApiSearch, enableApiSearch, selectedItems, onOpenChange, align = 'start',
|
|
4161
|
+
const Menu = ({ items, children, onItemSelect, search, enableInfiniteScroll, onScrollEnd, isLoadingMore, onApiSearch, enableApiSearch, selectedItems, onOpenChange, align = 'start', scale = 1, className, style, maxHeight = 400, ...rest }) => {
|
|
4095
4162
|
const itemsWrapperRef = useRef(null);
|
|
4096
4163
|
const hasReachedEndRef = useRef(false);
|
|
4097
4164
|
const observerRef = useRef(null);
|
|
@@ -4101,14 +4168,10 @@ const Menu = ({ items, children, onItemSelect, search, enableInfiniteScroll, onS
|
|
|
4101
4168
|
const [searchInput, setSearchInput] = useState('');
|
|
4102
4169
|
const [searchTerm, setSearchTerm] = useState('');
|
|
4103
4170
|
const maxHeightStyle = typeof maxHeight === 'number' ? `${maxHeight}px` : maxHeight;
|
|
4104
|
-
const
|
|
4105
|
-
|
|
4106
|
-
1.5: 'scale-1-5',
|
|
4107
|
-
2: 'scale-2-0',
|
|
4108
|
-
}[dropdownScale];
|
|
4109
|
-
const triggerWithScale = React__default.isValidElement(children) && buttonScale
|
|
4171
|
+
const containerStyle = { '--giro-scale': scale };
|
|
4172
|
+
const triggerWithScale = React__default.isValidElement(children)
|
|
4110
4173
|
? React__default.cloneElement(children, {
|
|
4111
|
-
scale: children.props?.scale ??
|
|
4174
|
+
scale: children.props?.scale ?? scale,
|
|
4112
4175
|
})
|
|
4113
4176
|
: children;
|
|
4114
4177
|
const { open, setOpen, handleItemSelect: handleItemSelectLogic, isItemSelected } = useMenuLogic({
|
|
@@ -4213,7 +4276,7 @@ const Menu = ({ items, children, onItemSelect, search, enableInfiniteScroll, onS
|
|
|
4213
4276
|
hasReachedEndRef.current = false;
|
|
4214
4277
|
}
|
|
4215
4278
|
};
|
|
4216
|
-
return (jsxs(DropdownMenu.Root, { open: open, onOpenChange: handleOpenChange, children: [jsx(DropdownMenu.Trigger, { asChild: true, children: triggerWithScale }), jsx(DropdownMenu.Portal, { children: jsxs(DropdownMenu.Content, { className: clsx(styles$9.content,
|
|
4279
|
+
return (jsxs(DropdownMenu.Root, { open: open, onOpenChange: handleOpenChange, children: [jsx(DropdownMenu.Trigger, { asChild: true, children: triggerWithScale }), jsx(DropdownMenu.Portal, { children: jsxs(DropdownMenu.Content, { className: clsx(styles$9.content, className), style: { ...containerStyle, ...style }, sideOffset: 8, align: align, onPointerDown: () => { closedByPointerRef.current = true; }, onInteractOutside: () => { closedByPointerRef.current = true; }, onCloseAutoFocus: (e) => {
|
|
4217
4280
|
if (closedByPointerRef.current) {
|
|
4218
4281
|
e.preventDefault();
|
|
4219
4282
|
closedByPointerRef.current = false;
|
|
@@ -4245,7 +4308,7 @@ const Modal = ({ isOpen = false, onClose, title, children, headerContent, closeO
|
|
|
4245
4308
|
|
|
4246
4309
|
var styles$7 = {"quantity":"Quantity-module__quantity___-vndR","quantityInput":"Quantity-module__quantityInput___xZG-v","disabled":"Quantity-module__disabled___X6p5l"};
|
|
4247
4310
|
|
|
4248
|
-
const Quantity = ({ value = 0, onChange, disabled = false, decimal = false, decimalPlaces = 2, size = 'lg', id, valueIncrement = 1, scale = 1, className, inputSize, minValue = 0, maxValue = 9999, decrementAriaLabel = 'Decrease quantity', incrementAriaLabel = 'Increase quantity', inputAriaLabel = 'Quantity', ...rest }) => {
|
|
4311
|
+
const Quantity = ({ value = 0, onChange, disabled = false, decimal = false, decimalPlaces = 2, size = 'lg', id, valueIncrement = 1, scale = 1, className, style, inputSize, minValue = 0, maxValue = 9999, decrementAriaLabel = 'Decrease quantity', incrementAriaLabel = 'Increase quantity', inputAriaLabel = 'Quantity', ...rest }) => {
|
|
4249
4312
|
const initialValue = Math.min(Math.max(value, minValue), maxValue);
|
|
4250
4313
|
const [internalValue, setInternalValue] = useState(initialValue);
|
|
4251
4314
|
const [inputValue, setInputValue] = useState(decimal ? initialValue.toFixed(decimalPlaces) : String(initialValue));
|
|
@@ -4424,17 +4487,12 @@ const Quantity = ({ value = 0, onChange, disabled = false, decimal = false, deci
|
|
|
4424
4487
|
const inputSizeValue = inputSize !== undefined ? inputSize : Math.max(1, inputValue.length);
|
|
4425
4488
|
const uniqueId = useId();
|
|
4426
4489
|
const inputId = id || uniqueId;
|
|
4427
|
-
|
|
4428
|
-
1: 'scale-1-0',
|
|
4429
|
-
1.5: 'scale-1-5',
|
|
4430
|
-
2: 'scale-2-0',
|
|
4431
|
-
}[scale];
|
|
4432
|
-
return (jsxs("div", { className: clsx(styles$7.quantity, scaleClass, { [styles$7.disabled]: disabled }, className), ...rest, children: [jsx(Button, { variant: 'outlined', size: size, type: 'button', iconOnly: true, icon: jsx(Subtract16Regular, {}), onClick: decrement, disabled: disabled || isMinValue, "aria-label": decrementAriaLabel, tooltipText: 'Diminuir' }), jsx("input", { ref: inputRef, className: clsx(styles$7.quantityInput, { [styles$7.disabled]: disabled }), type: 'text', value: inputValue, onChange: handleInputChange, onBlur: handleBlur, onKeyDown: handleInputKeyDown, id: inputId, step: stepValue, "aria-label": inputAriaLabel, role: 'spinbutton', "aria-valuenow": internalValue, "aria-valuemin": minValue, "aria-valuemax": maxValue, disabled: disabled, inputMode: decimal ? 'decimal' : 'numeric', size: inputSizeValue }), jsx(Button, { variant: 'outlined', size: size, type: 'button', iconOnly: true, onClick: increment, disabled: disabled || isMaxValue, "aria-label": incrementAriaLabel, icon: jsx(Add16Regular, {}), tooltipText: 'Aumentar' })] }));
|
|
4490
|
+
return (jsxs("div", { className: clsx(styles$7.quantity, { [styles$7.disabled]: disabled }, className), style: { '--giro-scale': scale, ...style }, ...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', scale: scale }), jsx("input", { ref: inputRef, className: clsx(styles$7.quantityInput, { [styles$7.disabled]: disabled }), type: 'text', value: inputValue, onChange: handleInputChange, onBlur: handleBlur, onKeyDown: handleInputKeyDown, id: inputId, step: stepValue, "aria-label": inputAriaLabel, role: 'spinbutton', "aria-valuenow": internalValue, "aria-valuemin": minValue, "aria-valuemax": maxValue, disabled: disabled, inputMode: decimal ? 'decimal' : 'numeric', size: inputSizeValue }), jsx(Button, { variant: 'outlined', size: size, type: 'button', iconOnly: true, onClick: increment, disabled: disabled || isMaxValue, "aria-label": incrementAriaLabel, icon: jsx(Add16Regular, {}), tooltipText: 'Aumentar', scale: scale })] }));
|
|
4433
4491
|
};
|
|
4434
4492
|
const memorizedQuantity = React__default.memo(Quantity);
|
|
4435
4493
|
memorizedQuantity.displayName = 'Quantity';
|
|
4436
4494
|
|
|
4437
|
-
var styles$6 = {"fieldContainer":"Select-module__fieldContainer___zkWSZ","trigger":"Select-module__trigger___xZVUG","disabled":"Select-module__disabled___kkzG-","open":"Select-module__open___bTuTy","error":"Select-module__error___yikGO","hasValue":"Select-module__hasValue___56T9r","triggerText":"Select-module__triggerText___tfXlq","
|
|
4495
|
+
var styles$6 = {"fieldContainer":"Select-module__fieldContainer___zkWSZ","trigger":"Select-module__trigger___xZVUG","disabled":"Select-module__disabled___kkzG-","open":"Select-module__open___bTuTy","error":"Select-module__error___yikGO","hasValue":"Select-module__hasValue___56T9r","triggerText":"Select-module__triggerText___tfXlq","triggerIcon":"Select-module__triggerIcon___Smobj","content":"Select-module__content___Eftze","viewport":"Select-module__viewport___mMGOo","group":"Select-module__group___wErLt","container":"Select-module__container___U1UI1","containerLabel":"Select-module__containerLabel___-5qpN","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-"};
|
|
4438
4496
|
|
|
4439
4497
|
const CheckboxSelectItem = ({ text, subTitle, disabled, checked, onCheckedChange, value, ...restProps }) => {
|
|
4440
4498
|
const itemRef = useRef(null);
|
|
@@ -4743,7 +4801,7 @@ function useSelectLogic({ value, required = false, search = false, onValueChange
|
|
|
4743
4801
|
};
|
|
4744
4802
|
}
|
|
4745
4803
|
|
|
4746
|
-
const Select = ({ items, onValueChange, onOpenChange, variant, required = false, value, label, helperText, placeholder = 'Selecione', maxWidth, search = false, errorMessage, disabled = false,
|
|
4804
|
+
const Select = ({ items, onValueChange, onOpenChange, variant, required = false, value, label, helperText, placeholder = 'Selecione', maxWidth, search = false, errorMessage, disabled = false, className, style, 'aria-label': ariaLabel, 'data-testid': testId, tooltip = false, tooltipText, side = 'bottom', align = 'start', enableInfiniteScroll = false, onScrollEnd, isLoadingMore = false, enableApiSearch = false, onApiSearch, isSearching = false, scale = 1, ...rest }) => {
|
|
4747
4805
|
const componentId = useId();
|
|
4748
4806
|
const selectId = `select-${componentId}`;
|
|
4749
4807
|
const viewportRef = useRef(null);
|
|
@@ -4790,12 +4848,8 @@ const Select = ({ items, onValueChange, onOpenChange, variant, required = false,
|
|
|
4790
4848
|
}, [items, state.searchTerm, state.searchInput, enableApiSearch, utils]);
|
|
4791
4849
|
const containerStyle = useMemo(() => ({
|
|
4792
4850
|
maxWidth: maxWidth ? `${maxWidth}px` : undefined,
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
1: 'scale-1-0',
|
|
4796
|
-
1.5: 'scale-1-5',
|
|
4797
|
-
2: 'scale-2-0',
|
|
4798
|
-
}[scale];
|
|
4851
|
+
'--giro-scale': scale,
|
|
4852
|
+
}), [maxWidth, scale]);
|
|
4799
4853
|
const handleSearchChange = (e) => {
|
|
4800
4854
|
const value = e.target.value;
|
|
4801
4855
|
actions.setSearchInput(value);
|
|
@@ -4828,14 +4882,14 @@ const Select = ({ items, onValueChange, onOpenChange, variant, required = false,
|
|
|
4828
4882
|
onApiSearch('');
|
|
4829
4883
|
}
|
|
4830
4884
|
};
|
|
4831
|
-
return (jsx(Select$1.Root, { value: variant === 'checkbox' || (search && state.isOpen) ? '' : (state.selectedValues[0] || ''), onValueChange: variant === 'checkbox' ? undefined : actions.handleSingleSelect, required: required, open: state.isOpen, onOpenChange: actions.setOpen, disabled: disabled, ...rest, children: jsxs("div", { className: clsx(styles$6.container,
|
|
4885
|
+
return (jsx(Select$1.Root, { value: variant === 'checkbox' || (search && state.isOpen) ? '' : (state.selectedValues[0] || ''), onValueChange: variant === 'checkbox' ? undefined : actions.handleSingleSelect, required: required, open: state.isOpen, onOpenChange: actions.setOpen, disabled: disabled, ...rest, children: jsxs("div", { className: clsx(styles$6.container, className), style: { ...containerStyle, ...style }, "data-testid": testId, children: [jsx("div", { className: styles$6.fieldContainer, children: jsxs("div", { className: styles$6.containerLabel, children: [jsx(LabelComponent, { htmlFor: selectId, required: required, tooltipText: tooltipText, tooltip: tooltip, side: side, align: align, error: state.hasError && state.touched, disabled: disabled, scale: scale, children: label }), jsxs(Select$1.Trigger, { className: clsx(styles$6.trigger, {
|
|
4832
4886
|
[styles$6.error]: state.hasError && state.touched,
|
|
4833
4887
|
[styles$6.disabled]: disabled,
|
|
4834
4888
|
[styles$6.hasValue]: state.selectedValues.length > 0,
|
|
4835
4889
|
[styles$6.open]: state.isOpen,
|
|
4836
|
-
}), id: selectId, "aria-label": ariaLabel, "data-testid": `${testId}-trigger`, children: [variant === 'checkbox' ? (jsx("span", { className: styles$6.triggerText, children: displayText })) : (jsx(Select$1.Value, { placeholder: placeholder, className: styles$6.placeholder, children: displayText })), state.isOpen ? jsx(ChevronUp16Regular, {}) : jsx(ChevronDown16Regular, {})] }), !state.isOpen && helperText && !state.hasError && (jsx("span", { className: clsx(styles$6.helper, {
|
|
4890
|
+
}), id: selectId, "aria-label": ariaLabel, "data-testid": `${testId}-trigger`, children: [variant === 'checkbox' ? (jsx("span", { className: styles$6.triggerText, children: displayText })) : (jsx(Select$1.Value, { placeholder: placeholder, className: styles$6.placeholder, children: displayText })), jsx("div", { className: styles$6.triggerIcon, children: state.isOpen ? jsx(ChevronUp16Regular, {}) : jsx(ChevronDown16Regular, {}) })] }), !state.isOpen && helperText && !state.hasError && (jsx("span", { className: clsx(styles$6.helper, {
|
|
4837
4891
|
[styles$6.disabled]: disabled
|
|
4838
|
-
}), children: helperText })), state.hasError && state.touched && (jsx("span", { className: styles$6.errorMessage, children: errorMessage || 'Campo obrigatório' }))] }) }), jsx(Select$1.Portal, { children: jsxs(Select$1.Content, { className: styles$6.content, position: "popper", side: "bottom", sideOffset: 8, align: "start", avoidCollisions: true, children: [search && (jsx("div", { className: styles$6.searchWrapper, children: jsx(Search, { ref: refs.searchInputRef, className: styles$6.search, placeholder: "Buscar", value: state.searchInput, onChange: handleSearchChange, onKeyDown: handleSearchKeyDown, onClear: handleClear, "data-testid": `${testId}-search
|
|
4892
|
+
}), children: helperText })), state.hasError && state.touched && (jsx("span", { className: styles$6.errorMessage, children: errorMessage || 'Campo obrigatório' }))] }) }), jsx(Select$1.Portal, { children: jsxs(Select$1.Content, { className: styles$6.content, style: { '--giro-scale': scale }, position: "popper", side: "bottom", sideOffset: 8, align: "start", avoidCollisions: true, children: [search && (jsx("div", { className: styles$6.searchWrapper, children: jsx(Search, { ref: refs.searchInputRef, className: styles$6.search, placeholder: "Buscar", value: state.searchInput, onChange: handleSearchChange, onKeyDown: handleSearchKeyDown, onClear: handleClear, "data-testid": `${testId}-search`, scale: scale }) })), jsx(Select$1.Viewport, { ref: viewportRef, className: styles$6.viewport, "data-testid": testId ? `${testId}-viewport` : undefined, children: jsx(Select$1.Group, { className: styles$6.group, children: filteredItems.length === 0 ? (jsx("div", { className: styles$6.noResults, children: "Nenhum resultado encontrado" })) : (jsxs(Fragment, { children: [filteredItems.map((item) => {
|
|
4839
4893
|
const hasChildren = item.children && item.children.length > 0;
|
|
4840
4894
|
if (hasChildren) {
|
|
4841
4895
|
return (jsx(ExpandableSelectItem, { item: item, variant: variant, selectedValues: state.selectedValues, onSelect: (value) => {
|
|
@@ -5234,7 +5288,7 @@ const TableV2 = ({ columns, data, rowSelection: rowSelectionConfig, enableSortin
|
|
|
5234
5288
|
};
|
|
5235
5289
|
return (jsxs("div", { className: clsx(styles$4.wrapper, className), children: [showBulkActions && (jsxs("div", { className: styles$4.bulkActionsBar, children: [jsxs("div", { className: styles$4.bulkActionsInfo, children: [jsx(Button, { variant: "text", iconOnly: true, icon: jsx(Dismiss16Regular, {}), ariaLabel: "Limpar sele\u00E7\u00E3o", onClick: handleClearSelection, className: styles$4.bulkActionsClearButton }), jsx("span", { className: styles$4.bulkActionsLabel, children: bulkActions.label
|
|
5236
5290
|
? bulkActions.label(selectedCount, selectedRows)
|
|
5237
|
-
: `${selectedCount} ${selectedCount === 1 ? 'item selecionado' : 'itens selecionados'}` })] }), jsx("div", { className: styles$4.bulkActionsButtons, children: bulkActions.actions.map((action, index) => (jsx(Button, { variant: action.variant ?? 'outlined', type: "button", disabled: action.disabled, onClick: action.onClick, size: "sm", children: action.label }, index))) })] })), header && (jsxs("div", { className: styles$4.tableHeader, children: [showSearch && (jsx("div", { className: styles$4.tableHeaderSearchContainer, children: jsx(Search, { value: pendingSearch, virtualKeyboard: header.virtualKeyboard,
|
|
5291
|
+
: `${selectedCount} ${selectedCount === 1 ? 'item selecionado' : 'itens selecionados'}` })] }), jsx("div", { className: styles$4.bulkActionsButtons, children: bulkActions.actions.map((action, index) => (jsx(Button, { variant: action.variant ?? 'outlined', type: "button", disabled: action.disabled, onClick: action.onClick, size: "sm", children: action.label }, index))) })] })), header && (jsxs("div", { className: styles$4.tableHeader, children: [showSearch && (jsx("div", { className: styles$4.tableHeaderSearchContainer, children: jsx(Search, { value: pendingSearch, virtualKeyboard: header.virtualKeyboard, searchMode: header?.searchMode ?? "on-enter", onChange: (e) => {
|
|
5238
5292
|
setPendingSearch(e.target.value);
|
|
5239
5293
|
}, onSearch: (val) => {
|
|
5240
5294
|
if (footer) {
|
|
@@ -5299,7 +5353,7 @@ const TableV2 = ({ columns, data, rowSelection: rowSelectionConfig, enableSortin
|
|
|
5299
5353
|
|
|
5300
5354
|
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"};
|
|
5301
5355
|
|
|
5302
|
-
const TextArea = forwardRef(({ className, value, label, placeholder, onChange, disabled = false, maxLength, required = false, helperText, tooltip = false, tooltipText, side = 'bottom', align = 'start', errorMessage, error, id, onBlur, onFocus, name, resize = 'vertical', showCharCount = false, height, virtualKeyboard
|
|
5356
|
+
const TextArea = forwardRef(({ className, value, label, placeholder, onChange, disabled = false, maxLength, required = false, helperText, tooltip = false, tooltipText, side = 'bottom', align = 'start', errorMessage, error, id, onBlur, onFocus, name, resize = 'vertical', showCharCount = false, height, virtualKeyboard, ...rest }, ref) => {
|
|
5303
5357
|
const normalizeValue = (val) => {
|
|
5304
5358
|
return val === undefined || val === null ? '' : String(val);
|
|
5305
5359
|
};
|
|
@@ -5338,7 +5392,7 @@ const TextArea = forwardRef(({ className, value, label, placeholder, onChange, d
|
|
|
5338
5392
|
? `${componentId}-helper`
|
|
5339
5393
|
: undefined;
|
|
5340
5394
|
const containerClass = clsx(styles$3.container, disabled && styles$3.disabled, hasError && !disabled && styles$3.error, className);
|
|
5341
|
-
return (jsxs("div", { className: containerClass, children: [label && (jsx(LabelComponent, { htmlFor: componentId, required: required, tooltip: tooltip, tooltipText: tooltipText, side: side, align: align, error: hasError, disabled: disabled, children: label })), jsxs("div", { className: styles$3.inputWrapper, children: [jsx("div", { className: styles$3.inputContainer, children: jsx("textarea", { ...rest, ref: setTextareaRefs, id: componentId, name: name, value: textareaValue, placeholder: placeholder, onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur, maxLength: maxLength, disabled: disabled, "aria-invalid": hasError, "aria-required": required, "aria-describedby": helperId, style: { resize, height }, inputMode: virtualKeyboard ? 'none' : rest.inputMode }) }), jsxs("div", { className: styles$3.footer, children: [jsx("span", { id: helperId, className: styles$3.helperText, "aria-live": hasError ? 'polite' : undefined, children: displayHelperText }), showCharCount && maxLength && (jsxs("span", { className: styles$3.charCount, children: [textareaValue.length, "/", maxLength] }))] })] }), virtualKeyboard && (jsx("div", { className: "virtualKeyboardWrapper", children: jsx(VirtualKeyboard, { variant: "native", type:
|
|
5395
|
+
return (jsxs("div", { className: containerClass, children: [label && (jsx(LabelComponent, { htmlFor: componentId, required: required, tooltip: tooltip, tooltipText: tooltipText, side: side, align: align, error: hasError, disabled: disabled, children: label })), jsxs("div", { className: styles$3.inputWrapper, children: [jsx("div", { className: styles$3.inputContainer, children: jsx("textarea", { ...rest, ref: setTextareaRefs, id: componentId, name: name, value: textareaValue, placeholder: placeholder, onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur, maxLength: maxLength, disabled: disabled, "aria-invalid": hasError, "aria-required": required, "aria-describedby": helperId, style: { resize, height }, inputMode: (virtualKeyboard === 'default' || virtualKeyboard === 'numeric') ? 'none' : rest.inputMode }) }), jsxs("div", { className: styles$3.footer, children: [jsx("span", { id: helperId, className: styles$3.helperText, "aria-live": hasError ? 'polite' : undefined, children: displayHelperText }), showCharCount && maxLength && (jsxs("span", { className: styles$3.charCount, children: [textareaValue.length, "/", maxLength] }))] })] }), (virtualKeyboard === 'default' || virtualKeyboard === 'numeric') && (jsx("div", { className: "virtualKeyboardWrapper", children: jsx(VirtualKeyboard, { variant: "native", type: virtualKeyboard, maxLength: maxLength, value: textareaValue, targetRef: textareaRef, onChange: (val) => {
|
|
5342
5396
|
if (!disabled && (!maxLength || val.length <= maxLength)) {
|
|
5343
5397
|
setTextareaValue(val);
|
|
5344
5398
|
onChange?.(val);
|
|
@@ -5556,13 +5610,8 @@ ToastContainer.displayName = 'ToastContainer';
|
|
|
5556
5610
|
|
|
5557
5611
|
var styles$1 = {"container":"Switch-module__container___BR1OB","switchRoot":"Switch-module__switchRoot___jz2HD","switchThumb":"Switch-module__switchThumb___X3RL7"};
|
|
5558
5612
|
|
|
5559
|
-
const Switch = ({ disabled = false, defaultChecked = false, checked, onCheckedChange, scale = 1, className, ...rest }) => {
|
|
5560
|
-
|
|
5561
|
-
1: 'scale-1-0',
|
|
5562
|
-
1.5: 'scale-1-5',
|
|
5563
|
-
2: 'scale-2-0',
|
|
5564
|
-
}[scale];
|
|
5565
|
-
return (jsx("div", { className: clsx(styles$1.container, scaleClass, className), children: jsx(Switch$1.Root, { className: styles$1.switchRoot, disabled: disabled, defaultChecked: defaultChecked, checked: checked, onCheckedChange: onCheckedChange, ...rest, children: jsx(Switch$1.Thumb, { className: styles$1.switchThumb }) }) }));
|
|
5613
|
+
const Switch = ({ disabled = false, defaultChecked = false, checked, onCheckedChange, scale = 1, className, style, ...rest }) => {
|
|
5614
|
+
return (jsx("div", { className: clsx(styles$1.container, className), style: { '--giro-scale': scale, ...style }, children: jsx(Switch$1.Root, { className: styles$1.switchRoot, disabled: disabled, defaultChecked: defaultChecked, checked: checked, onCheckedChange: onCheckedChange, ...rest, children: jsx(Switch$1.Thumb, { className: styles$1.switchThumb }) }) }));
|
|
5566
5615
|
};
|
|
5567
5616
|
|
|
5568
5617
|
var styles = {"zds-verification-code__container":"VerificationCode-module__zds-verification-code__container___tUNuJ","zds-verification-code__input":"VerificationCode-module__zds-verification-code__input___wDIQ6","zds-verification-code__filled":"VerificationCode-module__zds-verification-code__filled___-2VVb","zds-verification-code__has-error":"VerificationCode-module__zds-verification-code__has-error___eqKAp","zds-verification-code__error":"VerificationCode-module__zds-verification-code__error___T53i5"};
|
|
@@ -5979,5 +6028,5 @@ function useInfiniteScroll({ status, page, lastPage, onLoadMore, threshold = 0.1
|
|
|
5979
6028
|
};
|
|
5980
6029
|
}
|
|
5981
6030
|
|
|
5982
|
-
export { Avatar, Badge, Button, Calendar, Callout, Checkbox, MemoizedChips as Chips, Container, DatePicker_default as DatePicker, Dialog, Drawer, Filter, ListItem, Menu, Modal, Popover, memorizedQuantity as Quantity, Radio, Search, Select, Switch, Table, TableHeader, TablePagination, TableV2, TextArea_default as TextArea, TextField$1 as TextField, Toast, ToastContainer, ToastProvider, Tooltip, VerificationCode, VirtualKeyboard, normalizeText, useApiSimulation, useInfiniteScroll, useToast };
|
|
6031
|
+
export { Avatar, Badge, Button, Calendar, Callout, Card, Checkbox, MemoizedChips as Chips, Container, DatePicker_default as DatePicker, Dialog, Drawer, Filter, ListItem, Menu, Modal, Popover, memorizedQuantity as Quantity, Radio, Search, Select, Switch, Table, TableHeader, TablePagination, TableV2, TextArea_default as TextArea, TextField$1 as TextField, Toast, ToastContainer, ToastProvider, Tooltip, VerificationCode, VirtualKeyboard, normalizeText, useApiSimulation, useInfiniteScroll, useToast };
|
|
5983
6032
|
//# sourceMappingURL=index.esm.js.map
|