yet-another-react-lightbox 3.21.7 → 3.21.9

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/README.md CHANGED
@@ -24,7 +24,7 @@ extendable.
24
24
  - **TypeScript:** type definitions come built-in in the package
25
25
  - **RTL:** compatible with RTL layout
26
26
 
27
- ![Yet Another React Lightbox | Example](https://yet-another-react-lightbox.com/images/example.jpg)
27
+ ![Yet Another React Lightbox | Example](https://images.yet-another-react-lightbox.com/example.jpg)
28
28
 
29
29
  ## Documentation
30
30
 
package/dist/index.d.ts CHANGED
@@ -45,7 +45,7 @@ declare function stopNavigationEventsPropagation(): {
45
45
  };
46
46
  declare function calculatePreload(carousel: CarouselSettings, slides: Slide[], minimum?: number): number;
47
47
  declare function makeInertWhen(condition: boolean): {
48
- inert: string | boolean | undefined;
48
+ inert: boolean;
49
49
  };
50
50
 
51
51
  declare function createModule(name: string, component: Component): Module;
@@ -72,7 +72,7 @@ declare function useAnimation<T>(nodeRef: React.RefObject<HTMLElement | null>, c
72
72
 
73
73
  declare function useContainerRect<T extends HTMLElement = HTMLElement>(): {
74
74
  setContainerRef: (node: T | null) => void;
75
- containerRef: React.MutableRefObject<T | null>;
75
+ containerRef: React.RefObject<T | null>;
76
76
  containerRect: ContainerRect | undefined;
77
77
  };
78
78
 
@@ -83,7 +83,7 @@ declare function useEventCallback<Args extends unknown[], Return>(fn: (...args:
83
83
  declare function setRef<T>(ref: React.MutableRefObject<T | null> | ((instance: T | null) => void) | null | undefined, value: T | null): void;
84
84
  declare function useForkRef<InstanceA, InstanceB>(refA: React.Ref<InstanceA> | null | undefined, refB: React.Ref<InstanceB> | null | undefined): React.Ref<InstanceA & InstanceB> | null;
85
85
 
86
- declare const useLayoutEffect: typeof React.useEffect;
86
+ declare const useLayoutEffect: typeof React.useLayoutEffect;
87
87
 
88
88
  declare function useLoseFocus(focus: () => void, disabled?: boolean): {
89
89
  onFocus: () => void;
@@ -108,7 +108,7 @@ type UseSensors<T extends Element> = {
108
108
  };
109
109
  declare function useSensors<T extends Element>(): UseSensors<T>;
110
110
 
111
- declare function useThrottle(callback: (...args: any[]) => void, delay: number): (...args: any[]) => void;
111
+ declare function useThrottle(callback: (...args: unknown[]) => void, delay: number): (...args: unknown[]) => void;
112
112
 
113
113
  type DocumentContextType = {
114
114
  getOwnerDocument: (node?: Node | null) => Document;
@@ -117,7 +117,7 @@ type DocumentContextType = {
117
117
  declare const DocumentContext: React.Context<DocumentContextType | null>;
118
118
  declare const useDocumentContext: () => DocumentContextType;
119
119
  type DocumentContextProviderProps = React.PropsWithChildren & {
120
- nodeRef: React.RefObject<Node>;
120
+ nodeRef: React.RefObject<Node | null>;
121
121
  };
122
122
  declare function DocumentContextProvider({ nodeRef, children }: DocumentContextProviderProps): React.JSX.Element;
123
123
 
@@ -241,7 +241,7 @@ type ControllerContextType = Pick<ControllerRef, "prev" | "next" | "close"> & {
241
241
  slideRect: ContainerRect;
242
242
  containerRect: ContainerRect;
243
243
  subscribeSensors: SubscribeSensors<HTMLDivElement>;
244
- containerRef: React.RefObject<HTMLDivElement>;
244
+ containerRef: React.RefObject<HTMLDivElement | null>;
245
245
  setCarouselRef: React.Ref<HTMLDivElement>;
246
246
  toolbarWidth: number | undefined;
247
247
  setToolbarWidth: (width: number | undefined) => void;
@@ -283,4 +283,5 @@ declare const RootModule: Module;
283
283
  declare function Toolbar({ toolbar: { buttons }, render: { buttonClose, iconClose }, styles }: ComponentProps): React.JSX.Element;
284
284
  declare const ToolbarModule: Module;
285
285
 
286
- export { Augmentation, Callback, Carousel, CarouselModule, CarouselSettings, CloseIcon, Component, ComponentProps, type ComputeAnimation, ContainerRect, Controller, ControllerContext, type ControllerContextType, ControllerModule, ControllerRef, ControllerSettings, DocumentContext, DocumentContextProvider, type DocumentContextProviderProps, type DocumentContextType, ErrorIcon, type Event, type EventCallback, EventTypes, EventsContext, type EventsContextType, EventsProvider, IconButton, type IconButtonProps, ImageSlide, type ImageSlideProps, type KeyboardEventType, Label, Labels, LengthOrPercentage, Lightbox, LightboxDefaultProps, LightboxDispatchContext, type LightboxDispatchContextType, LightboxExternalProps, LightboxProps, LightboxPropsContext, type LightboxPropsContextType, LightboxPropsProvider, LightboxRoot, LightboxState, type LightboxStateAction, LightboxStateContext, type LightboxStateContextType, LightboxStateProvider, type LightboxStateProviderProps, LightboxStateSwipeAction, LightboxStateUpdateAction, LoadingIcon, Module, Navigation, NavigationButton, type NavigationButtonProps, NavigationModule, NextIcon, NoScroll, NoScrollModule, Node$1 as 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, makeInertWhen, makeUseContext, parseInt, parseLengthPercentage, round, setRef, stopNavigationEventsPropagation, useAnimation, useContainerRect, useController, useDelay, useDocumentContext, useEventCallback, useEvents, useForkRef, useKeyboardNavigation, useLayoutEffect, useLightboxDispatch, useLightboxProps, useLightboxState, useLoseFocus, useMotionPreference, useNavigationState, usePointerSwipe, usePreventWheelDefaults, useRTL, useSensors, useThrottle, useTimeouts, useWheelSwipe, withPlugins };
286
+ export { Augmentation, Callback, Carousel, CarouselModule, CarouselSettings, CloseIcon, Component, ComponentProps, ContainerRect, Controller, ControllerContext, ControllerModule, ControllerRef, ControllerSettings, DocumentContext, DocumentContextProvider, ErrorIcon, EventTypes, EventsContext, EventsProvider, IconButton, ImageSlide, Label, Labels, LengthOrPercentage, Lightbox, LightboxDefaultProps, LightboxDispatchContext, LightboxExternalProps, LightboxProps, LightboxPropsContext, LightboxPropsProvider, LightboxRoot, LightboxState, LightboxStateContext, LightboxStateProvider, LightboxStateSwipeAction, LightboxStateUpdateAction, LoadingIcon, Module, Navigation, NavigationButton, NavigationModule, NextIcon, NoScroll, NoScrollModule, Node$1 as Node, Plugin, Portal, PortalModule, PreviousIcon, Render, RenderFunction, Root, RootModule, Slide, SlideImage, SwipeState, TimeoutsContext, TimeoutsProvider, Toolbar, ToolbarModule, ToolbarSettings, 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, makeInertWhen, makeUseContext, parseInt, parseLengthPercentage, round, setRef, stopNavigationEventsPropagation, useAnimation, useContainerRect, useController, useDelay, useDocumentContext, useEventCallback, useEvents, useForkRef, useKeyboardNavigation, useLayoutEffect, useLightboxDispatch, useLightboxProps, useLightboxState, useLoseFocus, useMotionPreference, useNavigationState, usePointerSwipe, usePreventWheelDefaults, useRTL, useSensors, useThrottle, useTimeouts, useWheelSwipe, withPlugins };
287
+ export type { ComputeAnimation, ControllerContextType, DocumentContextProviderProps, DocumentContextType, Event, EventCallback, EventsContextType, IconButtonProps, ImageSlideProps, KeyboardEventType, LightboxDispatchContextType, LightboxPropsContextType, LightboxStateAction, LightboxStateContextType, LightboxStateProviderProps, NavigationButtonProps, PointerEventType, Publish, ReactEventType, RegisterSensors, SensorCallback, Subscribe, SubscribeSensors, SupportedEventType, TimeoutsContextType, Topic, Unsubscribe, UseSensors, WheelEventType };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import * as React from 'react';
3
- import { IMAGE_FIT_COVER, IMAGE_FIT_CONTAIN, ACTION_CLOSE, MODULE_CONTROLLER, UNKNOWN_ACTION_TYPE, ELEMENT_BUTTON, ELEMENT_ICON, EVENT_ON_POINTER_DOWN, EVENT_ON_POINTER_MOVE, EVENT_ON_POINTER_UP, EVENT_ON_POINTER_LEAVE, EVENT_ON_POINTER_CANCEL, EVENT_ON_KEY_DOWN, EVENT_ON_KEY_UP, EVENT_ON_WHEEL, SLIDE_STATUS_LOADING, activeSlideStatus, SLIDE_STATUS_COMPLETE, SLIDE_STATUS_ERROR, SLIDE_STATUS_PLACEHOLDER, ACTION_PREV, ACTION_NEXT, ACTION_SWIPE, MODULE_PORTAL, CLASS_FLEX_CENTER, MODULE_CAROUSEL, CLASS_SLIDE_WRAPPER, VK_ARROW_RIGHT, VK_ARROW_LEFT, VK_ESCAPE, MODULE_NAVIGATION, CLASS_NO_SCROLL, CLASS_NO_SCROLL_PADDING, MODULE_NO_SCROLL, MODULE_ROOT, MODULE_TOOLBAR } from './types.js';
3
+ import { IMAGE_FIT_COVER, IMAGE_FIT_CONTAIN, ACTION_CLOSE, MODULE_CONTROLLER, UNKNOWN_ACTION_TYPE, ELEMENT_BUTTON, ELEMENT_ICON, EVENT_ON_WHEEL, EVENT_ON_KEY_UP, EVENT_ON_KEY_DOWN, EVENT_ON_POINTER_CANCEL, EVENT_ON_POINTER_LEAVE, EVENT_ON_POINTER_UP, EVENT_ON_POINTER_MOVE, EVENT_ON_POINTER_DOWN, SLIDE_STATUS_LOADING, activeSlideStatus, SLIDE_STATUS_COMPLETE, SLIDE_STATUS_ERROR, SLIDE_STATUS_PLACEHOLDER, ACTION_PREV, ACTION_NEXT, ACTION_SWIPE, MODULE_PORTAL, CLASS_FLEX_CENTER, MODULE_CAROUSEL, CLASS_SLIDE_WRAPPER, VK_ARROW_RIGHT, VK_ARROW_LEFT, VK_ESCAPE, MODULE_NAVIGATION, CLASS_NO_SCROLL, CLASS_NO_SCROLL_PADDING, MODULE_NO_SCROLL, MODULE_ROOT, MODULE_TOOLBAR } from './types.js';
4
4
  import { createPortal } from 'react-dom';
5
5
  export { ACTIVE_SLIDE_COMPLETE, ACTIVE_SLIDE_ERROR, ACTIVE_SLIDE_LOADING, ACTIVE_SLIDE_PLAYING, CLASS_FULLSIZE, CLASS_SLIDE_WRAPPER_INTERACTIVE, PLUGIN_CAPTIONS, PLUGIN_COUNTER, PLUGIN_DOWNLOAD, PLUGIN_FULLSCREEN, PLUGIN_INLINE, PLUGIN_SHARE, PLUGIN_SLIDESHOW, PLUGIN_THUMBNAILS, PLUGIN_ZOOM, SLIDE_STATUS_PLAYING } from './types.js';
6
6
 
@@ -454,8 +454,8 @@ function currentTransformation(node) {
454
454
  return { x, y, z };
455
455
  }
456
456
  function useAnimation(nodeRef, computeAnimation) {
457
- const snapshot = React.useRef();
458
- const animation = React.useRef();
457
+ const snapshot = React.useRef(undefined);
458
+ const animation = React.useRef(undefined);
459
459
  const reduceMotion = useMotionPreference();
460
460
  useLayoutEffect(() => {
461
461
  var _a, _b, _c;
@@ -490,7 +490,7 @@ function useAnimation(nodeRef, computeAnimation) {
490
490
 
491
491
  function useContainerRect() {
492
492
  const containerRef = React.useRef(null);
493
- const observerRef = React.useRef();
493
+ const observerRef = React.useRef(undefined);
494
494
  const [containerRect, setContainerRect] = React.useState();
495
495
  const setContainerRef = React.useCallback((node) => {
496
496
  containerRef.current = node;
@@ -521,7 +521,7 @@ function useContainerRect() {
521
521
  }
522
522
 
523
523
  function useDelay() {
524
- const timeoutId = React.useRef();
524
+ const timeoutId = React.useRef(undefined);
525
525
  const { setTimeout, clearTimeout } = useTimeouts();
526
526
  return React.useCallback((callback, delay) => {
527
527
  clearTimeout(timeoutId.current);
@@ -555,7 +555,7 @@ function useForkRef(refA, refB) {
555
555
  }
556
556
 
557
557
  function useLoseFocus(focus, disabled = false) {
558
- const focused = React.useRef();
558
+ const focused = React.useRef(false);
559
559
  useLayoutEffect(() => {
560
560
  if (disabled && focused.current) {
561
561
  focused.current = false;
@@ -722,7 +722,7 @@ const SWIPE_THRESHOLD = 30;
722
722
  function usePointerSwipe(subscribeSensors, isSwipeValid, containerWidth, swipeAnimationDuration, onSwipeStart, onSwipeProgress, onSwipeFinish, onSwipeCancel, pullUpEnabled, pullDownEnabled, onPullStart, onPullProgress, onPullFinish, onPullCancel) {
723
723
  const offset = React.useRef(0);
724
724
  const pointers = React.useRef([]);
725
- const activePointer = React.useRef();
725
+ const activePointer = React.useRef(undefined);
726
726
  const startTime = React.useRef(0);
727
727
  const gesture = React.useRef(Gesture.NONE);
728
728
  const clearPointer = React.useCallback((event) => {
@@ -837,10 +837,10 @@ function usePreventWheelDefaults({ preventDefaultWheelX, preventDefaultWheelY, }
837
837
  function useWheelSwipe(swipeState, subscribeSensors, isSwipeValid, containerWidth, swipeAnimationDuration, onSwipeStart, onSwipeProgress, onSwipeFinish, onSwipeCancel) {
838
838
  const offset = React.useRef(0);
839
839
  const intent = React.useRef(0);
840
- const intentCleanup = React.useRef();
841
- const resetCleanup = React.useRef();
840
+ const intentCleanup = React.useRef(undefined);
841
+ const resetCleanup = React.useRef(undefined);
842
842
  const wheelInertia = React.useRef(0);
843
- const wheelInertiaCleanup = React.useRef();
843
+ const wheelInertiaCleanup = React.useRef(undefined);
844
844
  const startTime = React.useRef(0);
845
845
  const { setTimeout, clearTimeout } = useTimeouts();
846
846
  const cancelSwipeIntentCleanup = React.useCallback(() => {
@@ -63,9 +63,7 @@ function Description({ description }) {
63
63
  : null),
64
64
  ...styles.captionsDescription,
65
65
  } }, typeof description === "string"
66
- ? description
67
- .split("\n")
68
- .flatMap((line, index) => [...(index > 0 ? [React.createElement("br", { key: index })] : []), line])
66
+ ? description.split("\n").flatMap((line, index) => [...(index > 0 ? [React.createElement("br", { key: index })] : []), line])
69
67
  : description)));
70
68
  }
71
69
 
@@ -28,7 +28,7 @@ function corsEnabled(url) {
28
28
  try {
29
29
  xhr.send();
30
30
  }
31
- catch (e) {
31
+ catch (_) {
32
32
  }
33
33
  return xhr.status >= 200 && xhr.status <= 299;
34
34
  }
@@ -36,7 +36,7 @@ function click(link) {
36
36
  try {
37
37
  link.dispatchEvent(new MouseEvent("click"));
38
38
  }
39
- catch (e) {
39
+ catch (_) {
40
40
  const event = document.createEvent("MouseEvents");
41
41
  event.initMouseEvent("click", true, true, window, 0, 0, 0, 80, 20, false, false, false, false, 0, null);
42
42
  link.dispatchEvent(event);
@@ -50,7 +50,7 @@ function FullscreenContextProvider({ fullscreen: fullscreenProps, on, children }
50
50
  container.msRequestFullscreen();
51
51
  }
52
52
  }
53
- catch (err) {
53
+ catch (_) {
54
54
  }
55
55
  }, []);
56
56
  const exit = React.useCallback(() => {
@@ -71,7 +71,7 @@ function FullscreenContextProvider({ fullscreen: fullscreenProps, on, children }
71
71
  ownerDocument.msExitFullscreen();
72
72
  }
73
73
  }
74
- catch (err) {
74
+ catch (_) {
75
75
  }
76
76
  }, [getFullscreenElement, getOwnerDocument]);
77
77
  React.useEffect(() => {
@@ -1,4 +1,4 @@
1
- import { LightboxRoot, clsx, cssClass, cssVar, createModule } from '../../index.js';
1
+ import { LightboxRoot, cssVar, clsx, cssClass, createModule } from '../../index.js';
2
2
  import * as React from 'react';
3
3
  import { ACTION_CLOSE, MODULE_NO_SCROLL, MODULE_PORTAL, PLUGIN_INLINE } from '../../types.js';
4
4
 
@@ -18,8 +18,8 @@ function SlideshowContextProvider({ slideshow, carousel: { finite }, on, childre
18
18
  const { autoplay, delay, ref } = resolveSlideshowProps(slideshow);
19
19
  const wasPlaying = React.useRef(autoplay);
20
20
  const [playing, setPlaying] = React.useState(autoplay);
21
- const scheduler = React.useRef();
22
- const slideStatus = React.useRef();
21
+ const scheduler = React.useRef(undefined);
22
+ const slideStatus = React.useRef(undefined);
23
23
  const { slides, currentIndex } = useLightboxState();
24
24
  const { setTimeout, clearTimeout } = useTimeouts();
25
25
  const { subscribe } = useEvents();
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { useLightboxProps, composePrefix, createIcon, ImageSlide, isImageSlide, cssClass, makeComposePrefix, useDocumentContext, useEventCallback, clsx, cssVar, getSlideKey, useRTL, useEvents, useLightboxState, useSensors, useKeyboardNavigation, useAnimation, cleanup, calculatePreload, hasSlides, getSlide, makeUseContext, LightboxPropsProvider, createIconDisabled, IconButton, addToolbarButton, createModule } from '../../index.js';
2
+ import { useLightboxProps, composePrefix, createIcon, ImageSlide, isImageSlide, cssClass, makeComposePrefix, useDocumentContext, useEventCallback, cssVar, clsx, getSlideKey, useRTL, useEvents, useLightboxState, useSensors, useKeyboardNavigation, useAnimation, cleanup, calculatePreload, hasSlides, getSlide, makeUseContext, LightboxPropsProvider, createIconDisabled, IconButton, addToolbarButton, createModule } from '../../index.js';
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
 
5
5
  const defaultThumbnailsProps = {
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { useLightboxProps, useEvents, useContainerRect, useEventCallback, clsx, cssClass } from '../../index.js';
3
- import { ACTIVE_SLIDE_LOADING, CLASS_FLEX_CENTER, CLASS_SLIDE_WRAPPER, ACTIVE_SLIDE_PLAYING, ACTIVE_SLIDE_COMPLETE } from '../../types.js';
3
+ import { ACTIVE_SLIDE_LOADING, CLASS_FLEX_CENTER, CLASS_SLIDE_WRAPPER, ACTIVE_SLIDE_COMPLETE, ACTIVE_SLIDE_PLAYING } from '../../types.js';
4
4
 
5
5
  const defaultVideoProps = {
6
6
  controls: true,
@@ -19,8 +19,8 @@ const resolveZoomProps = (zoom) => ({
19
19
  });
20
20
 
21
21
  function useZoomAnimation(zoom, offsetX, offsetY, zoomWrapperRef) {
22
- const zoomAnimation = React.useRef();
23
- const zoomAnimationStart = React.useRef();
22
+ const zoomAnimation = React.useRef(undefined);
23
+ const zoomAnimationStart = React.useRef(undefined);
24
24
  const { zoom: zoomAnimationDuration } = useLightboxProps().animation;
25
25
  const reduceMotion = useMotionPreference();
26
26
  const playZoomAnimation = useEventCallback(() => {
@@ -121,7 +121,7 @@ function scaleZoom(value, delta, factor = 100, clamp = 2) {
121
121
  function useZoomSensors(zoom, maxZoom, disabled, changeZoom, changeOffsets, zoomWrapperRef) {
122
122
  const activePointers = React.useRef([]);
123
123
  const lastPointerDown = React.useRef(0);
124
- const pinchZoomDistance = React.useRef();
124
+ const pinchZoomDistance = React.useRef(undefined);
125
125
  const { globalIndex } = useLightboxState();
126
126
  const { getOwnerWindow } = useDocumentContext();
127
127
  const { containerRef, subscribeSensors } = useController();
@@ -136,6 +136,8 @@ function useZoomSensors(zoom, maxZoom, disabled, changeZoom, changeOffsets, zoom
136
136
  return [];
137
137
  }, [containerRef, getOwnerWindow]);
138
138
  const onKeyDown = useEventCallback((event) => {
139
+ const { key, metaKey, ctrlKey } = event;
140
+ const meta = metaKey || ctrlKey;
139
141
  const preventDefault = () => {
140
142
  event.preventDefault();
141
143
  event.stopPropagation();
@@ -145,16 +147,16 @@ function useZoomSensors(zoom, maxZoom, disabled, changeZoom, changeOffsets, zoom
145
147
  preventDefault();
146
148
  changeOffsets(deltaX, deltaY);
147
149
  };
148
- if (event.key === "ArrowDown") {
150
+ if (key === "ArrowDown") {
149
151
  move(0, keyboardMoveDistance);
150
152
  }
151
- else if (event.key === "ArrowUp") {
153
+ else if (key === "ArrowUp") {
152
154
  move(0, -keyboardMoveDistance);
153
155
  }
154
- else if (event.key === "ArrowLeft") {
156
+ else if (key === "ArrowLeft") {
155
157
  move(-keyboardMoveDistance, 0);
156
158
  }
157
- else if (event.key === "ArrowRight") {
159
+ else if (key === "ArrowRight") {
158
160
  move(keyboardMoveDistance, 0);
159
161
  }
160
162
  }
@@ -162,14 +164,13 @@ function useZoomSensors(zoom, maxZoom, disabled, changeZoom, changeOffsets, zoom
162
164
  preventDefault();
163
165
  changeZoom(zoomValue);
164
166
  };
165
- const hasMeta = () => event.getModifierState("Meta");
166
- if (event.key === "+" || (event.key === "=" && hasMeta())) {
167
+ if (key === "+" || (meta && key === "=")) {
167
168
  handleChangeZoom(zoom * zoomInMultiplier);
168
169
  }
169
- else if (event.key === "-" || (event.key === "_" && hasMeta())) {
170
+ else if (key === "-" || (meta && key === "_")) {
170
171
  handleChangeZoom(zoom / zoomInMultiplier);
171
172
  }
172
- else if (event.key === "0" && hasMeta()) {
173
+ else if (meta && key === "0") {
173
174
  handleChangeZoom(1);
174
175
  }
175
176
  });
@@ -434,7 +435,7 @@ function ResponsiveImage(props) {
434
435
  Object.assign(style, rect.width / rect.height < width / height ? { width: "100%", height: "auto" } : { width: "auto", height: "100%" });
435
436
  }
436
437
  return (React.createElement(React.Fragment, null,
437
- preload && preload !== current && (React.createElement(ImageSlide, { key: "preload", ...props, slide: { ...image, src: preload, srcSet: undefined }, style: { position: "absolute", visibility: "hidden", ...style }, onLoad: () => handlePreload(preload), render: {
438
+ preload && preload !== current && (React.createElement(ImageSlide, { key: "preload", ...props, offset: undefined, slide: { ...image, src: preload, srcSet: undefined }, style: { position: "absolute", visibility: "hidden", ...style }, onLoad: () => handlePreload(preload), render: {
438
439
  ...render,
439
440
  iconLoading: () => null,
440
441
  iconError: () => null,
package/dist/types.d.ts CHANGED
@@ -425,11 +425,12 @@ interface PluginProps {
425
425
  /** Lightbox plugin */
426
426
  type Plugin = (props: PluginProps) => void;
427
427
  /** Deep partial utility type */
428
- type DeepPartial<T extends {}, K extends keyof T = keyof T, E extends string = never> = Omit<Partial<T>, K> & {
428
+ type DeepPartial<T extends object, K extends keyof T = keyof T, E extends string = never> = Omit<Partial<T>, K> & {
429
429
  [P in K]?: DeepPartialValue<T[P], E>;
430
430
  };
431
- type DeepPartialValue<T, E extends string = never> = T extends any[] ? T : T extends (...props: any[]) => any ? T : T extends {} ? {
431
+ type DeepPartialValue<T, E extends string = never> = T extends any[] ? T : T extends (...props: any[]) => any ? T : T extends object ? {
432
432
  [P in keyof T]?: P extends E ? T[P] : DeepPartialValue<T[P], E>;
433
433
  } : T;
434
434
 
435
- export { ACTION_CLOSE, ACTION_NEXT, ACTION_PREV, ACTION_SWIPE, ACTIVE_SLIDE_COMPLETE, ACTIVE_SLIDE_ERROR, ACTIVE_SLIDE_LOADING, ACTIVE_SLIDE_PLAYING, type AnimationSettings, type Augmentation, CLASS_FLEX_CENTER, CLASS_FULLSIZE, CLASS_NO_SCROLL, CLASS_NO_SCROLL_PADDING, CLASS_SLIDE_WRAPPER, CLASS_SLIDE_WRAPPER_INTERACTIVE, type Callback, type Callbacks, type CarouselSettings, type ClickCallbackProps, type Component, type ComponentProps, type ContainerRect, type ControllerRef, type ControllerSettings, type DeepPartial, type DeepPartialValue, 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, type EventTypes, type GenericSlide, IMAGE_FIT_CONTAIN, IMAGE_FIT_COVER, type ImageFit, type ImageSource, type Label, type Labels, type LengthOrPercentage, type LightboxExternalProps, type LightboxProps, type LightboxState, type LightboxStateSwipeAction, type LightboxStateUpdateAction, MODULE_CAROUSEL, MODULE_CONTROLLER, MODULE_NAVIGATION, MODULE_NO_SCROLL, MODULE_PORTAL, MODULE_ROOT, MODULE_TOOLBAR, type Module, type NavigationAction, type NoScrollSettings, type Node, PLUGIN_CAPTIONS, PLUGIN_COUNTER, PLUGIN_DOWNLOAD, PLUGIN_FULLSCREEN, PLUGIN_INLINE, PLUGIN_SHARE, PLUGIN_SLIDESHOW, PLUGIN_THUMBNAILS, PLUGIN_ZOOM, type Plugin, type PluginProps, type PortalSettings, type Render, type RenderFunction, type RenderSlideContainerProps, type RenderSlideFooterProps, type RenderSlideHeaderProps, type RenderSlideProps, SLIDE_STATUS_COMPLETE, SLIDE_STATUS_ERROR, SLIDE_STATUS_LOADING, SLIDE_STATUS_PLACEHOLDER, SLIDE_STATUS_PLAYING, type Slide, type SlideImage, type SlideStatus, type SlideTypeKey, type SlideTypes, type Slot, type SlotStyles, type SlotType, type ToolbarButtonKey, type ToolbarButtonKeys, type ToolbarSettings, UNKNOWN_ACTION_TYPE, VK_ARROW_LEFT, VK_ARROW_RIGHT, VK_ESCAPE, type ViewCallbackProps, activeSlideStatus };
435
+ export { ACTION_CLOSE, ACTION_NEXT, ACTION_PREV, ACTION_SWIPE, ACTIVE_SLIDE_COMPLETE, ACTIVE_SLIDE_ERROR, ACTIVE_SLIDE_LOADING, ACTIVE_SLIDE_PLAYING, CLASS_FLEX_CENTER, CLASS_FULLSIZE, CLASS_NO_SCROLL, CLASS_NO_SCROLL_PADDING, CLASS_SLIDE_WRAPPER, CLASS_SLIDE_WRAPPER_INTERACTIVE, 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, IMAGE_FIT_CONTAIN, IMAGE_FIT_COVER, MODULE_CAROUSEL, MODULE_CONTROLLER, MODULE_NAVIGATION, MODULE_NO_SCROLL, MODULE_PORTAL, MODULE_ROOT, MODULE_TOOLBAR, PLUGIN_CAPTIONS, PLUGIN_COUNTER, PLUGIN_DOWNLOAD, PLUGIN_FULLSCREEN, PLUGIN_INLINE, PLUGIN_SHARE, PLUGIN_SLIDESHOW, PLUGIN_THUMBNAILS, PLUGIN_ZOOM, SLIDE_STATUS_COMPLETE, SLIDE_STATUS_ERROR, SLIDE_STATUS_LOADING, SLIDE_STATUS_PLACEHOLDER, SLIDE_STATUS_PLAYING, UNKNOWN_ACTION_TYPE, VK_ARROW_LEFT, VK_ARROW_RIGHT, VK_ESCAPE, activeSlideStatus };
436
+ export type { AnimationSettings, Augmentation, Callback, Callbacks, CarouselSettings, ClickCallbackProps, Component, ComponentProps, ContainerRect, ControllerRef, ControllerSettings, DeepPartial, DeepPartialValue, EventTypes, GenericSlide, ImageFit, ImageSource, Label, Labels, LengthOrPercentage, LightboxExternalProps, LightboxProps, LightboxState, LightboxStateSwipeAction, LightboxStateUpdateAction, Module, NavigationAction, NoScrollSettings, Node, Plugin, PluginProps, PortalSettings, Render, RenderFunction, RenderSlideContainerProps, RenderSlideFooterProps, RenderSlideHeaderProps, RenderSlideProps, Slide, SlideImage, SlideStatus, SlideTypeKey, SlideTypes, Slot, SlotStyles, SlotType, ToolbarButtonKey, ToolbarButtonKeys, ToolbarSettings, ViewCallbackProps };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yet-another-react-lightbox",
3
- "version": "3.21.7",
3
+ "version": "3.21.9",
4
4
  "description": "Modern React lightbox component",
5
5
  "author": "Igor Danchenko",
6
6
  "license": "MIT",
@@ -154,8 +154,18 @@
154
154
  "provenance": true
155
155
  },
156
156
  "peerDependencies": {
157
- "react": ">=16.8.0",
158
- "react-dom": ">=16.8.0"
157
+ "@types/react": "^16 || ^17 || ^18 || ^19",
158
+ "@types/react-dom": "^16 || ^17 || ^18 || ^19",
159
+ "react": "^16.8.0 || ^17 || ^18 || ^19",
160
+ "react-dom": "^16.8.0 || ^17 || ^18 || ^19"
161
+ },
162
+ "peerDependenciesMeta": {
163
+ "@types/react": {
164
+ "optional": true
165
+ },
166
+ "@types/react-dom": {
167
+ "optional": true
168
+ }
159
169
  },
160
170
  "keywords": [
161
171
  "react",