@giro-ds/react 10.0.0 → 11.1.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 +67 -109
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +28 -62
- package/dist/index.esm.js +67 -109
- package/dist/index.esm.js.map +1 -1
- package/dist/styles.css +3 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -110,12 +110,7 @@ const Button = React.forwardRef(({ as, children, variant = 'filled', iconPositio
|
|
|
110
110
|
'Forneça um ícone via `icon={<MeuIcone />}`.');
|
|
111
111
|
}
|
|
112
112
|
const resolvedIcon = icon;
|
|
113
|
-
const
|
|
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, {
|
|
113
|
+
const buttonClasses = clsx(styles$r.button, styles$r[`button-${variant}`], styles$r[`button-${size}`], {
|
|
119
114
|
[styles$r['disabled']]: disabled,
|
|
120
115
|
[styles$r['buttonLoading']]: loading,
|
|
121
116
|
[styles$r['buttonWithIcon']]: resolvedIcon && !iconOnly,
|
|
@@ -155,6 +150,7 @@ const Button = React.forwardRef(({ as, children, variant = 'filled', iconPositio
|
|
|
155
150
|
}
|
|
156
151
|
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 }))] }));
|
|
157
152
|
};
|
|
153
|
+
const { style: externalStyle, ...otherRest } = rest;
|
|
158
154
|
const baseProps = {
|
|
159
155
|
ref,
|
|
160
156
|
id: componentId,
|
|
@@ -164,7 +160,11 @@ const Button = React.forwardRef(({ as, children, variant = 'filled', iconPositio
|
|
|
164
160
|
'aria-busy': loading || undefined,
|
|
165
161
|
tabIndex: disabled || loading ? -1 : 0,
|
|
166
162
|
onClick: handleClick,
|
|
167
|
-
...
|
|
163
|
+
...otherRest,
|
|
164
|
+
style: {
|
|
165
|
+
'--giro-scale': scale,
|
|
166
|
+
...externalStyle,
|
|
167
|
+
},
|
|
168
168
|
};
|
|
169
169
|
const getNavigationProps = () => {
|
|
170
170
|
if (href) {
|
|
@@ -2458,7 +2458,7 @@ const ptBR = {
|
|
|
2458
2458
|
},
|
|
2459
2459
|
};
|
|
2460
2460
|
|
|
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"};
|
|
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","chevron_wrapper":"Calendar-module__chevron_wrapper___BfN9a"};
|
|
2462
2462
|
|
|
2463
2463
|
const FLUENT_CHEVRON_MAP = {
|
|
2464
2464
|
down: reactIcons.ChevronDown16Regular,
|
|
@@ -2468,7 +2468,7 @@ const FLUENT_CHEVRON_MAP = {
|
|
|
2468
2468
|
};
|
|
2469
2469
|
const CustomChevron = ({ orientation = "left", className, }) => {
|
|
2470
2470
|
const Icon = FLUENT_CHEVRON_MAP[orientation];
|
|
2471
|
-
return jsxRuntime.jsx(Icon, { className: className, "aria-hidden": true });
|
|
2471
|
+
return jsxRuntime.jsx("span", { className: styles$q.chevron_wrapper, children: jsxRuntime.jsx(Icon, { className: className, "aria-hidden": true }) });
|
|
2472
2472
|
};
|
|
2473
2473
|
const GridCtx = React.createContext(null);
|
|
2474
2474
|
const GridMonthCaption = ({ calendarMonth, displayIndex: _displayIndex, ...divProps }) => {
|
|
@@ -2477,10 +2477,10 @@ const GridMonthCaption = ({ calendarMonth, displayIndex: _displayIndex, ...divPr
|
|
|
2477
2477
|
const date = calendarMonth.date;
|
|
2478
2478
|
const monthLabel = new Intl.DateTimeFormat(intlLocale, { month: "long" }).format(date);
|
|
2479
2479
|
const yearLabel = String(date.getFullYear());
|
|
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 }))] })] }));
|
|
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("span", { className: styles$q.chevron_wrapper, children: jsxRuntime.jsx(reactIcons.ChevronUp16Regular, { className: styles$q.caption_year_chevron, "aria-hidden": true }) })) : (jsxRuntime.jsx("span", { className: styles$q.chevron_wrapper, children: jsxRuntime.jsx(reactIcons.ChevronDown16Regular, { className: styles$q.caption_year_chevron, "aria-hidden": true }) }))] })] }));
|
|
2481
2481
|
};
|
|
2482
2482
|
const YEARS_PER_PAGE = 20;
|
|
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 }) => {
|
|
2483
|
+
const Calendar = ({ selected, currentDate, defaultMonth, startMonth, endMonth, onDaySelect, onDateChange, onClear: _onClear, minDate, maxDate, disabled, format: _format, locale = "pt-br", autoFocus, className, style, scale = 1, id, "aria-label": ariaLabel, ...rest }) => {
|
|
2484
2484
|
const animate = true;
|
|
2485
2485
|
const [internalSelected, setInternalSelected] = React.useState(selected ?? undefined);
|
|
2486
2486
|
const [internalDisplayMonth, setInternalDisplayMonth] = React.useState(() => currentDate ?? defaultMonth ?? new Date());
|
|
@@ -2557,12 +2557,8 @@ const Calendar = ({ selected, currentDate, defaultMonth, startMonth, endMonth, o
|
|
|
2557
2557
|
autoFocus,
|
|
2558
2558
|
"aria-label": ariaLabel,
|
|
2559
2559
|
};
|
|
2560
|
-
const
|
|
2561
|
-
|
|
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))) })] }))] }))] }) }));
|
|
2560
|
+
const containerStyle = { '--giro-scale': scale };
|
|
2561
|
+
return (jsxRuntime.jsx(GridCtx.Provider, { value: gridCtxValue, children: jsxRuntime.jsxs("div", { className: clsx(styles$q.calendar_grid_wrapper, className), style: { ...containerStyle, ...style }, 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("span", { className: styles$q.chevron_wrapper, children: 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("span", { className: styles$q.chevron_wrapper, children: 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("span", { className: styles$q.chevron_wrapper, 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("span", { className: styles$q.chevron_wrapper, 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))) })] }))] }))] }) }));
|
|
2566
2562
|
};
|
|
2567
2563
|
|
|
2568
2564
|
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"};
|
|
@@ -2600,14 +2596,9 @@ const CheckHalf = ({ className = '', width = 16, height = 16, fill = 'white', ..
|
|
|
2600
2596
|
|
|
2601
2597
|
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"};
|
|
2602
2598
|
|
|
2603
|
-
const Checkbox = ({ id, label, onCheckedChange, checked, disabled, className, scale = 1, indeterminate = false, ...rest }) => {
|
|
2599
|
+
const Checkbox = ({ id, label, onCheckedChange, checked, disabled, className, style, scale = 1, indeterminate = false, ...rest }) => {
|
|
2604
2600
|
const componentId = id || React__namespace.useId();
|
|
2605
|
-
|
|
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, {
|
|
2601
|
+
return (jsxRuntime.jsxs("div", { className: clsx(styles$n.container, className), style: { '--giro-scale': scale, ...style }, children: [jsxRuntime.jsx("div", { className: clsx(styles$n.wrapperCheckbox, {
|
|
2611
2602
|
[styles$n.disabled]: disabled,
|
|
2612
2603
|
}), 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 })] }));
|
|
2613
2604
|
};
|
|
@@ -2615,17 +2606,13 @@ const Checkbox = ({ id, label, onCheckedChange, checked, disabled, className, sc
|
|
|
2615
2606
|
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
2607
|
|
|
2617
2608
|
const Chips = ({ children, leftIcon, rightIcon, variant = 'neutral', disabled = false, backgroundColor, textColor, scale = 1, className, style, ...rest }) => {
|
|
2618
|
-
const
|
|
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, {
|
|
2609
|
+
const chipsClass = clsx(styles$m.chips, styles$m[variant], {
|
|
2624
2610
|
[styles$m.disabled]: disabled,
|
|
2625
2611
|
[styles$m.hasLeftIcon]: leftIcon,
|
|
2626
2612
|
[styles$m.hasRightIcon]: rightIcon,
|
|
2627
2613
|
}, className);
|
|
2628
2614
|
const colorStyle = {
|
|
2615
|
+
'--giro-scale': scale,
|
|
2629
2616
|
...(!disabled && backgroundColor && { '--chips-bg': `var(--${backgroundColor})` }),
|
|
2630
2617
|
...(!disabled && textColor && { '--chips-text': `var(--${textColor})` }),
|
|
2631
2618
|
...style,
|
|
@@ -2695,6 +2682,7 @@ const LAYOUT_DISPLAY = {
|
|
|
2695
2682
|
|
|
2696
2683
|
const EMOTICON_KEY = '{emoticon}';
|
|
2697
2684
|
const DOWN_KEYBOARD_KEY = '{downkeyboard}';
|
|
2685
|
+
const ENTER_KEY = '{enter}';
|
|
2698
2686
|
const removeKeyFromLayout = (layout, key) => Object.fromEntries(Object.entries(layout).map(([layoutName, rows]) => [
|
|
2699
2687
|
layoutName,
|
|
2700
2688
|
rows.map((row) => row.split(key).join(' ').replace(/\s+/g, ' ').trim()),
|
|
@@ -2756,7 +2744,7 @@ const NATIVE_LAYOUTS = {
|
|
|
2756
2744
|
const NATIVE_LAYOUT_KEYS = new Set([
|
|
2757
2745
|
'default', 'numeric',
|
|
2758
2746
|
]);
|
|
2759
|
-
const getNativeLayout = (type, Emoji = true, showDownKeyboardButton = true, isFixed = false) => {
|
|
2747
|
+
const getNativeLayout = (type, Emoji = true, showDownKeyboardButton = true, isFixed = false, showEnterKey = true) => {
|
|
2760
2748
|
const layout = NATIVE_LAYOUTS[type] ?? NATIVE_LAYOUTS.default ?? null;
|
|
2761
2749
|
if (!layout)
|
|
2762
2750
|
return null;
|
|
@@ -2767,6 +2755,9 @@ const getNativeLayout = (type, Emoji = true, showDownKeyboardButton = true, isFi
|
|
|
2767
2755
|
if (!showDownKeyboardButton) {
|
|
2768
2756
|
computedLayout = removeKeyFromLayout(computedLayout, DOWN_KEYBOARD_KEY);
|
|
2769
2757
|
}
|
|
2758
|
+
if (!showEnterKey) {
|
|
2759
|
+
computedLayout = removeKeyFromLayout(computedLayout, ENTER_KEY);
|
|
2760
|
+
}
|
|
2770
2761
|
if (isFixed) {
|
|
2771
2762
|
computedLayout = Object.fromEntries(Object.entries(computedLayout).map(([layoutName, rows]) => [
|
|
2772
2763
|
layoutName,
|
|
@@ -2792,7 +2783,7 @@ const SHIFT_TOGGLES = {
|
|
|
2792
2783
|
alt2: 'alt',
|
|
2793
2784
|
};
|
|
2794
2785
|
|
|
2795
|
-
var styles$j = {"container":"VirtualKeyboard-module__container___A-e0I","layout--numeric":"VirtualKeyboard-module__layout--numeric___zfd7G","
|
|
2786
|
+
var styles$j = {"container":"VirtualKeyboard-module__container___A-e0I","layout--numeric":"VirtualKeyboard-module__layout--numeric___zfd7G","mode--fixed":"VirtualKeyboard-module__mode--fixed___1eFY1","layout--default":"VirtualKeyboard-module__layout--default___qyY1b","textFieldContainer":"VirtualKeyboard-module__textFieldContainer___XxGen","keyboardWrapper":"VirtualKeyboard-module__keyboardWrapper___jryTf","keyboardNumpadActive":"VirtualKeyboard-module__keyboardNumpadActive___jPpJD","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
2787
|
|
|
2797
2788
|
const LONG_PRESS_DELAY_MS = 400;
|
|
2798
2789
|
const ACCENT_OPTIONS = {
|
|
@@ -2832,12 +2823,12 @@ const ACCENT_OPTIONS = {
|
|
|
2832
2823
|
* <VirtualKeyboard targetRef={inputRef} value={value} onChange={setValue} />
|
|
2833
2824
|
* ```
|
|
2834
2825
|
*/
|
|
2835
|
-
const VirtualKeyboard = ({ variant = 'native', type = 'default', value = '', onChange, onKeyPress, maxLength, Emoji = false, className, id, textFieldPlaceholder = 'Digite aqui...', helperText, error, errorMessage, targetRef, }) => {
|
|
2826
|
+
const VirtualKeyboard = ({ variant = 'native', type = 'default', value = '', onChange, onKeyPress, maxLength, Emoji = false, className, id, textFieldPlaceholder = 'Digite aqui...', helperText, error, errorMessage, targetRef, textFieldScale = 1, showEnterKey = true, }) => {
|
|
2836
2827
|
const [layoutName, setLayoutName] = React.useState('default');
|
|
2837
2828
|
const [capsLockOn, setCapsLockOn] = React.useState(false);
|
|
2838
2829
|
const [accentMenu, setAccentMenu] = React.useState(null);
|
|
2839
2830
|
const [accentMenuOffsetX, setAccentMenuOffsetX] = React.useState(0);
|
|
2840
|
-
const [activeLayout, setActiveLayout] = React.useState(getNativeLayout(type, Emoji, variant === 'native', variant === 'fixed'));
|
|
2831
|
+
const [activeLayout, setActiveLayout] = React.useState(getNativeLayout(type, Emoji, variant === 'native', variant === 'fixed', showEnterKey));
|
|
2841
2832
|
const visualType = NATIVE_LAYOUT_KEYS.has(type) ? type : 'default';
|
|
2842
2833
|
const [isOpen, setIsOpen] = React.useState(variant !== 'native');
|
|
2843
2834
|
const hideTimeoutRef = React.useRef(null);
|
|
@@ -2950,8 +2941,8 @@ const VirtualKeyboard = ({ variant = 'native', type = 'default', value = '', onC
|
|
|
2950
2941
|
React.useEffect(() => {
|
|
2951
2942
|
setLayoutName('default');
|
|
2952
2943
|
setCapsLockOn(false);
|
|
2953
|
-
setActiveLayout(getNativeLayout(type, Emoji, variant === 'native', variant === 'fixed'));
|
|
2954
|
-
}, [type, Emoji, variant]);
|
|
2944
|
+
setActiveLayout(getNativeLayout(type, Emoji, variant === 'native', variant === 'fixed', showEnterKey));
|
|
2945
|
+
}, [type, Emoji, variant, showEnterKey]);
|
|
2955
2946
|
React.useEffect(() => {
|
|
2956
2947
|
if (!Emoji && layoutName === 'emoticon') {
|
|
2957
2948
|
setLayoutName(type === 'numeric' ? 'abc' : 'default');
|
|
@@ -3301,7 +3292,7 @@ const VirtualKeyboard = ({ variant = 'native', type = 'default', value = '', onC
|
|
|
3301
3292
|
'{bksp}': (baseDisplay['{bksp}'] ?? '').replace(/\s*Apagar$/, ''),
|
|
3302
3293
|
};
|
|
3303
3294
|
}, [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) => {
|
|
3295
|
+
const keyboardEl = activeLayout ? (jsxRuntime.jsxs("div", { ref: keyboardWrapperRef, className: clsx(styles$j.keyboardWrapper, ((type === 'numeric' && layoutName === 'default') || layoutName === 'numbers') && styles$j.keyboardNumpadActive), onPointerDownCapture: handleLongPressStart, onPointerUpCapture: handleLongPressEnd, onPointerLeave: handleLongPressEnd, onPointerCancelCapture: handleLongPressEnd, children: [jsxRuntime.jsx(Keyboard, { keyboardRef: (instance) => {
|
|
3305
3296
|
keyboardInstanceRef.current = instance;
|
|
3306
3297
|
if (instance) {
|
|
3307
3298
|
instance.setInput(valueRef.current);
|
|
@@ -3341,10 +3332,10 @@ const VirtualKeyboard = ({ variant = 'native', type = 'default', value = '', onC
|
|
|
3341
3332
|
if (variant === 'native' && typeof document !== 'undefined') {
|
|
3342
3333
|
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
3334
|
}
|
|
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] }));
|
|
3335
|
+
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, scale: textFieldScale }) })), keyboardEl] }));
|
|
3345
3336
|
};
|
|
3346
3337
|
|
|
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"};
|
|
3338
|
+
var styles$i = {"container":"TextField-module__container___WJHFR","inputWrapper":"TextField-module__inputWrapper___INjfd","inputContainer":"TextField-module__inputContainer___3EsFJ","icon":"TextField-module__icon___p1vwi","clearButton":"TextField-module__clearButton___kgOot","inputWithIcon":"TextField-module__inputWithIcon___shqkL","helperText":"TextField-module__helperText___d5QGC","error":"TextField-module__error___IGQzp","disabled":"TextField-module__disabled___roIKP","attachedToVirtualKeyboard":"TextField-module__attachedToVirtualKeyboard___fuO2O","errorWithMessage":"TextField-module__errorWithMessage___m-5AA","clearButtonIcon":"TextField-module__clearButtonIcon___Z2iyc"};
|
|
3348
3339
|
|
|
3349
3340
|
const validateInput = ({ value, maxLength, errorMessage, required }) => {
|
|
3350
3341
|
if (required && value.trim() === '') {
|
|
@@ -3358,8 +3349,11 @@ const validateInput = ({ value, maxLength, errorMessage, required }) => {
|
|
|
3358
3349
|
|
|
3359
3350
|
var styles$h = {"labelContainer":"index-module__labelContainer___WGyDF","wrapperLabel":"index-module__wrapperLabel___XJzZO","requiredLabel":"index-module__requiredLabel___7oZkh","infoIcon":"index-module__infoIcon___lClx4","errorIcon":"index-module__errorIcon___yN-lq","disabledIcon":"index-module__disabledIcon___89Os7","errorLabel":"index-module__errorLabel___qa6h6","disabledLabel":"index-module__disabledLabel___U9vL8","disabledContainer":"index-module__disabledContainer___MtOvy"};
|
|
3360
3351
|
|
|
3361
|
-
const LabelComponent = ({ children, htmlFor, required = false, tooltip = false, tooltipText, side = 'bottom', align = 'start', className, error = false, disabled = false }) => {
|
|
3362
|
-
const
|
|
3352
|
+
const LabelComponent = ({ children, htmlFor, required = false, tooltip = false, tooltipText, side = 'bottom', align = 'start', className, error = false, disabled = false, scale = 1, }) => {
|
|
3353
|
+
const containerStyle = {
|
|
3354
|
+
'--giro-scale': scale,
|
|
3355
|
+
};
|
|
3356
|
+
const container = (jsxRuntime.jsxs("div", { className: clsx(styles$h.labelContainer, disabled && styles$h.disabledContainer), style: containerStyle, children: [jsxRuntime.jsxs(radixUi.Label.Root, { className: clsx(styles$h.wrapperLabel, error && !disabled && styles$h.errorLabel, disabled && styles$h.disabledLabel, className), htmlFor: htmlFor, children: [children, required && jsxRuntime.jsx("span", { className: styles$h.requiredLabel, children: "*" })] }), tooltip && (jsxRuntime.jsx("span", { className: disabled ? styles$h.disabledIcon : error ?
|
|
3363
3357
|
styles$h.errorIcon : styles$h.infoIcon, children: jsxRuntime.jsx(reactIcons.Info12Regular, {}) }))] }));
|
|
3364
3358
|
if (tooltip) {
|
|
3365
3359
|
return (jsxRuntime.jsx(Tooltip, { side: side, align: align, text: tooltipText || '', children: container }));
|
|
@@ -3367,7 +3361,7 @@ const LabelComponent = ({ children, htmlFor, required = false, tooltip = false,
|
|
|
3367
3361
|
return container;
|
|
3368
3362
|
};
|
|
3369
3363
|
|
|
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) => {
|
|
3364
|
+
const TextField$1 = React.forwardRef(({ className, style, value, label, placeholder, type = 'text', onChange, disabled = false, maxLength, required = false, helperText, tooltip = false, tooltipText, tooltipSide = 'bottom', tooltipAlign = 'start', errorMessage, error, id, icon, scale = 1, onBlur, onFocus, name, persistIcon = false, virtualKeyboard, attachedToVirtualKeyboard, disableAutoComplete = false, ...rest }, ref) => {
|
|
3371
3365
|
const normalizeValue = (val) => {
|
|
3372
3366
|
return val === undefined || val === null ? '' : String(val);
|
|
3373
3367
|
};
|
|
@@ -3427,24 +3421,20 @@ const TextField$1 = React.forwardRef(({ className, value, label, placeholder, ty
|
|
|
3427
3421
|
: helperText
|
|
3428
3422
|
? `${componentId}-helper`
|
|
3429
3423
|
: undefined;
|
|
3430
|
-
const
|
|
3431
|
-
|
|
3432
|
-
1.5: 'scale-1-5',
|
|
3433
|
-
2: 'scale-2-0',
|
|
3434
|
-
}[scale];
|
|
3435
|
-
const containerClass = clsx(styles$i.container, scaleClass, {
|
|
3436
|
-
[styles$i.disabled]: disabled,
|
|
3437
|
-
[styles$i.error]: hasError && !disabled,
|
|
3438
|
-
[styles$i.errorWithMessage]: Boolean(error) && Boolean(errorMessage) && !disabled,
|
|
3424
|
+
const containerStyle = { '--giro-scale': scale };
|
|
3425
|
+
const containerClass = clsx(styles$i.container, {
|
|
3439
3426
|
[styles$i.attachedToVirtualKeyboard]: attachedToVirtualKeyboard,
|
|
3427
|
+
[styles$i.disabled]: disabled,
|
|
3428
|
+
[styles$i.error]: error,
|
|
3429
|
+
[styles$i.errorWithMessage]: !!errorMessage,
|
|
3440
3430
|
[className]: className,
|
|
3441
3431
|
});
|
|
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({
|
|
3432
|
+
return (jsxRuntime.jsxs("div", { className: containerClass, style: { ...containerStyle, ...style }, children: [label && (jsxRuntime.jsx(LabelComponent, { scale: scale, 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({
|
|
3443
3433
|
[styles$i.inputWithIcon]: showCustomIcon || showClearIcon,
|
|
3444
3434
|
}) }), showCustomIcon && jsxRuntime.jsx("span", { className: styles$i.icon, children: icon }), showClearIcon && (jsxRuntime.jsx("button", { type: "button", className: styles$i.clearButton, onMouseDown: (e) => {
|
|
3445
3435
|
e.preventDefault();
|
|
3446
3436
|
handleClear();
|
|
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) => {
|
|
3437
|
+
}, "aria-label": "Limpar campo", tabIndex: -1, children: jsxRuntime.jsx("span", { className: styles$i.clearButtonIcon, 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
3438
|
if (!disabled && (!maxLength || val.length <= maxLength)) {
|
|
3449
3439
|
setInputValue(val);
|
|
3450
3440
|
onChange?.(val);
|
|
@@ -3546,9 +3536,10 @@ function validatePartialDate(value, locale = 'pt-br') {
|
|
|
3546
3536
|
return 'incomplete';
|
|
3547
3537
|
}
|
|
3548
3538
|
|
|
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,
|
|
3539
|
+
const DatePicker = ({ locale = 'pt-br', calendarSide = 'bottom', calendarAlign = 'start', helperText, required = false, label = 'Data', value, defaultValue, onChange, disabled = false, error: externalError, minDate, maxDate, 'data-testid': testId, scale = 1, className, style, ...rest }) => {
|
|
3550
3540
|
const fieldId = React.useId();
|
|
3551
3541
|
const calendarId = `${fieldId}-calendar`;
|
|
3542
|
+
const containerStyle = { '--giro-scale': scale };
|
|
3552
3543
|
const isControlled = value !== undefined;
|
|
3553
3544
|
const [internalDate, setInternalDate] = React.useState(defaultValue || null);
|
|
3554
3545
|
const [tempInputValue, setTempInputValue] = React.useState('');
|
|
@@ -3563,11 +3554,6 @@ const DatePicker = ({ locale = 'pt-br', calendarSide = 'bottom', calendarAlign =
|
|
|
3563
3554
|
const combinedHelperText = externalError && helperText
|
|
3564
3555
|
? `${helperText} • ${externalError}`
|
|
3565
3556
|
: externalError || helperText || '';
|
|
3566
|
-
const scaleClass = {
|
|
3567
|
-
1: 'scale-1-0',
|
|
3568
|
-
1.5: 'scale-1-5',
|
|
3569
|
-
2: 'scale-2-0',
|
|
3570
|
-
}[datePickerScale];
|
|
3571
3557
|
React.useEffect(() => {
|
|
3572
3558
|
function handleClickOutside(event) {
|
|
3573
3559
|
const target = event.target;
|
|
@@ -3680,9 +3666,9 @@ const DatePicker = ({ locale = 'pt-br', calendarSide = 'bottom', calendarAlign =
|
|
|
3680
3666
|
}
|
|
3681
3667
|
}
|
|
3682
3668
|
};
|
|
3683
|
-
return (jsxRuntime.jsx("div", { ref: wrapperRef, className: clsx(styles$g.datePicker,
|
|
3669
|
+
return (jsxRuntime.jsx("div", { ref: wrapperRef, className: clsx(styles$g.datePicker, className), style: { ...containerStyle, ...style }, ...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) => {
|
|
3684
3670
|
handleTextFieldChange(String(e));
|
|
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:
|
|
3671
|
+
}, onKeyDown: handleKeyDown, onFocus: handleFocus, persistIcon: true, autoComplete: "off", value: displayValue, helperText: !externalError ? (helperText || undefined) : undefined, errorMessage: externalError ? combinedHelperText : undefined, error: hasValidationError ? true : undefined, maxLength: 10, required: required, label: label, disabled: disabled, scale: scale, id: fieldId, "data-testid": testId, placeholder: locale === 'en-us' ? 'MM/DD/YYYY' : 'DD/MM/YYYY', "aria-label": "Open calendar", "aria-expanded": showCalendar, "aria-controls": calendarId, "aria-invalid": hasValidationError, "aria-describedby": externalError ? undefined : (helperText ? `${fieldId}-help` : undefined) }), content: 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: scale, id: calendarId, onClear: () => {
|
|
3686
3672
|
handleDateChange(null);
|
|
3687
3673
|
setCurrentDate(new Date());
|
|
3688
3674
|
} }), side: calendarSide, align: calendarAlign, sideOffset: 8 }) }));
|
|
@@ -3776,18 +3762,13 @@ const Combined = ({ buttonText = 'Filtrar', icon, variant = 'outlined', disabled
|
|
|
3776
3762
|
|
|
3777
3763
|
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"};
|
|
3778
3764
|
|
|
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) => {
|
|
3765
|
+
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, style, virtualKeyboard, 'data-testid': testId, ...rest }, ref) => {
|
|
3780
3766
|
const [internalValue, setInternalValue] = React.useState('');
|
|
3781
3767
|
const { internalRef: inputRef, setRefs: setInputRefs } = useInputKeyboardValue(ref);
|
|
3782
3768
|
const isControlled = value !== undefined && onChange !== undefined;
|
|
3783
3769
|
const currentValue = isControlled ? value : internalValue;
|
|
3784
3770
|
const generatedId = React.useId();
|
|
3785
3771
|
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];
|
|
3791
3772
|
const handleChange = (e) => {
|
|
3792
3773
|
if (disabled)
|
|
3793
3774
|
return;
|
|
@@ -3834,7 +3815,7 @@ const Search = React.forwardRef(({ placeholder = 'Dica do que deve ser buscado',
|
|
|
3834
3815
|
}
|
|
3835
3816
|
onKeyDown?.(e);
|
|
3836
3817
|
};
|
|
3837
|
-
return (jsxRuntime.jsxs("div", { className: clsx(styles$c.search,
|
|
3818
|
+
return (jsxRuntime.jsxs("div", { className: clsx(styles$c.search, { [styles$c.disabled]: disabled }, className), style: { '--giro-scale': scale, ...style }, onClick: onClick, onMouseDown: onMouseDown, role: onClick || onMouseDown ? "button" : undefined, tabIndex: onClick || onMouseDown ? 0 : undefined, onKeyDown: onClick || onMouseDown ? (e) => {
|
|
3838
3819
|
if (e.key === 'Enter' || e.key === ' ') {
|
|
3839
3820
|
e.preventDefault();
|
|
3840
3821
|
onClick?.(e);
|
|
@@ -3976,15 +3957,10 @@ var styles$b = {"zds-list-item__container":"ListItem-module__zds-list-item__cont
|
|
|
3976
3957
|
|
|
3977
3958
|
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"};
|
|
3978
3959
|
|
|
3979
|
-
const Radio = ({ items, onValueChange, defaultValue, name, id, ariaLabel, orientation = 'vertical', scale = 1, className, ...rest }) => {
|
|
3960
|
+
const Radio = ({ items, onValueChange, defaultValue, name, id, ariaLabel, orientation = 'vertical', scale = 1, className, style, ...rest }) => {
|
|
3980
3961
|
const generatedId = React.useId();
|
|
3981
3962
|
const componentId = id || generatedId;
|
|
3982
|
-
|
|
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 }) => {
|
|
3963
|
+
return (jsxRuntime.jsx(radixUi.RadioGroup.Root, { id: componentId, className: clsx(styles$a.root, className), style: { '--giro-scale': scale, ...style }, defaultValue: defaultValue, onValueChange: onValueChange, name: name, "aria-label": ariaLabel, "data-orientation": orientation, orientation: orientation, ...rest, children: items.map(({ id, value, disabled, label }) => {
|
|
3988
3964
|
const itemKey = id ?? value;
|
|
3989
3965
|
const uniqueId = `${componentId}-item-${value}`;
|
|
3990
3966
|
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));
|
|
@@ -4205,7 +4181,7 @@ const useSearchLogic = ({ items, searchValue, searchTerm, enableApiSearch, onApi
|
|
|
4205
4181
|
return { filteredItems: filteredItems() };
|
|
4206
4182
|
};
|
|
4207
4183
|
|
|
4208
|
-
const Menu = ({ items, children, onItemSelect, search, enableInfiniteScroll, onScrollEnd, isLoadingMore, onApiSearch, enableApiSearch, selectedItems, onOpenChange, align = 'start',
|
|
4184
|
+
const Menu = ({ items, children, onItemSelect, search, enableInfiniteScroll, onScrollEnd, isLoadingMore, onApiSearch, enableApiSearch, selectedItems, onOpenChange, align = 'start', scale = 1, className, style, maxHeight = 400, ...rest }) => {
|
|
4209
4185
|
const itemsWrapperRef = React.useRef(null);
|
|
4210
4186
|
const hasReachedEndRef = React.useRef(false);
|
|
4211
4187
|
const observerRef = React.useRef(null);
|
|
@@ -4215,14 +4191,10 @@ const Menu = ({ items, children, onItemSelect, search, enableInfiniteScroll, onS
|
|
|
4215
4191
|
const [searchInput, setSearchInput] = React.useState('');
|
|
4216
4192
|
const [searchTerm, setSearchTerm] = React.useState('');
|
|
4217
4193
|
const maxHeightStyle = typeof maxHeight === 'number' ? `${maxHeight}px` : maxHeight;
|
|
4218
|
-
const
|
|
4219
|
-
|
|
4220
|
-
1.5: 'scale-1-5',
|
|
4221
|
-
2: 'scale-2-0',
|
|
4222
|
-
}[dropdownScale];
|
|
4223
|
-
const triggerWithScale = React.isValidElement(children) && buttonScale
|
|
4194
|
+
const containerStyle = { '--giro-scale': scale };
|
|
4195
|
+
const triggerWithScale = React.isValidElement(children)
|
|
4224
4196
|
? React.cloneElement(children, {
|
|
4225
|
-
scale: children.props?.scale ??
|
|
4197
|
+
scale: children.props?.scale ?? scale,
|
|
4226
4198
|
})
|
|
4227
4199
|
: children;
|
|
4228
4200
|
const { open, setOpen, handleItemSelect: handleItemSelectLogic, isItemSelected } = useMenuLogic({
|
|
@@ -4327,7 +4299,7 @@ const Menu = ({ items, children, onItemSelect, search, enableInfiniteScroll, onS
|
|
|
4327
4299
|
hasReachedEndRef.current = false;
|
|
4328
4300
|
}
|
|
4329
4301
|
};
|
|
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,
|
|
4302
|
+
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, className), style: { ...containerStyle, ...style }, sideOffset: 8, align: align, onPointerDown: () => { closedByPointerRef.current = true; }, onInteractOutside: () => { closedByPointerRef.current = true; }, onCloseAutoFocus: (e) => {
|
|
4331
4303
|
if (closedByPointerRef.current) {
|
|
4332
4304
|
e.preventDefault();
|
|
4333
4305
|
closedByPointerRef.current = false;
|
|
@@ -4359,7 +4331,7 @@ const Modal = ({ isOpen = false, onClose, title, children, headerContent, closeO
|
|
|
4359
4331
|
|
|
4360
4332
|
var styles$7 = {"quantity":"Quantity-module__quantity___-vndR","quantityInput":"Quantity-module__quantityInput___xZG-v","disabled":"Quantity-module__disabled___X6p5l"};
|
|
4361
4333
|
|
|
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 }) => {
|
|
4334
|
+
const Quantity = ({ value = 0, onChange, disabled = false, decimal = false, decimalPlaces = 2, size = 'lg', id, valueIncrement = 1, scale = 1, className, style, inputSize, minValue = 0, maxValue = 9999, decrementAriaLabel = 'Decrease quantity', incrementAriaLabel = 'Increase quantity', inputAriaLabel = 'Quantity', ...rest }) => {
|
|
4363
4335
|
const initialValue = Math.min(Math.max(value, minValue), maxValue);
|
|
4364
4336
|
const [internalValue, setInternalValue] = React.useState(initialValue);
|
|
4365
4337
|
const [inputValue, setInputValue] = React.useState(decimal ? initialValue.toFixed(decimalPlaces) : String(initialValue));
|
|
@@ -4538,17 +4510,12 @@ const Quantity = ({ value = 0, onChange, disabled = false, decimal = false, deci
|
|
|
4538
4510
|
const inputSizeValue = inputSize !== undefined ? inputSize : Math.max(1, inputValue.length);
|
|
4539
4511
|
const uniqueId = React.useId();
|
|
4540
4512
|
const inputId = id || uniqueId;
|
|
4541
|
-
|
|
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' })] }));
|
|
4513
|
+
return (jsxRuntime.jsxs("div", { className: clsx(styles$7.quantity, { [styles$7.disabled]: disabled }, className), style: { '--giro-scale': scale, ...style }, ...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', scale: scale }), 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', scale: scale })] }));
|
|
4547
4514
|
};
|
|
4548
4515
|
const memorizedQuantity = React.memo(Quantity);
|
|
4549
4516
|
memorizedQuantity.displayName = 'Quantity';
|
|
4550
4517
|
|
|
4551
|
-
var styles$6 = {"fieldContainer":"Select-module__fieldContainer___zkWSZ","trigger":"Select-module__trigger___xZVUG","disabled":"Select-module__disabled___kkzG-","open":"Select-module__open___bTuTy","error":"Select-module__error___yikGO","hasValue":"Select-module__hasValue___56T9r","triggerText":"Select-module__triggerText___tfXlq","
|
|
4518
|
+
var styles$6 = {"fieldContainer":"Select-module__fieldContainer___zkWSZ","trigger":"Select-module__trigger___xZVUG","disabled":"Select-module__disabled___kkzG-","open":"Select-module__open___bTuTy","error":"Select-module__error___yikGO","hasValue":"Select-module__hasValue___56T9r","triggerText":"Select-module__triggerText___tfXlq","triggerIcon":"Select-module__triggerIcon___Smobj","content":"Select-module__content___Eftze","viewport":"Select-module__viewport___mMGOo","group":"Select-module__group___wErLt","container":"Select-module__container___U1UI1","containerLabel":"Select-module__containerLabel___-5qpN","searchWrapper":"Select-module__searchWrapper___H01Wp","item":"Select-module__item___72Rnu","subTitle":"Select-module__subTitle___FdYBH","checkboxItem":"Select-module__checkboxItem___Ehw-a","checkboxContent":"Select-module__checkboxContent___7eKLC","itemWrapper":"Select-module__itemWrapper___nPovg","title":"Select-module__title___bqW3p","icon":"Select-module__icon___RH27W","itemIndicator":"Select-module__itemIndicator___4DBU-","textContent":"Select-module__textContent___k1SLX","helper":"Select-module__helper___pTp7X","errorMessage":"Select-module__errorMessage___--vrn","noResults":"Select-module__noResults___IxsAN","loadingMore":"Select-module__loadingMore___DjAUE","expandableItemContainer":"Select-module__expandableItemContainer___w4ZIb","chevron":"Select-module__chevron___Kgee3","childrenWrapper":"Select-module__childrenWrapper___2NnS-"};
|
|
4552
4519
|
|
|
4553
4520
|
const CheckboxSelectItem = ({ text, subTitle, disabled, checked, onCheckedChange, value, ...restProps }) => {
|
|
4554
4521
|
const itemRef = React.useRef(null);
|
|
@@ -4857,7 +4824,7 @@ function useSelectLogic({ value, required = false, search = false, onValueChange
|
|
|
4857
4824
|
};
|
|
4858
4825
|
}
|
|
4859
4826
|
|
|
4860
|
-
const Select = ({ items, onValueChange, onOpenChange, variant, required = false, value, label, helperText, placeholder = 'Selecione', maxWidth, search = false, errorMessage, disabled = false,
|
|
4827
|
+
const Select = ({ items, onValueChange, onOpenChange, variant, required = false, value, label, helperText, placeholder = 'Selecione', maxWidth, search = false, errorMessage, disabled = false, className, style, 'aria-label': ariaLabel, 'data-testid': testId, tooltip = false, tooltipText, side = 'bottom', align = 'start', enableInfiniteScroll = false, onScrollEnd, isLoadingMore = false, enableApiSearch = false, onApiSearch, isSearching = false, scale = 1, ...rest }) => {
|
|
4861
4828
|
const componentId = React.useId();
|
|
4862
4829
|
const selectId = `select-${componentId}`;
|
|
4863
4830
|
const viewportRef = React.useRef(null);
|
|
@@ -4904,12 +4871,8 @@ const Select = ({ items, onValueChange, onOpenChange, variant, required = false,
|
|
|
4904
4871
|
}, [items, state.searchTerm, state.searchInput, enableApiSearch, utils]);
|
|
4905
4872
|
const containerStyle = React.useMemo(() => ({
|
|
4906
4873
|
maxWidth: maxWidth ? `${maxWidth}px` : undefined,
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
1: 'scale-1-0',
|
|
4910
|
-
1.5: 'scale-1-5',
|
|
4911
|
-
2: 'scale-2-0',
|
|
4912
|
-
}[scale];
|
|
4874
|
+
'--giro-scale': scale,
|
|
4875
|
+
}), [maxWidth, scale]);
|
|
4913
4876
|
const handleSearchChange = (e) => {
|
|
4914
4877
|
const value = e.target.value;
|
|
4915
4878
|
actions.setSearchInput(value);
|
|
@@ -4942,14 +4905,14 @@ const Select = ({ items, onValueChange, onOpenChange, variant, required = false,
|
|
|
4942
4905
|
onApiSearch('');
|
|
4943
4906
|
}
|
|
4944
4907
|
};
|
|
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,
|
|
4908
|
+
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, ...style }, "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, scale: scale, children: label }), jsxRuntime.jsxs(radixUi.Select.Trigger, { className: clsx(styles$6.trigger, {
|
|
4946
4909
|
[styles$6.error]: state.hasError && state.touched,
|
|
4947
4910
|
[styles$6.disabled]: disabled,
|
|
4948
4911
|
[styles$6.hasValue]: state.selectedValues.length > 0,
|
|
4949
4912
|
[styles$6.open]: state.isOpen,
|
|
4950
|
-
}), id: selectId, "aria-label": ariaLabel, "data-testid": `${testId}-trigger`, children: [variant === 'checkbox' ? (jsxRuntime.jsx("span", { className: styles$6.triggerText, children: displayText })) : (jsxRuntime.jsx(radixUi.Select.Value, { placeholder: placeholder, className: styles$6.placeholder, children: displayText })), state.isOpen ? jsxRuntime.jsx(reactIcons.ChevronUp16Regular, {}) : jsxRuntime.jsx(reactIcons.ChevronDown16Regular, {})] }), !state.isOpen && helperText && !state.hasError && (jsxRuntime.jsx("span", { className: clsx(styles$6.helper, {
|
|
4913
|
+
}), id: selectId, "aria-label": ariaLabel, "data-testid": `${testId}-trigger`, children: [variant === 'checkbox' ? (jsxRuntime.jsx("span", { className: styles$6.triggerText, children: displayText })) : (jsxRuntime.jsx(radixUi.Select.Value, { placeholder: placeholder, className: styles$6.placeholder, children: displayText })), jsxRuntime.jsx("div", { className: styles$6.triggerIcon, children: state.isOpen ? jsxRuntime.jsx(reactIcons.ChevronUp16Regular, {}) : jsxRuntime.jsx(reactIcons.ChevronDown16Regular, {}) })] }), !state.isOpen && helperText && !state.hasError && (jsxRuntime.jsx("span", { className: clsx(styles$6.helper, {
|
|
4951
4914
|
[styles$6.disabled]: disabled
|
|
4952
|
-
}), children: helperText })), state.hasError && state.touched && (jsxRuntime.jsx("span", { className: styles$6.errorMessage, children: errorMessage || 'Campo obrigatório' }))] }) }), jsxRuntime.jsx(radixUi.Select.Portal, { children: jsxRuntime.jsxs(radixUi.Select.Content, { className: styles$6.content, position: "popper", side: "bottom", sideOffset: 8, align: "start", avoidCollisions: true, children: [search && (jsxRuntime.jsx("div", { className: styles$6.searchWrapper, children: jsxRuntime.jsx(Search, { ref: refs.searchInputRef, className: styles$6.search, placeholder: "Buscar", value: state.searchInput, onChange: handleSearchChange, onKeyDown: handleSearchKeyDown, onClear: handleClear, "data-testid": `${testId}-search
|
|
4915
|
+
}), children: helperText })), state.hasError && state.touched && (jsxRuntime.jsx("span", { className: styles$6.errorMessage, children: errorMessage || 'Campo obrigatório' }))] }) }), jsxRuntime.jsx(radixUi.Select.Portal, { children: jsxRuntime.jsxs(radixUi.Select.Content, { className: styles$6.content, style: { '--giro-scale': scale }, position: "popper", side: "bottom", sideOffset: 8, align: "start", avoidCollisions: true, children: [search && (jsxRuntime.jsx("div", { className: styles$6.searchWrapper, children: jsxRuntime.jsx(Search, { ref: refs.searchInputRef, className: styles$6.search, placeholder: "Buscar", value: state.searchInput, onChange: handleSearchChange, onKeyDown: handleSearchKeyDown, onClear: handleClear, "data-testid": `${testId}-search`, scale: scale }) })), jsxRuntime.jsx(radixUi.Select.Viewport, { ref: viewportRef, className: styles$6.viewport, "data-testid": testId ? `${testId}-viewport` : undefined, children: jsxRuntime.jsx(radixUi.Select.Group, { className: styles$6.group, children: filteredItems.length === 0 ? (jsxRuntime.jsx("div", { className: styles$6.noResults, children: "Nenhum resultado encontrado" })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [filteredItems.map((item) => {
|
|
4953
4916
|
const hasChildren = item.children && item.children.length > 0;
|
|
4954
4917
|
if (hasChildren) {
|
|
4955
4918
|
return (jsxRuntime.jsx(ExpandableSelectItem, { item: item, variant: variant, selectedValues: state.selectedValues, onSelect: (value) => {
|
|
@@ -5670,13 +5633,8 @@ ToastContainer.displayName = 'ToastContainer';
|
|
|
5670
5633
|
|
|
5671
5634
|
var styles$1 = {"container":"Switch-module__container___BR1OB","switchRoot":"Switch-module__switchRoot___jz2HD","switchThumb":"Switch-module__switchThumb___X3RL7"};
|
|
5672
5635
|
|
|
5673
|
-
const Switch = ({ disabled = false, defaultChecked = false, checked, onCheckedChange, scale = 1, className, ...rest }) => {
|
|
5674
|
-
|
|
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 }) }) }));
|
|
5636
|
+
const Switch = ({ disabled = false, defaultChecked = false, checked, onCheckedChange, scale = 1, className, style, ...rest }) => {
|
|
5637
|
+
return (jsxRuntime.jsx("div", { className: clsx(styles$1.container, className), style: { '--giro-scale': scale, ...style }, 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
5638
|
};
|
|
5681
5639
|
|
|
5682
5640
|
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"};
|