yet-another-react-lightbox 3.17.4 → 3.18.0

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.d.ts CHANGED
@@ -36,6 +36,7 @@ declare function getSlideIndex(index: number, slidesCount: number): number;
36
36
  declare function hasSlides(slides: Slide[]): slides is [Slide, ...Slide[]];
37
37
  declare function getSlide(slides: [Slide, ...Slide[]], index: number): SlideImage;
38
38
  declare function getSlideIfPresent(slides: Slide[], index: number): SlideImage | undefined;
39
+ declare function getSlideKey(slide: Slide): string | undefined;
39
40
  declare function addToolbarButton(toolbar: ToolbarSettings, key: string, button: React.ReactNode): ToolbarSettings;
40
41
  declare function stopNavigationEventsPropagation(): {
41
42
  onPointerDown: (event: React.PointerEvent | React.KeyboardEvent | React.WheelEvent) => void;
@@ -265,4 +266,4 @@ declare const RootModule: Module;
265
266
  declare function Toolbar({ toolbar: { buttons }, render: { buttonClose, iconClose }, styles }: ComponentProps): React.JSX.Element;
266
267
  declare const ToolbarModule: Module;
267
268
 
268
- export { Augmentation, Callback, Carousel, CarouselModule, CarouselSettings, CloseIcon, Component, ComponentProps, type ComputeAnimation, ContainerRect, Controller, ControllerContext, type ControllerContextType, ControllerModule, ControllerRef, ControllerSettings, ErrorIcon, type Event, type EventCallback, EventTypes, EventsContext, type EventsContextType, EventsProvider, IconButton, type IconButtonProps, ImageSlide, type ImageSlideProps, type KeyboardEventType, Labels, LengthOrPercentage, Lightbox, LightboxDefaultProps, LightboxDispatchContext, type LightboxDispatchContextType, LightboxExternalProps, LightboxProps, LightboxPropsContext, type LightboxPropsContextType, LightboxPropsProvider, LightboxState, type LightboxStateAction, LightboxStateContext, type LightboxStateContextType, LightboxStateProvider, type LightboxStateProviderProps, LightboxStateSwipeAction, LightboxStateUpdateAction, LoadingIcon, Module, Navigation, NavigationButton, type NavigationButtonProps, NavigationModule, NextIcon, NoScroll, NoScrollModule, Node, Plugin, type PointerEventType, Portal, PortalModule, PreviousIcon, type Publish, type ReactEventType, type RegisterSensors, Render, RenderFunction, Root, RootModule, type SensorCallback, Slide, SlideImage, type Subscribe, type SubscribeSensors, type SupportedEventType, SwipeState, TimeoutsContext, type TimeoutsContextType, TimeoutsProvider, Toolbar, ToolbarModule, ToolbarSettings, type Topic, type Unsubscribe, type UseSensors, type WheelEventType, addToolbarButton, calculatePreload, cleanup, clsx, composePrefix, computeSlideRect, createIcon, createIconDisabled, createModule, createNode, cssClass, cssVar, Lightbox as default, devicePixelRatio, getSlide, getSlideIfPresent, getSlideIndex, hasSlides, hasWindow, isImageFitCover, isImageSlide, label, makeComposePrefix, makeUseContext, parseInt, parseLengthPercentage, round, setRef, stopNavigationEventsPropagation, useAnimation, useContainerRect, useController, useDelay, useEventCallback, useEvents, useForkRef, useKeyboardNavigation, useLayoutEffect, useLightboxDispatch, useLightboxProps, useLightboxState, useLoseFocus, useMotionPreference, useNavigationState, usePointerSwipe, usePreventWheelDefaults, useRTL, useSensors, useThrottle, useTimeouts, useWheelSwipe, withPlugins };
269
+ export { Augmentation, Callback, Carousel, CarouselModule, CarouselSettings, CloseIcon, Component, ComponentProps, type ComputeAnimation, ContainerRect, Controller, ControllerContext, type ControllerContextType, ControllerModule, ControllerRef, ControllerSettings, ErrorIcon, type Event, type EventCallback, EventTypes, EventsContext, type EventsContextType, EventsProvider, IconButton, type IconButtonProps, ImageSlide, type ImageSlideProps, type KeyboardEventType, Labels, LengthOrPercentage, Lightbox, LightboxDefaultProps, LightboxDispatchContext, type LightboxDispatchContextType, LightboxExternalProps, LightboxProps, LightboxPropsContext, type LightboxPropsContextType, LightboxPropsProvider, LightboxState, type LightboxStateAction, LightboxStateContext, type LightboxStateContextType, LightboxStateProvider, type LightboxStateProviderProps, LightboxStateSwipeAction, LightboxStateUpdateAction, LoadingIcon, Module, Navigation, NavigationButton, type NavigationButtonProps, NavigationModule, NextIcon, NoScroll, NoScrollModule, Node, Plugin, type PointerEventType, Portal, PortalModule, PreviousIcon, type Publish, type ReactEventType, type RegisterSensors, Render, RenderFunction, Root, RootModule, type SensorCallback, Slide, SlideImage, type Subscribe, type SubscribeSensors, type SupportedEventType, SwipeState, TimeoutsContext, type TimeoutsContextType, TimeoutsProvider, Toolbar, ToolbarModule, ToolbarSettings, type Topic, type Unsubscribe, type UseSensors, type WheelEventType, addToolbarButton, calculatePreload, cleanup, clsx, composePrefix, computeSlideRect, createIcon, createIconDisabled, createModule, createNode, cssClass, cssVar, Lightbox as default, devicePixelRatio, getSlide, getSlideIfPresent, getSlideIndex, getSlideKey, hasSlides, hasWindow, isImageFitCover, isImageSlide, label, makeComposePrefix, makeUseContext, parseInt, parseLengthPercentage, round, setRef, stopNavigationEventsPropagation, useAnimation, useContainerRect, useController, useDelay, useEventCallback, useEvents, useForkRef, useKeyboardNavigation, useLayoutEffect, useLightboxDispatch, useLightboxProps, useLightboxState, useLoseFocus, useMotionPreference, useNavigationState, usePointerSwipe, usePreventWheelDefaults, useRTL, useSensors, useThrottle, useTimeouts, useWheelSwipe, withPlugins };
package/dist/index.js CHANGED
@@ -89,6 +89,9 @@ function getSlide(slides, index) {
89
89
  function getSlideIfPresent(slides, index) {
90
90
  return hasSlides(slides) ? getSlide(slides, index) : undefined;
91
91
  }
92
+ function getSlideKey(slide) {
93
+ return isImageSlide(slide) ? slide.src : undefined;
94
+ }
92
95
  function addToolbarButton(toolbar, key, button) {
93
96
  if (!button)
94
97
  return toolbar;
@@ -1217,17 +1220,20 @@ function Carousel({ carousel }) {
1217
1220
  const { setCarouselRef } = useController();
1218
1221
  const spacingValue = parseLengthPercentage(carousel.spacing);
1219
1222
  const paddingValue = parseLengthPercentage(carousel.padding);
1220
- const items = [];
1221
1223
  const preload = calculatePreload(carousel, slides, 1);
1224
+ const items = [];
1222
1225
  if (hasSlides(slides)) {
1223
- for (let i = currentIndex - preload; i < currentIndex; i += 1) {
1224
- const key = globalIndex + i - currentIndex;
1225
- items.push(!carousel.finite || i >= 0 ? (React.createElement(CarouselSlide, { key: key, slide: slides[(i + preload * slides.length) % slides.length], offset: i - currentIndex })) : (React.createElement(Placeholder, { key: key })));
1226
- }
1227
- items.push(React.createElement(CarouselSlide, { key: globalIndex, slide: slides[currentIndex], offset: 0 }));
1228
- for (let i = currentIndex + 1; i <= currentIndex + preload; i += 1) {
1229
- const key = globalIndex + i - currentIndex;
1230
- items.push(!carousel.finite || i <= slides.length - 1 ? (React.createElement(CarouselSlide, { key: key, slide: slides[i % slides.length], offset: i - currentIndex })) : (React.createElement(Placeholder, { key: key })));
1226
+ for (let index = currentIndex - preload; index <= currentIndex + preload; index += 1) {
1227
+ const slide = getSlide(slides, index);
1228
+ const key = globalIndex - currentIndex + index;
1229
+ const placeholder = carousel.finite && (index < 0 || index > slides.length - 1);
1230
+ items.push(!placeholder
1231
+ ? {
1232
+ key: [`${key}`, getSlideKey(slide)].filter(Boolean).join("|"),
1233
+ offset: index - currentIndex,
1234
+ slide,
1235
+ }
1236
+ : { key });
1231
1237
  }
1232
1238
  }
1233
1239
  return (React.createElement("div", { ref: setCarouselRef, className: clsx(cssClass(cssPrefix$2()), items.length > 0 && cssClass(cssPrefix$2("with_slides"))), style: {
@@ -1236,7 +1242,7 @@ function Carousel({ carousel }) {
1236
1242
  [`${cssVar(cssPrefix$2("spacing_percent"))}`]: spacingValue.percent || 0,
1237
1243
  [`${cssVar(cssPrefix$2("padding_px"))}`]: paddingValue.pixel || 0,
1238
1244
  [`${cssVar(cssPrefix$2("padding_percent"))}`]: paddingValue.percent || 0,
1239
- } }, items));
1245
+ } }, items.map(({ key, slide, offset }) => slide ? React.createElement(CarouselSlide, { key: key, slide: slide, offset: offset }) : React.createElement(Placeholder, { key: key }))));
1240
1246
  }
1241
1247
  const CarouselModule = createModule(MODULE_CAROUSEL, Carousel);
1242
1248
 
@@ -1502,4 +1508,4 @@ function Lightbox({ carousel, animation, render, toolbar, controller, noScroll,
1502
1508
  React.createElement(EventsProvider, null, renderNode(createNode(RootModule, config), props))))));
