@giro-ds/react 12.6.0 → 12.6.2
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 +29 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +30 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/styles.css +2 -2
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -4071,7 +4071,7 @@ var styles$g = {"DialogOverlay":"Dialog-module__DialogOverlay___LEX2O","DialogCo
|
|
|
4071
4071
|
|
|
4072
4072
|
const Dialog = ({ show = false, title, bodyContent, textPrimaryAction, textSecondaryAction, onPrimaryAction, onSecondaryAction, className, ...rest }) => (jsxRuntime.jsx(radixUi.AlertDialog.Root, { open: show, ...rest, children: jsxRuntime.jsxs(radixUi.AlertDialog.Portal, { children: [jsxRuntime.jsx(radixUi.AlertDialog.Overlay, { className: styles$g.DialogOverlay }), jsxRuntime.jsxs(radixUi.AlertDialog.Content, { className: clsx(styles$g.DialogContent, className), children: [jsxRuntime.jsx(radixUi.AlertDialog.Title, { className: styles$g.DialogTitle, children: title }), jsxRuntime.jsx(radixUi.AlertDialog.Description, { asChild: true, className: styles$g.DialogDescription, children: jsxRuntime.jsx("div", { children: bodyContent }) }), jsxRuntime.jsxs("div", { className: styles$g.DivButtons, children: [!!(textSecondaryAction && textSecondaryAction.trim()) && (jsxRuntime.jsx(radixUi.AlertDialog.Cancel, { asChild: true, children: jsxRuntime.jsx(Button, { variant: "outlined", ...(onSecondaryAction && { onClick: onSecondaryAction }), children: textSecondaryAction }) })), jsxRuntime.jsx(radixUi.AlertDialog.Action, { asChild: true, children: jsxRuntime.jsx(Button, { variant: "filled", ...(onPrimaryAction && { onClick: onPrimaryAction }), children: textPrimaryAction }) })] })] })] }) }));
|
|
4073
4073
|
|
|
4074
|
-
var styles$f = {"drawerShadow":"Drawer-module__drawerShadow___0Z6iL","drawerShadow--visible":"Drawer-module__drawerShadow--visible___FspoH","drawerSidebar":"Drawer-module__drawerSidebar___cdyyb","drawerSidebar--open":"Drawer-module__drawerSidebar--open___ee2-Y","drawerSidebar--disabled":"Drawer-module__drawerSidebar--disabled___MYrBI","drawerTitleClose":"Drawer-module__drawerTitleClose___QzqN-","drawerTitle":"Drawer-module__drawerTitle___naMX0","drawerChildren":"Drawer-module__drawerChildren___xGdg9","drawerHeaderContent":"Drawer-module__drawerHeaderContent___NLSwj"};
|
|
4074
|
+
var styles$f = {"drawerShadow":"Drawer-module__drawerShadow___0Z6iL","drawerShadow--visible":"Drawer-module__drawerShadow--visible___FspoH","drawerSidebar":"Drawer-module__drawerSidebar___cdyyb","drawerSidebar--open":"Drawer-module__drawerSidebar--open___ee2-Y","drawerSidebar--disabled":"Drawer-module__drawerSidebar--disabled___MYrBI","drawerTitleClose":"Drawer-module__drawerTitleClose___QzqN-","drawerTitle":"Drawer-module__drawerTitle___naMX0","drawerChildren":"Drawer-module__drawerChildren___xGdg9","drawerHeaderContent":"Drawer-module__drawerHeaderContent___NLSwj","drawerFooter":"Drawer-module__drawerFooter___qGaC-"};
|
|
4075
4075
|
|
|
4076
4076
|
const Drawer = ({ children, headerContent, footer, customWidth = '400px', onClose, title = 'Título', isOpen = false, onOpen, className, id, disabled = false, onOverlayClick, closeOnOverlayClick = true, closeOnEscape = true, ...rest }) => {
|
|
4077
4077
|
const internalClose = React.useCallback(() => {
|
|
@@ -4120,6 +4120,25 @@ const Drawer = ({ children, headerContent, footer, customWidth = '400px', onClos
|
|
|
4120
4120
|
event.stopPropagation();
|
|
4121
4121
|
internalClose();
|
|
4122
4122
|
};
|
|
4123
|
+
const contentRef = React.useRef(null);
|
|
4124
|
+
const [scrollbarWidth, setScrollbarWidth] = React.useState(0);
|
|
4125
|
+
React.useEffect(() => {
|
|
4126
|
+
const contentEl = contentRef.current;
|
|
4127
|
+
if (!contentEl)
|
|
4128
|
+
return;
|
|
4129
|
+
const measureScrollbar = () => {
|
|
4130
|
+
setScrollbarWidth(contentEl.offsetWidth - contentEl.clientWidth);
|
|
4131
|
+
};
|
|
4132
|
+
measureScrollbar();
|
|
4133
|
+
const resizeObserver = new ResizeObserver(measureScrollbar);
|
|
4134
|
+
resizeObserver.observe(contentEl);
|
|
4135
|
+
const mutationObserver = new MutationObserver(measureScrollbar);
|
|
4136
|
+
mutationObserver.observe(contentEl, { childList: true, subtree: true, characterData: true });
|
|
4137
|
+
return () => {
|
|
4138
|
+
resizeObserver.disconnect();
|
|
4139
|
+
mutationObserver.disconnect();
|
|
4140
|
+
};
|
|
4141
|
+
}, [isOpen, children]);
|
|
4123
4142
|
return reactDom.createPortal(jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: clsx(styles$f['drawerShadow'], {
|
|
4124
4143
|
[styles$f['drawerShadow--visible']]: isOpen,
|
|
4125
4144
|
}), onClick: handleOverlayClick, role: "presentation", "aria-hidden": "true", "data-testid": "drawer-overlay" }), jsxRuntime.jsxs("div", { className: clsx(styles$f['drawerSidebar'], {
|
|
@@ -4127,7 +4146,8 @@ const Drawer = ({ children, headerContent, footer, customWidth = '400px', onClos
|
|
|
4127
4146
|
[styles$f['drawerSidebar--disabled']]: disabled,
|
|
4128
4147
|
}, className), style: {
|
|
4129
4148
|
'--drawer-custom-width': customWidth,
|
|
4130
|
-
|
|
4149
|
+
'--drawer-scrollbar-width': `${scrollbarWidth}px`,
|
|
4150
|
+
}, onClick: handleDrawerClick, role: "dialog", "aria-modal": "true", "aria-labelledby": id ? `${id}-title` : 'drawer-title', "aria-hidden": !isOpen, "data-testid": "drawer-panel", id: id, ...rest, children: [jsxRuntime.jsxs("div", { className: styles$f.drawerTitleClose, children: [jsxRuntime.jsx("div", { className: styles$f.drawerTitle, id: id ? `${id}-title` : 'drawer-title', children: title }), headerContent && (jsxRuntime.jsx("div", { className: styles$f.drawerHeaderContent, children: headerContent })), jsxRuntime.jsx(Button, { onClick: handleCloseClick, variant: 'outlined', iconOnly: true, icon: jsxRuntime.jsx(reactIcons.Dismiss16Regular, {}), size: 'lg', tooltipText: 'Fechar' })] }), jsxRuntime.jsx("div", { ref: contentRef, className: styles$f.drawerChildren, "data-testid": "drawer-content", children: children }), footer && (jsxRuntime.jsx("div", { className: styles$f.drawerFooter, children: footer }))] })] }), document.body);
|
|
4131
4151
|
};
|
|
4132
4152
|
|
|
4133
4153
|
var styles$e = {"container":"FileUpload-module__container___hFeKV","dropZone":"FileUpload-module__dropZone___716hF","disabled":"FileUpload-module__disabled___mwePo","alert":"FileUpload-module__alert___Dnzqc","dragging":"FileUpload-module__dragging___XZghy","emptyState":"FileUpload-module__emptyState___6Ll9D","uploadIcon":"FileUpload-module__uploadIcon___MkBLe","uploadText":"FileUpload-module__uploadText___VWc9g","alertIcon":"FileUpload-module__alertIcon___pTaMS","alertText":"FileUpload-module__alertText___sfV4z","fileList":"FileUpload-module__fileList___K6KQD","thumb":"FileUpload-module__thumb___eg59D","removeButton":"FileUpload-module__removeButton___jUFNv","thumbClip":"FileUpload-module__thumbClip___sP9wp","thumbImage":"FileUpload-module__thumbImage___Swxhd","thumbFile":"FileUpload-module__thumbFile___y7lg5","thumbFileName":"FileUpload-module__thumbFileName___LPSCX","helperText":"FileUpload-module__helperText___DzPqP","errorText":"FileUpload-module__errorText___cHd1Z"};
|
|
@@ -6150,11 +6170,17 @@ ToastProvider.displayName = 'ToastProvider';
|
|
|
6150
6170
|
*/
|
|
6151
6171
|
const ToastContainer = () => {
|
|
6152
6172
|
const { toasts } = useToastContext();
|
|
6173
|
+
const portalRef = React__namespace.useRef(null);
|
|
6174
|
+
React__namespace.useEffect(() => {
|
|
6175
|
+
if (toasts.length > 0 && portalRef.current) {
|
|
6176
|
+
document.body.appendChild(portalRef.current);
|
|
6177
|
+
}
|
|
6178
|
+
}, [toasts.length]);
|
|
6153
6179
|
return (jsxRuntime.jsxs(radixUi.Toast.Provider, { swipeDirection: "left", children: [toasts.map((toast) => {
|
|
6154
6180
|
if (!toast.id)
|
|
6155
6181
|
return null;
|
|
6156
6182
|
return jsxRuntime.jsx(Toast, { id: toast.id, ...toast }, toast.id);
|
|
6157
|
-
}), jsxRuntime.jsx(radixUi.Toast.Viewport, { className: styles$2.toastViewport })] }));
|
|
6183
|
+
}), jsxRuntime.jsx(radixUi.Portal.Root, { ref: portalRef, children: jsxRuntime.jsx(radixUi.Toast.Viewport, { className: styles$2.toastViewport }) })] }));
|
|
6158
6184
|
};
|
|
6159
6185
|
ToastContainer.displayName = 'ToastContainer';
|
|
6160
6186
|
|