infinity-ui-elements 1.8.20 → 1.8.22
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/Modal/Modal.stories.d.ts +2 -0
- package/dist/components/Modal/Modal.stories.d.ts.map +1 -1
- package/dist/components/SearchableDropdown/SearchableDropdown.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.esm.js +24 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +24 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2575,7 +2575,7 @@ const Modal = React__namespace.forwardRef(({ isOpen, onClose, title, description
|
|
|
2575
2575
|
if (!isOpen)
|
|
2576
2576
|
return null;
|
|
2577
2577
|
const hasHeader = title || description;
|
|
2578
|
-
return (jsxRuntime.jsxs("div", { className: cn("fixed inset-0 z-
|
|
2578
|
+
return (jsxRuntime.jsxs("div", { className: cn("fixed inset-0 z-[10000] flex items-center justify-center p-4", className), role: "dialog", "aria-modal": "true", "aria-label": ariaLabel || title, "aria-describedby": ariaDescribedBy, children: [jsxRuntime.jsx("div", { className: cn("absolute inset-0 bg-black/50 backdrop-blur-sm transition-opacity", overlayClassName), onClick: handleOverlayClick, "aria-hidden": "true" }), jsxRuntime.jsxs("div", { ref: contentRef, className: cn("relative w-full bg-white rounded-large shadow-xl transition-all", "flex flex-col max-h-[90vh]", sizeConfig[size], contentClassName), children: [hasHeader && (jsxRuntime.jsxs("div", { className: cn("flex items-start justify-between gap-4 px-6 pt-6", !description && "pb-4", description && "pb-2", headerClassName), children: [jsxRuntime.jsxs("div", { className: "flex-1", children: [title && (jsxRuntime.jsx(Text, { as: "h2", variant: "body", size: "large", weight: "semibold", color: "default", children: title })), description && (jsxRuntime.jsx(Text, { as: "p", variant: "body", size: "small", weight: "regular", color: "subtle", className: "mt-1", children: description }))] }), showCloseButton && onClose && (jsxRuntime.jsx(IconButton, { icon: "close", onClick: onClose, color: "neutral", size: "small", "aria-label": "Close modal", className: "shrink-0" }))] })), !hasHeader && showCloseButton && onClose && (jsxRuntime.jsx("div", { className: "absolute top-4 right-4 z-10", children: jsxRuntime.jsx(IconButton, { icon: "close", onClick: onClose, color: "neutral", size: "small", "aria-label": "Close modal" }) })), jsxRuntime.jsx("div", { className: cn("flex-1 overflow-y-auto px-6", hasHeader ? "py-4" : "pt-6 pb-4", !footer && "pb-6", bodyClassName), children: children }), footer && (jsxRuntime.jsxs("div", { className: "flex flex-col", children: [jsxRuntime.jsx(Divider, { thickness: "thin", variant: "muted" }), jsxRuntime.jsx("div", { className: cn("flex items-center justify-end gap-3 px-6 py-4", footerClassName), children: footer })] }))] })] }));
|
|
2579
2579
|
});
|
|
2580
2580
|
Modal.displayName = "Modal";
|
|
2581
2581
|
|
|
@@ -3226,6 +3226,7 @@ const SearchableDropdown = React__namespace.forwardRef(({ className, items = [],
|
|
|
3226
3226
|
const [uncontrolledSearchValue, setUncontrolledSearchValue] = React__namespace.useState(defaultSearchValue);
|
|
3227
3227
|
const [isOpen, setIsOpen] = React__namespace.useState(false);
|
|
3228
3228
|
const [focusedIndex, setFocusedIndex] = React__namespace.useState(-1);
|
|
3229
|
+
const [isInsideModal, setIsInsideModal] = React__namespace.useState(false);
|
|
3229
3230
|
const dropdownRef = React__namespace.useRef(null);
|
|
3230
3231
|
const inputRef = React__namespace.useRef(null);
|
|
3231
3232
|
const menuRef = React__namespace.useRef(null);
|
|
@@ -3235,6 +3236,27 @@ const SearchableDropdown = React__namespace.forwardRef(({ className, items = [],
|
|
|
3235
3236
|
width: 0,
|
|
3236
3237
|
});
|
|
3237
3238
|
React__namespace.useImperativeHandle(ref, () => inputRef.current);
|
|
3239
|
+
// Check if dropdown is inside a modal
|
|
3240
|
+
React__namespace.useEffect(() => {
|
|
3241
|
+
if (isOpen && dropdownRef.current) {
|
|
3242
|
+
let element = dropdownRef.current;
|
|
3243
|
+
let foundModal = false;
|
|
3244
|
+
while (element && !foundModal) {
|
|
3245
|
+
const styles = window.getComputedStyle(element);
|
|
3246
|
+
const zIndex = parseInt(styles.zIndex, 10);
|
|
3247
|
+
// Check if element has modal z-index (10000) or is a modal container
|
|
3248
|
+
if (zIndex === 10000 || element.getAttribute('role') === 'dialog') {
|
|
3249
|
+
foundModal = true;
|
|
3250
|
+
setIsInsideModal(true);
|
|
3251
|
+
break;
|
|
3252
|
+
}
|
|
3253
|
+
element = element.parentElement;
|
|
3254
|
+
}
|
|
3255
|
+
if (!foundModal) {
|
|
3256
|
+
setIsInsideModal(false);
|
|
3257
|
+
}
|
|
3258
|
+
}
|
|
3259
|
+
}, [isOpen]);
|
|
3238
3260
|
// Update position when dropdown opens or window resizes
|
|
3239
3261
|
React__namespace.useEffect(() => {
|
|
3240
3262
|
if (isOpen && dropdownRef.current) {
|
|
@@ -3394,7 +3416,7 @@ const SearchableDropdown = React__namespace.forwardRef(({ className, items = [],
|
|
|
3394
3416
|
top: `${position.top + 8}px`,
|
|
3395
3417
|
left: `${position.left}px`,
|
|
3396
3418
|
width: dropdownWidth === "full" ? `${position.width}px` : "auto",
|
|
3397
|
-
zIndex: 9999,
|
|
3419
|
+
zIndex: isInsideModal ? 10001 : 9999,
|
|
3398
3420
|
}, children: jsxRuntime.jsx(DropdownMenu, { items: itemsWithHandlers, sectionHeading: sectionHeading, isLoading: isLoading, isEmpty: itemsWithAddNew.length === 0 && !showAddNew, emptyTitle: emptyTitle, emptyDescription: emptyDescription, emptyLinkText: emptyLinkText, onEmptyLinkClick: onEmptyLinkClick, primaryButtonText: primaryButtonText, secondaryButtonText: secondaryButtonText, onPrimaryClick: onPrimaryClick, onSecondaryClick: onSecondaryClick, showChevron: showChevron, emptyIcon: emptyIcon, disableFooter: disableFooter, showFooter: (primaryButtonText || secondaryButtonText) && !disableFooter
|
|
3399
3421
|
? true
|
|
3400
3422
|
: false, footerLayout: footerLayout, onClose: () => setIsOpen(false), focusedIndex: focusedIndex, className: dropdownClassName, width: dropdownWidth === "full" ? "full" : "auto" }) }));
|