infinity-ui-elements 1.8.21 → 1.8.23

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.js CHANGED
@@ -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" }) }));