@giro-ds/react 1.0.3 → 1.0.5
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/components/TextField/TextField.d.ts +2 -2
- package/dist/components/TextField/TextField.types.d.ts +24 -14
- package/dist/components/TextField/__tests__/Textfield.test.d.ts +1 -0
- package/dist/components/TextField/utils/__tests__/validation.test.d.ts +1 -0
- package/dist/components/TextField/utils/index.d.ts +2 -0
- package/dist/components/TextField/utils/validation.d.ts +8 -0
- package/dist/index.cjs +150 -157
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +20 -17
- package/dist/index.esm.js +152 -159
- package/dist/index.esm.js.map +1 -1
- package/dist/shared/Label/index.d.ts +2 -1
- package/dist/styles.css +1 -1
- package/package.json +15 -13
- package/dist/components/TextField/ValidationUtils.d.ts +0 -8
package/dist/index.cjs
CHANGED
|
@@ -720,7 +720,9 @@ function Container({ children }) {
|
|
|
720
720
|
return (jsxRuntime.jsx("main", { className: `${styles$l['container']} mx-auto`, children: children }));
|
|
721
721
|
}
|
|
722
722
|
|
|
723
|
-
var styles$k = {"
|
|
723
|
+
var styles$k = {"wrapperLabel":"index-module__wrapperLabel___XJzZO","requiredLabel":"index-module__requiredLabel___7oZkh","infoIcon":"index-module__infoIcon___lClx4","errorLabel":"index-module__errorLabel___qa6h6","disabledLabel":"index-module__disabledLabel___U9vL8"};
|
|
724
|
+
|
|
725
|
+
var styles$j = {"zds-tooltip__wrapper":"Tooltip-module__zds-tooltip__wrapper___BaLW6","zds-tooltip__content":"Tooltip-module__zds-tooltip__content___E6A4Q","zds-tooltip__top-right":"Tooltip-module__zds-tooltip__top-right___04O6s","zds-tooltip__top-left":"Tooltip-module__zds-tooltip__top-left___EqSvC","zds-tooltip__left":"Tooltip-module__zds-tooltip__left___yxr2G","zds-tooltip__right":"Tooltip-module__zds-tooltip__right___Fq5jm","zds-tooltip__bottom-left":"Tooltip-module__zds-tooltip__bottom-left___aBINN","zds-tooltip__bottom-right":"Tooltip-module__zds-tooltip__bottom-right___yVKMn"};
|
|
724
726
|
|
|
725
727
|
const Tooltip = ({ id, text, children, position = 'top-right' }) => {
|
|
726
728
|
const [visible, setVisible] = React.useState(false);
|
|
@@ -756,85 +758,79 @@ const Tooltip = ({ id, text, children, position = 'top-right' }) => {
|
|
|
756
758
|
}
|
|
757
759
|
};
|
|
758
760
|
}, []);
|
|
759
|
-
const tooltipClass = clsx(styles$
|
|
760
|
-
return (jsxRuntime.jsxs("div", { className: clsx(styles$
|
|
761
|
+
const tooltipClass = clsx(styles$j['zds-tooltip__content'], styles$j[`zds-tooltip__${position}`]);
|
|
762
|
+
return (jsxRuntime.jsxs("div", { className: clsx(styles$j['zds-tooltip__wrapper']), onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onFocus: handleMouseEnter, onBlur: handleMouseLeave, onKeyDown: handleKeyDown, tabIndex: 0, "aria-describedby": visible ? tooltipId : undefined, children: [children, visible && (jsxRuntime.jsx("div", { ref: tooltipRef, className: tooltipClass, role: 'tooltip', id: tooltipId, "aria-describedby": tooltipId, "aria-hidden": !visible, children: text }))] }));
|
|
761
763
|
};
|
|
762
764
|
|
|
763
|
-
|
|
765
|
+
const LabelComponent = ({ children, htmlFor, required = false, tooltip = false, tooltipMessage, tooltipPosition = 'top-left', className, error = false, disabled = false }) => (jsxRuntime.jsx(jsxRuntime.Fragment, { children: tooltip ? (jsxRuntime.jsx(Tooltip, { position: tooltipPosition, text: tooltipMessage || '', children: jsxRuntime.jsxs(radixUi.Label.Root, { className: clsx(styles$k.wrapperLabel, error && styles$k.errorLabel, className), htmlFor: htmlFor, children: [children, required && jsxRuntime.jsx("span", { className: styles$k.requiredLabel, children: "*" }), jsxRuntime.jsx(reactIcons.Info12Regular, { className: styles$k.infoIcon })] }) })) : (jsxRuntime.jsxs(radixUi.Label.Root, { className: clsx(styles$k.wrapperLabel, error && styles$k.errorLabel, disabled && styles$k.disabledLabel, className), htmlFor: htmlFor, children: [children, required && jsxRuntime.jsx("span", { className: styles$k.requiredLabel, children: "*" })] })) }));
|
|
766
|
+
|
|
767
|
+
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","helperText":"TextField-module__helperText___d5QGC","error":"TextField-module__error___IGQzp","disabled":"TextField-module__disabled___roIKP"};
|
|
764
768
|
|
|
765
|
-
const validateInput = ({ value, maxLength,
|
|
766
|
-
if (required &&
|
|
769
|
+
const validateInput = ({ value, maxLength, errorMessage, required }) => {
|
|
770
|
+
if (required && value.trim() === '') {
|
|
767
771
|
return errorMessage || 'Campo obrigatório.';
|
|
768
772
|
}
|
|
769
|
-
if (
|
|
773
|
+
if (maxLength && value.length > maxLength) {
|
|
770
774
|
return errorMessage || `Campo deve ter no máximo ${maxLength} caracteres.`;
|
|
771
775
|
}
|
|
772
776
|
return '';
|
|
773
777
|
};
|
|
774
778
|
|
|
775
|
-
const TextField = ({
|
|
776
|
-
const [inputValue,
|
|
779
|
+
const TextField$1 = React.forwardRef(({ className, value = '', label, placeholder, type = 'text', onChange, disabled = false, maxLength = 30, required = false, helperText, tooltip = false, tooltipText = '', positionTooltip = 'top-right', errorMessage = '', id, icon, onBlur, onFocus, name, ...inputProps }, ref) => {
|
|
780
|
+
const [inputValue, setInputValue] = React.useState(value);
|
|
777
781
|
const [inputError, setInputError] = React.useState('');
|
|
778
|
-
const [
|
|
779
|
-
const
|
|
782
|
+
const [isFocused, setIsFocused] = React.useState(false);
|
|
783
|
+
const generatedId = React.useId();
|
|
784
|
+
const componentId = id || generatedId;
|
|
780
785
|
const handleChange = React.useCallback((e) => {
|
|
781
786
|
const newValue = e.target.value;
|
|
782
787
|
if (!disabled && (!maxLength || newValue.length <= maxLength)) {
|
|
783
|
-
|
|
788
|
+
setInputValue(newValue);
|
|
784
789
|
onChange?.(newValue);
|
|
785
790
|
}
|
|
786
791
|
}, [disabled, maxLength, onChange]);
|
|
787
|
-
const
|
|
792
|
+
const handleClear = React.useCallback(() => {
|
|
788
793
|
if (!disabled) {
|
|
789
|
-
|
|
794
|
+
setInputValue('');
|
|
790
795
|
onChange?.('');
|
|
791
796
|
}
|
|
792
797
|
}, [disabled, onChange]);
|
|
793
|
-
const
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
// Sincroniza errorMessage externo com estado interno
|
|
813
|
-
React.useEffect(() => {
|
|
814
|
-
if (errorMessage) {
|
|
815
|
-
setInputError(errorMessage);
|
|
816
|
-
}
|
|
817
|
-
else if (!errorMessage && inputError && !required) {
|
|
818
|
-
setInputError('');
|
|
819
|
-
}
|
|
820
|
-
}, [errorMessage]);
|
|
821
|
-
const TextFieldClass = clsx(styles$j['zds-textfield__container'], {
|
|
822
|
-
[styles$j['zds-textfield__error']]: inputError,
|
|
823
|
-
[styles$j['zds-textfield__disabled']]: disabled,
|
|
824
|
-
[className]: className,
|
|
825
|
-
});
|
|
826
|
-
const shouldRenderCustomIcon = typeof inputValue === 'string' && inputValue.trim().length === 0;
|
|
827
|
-
const shouldRenderClearIcon = focus && typeof inputValue === 'string' && inputValue.trim().length > 0;
|
|
828
|
-
const helperContent = inputError || (helper && helperText) || '\u00A0';
|
|
798
|
+
const handleBlur = React.useCallback((e) => {
|
|
799
|
+
const error = validateInput({
|
|
800
|
+
value: inputValue,
|
|
801
|
+
maxLength,
|
|
802
|
+
errorMessage,
|
|
803
|
+
required,
|
|
804
|
+
});
|
|
805
|
+
setInputError(error);
|
|
806
|
+
setIsFocused(false);
|
|
807
|
+
onBlur?.(e);
|
|
808
|
+
}, [inputValue, type, maxLength, errorMessage, required, onBlur]);
|
|
809
|
+
const handleFocus = React.useCallback((e) => {
|
|
810
|
+
setIsFocused(true);
|
|
811
|
+
onFocus?.(e);
|
|
812
|
+
}, [onFocus]);
|
|
813
|
+
const showCustomIcon = inputValue.trim().length === 0 && icon;
|
|
814
|
+
const showClearIcon = isFocused && inputValue.trim().length > 0;
|
|
815
|
+
const hasError = Boolean(inputError);
|
|
816
|
+
const displayHelperText = inputError || helperText || '\u00A0';
|
|
829
817
|
const helperId = inputError
|
|
830
818
|
? `${componentId}-error`
|
|
831
|
-
:
|
|
819
|
+
: helperText
|
|
832
820
|
? `${componentId}-helper`
|
|
833
821
|
: undefined;
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
822
|
+
const containerClass = clsx(styles$i.container, {
|
|
823
|
+
[styles$i.error]: hasError,
|
|
824
|
+
[styles$i.disabled]: disabled,
|
|
825
|
+
[className]: className,
|
|
826
|
+
});
|
|
827
|
+
return (jsxRuntime.jsxs("div", { className: containerClass, children: [label && (jsxRuntime.jsx(LabelComponent, { htmlFor: componentId, required: required, tooltip: tooltip, tooltipMessage: tooltipText, tooltipPosition: positionTooltip, 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", { ...inputProps, ref: ref, id: componentId, name: name, type: type, value: inputValue, placeholder: placeholder, onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur, maxLength: maxLength, disabled: disabled, "aria-invalid": hasError, "aria-required": required, "aria-describedby": helperId }), showCustomIcon && jsxRuntime.jsx("span", { className: styles$i.icon, children: icon }), showClearIcon && (jsxRuntime.jsx("button", { type: "button", className: styles$i.clearButton, onMouseDown: (e) => {
|
|
828
|
+
e.preventDefault();
|
|
829
|
+
handleClear();
|
|
830
|
+
}, "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 })] })] }));
|
|
831
|
+
});
|
|
832
|
+
TextField$1.displayName = 'TextField';
|
|
833
|
+
var TextField = React.memo(TextField$1);
|
|
838
834
|
|
|
839
835
|
/**
|
|
840
836
|
* Formata uma data para string conforme o locale.
|
|
@@ -929,7 +925,7 @@ function parseDate(dateString, locale = 'pt-br') {
|
|
|
929
925
|
return date;
|
|
930
926
|
}
|
|
931
927
|
|
|
932
|
-
var styles$
|
|
928
|
+
var styles$h = {"zds-date-picker":"DatePicker-module__zds-date-picker___FjFTb","zds-date-picker__calendar-popup":"DatePicker-module__zds-date-picker__calendar-popup___hEkq7","zds-calendar--left":"DatePicker-module__zds-calendar--left___5z2UM","zds-calendar--right":"DatePicker-module__zds-calendar--right___NCJtd"};
|
|
933
929
|
|
|
934
930
|
const DatePicker = ({ locale = 'pt-br', calendarPosition = 'left', helperText = '', required = false, label = 'Data', value, defaultValue, onChange, disabled = false, error: externalError, minDate, maxDate, className = '', 'data-testid': testId, }) => {
|
|
935
931
|
// ✅ IDs únicos para acessibilidade
|
|
@@ -1111,13 +1107,13 @@ const DatePicker = ({ locale = 'pt-br', calendarPosition = 'left', helperText =
|
|
|
1111
1107
|
setTempInputValue(formatDate(currentSelectedDate, locale));
|
|
1112
1108
|
}
|
|
1113
1109
|
}, [locale, currentSelectedDate, isEditing]);
|
|
1114
|
-
return (jsxRuntime.jsx("div", { ref: wrapperRef, children: jsxRuntime.jsxs("div", { className: clsx(styles$
|
|
1110
|
+
return (jsxRuntime.jsx("div", { ref: wrapperRef, children: jsxRuntime.jsxs("div", { className: clsx(styles$h['zds-date-picker']), children: [jsxRuntime.jsx("div", { onClick: handleFieldClick, onFocus: handleFieldFocus, onKeyDown: handleKeyDown, style: { cursor: 'pointer' }, children: jsxRuntime.jsx(TextField, { type: "tel", icon: jsxRuntime.jsx(reactIcons.Calendar16Regular, { onClick: handleIconClick, style: { cursor: 'pointer' } }), onChange: (e) => {
|
|
1115
1111
|
handleTextFieldChange(String(e));
|
|
1116
|
-
}, "aria-label": "Open calendar", "aria-expanded": showCalendar, "aria-controls": "calendar-popup", placeholder: locale === 'en-us' ? 'MM/DD/YYYY' : 'DD/MM/YYYY', value: displayValue, errorMessage: undefined, "aria-invalid": !!currentError, "aria-describedby": combinedHelperText ? helperTextId : undefined, maxLength: 10, helper: combinedHelperText ? true : false, helperText: combinedHelperText, required: required, label: label }) }), jsxRuntime.jsx("div", { className: clsx(styles$
|
|
1112
|
+
}, "aria-label": "Open calendar", "aria-expanded": showCalendar, "aria-controls": "calendar-popup", placeholder: locale === 'en-us' ? 'MM/DD/YYYY' : 'DD/MM/YYYY', value: displayValue, errorMessage: undefined, "aria-invalid": !!currentError, "aria-describedby": combinedHelperText ? helperTextId : undefined, maxLength: 10, helper: combinedHelperText ? true : false, helperText: combinedHelperText, required: required, label: label }) }), jsxRuntime.jsx("div", { className: clsx(styles$h['zds-date-picker__calendar-popup'], calendarPosition === 'left' && styles$h['zds-calendar--left'], calendarPosition === 'right' && styles$h['zds-calendar--right']), children: showCalendar && (jsxRuntime.jsx(MemoizedCalendar, { selectedDate: currentSelectedDate, currentDate: currentDate, onDateChange: setCurrentDate, onDaySelect: handleDaySelect, locale: locale, format: locale === 'en-us' ? 'mm/dd/yyyy' : 'dd/mm/yyyy' })) })] }) }));
|
|
1117
1113
|
};
|
|
1118
1114
|
var DatePicker_default = React.memo(DatePicker);
|
|
1119
1115
|
|
|
1120
|
-
var styles$
|
|
1116
|
+
var styles$g = {"zds-dialog__overlay":"Dialog-module__zds-dialog__overlay___I0T-Q","zds-dialog__wrapper":"Dialog-module__zds-dialog__wrapper___Va69y","zds-dialog":"Dialog-module__zds-dialog___Bi-9b","zds-dialog__title":"Dialog-module__zds-dialog__title___w9yHe","zds-dialog__text":"Dialog-module__zds-dialog__text___-GmvH","zds-dialog__actions":"Dialog-module__zds-dialog__actions___hHHmN"};
|
|
1121
1117
|
|
|
1122
1118
|
const useFocusTrap = (isActive) => {
|
|
1123
1119
|
const containerRef = React.useRef(null);
|
|
@@ -1200,13 +1196,13 @@ const Dialog = ({ show, title, text, textConfirm = 'OK', textCancel = 'Cancelar'
|
|
|
1200
1196
|
}, [show, handleCancel]);
|
|
1201
1197
|
if (!show)
|
|
1202
1198
|
return null;
|
|
1203
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: styles$
|
|
1199
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: styles$g['zds-dialog__overlay'] }), jsxRuntime.jsx("div", { className: styles$g['zds-dialog__wrapper'], children: jsxRuntime.jsxs("div", { className: clsx(styles$g['zds-dialog'], className), role: "dialog", "aria-modal": "true", id: id, "aria-labelledby": `zds-dialog-title-${id}`, "aria-describedby": `zds-dialog-desc-${id}`, tabIndex: -1, ref: containerRef, children: [jsxRuntime.jsx("div", { id: `zds-dialog-title-${id}`, className: styles$g['zds-dialog__title'], children: title }), jsxRuntime.jsx("div", { id: `zds-dialog-desc-${id}`, className: styles$g['zds-dialog__text'], children: text }), jsxRuntime.jsxs("div", { className: styles$g['zds-dialog__actions'], children: [!!(textCancel && textCancel.trim()) && (jsxRuntime.jsx(Button, { variant: "outlined", onClick: handleCancel, children: textCancel })), jsxRuntime.jsx(Button, { variant: "filled", onClick: handleConfirm, children: textConfirm })] })] }) })] }));
|
|
1204
1200
|
};
|
|
1205
1201
|
// Memoização para otimização de performance
|
|
1206
1202
|
const MemoizedDialog = React.memo(Dialog);
|
|
1207
1203
|
MemoizedDialog.displayName = 'Dialog';
|
|
1208
1204
|
|
|
1209
|
-
var styles$
|
|
1205
|
+
var styles$f = {"zds-custom__drawer-shadow":"Drawer-module__zds-custom__drawer-shadow___xoF-q","zds-custom__drawer-shadow--visible":"Drawer-module__zds-custom__drawer-shadow--visible___9JUdU","zds-custom__drawer-sidebar":"Drawer-module__zds-custom__drawer-sidebar___MC8Zt","zds-custom__drawer-sidebar--open":"Drawer-module__zds-custom__drawer-sidebar--open___DiMJb","zds-custom__drawer-sidebar--disabled":"Drawer-module__zds-custom__drawer-sidebar--disabled___6OGsA","zds-drawer__title-close":"Drawer-module__zds-drawer__title-close___g9K3D","zds-drawer__title":"Drawer-module__zds-drawer__title___lqHFw","zds-drawer__children":"Drawer-module__zds-drawer__children___ZnzF6"};
|
|
1210
1206
|
|
|
1211
1207
|
/**
|
|
1212
1208
|
* Componente Drawer do Zanthus Design System
|
|
@@ -1288,18 +1284,18 @@ onClose, title = 'Título', isOpen = false, onOpen, className = '', id, disabled
|
|
|
1288
1284
|
event.stopPropagation();
|
|
1289
1285
|
internalClose();
|
|
1290
1286
|
};
|
|
1291
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: clsx(styles$
|
|
1292
|
-
[styles$
|
|
1293
|
-
}), onClick: handleOverlayClick, role: "presentation", "aria-hidden": "true", "data-testid": "drawer-overlay" }), jsxRuntime.jsxs("div", { className: clsx(styles$
|
|
1294
|
-
[styles$
|
|
1295
|
-
[styles$
|
|
1287
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: clsx(styles$f['zds-custom__drawer-shadow'], {
|
|
1288
|
+
[styles$f['zds-custom__drawer-shadow--visible']]: isOpen,
|
|
1289
|
+
}), onClick: handleOverlayClick, role: "presentation", "aria-hidden": "true", "data-testid": "drawer-overlay" }), jsxRuntime.jsxs("div", { className: clsx(styles$f['zds-custom__drawer-sidebar'], {
|
|
1290
|
+
[styles$f['zds-custom__drawer-sidebar--open']]: isOpen,
|
|
1291
|
+
[styles$f['zds-custom__drawer-sidebar--disabled']]: disabled,
|
|
1296
1292
|
}, className), style: {
|
|
1297
1293
|
// ✅ APENAS: Width customizável via CSS custom property
|
|
1298
1294
|
'--drawer-custom-width': customWidth,
|
|
1299
|
-
}, onClick: handleDrawerClick, role: "dialog", "aria-modal": "true", "aria-labelledby": id ? `${id}-title` : 'drawer-title', "aria-hidden": !isOpen, "data-testid": "drawer-panel", id: id, children: [jsxRuntime.jsxs("div", { className: clsx(styles$
|
|
1295
|
+
}, onClick: handleDrawerClick, role: "dialog", "aria-modal": "true", "aria-labelledby": id ? `${id}-title` : 'drawer-title', "aria-hidden": !isOpen, "data-testid": "drawer-panel", id: id, children: [jsxRuntime.jsxs("div", { className: clsx(styles$f['zds-drawer__title-close']), children: [jsxRuntime.jsx("div", { className: clsx(styles$f['zds-drawer__title']), id: id ? `${id}-title` : 'drawer-title', children: title }), jsxRuntime.jsx(Button, { onClick: handleCloseClick, variant: 'text', iconOnly: true, icon: jsxRuntime.jsx(reactIcons.Dismiss16Regular, {}), size: 'lg' })] }), jsxRuntime.jsx("div", { className: clsx(styles$f['zds-drawer__children']), "data-testid": "drawer-content", children: children })] })] }));
|
|
1300
1296
|
};
|
|
1301
1297
|
|
|
1302
|
-
var styles$
|
|
1298
|
+
var styles$e = {"zds-search":"Search-module__zds-search___DRIVl","zds-search__leftIcon":"Search-module__zds-search__leftIcon___gBvTI","zds-search__clearIcon":"Search-module__zds-search__clearIcon___wsOBs"};
|
|
1303
1299
|
|
|
1304
1300
|
const Search = React.forwardRef(({ placeholder = 'Dica do que deve ser buscado', disabled = false, value, onChange, onKeyDown, onFocus, onBlur, onClear, onClick, onMouseDown, id = '', className = '', }, ref) => {
|
|
1305
1301
|
const [internalValue, setInternalValue] = React.useState('');
|
|
@@ -1346,11 +1342,11 @@ const Search = React.forwardRef(({ placeholder = 'Dica do que deve ser buscado',
|
|
|
1346
1342
|
return;
|
|
1347
1343
|
onKeyDown?.(e);
|
|
1348
1344
|
};
|
|
1349
|
-
const searchClass = clsx(styles$
|
|
1345
|
+
const searchClass = clsx(styles$e['zds-search'], {
|
|
1350
1346
|
disabled,
|
|
1351
1347
|
[className]: className,
|
|
1352
1348
|
});
|
|
1353
|
-
return (jsxRuntime.jsxs("div", { className: searchClass, onClick: onClick, onMouseDown: onMouseDown, children: [jsxRuntime.jsx("span", { className: clsx(styles$
|
|
1349
|
+
return (jsxRuntime.jsxs("div", { className: searchClass, onClick: onClick, onMouseDown: onMouseDown, children: [jsxRuntime.jsx("span", { className: clsx(styles$e['zds-search__leftIcon'], { disabled }), tabIndex: -1, role: "presentation", "aria-hidden": "true", children: jsxRuntime.jsx(reactIcons.Search16Regular, {}) }), jsxRuntime.jsx("input", { ref: ref, id: inputId, type: "text", placeholder: placeholder, "aria-label": placeholder, value: currentValue || '', onChange: handleChange, onKeyDown: handleKeyDown, disabled: disabled, onFocus: handleFocus, onBlur: handleBlur }), currentValue && currentValue.length > 0 && (jsxRuntime.jsx("span", { className: styles$e['zds-search__clearIcon'], "aria-hidden": "true", onClick: clearInputSearch, children: jsxRuntime.jsx(reactIcons.Dismiss16Regular, {}) }))] }));
|
|
1354
1350
|
});
|
|
1355
1351
|
Search.displayName = 'ZdsSearch';
|
|
1356
1352
|
|
|
@@ -1385,7 +1381,7 @@ const validateItems = (items, type) => {
|
|
|
1385
1381
|
});
|
|
1386
1382
|
};
|
|
1387
1383
|
|
|
1388
|
-
var styles$
|
|
1384
|
+
var styles$d = {"zds-dropdown__container":"Dropdown-module__zds-dropdown__container___UMV5O","zds-dropdown__container--top":"Dropdown-module__zds-dropdown__container--top___nys1y","zds-dropdown__container--bottom":"Dropdown-module__zds-dropdown__container--bottom___5ncXH","zds-dropdown__search-container":"Dropdown-module__zds-dropdown__search-container___5igq1","zds-dropdown__item":"Dropdown-module__zds-dropdown__item___bqAnI","zds-dropdown--disabled":"Dropdown-module__zds-dropdown--disabled___WF-ao","zds-dropdown__item--focused":"Dropdown-module__zds-dropdown__item--focused___ulKda","zds-dropdown__item--selected":"Dropdown-module__zds-dropdown__item--selected___K-Mk-","zds-dropdown__title":"Dropdown-module__zds-dropdown__title___emxcQ","zds-dropdown__subtext":"Dropdown-module__zds-dropdown__subtext___YzXrw","zds-dropdown__item-content":"Dropdown-module__zds-dropdown__item-content___E3qkd","zds-dropdown__item-content--disabled":"Dropdown-module__zds-dropdown__item-content--disabled___RmhHd","zds-dropdown__item-text":"Dropdown-module__zds-dropdown__item-text___D39Qy","zds-dropdown__item-icon":"Dropdown-module__zds-dropdown__item-icon___QdCJz","zds-dropdown__item-icon-container":"Dropdown-module__zds-dropdown__item-icon-container___ULMHu","zds-dropdown__no-results":"Dropdown-module__zds-dropdown__no-results___rUZ-Z","zds-dropdown__list":"Dropdown-module__zds-dropdown__list___d65nL","zds-checkbox":"Dropdown-module__zds-checkbox___rJTmR","zds-dropdown__item--checkbox":"Dropdown-module__zds-dropdown__item--checkbox___z94nE","zds-dropdown__container-filter":"Dropdown-module__zds-dropdown__container-filter___Deixf","zds-dropdown__infinite-scroll-trigger":"Dropdown-module__zds-dropdown__infinite-scroll-trigger___RA9Gd","zds-dropdown__loading-indicator":"Dropdown-module__zds-dropdown__loading-indicator___Zf-uW"};
|
|
1389
1385
|
|
|
1390
1386
|
/**
|
|
1391
1387
|
* Hook otimizado para scroll infinito usando IntersectionObserver
|
|
@@ -1650,17 +1646,17 @@ const Dropdown = ({ className, items = [], id, type = 'text', applySearch = fals
|
|
|
1650
1646
|
const renderItemContent = React.useCallback((item, index) => {
|
|
1651
1647
|
const itemId = item.id || `dropdown-item-${index}`;
|
|
1652
1648
|
const currentSelection = filter ? tempSelectedItems : selectedItems;
|
|
1653
|
-
return (jsxRuntime.jsxs("div", { className: clsx(styles$
|
|
1654
|
-
[styles$
|
|
1649
|
+
return (jsxRuntime.jsxs("div", { className: clsx(styles$d['zds-dropdown__item-content'], {
|
|
1650
|
+
[styles$d['zds-dropdown__item-content--disabled']]: item.disabled,
|
|
1655
1651
|
}), children: [type === 'checkbox' && (jsxRuntime.jsx(MemoizedCheckbox, { checked: currentSelection[itemId], onChange: (event) => {
|
|
1656
1652
|
event.preventDefault();
|
|
1657
1653
|
event.stopPropagation();
|
|
1658
1654
|
toggleSelection(itemId, item);
|
|
1659
|
-
}, disabled: item.disabled, label: "" })), type === 'icon' && item.icon && (jsxRuntime.jsx("div", { className: styles$
|
|
1655
|
+
}, disabled: item.disabled, label: "" })), type === 'icon' && item.icon && (jsxRuntime.jsx("div", { className: styles$d['zds-dropdown__item-icon-container'], children: jsxRuntime.jsx("span", { className: styles$d['zds-dropdown__item-icon'], onClick: (event) => {
|
|
1660
1656
|
event.preventDefault();
|
|
1661
1657
|
event.stopPropagation();
|
|
1662
1658
|
handleItemClick(event, itemId, item);
|
|
1663
|
-
}, children: item.icon }) })), jsxRuntime.jsxs("div", { className: styles$
|
|
1659
|
+
}, children: item.icon }) })), jsxRuntime.jsxs("div", { className: styles$d['zds-dropdown__item-text'], children: [jsxRuntime.jsx("span", { id: `dropdown-item-${itemId}-label`, className: styles$d['zds-dropdown__title'], children: item.text }), showSubText && item.subText && (jsxRuntime.jsx("span", { id: `dropdown-item-${itemId}-desc`, className: styles$d['zds-dropdown__subtext'], children: item.subText }))] })] }));
|
|
1664
1660
|
}, [
|
|
1665
1661
|
type,
|
|
1666
1662
|
selectedItems,
|
|
@@ -1725,10 +1721,10 @@ const Dropdown = ({ className, items = [], id, type = 'text', applySearch = fals
|
|
|
1725
1721
|
isSearchFocused,
|
|
1726
1722
|
handleSearchClear,
|
|
1727
1723
|
]);
|
|
1728
|
-
const DropdownClass = clsx(styles$
|
|
1724
|
+
const DropdownClass = clsx(styles$d['zds-dropdown__container'], styles$d[`zds-dropdown__container--${position}`], {
|
|
1729
1725
|
[className || '']: className,
|
|
1730
|
-
[styles$
|
|
1731
|
-
[styles$
|
|
1726
|
+
[styles$d['zds-dropdown__container--search-active']]: searchQuery.length > 0,
|
|
1727
|
+
[styles$d['zds-dropdown__container--fixed-width']]: !!maxWidth,
|
|
1732
1728
|
});
|
|
1733
1729
|
const dropdownStyles = React.useMemo(() => {
|
|
1734
1730
|
const styles = {};
|
|
@@ -1750,14 +1746,14 @@ const Dropdown = ({ className, items = [], id, type = 'text', applySearch = fals
|
|
|
1750
1746
|
}
|
|
1751
1747
|
return styles;
|
|
1752
1748
|
}, [maxWidth, minWidth, width, maxHeight]);
|
|
1753
|
-
return (jsxRuntime.jsx("div", { ref: containerRef, className: DropdownClass, tabIndex: 0, role: "combobox", "aria-expanded": filteredItems.length > 0 ? 'true' : 'false', "aria-haspopup": "listbox", "aria-owns": id ? `${id}-listbox` : undefined, "aria-controls": id ? `${id}-listbox` : undefined, "aria-activedescendant": focusedIndex >= 0 ? `${id}-option-${focusedIndex}` : undefined, "aria-label": "Dropdown de sele\u00E7\u00E3o", "aria-describedby": searchVisible ? `${id}-search-help` : undefined, onKeyDown: handleKeyDown, style: dropdownStyles, children: jsxRuntime.jsxs("ul", { className: styles$
|
|
1749
|
+
return (jsxRuntime.jsx("div", { ref: containerRef, className: DropdownClass, tabIndex: 0, role: "combobox", "aria-expanded": filteredItems.length > 0 ? 'true' : 'false', "aria-haspopup": "listbox", "aria-owns": id ? `${id}-listbox` : undefined, "aria-controls": id ? `${id}-listbox` : undefined, "aria-activedescendant": focusedIndex >= 0 ? `${id}-option-${focusedIndex}` : undefined, "aria-label": "Dropdown de sele\u00E7\u00E3o", "aria-describedby": searchVisible ? `${id}-search-help` : undefined, onKeyDown: handleKeyDown, style: dropdownStyles, children: jsxRuntime.jsxs("ul", { className: styles$d['zds-dropdown__list'], id: id || undefined, role: "listbox", "aria-label": "Lista de op\u00E7\u00F5es", "aria-multiselectable": isMultiSelectable, children: [searchVisible && (jsxRuntime.jsx("li", { role: "none", className: styles$d['zds-dropdown__search-container'], children: jsxRuntime.jsx(Search, { value: inputValue, placeholder: placeholder || 'Digite e pressione Enter para buscar...', onChange: handleSearchChange, onKeyDown: handleSearchKeyDown, onFocus: () => setIsSearchFocused(true), onBlur: () => setIsSearchFocused(false), onClear: handleSearchClear, "aria-label": "Campo de busca - pressione Enter para pesquisar" }) })), filteredItems.length > 0 ? (filteredItems.map((item, index) => {
|
|
1754
1750
|
const itemId = generateItemId(item, index);
|
|
1755
1751
|
const currentSelection = filter ? tempSelectedItems : selectedItems;
|
|
1756
|
-
return (jsxRuntime.jsx("li", { role: "option", "aria-selected": !!currentSelection[itemId], "aria-labelledby": `dropdown-item-${itemId}-label`, "aria-describedby": item.subText ? `dropdown-item-${itemId}-desc` : undefined, className: clsx(styles$
|
|
1757
|
-
[styles$
|
|
1758
|
-
[styles$
|
|
1759
|
-
[styles$
|
|
1760
|
-
[styles$
|
|
1752
|
+
return (jsxRuntime.jsx("li", { role: "option", "aria-selected": !!currentSelection[itemId], "aria-labelledby": `dropdown-item-${itemId}-label`, "aria-describedby": item.subText ? `dropdown-item-${itemId}-desc` : undefined, className: clsx(styles$d['zds-dropdown__item'], {
|
|
1753
|
+
[styles$d[`zds-dropdown__item--${type}`]]: type,
|
|
1754
|
+
[styles$d['zds-dropdown__item--selected']]: currentSelection[itemId],
|
|
1755
|
+
[styles$d['zds-dropdown__item--focused']]: focusedIndex === index,
|
|
1756
|
+
[styles$d['zds-dropdown__item--disabled']]: item.disabled,
|
|
1761
1757
|
}), tabIndex: focusedIndex === index ? 0 : -1, onFocus: () => setFocusedIndex(index), onClick: (event) => {
|
|
1762
1758
|
event.stopPropagation();
|
|
1763
1759
|
handleItemClick(event, itemId, item);
|
|
@@ -1767,12 +1763,12 @@ const Dropdown = ({ className, items = [], id, type = 'text', applySearch = fals
|
|
|
1767
1763
|
setFocusedIndex(index);
|
|
1768
1764
|
}
|
|
1769
1765
|
}, children: renderItemContent(item, index) }, itemId));
|
|
1770
|
-
})) : (jsxRuntime.jsx("li", { className: styles$
|
|
1766
|
+
})) : (jsxRuntime.jsx("li", { className: styles$d['zds-dropdown__no-results'], role: "status", "aria-live": "polite", children: "Nenhum item corresponde \u00E0 sua busca" })), filter && (jsxRuntime.jsxs("div", { className: styles$d['zds-dropdown__container-filter'], children: [jsxRuntime.jsx(Button, { size: "sm", variant: "outlined", onClick: handleClearFilter, children: "Limpar" }), jsxRuntime.jsx(Button, { size: "sm", onClick: handleApplyFilter, children: "Aplicar" })] })), infiniteScrollHook && infiniteScrollHook.hasNextPage && (jsxRuntime.jsx("li", { role: "none", className: styles$d['zds-dropdown__infinite-scroll-trigger'], children: jsxRuntime.jsx("div", { ref: infiniteScrollHook.observerRef, className: styles$d['zds-dropdown__loading-indicator'], children: infiniteScroll?.status === 'loading' ? (jsxRuntime.jsx("span", { children: "Carregando..." })) : (jsxRuntime.jsx("span", { children: "Trigger" })) }) }))] }) }));
|
|
1771
1767
|
};
|
|
1772
1768
|
const MemoizedDropdown = React.memo(Dropdown);
|
|
1773
1769
|
MemoizedDropdown.displayName = 'Dropdown';
|
|
1774
1770
|
|
|
1775
|
-
var styles$
|
|
1771
|
+
var styles$c = {"zds-filter__container":"Filter-module__zds-filter__container___0E-nC","zds-filter__button":"Filter-module__zds-filter__button___gT9yM","zds-filter__icon":"Filter-module__zds-filter__icon___ypiCu","zds-filter__text":"Filter-module__zds-filter__text___1iywL","zds-filter__arrow":"Filter-module__zds-filter__arrow___xflU2","zds-filter__arrow--up":"Filter-module__zds-filter__arrow--up___R0HR-","zds-filter__arrow--down":"Filter-module__zds-filter__arrow--down___4YMmg","zds-filter__button--open":"Filter-module__zds-filter__button--open___OA6EF","zds-filter__dropdown":"Filter-module__zds-filter__dropdown___-67MJ","zds-filter__dropdown--left":"Filter-module__zds-filter__dropdown--left___GgonW","zds-filter__dropdown--right":"Filter-module__zds-filter__dropdown--right___7GS9L","zds-filter-button__content":"Filter-module__zds-filter-button__content___eNIIz","zds-filter-button__arrow":"Filter-module__zds-filter-button__arrow___ZhymS","zds-filter-button__icon":"Filter-module__zds-filter-button__icon___-42Ey"};
|
|
1776
1772
|
|
|
1777
1773
|
// ✅ CORREÇÃO: Problema de loop infinito no useEffect
|
|
1778
1774
|
const Filter = ({ items = [], type = 'checkbox', selectedIds = [], onApplyFilter, placeholder = 'Selecionar...', enableSearch = false, buttonText = 'Filter', icon, variant = 'outlined', onOpen, onClose, position = 'left', disabled = false, className = '', selectedDate, onDateSelect, onClearDate, minDate, maxDate, locale = 'pt-br', }) => {
|
|
@@ -1857,14 +1853,14 @@ const Filter = ({ items = [], type = 'checkbox', selectedIds = [], onApplyFilter
|
|
|
1857
1853
|
}
|
|
1858
1854
|
return () => document.removeEventListener('keydown', handleEscape);
|
|
1859
1855
|
}, [isOpen, onClose]);
|
|
1860
|
-
const filterClass = clsx(styles$
|
|
1861
|
-
const dropdownClass = clsx(styles$
|
|
1862
|
-
[styles$
|
|
1856
|
+
const filterClass = clsx(styles$c['zds-filter__container'], className);
|
|
1857
|
+
const dropdownClass = clsx(styles$c['zds-filter__dropdown'], {
|
|
1858
|
+
[styles$c[`zds-filter__dropdown--${position}`]]: position,
|
|
1863
1859
|
});
|
|
1864
|
-
return (jsxRuntime.jsxs("div", { ref: filterRef, className: filterClass, children: [jsxRuntime.jsx(Button, { variant: variant, onClick: handleToggle, disabled: disabled, icon: type === 'calendar' ? jsxRuntime.jsx(reactIcons.Calendar16Regular, {}) : jsxRuntime.jsx(reactIcons.ChevronDownRegular, {}), iconPosition: "right", size: "lg", children: jsxRuntime.jsxs("div", { className: styles$
|
|
1860
|
+
return (jsxRuntime.jsxs("div", { ref: filterRef, className: filterClass, children: [jsxRuntime.jsx(Button, { variant: variant, onClick: handleToggle, disabled: disabled, icon: type === 'calendar' ? jsxRuntime.jsx(reactIcons.Calendar16Regular, {}) : jsxRuntime.jsx(reactIcons.ChevronDownRegular, {}), iconPosition: "right", size: "lg", children: jsxRuntime.jsxs("div", { className: styles$c['zds-filter-button__content'], children: [icon && jsxRuntime.jsx("span", { className: styles$c['zds-filter-button__icon'], children: icon }), jsxRuntime.jsx("span", { className: styles$c['zds-filter-button__text'], children: buttonDisplayText }), jsxRuntime.jsx("span", { className: `${styles$c['zds-filter-button__arrow']} ${isOpen ? styles$c['zds-filter-button__arrow--open'] : ''}`, children: getBadgeValue() && (jsxRuntime.jsx(Badge, { badgeValue: `+${getBadgeValue()}`, type: "status" })) })] }) }), isOpen && (jsxRuntime.jsx("div", { className: dropdownClass, children: type === 'calendar' ? (jsxRuntime.jsx(MemoizedCalendar, { currentDate: currentCalendarDate, selectedDate: selectedDate, onDaySelect: handleDateSelection, onDateChange: handleCalendarNavigation, minDate: minDate, maxDate: maxDate, locale: locale, onClear: handleClear, id: `filter-calendar-${filterRef.current?.id || ''}`, "aria-label": "Selecionar data para filtro" })) : (jsxRuntime.jsx(MemoizedDropdown, { items: items, type: type, defaultSelectedIds: selectedIds, placeholder: placeholder, applySearch: enableSearch, filter: true, onSelectionChange: handleApplyFilter })) }))] }));
|
|
1865
1861
|
};
|
|
1866
1862
|
|
|
1867
|
-
var styles$
|
|
1863
|
+
var styles$b = {"zds-radiobutton":"Radio-module__zds-radiobutton___b7a-O","zds-radiobutton__box-check":"Radio-module__zds-radiobutton__box-check___nJoyz","zds-radiobutton__box-check__text":"Radio-module__zds-radiobutton__box-check__text___xk4xV","zds-radiobutton__mini-box":"Radio-module__zds-radiobutton__mini-box___o0vCx","zds-radiobutton__disabled":"Radio-module__zds-radiobutton__disabled___rU5Yf"};
|
|
1868
1864
|
|
|
1869
1865
|
/**
|
|
1870
1866
|
* Componente Radio para seleção única em grupos
|
|
@@ -1880,18 +1876,18 @@ const Radio = ({ name = 'radiobutton', value = '', id, checked = false, classNam
|
|
|
1880
1876
|
return;
|
|
1881
1877
|
onChange?.(e.target.value);
|
|
1882
1878
|
};
|
|
1883
|
-
const radioClass = clsx(styles$
|
|
1884
|
-
[styles$
|
|
1879
|
+
const radioClass = clsx(styles$b['zds-radiobutton'], {
|
|
1880
|
+
[styles$b['zds-radiobutton--disabled']]: disabled,
|
|
1885
1881
|
}, className);
|
|
1886
|
-
const labelClass = clsx(styles$
|
|
1887
|
-
[styles$
|
|
1882
|
+
const labelClass = clsx(styles$b['zds-radiobutton__box-check'], {
|
|
1883
|
+
[styles$b['zds-radiobutton__disabled']]: disabled,
|
|
1888
1884
|
});
|
|
1889
|
-
return (jsxRuntime.jsx("div", { className: radioClass, children: jsxRuntime.jsxs("label", { className: labelClass, htmlFor: inputId, children: [jsxRuntime.jsx("div", { className: styles$
|
|
1885
|
+
return (jsxRuntime.jsx("div", { className: radioClass, children: jsxRuntime.jsxs("label", { className: labelClass, htmlFor: inputId, children: [jsxRuntime.jsx("div", { className: styles$b['zds-radiobutton__mini-box'], children: jsxRuntime.jsx("input", { id: inputId, type: "radio", name: name, value: value, checked: checked, disabled: disabled, onChange: handleChange }) }), label && (jsxRuntime.jsx("span", { id: `${inputId}-description`, className: styles$b['zds-radiobutton__box-check__text'], children: label }))] }) }));
|
|
1890
1886
|
};
|
|
1891
1887
|
const MemoizedRadio = React.memo(Radio);
|
|
1892
1888
|
MemoizedRadio.displayName = 'Radio';
|
|
1893
1889
|
|
|
1894
|
-
var styles$
|
|
1890
|
+
var styles$a = {"zds-list-item__container":"ListItem-module__zds-list-item__container___mEIUK","zds-list-item--checkbox":"ListItem-module__zds-list-item--checkbox___wfi9-","zds-list-item--icon":"ListItem-module__zds-list-item--icon___h3Ijt","zds-list-item--radio":"ListItem-module__zds-list-item--radio___2l7mK","zds-list-item--text":"ListItem-module__zds-list-item--text___F0PDx","zds-list-item--hovered":"ListItem-module__zds-list-item--hovered___XrDWn","zds-list-item--disabled":"ListItem-module__zds-list-item--disabled___p1xZF","zds-list-item__wrapper-text":"ListItem-module__zds-list-item__wrapper-text___5-TX2","zds-list-item__wrapper-icon":"ListItem-module__zds-list-item__wrapper-icon___S6Fr1","zds-list-item__title":"ListItem-module__zds-list-item__title___AV7nz","zds-list-item__subtext":"ListItem-module__zds-list-item__subtext___nfXky","zds-list-item__text":"ListItem-module__zds-list-item__text___3y0sB"};
|
|
1895
1891
|
|
|
1896
1892
|
/**
|
|
1897
1893
|
* Componente ListItem do Zanthus Design System
|
|
@@ -1976,20 +1972,20 @@ const ListItem = ({ id, className, variant = 'text', text = '', name = '', subTe
|
|
|
1976
1972
|
const currentVariant = validVariants.includes(variant) ? variant : 'text';
|
|
1977
1973
|
switch (currentVariant) {
|
|
1978
1974
|
case 'checkbox':
|
|
1979
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(MemoizedCheckbox, { name: name, checked: internalChecked, disabled: disabled, label: "", onChange: () => handleCheckboxClick({}), value: value }), jsxRuntime.jsxs("div", { className: styles$
|
|
1975
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(MemoizedCheckbox, { name: name, checked: internalChecked, disabled: disabled, label: "", onChange: () => handleCheckboxClick({}), value: value }), jsxRuntime.jsxs("div", { className: styles$a['zds-list-item__wrapper-text'], children: [jsxRuntime.jsx("span", { id: `${itemId}-text`, className: styles$a['zds-list-item__text'], onClick: handleCheckboxClick, children: text }), showSubText && subText && (jsxRuntime.jsx("span", { id: `${itemId}-subtext`, className: styles$a['zds-list-item__subtext'], onClick: handleCheckboxClick, children: subText }))] })] }));
|
|
1980
1976
|
case 'radio':
|
|
1981
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: styles$
|
|
1977
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: styles$a['zds-list-item__wrapper-radio'], children: jsxRuntime.jsx("span", { className: styles$a['zds-list-item__radio'], "aria-hidden": "true", children: jsxRuntime.jsx(MemoizedRadio, { name: name, checked: internalChecked, disabled: disabled, onChange: () => handleRadioClick({}), value: value, "aria-labelledby": `${itemId}-text` }) }) }), jsxRuntime.jsxs("div", { className: styles$a['zds-list-item__wrapper-text'], children: [jsxRuntime.jsx("span", { id: `${itemId}-text`, className: styles$a['zds-list-item__title'], onClick: handleRadioClick, children: text }), showSubText && subText && (jsxRuntime.jsx("span", { id: `${itemId}-subtext`, className: styles$a['zds-list-item__subtext'], children: subText }))] })] }));
|
|
1982
1978
|
case 'icon':
|
|
1983
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: styles$
|
|
1979
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: styles$a['zds-list-item__wrapper-icon'], children: icon }), jsxRuntime.jsxs("div", { className: styles$a['zds-list-item__wrapper-text'], children: [jsxRuntime.jsx("span", { id: `${itemId}-text`, className: styles$a['zds-list-item__title'], onClick: handleTextOrIconClick, children: text }), showSubText && subText && (jsxRuntime.jsx("span", { id: `${itemId}-subtext`, className: styles$a['zds-list-item__subtext'], children: subText }))] })] }));
|
|
1984
1980
|
case 'text':
|
|
1985
1981
|
default:
|
|
1986
|
-
return (jsxRuntime.jsxs("div", { className: styles$
|
|
1982
|
+
return (jsxRuntime.jsxs("div", { className: styles$a['zds-list-item__wrapper-text'], children: [jsxRuntime.jsx("span", { id: `${itemId}-text`, className: styles$a['zds-list-item__title'], onClick: handleTextOrIconClick, children: text }), showSubText && subText && (jsxRuntime.jsx("span", { id: `${itemId}-subtext`, className: styles$a['zds-list-item__subtext'], children: subText }))] }));
|
|
1987
1983
|
}
|
|
1988
1984
|
}, [variant, itemId, internalChecked, disabled, handleCheckboxClick, handleRadioClick, handleTextOrIconClick, value, text, showSubText, subText, icon, name]);
|
|
1989
|
-
const listItemClass = clsx(styles$
|
|
1990
|
-
[styles$
|
|
1991
|
-
[styles$
|
|
1992
|
-
[styles$
|
|
1985
|
+
const listItemClass = clsx(styles$a['zds-list-item__container'], {
|
|
1986
|
+
[styles$a[`zds-list-item--${variant}`]]: variant,
|
|
1987
|
+
[styles$a['zds-list-item--disabled']]: disabled,
|
|
1988
|
+
[styles$a['zds-list-item--hovered']]: hovered,
|
|
1993
1989
|
[className || '']: className
|
|
1994
1990
|
});
|
|
1995
1991
|
const getAriaChecked = React.useCallback(() => {
|
|
@@ -2001,7 +1997,7 @@ const ListItem = ({ id, className, variant = 'text', text = '', name = '', subTe
|
|
|
2001
1997
|
return (jsxRuntime.jsx("li", { className: listItemClass, tabIndex: disabled ? -1 : 0, onKeyDown: handleKeyDown, "aria-selected": variant === 'text' || variant === 'icon' ? internalSelected : undefined, "aria-disabled": disabled, "aria-checked": getAriaChecked(), "aria-labelledby": `${itemId}-text`, "aria-describedby": showSubText && subText ? `${itemId}-subtext` : undefined, "data-testid": "list-item", children: renderVariantContent() }));
|
|
2002
1998
|
};
|
|
2003
1999
|
|
|
2004
|
-
var styles$
|
|
2000
|
+
var styles$9 = {"zds-menu__container":"Menu-module__zds-menu__container___BVQ87","zds-search":"Menu-module__zds-search___grixQ","zds-menu__dropdown":"Menu-module__zds-menu__dropdown___rnrrj","zds-menu__dropdown--left":"Menu-module__zds-menu__dropdown--left___1z4dD","zds-menu__dropdown--right":"Menu-module__zds-menu__dropdown--right___A0Mdg"};
|
|
2005
2001
|
|
|
2006
2002
|
const Menu = ({ children, menuItems = [], onMenuItemClick, onToggle, type = 'text', applySearch = false, placeholder = '', showSubText = false, className, id, maxWidth = '210px', minWidth, position = 'left' }) => {
|
|
2007
2003
|
const [isMenuOpen, setIsMenuOpen] = React.useState(false);
|
|
@@ -2141,12 +2137,12 @@ const Menu = ({ children, menuItems = [], onMenuItemClick, onToggle, type = 'tex
|
|
|
2141
2137
|
'aria-controls': isMenuOpen ? dropdownId : undefined
|
|
2142
2138
|
});
|
|
2143
2139
|
};
|
|
2144
|
-
const menuClass = clsx.clsx(styles$
|
|
2145
|
-
const dropdownClass = clsx.clsx(styles$
|
|
2140
|
+
const menuClass = clsx.clsx(styles$9['zds-menu__container'], className);
|
|
2141
|
+
const dropdownClass = clsx.clsx(styles$9['zds-menu__dropdown'], styles$9[`zds-menu__dropdown--${position}`]);
|
|
2146
2142
|
return (jsxRuntime.jsxs("div", { ref: menuContainerRef, className: menuClass, id: id, children: [renderAnchor(), isMenuOpen && (jsxRuntime.jsx("div", { ref: dropdownRef, className: dropdownClass, role: "menu", "aria-label": "Menu de a\u00E7\u00F5es", id: `${id || 'menu'}-dropdown`, children: jsxRuntime.jsx(MemoizedDropdown, { type: type, items: menuItems, onSelectionChange: handleSelectionChange, initialItemsSelected: initialItemsSelected, applySearch: applySearch, placeholder: placeholder, showSubText: showSubText, "aria-label": "Menu de a\u00E7\u00F5es", minWidth: minWidth, maxWidth: maxWidth, className: dropdownClass }) }))] }));
|
|
2147
2143
|
};
|
|
2148
2144
|
|
|
2149
|
-
var styles$
|
|
2145
|
+
var styles$8 = {"content":"MenuRadix-module__content___zlnmj","subContent":"MenuRadix-module__subContent___tnX0E","itemsWrapper":"MenuRadix-module__itemsWrapper___FaUM1","item":"MenuRadix-module__item___xYiTK","subTrigger":"MenuRadix-module__subTrigger___HIuMb","itemSubText":"MenuRadix-module__itemSubText___Z8qgX","itemIcon":"MenuRadix-module__itemIcon___la-QC","itemSelected":"MenuRadix-module__itemSelected___sEBh6","itemText":"MenuRadix-module__itemText___ybPJy","wrapperText":"MenuRadix-module__wrapperText___-Sji9","chevronIcon":"MenuRadix-module__chevronIcon___VMHpF","searchWrapper":"MenuRadix-module__searchWrapper___qrshb","emptyState":"MenuRadix-module__emptyState___SVFf0","loadingMore":"MenuRadix-module__loadingMore___rYo-t"};
|
|
2150
2146
|
|
|
2151
2147
|
const normalizeText = (text) => {
|
|
2152
2148
|
if (typeof text === 'string')
|
|
@@ -2269,7 +2265,7 @@ const MenuItem = React.memo(({ item, isSelected, onSelect }) => {
|
|
|
2269
2265
|
const handleSelect = () => {
|
|
2270
2266
|
onSelect(item);
|
|
2271
2267
|
};
|
|
2272
|
-
return (jsxRuntime.jsxs(radixUi.DropdownMenu.Item, { className: clsx(styles$
|
|
2268
|
+
return (jsxRuntime.jsxs(radixUi.DropdownMenu.Item, { className: clsx(styles$8.item, { [styles$8.itemSelected]: isSelected }), onSelect: handleSelect, disabled: item.disabled, children: [item.icon && jsxRuntime.jsx("span", { className: styles$8.itemIcon, children: item.icon }), jsxRuntime.jsxs("div", { className: styles$8.wrapperText, children: [jsxRuntime.jsx("span", { className: styles$8.itemText, children: item.text }), item.subText && (jsxRuntime.jsx("span", { className: styles$8.itemSubText, children: item.subText }))] })] }));
|
|
2273
2269
|
});
|
|
2274
2270
|
MenuItem.displayName = 'MenuItem';
|
|
2275
2271
|
|
|
@@ -2376,7 +2372,7 @@ const MenuRadix = ({ items, children, onItemSelect, search, enableInfiniteScroll
|
|
|
2376
2372
|
const renderMenuItem = React.useCallback((item, key) => {
|
|
2377
2373
|
const hasChildren = item.children && item.children.length > 0;
|
|
2378
2374
|
if (hasChildren) {
|
|
2379
|
-
return (jsxRuntime.jsxs(radixUi.DropdownMenu.Sub, { children: [jsxRuntime.jsxs(radixUi.DropdownMenu.SubTrigger, { className: styles$
|
|
2375
|
+
return (jsxRuntime.jsxs(radixUi.DropdownMenu.Sub, { children: [jsxRuntime.jsxs(radixUi.DropdownMenu.SubTrigger, { className: styles$8.subTrigger, disabled: item.disabled, children: [item.icon && (jsxRuntime.jsx("span", { className: styles$8.itemIcon, children: item.icon })), jsxRuntime.jsxs("div", { className: styles$8.wrapperText, children: [jsxRuntime.jsx("span", { className: styles$8.itemText, children: item.text }), item.subText && (jsxRuntime.jsx("span", { className: styles$8.itemSubText, children: item.subText }))] }), jsxRuntime.jsx(reactIcons.ChevronRight16Filled, { className: styles$8.chevronIcon })] }), jsxRuntime.jsx(radixUi.DropdownMenu.Portal, { children: jsxRuntime.jsx(radixUi.DropdownMenu.SubContent, { className: styles$8.subContent, sideOffset: 10, alignOffset: -5, collisionPadding: 20, children: item.children.map((childItem, childIndex) => renderMenuItem(childItem, `${key}-${childIndex}`)) }) })] }, key));
|
|
2380
2376
|
}
|
|
2381
2377
|
return (jsxRuntime.jsx(MenuItem, { item: item, isSelected: isItemSelected(item), onSelect: handleItemSelect }, key));
|
|
2382
2378
|
}, [handleItemSelect, isItemSelected]);
|
|
@@ -2389,14 +2385,14 @@ const MenuRadix = ({ items, children, onItemSelect, search, enableInfiniteScroll
|
|
|
2389
2385
|
hasReachedEndRef.current = false;
|
|
2390
2386
|
}
|
|
2391
2387
|
};
|
|
2392
|
-
return (jsxRuntime.jsxs(radixUi.DropdownMenu.Root, { open: open, onOpenChange: handleOpenChange, children: [jsxRuntime.jsx(radixUi.DropdownMenu.Trigger, { asChild: true, children: children }), jsxRuntime.jsx(radixUi.DropdownMenu.Portal, { children: jsxRuntime.jsxs(radixUi.DropdownMenu.Content, { className: clsx(styles$
|
|
2388
|
+
return (jsxRuntime.jsxs(radixUi.DropdownMenu.Root, { open: open, onOpenChange: handleOpenChange, children: [jsxRuntime.jsx(radixUi.DropdownMenu.Trigger, { asChild: true, children: children }), jsxRuntime.jsx(radixUi.DropdownMenu.Portal, { children: jsxRuntime.jsxs(radixUi.DropdownMenu.Content, { className: clsx(styles$8.content, className), sideOffset: 8, align: align, onKeyDown: (e) => {
|
|
2393
2389
|
if (search) {
|
|
2394
2390
|
e.stopPropagation();
|
|
2395
2391
|
}
|
|
2396
|
-
}, ...rest, children: [search && (jsxRuntime.jsx("div", { className: styles$
|
|
2392
|
+
}, ...rest, children: [search && (jsxRuntime.jsx("div", { className: styles$8.searchWrapper, children: jsxRuntime.jsx(Search, { placeholder: "Buscar", onChange: handleSearchChange, value: searchInput, onKeyDown: handleSearchKeyDown }) })), jsxRuntime.jsxs("div", { className: styles$8.itemsWrapper, ref: itemsWrapperRef, style: { maxHeight: maxHeightStyle }, children: [filteredItems.length > 0 ? (filteredItems.map((item, index) => renderMenuItem(item, item.value || item.text || `item-${index}`))) : (jsxRuntime.jsx("div", { className: styles$8.emptyState, children: "Nenhum item encontrado" })), enableInfiniteScroll && isLoadingMore && (jsxRuntime.jsx("div", { className: styles$8.loadingMore, children: "Carregando mais itens..." })), enableInfiniteScroll && (jsxRuntime.jsx("div", { ref: sentinelRef, "data-scroll-sentinel": true, style: { height: '1px', visibility: 'hidden' } }))] })] }) })] }));
|
|
2397
2393
|
};
|
|
2398
2394
|
|
|
2399
|
-
var styles$
|
|
2395
|
+
var styles$7 = {"zds-quantity":"Quantity-module__zds-quantity___AymLj","zds-quantity__input":"Quantity-module__zds-quantity__input___Wlhmo"};
|
|
2400
2396
|
|
|
2401
2397
|
/**
|
|
2402
2398
|
* Componente Quantity - permite incrementar/decrementar valores numéricos
|
|
@@ -2615,25 +2611,25 @@ const Quantity = ({ defaultValue = 0, value: controlledValue, onChange, disabled
|
|
|
2615
2611
|
}, [disabled, increment, decrement, decimal, decimalPlaces, isControlled, onChange, computedValue]);
|
|
2616
2612
|
const uniqueId = React.useId();
|
|
2617
2613
|
const inputId = id || uniqueId;
|
|
2618
|
-
return (jsxRuntime.jsxs("div", { className: clsx(styles$
|
|
2614
|
+
return (jsxRuntime.jsxs("div", { className: clsx(styles$7['zds-quantity'], { disabled }, className), children: [jsxRuntime.jsx(Button, { variant: 'outlined', size: size, type: 'button', iconOnly: true, icon: jsxRuntime.jsx(reactIcons.Subtract16Regular, {}), onClick: decrement, disabled: disabled || isMinValue, "aria-label": 'Diminuir quantidade' }), jsxRuntime.jsx("input", { ref: inputRef, className: clsx(styles$7['zds-quantity__input'], { disabled }), type: 'text', value: inputValue, onChange: handleInputChange, onBlur: handleBlur, onKeyDown: handleInputKeyDown, id: inputId, min: '0', step: stepValue, "aria-label": 'Quantidade', role: 'spinbutton', "aria-valuenow": computedValue, "aria-valuemin": 0, "aria-valuemax": decimal ? undefined : 9999, disabled: disabled, inputMode: decimal ? 'decimal' : 'numeric' }), jsxRuntime.jsx(Button, { variant: 'outlined', size: size, type: 'button', iconOnly: true, onClick: increment, disabled: disabled, "aria-label": 'Aumentar quantidade', icon: jsxRuntime.jsx(reactIcons.Add16Regular, {}) })] }));
|
|
2619
2615
|
};
|
|
2620
2616
|
const memorizedQuantity = React.memo(Quantity);
|
|
2621
2617
|
memorizedQuantity.displayName = 'Quantity';
|
|
2622
2618
|
|
|
2623
|
-
var styles$
|
|
2619
|
+
var styles$6 = {"root":"RadioRadix-module__root___fkfHL","wrapper":"RadioRadix-module__wrapper___IzWxC","labelWrapper":"RadioRadix-module__labelWrapper___YJy4H","itemWrapper":"RadioRadix-module__itemWrapper___VzD-H","item":"RadioRadix-module__item___z7087","disabled":"RadioRadix-module__disabled___eGuSF","labelText":"RadioRadix-module__labelText___jP1Lv","indicator":"RadioRadix-module__indicator___oJlhm"};
|
|
2624
2620
|
|
|
2625
2621
|
const RadioRadix = ({ items, onValueChange, defaultValue, name, id, ariaLabel, orientation = 'vertical', ...rest }) => {
|
|
2626
2622
|
const componentId = id || React.useId();
|
|
2627
|
-
return (jsxRuntime.jsx(radixUi.RadioGroup.Root, { id: componentId, className: styles$
|
|
2623
|
+
return (jsxRuntime.jsx(radixUi.RadioGroup.Root, { id: componentId, className: styles$6.root, defaultValue: defaultValue, onValueChange: onValueChange, name: name, "aria-label": ariaLabel, "data-orientation": orientation, orientation: orientation, ...rest, children: items.map(({ id, value, disabled, label }, index) => {
|
|
2628
2624
|
const itemKey = id ?? value ?? `radio-${index}`;
|
|
2629
2625
|
const uniqueId = `${componentId}-item-${value}`;
|
|
2630
|
-
return (jsxRuntime.jsx("div", { className: clsx(styles$
|
|
2626
|
+
return (jsxRuntime.jsx("div", { className: clsx(styles$6.wrapper, { [styles$6.disabled]: disabled }), children: jsxRuntime.jsxs("label", { className: styles$6.labelWrapper, htmlFor: uniqueId, children: [jsxRuntime.jsx("div", { className: styles$6.itemWrapper, children: jsxRuntime.jsx(radixUi.RadioGroup.Item, { disabled: disabled, className: styles$6.item, value: value, id: uniqueId, "data-disabled": disabled, children: jsxRuntime.jsx(radixUi.RadioGroup.Indicator, { className: styles$6.indicator }) }) }), jsxRuntime.jsx("span", { className: styles$6.labelText, children: label })] }) }, itemKey));
|
|
2631
2627
|
}) }));
|
|
2632
2628
|
};
|
|
2633
2629
|
|
|
2634
|
-
var styles$
|
|
2630
|
+
var styles$5 = {"zds-select":"Select-module__zds-select___TePBJ","zds-select__dropdown":"Select-module__zds-select__dropdown___pEXsY","zds-dropdown__container":"Select-module__zds-dropdown__container___TJvrT","zds-select__dropdown--top":"Select-module__zds-select__dropdown--top___O3u5M","zds-select__dropdown--bottom":"Select-module__zds-select__dropdown--bottom___qfKLH"};
|
|
2635
2631
|
|
|
2636
|
-
var styles$
|
|
2632
|
+
var styles$4 = {"zds-select-field":"SelectField-module__zds-select-field___djzS5","zds-select-field__required":"SelectField-module__zds-select-field__required___T-LvC","zds-select-field__container-box":"SelectField-module__zds-select-field__container-box___nkzZy","zds-select-field__box__input":"SelectField-module__zds-select-field__box__input___xBdKZ","zds-select-field__display":"SelectField-module__zds-select-field__display___snLz3","zds-select-field--open":"SelectField-module__zds-select-field--open___IUfIn","zds-select-field__icon":"SelectField-module__zds-select-field__icon___kt-SW","zds-select-field__helper-text":"SelectField-module__zds-select-field__helper-text___9jTiW","zds-select-field__container-tooltip":"SelectField-module__zds-select-field__container-tooltip___xZr46","zds-select-field__tooltip":"SelectField-module__zds-select-field__tooltip___XYAEC","zds-select-field--error":"SelectField-module__zds-select-field--error___sb6H6","zds-select-field--disabled":"SelectField-module__zds-select-field--disabled___48f33"};
|
|
2637
2633
|
|
|
2638
2634
|
const SelectField = React.forwardRef(({ id, name, value, placeholder, label, helperText, errorMessage, required = false, disabled = false, icon, isOpen = false, className, tooltip, tooltipText, isTouched = false, hasError = false, positionTooltip }, ref) => {
|
|
2639
2635
|
// ✅ NOVA LÓGICA: Validação de required
|
|
@@ -2647,19 +2643,19 @@ const SelectField = React.forwardRef(({ id, name, value, placeholder, label, hel
|
|
|
2647
2643
|
// ✅ NOVA LÓGICA: Estado de erro combinado
|
|
2648
2644
|
const showError = hasError || shouldShowRequiredError || Boolean(errorMessage);
|
|
2649
2645
|
// Classes CSS
|
|
2650
|
-
const containerClasses = clsx(styles$
|
|
2651
|
-
[styles$
|
|
2652
|
-
[styles$
|
|
2653
|
-
[styles$
|
|
2654
|
-
[styles$
|
|
2655
|
-
[styles$
|
|
2646
|
+
const containerClasses = clsx(styles$4['zds-select-field'], {
|
|
2647
|
+
[styles$4['zds-select-field--open']]: isOpen,
|
|
2648
|
+
[styles$4['zds-select-field--disabled']]: disabled,
|
|
2649
|
+
[styles$4['zds-select-field--error']]: showError,
|
|
2650
|
+
[styles$4['zds-select-field--required']]: isRequired,
|
|
2651
|
+
[styles$4['zds-select-field--touched']]: isTouched,
|
|
2656
2652
|
}, className);
|
|
2657
|
-
const displayClasses = clsx(styles$
|
|
2658
|
-
[styles$
|
|
2653
|
+
const displayClasses = clsx(styles$4['zds-select-field__display'], {
|
|
2654
|
+
[styles$4['zds-select-field__display--placeholder']]: !hasValue,
|
|
2659
2655
|
'has-value': hasValue,
|
|
2660
2656
|
});
|
|
2661
2657
|
const displayText = hasValue ? value : placeholder;
|
|
2662
|
-
return (jsxRuntime.jsxs("div", { className: containerClasses, ref: ref, children: [label && (jsxRuntime.jsx("label", { htmlFor: id, children: tooltip ? (jsxRuntime.jsx(Tooltip, { text: tooltipText, position: positionTooltip, children: jsxRuntime.jsxs("div", { className: styles$
|
|
2658
|
+
return (jsxRuntime.jsxs("div", { className: containerClasses, ref: ref, children: [label && (jsxRuntime.jsx("label", { htmlFor: id, children: tooltip ? (jsxRuntime.jsx(Tooltip, { text: tooltipText, position: positionTooltip, children: jsxRuntime.jsxs("div", { className: styles$4['zds-select-field__container-tooltip'], children: [label, required && jsxRuntime.jsx("span", { className: styles$4['zds-select-field__required'], children: "*" }), jsxRuntime.jsx(reactIcons.Info12Regular, { className: styles$4['zds-select-field__tooltip'] })] }) })) : (jsxRuntime.jsxs("div", { className: styles$4['zds-select-field__container-tooltip'], children: [label, required && jsxRuntime.jsx("span", { className: styles$4['zds-select-field__required'], children: "*" })] })) })), jsxRuntime.jsxs("div", { className: styles$4['zds-select-field__container-box'], children: [jsxRuntime.jsxs("div", { className: styles$4['zds-select-field__box__input'], children: [jsxRuntime.jsx("div", { id: id, className: displayClasses, "data-placeholder": !hasValue ? placeholder : undefined, children: displayText }), jsxRuntime.jsx("input", { type: "hidden", name: name, value: value || '', disabled: disabled, required: required, className: styles$4['zds-select-field__input'] }), icon && (jsxRuntime.jsx("div", { className: styles$4['zds-select-field__icon'], children: icon }))] }), !isOpen && (helperText || showError) && (jsxRuntime.jsx("div", { className: styles$4['zds-select-field__helper-text'], children: showError ? dynamicErrorMessage : helperText }))] })] }));
|
|
2663
2659
|
});
|
|
2664
2660
|
SelectField.displayName = 'SelectField';
|
|
2665
2661
|
|
|
@@ -2973,16 +2969,16 @@ const Select = React.memo(({ id, options = [], value, initialValue, onChange, pl
|
|
|
2973
2969
|
return styles;
|
|
2974
2970
|
}, [maxWidth, minWidth, width]);
|
|
2975
2971
|
// ✅ MELHORADO: Classes CSS com estados visuais
|
|
2976
|
-
const selectClasses = clsx(styles$
|
|
2977
|
-
[styles$
|
|
2978
|
-
[styles$
|
|
2979
|
-
[styles$
|
|
2980
|
-
[styles$
|
|
2981
|
-
[styles$
|
|
2972
|
+
const selectClasses = clsx(styles$5['zds-select'], {
|
|
2973
|
+
[styles$5['zds-select--disabled']]: disabled,
|
|
2974
|
+
[styles$5['zds-select--error']]: Boolean(errorMessage) || shouldShowRequiredError,
|
|
2975
|
+
[styles$5['zds-select--focused']]: isOpen,
|
|
2976
|
+
[styles$5['zds-select--required']]: required,
|
|
2977
|
+
[styles$5['zds-select--touched']]: isTouched,
|
|
2982
2978
|
}, className);
|
|
2983
2979
|
return (jsxRuntime.jsxs("div", { className: selectClasses, ref: selectRef, id: finalId, "data-testid": "select-container", style: containerStyles, children: [jsxRuntime.jsx("div", { role: "combobox", "aria-expanded": isOpen, "aria-haspopup": "listbox", "aria-owns": isOpen ? `${finalId}-dropdown` : undefined, "aria-controls": `${finalId}-dropdown`, "aria-describedby": helperText ? `${finalId}-helper` : undefined, "aria-invalid": Boolean(errorMessage), "aria-required": required, "aria-label": ariaLabel || label || placeholder || 'Selecione uma opção', "aria-activedescendant": isOpen && focusedOptionIndex >= 0
|
|
2984
2980
|
? dropdownItems[focusedOptionIndex]?.id
|
|
2985
|
-
: selectedIds.length > 0 ? selectedIds[0] : undefined, tabIndex: disabled ? -1 : 0, onBlur: handleBlur, onKeyDown: handleKeyDown, onClick: handleTriggerClick, className: styles$
|
|
2981
|
+
: selectedIds.length > 0 ? selectedIds[0] : undefined, tabIndex: disabled ? -1 : 0, onBlur: handleBlur, onKeyDown: handleKeyDown, onClick: handleTriggerClick, className: styles$5['zds-select__trigger'], children: jsxRuntime.jsx(SelectField, { name: `select-${finalId}`, placeholder: displayText || placeholder, value: displayText, disabled: disabled, helperText: !isOpen ? helperText : undefined, errorMessage: !isOpen ? errorMessage : undefined, icon: isOpen ? jsxRuntime.jsx(reactIcons.ChevronUp16Regular, {}) : jsxRuntime.jsx(reactIcons.ChevronDown16Regular, {}), required: required, label: label, isTouched: isTouched, hasError: shouldShowRequiredError, isOpen: isOpen, tooltip: tooltip, tooltipText: tooltipText, positionTooltip: positionTooltip }) }), isOpen && !disabled && (jsxRuntime.jsx("div", { className: clsx(styles$5['zds-select__dropdown'], position && styles$5[`zds-select__dropdown--${position}`]), children: jsxRuntime.jsx(MemoizedDropdown, { items: dropdownItems, type: type, onSelectionChange: handleOptionSelect, initialItemsSelected: initialItemsSelected, defaultSelectedIds: selectedIds, id: `${finalId}-dropdown`, showSubText: showSubText, maxWidth: maxWidth, minWidth: minWidth, width: width, maxHeight: maxHeight, infiniteScroll: infiniteScroll }, `dropdown-${selectedIds.join('-')}`) }))] }));
|
|
2986
2982
|
});
|
|
2987
2983
|
Select.displayName = 'Select';
|
|
2988
2984
|
|
|
@@ -3227,32 +3223,28 @@ enableApiSearch = false, onApiSearch, isSearching = false, }) {
|
|
|
3227
3223
|
};
|
|
3228
3224
|
}
|
|
3229
3225
|
|
|
3230
|
-
var styles$
|
|
3226
|
+
var styles$3 = {"fieldContainer":"index-module__fieldContainer___rfpwH","trigger":"index-module__trigger___RCzFG","disabled":"index-module__disabled___ust2Z","open":"index-module__open___JZ3rh","error":"index-module__error___bEUc-","hasValue":"index-module__hasValue___pp7kv","triggerText":"index-module__triggerText___Q67w2","containerLabel":"index-module__containerLabel___nM2na","content":"index-module__content___hK3aL","viewport":"index-module__viewport___lJTlo","group":"index-module__group___2RRJc","container":"index-module__container___IPFKk","searchWrapper":"index-module__searchWrapper___Mxi7i","item":"index-module__item___ePUP1","subTitle":"index-module__subTitle___6Iz6p","title":"index-module__title___XHkS6","checkboxItem":"index-module__checkboxItem___3Q7pV","checkboxContent":"index-module__checkboxContent___a9PQw","itemWrapper":"index-module__itemWrapper___LmG00","icon":"index-module__icon___5zWjG","itemIndicator":"index-module__itemIndicator___jC6dI","textContent":"index-module__textContent___sIMxV","helper":"index-module__helper___LK89V","errorMessage":"index-module__errorMessage___MDeJD","noResults":"index-module__noResults___mudWL","loadingMore":"index-module__loadingMore___WvQCu"};
|
|
3231
3227
|
|
|
3232
3228
|
const CheckboxSelectItem = ({ text, subTitle, disabled, checked, onChange, value, ...restProps }) => {
|
|
3233
3229
|
const handleCheckboxChange = (e) => {
|
|
3234
3230
|
e.stopPropagation();
|
|
3235
3231
|
onChange(e.target.checked);
|
|
3236
3232
|
};
|
|
3237
|
-
return (jsxRuntime.jsx("div", { className: clsx(styles$
|
|
3238
|
-
[styles$
|
|
3239
|
-
}), role: "option", "aria-selected": checked, "data-selected": checked, "data-testid": `checkbox-item-${value}`, ...restProps, children: jsxRuntime.jsx("div", { className: styles$
|
|
3233
|
+
return (jsxRuntime.jsx("div", { className: clsx(styles$3.item, styles$3.checkboxItem, {
|
|
3234
|
+
[styles$3.disabled]: disabled,
|
|
3235
|
+
}), role: "option", "aria-selected": checked, "data-selected": checked, "data-testid": `checkbox-item-${value}`, ...restProps, children: jsxRuntime.jsx("div", { className: styles$3.checkboxContent, children: jsxRuntime.jsx(MemoizedCheckbox, { checked: checked, onChange: handleCheckboxChange, disabled: disabled, label: jsxRuntime.jsxs("div", { className: styles$3.textContent, children: [jsxRuntime.jsx("span", { className: styles$3.title, children: text }), subTitle && jsxRuntime.jsx("div", { className: styles$3.subTitle, children: subTitle })] }), onClick: (e) => e.stopPropagation() }) }) }));
|
|
3240
3236
|
};
|
|
3241
3237
|
CheckboxSelectItem.displayName = 'CheckboxSelectItem';
|
|
3242
3238
|
|
|
3243
3239
|
const SelectItem = React.forwardRef(({ text, subTitle, icon, disabled, value, variant, ...restProps }, ref) => {
|
|
3244
|
-
return (jsxRuntime.jsxs("div", { className: clsx(styles$
|
|
3245
|
-
[styles$
|
|
3246
|
-
}), "data-disabled": disabled || undefined, "data-testid": `select-item-${value}`, ref: ref, children: [variant === 'icon' && icon && (jsxRuntime.jsx("span", { className: styles$
|
|
3247
|
-
[styles$
|
|
3248
|
-
}), value: value, disabled: disabled, ...restProps, children: [jsxRuntime.jsx(radixUi.Select.ItemText, { className: styles$
|
|
3240
|
+
return (jsxRuntime.jsxs("div", { className: clsx(styles$3.itemWrapper, {
|
|
3241
|
+
[styles$3.disabled]: disabled,
|
|
3242
|
+
}), "data-disabled": disabled || undefined, "data-testid": `select-item-${value}`, ref: ref, children: [variant === 'icon' && icon && (jsxRuntime.jsx("span", { className: styles$3.icon, children: icon })), jsxRuntime.jsxs(radixUi.Select.Item, { className: clsx(styles$3.item, {
|
|
3243
|
+
[styles$3.disabled]: disabled,
|
|
3244
|
+
}), value: value, disabled: disabled, ...restProps, children: [jsxRuntime.jsx(radixUi.Select.ItemText, { className: styles$3.title, children: text }), subTitle && jsxRuntime.jsx("div", { className: styles$3.subTitle, children: subTitle }), jsxRuntime.jsx(radixUi.Select.ItemIndicator, { className: styles$3.itemIndicator })] })] }));
|
|
3249
3245
|
});
|
|
3250
3246
|
SelectItem.displayName = 'SelectItem';
|
|
3251
3247
|
|
|
3252
|
-
var styles$3 = {"wrapperLabel":"index-module__wrapperLabel___XJzZO","requiredLabel":"index-module__requiredLabel___7oZkh","infoIcon":"index-module__infoIcon___lClx4","errorLabel":"index-module__errorLabel___qa6h6","disabledLabel":"index-module__disabledLabel___U9vL8"};
|
|
3253
|
-
|
|
3254
|
-
const LabelComponent = ({ children, htmlFor, required = false, tooltip = false, tooltipMessage, className, error = false, disabled = false }) => (jsxRuntime.jsx("div", { className: styles$3.containerLabel, children: tooltip ? (jsxRuntime.jsx(Tooltip, { position: "top-left", text: tooltipMessage || '', children: jsxRuntime.jsxs(radixUi.Label.Root, { className: clsx(styles$3.wrapperLabel, error && styles$3.errorLabel, className), htmlFor: htmlFor, children: [children, required && jsxRuntime.jsx("span", { className: styles$3.requiredLabel, children: "*" }), jsxRuntime.jsx(reactIcons.Info12Regular, { className: styles$3.infoIcon })] }) })) : (jsxRuntime.jsxs(radixUi.Label.Root, { className: clsx(styles$3.wrapperLabel, error && styles$3.errorLabel, disabled && styles$3.disabledLabel, className), htmlFor: htmlFor, children: [children, required && jsxRuntime.jsx("span", { className: styles$3.requiredLabel, children: "*" })] })) }));
|
|
3255
|
-
|
|
3256
3248
|
const SelectRadix = ({ items, onValueChange, onOpenChange, variant, required = false, value, tooltip = false, tooltipMessage, label, helperText, placeholder = 'Selecione', maxWidth, search = false, errorMessage, disabled = false, className, 'aria-label': ariaLabel, 'data-testid': testId,
|
|
3257
3249
|
// Props para scroll infinito
|
|
3258
3250
|
enableInfiniteScroll = false, onScrollEnd, isLoadingMore = false,
|
|
@@ -3331,13 +3323,14 @@ enableApiSearch = false, onApiSearch, isSearching = false, ...restProps }) => {
|
|
|
3331
3323
|
onApiSearch('');
|
|
3332
3324
|
}
|
|
3333
3325
|
};
|
|
3334
|
-
return (jsxRuntime.jsx(radixUi.Select.Root, { value: variant === 'checkbox' ? '' : (state.selectedValues[0] || ''), onValueChange: variant === 'checkbox' ? undefined : actions.handleSingleSelect, required: required, open: state.isOpen, onOpenChange: actions.setOpen, disabled: disabled, ...restProps, children: jsxRuntime.jsxs("div", { className: clsx(styles$
|
|
3335
|
-
[styles$
|
|
3336
|
-
[styles$
|
|
3337
|
-
[styles$
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3326
|
+
return (jsxRuntime.jsx(radixUi.Select.Root, { value: variant === 'checkbox' ? '' : (state.selectedValues[0] || ''), onValueChange: variant === 'checkbox' ? undefined : actions.handleSingleSelect, required: required, open: state.isOpen, onOpenChange: actions.setOpen, disabled: disabled, ...restProps, children: jsxRuntime.jsxs("div", { className: clsx(styles$3.container, className), style: containerStyle, "data-testid": testId, children: [jsxRuntime.jsx("div", { className: styles$3.fieldContainer, children: jsxRuntime.jsxs("div", { className: styles$3.containerLabel, children: [jsxRuntime.jsx(LabelComponent, { htmlFor: selectId, required: required, tooltipMessage: tooltipMessage, tooltip: tooltip, error: state.hasError && state.touched, disabled: disabled, children: label }), jsxRuntime.jsxs(radixUi.Select.Trigger, { className: clsx(styles$3.trigger, {
|
|
3327
|
+
[styles$3.error]: state.hasError && state.touched,
|
|
3328
|
+
[styles$3.disabled]: disabled,
|
|
3329
|
+
[styles$3.hasValue]: state.selectedValues.length > 0,
|
|
3330
|
+
[styles$3.open]: state.isOpen,
|
|
3331
|
+
}), id: selectId, "aria-label": ariaLabel, "data-testid": `${testId}-trigger`, children: [variant === 'checkbox' ? (jsxRuntime.jsx("span", { className: styles$3.triggerText, children: displayText })) : (jsxRuntime.jsx(radixUi.Select.Value, { placeholder: placeholder, className: styles$3.placeholder, children: displayText })), state.isOpen ? jsxRuntime.jsx(reactIcons.ChevronUp16Regular, {}) : jsxRuntime.jsx(reactIcons.ChevronDown16Regular, {})] }), !state.isOpen && helperText && !state.hasError && (jsxRuntime.jsx("span", { className: clsx(styles$3.helper, {
|
|
3332
|
+
[styles$3.disabled]: disabled
|
|
3333
|
+
}), children: helperText })), state.hasError && state.touched && (jsxRuntime.jsx("span", { className: styles$3.errorMessage, children: errorMessage || 'Campo obrigatório' }))] }) }), jsxRuntime.jsx(radixUi.Select.Portal, { children: jsxRuntime.jsxs(radixUi.Select.Content, { className: styles$3.content, position: "popper", side: "bottom", sideOffset: 8, align: "start", avoidCollisions: true, children: [search && (jsxRuntime.jsx("div", { className: styles$3.searchWrapper, children: jsxRuntime.jsx(Search, { ref: refs.searchInputRef, className: styles$3.search, placeholder: "Buscar", value: state.searchInput, onChange: handleSearchChange, onKeyDown: handleSearchKeyDown, onClear: handleClear, "data-testid": `${testId}-search` }) })), jsxRuntime.jsx(radixUi.Select.Viewport, { ref: viewportRef, className: styles$3.viewport, children: jsxRuntime.jsx(radixUi.Select.Group, { className: styles$3.group, children: filteredItems.length === 0 ? (jsxRuntime.jsx("div", { className: styles$3.noResults, children: "Nenhum resultado encontrado" })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [filteredItems.map((item) => (variant === 'checkbox' ? (jsxRuntime.jsx(CheckboxSelectItem, { ...item, checked: state.selectedValues.includes(item.value), onChange: (checked) => actions.handleMultipleSelect(item.value, checked) }, item.id || item.value)) : (jsxRuntime.jsx(SelectItem, { ...item, variant: variant }, item.id || item.value)))), enableInfiniteScroll && isLoadingMore && (jsxRuntime.jsx("div", { className: styles$3.loadingMore, children: "Carregando mais itens..." }))] })) }) })] }) })] }) }));
|
|
3341
3334
|
};
|
|
3342
3335
|
SelectRadix.displayName = 'SelectRadix';
|
|
3343
3336
|
|
|
@@ -7354,7 +7347,7 @@ exports.SelectRadix = SelectRadix;
|
|
|
7354
7347
|
exports.Table = Table;
|
|
7355
7348
|
exports.TableHeader = TableHeader;
|
|
7356
7349
|
exports.TablePagination = TablePagination;
|
|
7357
|
-
exports.TextField =
|
|
7350
|
+
exports.TextField = TextField;
|
|
7358
7351
|
exports.Toast = ToastProvider;
|
|
7359
7352
|
exports.ToastProvider = ToastProvider;
|
|
7360
7353
|
exports.Tooltip = Tooltip;
|