@lumx/react 3.7.6-alpha.4 → 3.7.6-alpha.6
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
|
@@ -8225,7 +8225,16 @@ const ImageSlideshow = _ref => {
|
|
|
8225
8225
|
icon: mdiMagnifyMinusOutline,
|
|
8226
8226
|
onClick: zoomOut
|
|
8227
8227
|
})));
|
|
8228
|
-
const getImgRef = React.useMemo(() => memoize(
|
|
8228
|
+
const getImgRef = React.useMemo(() => memoize((index, isActive) => {
|
|
8229
|
+
return mergeRefs(images === null || images === void 0 ? void 0 : images[index].imgRef, isActive ? activeImageRef : undefined);
|
|
8230
|
+
},
|
|
8231
|
+
// memoize based on both arguments
|
|
8232
|
+
function () {
|
|
8233
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
8234
|
+
args[_key] = arguments[_key];
|
|
8235
|
+
}
|
|
8236
|
+
return args.join();
|
|
8237
|
+
}), [images, activeImageRef]);
|
|
8229
8238
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Slides, {
|
|
8230
8239
|
activeIndex: activeIndex,
|
|
8231
8240
|
theme: "dark",
|
|
@@ -8247,7 +8256,7 @@ const ImageSlideshow = _ref => {
|
|
|
8247
8256
|
key: image,
|
|
8248
8257
|
image: _objectSpread2(_objectSpread2({}, imageProps), {}, {
|
|
8249
8258
|
image,
|
|
8250
|
-
imgRef: getImgRef(index)
|
|
8259
|
+
imgRef: getImgRef(index, isActive)
|
|
8251
8260
|
}),
|
|
8252
8261
|
scale: isActive ? scale : undefined,
|
|
8253
8262
|
onScaleChange: onScaleChange
|
|
@@ -8317,7 +8326,7 @@ async function startViewTransition(_ref) {
|
|
|
8317
8326
|
}
|
|
8318
8327
|
|
|
8319
8328
|
/** Find image in element including the element */
|
|
8320
|
-
const findImage = element => element !== null && element !== void 0 && element.matches('img') ? element : element === null || element === void 0 ? void 0 : element.querySelector('img');
|
|
8329
|
+
const findImage = element => element !== null && element !== void 0 && element.matches('img') ? element : (element === null || element === void 0 ? void 0 : element.querySelector('img')) || null;
|
|
8321
8330
|
|
|
8322
8331
|
const _excluded$A = ["images"];
|
|
8323
8332
|
|
|
@@ -8433,10 +8442,12 @@ function useImageLightbox(initialProps) {
|
|
|
8433
8442
|
}
|
|
8434
8443
|
return memoize(options => ({
|
|
8435
8444
|
ref(element) {
|
|
8436
|
-
|
|
8437
|
-
if ((options === null || options === void 0 ? void 0 : options.activeImageIndex) !== undefined &&
|
|
8438
|
-
|
|
8439
|
-
|
|
8445
|
+
// Track trigger image ref if any
|
|
8446
|
+
if ((options === null || options === void 0 ? void 0 : options.activeImageIndex) !== undefined && element) {
|
|
8447
|
+
triggerImageRefs[options.activeImageIndex] = {
|
|
8448
|
+
current: findImage(element)
|
|
8449
|
+
};
|
|
8450
|
+
}
|
|
8440
8451
|
},
|
|
8441
8452
|
onClick(e) {
|
|
8442
8453
|
openLightbox(e.target, options);
|