1503
1509
  }
1504
1510
 
1505
- export { ACTION_CLOSE, ACTION_NEXT, ACTION_PREV, ACTION_SWIPE, CLASS_FLEX_CENTER, CLASS_NO_SCROLL, CLASS_NO_SCROLL_PADDING, CLASS_SLIDE_WRAPPER, Carousel, CarouselModule, CloseIcon, Controller, ControllerContext, ControllerModule, ELEMENT_BUTTON, ELEMENT_ICON, EVENT_ON_KEY_DOWN, EVENT_ON_KEY_UP, EVENT_ON_POINTER_CANCEL, EVENT_ON_POINTER_DOWN, EVENT_ON_POINTER_LEAVE, EVENT_ON_POINTER_MOVE, EVENT_ON_POINTER_UP, EVENT_ON_WHEEL, ErrorIcon, EventsContext, EventsProvider, IMAGE_FIT_CONTAIN, IMAGE_FIT_COVER, IconButton, ImageSlide, Lightbox, LightboxDefaultProps, LightboxDispatchContext, LightboxPropsContext, LightboxPropsProvider, LightboxStateContext, LightboxStateProvider, LoadingIcon, MODULE_CAROUSEL, MODULE_CONTROLLER, MODULE_NAVIGATION, MODULE_NO_SCROLL, MODULE_PORTAL, MODULE_ROOT, MODULE_TOOLBAR, Navigation, NavigationButton, NavigationModule, NextIcon, NoScroll, NoScrollModule, Portal, PortalModule, PreviousIcon, Root, RootModule, SLIDE_STATUS_COMPLETE, SLIDE_STATUS_ERROR, SLIDE_STATUS_LOADING, SLIDE_STATUS_PLACEHOLDER, SwipeState, TimeoutsContext, TimeoutsProvider, Toolbar, ToolbarModule, UNKNOWN_ACTION_TYPE, VK_ARROW_LEFT, VK_ARROW_RIGHT, VK_ESCAPE, activeSlideStatus, addToolbarButton, calculatePreload, cleanup, clsx, composePrefix, computeSlideRect, createIcon, createIconDisabled, createModule, createNode, cssClass, cssVar, Lightbox as default, devicePixelRatio, getSlide, getSlideIfPresent, getSlideIndex, hasSlides, hasWindow, isImageFitCover, isImageSlide, label, makeComposePrefix, makeUseContext, parseInt, parseLengthPercentage, round, setRef, stopNavigationEventsPropagation, useAnimation, useContainerRect, useController, useDelay, useEventCallback, useEvents, useForkRef, useKeyboardNavigation, useLayoutEffect, useLightboxDispatch, useLightboxProps, useLightboxState, useLoseFocus, useMotionPreference, useNavigationState, usePointerEvents, usePointerSwipe, usePreventWheelDefaults, useRTL, useSensors, useThrottle, useTimeouts, useWheelSwipe, withPlugins };
1511
+ export { ACTION_CLOSE, ACTION_NEXT, ACTION_PREV, ACTION_SWIPE, CLASS_FLEX_CENTER, CLASS_NO_SCROLL, CLASS_NO_SCROLL_PADDING, CLASS_SLIDE_WRAPPER, Carousel, CarouselModule, CloseIcon, Controller, ControllerContext, ControllerModule, ELEMENT_BUTTON, ELEMENT_ICON, EVENT_ON_KEY_DOWN, EVENT_ON_KEY_UP, EVENT_ON_POINTER_CANCEL, EVENT_ON_POINTER_DOWN, EVENT_ON_POINTER_LEAVE, EVENT_ON_POINTER_MOVE, EVENT_ON_POINTER_UP, EVENT_ON_WHEEL, ErrorIcon, EventsContext, EventsProvider, IMAGE_FIT_CONTAIN, IMAGE_FIT_COVER, IconButton, ImageSlide, Lightbox, LightboxDefaultProps, LightboxDispatchContext, LightboxPropsContext, LightboxPropsProvider, LightboxStateContext, LightboxStateProvider, LoadingIcon, MODULE_CAROUSEL, MODULE_CONTROLLER, MODULE_NAVIGATION, MODULE_NO_SCROLL, MODULE_PORTAL, MODULE_ROOT, MODULE_TOOLBAR, Navigation, NavigationButton, NavigationModule, NextIcon, NoScroll, NoScrollModule, Portal, PortalModule, PreviousIcon, Root, RootModule, SLIDE_STATUS_COMPLETE, SLIDE_STATUS_ERROR, SLIDE_STATUS_LOADING, SLIDE_STATUS_PLACEHOLDER, SwipeState, TimeoutsContext, TimeoutsProvider, Toolbar, ToolbarModule, UNKNOWN_ACTION_TYPE, VK_ARROW_LEFT, VK_ARROW_RIGHT, VK_ESCAPE, activeSlideStatus, addToolbarButton, calculatePreload, cleanup, clsx, composePrefix, computeSlideRect, createIcon, createIconDisabled, createModule, createNode, cssClass, cssVar, Lightbox as default, devicePixelRatio, getSlide, getSlideIfPresent, getSlideIndex, getSlideKey, hasSlides, hasWindow, isImageFitCover, isImageSlide, label, makeComposePrefix, makeUseContext, parseInt, parseLengthPercentage, round, setRef, stopNavigationEventsPropagation, useAnimation, useContainerRect, useController, useDelay, useEventCallback, useEvents, useForkRef, useKeyboardNavigation, useLayoutEffect, useLightboxDispatch, useLightboxProps, useLightboxState, useLoseFocus, useMotionPreference, useNavigationState, usePointerEvents, usePointerSwipe, usePreventWheelDefaults, useRTL, useSensors, useThrottle, useTimeouts, useWheelSwipe, withPlugins };
@@ -1,4 +1,4 @@
1
- import { useLightboxProps, composePrefix, createIcon, cssClass, isImageSlide, ImageSlide, makeComposePrefix, useEventCallback, clsx, cssVar, useRTL, useEvents, useLightboxState, useSensors, useKeyboardNavigation, useAnimation, cleanup, calculatePreload, hasSlides, getSlide, makeUseContext, LightboxPropsProvider, createIconDisabled, IconButton, addToolbarButton, createModule } from '../../index.js';
1
+ import { useLightboxProps, composePrefix, createIcon, cssClass, isImageSlide, ImageSlide, makeComposePrefix, useEventCallback, clsx, cssVar, useRTL, useEvents, useLightboxState, useSensors, useKeyboardNavigation, useAnimation, cleanup, calculatePreload, hasSlides, getSlide, getSlideKey, makeUseContext, LightboxPropsProvider, createIconDisabled, IconButton, addToolbarButton, createModule } from '../../index.js';
2
2
  import * as React from 'react';
