@lumx/react 3.8.2-alpha.0 → 3.8.2-alpha.1

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/index.js CHANGED
@@ -8519,6 +8519,14 @@ const Inner = /*#__PURE__*/forwardRef((props, ref) => {
8519
8519
  const footerRef = React.useRef(null);
8520
8520
  const imageRef = React.useRef(null);
8521
8521
  const clickAwayChildrenRefs = React.useRef([imageRef, footerRef]);
8522
+ const onClickAway = React.useCallback(evt => {
8523
+ const targetElement = evt.target;
8524
+ if (!(targetElement instanceof HTMLElement) || !(evt instanceof MouseEvent)) return;
8525
+
8526
+ // Skip click away if clicking on the scrollbar
8527
+ if (targetElement.clientWidth < evt.clientX || targetElement.clientHeight < evt.clientY) return;
8528
+ onClose === null || onClose === void 0 ? void 0 : onClose();
8529
+ }, [onClose]);
8522
8530
  return /*#__PURE__*/React.createElement(Lightbox, _extends({
8523
8531
  ref: ref,
8524
8532
  className: classnames(className, CLASSNAME$v),
@@ -8529,7 +8537,7 @@ const Inner = /*#__PURE__*/forwardRef((props, ref) => {
8529
8537
  focusElement: currentPaginationItemRef
8530
8538
  }, forwardedProps), /*#__PURE__*/React.createElement(ClickAwayProvider, {
8531
8539
  childrenRefs: clickAwayChildrenRefs,
8532
- callback: onClose
8540
+ callback: onClickAway
8533
8541
  }, /*#__PURE__*/React.createElement(ImageSlideshow, {
8534
8542
  activeImageIndex: activeImageIndex,
8535
8543
  slideGroupLabel: slideGroupLabel,
@@ -8538,7 +8546,7 @@ const Inner = /*#__PURE__*/forwardRef((props, ref) => {
8538
8546
  zoomInButtonProps: zoomInButtonProps,
8539
8547
  zoomOutButtonProps: zoomOutButtonProps,
8540
8548
  footerRef: footerRef,
8541
- activeImageRef: mergeRefs(propImageRef, imageRef),
8549
+ activeImageRef: useMergeRefs(propImageRef, imageRef),
8542
8550
  currentPaginationItemRef: currentPaginationItemRef
8543
8551
  })));
8544
8552
  });