yet-another-react-lightbox 3.21.9 → 3.22.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 +1 -1
- package/dist/index.js +7 -4
- package/dist/plugins/zoom/index.d.ts +2 -2
- package/dist/types.d.ts +2 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -224,7 +224,7 @@ declare enum SwipeState {
|
|
|
224
224
|
ANIMATION = 3
|
|
225
225
|
}
|
|
226
226
|
|
|
227
|
-
declare function usePointerSwipe<T extends Element = Element>(subscribeSensors: UseSensors<T>["subscribeSensors"], isSwipeValid: (offset: number) => boolean, containerWidth: number, swipeAnimationDuration: number, onSwipeStart: () => void, onSwipeProgress: (offset: number) => void, onSwipeFinish: (offset: number, duration: number) => void, onSwipeCancel: (offset: number) => void, pullUpEnabled: boolean, pullDownEnabled: boolean, onPullStart: () => void, onPullProgress: (offset: number) => void, onPullFinish: (offset: number, duration: number) => void, onPullCancel: (offset: number) => void): void;
|
|
227
|
+
declare function usePointerSwipe<T extends Element = Element>({ disableSwipeNavigation }: ControllerSettings, subscribeSensors: UseSensors<T>["subscribeSensors"], isSwipeValid: (offset: number) => boolean, containerWidth: number, swipeAnimationDuration: number, onSwipeStart: () => void, onSwipeProgress: (offset: number) => void, onSwipeFinish: (offset: number, duration: number) => void, onSwipeCancel: (offset: number) => void, pullUpEnabled: boolean, pullDownEnabled: boolean, onPullStart: () => void, onPullProgress: (offset: number) => void, onPullFinish: (offset: number, duration: number) => void, onPullCancel: (offset: number) => void): void;
|
|
228
228
|
|
|
229
229
|
/**
|
|
230
230
|
* Prevent default effects of the wheel events:
|
package/dist/index.js
CHANGED
|
@@ -156,6 +156,7 @@ const LightboxDefaultProps = {
|
|
|
156
156
|
closeOnBackdropClick: false,
|
|
157
157
|
preventDefaultWheelX: true,
|
|
158
158
|
preventDefaultWheelY: false,
|
|
159
|
+
disableSwipeNavigation: false,
|
|
159
160
|
},
|
|
160
161
|
portal: {},
|
|
161
162
|
noScroll: {
|
|
@@ -719,7 +720,7 @@ var Gesture;
|
|
|
719
720
|
Gesture[Gesture["PULL"] = 2] = "PULL";
|
|
720
721
|
})(Gesture || (Gesture = {}));
|
|
721
722
|
const SWIPE_THRESHOLD = 30;
|
|
722
|
-
function usePointerSwipe(subscribeSensors, isSwipeValid, containerWidth, swipeAnimationDuration, onSwipeStart, onSwipeProgress, onSwipeFinish, onSwipeCancel, pullUpEnabled, pullDownEnabled, onPullStart, onPullProgress, onPullFinish, onPullCancel) {
|
|
723
|
+
function usePointerSwipe({ disableSwipeNavigation }, subscribeSensors, isSwipeValid, containerWidth, swipeAnimationDuration, onSwipeStart, onSwipeProgress, onSwipeFinish, onSwipeCancel, pullUpEnabled, pullDownEnabled, onPullStart, onPullProgress, onPullFinish, onPullCancel) {
|
|
723
724
|
const offset = React.useRef(0);
|
|
724
725
|
const pointers = React.useRef([]);
|
|
725
726
|
const activePointer = React.useRef(undefined);
|
|
@@ -791,8 +792,10 @@ function usePointerSwipe(subscribeSensors, isSwipeValid, containerWidth, swipeAn
|
|
|
791
792
|
gesture.current = newGesture;
|
|
792
793
|
};
|
|
793
794
|
if (Math.abs(deltaX) > Math.abs(deltaY) && Math.abs(deltaX) > SWIPE_THRESHOLD && isSwipeValid(deltaX)) {
|
|
794
|
-
|
|
795
|
-
|
|
795
|
+
if (!disableSwipeNavigation) {
|
|
796
|
+
startGesture(Gesture.SWIPE);
|
|
797
|
+
onSwipeStart();
|
|
798
|
+
}
|
|
796
799
|
}
|
|
797
800
|
else if (Math.abs(deltaY) > Math.abs(deltaX) && exceedsPullThreshold(deltaY, SWIPE_THRESHOLD)) {
|
|
798
801
|
startGesture(Gesture.PULL);
|
|
@@ -1145,7 +1148,7 @@ function Controller({ children, ...props }) {
|
|
|
1145
1148
|
(offset) => pull(offset),
|
|
1146
1149
|
(offset) => pull(offset, true),
|
|
1147
1150
|
];
|
|
1148
|
-
usePointerSwipe(...swipeParams, closeOnPullUp, closeOnPullDown, ...pullParams);
|
|
1151
|
+
usePointerSwipe(controller, ...swipeParams, closeOnPullUp, closeOnPullDown, ...pullParams);
|
|
1149
1152
|
useWheelSwipe(swipeState, ...swipeParams);
|
|
1150
1153
|
const focusOnMount = useEventCallback(() => {
|
|
1151
1154
|
if (controller.focus &&
|
|
@@ -14,9 +14,9 @@ declare module "yet-another-react-lightbox" {
|
|
|
14
14
|
maxZoomPixelRatio?: number;
|
|
15
15
|
/** zoom-in multiplier */
|
|
16
16
|
zoomInMultiplier?: number;
|
|
17
|
-
/** double-tap maximum time delay */
|
|
17
|
+
/** @deprecated - double-tap maximum time delay */
|
|
18
18
|
doubleTapDelay?: number;
|
|
19
|
-
/** double-click maximum time delay */
|
|
19
|
+
/** @deprecated - double-click maximum time delay */
|
|
20
20
|
doubleClickDelay?: number;
|
|
21
21
|
/** maximum number of zoom-in stops via double-click or double-tap */
|
|
22
22
|
doubleClickMaxStops?: number;
|
package/dist/types.d.ts
CHANGED
|
@@ -240,6 +240,8 @@ interface ControllerSettings {
|
|
|
240
240
|
preventDefaultWheelX: boolean;
|
|
241
241
|
/** if `true`, prevent default for vertical wheel scroll events (for internal use only) */
|
|
242
242
|
preventDefaultWheelY: boolean;
|
|
243
|
+
/** if `true`, disable slide change on pointer swipe / drag */
|
|
244
|
+
disableSwipeNavigation: boolean;
|
|
243
245
|
}
|
|
244
246
|
/** Lightbox controller ref */
|
|
245
247
|
interface ControllerRef {
|