@giro-ds/react 9.0.0 → 10.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 +879 -79
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +190 -21
- package/dist/index.esm.js +880 -82
- package/dist/index.esm.js.map +1 -1
- package/dist/styles.css +23 -1
- package/package.json +3 -2
package/dist/index.cjs
CHANGED
|
@@ -8,6 +8,7 @@ var reactIcons = require('@fluentui/react-icons');
|
|
|
8
8
|
var reactDayPicker = require('react-day-picker');
|
|
9
9
|
var dateFns = require('date-fns');
|
|
10
10
|
var reactDom = require('react-dom');
|
|
11
|
+
var Keyboard = require('react-simple-keyboard');
|
|
11
12
|
var reactTable = require('@tanstack/react-table');
|
|
12
13
|
var Skeleton = require('react-loading-skeleton');
|
|
13
14
|
|
|
@@ -30,17 +31,17 @@ function _interopNamespaceDefault(e) {
|
|
|
30
31
|
|
|
31
32
|
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
32
33
|
|
|
33
|
-
var styles$
|
|
34
|
+
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"};
|
|
34
35
|
|
|
35
36
|
const Avatar = ({ icon, size = 'lg', src, className, initialLetters, ...rest }) => {
|
|
36
|
-
const AvatarClass = clsx(styles$
|
|
37
|
-
[styles$
|
|
38
|
-
[styles$
|
|
37
|
+
const AvatarClass = clsx(styles$u.AvatarRoot, {
|
|
38
|
+
[styles$u['AvatarRoot--lg']]: size === 'lg',
|
|
39
|
+
[styles$u['AvatarRoot--sm']]: size === 'sm',
|
|
39
40
|
}, className);
|
|
40
|
-
return (jsxRuntime.jsxs(radixUi.Avatar.Root, { className: AvatarClass, ...rest, children: [src && (jsxRuntime.jsx(radixUi.Avatar.Image, { className: styles$
|
|
41
|
+
return (jsxRuntime.jsxs(radixUi.Avatar.Root, { className: AvatarClass, ...rest, children: [src && (jsxRuntime.jsx(radixUi.Avatar.Image, { className: styles$u.AvatarImage, src: src, alt: "Avatar" })), jsxRuntime.jsx(radixUi.Avatar.Fallback, { className: styles$u.AvatarFallback, children: icon || initialLetters })] }));
|
|
41
42
|
};
|
|
42
43
|
|
|
43
|
-
var styles$
|
|
44
|
+
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"};
|
|
44
45
|
|
|
45
46
|
const getDisplayValue = (value) => {
|
|
46
47
|
if (value === null || value === undefined)
|
|
@@ -62,27 +63,27 @@ const Badge = ({ children, badgeValue = null, className, id, filterVariant = fal
|
|
|
62
63
|
const displayValue = getDisplayValue(badgeValue);
|
|
63
64
|
const isEmpty = displayValue === '';
|
|
64
65
|
if (children) {
|
|
65
|
-
return (jsxRuntime.jsxs("div", { className: styles$
|
|
66
|
-
[styles$
|
|
67
|
-
[styles$
|
|
66
|
+
return (jsxRuntime.jsxs("div", { className: styles$t.badgeContainer, ...rest, children: [jsxRuntime.jsx("div", { "data-testid": "badge-content", children: children }), jsxRuntime.jsx("div", { id: componentId, className: clsx(styles$t.badge, {
|
|
67
|
+
[styles$t['badge__empty']]: isEmpty,
|
|
68
|
+
[styles$t['badge__flex']]: displayValue.length >= 2,
|
|
68
69
|
}, className), "data-testid": "badge", children: !isEmpty && jsxRuntime.jsx("span", { "aria-hidden": !!ariaLabel, children: displayValue }) })] }));
|
|
69
70
|
}
|
|
70
|
-
return (jsxRuntime.jsx("div", { className: styles$
|
|
71
|
-
[styles$
|
|
72
|
-
[styles$
|
|
73
|
-
[styles$
|
|
71
|
+
return (jsxRuntime.jsx("div", { className: styles$t.badgeContainer, children: jsxRuntime.jsx("div", { className: clsx(styles$t['badge__status'], {
|
|
72
|
+
[styles$t['badge__status__empty']]: isEmpty,
|
|
73
|
+
[styles$t['badge__status__flex']]: displayValue.length >= 2,
|
|
74
|
+
[styles$t['badge__status__filterBadge']]: filterVariant,
|
|
74
75
|
}, className), "data-testid": "badge", children: !isEmpty && (jsxRuntime.jsx("span", { "aria-hidden": !!ariaLabel, children: displayValue })) }) }));
|
|
75
76
|
};
|
|
76
77
|
|
|
77
|
-
var styles$
|
|
78
|
+
var styles$s = {"tooltipContent":"Tooltip-module__tooltipContent___xycUg","triggerWrapper":"Tooltip-module__triggerWrapper___x83XR"};
|
|
78
79
|
|
|
79
80
|
const Tooltip = ({ children, text, side = 'bottom', align = 'start', maxWidth, sideOffset = 10, className, ...rest }) => {
|
|
80
|
-
return (jsxRuntime.jsx(radixUi.Tooltip.Provider, { children: jsxRuntime.jsxs(radixUi.Tooltip.Root, { children: [jsxRuntime.jsx(radixUi.Tooltip.Trigger, { asChild: true, children: jsxRuntime.jsx("span", { className: styles$
|
|
81
|
+
return (jsxRuntime.jsx(radixUi.Tooltip.Provider, { children: jsxRuntime.jsxs(radixUi.Tooltip.Root, { children: [jsxRuntime.jsx(radixUi.Tooltip.Trigger, { asChild: true, children: jsxRuntime.jsx("span", { className: styles$s.triggerWrapper, children: children }) }), jsxRuntime.jsx(radixUi.Tooltip.Portal, { children: jsxRuntime.jsx(radixUi.Tooltip.Content, { className: clsx(styles$s.tooltipContent, className), side: side, align: align, sideOffset: sideOffset, style: { maxWidth: maxWidth ? `${maxWidth}px` : 'auto' }, ...rest, children: text }) })] }) }));
|
|
81
82
|
};
|
|
82
83
|
|
|
83
|
-
var styles$
|
|
84
|
+
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"};
|
|
84
85
|
|
|
85
|
-
const Button = React.forwardRef(({ as, children, variant = 'filled', iconPosition = 'left', href, to, external = false, target, rel, disabled = false, onClick, size = 'lg', className, type = 'button', id, icon, fullWidth = false, ariaLabel, iconOnly = false, loading = false, tooltipText, tooltipSide = 'top', tooltipAlign = 'center', ...rest }, ref) => {
|
|
86
|
+
const Button = React.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) => {
|
|
86
87
|
const generatedId = React.useId();
|
|
87
88
|
const componentId = id || generatedId;
|
|
88
89
|
const getComponent = () => {
|
|
@@ -109,14 +110,19 @@ const Button = React.forwardRef(({ as, children, variant = 'filled', iconPositio
|
|
|
109
110
|
'Forneça um ícone via `icon={<MeuIcone />}`.');
|
|
110
111
|
}
|
|
111
112
|
const resolvedIcon = icon;
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
[styles$
|
|
119
|
-
[styles$
|
|
113
|
+
const scaleClass = {
|
|
114
|
+
1: 'scale-1-0',
|
|
115
|
+
1.5: 'scale-1-5',
|
|
116
|
+
2: 'scale-2-0',
|
|
117
|
+
}[scale];
|
|
118
|
+
const buttonClasses = clsx(styles$r.button, styles$r[`button-${variant}`], styles$r[`button-${size}`], scaleClass, {
|
|
119
|
+
[styles$r['disabled']]: disabled,
|
|
120
|
+
[styles$r['buttonLoading']]: loading,
|
|
121
|
+
[styles$r['buttonWithIcon']]: resolvedIcon && !iconOnly,
|
|
122
|
+
[styles$r[`buttonIconPosition-${iconPosition}`]]: resolvedIcon && !iconOnly,
|
|
123
|
+
[styles$r['buttonNoContent']]: resolvedIcon && !hasContent && !iconOnly,
|
|
124
|
+
[styles$r['buttonFullWidth']]: fullWidth,
|
|
125
|
+
[styles$r['buttonIconOnly']]: iconOnly,
|
|
120
126
|
}, className);
|
|
121
127
|
const getAriaLabel = () => {
|
|
122
128
|
if (ariaLabel)
|
|
@@ -142,12 +148,12 @@ const Button = React.forwardRef(({ as, children, variant = 'filled', iconPositio
|
|
|
142
148
|
};
|
|
143
149
|
const renderContent = () => {
|
|
144
150
|
if (iconOnly && !loading) {
|
|
145
|
-
return (jsxRuntime.jsx("span", { className: styles$
|
|
151
|
+
return (jsxRuntime.jsx("span", { className: styles$r.buttonIconOnly, "aria-hidden": "true", children: resolvedIcon }));
|
|
146
152
|
}
|
|
147
153
|
if (loading) {
|
|
148
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [!iconOnly && (jsxRuntime.jsxs("span", { className: styles$
|
|
154
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [!iconOnly && (jsxRuntime.jsxs("span", { className: styles$r.buttonContentHidden, "aria-hidden": "true", children: [resolvedIcon && (iconPosition === 'left' || iconPosition === 'both') && (jsxRuntime.jsx("span", { className: styles$r.buttonIconLeft, children: resolvedIcon })), children, resolvedIcon && (iconPosition === 'right' || iconPosition === 'both') && (jsxRuntime.jsx("span", { className: styles$r.buttonIconRight, children: resolvedIcon }))] })), jsxRuntime.jsx("span", { className: styles$r.buttonLoadingSpinner, "aria-hidden": "true", children: jsxRuntime.jsx(reactIcons.SpinnerIos16Regular, { "aria-hidden": "true" }) })] }));
|
|
149
155
|
}
|
|
150
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [resolvedIcon && (iconPosition === 'left' || iconPosition === 'both') && (jsxRuntime.jsx("span", { className: styles$
|
|
156
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [resolvedIcon && (iconPosition === 'left' || iconPosition === 'both') && (jsxRuntime.jsx("span", { className: styles$r.buttonIconLeft, "aria-hidden": "true", children: resolvedIcon })), children, resolvedIcon && (iconPosition === 'right' || iconPosition === 'both') && (jsxRuntime.jsx("span", { className: styles$r.buttonIconRight, "aria-hidden": "true", children: resolvedIcon }))] }));
|
|
151
157
|
};
|
|
152
158
|
const baseProps = {
|
|
153
159
|
ref,
|
|
@@ -2452,7 +2458,7 @@ const ptBR = {
|
|
|
2452
2458
|
},
|
|
2453
2459
|
};
|
|
2454
2460
|
|
|
2455
|
-
var styles$
|
|
2461
|
+
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"};
|
|
2456
2462
|
|
|
2457
2463
|
const FLUENT_CHEVRON_MAP = {
|
|
2458
2464
|
down: reactIcons.ChevronDown16Regular,
|
|
@@ -2471,10 +2477,10 @@ const GridMonthCaption = ({ calendarMonth, displayIndex: _displayIndex, ...divPr
|
|
|
2471
2477
|
const date = calendarMonth.date;
|
|
2472
2478
|
const monthLabel = new Intl.DateTimeFormat(intlLocale, { month: "long" }).format(date);
|
|
2473
2479
|
const yearLabel = String(date.getFullYear());
|
|
2474
|
-
return (jsxRuntime.jsxs("div", { ...divProps, children: [jsxRuntime.jsx("span", { className: styles$
|
|
2480
|
+
return (jsxRuntime.jsxs("div", { ...divProps, children: [jsxRuntime.jsx("span", { className: styles$q.caption_grid_label, children: monthLabel }), jsxRuntime.jsxs("button", { type: "button", className: styles$q.caption_grid_btn, "aria-pressed": view === "years", onClick: onYearLabelClick, children: [yearLabel, view !== "days" ? (jsxRuntime.jsx(reactIcons.ChevronUp16Regular, { className: styles$q.caption_year_chevron, "aria-hidden": true })) : (jsxRuntime.jsx(reactIcons.ChevronDown16Regular, { className: styles$q.caption_year_chevron, "aria-hidden": true }))] })] }));
|
|
2475
2481
|
};
|
|
2476
2482
|
const YEARS_PER_PAGE = 20;
|
|
2477
|
-
const Calendar = ({ selected, currentDate, defaultMonth, startMonth, endMonth, onDaySelect, onDateChange, onClear: _onClear, minDate, maxDate, disabled, format: _format, locale = "pt-br", autoFocus, className, id, "aria-label": ariaLabel, ...rest }) => {
|
|
2483
|
+
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 }) => {
|
|
2478
2484
|
const animate = true;
|
|
2479
2485
|
const [internalSelected, setInternalSelected] = React.useState(selected ?? undefined);
|
|
2480
2486
|
const [internalDisplayMonth, setInternalDisplayMonth] = React.useState(() => currentDate ?? defaultMonth ?? new Date());
|
|
@@ -2539,7 +2545,7 @@ const Calendar = ({ selected, currentDate, defaultMonth, startMonth, endMonth, o
|
|
|
2539
2545
|
onYearLabelClick: handleYearLabelClick,
|
|
2540
2546
|
};
|
|
2541
2547
|
const sharedDayPickerProps = {
|
|
2542
|
-
classNames: styles$
|
|
2548
|
+
classNames: styles$q,
|
|
2543
2549
|
animate,
|
|
2544
2550
|
mode: "single",
|
|
2545
2551
|
selected: resolvedSelected,
|
|
@@ -2551,10 +2557,15 @@ const Calendar = ({ selected, currentDate, defaultMonth, startMonth, endMonth, o
|
|
|
2551
2557
|
autoFocus,
|
|
2552
2558
|
"aria-label": ariaLabel,
|
|
2553
2559
|
};
|
|
2554
|
-
|
|
2560
|
+
const scaleClass = {
|
|
2561
|
+
1: 'scale-1-0',
|
|
2562
|
+
1.5: 'scale-1-5',
|
|
2563
|
+
2: 'scale-2-0',
|
|
2564
|
+
}[scale];
|
|
2565
|
+
return (jsxRuntime.jsx(GridCtx.Provider, { value: gridCtxValue, children: jsxRuntime.jsxs("div", { className: clsx(styles$q.calendar_grid_wrapper, scaleClass, className), children: [jsxRuntime.jsx(reactDayPicker.DayPicker, { id: id, ...sharedDayPickerProps, ...rest, captionLayout: "label", month: resolvedDisplayMonth, onMonthChange: handleMonthChange, components: { MonthCaption: GridMonthCaption, Chevron: CustomChevron } }), gridView !== "days" && (jsxRuntime.jsxs("div", { className: `${styles$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" && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: styles$q.gridOverlayCaption, children: [jsxRuntime.jsx("span", { className: styles$q.caption_grid_label, children: new Intl.DateTimeFormat(intlLocale, { month: "long" }).format(resolvedDisplayMonth) }), jsxRuntime.jsxs("button", { type: "button", className: styles$q.caption_grid_btn, onClick: () => setGridView("days"), "aria-label": "Fechar sele\u00E7\u00E3o de m\u00EAs", children: [displayedYear, jsxRuntime.jsx(reactIcons.ChevronUp16Regular, { className: styles$q.caption_year_chevron, "aria-hidden": true })] })] }), jsxRuntime.jsx("div", { className: styles$q.gridCells, children: monthsGrid.map(({ index, label, disabled: monthDisabled }) => (jsxRuntime.jsx("button", { type: "button", disabled: monthDisabled, className: `${styles$q.gridCell}${displayedMonthIndex === index ? ` ${styles$q.gridCellActive}` : ""}`, onClick: () => handleGridMonthSelect(index), children: label }, index))) })] })), gridView === "years" && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: styles$q.gridOverlayCaption, children: [jsxRuntime.jsx("span", { className: styles$q.caption_grid_label, children: new Intl.DateTimeFormat(intlLocale, { month: "long" }).format(resolvedDisplayMonth) }), jsxRuntime.jsxs("button", { type: "button", className: styles$q.caption_grid_btn, onClick: () => setGridView("days"), "aria-label": "Fechar sele\u00E7\u00E3o de ano", children: [displayedYear, jsxRuntime.jsx(reactIcons.ChevronUp16Regular, { className: styles$q.caption_year_chevron, "aria-hidden": true })] }), jsxRuntime.jsxs("div", { className: styles$q.gridOverlayYearsNav, children: [jsxRuntime.jsx("button", { type: "button", className: styles$q.gridNavBtn, disabled: !canGoPrevYears, onClick: () => setYearPageStart((s) => s - YEARS_PER_PAGE), "aria-label": "Anos anteriores", children: jsxRuntime.jsx(reactIcons.ChevronLeft16Regular, { className: styles$q.chevronNavBtnPrev, "aria-hidden": true }) }), jsxRuntime.jsx("button", { type: "button", className: styles$q.gridNavBtn, disabled: !canGoNextYears, onClick: () => setYearPageStart((s) => s + YEARS_PER_PAGE), "aria-label": "Pr\u00F3ximos anos", children: jsxRuntime.jsx(reactIcons.ChevronRight16Regular, { className: styles$q.chevronNavBtnNext, "aria-hidden": true }) })] })] }), jsxRuntime.jsx("div", { className: `${styles$q.gridCells} ${styles$q.gridCellsYears}`, children: yearsInPage.map((year) => (jsxRuntime.jsx("button", { type: "button", className: `${styles$q.gridCell}${displayedYear === year ? ` ${styles$q.gridCellActive}` : ""}`, onClick: () => handleGridYearSelect(year), children: year }, year))) })] }))] }))] }) }));
|
|
2555
2566
|
};
|
|
2556
2567
|
|
|
2557
|
-
var styles$
|
|
2568
|
+
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"};
|
|
2558
2569
|
|
|
2559
2570
|
const Callout = ({ variant = 'neutral', title, text, icon, onDismiss, dismiss, backgroundColor, textColor, className, id, style, ...rest }) => {
|
|
2560
2571
|
if (process.env.NODE_ENV !== 'production' && (text === '' || (typeof text === 'string' && !text.trim()))) {
|
|
@@ -2564,15 +2575,21 @@ const Callout = ({ variant = 'neutral', title, text, icon, onDismiss, dismiss, b
|
|
|
2564
2575
|
const titleId = `callout-title-${id || generatedId}`;
|
|
2565
2576
|
const componentId = id || generatedId;
|
|
2566
2577
|
const isAlert = variant === 'alert';
|
|
2567
|
-
const containerClass = clsx(styles$
|
|
2578
|
+
const containerClass = clsx(styles$p.container, styles$p[variant], { [styles$p.withTitle]: title }, className);
|
|
2568
2579
|
const customStyle = {
|
|
2569
2580
|
...style,
|
|
2570
2581
|
...(backgroundColor && { '--callout-bg': `var(--${backgroundColor})` }),
|
|
2571
2582
|
...(textColor && { '--callout-text': `var(--${textColor})` }),
|
|
2572
2583
|
};
|
|
2573
|
-
return (jsxRuntime.jsx("div", { id: componentId, className: containerClass, role: isAlert ? 'alert' : 'status', "aria-live": isAlert ? 'assertive' : 'polite', "aria-labelledby": title ? titleId : undefined, style: customStyle, ...rest, children: jsxRuntime.jsxs("div", { className: styles$
|
|
2584
|
+
return (jsxRuntime.jsx("div", { id: componentId, className: containerClass, role: isAlert ? 'alert' : 'status', "aria-live": isAlert ? 'assertive' : 'polite', "aria-labelledby": title ? titleId : undefined, style: customStyle, ...rest, children: jsxRuntime.jsxs("div", { className: styles$p.content, children: [icon && jsxRuntime.jsx("span", { className: styles$p.icon, "aria-hidden": "true", children: icon }), jsxRuntime.jsxs("div", { className: styles$p.subcontent, children: [title && (jsxRuntime.jsx("span", { id: titleId, className: styles$p.title, children: title })), text && jsxRuntime.jsx("span", { className: styles$p.text, children: text })] }), dismiss && (jsxRuntime.jsx("button", { className: styles$p.dismiss, onClick: onDismiss, type: "button", "aria-label": "Fechar", children: jsxRuntime.jsx(reactIcons.Dismiss24Regular, { "aria-hidden": "true" }) }))] }) }));
|
|
2574
2585
|
};
|
|
2575
2586
|
|
|
2587
|
+
var styles$o = {"card":"Card-module__card___LzN-3","card--hoverable":"Card-module__card--hoverable___orpJZ"};
|
|
2588
|
+
|
|
2589
|
+
function Card({ children, className, hoverable }) {
|
|
2590
|
+
return (jsxRuntime.jsx("main", { className: clsx(styles$o['card'], hoverable && styles$o['card--hoverable'], className), children: children }));
|
|
2591
|
+
}
|
|
2592
|
+
|
|
2576
2593
|
const CheckSmall = ({ className = '', width = 12, height = 10, fill = 'white', ...restProps }) => {
|
|
2577
2594
|
return (jsxRuntime.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: jsxRuntime.jsx("path", { d: "M4 9.4L0 5.4L1.4 4L4 6.6L10.6 0L12 1.4L4 9.4Z", fill: fill }) }));
|
|
2578
2595
|
};
|
|
@@ -2581,22 +2598,32 @@ const CheckHalf = ({ className = '', width = 16, height = 16, fill = 'white', ..
|
|
|
2581
2598
|
return (jsxRuntime.jsx("svg", { width: width, height: height, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, "aria-hidden": "true", ...restProps, children: jsxRuntime.jsx("g", { id: "Icons/check_indeterminate_small", children: jsxRuntime.jsx("path", { id: "icon", d: "M3 9V7H13V9H3Z", fill: fill }) }) }));
|
|
2582
2599
|
};
|
|
2583
2600
|
|
|
2584
|
-
var styles$
|
|
2601
|
+
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"};
|
|
2585
2602
|
|
|
2586
|
-
const Checkbox = ({ id, label, onCheckedChange, checked, disabled, className, indeterminate = false, ...rest }) => {
|
|
2603
|
+
const Checkbox = ({ id, label, onCheckedChange, checked, disabled, className, scale = 1, indeterminate = false, ...rest }) => {
|
|
2587
2604
|
const componentId = id || React__namespace.useId();
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2605
|
+
const scaleClass = {
|
|
2606
|
+
1: 'scale-1-0',
|
|
2607
|
+
1.5: 'scale-1-5',
|
|
2608
|
+
2: 'scale-2-0',
|
|
2609
|
+
}[scale];
|
|
2610
|
+
return (jsxRuntime.jsxs("div", { className: clsx(styles$n.container, scaleClass, className), children: [jsxRuntime.jsx("div", { className: clsx(styles$n.wrapperCheckbox, {
|
|
2611
|
+
[styles$n.disabled]: disabled,
|
|
2612
|
+
}), role: "presentation", tabIndex: disabled ? -1 : 0, children: jsxRuntime.jsx(radixUi.Checkbox.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: jsxRuntime.jsx(radixUi.Checkbox.Indicator, { className: styles$n.indicator, children: indeterminate ? jsxRuntime.jsx(CheckHalf, {}) : jsxRuntime.jsx(CheckSmall, {}) }) }) }), jsxRuntime.jsx("label", { className: clsx(styles$n.label, { [styles$n.disabled]: disabled }), htmlFor: componentId, children: label })] }));
|
|
2591
2613
|
};
|
|
2592
2614
|
|
|
2593
|
-
var styles$
|
|
2594
|
-
|
|
2595
|
-
const Chips = ({ children, leftIcon, rightIcon, variant = 'neutral', disabled = false, backgroundColor, textColor, className, style, ...rest }) => {
|
|
2596
|
-
const
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2615
|
+
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"};
|
|
2616
|
+
|
|
2617
|
+
const Chips = ({ children, leftIcon, rightIcon, variant = 'neutral', disabled = false, backgroundColor, textColor, scale = 1, className, style, ...rest }) => {
|
|
2618
|
+
const scaleClass = {
|
|
2619
|
+
1: 'scale-1-0',
|
|
2620
|
+
1.5: 'scale-1-5',
|
|
2621
|
+
2: 'scale-2-0',
|
|
2622
|
+
}[scale];
|
|
2623
|
+
const chipsClass = clsx(styles$m.chips, styles$m[variant], scaleClass, {
|
|
2624
|
+
[styles$m.disabled]: disabled,
|
|
2625
|
+
[styles$m.hasLeftIcon]: leftIcon,
|
|
2626
|
+
[styles$m.hasRightIcon]: rightIcon,
|
|
2600
2627
|
}, className);
|
|
2601
2628
|
const colorStyle = {
|
|
2602
2629
|
...(!disabled && backgroundColor && { '--chips-bg': `var(--${backgroundColor})` }),
|
|
@@ -2604,24 +2631,720 @@ const Chips = ({ children, leftIcon, rightIcon, variant = 'neutral', disabled =
|
|
|
2604
2631
|
...style,
|
|
2605
2632
|
};
|
|
2606
2633
|
const isInteractive = typeof rest.onClick === 'function';
|
|
2607
|
-
return (jsxRuntime.jsxs("div", { className: chipsClass, "aria-disabled": disabled, style: colorStyle, role: isInteractive ? 'button' : undefined, tabIndex: isInteractive ? (disabled ? -1 : 0) : undefined, ...rest, children: [leftIcon && (jsxRuntime.jsx("span", { className: styles$
|
|
2634
|
+
return (jsxRuntime.jsxs("div", { className: chipsClass, "aria-disabled": disabled, style: colorStyle, role: isInteractive ? 'button' : undefined, tabIndex: isInteractive ? (disabled ? -1 : 0) : undefined, ...rest, children: [leftIcon && (jsxRuntime.jsx("span", { className: styles$m.iconLeft, "aria-hidden": "true", children: leftIcon })), jsxRuntime.jsx("span", { className: styles$m.title, children: children }), rightIcon && (jsxRuntime.jsx("span", { className: styles$m.iconRight, children: rightIcon }))] }));
|
|
2608
2635
|
};
|
|
2609
2636
|
const MemoizedChips = React.memo(Chips);
|
|
2610
2637
|
MemoizedChips.displayName = 'Chips';
|
|
2611
2638
|
|
|
2612
|
-
var styles$
|
|
2639
|
+
var styles$l = {"container":"Container-module__container___exPuE"};
|
|
2613
2640
|
|
|
2614
2641
|
function Container({ children, className }) {
|
|
2615
|
-
return (jsxRuntime.jsx("main", { className: clsx(styles$
|
|
2642
|
+
return (jsxRuntime.jsx("main", { className: clsx(styles$l['container'], 'mx-auto', className), children: children }));
|
|
2616
2643
|
}
|
|
2617
2644
|
|
|
2618
|
-
var styles$
|
|
2645
|
+
var styles$k = {"Content":"Popover-module__Content___RIETg"};
|
|
2619
2646
|
|
|
2620
2647
|
const Popover = ({ trigger, content, side = "left", align = "start", sideOffset = 8, open, onOpenChange, asAnchor = false, onOpenAutoFocus, onCloseAutoFocus, showArrow = false, className, ...rest }) => {
|
|
2621
|
-
return (jsxRuntime.jsxs(radixUi.Popover.Root, { open: open, onOpenChange: onOpenChange, ...rest, children: [asAnchor ? (jsxRuntime.jsx(radixUi.Popover.Anchor, { asChild: true, children: trigger })) : (jsxRuntime.jsx(radixUi.Popover.Trigger, { asChild: true, children: trigger })), jsxRuntime.jsx(radixUi.Popover.Portal, { children: jsxRuntime.jsxs(radixUi.Popover.Content, { className: clsx(styles$
|
|
2648
|
+
return (jsxRuntime.jsxs(radixUi.Popover.Root, { open: open, onOpenChange: onOpenChange, ...rest, children: [asAnchor ? (jsxRuntime.jsx(radixUi.Popover.Anchor, { asChild: true, children: trigger })) : (jsxRuntime.jsx(radixUi.Popover.Trigger, { asChild: true, children: trigger })), jsxRuntime.jsx(radixUi.Popover.Portal, { children: jsxRuntime.jsxs(radixUi.Popover.Content, { className: clsx(styles$k.Content, className), sideOffset: sideOffset, side: side, align: align, onOpenAutoFocus: asAnchor ? (e) => e.preventDefault() : onOpenAutoFocus, onCloseAutoFocus: asAnchor ? (e) => e.preventDefault() : onCloseAutoFocus, onInteractOutside: asAnchor ? (e) => e.preventDefault() : undefined, children: [content, showArrow && jsxRuntime.jsx(radixUi.Popover.Arrow, {})] }) })] }));
|
|
2649
|
+
};
|
|
2650
|
+
|
|
2651
|
+
function useInputKeyboardValue(externalRef) {
|
|
2652
|
+
const internalRef = React.useRef(null);
|
|
2653
|
+
const setRefs = React.useCallback((node) => {
|
|
2654
|
+
internalRef.current = node;
|
|
2655
|
+
if (typeof externalRef === 'function') {
|
|
2656
|
+
externalRef(node);
|
|
2657
|
+
return;
|
|
2658
|
+
}
|
|
2659
|
+
if (externalRef) {
|
|
2660
|
+
externalRef.current = node;
|
|
2661
|
+
}
|
|
2662
|
+
}, [externalRef]);
|
|
2663
|
+
return { internalRef, setRefs };
|
|
2664
|
+
}
|
|
2665
|
+
|
|
2666
|
+
const iconSlot = (key) => `<span data-icon-key="${key}"></span>`;
|
|
2667
|
+
const ICON_KEY_MAP = {
|
|
2668
|
+
bksp: reactIcons.Backspace20Regular,
|
|
2669
|
+
shift: reactIcons.KeyboardShift20Regular,
|
|
2670
|
+
shiftactivated: reactIcons.KeyboardShift20Filled,
|
|
2671
|
+
capslock: reactIcons.KeyboardShiftUppercase20Regular,
|
|
2672
|
+
downkeyboard: reactIcons.ChevronDown20Regular,
|
|
2673
|
+
emoji: reactIcons.Emoji20Regular,
|
|
2674
|
+
};
|
|
2675
|
+
const SHARED_DISPLAY = {
|
|
2676
|
+
'{capslock}': iconSlot('capslock'),
|
|
2677
|
+
'{numbers}': '123',
|
|
2678
|
+
'{abc}': 'Abc',
|
|
2679
|
+
'{alt}': '.?!',
|
|
2680
|
+
'{alt2}': '#+=',
|
|
2681
|
+
'{emoticon}': iconSlot('emoji'),
|
|
2682
|
+
'{shift}': iconSlot('shift'),
|
|
2683
|
+
'{shiftactivated}': iconSlot('shiftactivated'),
|
|
2684
|
+
'{enter}': 'Enter',
|
|
2685
|
+
'{bksp}': iconSlot('bksp'),
|
|
2686
|
+
'{altright}': '.?123',
|
|
2687
|
+
'{downkeyboard}': iconSlot('downkeyboard'),
|
|
2688
|
+
'{space}': ' ',
|
|
2689
|
+
'{default}': 'Abc',
|
|
2690
|
+
};
|
|
2691
|
+
const LAYOUT_DISPLAY = {
|
|
2692
|
+
default: SHARED_DISPLAY,
|
|
2693
|
+
numeric: SHARED_DISPLAY,
|
|
2694
|
+
};
|
|
2695
|
+
|
|
2696
|
+
const EMOTICON_KEY = '{emoticon}';
|
|
2697
|
+
const DOWN_KEYBOARD_KEY = '{downkeyboard}';
|
|
2698
|
+
const removeKeyFromLayout = (layout, key) => Object.fromEntries(Object.entries(layout).map(([layoutName, rows]) => [
|
|
2699
|
+
layoutName,
|
|
2700
|
+
rows.map((row) => row.split(key).join(' ').replace(/\s+/g, ' ').trim()),
|
|
2701
|
+
]));
|
|
2702
|
+
const QWERTY_LOWERCASE = [
|
|
2703
|
+
'1 2 3 4 5 6 7 8 9 0',
|
|
2704
|
+
'q w e r t y u i o p',
|
|
2705
|
+
'a s d f g h j k l ç',
|
|
2706
|
+
'{shift} z x c v b n m {bksp}',
|
|
2707
|
+
'{numbers} {alt} {space} . {enter}',
|
|
2708
|
+
];
|
|
2709
|
+
const NUMPAD = ['1 2 3', '4 5 6', '7 8 9', '{bksp} 0 {abc}'];
|
|
2710
|
+
const SHARED_LAYOUTS = {
|
|
2711
|
+
shift: [
|
|
2712
|
+
'1 2 3 4 5 6 7 8 9 0',
|
|
2713
|
+
'Q W E R T Y U I O P',
|
|
2714
|
+
'A S D F G H J K L Ç',
|
|
2715
|
+
'{capslock} Z X C V B N M {bksp}',
|
|
2716
|
+
'{numbers} {alt} {emoticon} {space} . {enter}',
|
|
2717
|
+
],
|
|
2718
|
+
caps: [
|
|
2719
|
+
'1 2 3 4 5 6 7 8 9 0',
|
|
2720
|
+
'Q W E R T Y U I O P',
|
|
2721
|
+
'A S D F G H J K L Ç',
|
|
2722
|
+
'{shiftactivated} Z X C V B N M {bksp}',
|
|
2723
|
+
'{numbers} {alt} {emoticon} {space} . {enter}',
|
|
2724
|
+
],
|
|
2725
|
+
numbers: NUMPAD,
|
|
2726
|
+
alt: [
|
|
2727
|
+
'1 2 3 4 5 6 7 8 9 0',
|
|
2728
|
+
`- / : ; ( ) $ & @ "`,
|
|
2729
|
+
'{alt2} . , ? ! ´ {bksp}',
|
|
2730
|
+
'{default} {emoticon} {space} {enter}',
|
|
2731
|
+
],
|
|
2732
|
+
alt2: [
|
|
2733
|
+
'[ ] { } # % ^ * + =',
|
|
2734
|
+
'_ \\ | ~ < > ¢ £ ¥ •',
|
|
2735
|
+
`{alt} . , ? ! ' {bksp}`,
|
|
2736
|
+
'{default} {emoticon} {space} {enter}',
|
|
2737
|
+
],
|
|
2738
|
+
emoticon: [
|
|
2739
|
+
'😀 😊 😅 😂 🙂 😉 😍 😛 😠 😎 {bksp}',
|
|
2740
|
+
`😏 😬 😭 😓 😱 😪 🙄 😴 😯 {enter}`,
|
|
2741
|
+
'😐 😇 🤣 😘 😚 😆 😡 😥 😓 {shift}',
|
|
2742
|
+
'{default} {alt} {space} {altright} {downkeyboard}',
|
|
2743
|
+
],
|
|
2744
|
+
};
|
|
2745
|
+
const NATIVE_LAYOUTS = {
|
|
2746
|
+
default: {
|
|
2747
|
+
default: QWERTY_LOWERCASE,
|
|
2748
|
+
...SHARED_LAYOUTS,
|
|
2749
|
+
},
|
|
2750
|
+
numeric: {
|
|
2751
|
+
default: NUMPAD,
|
|
2752
|
+
abc: QWERTY_LOWERCASE,
|
|
2753
|
+
...SHARED_LAYOUTS,
|
|
2754
|
+
},
|
|
2755
|
+
};
|
|
2756
|
+
const NATIVE_LAYOUT_KEYS = new Set([
|
|
2757
|
+
'default', 'numeric',
|
|
2758
|
+
]);
|
|
2759
|
+
const getNativeLayout = (type, Emoji = true, showDownKeyboardButton = true, isFixed = false) => {
|
|
2760
|
+
const layout = NATIVE_LAYOUTS[type] ?? NATIVE_LAYOUTS.default ?? null;
|
|
2761
|
+
if (!layout)
|
|
2762
|
+
return null;
|
|
2763
|
+
let computedLayout = layout;
|
|
2764
|
+
if (!Emoji) {
|
|
2765
|
+
computedLayout = removeKeyFromLayout(computedLayout, EMOTICON_KEY);
|
|
2766
|
+
}
|
|
2767
|
+
if (!showDownKeyboardButton) {
|
|
2768
|
+
computedLayout = removeKeyFromLayout(computedLayout, DOWN_KEYBOARD_KEY);
|
|
2769
|
+
}
|
|
2770
|
+
if (isFixed) {
|
|
2771
|
+
computedLayout = Object.fromEntries(Object.entries(computedLayout).map(([layoutName, rows]) => [
|
|
2772
|
+
layoutName,
|
|
2773
|
+
rows.map((row) => {
|
|
2774
|
+
const trimmed = row.trim();
|
|
2775
|
+
if (/^[a-zA-ZçÇ]/.test(trimmed) && trimmed.endsWith('{bksp}')) {
|
|
2776
|
+
return '{//} ' + trimmed.replace(/\s*\{bksp\}$/, '') + ' {//}';
|
|
2777
|
+
}
|
|
2778
|
+
if (/\{(shift|capslock|shiftactivated)\}$/.test(trimmed)) {
|
|
2779
|
+
return trimmed.replace(/\{(shift|capslock|shiftactivated)\}$/, '{bksp}');
|
|
2780
|
+
}
|
|
2781
|
+
return row;
|
|
2782
|
+
}),
|
|
2783
|
+
]));
|
|
2784
|
+
}
|
|
2785
|
+
return computedLayout;
|
|
2786
|
+
};
|
|
2787
|
+
const SHIFT_TOGGLES = {
|
|
2788
|
+
default: 'shift',
|
|
2789
|
+
abc: 'shift',
|
|
2790
|
+
shift: 'default',
|
|
2791
|
+
alt: 'default',
|
|
2792
|
+
alt2: 'alt',
|
|
2793
|
+
};
|
|
2794
|
+
|
|
2795
|
+
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"};
|
|
2796
|
+
|
|
2797
|
+
const LONG_PRESS_DELAY_MS = 400;
|
|
2798
|
+
const ACCENT_OPTIONS = {
|
|
2799
|
+
a: ['a', 'á', 'à', 'â', 'ã', 'ä', 'å', 'æ', '@', 'ª'],
|
|
2800
|
+
e: ['e', 'é', 'è', 'ê', 'ë', 'ę', 'ē', 'ė', '€'],
|
|
2801
|
+
i: ['i', 'í', 'ì', 'î', 'ï', 'ī', 'į', 'ı'],
|
|
2802
|
+
o: ['o', 'ó', 'ò', 'ô', 'õ', 'ö', 'ō', 'ø', 'œ', 'º'],
|
|
2803
|
+
u: ['u', 'ú', 'ù', 'û', 'ü', 'ū', 'ů', 'ű'],
|
|
2804
|
+
y: ['y', 'ý', 'ÿ', 'ŷ', 'ȳ'],
|
|
2805
|
+
n: ['n', 'ñ'],
|
|
2806
|
+
c: ['c', 'ç'],
|
|
2807
|
+
'?': ['?', '¿'],
|
|
2808
|
+
'!': ['!', '¡'],
|
|
2809
|
+
};
|
|
2810
|
+
/**
|
|
2811
|
+
* Componente VirtualKeyboard — teclado virtual on-screen para entradas controladas.
|
|
2812
|
+
*
|
|
2813
|
+
* @description Baseado em `react-simple-keyboard`, oferece apenas layouts nativos (QWERTY e numérico)
|
|
2814
|
+
* seguindo o visual padrão da biblioteca.
|
|
2815
|
+
*
|
|
2816
|
+
* Possui dois modos:
|
|
2817
|
+
* - **`native`** (padrão): age como teclado nativo — aparece ao focar no campo referenciado por `targetRef` e some ao perder o foco.
|
|
2818
|
+
* - **`fixed`**: teclado sempre visível com um TextField próprio acima.
|
|
2819
|
+
*
|
|
2820
|
+
* @example
|
|
2821
|
+
* ```tsx
|
|
2822
|
+
* // Modo fixed
|
|
2823
|
+
* <VirtualKeyboard variant="fixed" type="default" onChange={setValue} />
|
|
2824
|
+
* ```
|
|
2825
|
+
*
|
|
2826
|
+
* @example
|
|
2827
|
+
* ```tsx
|
|
2828
|
+
* // Modo native — aparece ao focar no input
|
|
2829
|
+
* const inputRef = useRef<HTMLInputElement>(null);
|
|
2830
|
+
* const [value, setValue] = useState('');
|
|
2831
|
+
* <input ref={inputRef} value={value} readOnly />
|
|
2832
|
+
* <VirtualKeyboard targetRef={inputRef} value={value} onChange={setValue} />
|
|
2833
|
+
* ```
|
|
2834
|
+
*/
|
|
2835
|
+
const VirtualKeyboard = ({ variant = 'native', type = 'default', value = '', onChange, onKeyPress, maxLength, Emoji = false, className, id, textFieldPlaceholder = 'Digite aqui...', helperText, error, errorMessage, targetRef, }) => {
|
|
2836
|
+
const [layoutName, setLayoutName] = React.useState('default');
|
|
2837
|
+
const [capsLockOn, setCapsLockOn] = React.useState(false);
|
|
2838
|
+
const [accentMenu, setAccentMenu] = React.useState(null);
|
|
2839
|
+
const [accentMenuOffsetX, setAccentMenuOffsetX] = React.useState(0);
|
|
2840
|
+
const [activeLayout, setActiveLayout] = React.useState(getNativeLayout(type, Emoji, variant === 'native', variant === 'fixed'));
|
|
2841
|
+
const visualType = NATIVE_LAYOUT_KEYS.has(type) ? type : 'default';
|
|
2842
|
+
const [isOpen, setIsOpen] = React.useState(variant !== 'native');
|
|
2843
|
+
const hideTimeoutRef = React.useRef(null);
|
|
2844
|
+
const scrollTimeoutRef = React.useRef(null);
|
|
2845
|
+
const longPressTimeoutRef = React.useRef(null);
|
|
2846
|
+
const suppressNextInputRef = React.useRef(null);
|
|
2847
|
+
const heldAccentKeyRef = React.useRef(null);
|
|
2848
|
+
const longPressTriggeredRef = React.useRef(false);
|
|
2849
|
+
const isKeyboardInteractingRef = React.useRef(false);
|
|
2850
|
+
const keyboardWrapperRef = React.useRef(null);
|
|
2851
|
+
const keyboardInstanceRef = React.useRef(null);
|
|
2852
|
+
const accentMenuRef = React.useRef(null);
|
|
2853
|
+
const accentButtonRef = React.useRef(null);
|
|
2854
|
+
const valueRef = React.useRef(value);
|
|
2855
|
+
const [iconSlots, setIconSlots] = React.useState([]);
|
|
2856
|
+
const [keyPreview, setKeyPreview] = React.useState(null);
|
|
2857
|
+
const [keyPreviewOffsetX, setKeyPreviewOffsetX] = React.useState(0);
|
|
2858
|
+
const keyPreviewRef = React.useRef(null);
|
|
2859
|
+
const [containerWidth, setContainerWidth] = React.useState(Infinity);
|
|
2860
|
+
React.useEffect(() => {
|
|
2861
|
+
valueRef.current = value;
|
|
2862
|
+
}, [value]);
|
|
2863
|
+
const clearLongPressTimeout = React.useCallback(() => {
|
|
2864
|
+
if (longPressTimeoutRef.current !== null) {
|
|
2865
|
+
clearTimeout(longPressTimeoutRef.current);
|
|
2866
|
+
longPressTimeoutRef.current = null;
|
|
2867
|
+
}
|
|
2868
|
+
}, []);
|
|
2869
|
+
const closeAccentMenu = React.useCallback(() => {
|
|
2870
|
+
setAccentMenu(null);
|
|
2871
|
+
accentButtonRef.current = null;
|
|
2872
|
+
}, []);
|
|
2873
|
+
const syncKeyboardInput = React.useCallback((nextValue) => {
|
|
2874
|
+
keyboardInstanceRef.current?.setInput(nextValue);
|
|
2875
|
+
}, []);
|
|
2876
|
+
React.useEffect(() => {
|
|
2877
|
+
syncKeyboardInput(value);
|
|
2878
|
+
}, [value, syncKeyboardInput]);
|
|
2879
|
+
const scheduleHideIfBlurred = React.useCallback(() => {
|
|
2880
|
+
if (variant !== 'native')
|
|
2881
|
+
return;
|
|
2882
|
+
if (hideTimeoutRef.current !== null) {
|
|
2883
|
+
clearTimeout(hideTimeoutRef.current);
|
|
2884
|
+
}
|
|
2885
|
+
hideTimeoutRef.current = setTimeout(() => {
|
|
2886
|
+
const targetEl = targetRef?.current;
|
|
2887
|
+
const isTargetFocused = !!targetEl && document.activeElement === targetEl;
|
|
2888
|
+
if (!isTargetFocused && !isKeyboardInteractingRef.current) {
|
|
2889
|
+
setIsOpen(false);
|
|
2890
|
+
}
|
|
2891
|
+
}, 150);
|
|
2892
|
+
}, [variant, targetRef]);
|
|
2893
|
+
const scrollTargetIntoView = React.useCallback(() => {
|
|
2894
|
+
const targetEl = targetRef?.current;
|
|
2895
|
+
if (!targetEl)
|
|
2896
|
+
return;
|
|
2897
|
+
const keyboardHeight = keyboardWrapperRef.current?.offsetHeight ?? 0;
|
|
2898
|
+
const rect = targetEl.getBoundingClientRect();
|
|
2899
|
+
const visibleBottom = window.innerHeight - keyboardHeight - 8;
|
|
2900
|
+
if (rect.bottom > visibleBottom) {
|
|
2901
|
+
window.scrollBy({ top: rect.bottom - visibleBottom, behavior: 'smooth' });
|
|
2902
|
+
}
|
|
2903
|
+
}, [targetRef]);
|
|
2904
|
+
React.useEffect(() => {
|
|
2905
|
+
if (variant !== 'native')
|
|
2906
|
+
return;
|
|
2907
|
+
if (!targetRef?.current) {
|
|
2908
|
+
setIsOpen(true);
|
|
2909
|
+
return;
|
|
2910
|
+
}
|
|
2911
|
+
const el = targetRef.current;
|
|
2912
|
+
const handleFocus = () => {
|
|
2913
|
+
if (hideTimeoutRef.current !== null)
|
|
2914
|
+
clearTimeout(hideTimeoutRef.current);
|
|
2915
|
+
if (scrollTimeoutRef.current !== null)
|
|
2916
|
+
clearTimeout(scrollTimeoutRef.current);
|
|
2917
|
+
setIsOpen(true);
|
|
2918
|
+
scrollTimeoutRef.current = setTimeout(scrollTargetIntoView, 50);
|
|
2919
|
+
};
|
|
2920
|
+
const handleBlur = () => {
|
|
2921
|
+
scheduleHideIfBlurred();
|
|
2922
|
+
};
|
|
2923
|
+
el.addEventListener('focus', handleFocus);
|
|
2924
|
+
el.addEventListener('blur', handleBlur);
|
|
2925
|
+
return () => {
|
|
2926
|
+
el.removeEventListener('focus', handleFocus);
|
|
2927
|
+
el.removeEventListener('blur', handleBlur);
|
|
2928
|
+
if (hideTimeoutRef.current !== null)
|
|
2929
|
+
clearTimeout(hideTimeoutRef.current);
|
|
2930
|
+
if (scrollTimeoutRef.current !== null)
|
|
2931
|
+
clearTimeout(scrollTimeoutRef.current);
|
|
2932
|
+
};
|
|
2933
|
+
}, [variant, targetRef, scheduleHideIfBlurred, scrollTargetIntoView]);
|
|
2934
|
+
React.useEffect(() => {
|
|
2935
|
+
if (variant !== 'native')
|
|
2936
|
+
return;
|
|
2937
|
+
const wrapper = keyboardWrapperRef.current;
|
|
2938
|
+
if (!wrapper)
|
|
2939
|
+
return;
|
|
2940
|
+
const preventIOSBlur = (event) => {
|
|
2941
|
+
const targetEl = event.target;
|
|
2942
|
+
!!targetEl.closest('.hg-button');
|
|
2943
|
+
event.preventDefault();
|
|
2944
|
+
};
|
|
2945
|
+
wrapper.addEventListener('touchstart', preventIOSBlur, { passive: false });
|
|
2946
|
+
return () => {
|
|
2947
|
+
wrapper.removeEventListener('touchstart', preventIOSBlur);
|
|
2948
|
+
};
|
|
2949
|
+
}, [variant]);
|
|
2950
|
+
React.useEffect(() => {
|
|
2951
|
+
setLayoutName('default');
|
|
2952
|
+
setCapsLockOn(false);
|
|
2953
|
+
setActiveLayout(getNativeLayout(type, Emoji, variant === 'native', variant === 'fixed'));
|
|
2954
|
+
}, [type, Emoji, variant]);
|
|
2955
|
+
React.useEffect(() => {
|
|
2956
|
+
if (!Emoji && layoutName === 'emoticon') {
|
|
2957
|
+
setLayoutName(type === 'numeric' ? 'abc' : 'default');
|
|
2958
|
+
}
|
|
2959
|
+
}, [Emoji, layoutName, type]);
|
|
2960
|
+
React.useEffect(() => {
|
|
2961
|
+
return () => {
|
|
2962
|
+
clearLongPressTimeout();
|
|
2963
|
+
};
|
|
2964
|
+
}, [clearLongPressTimeout]);
|
|
2965
|
+
React.useEffect(() => {
|
|
2966
|
+
if (!accentMenu)
|
|
2967
|
+
return;
|
|
2968
|
+
const handleOutsidePointerDown = (event) => {
|
|
2969
|
+
if (accentMenuRef.current?.contains(event.target))
|
|
2970
|
+
return;
|
|
2971
|
+
closeAccentMenu();
|
|
2972
|
+
};
|
|
2973
|
+
const handleEscape = (event) => {
|
|
2974
|
+
if (event.key === 'Escape') {
|
|
2975
|
+
closeAccentMenu();
|
|
2976
|
+
}
|
|
2977
|
+
};
|
|
2978
|
+
document.addEventListener('pointerdown', handleOutsidePointerDown, true);
|
|
2979
|
+
document.addEventListener('keydown', handleEscape);
|
|
2980
|
+
return () => {
|
|
2981
|
+
document.removeEventListener('pointerdown', handleOutsidePointerDown, true);
|
|
2982
|
+
document.removeEventListener('keydown', handleEscape);
|
|
2983
|
+
};
|
|
2984
|
+
}, [accentMenu, closeAccentMenu]);
|
|
2985
|
+
React.useLayoutEffect(() => {
|
|
2986
|
+
if (!keyPreview || !keyPreviewRef.current)
|
|
2987
|
+
return;
|
|
2988
|
+
const margin = 8;
|
|
2989
|
+
const rect = keyPreviewRef.current.getBoundingClientRect();
|
|
2990
|
+
if (rect.width <= 0 || rect.height <= 0)
|
|
2991
|
+
return;
|
|
2992
|
+
const minCenter = margin + rect.width / 2;
|
|
2993
|
+
const maxCenter = window.innerWidth - margin - rect.width / 2;
|
|
2994
|
+
const clampedCenter = Math.min(maxCenter, Math.max(minCenter, keyPreview.left));
|
|
2995
|
+
const nextOffset = clampedCenter - keyPreview.left;
|
|
2996
|
+
if (Math.abs(nextOffset - keyPreviewOffsetX) > 0.5) {
|
|
2997
|
+
setKeyPreviewOffsetX(nextOffset);
|
|
2998
|
+
}
|
|
2999
|
+
}, [keyPreview, keyPreviewOffsetX]);
|
|
3000
|
+
React.useLayoutEffect(() => {
|
|
3001
|
+
if (!accentMenu || !accentMenuRef.current)
|
|
3002
|
+
return;
|
|
3003
|
+
const margin = 8;
|
|
3004
|
+
const rect = accentMenuRef.current.getBoundingClientRect();
|
|
3005
|
+
if (rect.width <= 0 || rect.height <= 0)
|
|
3006
|
+
return;
|
|
3007
|
+
const minCenter = margin + rect.width / 2;
|
|
3008
|
+
const maxCenter = window.innerWidth - margin - rect.width / 2;
|
|
3009
|
+
const clampedCenter = Math.min(maxCenter, Math.max(minCenter, accentMenu.left));
|
|
3010
|
+
const nextOffset = clampedCenter - accentMenu.left;
|
|
3011
|
+
if (Math.abs(nextOffset - accentMenuOffsetX) > 0.5) {
|
|
3012
|
+
setAccentMenuOffsetX(nextOffset);
|
|
3013
|
+
}
|
|
3014
|
+
}, [accentMenu, accentMenuOffsetX]);
|
|
3015
|
+
React.useEffect(() => {
|
|
3016
|
+
const wrapper = keyboardWrapperRef.current;
|
|
3017
|
+
if (!wrapper)
|
|
3018
|
+
return;
|
|
3019
|
+
const ro = new ResizeObserver((entries) => {
|
|
3020
|
+
setContainerWidth(entries[0]?.contentRect.width ?? Infinity);
|
|
3021
|
+
});
|
|
3022
|
+
ro.observe(wrapper);
|
|
3023
|
+
return () => ro.disconnect();
|
|
3024
|
+
}, []);
|
|
3025
|
+
React.useEffect(() => {
|
|
3026
|
+
if (!keyboardWrapperRef.current)
|
|
3027
|
+
return;
|
|
3028
|
+
const container = keyboardWrapperRef.current;
|
|
3029
|
+
const registerNewSlots = () => {
|
|
3030
|
+
const newSlots = Array.from(container.querySelectorAll('[data-icon-key]:not([data-icon-root])'));
|
|
3031
|
+
if (newSlots.length === 0)
|
|
3032
|
+
return;
|
|
3033
|
+
newSlots.forEach((s) => s.setAttribute('data-icon-root', 'true'));
|
|
3034
|
+
setIconSlots((prev) => [...prev, ...newSlots]);
|
|
3035
|
+
};
|
|
3036
|
+
registerNewSlots();
|
|
3037
|
+
const observer = new MutationObserver(() => {
|
|
3038
|
+
setIconSlots((prev) => prev.filter((slot) => container.contains(slot)));
|
|
3039
|
+
registerNewSlots();
|
|
3040
|
+
});
|
|
3041
|
+
observer.observe(container, { childList: true, subtree: true });
|
|
3042
|
+
return () => {
|
|
3043
|
+
observer.disconnect();
|
|
3044
|
+
};
|
|
3045
|
+
}, []);
|
|
3046
|
+
React.useEffect(() => {
|
|
3047
|
+
closeAccentMenu();
|
|
3048
|
+
setAccentMenuOffsetX(0);
|
|
3049
|
+
suppressNextInputRef.current = null;
|
|
3050
|
+
clearLongPressTimeout();
|
|
3051
|
+
}, [layoutName, type, closeAccentMenu, clearLongPressTimeout]);
|
|
3052
|
+
React.useEffect(() => {
|
|
3053
|
+
const updateAccentPosition = () => {
|
|
3054
|
+
const btn = accentButtonRef.current;
|
|
3055
|
+
if (!btn)
|
|
3056
|
+
return;
|
|
3057
|
+
const rect = btn.getBoundingClientRect();
|
|
3058
|
+
setAccentMenu((prev) => prev ? { ...prev, top: rect.top - 8, left: rect.left + rect.width / 2 } : null);
|
|
3059
|
+
};
|
|
3060
|
+
window.addEventListener('scroll', updateAccentPosition, { capture: true, passive: true });
|
|
3061
|
+
window.addEventListener('resize', updateAccentPosition);
|
|
3062
|
+
return () => {
|
|
3063
|
+
window.removeEventListener('scroll', updateAccentPosition, true);
|
|
3064
|
+
window.removeEventListener('resize', updateAccentPosition);
|
|
3065
|
+
};
|
|
3066
|
+
}, []);
|
|
3067
|
+
const handleLongPressStart = React.useCallback((event) => {
|
|
3068
|
+
isKeyboardInteractingRef.current = true;
|
|
3069
|
+
if (hideTimeoutRef.current !== null) {
|
|
3070
|
+
clearTimeout(hideTimeoutRef.current);
|
|
3071
|
+
}
|
|
3072
|
+
const keyboardWrapper = keyboardWrapperRef.current;
|
|
3073
|
+
if (!keyboardWrapper)
|
|
3074
|
+
return;
|
|
3075
|
+
const buttonEl = event.target.closest('.hg-button');
|
|
3076
|
+
if (!buttonEl || !keyboardWrapper.contains(buttonEl))
|
|
3077
|
+
return;
|
|
3078
|
+
event.preventDefault();
|
|
3079
|
+
const sourceKey = buttonEl.getAttribute('data-skbtn') ?? '';
|
|
3080
|
+
heldAccentKeyRef.current = null;
|
|
3081
|
+
longPressTriggeredRef.current = false;
|
|
3082
|
+
if (sourceKey && !sourceKey.startsWith('{') && type !== 'numeric' && containerWidth <= 768) {
|
|
3083
|
+
const buttonRect = buttonEl.getBoundingClientRect();
|
|
3084
|
+
setKeyPreviewOffsetX(0);
|
|
3085
|
+
setKeyPreview({
|
|
3086
|
+
char: sourceKey,
|
|
3087
|
+
top: buttonRect.top - 4,
|
|
3088
|
+
left: buttonRect.left + buttonRect.width / 2,
|
|
3089
|
+
});
|
|
3090
|
+
}
|
|
3091
|
+
if (!sourceKey || sourceKey.startsWith('{'))
|
|
3092
|
+
return;
|
|
3093
|
+
heldAccentKeyRef.current = sourceKey;
|
|
3094
|
+
clearLongPressTimeout();
|
|
3095
|
+
const accentOptions = ACCENT_OPTIONS[sourceKey.toLowerCase()];
|
|
3096
|
+
if (!accentOptions)
|
|
3097
|
+
return;
|
|
3098
|
+
longPressTimeoutRef.current = setTimeout(() => {
|
|
3099
|
+
const buttonRect = buttonEl.getBoundingClientRect();
|
|
3100
|
+
const isUpperCaseKey = sourceKey === sourceKey.toUpperCase();
|
|
3101
|
+
longPressTriggeredRef.current = true;
|
|
3102
|
+
setKeyPreview(null);
|
|
3103
|
+
accentButtonRef.current = buttonEl;
|
|
3104
|
+
setAccentMenu({
|
|
3105
|
+
sourceKey,
|
|
3106
|
+
options: isUpperCaseKey
|
|
3107
|
+
? accentOptions.map((option) => option.toUpperCase())
|
|
3108
|
+
: accentOptions,
|
|
3109
|
+
top: buttonRect.top - 8,
|
|
3110
|
+
left: buttonRect.left + buttonRect.width / 2,
|
|
3111
|
+
});
|
|
3112
|
+
setAccentMenuOffsetX(0);
|
|
3113
|
+
suppressNextInputRef.current = sourceKey;
|
|
3114
|
+
}, LONG_PRESS_DELAY_MS);
|
|
3115
|
+
}, [clearLongPressTimeout, type, containerWidth]);
|
|
3116
|
+
const handleLongPressEnd = React.useCallback(() => {
|
|
3117
|
+
const heldKey = heldAccentKeyRef.current;
|
|
3118
|
+
const longPressTriggered = longPressTriggeredRef.current;
|
|
3119
|
+
const baseLayout = type === 'numeric' ? 'abc' : 'default';
|
|
3120
|
+
setKeyPreview(null);
|
|
3121
|
+
isKeyboardInteractingRef.current = false;
|
|
3122
|
+
clearLongPressTimeout();
|
|
3123
|
+
if (heldKey && !longPressTriggered) {
|
|
3124
|
+
const currentValue = valueRef.current;
|
|
3125
|
+
if (maxLength === undefined || currentValue.length < maxLength) {
|
|
3126
|
+
const nextValue = `${currentValue}${heldKey}`;
|
|
3127
|
+
onChange?.(nextValue);
|
|
3128
|
+
onKeyPress?.(heldKey);
|
|
3129
|
+
syncKeyboardInput(nextValue);
|
|
3130
|
+
}
|
|
3131
|
+
if (layoutName === 'shift' && !capsLockOn) {
|
|
3132
|
+
setLayoutName(baseLayout);
|
|
3133
|
+
}
|
|
3134
|
+
suppressNextInputRef.current = heldKey;
|
|
3135
|
+
}
|
|
3136
|
+
heldAccentKeyRef.current = null;
|
|
3137
|
+
longPressTriggeredRef.current = false;
|
|
3138
|
+
scheduleHideIfBlurred();
|
|
3139
|
+
}, [
|
|
3140
|
+
clearLongPressTimeout,
|
|
3141
|
+
scheduleHideIfBlurred,
|
|
3142
|
+
maxLength,
|
|
3143
|
+
onChange,
|
|
3144
|
+
onKeyPress,
|
|
3145
|
+
syncKeyboardInput,
|
|
3146
|
+
type,
|
|
3147
|
+
layoutName,
|
|
3148
|
+
capsLockOn,
|
|
3149
|
+
]);
|
|
3150
|
+
const handleAccentSelect = React.useCallback((accentedChar) => {
|
|
3151
|
+
const currentValue = valueRef.current;
|
|
3152
|
+
const baseLayout = type === 'numeric' ? 'abc' : 'default';
|
|
3153
|
+
if (maxLength !== undefined && currentValue.length >= maxLength) {
|
|
3154
|
+
closeAccentMenu();
|
|
3155
|
+
suppressNextInputRef.current = null;
|
|
3156
|
+
syncKeyboardInput(currentValue);
|
|
3157
|
+
return;
|
|
3158
|
+
}
|
|
3159
|
+
const nextValue = `${currentValue}${accentedChar}`;
|
|
3160
|
+
onChange?.(nextValue);
|
|
3161
|
+
onKeyPress?.(accentedChar);
|
|
3162
|
+
closeAccentMenu();
|
|
3163
|
+
suppressNextInputRef.current = null;
|
|
3164
|
+
heldAccentKeyRef.current = null;
|
|
3165
|
+
longPressTriggeredRef.current = false;
|
|
3166
|
+
if (layoutName === 'shift' && !capsLockOn) {
|
|
3167
|
+
setLayoutName(baseLayout);
|
|
3168
|
+
}
|
|
3169
|
+
syncKeyboardInput(nextValue);
|
|
3170
|
+
}, [maxLength, onChange, onKeyPress, closeAccentMenu, syncKeyboardInput, type, layoutName, capsLockOn]);
|
|
3171
|
+
const handleKeyPress = React.useCallback((button) => {
|
|
3172
|
+
const baseLayout = type === 'numeric' ? 'abc' : 'default';
|
|
3173
|
+
if (button === '{capslock}') {
|
|
3174
|
+
setCapsLockOn((prev) => {
|
|
3175
|
+
const next = !prev;
|
|
3176
|
+
setLayoutName(next ? 'caps' : baseLayout);
|
|
3177
|
+
return next;
|
|
3178
|
+
});
|
|
3179
|
+
return;
|
|
3180
|
+
}
|
|
3181
|
+
if (button === '{shift}' ||
|
|
3182
|
+
button === '{shiftactivated}') {
|
|
3183
|
+
if (button === '{shiftactivated}') {
|
|
3184
|
+
setCapsLockOn(false);
|
|
3185
|
+
setLayoutName(baseLayout);
|
|
3186
|
+
return;
|
|
3187
|
+
}
|
|
3188
|
+
setLayoutName((prev) => {
|
|
3189
|
+
const next = SHIFT_TOGGLES[prev] ?? 'default';
|
|
3190
|
+
return next === 'default' ? baseLayout : next;
|
|
3191
|
+
});
|
|
3192
|
+
return;
|
|
3193
|
+
}
|
|
3194
|
+
if (button === '{numbers}') {
|
|
3195
|
+
setLayoutName('numbers');
|
|
3196
|
+
return;
|
|
3197
|
+
}
|
|
3198
|
+
if (button === '{abc}') {
|
|
3199
|
+
setLayoutName(baseLayout);
|
|
3200
|
+
return;
|
|
3201
|
+
}
|
|
3202
|
+
if (button === '{alt}' || button === '{altright}') {
|
|
3203
|
+
setLayoutName((prev) => {
|
|
3204
|
+
if (prev === 'alt2')
|
|
3205
|
+
return 'alt';
|
|
3206
|
+
return prev === 'alt' ? baseLayout : 'alt';
|
|
3207
|
+
});
|
|
3208
|
+
return;
|
|
3209
|
+
}
|
|
3210
|
+
if (button === '{alt2}') {
|
|
3211
|
+
setLayoutName((prev) => (prev === 'alt2' ? 'alt' : 'alt2'));
|
|
3212
|
+
return;
|
|
3213
|
+
}
|
|
3214
|
+
if (button === '{emoticon}') {
|
|
3215
|
+
if (!Emoji)
|
|
3216
|
+
return;
|
|
3217
|
+
setLayoutName((prev) => (prev === 'emoticon' ? baseLayout : 'emoticon'));
|
|
3218
|
+
return;
|
|
3219
|
+
}
|
|
3220
|
+
if (button === '{default}') {
|
|
3221
|
+
setLayoutName(baseLayout);
|
|
3222
|
+
return;
|
|
3223
|
+
}
|
|
3224
|
+
if (button === '{downkeyboard}') {
|
|
3225
|
+
setLayoutName(baseLayout);
|
|
3226
|
+
if (variant === 'native') {
|
|
3227
|
+
closeAccentMenu();
|
|
3228
|
+
setIsOpen(false);
|
|
3229
|
+
const targetElement = targetRef?.current;
|
|
3230
|
+
if (targetElement && document.activeElement === targetElement) {
|
|
3231
|
+
targetElement.blur();
|
|
3232
|
+
}
|
|
3233
|
+
}
|
|
3234
|
+
return;
|
|
3235
|
+
}
|
|
3236
|
+
const isHeldAccentKey = heldAccentKeyRef.current === button;
|
|
3237
|
+
if (button !== '{bksp}' && button !== '{enter}' && !isHeldAccentKey) {
|
|
3238
|
+
if (layoutName === 'shift' && !capsLockOn) {
|
|
3239
|
+
setLayoutName(baseLayout);
|
|
3240
|
+
}
|
|
3241
|
+
else if (layoutName === baseLayout && capsLockOn) {
|
|
3242
|
+
setLayoutName('shift');
|
|
3243
|
+
}
|
|
3244
|
+
}
|
|
3245
|
+
if (isHeldAccentKey) {
|
|
3246
|
+
return;
|
|
3247
|
+
}
|
|
3248
|
+
onKeyPress?.(button);
|
|
3249
|
+
}, [
|
|
3250
|
+
type,
|
|
3251
|
+
layoutName,
|
|
3252
|
+
capsLockOn,
|
|
3253
|
+
onKeyPress,
|
|
3254
|
+
Emoji,
|
|
3255
|
+
variant,
|
|
3256
|
+
closeAccentMenu,
|
|
3257
|
+
targetRef,
|
|
3258
|
+
]);
|
|
3259
|
+
const handleChange = React.useCallback((input) => {
|
|
3260
|
+
const currentValue = valueRef.current;
|
|
3261
|
+
const suppressedKey = suppressNextInputRef.current;
|
|
3262
|
+
const heldKey = heldAccentKeyRef.current;
|
|
3263
|
+
if (heldKey &&
|
|
3264
|
+
input.length >= currentValue.length + 1 &&
|
|
3265
|
+
input.startsWith(currentValue) &&
|
|
3266
|
+
input.slice(currentValue.length).split('').every((char) => char === heldKey)) {
|
|
3267
|
+
syncKeyboardInput(currentValue);
|
|
3268
|
+
return;
|
|
3269
|
+
}
|
|
3270
|
+
if (suppressedKey &&
|
|
3271
|
+
input.length === currentValue.length + 1 &&
|
|
3272
|
+
input.endsWith(suppressedKey)) {
|
|
3273
|
+
suppressNextInputRef.current = null;
|
|
3274
|
+
syncKeyboardInput(currentValue);
|
|
3275
|
+
return;
|
|
3276
|
+
}
|
|
3277
|
+
if (maxLength !== undefined && input.length > maxLength)
|
|
3278
|
+
return;
|
|
3279
|
+
onChange?.(input);
|
|
3280
|
+
}, [maxLength, onChange, syncKeyboardInput]);
|
|
3281
|
+
const portalSizes = React.useMemo(() => {
|
|
3282
|
+
if (containerWidth <= 360)
|
|
3283
|
+
return { preview: 42, option: 44, fontSize: 'var(--font-size-16)' };
|
|
3284
|
+
if (containerWidth <= 390)
|
|
3285
|
+
return { preview: 44, option: 44, fontSize: 'var(--font-size-18)' };
|
|
3286
|
+
if (containerWidth <= 480)
|
|
3287
|
+
return { preview: 46, option: 46, fontSize: 'var(--font-size-20)' };
|
|
3288
|
+
if (containerWidth <= 768)
|
|
3289
|
+
return { preview: 48, option: 48, fontSize: undefined };
|
|
3290
|
+
return { preview: 50, option: 50, fontSize: undefined };
|
|
3291
|
+
}, [containerWidth]);
|
|
3292
|
+
const keyboardDisplay = React.useMemo(() => {
|
|
3293
|
+
const baseDisplay = LAYOUT_DISPLAY[visualType];
|
|
3294
|
+
if (!baseDisplay)
|
|
3295
|
+
return baseDisplay;
|
|
3296
|
+
if (variant !== 'fixed') {
|
|
3297
|
+
return baseDisplay;
|
|
3298
|
+
}
|
|
3299
|
+
return {
|
|
3300
|
+
...baseDisplay,
|
|
3301
|
+
'{bksp}': (baseDisplay['{bksp}'] ?? '').replace(/\s*Apagar$/, ''),
|
|
3302
|
+
};
|
|
3303
|
+
}, [visualType, variant]);
|
|
3304
|
+
const keyboardEl = activeLayout ? (jsxRuntime.jsxs("div", { ref: keyboardWrapperRef, className: styles$j.keyboardWrapper, onPointerDownCapture: handleLongPressStart, onPointerUpCapture: handleLongPressEnd, onPointerLeave: handleLongPressEnd, onPointerCancelCapture: handleLongPressEnd, children: [jsxRuntime.jsx(Keyboard, { keyboardRef: (instance) => {
|
|
3305
|
+
keyboardInstanceRef.current = instance;
|
|
3306
|
+
if (instance) {
|
|
3307
|
+
instance.setInput(valueRef.current);
|
|
3308
|
+
}
|
|
3309
|
+
}, layoutName: layoutName, layout: activeLayout, theme: 'hg-theme-default', display: keyboardDisplay, onChange: handleChange, onKeyPress: handleKeyPress, preventMouseDownDefault: true }), (() => {
|
|
3310
|
+
const shiftCount = { current: 0 };
|
|
3311
|
+
return iconSlots.map((slot) => {
|
|
3312
|
+
const key = slot.getAttribute('data-icon-key');
|
|
3313
|
+
const Icon = key ? ICON_KEY_MAP[key] : undefined;
|
|
3314
|
+
if (!Icon || !key)
|
|
3315
|
+
return null;
|
|
3316
|
+
if (key === 'shift') {
|
|
3317
|
+
const label = shiftCount.current === 0 ? 'left' : 'right';
|
|
3318
|
+
shiftCount.current += 1;
|
|
3319
|
+
return reactDom.createPortal(React.createElement(Icon), slot, `icon-shift-${label}`);
|
|
3320
|
+
}
|
|
3321
|
+
return reactDom.createPortal(React.createElement(Icon), slot, `icon-${key}`);
|
|
3322
|
+
});
|
|
3323
|
+
})(), keyPreview && typeof document !== 'undefined' && reactDom.createPortal(jsxRuntime.jsx("div", { ref: keyPreviewRef, className: styles$j.keyPreview, style: {
|
|
3324
|
+
top: keyPreview.top,
|
|
3325
|
+
left: keyPreview.left + keyPreviewOffsetX,
|
|
3326
|
+
width: portalSizes.preview,
|
|
3327
|
+
height: portalSizes.preview,
|
|
3328
|
+
...(portalSizes.fontSize ? { fontSize: portalSizes.fontSize } : {}),
|
|
3329
|
+
}, "aria-hidden": true, children: keyPreview.char }), document.body), accentMenu && (typeof document !== 'undefined' &&
|
|
3330
|
+
reactDom.createPortal(jsxRuntime.jsx("div", { ref: accentMenuRef, className: styles$j.accentMenu, style: {
|
|
3331
|
+
top: accentMenu.top,
|
|
3332
|
+
left: accentMenu.left + accentMenuOffsetX,
|
|
3333
|
+
}, 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) => (jsxRuntime.jsx("div", { className: styles$j.accentMenuRow, children: rowOptions.map((option) => (jsxRuntime.jsx("button", { type: "button", className: styles$j.accentOption, style: {
|
|
3334
|
+
minWidth: portalSizes.option,
|
|
3335
|
+
height: portalSizes.option,
|
|
3336
|
+
...(portalSizes.fontSize ? { fontSize: portalSizes.fontSize } : {}),
|
|
3337
|
+
}, onPointerDown: (event) => {
|
|
3338
|
+
event.preventDefault();
|
|
3339
|
+
event.stopPropagation();
|
|
3340
|
+
}, onClick: () => handleAccentSelect(option), children: option }, `${accentMenu.sourceKey}-${option}`))) }, rowIndex))) }), document.body))] })) : null;
|
|
3341
|
+
if (variant === 'native' && typeof document !== 'undefined') {
|
|
3342
|
+
return reactDom.createPortal(jsxRuntime.jsx("div", { id: id, className: clsx(styles$j.overlay, { [styles$j.overlayOpen]: isOpen }, styles$j[`layout--${visualType}`], className), children: keyboardEl }), document.body);
|
|
3343
|
+
}
|
|
3344
|
+
return (jsxRuntime.jsxs("div", { id: id, className: clsx(styles$j.container, styles$j[`mode--${variant}`], styles$j[`layout--${visualType}`], className), children: [variant === 'fixed' && (jsxRuntime.jsx("div", { className: styles$j.textFieldContainer, children: jsxRuntime.jsx(TextField, { 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] }));
|
|
2622
3345
|
};
|
|
2623
3346
|
|
|
2624
|
-
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"};
|
|
3347
|
+
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"};
|
|
2625
3348
|
|
|
2626
3349
|
const validateInput = ({ value, maxLength, errorMessage, required }) => {
|
|
2627
3350
|
if (required && value.trim() === '') {
|
|
@@ -2644,19 +3367,19 @@ const LabelComponent = ({ children, htmlFor, required = false, tooltip = false,
|
|
|
2644
3367
|
return container;
|
|
2645
3368
|
};
|
|
2646
3369
|
|
|
2647
|
-
const TextField$1 = React.forwardRef(({ className, value, label, placeholder, type = 'text', onChange, disabled = false, maxLength
|
|
3370
|
+
const TextField$1 = React.forwardRef(({ className, 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) => {
|
|
2648
3371
|
const normalizeValue = (val) => {
|
|
2649
3372
|
return val === undefined || val === null ? '' : String(val);
|
|
2650
3373
|
};
|
|
2651
3374
|
const [inputValue, setInputValue] = React.useState(normalizeValue(value));
|
|
2652
3375
|
const [inputError, setInputError] = React.useState('');
|
|
2653
3376
|
const [isFocused, setIsFocused] = React.useState(false);
|
|
3377
|
+
const { internalRef: inputRef, setRefs: setInputRefs } = useInputKeyboardValue(ref);
|
|
2654
3378
|
const generatedId = React.useId();
|
|
2655
3379
|
const componentId = id || generatedId;
|
|
2656
3380
|
React.useEffect(() => {
|
|
2657
3381
|
const newValue = normalizeValue(value);
|
|
2658
3382
|
setInputValue(newValue);
|
|
2659
|
-
// Reavaliar erro quando valor muda externamente (ex: DatePicker atualiza o campo)
|
|
2660
3383
|
if (inputError) {
|
|
2661
3384
|
const validationError = validateInput({
|
|
2662
3385
|
value: newValue,
|
|
@@ -2704,17 +3427,29 @@ const TextField$1 = React.forwardRef(({ className, value, label, placeholder, ty
|
|
|
2704
3427
|
: helperText
|
|
2705
3428
|
? `${componentId}-helper`
|
|
2706
3429
|
: undefined;
|
|
2707
|
-
const
|
|
3430
|
+
const scaleClass = {
|
|
3431
|
+
1: 'scale-1-0',
|
|
3432
|
+
1.5: 'scale-1-5',
|
|
3433
|
+
2: 'scale-2-0',
|
|
3434
|
+
}[scale];
|
|
3435
|
+
const containerClass = clsx(styles$i.container, scaleClass, {
|
|
2708
3436
|
[styles$i.disabled]: disabled,
|
|
2709
3437
|
[styles$i.error]: hasError && !disabled,
|
|
3438
|
+
[styles$i.errorWithMessage]: Boolean(error) && Boolean(errorMessage) && !disabled,
|
|
3439
|
+
[styles$i.attachedToVirtualKeyboard]: attachedToVirtualKeyboard,
|
|
2710
3440
|
[className]: className,
|
|
2711
3441
|
});
|
|
2712
|
-
return (jsxRuntime.jsxs("div", { className: containerClass, children: [label && (jsxRuntime.jsx(LabelComponent, { htmlFor: componentId, required: required, tooltip: tooltip, tooltipText: tooltipText, side:
|
|
3442
|
+
return (jsxRuntime.jsxs("div", { className: containerClass, children: [label && (jsxRuntime.jsx(LabelComponent, { htmlFor: componentId, required: required, tooltip: tooltip, tooltipText: tooltipText, side: tooltipSide, align: tooltipAlign, error: hasError, disabled: disabled, children: label })), jsxRuntime.jsxs("div", { className: styles$i.inputWrapper, children: [jsxRuntime.jsxs("div", { className: styles$i.inputContainer, children: [jsxRuntime.jsx("input", { ...rest, ref: 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({
|
|
2713
3443
|
[styles$i.inputWithIcon]: showCustomIcon || showClearIcon,
|
|
2714
3444
|
}) }), showCustomIcon && jsxRuntime.jsx("span", { className: styles$i.icon, children: icon }), showClearIcon && (jsxRuntime.jsx("button", { type: "button", className: styles$i.clearButton, onMouseDown: (e) => {
|
|
2715
3445
|
e.preventDefault();
|
|
2716
3446
|
handleClear();
|
|
2717
|
-
}, "aria-label": "Limpar campo", tabIndex: -1, children: jsxRuntime.jsx(reactIcons.Dismiss16Regular, {}) }))] }), jsxRuntime.jsx("span", { id: helperId, className: styles$i.helperText, "aria-live": hasError ? 'polite' : undefined, children: displayHelperText })] })
|
|
3447
|
+
}, "aria-label": "Limpar campo", tabIndex: -1, children: jsxRuntime.jsx(reactIcons.Dismiss16Regular, {}) }))] }), ((error && errorMessage) || inputError || helperText) && (jsxRuntime.jsx("span", { id: helperId, className: styles$i.helperText, "aria-live": hasError ? 'polite' : undefined, children: displayHelperText }))] }), (virtualKeyboard === 'default' || virtualKeyboard === 'numeric') && (jsxRuntime.jsx("div", { className: "virtualKeyboardWrapper", children: jsxRuntime.jsx(VirtualKeyboard, { variant: "native", type: virtualKeyboard, value: inputValue, maxLength: maxLength, targetRef: inputRef, onChange: (val) => {
|
|
3448
|
+
if (!disabled && (!maxLength || val.length <= maxLength)) {
|
|
3449
|
+
setInputValue(val);
|
|
3450
|
+
onChange?.(val);
|
|
3451
|
+
}
|
|
3452
|
+
} }) }))] }));
|
|
2718
3453
|
});
|
|
2719
3454
|
TextField$1.displayName = 'TextField';
|
|
2720
3455
|
var TextField = React.memo(TextField$1);
|
|
@@ -2811,7 +3546,7 @@ function validatePartialDate(value, locale = 'pt-br') {
|
|
|
2811
3546
|
return 'incomplete';
|
|
2812
3547
|
}
|
|
2813
3548
|
|
|
2814
|
-
const DatePicker = ({ locale = 'pt-br', calendarSide = 'bottom', calendarAlign = 'start', helperText, required = false, label = 'Data', value, defaultValue, onChange, disabled = false, error: externalError, minDate, maxDate, 'data-testid': testId, className, ...rest }) => {
|
|
3549
|
+
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, datePickerScale = 1, calendarScale = 1, className, ...rest }) => {
|
|
2815
3550
|
const fieldId = React.useId();
|
|
2816
3551
|
const calendarId = `${fieldId}-calendar`;
|
|
2817
3552
|
const isControlled = value !== undefined;
|
|
@@ -2828,6 +3563,11 @@ const DatePicker = ({ locale = 'pt-br', calendarSide = 'bottom', calendarAlign =
|
|
|
2828
3563
|
const combinedHelperText = externalError && helperText
|
|
2829
3564
|
? `${helperText} • ${externalError}`
|
|
2830
3565
|
: externalError || helperText || '';
|
|
3566
|
+
const scaleClass = {
|
|
3567
|
+
1: 'scale-1-0',
|
|
3568
|
+
1.5: 'scale-1-5',
|
|
3569
|
+
2: 'scale-2-0',
|
|
3570
|
+
}[datePickerScale];
|
|
2831
3571
|
React.useEffect(() => {
|
|
2832
3572
|
function handleClickOutside(event) {
|
|
2833
3573
|
const target = event.target;
|
|
@@ -2940,9 +3680,9 @@ const DatePicker = ({ locale = 'pt-br', calendarSide = 'bottom', calendarAlign =
|
|
|
2940
3680
|
}
|
|
2941
3681
|
}
|
|
2942
3682
|
};
|
|
2943
|
-
return (jsxRuntime.jsx("div", { ref: wrapperRef, className: clsx(styles$g.datePicker, className), ...rest, children: jsxRuntime.jsx(Popover, { open: showCalendar, onOpenChange: setShowCalendar, asAnchor: true, trigger: jsxRuntime.jsx(TextField, { className: styles$g.textfieldContainer, type: "tel", icon: jsxRuntime.jsx(reactIcons.Calendar16Regular, { onClick: !disabled ? handleIconClick : undefined, className: clsx(styles$g.datePickerIcon, disabled && styles$g.datePickerIconDisabled) }), onChange: (e) => {
|
|
3683
|
+
return (jsxRuntime.jsx("div", { ref: wrapperRef, className: clsx(styles$g.datePicker, scaleClass, className), ...rest, children: jsxRuntime.jsx(Popover, { open: showCalendar, onOpenChange: setShowCalendar, asAnchor: true, trigger: jsxRuntime.jsx(TextField, { className: styles$g.textfieldContainer, type: "tel", icon: jsxRuntime.jsx(reactIcons.Calendar16Regular, { onClick: !disabled ? handleIconClick : undefined, className: clsx(styles$g.datePickerIcon, disabled && styles$g.datePickerIconDisabled) }), onChange: (e) => {
|
|
2944
3684
|
handleTextFieldChange(String(e));
|
|
2945
|
-
}, onKeyDown: handleKeyDown, onFocus: handleFocus, persistIcon: true, autoComplete: "off", value: displayValue, helperText: !externalError ? (helperText || undefined) : undefined, errorMessage: externalError ? combinedHelperText : undefined, error: hasValidationError ? true : undefined, maxLength: 10, required: required, label: label, disabled: disabled, id: fieldId, "data-testid": testId, placeholder: locale === 'en-us' ? 'MM/DD/YYYY' : 'DD/MM/YYYY', "aria-label": "Open calendar", "aria-expanded": showCalendar, "aria-controls": calendarId, "aria-invalid": hasValidationError, "aria-describedby": externalError ? undefined : (helperText ? `${fieldId}-help` : undefined) }), content: jsxRuntime.jsx(Calendar, { selected: currentSelectedDate, currentDate: currentDate, onDateChange: setCurrentDate, onDaySelect: handleDaySelect, locale: locale, format: locale === 'en-us' ? 'mm/dd/yyyy' : 'dd/mm/yyyy', minDate: minDate, maxDate: maxDate, id: calendarId, onClear: () => {
|
|
3685
|
+
}, onKeyDown: handleKeyDown, onFocus: handleFocus, persistIcon: true, autoComplete: "off", value: displayValue, helperText: !externalError ? (helperText || undefined) : undefined, errorMessage: externalError ? combinedHelperText : undefined, error: hasValidationError ? true : undefined, maxLength: 10, required: required, label: label, disabled: disabled, id: fieldId, "data-testid": testId, placeholder: locale === 'en-us' ? 'MM/DD/YYYY' : 'DD/MM/YYYY', "aria-label": "Open calendar", "aria-expanded": showCalendar, "aria-controls": calendarId, "aria-invalid": hasValidationError, "aria-describedby": externalError ? undefined : (helperText ? `${fieldId}-help` : undefined) }), content: jsxRuntime.jsx(Calendar, { selected: currentSelectedDate, currentDate: currentDate, onDateChange: setCurrentDate, onDaySelect: handleDaySelect, locale: locale, format: locale === 'en-us' ? 'mm/dd/yyyy' : 'dd/mm/yyyy', minDate: minDate, maxDate: maxDate, scale: calendarScale, id: calendarId, onClear: () => {
|
|
2946
3686
|
handleDateChange(null);
|
|
2947
3687
|
setCurrentDate(new Date());
|
|
2948
3688
|
} }), side: calendarSide, align: calendarAlign, sideOffset: 8 }) }));
|
|
@@ -3036,12 +3776,18 @@ const Combined = ({ buttonText = 'Filtrar', icon, variant = 'outlined', disabled
|
|
|
3036
3776
|
|
|
3037
3777
|
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"};
|
|
3038
3778
|
|
|
3039
|
-
const Search = React.forwardRef(({ placeholder = 'Dica do que deve ser buscado', disabled = false, value, onChange, onKeyDown, onFocus, onBlur, onClear, onClick, onMouseDown, searchMode = 'instant', onSearch, id, className, 'data-testid': testId, ...rest }, ref) => {
|
|
3779
|
+
const Search = React.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, virtualKeyboard, 'data-testid': testId, ...rest }, ref) => {
|
|
3040
3780
|
const [internalValue, setInternalValue] = React.useState('');
|
|
3781
|
+
const { internalRef: inputRef, setRefs: setInputRefs } = useInputKeyboardValue(ref);
|
|
3041
3782
|
const isControlled = value !== undefined && onChange !== undefined;
|
|
3042
3783
|
const currentValue = isControlled ? value : internalValue;
|
|
3043
3784
|
const generatedId = React.useId();
|
|
3044
3785
|
const inputId = id || generatedId;
|
|
3786
|
+
const scaleClass = {
|
|
3787
|
+
1: 'scale-1-0',
|
|
3788
|
+
1.5: 'scale-1-5',
|
|
3789
|
+
2: 'scale-2-0',
|
|
3790
|
+
}[scale];
|
|
3045
3791
|
const handleChange = (e) => {
|
|
3046
3792
|
if (disabled)
|
|
3047
3793
|
return;
|
|
@@ -3088,12 +3834,25 @@ const Search = React.forwardRef(({ placeholder = 'Dica do que deve ser buscado',
|
|
|
3088
3834
|
}
|
|
3089
3835
|
onKeyDown?.(e);
|
|
3090
3836
|
};
|
|
3091
|
-
return (jsxRuntime.jsxs("div", { className: clsx(styles$c.search, { [styles$c.disabled]: disabled }, className), onClick: onClick, onMouseDown: onMouseDown, role: onClick || onMouseDown ? "button" : undefined, tabIndex: onClick || onMouseDown ? 0 : undefined, onKeyDown: onClick || onMouseDown ? (e) => {
|
|
3837
|
+
return (jsxRuntime.jsxs("div", { className: clsx(styles$c.search, scaleClass, { [styles$c.disabled]: disabled }, className), onClick: onClick, onMouseDown: onMouseDown, role: onClick || onMouseDown ? "button" : undefined, tabIndex: onClick || onMouseDown ? 0 : undefined, onKeyDown: onClick || onMouseDown ? (e) => {
|
|
3092
3838
|
if (e.key === 'Enter' || e.key === ' ') {
|
|
3093
3839
|
e.preventDefault();
|
|
3094
3840
|
onClick?.(e);
|
|
3095
3841
|
}
|
|
3096
|
-
} : undefined, children: [jsxRuntime.jsx("span", { className: clsx(styles$c.searchLeftIcon, { [styles$c.disabled]: disabled }), tabIndex: -1, role: "presentation", "aria-hidden": "true", children: jsxRuntime.jsx(reactIcons.Search16Regular, {}) }), jsxRuntime.jsx("input", { ref:
|
|
3842
|
+
} : undefined, children: [jsxRuntime.jsx("span", { className: clsx(styles$c.searchLeftIcon, { [styles$c.disabled]: disabled }), tabIndex: -1, role: "presentation", "aria-hidden": "true", children: jsxRuntime.jsx(reactIcons.Search16Regular, {}) }), jsxRuntime.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 && (jsxRuntime.jsx("span", { className: styles$c.searchClearIcon, "aria-hidden": "true", onClick: clearInputSearch, children: jsxRuntime.jsx(reactIcons.Dismiss16Regular, {}) })), (virtualKeyboard === 'default' || virtualKeyboard === 'numeric') && (jsxRuntime.jsx("div", { className: "virtualKeyboardWrapper", children: jsxRuntime.jsx(VirtualKeyboard, { variant: "native", type: virtualKeyboard, value: currentValue || '', targetRef: inputRef, onChange: (val) => {
|
|
3843
|
+
if (disabled)
|
|
3844
|
+
return;
|
|
3845
|
+
if (isControlled) {
|
|
3846
|
+
const syntheticEvent = {
|
|
3847
|
+
target: { value: val },
|
|
3848
|
+
currentTarget: { value: val },
|
|
3849
|
+
};
|
|
3850
|
+
onChange?.(syntheticEvent);
|
|
3851
|
+
}
|
|
3852
|
+
else {
|
|
3853
|
+
setInternalValue(val);
|
|
3854
|
+
}
|
|
3855
|
+
} }) }))] }));
|
|
3097
3856
|
});
|
|
3098
3857
|
Search.displayName = 'Search';
|
|
3099
3858
|
|
|
@@ -3217,9 +3976,15 @@ var styles$b = {"zds-list-item__container":"ListItem-module__zds-list-item__cont
|
|
|
3217
3976
|
|
|
3218
3977
|
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"};
|
|
3219
3978
|
|
|
3220
|
-
const Radio = ({ items, onValueChange, defaultValue, name, id, ariaLabel, orientation = 'vertical', className, ...rest }) => {
|
|
3221
|
-
const
|
|
3222
|
-
|
|
3979
|
+
const Radio = ({ items, onValueChange, defaultValue, name, id, ariaLabel, orientation = 'vertical', scale = 1, className, ...rest }) => {
|
|
3980
|
+
const generatedId = React.useId();
|
|
3981
|
+
const componentId = id || generatedId;
|
|
3982
|
+
const scaleClass = {
|
|
3983
|
+
1: 'scale-1-0',
|
|
3984
|
+
1.5: 'scale-1-5',
|
|
3985
|
+
2: 'scale-2-0',
|
|
3986
|
+
}[scale];
|
|
3987
|
+
return (jsxRuntime.jsx(radixUi.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 }) => {
|
|
3223
3988
|
const itemKey = id ?? value;
|
|
3224
3989
|
const uniqueId = `${componentId}-item-${value}`;
|
|
3225
3990
|
return (jsxRuntime.jsx("div", { className: clsx(styles$a.wrapper, { [styles$a.disabled]: disabled }), children: jsxRuntime.jsxs("label", { className: styles$a.labelWrapper, htmlFor: uniqueId, children: [jsxRuntime.jsx("div", { className: styles$a.itemWrapper, children: jsxRuntime.jsx(radixUi.RadioGroup.Item, { disabled: disabled, className: styles$a.item, value: value, id: uniqueId, "data-disabled": disabled, children: jsxRuntime.jsx(radixUi.RadioGroup.Indicator, { className: styles$a.indicator }) }) }), jsxRuntime.jsx("span", { className: styles$a.labelText, children: label })] }) }, itemKey));
|
|
@@ -3440,7 +4205,7 @@ const useSearchLogic = ({ items, searchValue, searchTerm, enableApiSearch, onApi
|
|
|
3440
4205
|
return { filteredItems: filteredItems() };
|
|
3441
4206
|
};
|
|
3442
4207
|
|
|
3443
|
-
const Menu = ({ items, children, onItemSelect, search, enableInfiniteScroll, onScrollEnd, isLoadingMore, onApiSearch, enableApiSearch, selectedItems, onOpenChange, align = 'start', className, maxHeight = 400, ...rest }) => {
|
|
4208
|
+
const Menu = ({ items, children, onItemSelect, search, enableInfiniteScroll, onScrollEnd, isLoadingMore, onApiSearch, enableApiSearch, selectedItems, onOpenChange, align = 'start', dropdownScale = 1, buttonScale, className, maxHeight = 400, ...rest }) => {
|
|
3444
4209
|
const itemsWrapperRef = React.useRef(null);
|
|
3445
4210
|
const hasReachedEndRef = React.useRef(false);
|
|
3446
4211
|
const observerRef = React.useRef(null);
|
|
@@ -3450,6 +4215,16 @@ const Menu = ({ items, children, onItemSelect, search, enableInfiniteScroll, onS
|
|
|
3450
4215
|
const [searchInput, setSearchInput] = React.useState('');
|
|
3451
4216
|
const [searchTerm, setSearchTerm] = React.useState('');
|
|
3452
4217
|
const maxHeightStyle = typeof maxHeight === 'number' ? `${maxHeight}px` : maxHeight;
|
|
4218
|
+
const scaleClass = {
|
|
4219
|
+
1: 'scale-1-0',
|
|
4220
|
+
1.5: 'scale-1-5',
|
|
4221
|
+
2: 'scale-2-0',
|
|
4222
|
+
}[dropdownScale];
|
|
4223
|
+
const triggerWithScale = React.isValidElement(children) && buttonScale
|
|
4224
|
+
? React.cloneElement(children, {
|
|
4225
|
+
scale: children.props?.scale ?? buttonScale,
|
|
4226
|
+
})
|
|
4227
|
+
: children;
|
|
3453
4228
|
const { open, setOpen, handleItemSelect: handleItemSelectLogic, isItemSelected } = useMenuLogic({
|
|
3454
4229
|
selectedItems,
|
|
3455
4230
|
onItemSelect,
|
|
@@ -3552,7 +4327,7 @@ const Menu = ({ items, children, onItemSelect, search, enableInfiniteScroll, onS
|
|
|
3552
4327
|
hasReachedEndRef.current = false;
|
|
3553
4328
|
}
|
|
3554
4329
|
};
|
|
3555
|
-
return (jsxRuntime.jsxs(radixUi.DropdownMenu.Root, { open: open, onOpenChange: handleOpenChange, children: [jsxRuntime.jsx(radixUi.DropdownMenu.Trigger, { asChild: true, children:
|
|
4330
|
+
return (jsxRuntime.jsxs(radixUi.DropdownMenu.Root, { open: open, onOpenChange: handleOpenChange, children: [jsxRuntime.jsx(radixUi.DropdownMenu.Trigger, { asChild: true, children: triggerWithScale }), jsxRuntime.jsx(radixUi.DropdownMenu.Portal, { children: jsxRuntime.jsxs(radixUi.DropdownMenu.Content, { className: clsx(styles$9.content, scaleClass, className), sideOffset: 8, align: align, onPointerDown: () => { closedByPointerRef.current = true; }, onInteractOutside: () => { closedByPointerRef.current = true; }, onCloseAutoFocus: (e) => {
|
|
3556
4331
|
if (closedByPointerRef.current) {
|
|
3557
4332
|
e.preventDefault();
|
|
3558
4333
|
closedByPointerRef.current = false;
|
|
@@ -3584,7 +4359,7 @@ const Modal = ({ isOpen = false, onClose, title, children, headerContent, closeO
|
|
|
3584
4359
|
|
|
3585
4360
|
var styles$7 = {"quantity":"Quantity-module__quantity___-vndR","quantityInput":"Quantity-module__quantityInput___xZG-v","disabled":"Quantity-module__disabled___X6p5l"};
|
|
3586
4361
|
|
|
3587
|
-
const Quantity = ({ value = 0, onChange, disabled = false, decimal = false, decimalPlaces = 2, size = 'lg', id, valueIncrement = 1, className, inputSize, minValue = 0, maxValue = 9999, decrementAriaLabel = 'Decrease quantity', incrementAriaLabel = 'Increase quantity', inputAriaLabel = 'Quantity', ...rest }) => {
|
|
4362
|
+
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 }) => {
|
|
3588
4363
|
const initialValue = Math.min(Math.max(value, minValue), maxValue);
|
|
3589
4364
|
const [internalValue, setInternalValue] = React.useState(initialValue);
|
|
3590
4365
|
const [inputValue, setInputValue] = React.useState(decimal ? initialValue.toFixed(decimalPlaces) : String(initialValue));
|
|
@@ -3763,7 +4538,12 @@ const Quantity = ({ value = 0, onChange, disabled = false, decimal = false, deci
|
|
|
3763
4538
|
const inputSizeValue = inputSize !== undefined ? inputSize : Math.max(1, inputValue.length);
|
|
3764
4539
|
const uniqueId = React.useId();
|
|
3765
4540
|
const inputId = id || uniqueId;
|
|
3766
|
-
|
|
4541
|
+
const scaleClass = {
|
|
4542
|
+
1: 'scale-1-0',
|
|
4543
|
+
1.5: 'scale-1-5',
|
|
4544
|
+
2: 'scale-2-0',
|
|
4545
|
+
}[scale];
|
|
4546
|
+
return (jsxRuntime.jsxs("div", { className: clsx(styles$7.quantity, scaleClass, { [styles$7.disabled]: disabled }, className), ...rest, children: [jsxRuntime.jsx(Button, { variant: 'outlined', size: size, type: 'button', iconOnly: true, icon: jsxRuntime.jsx(reactIcons.Subtract16Regular, {}), onClick: decrement, disabled: disabled || isMinValue, "aria-label": decrementAriaLabel, tooltipText: 'Diminuir' }), jsxRuntime.jsx("input", { ref: inputRef, className: clsx(styles$7.quantityInput, { [styles$7.disabled]: disabled }), type: 'text', value: inputValue, onChange: handleInputChange, onBlur: handleBlur, onKeyDown: handleInputKeyDown, id: inputId, step: stepValue, "aria-label": inputAriaLabel, role: 'spinbutton', "aria-valuenow": internalValue, "aria-valuemin": minValue, "aria-valuemax": maxValue, disabled: disabled, inputMode: decimal ? 'decimal' : 'numeric', size: inputSizeValue }), jsxRuntime.jsx(Button, { variant: 'outlined', size: size, type: 'button', iconOnly: true, onClick: increment, disabled: disabled || isMaxValue, "aria-label": incrementAriaLabel, icon: jsxRuntime.jsx(reactIcons.Add16Regular, {}), tooltipText: 'Aumentar' })] }));
|
|
3767
4547
|
};
|
|
3768
4548
|
const memorizedQuantity = React.memo(Quantity);
|
|
3769
4549
|
memorizedQuantity.displayName = 'Quantity';
|
|
@@ -4077,7 +4857,7 @@ function useSelectLogic({ value, required = false, search = false, onValueChange
|
|
|
4077
4857
|
};
|
|
4078
4858
|
}
|
|
4079
4859
|
|
|
4080
|
-
const Select = ({ items, onValueChange, onOpenChange, variant, required = false, value, label, helperText, placeholder = 'Selecione', maxWidth, search = false, errorMessage, disabled = false, className, 'aria-label': ariaLabel, 'data-testid': testId, tooltip = false, tooltipText, side = 'bottom', align = 'start', enableInfiniteScroll = false, onScrollEnd, isLoadingMore = false, enableApiSearch = false, onApiSearch, isSearching = false, ...rest }) => {
|
|
4860
|
+
const Select = ({ items, onValueChange, onOpenChange, variant, required = false, value, label, helperText, placeholder = 'Selecione', maxWidth, search = false, errorMessage, disabled = false, scale = 1, className, 'aria-label': ariaLabel, 'data-testid': testId, tooltip = false, tooltipText, side = 'bottom', align = 'start', enableInfiniteScroll = false, onScrollEnd, isLoadingMore = false, enableApiSearch = false, onApiSearch, isSearching = false, ...rest }) => {
|
|
4081
4861
|
const componentId = React.useId();
|
|
4082
4862
|
const selectId = `select-${componentId}`;
|
|
4083
4863
|
const viewportRef = React.useRef(null);
|
|
@@ -4125,6 +4905,11 @@ const Select = ({ items, onValueChange, onOpenChange, variant, required = false,
|
|
|
4125
4905
|
const containerStyle = React.useMemo(() => ({
|
|
4126
4906
|
maxWidth: maxWidth ? `${maxWidth}px` : undefined,
|
|
4127
4907
|
}), [maxWidth]);
|
|
4908
|
+
const scaleClass = {
|
|
4909
|
+
1: 'scale-1-0',
|
|
4910
|
+
1.5: 'scale-1-5',
|
|
4911
|
+
2: 'scale-2-0',
|
|
4912
|
+
}[scale];
|
|
4128
4913
|
const handleSearchChange = (e) => {
|
|
4129
4914
|
const value = e.target.value;
|
|
4130
4915
|
actions.setSearchInput(value);
|
|
@@ -4157,7 +4942,7 @@ const Select = ({ items, onValueChange, onOpenChange, variant, required = false,
|
|
|
4157
4942
|
onApiSearch('');
|
|
4158
4943
|
}
|
|
4159
4944
|
};
|
|
4160
|
-
return (jsxRuntime.jsx(radixUi.Select.Root, { value: variant === 'checkbox' || (search && state.isOpen) ? '' : (state.selectedValues[0] || ''), onValueChange: variant === 'checkbox' ? undefined : actions.handleSingleSelect, required: required, open: state.isOpen, onOpenChange: actions.setOpen, disabled: disabled, ...rest, children: jsxRuntime.jsxs("div", { className: clsx(styles$6.container, className), style: containerStyle, "data-testid": testId, children: [jsxRuntime.jsx("div", { className: styles$6.fieldContainer, children: jsxRuntime.jsxs("div", { className: styles$6.containerLabel, children: [jsxRuntime.jsx(LabelComponent, { htmlFor: selectId, required: required, tooltipText: tooltipText, tooltip: tooltip, side: side, align: align, error: state.hasError && state.touched, disabled: disabled, children: label }), jsxRuntime.jsxs(radixUi.Select.Trigger, { className: clsx(styles$6.trigger, {
|
|
4945
|
+
return (jsxRuntime.jsx(radixUi.Select.Root, { value: variant === 'checkbox' || (search && state.isOpen) ? '' : (state.selectedValues[0] || ''), onValueChange: variant === 'checkbox' ? undefined : actions.handleSingleSelect, required: required, open: state.isOpen, onOpenChange: actions.setOpen, disabled: disabled, ...rest, children: jsxRuntime.jsxs("div", { className: clsx(styles$6.container, scaleClass, className), style: containerStyle, "data-testid": testId, children: [jsxRuntime.jsx("div", { className: styles$6.fieldContainer, children: jsxRuntime.jsxs("div", { className: styles$6.containerLabel, children: [jsxRuntime.jsx(LabelComponent, { htmlFor: selectId, required: required, tooltipText: tooltipText, tooltip: tooltip, side: side, align: align, error: state.hasError && state.touched, disabled: disabled, children: label }), jsxRuntime.jsxs(radixUi.Select.Trigger, { className: clsx(styles$6.trigger, {
|
|
4161
4946
|
[styles$6.error]: state.hasError && state.touched,
|
|
4162
4947
|
[styles$6.disabled]: disabled,
|
|
4163
4948
|
[styles$6.hasValue]: state.selectedValues.length > 0,
|
|
@@ -4563,7 +5348,7 @@ const TableV2 = ({ columns, data, rowSelection: rowSelectionConfig, enableSortin
|
|
|
4563
5348
|
};
|
|
4564
5349
|
return (jsxRuntime.jsxs("div", { className: clsx(styles$4.wrapper, className), children: [showBulkActions && (jsxRuntime.jsxs("div", { className: styles$4.bulkActionsBar, children: [jsxRuntime.jsxs("div", { className: styles$4.bulkActionsInfo, children: [jsxRuntime.jsx(Button, { variant: "text", iconOnly: true, icon: jsxRuntime.jsx(reactIcons.Dismiss16Regular, {}), ariaLabel: "Limpar sele\u00E7\u00E3o", onClick: handleClearSelection, className: styles$4.bulkActionsClearButton }), jsxRuntime.jsx("span", { className: styles$4.bulkActionsLabel, children: bulkActions.label
|
|
4565
5350
|
? bulkActions.label(selectedCount, selectedRows)
|
|
4566
|
-
: `${selectedCount} ${selectedCount === 1 ? 'item selecionado' : 'itens selecionados'}` })] }), jsxRuntime.jsx("div", { className: styles$4.bulkActionsButtons, children: bulkActions.actions.map((action, index) => (jsxRuntime.jsx(Button, { variant: action.variant ?? 'outlined', type: "button", disabled: action.disabled, onClick: action.onClick, size: "sm", children: action.label }, index))) })] })), header && (jsxRuntime.jsxs("div", { className: styles$4.tableHeader, children: [showSearch && (jsxRuntime.jsx("div", { className: styles$4.tableHeaderSearchContainer, children: jsxRuntime.jsx(Search, { value: pendingSearch, searchMode: header?.searchMode ?? "on-enter", onChange: (e) => {
|
|
5351
|
+
: `${selectedCount} ${selectedCount === 1 ? 'item selecionado' : 'itens selecionados'}` })] }), jsxRuntime.jsx("div", { className: styles$4.bulkActionsButtons, children: bulkActions.actions.map((action, index) => (jsxRuntime.jsx(Button, { variant: action.variant ?? 'outlined', type: "button", disabled: action.disabled, onClick: action.onClick, size: "sm", children: action.label }, index))) })] })), header && (jsxRuntime.jsxs("div", { className: styles$4.tableHeader, children: [showSearch && (jsxRuntime.jsx("div", { className: styles$4.tableHeaderSearchContainer, children: jsxRuntime.jsx(Search, { value: pendingSearch, virtualKeyboard: header.virtualKeyboard, searchMode: header?.searchMode ?? "on-enter", onChange: (e) => {
|
|
4567
5352
|
setPendingSearch(e.target.value);
|
|
4568
5353
|
}, onSearch: (val) => {
|
|
4569
5354
|
if (footer) {
|
|
@@ -4578,7 +5363,7 @@ const TableV2 = ({ columns, data, rowSelection: rowSelectionConfig, enableSortin
|
|
|
4578
5363
|
footer?.onPageChange?.(1);
|
|
4579
5364
|
}
|
|
4580
5365
|
header?.onSearchChange?.('');
|
|
4581
|
-
}, placeholder: header.searchPlaceholder ?? 'Pesquisar...', className: styles$4.tableHeaderSearch }) })), !!header.filterItems?.length && (jsxRuntime.jsxs("div", { className: styles$4.tableHeaderFilters, children: [jsxRuntime.jsx("span", { className: styles$4.tableHeaderFilterLabel, children: "Filtros" }), jsxRuntime.jsx("div", { className: styles$4.tableHeaderFilterItems, children: header.filterItems.map((filterItem, index) => {
|
|
5366
|
+
}, placeholder: header.searchPlaceholder ?? 'Pesquisar...', className: styles$4.tableHeaderSearch }) })), !!header.filterItems?.length && (jsxRuntime.jsxs("div", { className: styles$4.tableHeaderFilters, children: [header.filterItems.some((item) => item.type !== 'combined') && (jsxRuntime.jsx("span", { className: styles$4.tableHeaderFilterLabel, children: "Filtros" })), jsxRuntime.jsx("div", { className: styles$4.tableHeaderFilterItems, children: header.filterItems.map((filterItem, index) => {
|
|
4582
5367
|
const commonProps = {
|
|
4583
5368
|
buttonText: filterItem.buttonText,
|
|
4584
5369
|
icon: filterItem.icon,
|
|
@@ -4628,12 +5413,13 @@ const TableV2 = ({ columns, data, rowSelection: rowSelectionConfig, enableSortin
|
|
|
4628
5413
|
|
|
4629
5414
|
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"};
|
|
4630
5415
|
|
|
4631
|
-
const TextArea = React.forwardRef(({ className, value, label, placeholder, onChange, disabled = false, maxLength, required = false, helperText, tooltip = false, tooltipText, side = 'bottom', align = 'start', errorMessage, error, id, onBlur, onFocus, name, resize = 'vertical', showCharCount = false, height, ...rest }, ref) => {
|
|
5416
|
+
const TextArea = React.forwardRef(({ className, value, label, placeholder, onChange, disabled = false, maxLength, required = false, helperText, tooltip = false, tooltipText, side = 'bottom', align = 'start', errorMessage, error, id, onBlur, onFocus, name, resize = 'vertical', showCharCount = false, height, virtualKeyboard, ...rest }, ref) => {
|
|
4632
5417
|
const normalizeValue = (val) => {
|
|
4633
5418
|
return val === undefined || val === null ? '' : String(val);
|
|
4634
5419
|
};
|
|
4635
5420
|
const [textareaValue, setTextareaValue] = React.useState(normalizeValue(value));
|
|
4636
5421
|
const [textareaError, setTextareaError] = React.useState('');
|
|
5422
|
+
const { internalRef: textareaRef, setRefs: setTextareaRefs } = useInputKeyboardValue(ref);
|
|
4637
5423
|
const generatedId = React.useId();
|
|
4638
5424
|
const componentId = id || generatedId;
|
|
4639
5425
|
React.useEffect(() => {
|
|
@@ -4666,7 +5452,12 @@ const TextArea = React.forwardRef(({ className, value, label, placeholder, onCha
|
|
|
4666
5452
|
? `${componentId}-helper`
|
|
4667
5453
|
: undefined;
|
|
4668
5454
|
const containerClass = clsx(styles$3.container, disabled && styles$3.disabled, hasError && !disabled && styles$3.error, className);
|
|
4669
|
-
return (jsxRuntime.jsxs("div", { className: containerClass, children: [label && (jsxRuntime.jsx(LabelComponent, { htmlFor: componentId, required: required, tooltip: tooltip, tooltipText: tooltipText, side: side, align: align, error: hasError, disabled: disabled, children: label })), jsxRuntime.jsxs("div", { className: styles$3.inputWrapper, children: [jsxRuntime.jsx("div", { className: styles$3.inputContainer, children: jsxRuntime.jsx("textarea", { ...rest, ref:
|
|
5455
|
+
return (jsxRuntime.jsxs("div", { className: containerClass, children: [label && (jsxRuntime.jsx(LabelComponent, { htmlFor: componentId, required: required, tooltip: tooltip, tooltipText: tooltipText, side: side, align: align, error: hasError, disabled: disabled, children: label })), jsxRuntime.jsxs("div", { className: styles$3.inputWrapper, children: [jsxRuntime.jsx("div", { className: styles$3.inputContainer, children: jsxRuntime.jsx("textarea", { ...rest, ref: 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 }) }), jsxRuntime.jsxs("div", { className: styles$3.footer, children: [jsxRuntime.jsx("span", { id: helperId, className: styles$3.helperText, "aria-live": hasError ? 'polite' : undefined, children: displayHelperText }), showCharCount && maxLength && (jsxRuntime.jsxs("span", { className: styles$3.charCount, children: [textareaValue.length, "/", maxLength] }))] })] }), (virtualKeyboard === 'default' || virtualKeyboard === 'numeric') && (jsxRuntime.jsx("div", { className: "virtualKeyboardWrapper", children: jsxRuntime.jsx(VirtualKeyboard, { variant: "native", type: virtualKeyboard, maxLength: maxLength, value: textareaValue, targetRef: textareaRef, onChange: (val) => {
|
|
5456
|
+
if (!disabled && (!maxLength || val.length <= maxLength)) {
|
|
5457
|
+
setTextareaValue(val);
|
|
5458
|
+
onChange?.(val);
|
|
5459
|
+
}
|
|
5460
|
+
} }) }))] }));
|
|
4670
5461
|
});
|
|
4671
5462
|
TextArea.displayName = 'TextArea';
|
|
4672
5463
|
var TextArea_default = React.memo(TextArea);
|
|
@@ -4879,7 +5670,14 @@ ToastContainer.displayName = 'ToastContainer';
|
|
|
4879
5670
|
|
|
4880
5671
|
var styles$1 = {"container":"Switch-module__container___BR1OB","switchRoot":"Switch-module__switchRoot___jz2HD","switchThumb":"Switch-module__switchThumb___X3RL7"};
|
|
4881
5672
|
|
|
4882
|
-
const Switch = ({ disabled = false, defaultChecked = false, checked, onCheckedChange,
|
|
5673
|
+
const Switch = ({ disabled = false, defaultChecked = false, checked, onCheckedChange, scale = 1, className, ...rest }) => {
|
|
5674
|
+
const scaleClass = {
|
|
5675
|
+
1: 'scale-1-0',
|
|
5676
|
+
1.5: 'scale-1-5',
|
|
5677
|
+
2: 'scale-2-0',
|
|
5678
|
+
}[scale];
|
|
5679
|
+
return (jsxRuntime.jsx("div", { className: clsx(styles$1.container, scaleClass, className), children: jsxRuntime.jsx(radixUi.Switch.Root, { className: styles$1.switchRoot, disabled: disabled, defaultChecked: defaultChecked, checked: checked, onCheckedChange: onCheckedChange, ...rest, children: jsxRuntime.jsx(radixUi.Switch.Thumb, { className: styles$1.switchThumb }) }) }));
|
|
5680
|
+
};
|
|
4883
5681
|
|
|
4884
5682
|
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"};
|
|
4885
5683
|
|
|
@@ -5304,6 +6102,7 @@ exports.Badge = Badge;
|
|
|
5304
6102
|
exports.Button = Button;
|
|
5305
6103
|
exports.Calendar = Calendar;
|
|
5306
6104
|
exports.Callout = Callout;
|
|
6105
|
+
exports.Card = Card;
|
|
5307
6106
|
exports.Checkbox = Checkbox;
|
|
5308
6107
|
exports.Chips = MemoizedChips;
|
|
5309
6108
|
exports.Container = Container;
|
|
@@ -5331,6 +6130,7 @@ exports.ToastContainer = ToastContainer;
|
|
|
5331
6130
|
exports.ToastProvider = ToastProvider;
|
|
5332
6131
|
exports.Tooltip = Tooltip;
|
|
5333
6132
|
exports.VerificationCode = VerificationCode;
|
|
6133
|
+
exports.VirtualKeyboard = VirtualKeyboard;
|
|
5334
6134
|
exports.normalizeText = normalizeText;
|
|
5335
6135
|
exports.useApiSimulation = useApiSimulation;
|
|
5336
6136
|
exports.useInfiniteScroll = useInfiniteScroll;
|