3
3
  import { PLUGIN_THUMBNAILS, ELEMENT_ICON, CLASS_FLEX_CENTER, ACTION_SWIPE, ACTION_NEXT, ACTION_PREV, PLUGIN_FULLSCREEN, MODULE_CONTROLLER } from '../../types.js';
4
4
 
@@ -40,7 +40,7 @@ function renderThumbnail({ slide, render, rect, imageFit }) {
40
40
  }
41
41
  if (slide.type === "video") {
42
42
  return (React.createElement(React.Fragment, null,
43
- slide.poster && React.createElement(ImageSlide, { slide: { src: slide.poster }, render: render, rect: rect, imageFit: imageFit }),
43
+ slide.poster && (React.createElement(ImageSlide, { key: slide.poster, slide: { src: slide.poster }, render: render, rect: rect, imageFit: imageFit })),
44
44
  React.createElement(VideoThumbnailIcon, { className: thumbnailIconClass })));
45
45
  }
46
46
  return React.createElement(UnknownThumbnailIcon, { className: thumbnailIconClass });
@@ -95,7 +95,6 @@ function ThumbnailsTrack({ visible, containerRef }) {
95
95
  useKeyboardNavigation(subscribeSensors);
96
96
  const thumbnails = useThumbnailsProps();
97
97
  const { position, width, height, border, borderStyle, borderColor, borderRadius, padding, gap, vignette } = thumbnails;
98
- const index = globalIndex;
99
98
  const animationDuration = (animation === null || animation === void 0 ? void 0 : animation.duration) || 0;
100
99
  const offset = (animationDuration > 0 && (animation === null || animation === void 0 ? void 0 : animation.increment)) || 0;
101
100
  const { prepareAnimation } = useAnimation(track, (snapshot) => ({
@@ -130,40 +129,21 @@ function ThumbnailsTrack({ visible, containerRef }) {
130
129
  const preload = calculatePreload(carousel, slides);
131
130
  const items = [];
132
131
  if (hasSlides(slides)) {
133
- if (offset < 0) {
134
- for (let i = index - preload + offset; i < index - preload; i += 1) {
135
- items.push({ slide: null, index: i, placeholder: true });
136
- }
137
- }
138
- for (let i = index - preload - Math.max(offset, 0); i < index; i += 1) {
139
- if (!(carousel.finite && i < 0)) {
140
- items.push({ slide: getSlide(slides, i), index: i });
141
- }
142
- else {
143
- items.push({ slide: null, index: i, placeholder: true });
144
- }
145
- }
146
- items.push({ slide: getSlide(slides, index), index });
147
- for (let i = index + 1; i <= index + preload - Math.min(offset, 0); i += 1) {
148
- if (!carousel.finite || i <= slides.length - 1) {
149
- items.push({ slide: getSlide(slides, i), index: i });
150
- }
151
- else {
152
- items.push({ slide: null, index: i, placeholder: true });
153
- }
154
- }
155
- if (offset > 0) {
156
- for (let i = index + preload + 1; i <= index + preload + offset; i += 1) {
157
- items.push({ slide: null, index: i, placeholder: true });
158
- }
132
+ for (let index = globalIndex - preload - Math.abs(offset); index <= globalIndex + preload + Math.abs(offset); index += 1) {
133
+ const placeholder = (carousel.finite && (index < 0 || index > slides.length - 1)) ||
134
+ (offset < 0 && index < globalIndex - preload) ||
135
+ (offset > 0 && index > globalIndex + preload);
136
+ const slide = !placeholder ? getSlide(slides, index) : null;
137
+ const key = [`${index}`, slide ? getSlideKey(slide) : "placeholder"].filter(Boolean).join("|");
138
+ items.push({ key, index, slide });
159
139
  }
160
140
  }
161
141
  const handleClick = (slideIndex) => () => {
162
- if (slideIndex > index) {
163
- publish(ACTION_NEXT, { count: slideIndex - index });
142
+ if (slideIndex > globalIndex) {
143
+ publish(ACTION_NEXT, { count: slideIndex - globalIndex });
164
144
  }
165
- else if (slideIndex < index) {
166
- publish(ACTION_PREV, { count: index - slideIndex });
145
+ else if (slideIndex < globalIndex) {
146
+ publish(ACTION_PREV, { count: globalIndex - slideIndex });
167
147
  }
168
148
  };
169
149
  return (React.createElement("div", { className: clsx(cssClass(cssPrefix("container")), cssClass(CLASS_FLEX_CENTER)), style: {
@@ -186,26 +166,26 @@ function ThumbnailsTrack({ visible, containerRef }) {
186
166
  ...(gap !== defaultThumbnailsProps.gap ? { [cssVar(cssThumbnailPrefix("gap"))]: `${gap}px` } : null),
187
167
  ...styles.thumbnailsContainer,
188
168
  } },
189
- React.createElement("nav", { ref: track, style: styles.thumbnailsTrack, className: clsx(cssClass(cssPrefix("track")), cssClass(CLASS_FLEX_CENTER)), tabIndex: -1, ...registerSensors }, items.map(({ slide, index: slideIndex, placeholder }) => {
169
+ React.createElement("nav", { ref: track, style: styles.thumbnailsTrack, className: clsx(cssClass(cssPrefix("track")), cssClass(CLASS_FLEX_CENTER)), tabIndex: -1, ...registerSensors }, items.map(({ key, index, slide }) => {
190
170
  const fadeAnimationDuration = animationDuration / Math.abs(offset || 1);
191
- const fadeIn = (offset > 0 && slideIndex > index + preload - offset && slideIndex <= index + preload) ||
192
- (offset < 0 && slideIndex < index - preload - offset && slideIndex >= index - preload)
171
+ const fadeIn = (offset > 0 && index > globalIndex + preload - offset && index <= globalIndex + preload) ||
172
+ (offset < 0 && index < globalIndex - preload - offset && index >= globalIndex - preload)
193
173
  ? {
194
174
  duration: fadeAnimationDuration,
195
- delay: ((offset > 0 ? slideIndex - (index + preload - offset) : index - preload - offset - slideIndex) -
175
+ delay: ((offset > 0 ? index - (globalIndex + preload - offset) : globalIndex - preload - offset - index) -
196
176
  1) *
197
177
  fadeAnimationDuration,
198
178
  }
199
179
  : undefined;
200
- const fadeOut = (offset > 0 && slideIndex < index - preload) || (offset < 0 && slideIndex > index + preload)
180
+ const fadeOut = (offset > 0 && index < globalIndex - preload) || (offset < 0 && index > globalIndex + preload)
201
181
  ? {
202
182
  duration: fadeAnimationDuration,
203
183
  delay: (offset > 0
204
- ? offset - (index - preload - slideIndex)
205
- : -offset - (slideIndex - (index + preload))) * fadeAnimationDuration,
184
+ ? offset - (globalIndex - preload - index)
185
+ : -offset - (index - (globalIndex + preload))) * fadeAnimationDuration,
206
186
  }
207
187
  : undefined;
208
- return (React.createElement(Thumbnail, { key: [`${slideIndex}`, placeholder && "placeholder"].filter(Boolean).join("-"), slide: slide, active: slideIndex === index, fadeIn: fadeIn, fadeOut: fadeOut, placeholder: Boolean(placeholder), onClick: handleClick(slideIndex), onLoseFocus: () => { var _a; return (_a = track.current) === null || _a === void 0 ? void 0 : _a.focus(); } }));
188
+ return (React.createElement(Thumbnail, { key: key, slide: slide, active: index === globalIndex, fadeIn: fadeIn, fadeOut: fadeOut, placeholder: !slide, onClick: handleClick(index), onLoseFocus: () => { var _a; return (_a = track.current) === null || _a === void 0 ? void 0 : _a.focus(); } }));
209
189
  })),
210
190
  vignette && React.createElement("div", { className: cssClass(cssPrefix("vignette")) })));
211
191
  }
@@ -1,4 +1,4 @@
1
- import { PluginProps, GenericSlide } from '../../types.js';
1
+ import { PluginProps } from '../../types.js';
2
2
 
3
3
  /** Video plugin */
4
4
  declare function Video({ augment }: PluginProps): void;
@@ -44,6 +44,8 @@ declare module "yet-another-react-lightbox" {
44
44
  src: string;
45
45
  /** video source type (e.g., `video/mp4`) */
46
46
  type: string;
47
+ /** media query for the resource's intended media (e.g., `(min-width: 800px)`) */
48
+ media?: string;
47
49
  }[];
48
50
  }
49
51
  interface LightboxProps {
@@ -82,7 +82,7 @@ function VideoSlide({ slide, offset }) {
82
82
  publish(ACTIVE_SLIDE_PLAYING);
83
83
  }, onEnded: () => {
84
84
  publish(ACTIVE_SLIDE_COMPLETE);
85
- } }, sources.map(({ src, type }, index) => (React.createElement("source", { key: index, src: src, type: type })))))))));
85
+ } }, sources.map(({ src, type, media }) => (React.createElement("source", { key: [src, type, media].filter(Boolean).join("|"), src: src, type: type, media: media })))))))));
86
86
  }
