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/index.esm.js CHANGED
@@ -2554,7 +2554,7 @@ const Modal = React.forwardRef(({ isOpen, onClose, title, description, footer, c
2554
2554
  if (!isOpen)
2555
2555
  return null;
2556
2556
  const hasHeader = title || description;
2557
- return (jsxs("div", { className: cn("fixed inset-0 z-50 flex items-center justify-center p-4", className), role: "dialog", "aria-modal": "true", "aria-label": ariaLabel || title, "aria-describedby": ariaDescribedBy, children: [jsx("div", { className: cn("absolute inset-0 bg-black/50 backdrop-blur-sm transition-opacity", overlayClassName), onClick: handleOverlayClick, "aria-hidden": "true" }), 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 && (jsxs("div", { className: cn("flex items-start justify-between gap-4 px-6 pt-6", !description && "pb-4", description && "pb-2", headerClassName), children: [jsxs("div", { className: "flex-1", children: [title && (jsx(Text, { as: "h2", variant: "body", size: "large", weight: "semibold", color: "default", children: title })), description && (jsx(Text, { as: "p", variant: "body", size: "small", weight: "regular", color: "subtle", className: "mt-1", children: description }))] }), showCloseButton && onClose && (jsx(IconButton, { icon: "close", onClick: onClose, color: "neutral", size: "small", "aria-label": "Close modal", className: "shrink-0" }))] })), !hasHeader && showCloseButton && onClose && (jsx("div", { className: "absolute top-4 right-4 z-10", children: jsx(IconButton, { icon: "close", onClick: onClose, color: "neutral", size: "small", "aria-label": "Close modal" }) })), 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 && (jsxs("div", { className: "flex flex-col", children: [jsx(Divider, { thickness: "thin", variant: "muted" }), jsx("div", { className: cn("flex items-center justify-end gap-3 px-6 py-4", footerClassName), children: footer })] }))] })] }));
2557
+ return (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: [jsx("div", { className: cn("absolute inset-0 bg-black/50 backdrop-blur-sm transition-opacity", overlayClassName), onClick: handleOverlayClick, "aria-hidden": "true" }), 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 && (jsxs("div", { className: cn("flex items-start justify-between gap-4 px-6 pt-6", !description && "pb-4", description && "pb-2", headerClassName), children: [jsxs("div", { className: "flex-1", children: [title && (jsx(Text, { as: "h2", variant: "body", size: "large", weight: "semibold", color: "default", children: title })), description && (jsx(Text, { as: "p", variant: "body", size: "small", weight: "regular", color: "subtle", className: "mt-1", children: description }))] }), showCloseButton && onClose && (jsx(IconButton, { icon: "close", onClick: onClose, color: "neutral", size: "small", "aria-label": "Close modal", className: "shrink-0" }))] })), !hasHeader && showCloseButton && onClose && (jsx("div", { className: "absolute top-4 right-4 z-10", children: jsx(IconButton, { icon: "close", onClick: onClose, color: "neutral", size: "small", "aria-label": "Close modal" }) })), 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 && (jsxs("div", { className: "flex flex-col", children: [jsx(Divider, { thickness: "thin", variant: "muted" }), jsx("div", { className: cn("flex items-center justify-end gap-3 px-6 py-4", footerClassName), children: footer })] }))] })] }));
2558
2558
  });
2559
2559
  Modal.displayName = "Modal";
2560
2560
 
@@ -3205,6 +3205,7 @@ const SearchableDropdown = React.forwardRef(({ className, items = [], sectionHea
3205
3205
  const [uncontrolledSearchValue, setUncontrolledSearchValue] = React.useState(defaultSearchValue);
3206
3206
  const [isOpen, setIsOpen] = React.useState(false);
3207
3207
  const [focusedIndex, setFocusedIndex] = React.useState(-1);
3208
+ const [isInsideModal, setIsInsideModal] = React.useState(false);
3208
3209
  const dropdownRef = React.useRef(null);
3209
3210
  const inputRef = React.useRef(null);
3210
3211
  const menuRef = React.useRef(null);
@@ -3214,6 +3215,27 @@ const SearchableDropdown = React.forwardRef(({ className, items = [], sectionHea
3214
3215
  width: 0,
3215
3216
  });
3216
3217
  React.useImperativeHandle(ref, () => inputRef.current);
3218
+ // Check if dropdown is inside a modal
3219
+ React.useEffect(() => {
3220
+ if (isOpen && dropdownRef.current) {
3221
+ let element = dropdownRef.current;
3222
+ let foundModal = false;
3223
+ while (element && !foundModal) {
3224
+ const styles = window.getComputedStyle(element);
3225
+ const zIndex = parseInt(styles.zIndex, 10);
3226
+ // Check if element has modal z-index (10000) or is a modal container
3227
+ if (zIndex === 10000 || element.getAttribute('role') === 'dialog') {
3228
+ foundModal = true;
3229
+ setIsInsideModal(true);
3230
+ break;
3231
+ }
3232
+ element = element.parentElement;
3233
+ }
3234
+ if (!foundModal) {
3235
+ setIsInsideModal(false);
3236
+ }
3237
+ }
3238
+ }, [isOpen]);
3217
3239
  // Update position when dropdown opens or window resizes
3218
3240
  React.useEffect(() => {
3219
3241
  if (isOpen && dropdownRef.current) {
@@ -3373,7 +3395,7 @@ const SearchableDropdown = React.forwardRef(({ className, items = [], sectionHea
3373
3395
  top: `${position.top + 8}px`,
3374
3396
  left: `${position.left}px`,
3375
3397
  width: dropdownWidth === "full" ? `${position.width}px` : "auto",
3376
- zIndex: 9999,
3398
+ zIndex: isInsideModal ? 10001 : 9999,
3377
3399
  }, children: 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
3378
3400
  ? true
3379
3401
  : false, footerLayout: footerLayout, onClose: () => setIsOpen(false), focusedIndex: focusedIndex, className: dropdownClassName, width: dropdownWidth === "full" ? "full" : "auto" }) }));