87
87
 
88
88
  function isVideoSlide(slide) {
@@ -93,10 +93,7 @@ function Video({ augment }) {
93
93
  render: {
94
94
  slide: ({ slide, offset, rect }) => {
95
95
  var _a;
96
- if (isVideoSlide(slide)) {
97
- return (React.createElement(VideoSlide, { key: (_a = slide.sources) === null || _a === void 0 ? void 0 : _a.map((source) => source.src).join(" "), slide: slide, offset: offset }));
98
- }
99
- return renderSlide === null || renderSlide === void 0 ? void 0 : renderSlide({ slide, offset, rect });
96
+ return isVideoSlide(slide) ? (React.createElement(VideoSlide, { key: (_a = slide.sources) === null || _a === void 0 ? void 0 : _a.map((source) => source.src).join("|"), slide: slide, offset: offset })) : (renderSlide === null || renderSlide === void 0 ? void 0 : renderSlide({ slide, offset, rect }));
100
97
  },
101
98
  ...restRender,
102
99
  },
@@ -462,7 +462,7 @@ function ZoomWrapper({ render, slide, offset, rect }) {
462
462
  imageProps: carousel.imageProps,
463
463
  onClick: offset === 0 ? () => { var _a; return (_a = on.click) === null || _a === void 0 ? void 0 : _a.call(on, { index: currentIndex }); } : undefined,
464
464
  };
465
- rendered = isResponsiveImageSlide(slide) ? (React.createElement(ResponsiveImage, { key: slide.src, ...slideProps, slide: slide, rect: offset === 0 ? { width: rect.width * zoom, height: rect.height * zoom } : rect })) : (React.createElement(ImageSlide, { key: slide.src, onLoad: (img) => setImageDimensions({ width: img.naturalWidth, height: img.naturalHeight }), ...slideProps }));
465
+ rendered = isResponsiveImageSlide(slide) ? (React.createElement(ResponsiveImage, { ...slideProps, slide: slide, rect: offset === 0 ? { width: rect.width * zoom, height: rect.height * zoom } : rect })) : (React.createElement(ImageSlide, { onLoad: (img) => setImageDimensions({ width: img.naturalWidth, height: img.naturalHeight }), ...slideProps }));
466
466
  }
467
467
  if (!rendered)
468
468
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yet-another-react-lightbox",
3
- "version": "3.17.4",
3
+ "version": "3.18.0",
4
4
  "description": "Modern React lightbox component",
5
5
  "author": "Igor Danchenko",
6
6
  "license": "MIT",