point-focus 1.0.0 → 1.0.3
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/ImageMagnifier.d.ts +1 -1
- package/dist/ImageMagnifier.types.d.ts +64 -13
- package/dist/assets/svgCollection.d.ts +6 -0
- package/dist/components/ImageStatusPlaceholder.d.ts +10 -0
- package/dist/index.cjs +153 -82
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +50 -13
- package/dist/index.js +153 -82
- package/dist/index.js.map +1 -1
- package/dist/utils/globalUtils.d.ts +26 -22
- package/package.json +20 -3
package/dist/ImageMagnifier.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { IImageMagnifierTypes } from './ImageMagnifier.types';
|
|
2
|
-
declare const ImageMagnifier: ({ src, sources, width, height, zoomSrc, zoomScale, zoomPreload, fadeDuration, moveType, zoomType, baseImageStyle, hideCloseButton, containerClassName, baseImageClassName, zoomImageClassName, closeButtonClassName, onMouseEnter, onZoomedMouseMove, onMouseLeave, onClickImage, onZoom, onClose, afterZoomImgLoaded, afterZoomOut, onBaseImageError, onZoomImageError, onDragStart, onDragEnd, alt, containerAriaLabel, closeButtonAriaLabel, zoomImageAriaLabel, tabIndex, closeButtonContent, overlay, disableDrag, disableInertia, loadingPlaceholder, errorPlaceholder, clickToZoomOut, externalZoomState, setExternalZoomState, }: IImageMagnifierTypes) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
declare const ImageMagnifier: ({ src, sources, width, height, zoomSrc, zoomScale, zoomPreload, fadeDuration, moveType, zoomType, baseImageStyle, hideCloseButton, containerClassName, baseImageClassName, zoomImageClassName, closeButtonClassName, onMouseEnter, onZoomedMouseMove, onMouseLeave, onClickImage, onZoom, onClose, afterZoomImgLoaded, afterZoomOut, onBaseImageError, onZoomImageError, onDragStart, onDragEnd, alt, containerAriaLabel, closeButtonAriaLabel, zoomImageAriaLabel, tabIndex, closeButtonContent, overlay, disableDrag, disableInertia, loadingPlaceholder, errorPlaceholder, clickToZoomOut, externalZoomState, setExternalZoomState, disableMobile, }: IImageMagnifierTypes) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export default ImageMagnifier;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export type ImageSource = React.SourceHTMLAttributes<HTMLSourceElement>;
|
|
2
|
+
export type IInteractionTYpe = 'click' | 'hover' | 'keyboard' | 'external';
|
|
2
3
|
export interface IImageMagnifierTypes {
|
|
3
4
|
src: string;
|
|
4
5
|
sources?: ImageSource[];
|
|
@@ -26,18 +27,54 @@ export interface IImageMagnifierTypes {
|
|
|
26
27
|
closeButtonContent?: React.ReactNode | undefined;
|
|
27
28
|
overlay?: React.ReactNode | undefined;
|
|
28
29
|
baseImageStyle?: React.CSSProperties | undefined;
|
|
29
|
-
onMouseEnter?: (
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
30
|
+
onMouseEnter?: (info: {
|
|
31
|
+
source: 'mouse' | 'touch';
|
|
32
|
+
}) => void;
|
|
33
|
+
onMouseLeave?: (info: {
|
|
34
|
+
source: 'mouse' | 'touch';
|
|
35
|
+
}) => void;
|
|
36
|
+
onClickImage?: (info: {
|
|
37
|
+
x: number;
|
|
38
|
+
y: number;
|
|
39
|
+
source: 'mouse' | 'touch';
|
|
40
|
+
}) => void;
|
|
41
|
+
onZoom?: (info: {
|
|
42
|
+
at: {
|
|
43
|
+
x: number;
|
|
44
|
+
y: number;
|
|
45
|
+
};
|
|
46
|
+
method: IInteractionTYpe;
|
|
47
|
+
}) => void;
|
|
48
|
+
onClose?: (info: {
|
|
49
|
+
triggeredBy: IInteractionTYpe;
|
|
50
|
+
}) => void;
|
|
51
|
+
afterZoomImgLoaded?: () => void;
|
|
52
|
+
afterZoomOut?: () => void;
|
|
53
|
+
onBaseImageError?: () => void;
|
|
54
|
+
onZoomImageError?: () => void;
|
|
55
|
+
onDragStart?: (info: {
|
|
56
|
+
start: {
|
|
57
|
+
x: number;
|
|
58
|
+
y: number;
|
|
59
|
+
};
|
|
60
|
+
source: 'mouse' | 'touch';
|
|
61
|
+
}) => void;
|
|
62
|
+
onDragEnd?: (info: {
|
|
63
|
+
velocity: {
|
|
64
|
+
vx: number;
|
|
65
|
+
vy: number;
|
|
66
|
+
};
|
|
67
|
+
final: {
|
|
68
|
+
x: number;
|
|
69
|
+
y: number;
|
|
70
|
+
};
|
|
71
|
+
}) => void;
|
|
72
|
+
onZoomedMouseMove?: (info: {
|
|
73
|
+
x: number;
|
|
74
|
+
y: number;
|
|
75
|
+
bounds: DOMRect;
|
|
76
|
+
}) => void;
|
|
77
|
+
disableMobile?: boolean;
|
|
41
78
|
disableDrag?: boolean;
|
|
42
79
|
disableInertia?: boolean;
|
|
43
80
|
loadingPlaceholder?: React.ReactNode;
|
|
@@ -72,6 +109,12 @@ export type IImageTypes = {
|
|
|
72
109
|
y: number;
|
|
73
110
|
time: number;
|
|
74
111
|
} | null;
|
|
112
|
+
rafId?: number | null;
|
|
113
|
+
lastMoveEvent?: {
|
|
114
|
+
x: number;
|
|
115
|
+
y: number;
|
|
116
|
+
bounds: DOMRect;
|
|
117
|
+
} | null;
|
|
75
118
|
};
|
|
76
119
|
export type IZoomImageTypes = {
|
|
77
120
|
src: string;
|
|
@@ -81,7 +124,7 @@ export type IZoomImageTypes = {
|
|
|
81
124
|
isZoomed: boolean;
|
|
82
125
|
onLoad?: (e: React.SyntheticEvent<HTMLImageElement>) => void;
|
|
83
126
|
onError?: () => void;
|
|
84
|
-
onClose?: (
|
|
127
|
+
onClose?: (method: IInteractionTYpe) => void;
|
|
85
128
|
onFadeOut?: (e: React.TransitionEvent<HTMLImageElement>) => void;
|
|
86
129
|
closeButtonRef: React.RefObject<HTMLButtonElement>;
|
|
87
130
|
onDragStart?: (e: React.MouseEvent | React.TouchEvent) => void | undefined;
|
|
@@ -97,6 +140,7 @@ export type IZoomImageTypes = {
|
|
|
97
140
|
closeButtonContent?: React.ReactNode | undefined;
|
|
98
141
|
loadingPlaceholder?: React.ReactNode;
|
|
99
142
|
errorPlaceholder?: React.ReactNode;
|
|
143
|
+
zoomScale: number;
|
|
100
144
|
};
|
|
101
145
|
export type IBaseImageTypes = {
|
|
102
146
|
src: string;
|
|
@@ -131,4 +175,11 @@ export type InertiaOptions = {
|
|
|
131
175
|
minVelocity?: number;
|
|
132
176
|
onEnd?: () => void;
|
|
133
177
|
};
|
|
178
|
+
export type ZoomFallbackBoundaryProps = {
|
|
179
|
+
fallback: React.ReactNode;
|
|
180
|
+
children: React.ReactNode;
|
|
181
|
+
};
|
|
182
|
+
export type ZoomFallbackBoundaryState = {
|
|
183
|
+
hasError: boolean;
|
|
184
|
+
};
|
|
134
185
|
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare const ImageStatusPlaceholder: React.FC<{
|
|
3
|
+
isLoading?: boolean;
|
|
4
|
+
isError?: boolean;
|
|
5
|
+
loadingPlaceholder?: React.ReactNode;
|
|
6
|
+
errorPlaceholder?: React.ReactNode;
|
|
7
|
+
loadingTestId?: string;
|
|
8
|
+
errorTestId?: string;
|
|
9
|
+
}>;
|
|
10
|
+
export default ImageStatusPlaceholder;
|
package/dist/index.cjs
CHANGED
|
@@ -30,17 +30,20 @@ function styleInject(css, ref) {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
var css_248z = ":root{--button-icon-color:#
|
|
34
|
-
var styles = {"c-point-focus":"styles-module_c-point-focus__Glxyg","c-point-focus__zoom-img":"styles-module_c-point-focus__zoom-img__HP-hu","c-point-focus__overlay":"styles-module_c-point-focus__overlay__T8nCD","c-point-focus__placeholder":"styles-module_c-point-focus__placeholder__dHGk6","c-point-focus__img":"styles-module_c-point-focus__img__jCS0m","c-point-focus__button":"styles-module_c-point-focus__button__oCELz"};
|
|
33
|
+
var css_248z = ":root{--button-icon-color:#1e1c1c;--loader-background:#19181891;--loader-color:#fff}.styles-module_c-point-focus__Glxyg{align-items:center;cursor:zoom-in;display:inline-block;display:flex;height:100%;justify-content:center;margin:0;overflow:hidden;position:relative;width:100%}.styles-module_c-point-focus__Glxyg[data-movetype=follow] .styles-module_c-point-focus__zoom-img__HP-hu{cursor:crosshair}.styles-module_c-point-focus__Glxyg[data-movetype=drag] .styles-module_c-point-focus__zoom-img__HP-hu{cursor:grab}.styles-module_c-point-focus__overlay__T8nCD{inset:0;pointer-events:none;position:absolute;z-index:1}.styles-module_c-point-focus__placeholder__dHGk6{align-items:center;background:var(--loader-background);display:flex;inset:0;justify-content:center;position:absolute;z-index:2}.styles-module_c-point-focus__img__jCS0m{-webkit-user-drag:none;aspect-ratio:4/3;display:block;height:100%;object-fit:contain;opacity:1;pointer-events:none;transition:opacity 0ms linear var(--fade-duration),visibility 0ms linear var(--fade-duration);user-select:none;visibility:visible;width:100%}.styles-module_c-point-focus__img__jCS0m[data-hidden=true]{opacity:0;visibility:hidden}.styles-module_c-point-focus__zoom-img__HP-hu{-webkit-user-drag:none;-webkit-touch-callout:none;display:block;left:0;max-width:none!important;opacity:0;pointer-events:none;position:absolute;top:0;transform:translate(0);user-select:none;visibility:hidden;width:auto!important;will-change:transform}.styles-module_c-point-focus__zoom-img__HP-hu[data-visible=true]{cursor:zoom-out;opacity:1;pointer-events:auto;touch-action:none;visibility:visible}.styles-module_c-point-focus__button__oCELz{align-items:center;appearance:none;background:transparent;border:none;cursor:pointer;display:flex;justify-content:center;opacity:0;outline:none;padding:.3rem;position:absolute;right:2%;text-decoration:none;top:2%;transform-origin:center center;visibility:hidden}.styles-module_c-point-focus__button__oCELz[data-visible=true]{opacity:1;visibility:visible}.styles-module_c-point-focus__button__oCELz svg{filter:drop-shadow(0 0 10px rgba(0,0,0,.7));height:1rem;transform-origin:center;transition:transform .2s ease-in-out;width:1rem}.styles-module_c-point-focus__button__oCELz svg path{fill:var(--button-icon-color)}.styles-module_c-point-focus__button__oCELz:hover svg{transform:scale(1.2)}.styles-module_c-point-focus__button__oCELz:active{appearance:none;background:transparent;border:none;outline:none}.styles-module_c-point-focus__button__oCELz:active svg{transform:scale(1)}.styles-module_c-point-focus__loader__AIAkB{display:inline-block;height:48px;position:relative;width:48px}.styles-module_c-point-focus__loader__AIAkB:after,.styles-module_c-point-focus__loader__AIAkB:before{animation:styles-module_animloader__7LeVS 2s linear infinite;border:2px solid var(--loader-color);border-radius:50%;box-sizing:border-box;content:\"\";height:48px;left:0;position:absolute;top:0;width:48px}.styles-module_c-point-focus__loader__AIAkB:after{animation-delay:1s}@keyframes styles-module_animloader__7LeVS{0%{opacity:1;transform:scale(0)}to{opacity:0;transform:scale(2)}}.styles-module_c-point-focus__Glxyg .styles-module_c-fp-fallback-image__sROkG{height:100%;inset:0;object-fit:cover;object-position:center center;position:absolute;width:100%;z-index:2}";
|
|
34
|
+
var styles = {"c-point-focus":"styles-module_c-point-focus__Glxyg","c-point-focus__zoom-img":"styles-module_c-point-focus__zoom-img__HP-hu","c-point-focus__overlay":"styles-module_c-point-focus__overlay__T8nCD","c-point-focus__placeholder":"styles-module_c-point-focus__placeholder__dHGk6","c-point-focus__img":"styles-module_c-point-focus__img__jCS0m","c-point-focus__button":"styles-module_c-point-focus__button__oCELz","c-point-focus__loader":"styles-module_c-point-focus__loader__AIAkB","animloader":"styles-module_animloader__7LeVS","c-fp-fallback-image":"styles-module_c-fp-fallback-image__sROkG"};
|
|
35
35
|
styleInject(css_248z);
|
|
36
36
|
|
|
37
|
+
function isTouchEvent(e) {
|
|
38
|
+
return 'touches' in e || ('nativeEvent' in e && 'touches' in e.nativeEvent);
|
|
39
|
+
}
|
|
37
40
|
// Defaulted values to 0 to make the functions SSR safe
|
|
38
|
-
|
|
39
|
-
if ('touches' in e && e.touches.length > 0) {
|
|
41
|
+
function getPageCoords(e, fallbackElement) {
|
|
42
|
+
if ('touches' in e && e.touches && e.touches.length > 0) {
|
|
40
43
|
return { x: e.touches[0].pageX, y: e.touches[0].pageY };
|
|
41
44
|
}
|
|
42
45
|
else if ('pageX' in e && 'pageY' in e) {
|
|
43
|
-
return { x: e.pageX, y: e.pageY };
|
|
46
|
+
return { x: e.pageX, y: e.pageY }; // Could further narrow with type guards
|
|
44
47
|
}
|
|
45
48
|
else if (fallbackElement) {
|
|
46
49
|
const rect = fallbackElement.getBoundingClientRect();
|
|
@@ -50,7 +53,7 @@ const getPageCoords = (e, fallbackElement) => {
|
|
|
50
53
|
};
|
|
51
54
|
}
|
|
52
55
|
return { x: 0, y: 0 };
|
|
53
|
-
}
|
|
56
|
+
}
|
|
54
57
|
const getOffsets = (pageX, pageY, left, top) => {
|
|
55
58
|
return {
|
|
56
59
|
x: pageX - left,
|
|
@@ -60,10 +63,12 @@ const getOffsets = (pageX, pageY, left, top) => {
|
|
|
60
63
|
const getBounds = (container) => {
|
|
61
64
|
return container ? container.getBoundingClientRect() : { width: 0, height: 0, left: 0, top: 0 };
|
|
62
65
|
};
|
|
63
|
-
const getRatios = (bounds,
|
|
66
|
+
const getRatios = (bounds, natural, zoomScale) => {
|
|
67
|
+
const scaledWidth = natural.width * zoomScale;
|
|
68
|
+
const scaledHeight = natural.height * zoomScale;
|
|
64
69
|
return {
|
|
65
|
-
x: (
|
|
66
|
-
y: (
|
|
70
|
+
x: (scaledWidth - bounds.width) / bounds.width,
|
|
71
|
+
y: (scaledHeight - bounds.height) / bounds.height,
|
|
67
72
|
};
|
|
68
73
|
};
|
|
69
74
|
function clampToBounds(left, top, bounds) {
|
|
@@ -78,15 +83,6 @@ function calculateDragPosition(pageX, pageY, offsets) {
|
|
|
78
83
|
top: pageY - offsets.y,
|
|
79
84
|
};
|
|
80
85
|
}
|
|
81
|
-
const getScaledDimensions = (zoomedImgRef, zoomScale) => {
|
|
82
|
-
if (!zoomedImgRef || !zoomedImgRef.naturalWidth || !zoomedImgRef.naturalHeight) {
|
|
83
|
-
return { width: 0, height: 0 };
|
|
84
|
-
}
|
|
85
|
-
return {
|
|
86
|
-
width: zoomedImgRef.naturalWidth * zoomScale,
|
|
87
|
-
height: zoomedImgRef.naturalHeight * zoomScale,
|
|
88
|
-
};
|
|
89
|
-
};
|
|
90
86
|
const getDefaults = () => {
|
|
91
87
|
const defaultCoordinates = { x: 0, y: 0 };
|
|
92
88
|
return {
|
|
@@ -102,6 +98,24 @@ const getDefaults = () => {
|
|
|
102
98
|
lastDragCoords: { x: 0, y: 0, time: 0 },
|
|
103
99
|
};
|
|
104
100
|
};
|
|
101
|
+
class ZoomFallbackBoundary extends React.Component {
|
|
102
|
+
constructor(props) {
|
|
103
|
+
super(props);
|
|
104
|
+
this.state = { hasError: false };
|
|
105
|
+
}
|
|
106
|
+
static getDerivedStateFromError() {
|
|
107
|
+
return { hasError: true };
|
|
108
|
+
}
|
|
109
|
+
componentDidCatch(error, info) {
|
|
110
|
+
console.error('ZoomImage runtime error:', error, info);
|
|
111
|
+
}
|
|
112
|
+
render() {
|
|
113
|
+
if (this.state.hasError) {
|
|
114
|
+
return this.props.fallback ?? null;
|
|
115
|
+
}
|
|
116
|
+
return this.props.children;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
105
119
|
|
|
106
120
|
const applyMouseMove = (pageX, pageY, zoomContextRef, setLeft, setTop) => {
|
|
107
121
|
const { left, top } = calculateDragPosition(pageX, pageY, zoomContextRef.current.offsets);
|
|
@@ -143,29 +157,45 @@ function applyDragMove(x, y, zoomContextRef, setLeft, setTop) {
|
|
|
143
157
|
setTop(clamped.top);
|
|
144
158
|
}
|
|
145
159
|
|
|
160
|
+
const CloseIcon = ({ className = 'c-zoom-close-button-icon' }) => (jsxRuntime.jsx("svg", { xmlns: 'http://www.w3.org/2000/svg', className: className, viewBox: '0 0 24 24', fill: 'none', children: jsxRuntime.jsx("path", { fillRule: 'evenodd', clipRule: 'evenodd', d: 'M5.29289 5.29289C5.68342 4.90237 6.31658 4.90237 6.70711 5.29289L12 10.5858L17.2929 5.29289C17.6834 4.90237 18.3166 4.90237 18.7071 5.29289C19.0976 5.68342 19.0976 6.31658 18.7071 6.70711L13.4142 12L18.7071 17.2929C19.0976 17.6834 19.0976 18.3166 18.7071 18.7071C18.3166 19.0976 17.6834 19.0976 17.2929 18.7071L12 13.4142L6.70711 18.7071C6.31658 19.0976 5.68342 19.0976 5.29289 18.7071C4.90237 18.3166 4.90237 17.6834 5.29289 17.2929L10.5858 12L5.29289 6.70711C4.90237 6.31658 4.90237 5.68342 5.29289 5.29289Z', fill: '#000' }) }));
|
|
161
|
+
const FallbackImage = ({ className = 'c-fp-fallback-image' }) => (jsxRuntime.jsxs("svg", { className: className, viewBox: '0 0 2153 1548', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', children: [jsxRuntime.jsx("rect", { width: '100%', height: '100%', fill: 'white' }), jsxRuntime.jsx("path", { d: 'M762 504.5H1392C1425.97 504.5 1453.5 532.034 1453.5 566V982C1453.5 1015.97 1425.97 1043.5 1392 1043.5H762C728.034 1043.5 700.5 1015.97 700.5 982V566C700.5 532.034 728.034 504.5 762 504.5Z', fill: '#EBEEF0', stroke: '#8495A2', strokeWidth: '25' }), jsxRuntime.jsx("path", { d: 'M901.252 812.329C880.253 832.829 710.25 1012.23 707.251 1014.33C704.252 1016.43 728.751 1038.83 745.252 1038.83C761.752 1038.83 1381.75 1039.33 1388.25 1038.83C1394.75 1038.33 1443.75 1036.33 1445.75 981.832C1447.75 927.332 1445.75 946.332 1445.75 946.332C1445.75 946.332 1243.75 723.83 1225.75 705.829C1207.75 687.827 1194.25 681.832 1170.25 705.829C1146.25 729.826 1012.47 866.329 1012.47 866.329C1012.47 866.329 976.253 827.329 957.752 808.829C939.252 790.329 922.252 791.829 901.252 812.329Z', fill: '#CBD4DB' }), jsxRuntime.jsx("path", { d: 'M1056.25 912.329L1012.47 866.329M1012.47 866.329C1012.47 866.329 976.253 827.329 957.752 808.829C939.252 790.329 922.252 791.829 901.252 812.329C880.253 832.829 710.25 1012.23 707.251 1014.33C704.252 1016.43 728.751 1038.83 745.252 1038.83C761.752 1038.83 1381.75 1039.33 1388.25 1038.83C1394.75 1038.33 1443.75 1036.33 1445.75 981.832C1447.75 927.332 1445.75 946.332 1445.75 946.332C1445.75 946.332 1243.75 723.83 1225.75 705.829C1207.75 687.827 1194.25 681.832 1170.25 705.829C1146.25 729.826 1012.47 866.329 1012.47 866.329Z', stroke: '#8595A1', strokeWidth: '25', strokeLinecap: 'round' }), jsxRuntime.jsx("circle", { cx: '891.5', cy: '689.5', r: '60', fill: '#CBD4DA', stroke: '#8496A2', strokeWidth: '25' })] }));
|
|
162
|
+
|
|
146
163
|
const BaseImage = ({ src, sources, baseImageStyle = {}, isZoomed, fadeDuration, baseImageClassName, alt, loadingPlaceholder, errorPlaceholder, onError, }) => {
|
|
164
|
+
const imgRef = React.useRef(null);
|
|
147
165
|
const [isLoading, setIsLoading] = React.useState(true);
|
|
148
166
|
const [hasError, setHasError] = React.useState(false);
|
|
149
|
-
|
|
167
|
+
React.useEffect(() => {
|
|
168
|
+
setIsLoading(true);
|
|
169
|
+
setHasError(false);
|
|
170
|
+
}, [src]);
|
|
171
|
+
const handleLoad = () => {
|
|
172
|
+
console.log('Image loaded');
|
|
173
|
+
setIsLoading(false);
|
|
174
|
+
};
|
|
150
175
|
const handleError = () => {
|
|
151
176
|
setHasError(true);
|
|
152
177
|
setIsLoading(false);
|
|
178
|
+
console.error('Image has error');
|
|
153
179
|
onError?.();
|
|
154
180
|
};
|
|
181
|
+
React.useEffect(() => {
|
|
182
|
+
const img = imgRef.current;
|
|
183
|
+
if (img && img.complete && img.naturalWidth > 0) {
|
|
184
|
+
setIsLoading(false);
|
|
185
|
+
}
|
|
186
|
+
}, [src]);
|
|
155
187
|
const imageStyle = React.useMemo(() => ({
|
|
156
188
|
'--fade-duration': `${isZoomed ? fadeDuration : 0}ms`,
|
|
157
189
|
...baseImageStyle,
|
|
158
190
|
}), [isZoomed, fadeDuration, baseImageStyle]);
|
|
159
191
|
const imageClass = [styles['c-point-focus__img'], baseImageClassName].filter(Boolean).join(' ');
|
|
160
|
-
const imgElement = (jsxRuntime.jsx("img", { alt: alt, src: src, style: imageStyle, onLoad: handleLoad, onError: handleError, className: imageClass, "data-hidden": isZoomed, "data-testid": 'pf-base-image' }));
|
|
192
|
+
const imgElement = !hasError ? (jsxRuntime.jsx("img", { ref: imgRef, alt: alt, src: src, style: imageStyle, onLoad: handleLoad, onError: handleError, className: imageClass, "data-hidden": isZoomed, "data-testid": 'pf-base-image' })) : null;
|
|
161
193
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [sources && sources.length > 0 ? (jsxRuntime.jsxs("picture", { style: { width: '100%', height: '100%' }, children: [sources
|
|
162
194
|
.filter(s => s.srcSet)
|
|
163
|
-
.map((source, i) => (jsxRuntime.jsx("source", { ...source }, i))), imgElement] })) : (imgElement), isLoading &&
|
|
195
|
+
.map((source, i) => (jsxRuntime.jsx("source", { ...source }, i))), imgElement] })) : (imgElement), isLoading && !hasError && (jsxRuntime.jsx("div", { className: styles['c-point-focus__placeholder'], style: { zIndex: 0 }, "data-testid": 'pf-base-loading', children: loadingPlaceholder ?? jsxRuntime.jsx(FallbackImage, {}) })), hasError && (jsxRuntime.jsx("div", { className: styles['c-point-focus__placeholder'], style: { zIndex: 0 }, "data-testid": 'pf-base-error', children: errorPlaceholder ?? jsxRuntime.jsx(FallbackImage, {}) }))] }));
|
|
164
196
|
};
|
|
165
197
|
|
|
166
|
-
const
|
|
167
|
-
|
|
168
|
-
const ZoomImage = React.forwardRef(({ src, fadeDuration, top, left, isZoomed, onLoad, onDragStart, onDragEnd, onClose, onFadeOut, closeButtonRef, onTouchStart, onTouchEnd, zoomImageClassName, closeButtonClassName, alt, closeButtonAriaLabel, zoomImageAriaLabel, onKeyDown, closeButtonContent, onError, loadingPlaceholder, errorPlaceholder, }, ref) => {
|
|
198
|
+
const ZoomImage = React.forwardRef(({ src, fadeDuration, top, left, isZoomed, onLoad, onDragStart, onDragEnd, onClose, onFadeOut, closeButtonRef, onTouchStart, onTouchEnd, zoomImageClassName, closeButtonClassName, alt, closeButtonAriaLabel, zoomImageAriaLabel, onKeyDown, closeButtonContent, onError, loadingPlaceholder, errorPlaceholder, zoomScale, }, ref) => {
|
|
169
199
|
const [isLoading, setIsLoading] = React.useState(true);
|
|
170
200
|
const [hasError, setHasError] = React.useState(false);
|
|
171
201
|
React.useEffect(() => {
|
|
@@ -185,11 +215,12 @@ const ZoomImage = React.forwardRef(({ src, fadeDuration, top, left, isZoomed, on
|
|
|
185
215
|
};
|
|
186
216
|
const zoomImgClass = [styles['c-point-focus__zoom-img'], zoomImageClassName].filter(Boolean).join(' ');
|
|
187
217
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("img", { ref: ref, "data-testid": 'pf-zoom-image', "data-visible": isZoomed, className: zoomImgClass, style: {
|
|
188
|
-
transform: `translate(${left}px, ${top}px)`,
|
|
218
|
+
transform: `translate(${left}px, ${top}px) scale(${zoomScale})`,
|
|
219
|
+
transformOrigin: 'top left',
|
|
189
220
|
transition: `opacity ${fadeDuration}ms linear, visibility ${fadeDuration}ms linear`,
|
|
190
|
-
}, src: src, onLoad: handleLoad, onError: handleError, onMouseDown: onDragStart, onMouseUp: onDragEnd, onTouchStart: onTouchStart, onTouchEnd: onTouchEnd, onTransitionEnd: onFadeOut, draggable: false, alt: `${alt} zoomed`, "aria-label": zoomImageAriaLabel, onKeyDown: onKeyDown, tabIndex: 0 }), hasError &&
|
|
221
|
+
}, src: src, onLoad: handleLoad, onError: handleError, onMouseDown: onDragStart, onMouseUp: onDragEnd, onTouchStart: onTouchStart, onTouchEnd: onTouchEnd, onTransitionEnd: onFadeOut, draggable: false, alt: `${alt} zoomed`, "aria-label": zoomImageAriaLabel, onKeyDown: onKeyDown, tabIndex: 0 }), hasError && isZoomed && (jsxRuntime.jsx("div", { className: styles['c-point-focus__placeholder'], "data-testid": 'pf-zoom-error', children: errorPlaceholder ?? jsxRuntime.jsx(FallbackImage, {}) })), isLoading && !hasError && isZoomed && (jsxRuntime.jsx("div", { className: styles['c-point-focus__placeholder'], "data-testid": 'pf-zoom-loading', children: loadingPlaceholder ?? jsxRuntime.jsx("span", { className: styles['c-point-focus__loader'] }) })), onClose && (jsxRuntime.jsx("button", { type: 'button', ref: closeButtonRef, title: 'Close Zoom', "data-testid": 'pf-close-button', "aria-label": closeButtonAriaLabel ?? 'Zoom out', "data-visible": isZoomed, "data-action-type": 'close', className: closeButtonClassName || styles['c-point-focus__button'], style: {
|
|
191
222
|
transition: `opacity ${fadeDuration}ms linear, visibility ${fadeDuration}ms linear`,
|
|
192
|
-
}, onClick: onClose, onKeyDown: onKeyDown, children: closeButtonContent ?? jsxRuntime.jsx(CloseIcon, {}) }))] }));
|
|
223
|
+
}, onClick: () => onClose?.('click'), onKeyDown: onKeyDown, children: closeButtonContent ?? jsxRuntime.jsx(CloseIcon, {}) }))] }));
|
|
193
224
|
});
|
|
194
225
|
ZoomImage.displayName = 'ZoomImage';
|
|
195
226
|
|
|
@@ -222,7 +253,7 @@ function startInertia({ initialLeft, initialTop, velocity, setLeft, setTop, boun
|
|
|
222
253
|
requestAnimationFrame(step);
|
|
223
254
|
}
|
|
224
255
|
|
|
225
|
-
const ImageMagnifier = ({ src, sources, width, height, zoomSrc, zoomScale = 1, zoomPreload, fadeDuration = 150, moveType = 'follow', zoomType = 'click', baseImageStyle, hideCloseButton, containerClassName, baseImageClassName, zoomImageClassName, closeButtonClassName, onMouseEnter, onZoomedMouseMove, onMouseLeave, onClickImage, onZoom, onClose, afterZoomImgLoaded, afterZoomOut, onBaseImageError, onZoomImageError, onDragStart, onDragEnd, alt, containerAriaLabel, closeButtonAriaLabel, zoomImageAriaLabel, tabIndex = 0, closeButtonContent, overlay, disableDrag, disableInertia, loadingPlaceholder, errorPlaceholder, clickToZoomOut = false, externalZoomState, setExternalZoomState, }) => {
|
|
256
|
+
const ImageMagnifier = ({ src, sources, width, height, zoomSrc, zoomScale = 1, zoomPreload, fadeDuration = 150, moveType = 'follow', zoomType = 'click', baseImageStyle, hideCloseButton, containerClassName, baseImageClassName, zoomImageClassName, closeButtonClassName, onMouseEnter, onZoomedMouseMove, onMouseLeave, onClickImage, onZoom, onClose, afterZoomImgLoaded, afterZoomOut, onBaseImageError, onZoomImageError, onDragStart, onDragEnd, alt, containerAriaLabel, closeButtonAriaLabel, zoomImageAriaLabel, tabIndex = 0, closeButtonContent, overlay, disableDrag, disableInertia, loadingPlaceholder, errorPlaceholder, clickToZoomOut = false, externalZoomState, setExternalZoomState, disableMobile, }) => {
|
|
226
257
|
const containerRef = React.useRef(null);
|
|
227
258
|
const closeButtonRef = React.useRef(null);
|
|
228
259
|
const zoomedImgRef = React.useRef(null);
|
|
@@ -235,6 +266,7 @@ const ImageMagnifier = ({ src, sources, width, height, zoomSrc, zoomScale = 1, z
|
|
|
235
266
|
const [isFading, setIsFading] = React.useState(false);
|
|
236
267
|
const [left, setLeft] = React.useState(0);
|
|
237
268
|
const [top, setTop] = React.useState(0);
|
|
269
|
+
const safeZoomScale = Math.max(1, Math.min(zoomScale, 5));
|
|
238
270
|
const updateZoomState = (val) => {
|
|
239
271
|
if (isControlled) {
|
|
240
272
|
setExternalZoomState?.(val);
|
|
@@ -243,10 +275,10 @@ const ImageMagnifier = ({ src, sources, width, height, zoomSrc, zoomScale = 1, z
|
|
|
243
275
|
setInternalZoom(val);
|
|
244
276
|
}
|
|
245
277
|
};
|
|
246
|
-
const zoomIn = (pageX, pageY) => {
|
|
278
|
+
const zoomIn = (pageX, pageY, method) => {
|
|
247
279
|
updateZoomState(true);
|
|
248
280
|
initializeFollowZoomPosition(pageX, pageY, containerRef.current, zoomContextRef, setLeft, setTop);
|
|
249
|
-
onZoom?.();
|
|
281
|
+
onZoom?.({ at: { x: pageX, y: pageY }, method: method });
|
|
250
282
|
setTimeout(() => {
|
|
251
283
|
closeButtonRef.current?.focus();
|
|
252
284
|
}, 0);
|
|
@@ -265,26 +297,28 @@ const ImageMagnifier = ({ src, sources, width, height, zoomSrc, zoomScale = 1, z
|
|
|
265
297
|
setTop(0);
|
|
266
298
|
updateZoomState(false);
|
|
267
299
|
};
|
|
268
|
-
const handleDragStart = (e) => {
|
|
269
|
-
if (!isZoomed || disableDrag)
|
|
300
|
+
const handleDragStart = React.useCallback((e) => {
|
|
301
|
+
if (!isZoomed || disableDrag || (disableMobile && isTouchEvent(e)))
|
|
270
302
|
return;
|
|
271
303
|
const { x, y } = getPageCoords(e);
|
|
272
304
|
setIsDragging(true);
|
|
273
305
|
zoomContextRef.current.dragStartCoords = getOffsets(x, y, left, top);
|
|
274
|
-
onDragStart?.(
|
|
275
|
-
|
|
276
|
-
|
|
306
|
+
onDragStart?.({
|
|
307
|
+
start: { x, y },
|
|
308
|
+
source: isTouchEvent(e) ? 'touch' : 'mouse',
|
|
309
|
+
});
|
|
310
|
+
}, [isZoomed, disableDrag, disableMobile, left, top, onDragStart]);
|
|
311
|
+
const handleDragMove = React.useCallback((e) => {
|
|
277
312
|
if (!isDragging)
|
|
278
313
|
return;
|
|
279
314
|
const { x, y } = getPageCoords(e);
|
|
280
315
|
applyDragMove(x, y, zoomContextRef, setLeft, setTop);
|
|
281
316
|
if ('touches' in e)
|
|
282
317
|
e.preventDefault?.();
|
|
283
|
-
};
|
|
284
|
-
const handleDragEnd = () => {
|
|
318
|
+
}, [isDragging, setLeft, setTop]);
|
|
319
|
+
const handleDragEnd = React.useCallback(() => {
|
|
285
320
|
setIsDragging(false);
|
|
286
321
|
zoomContextRef.current.dragStartCoords = { x: 0, y: 0 };
|
|
287
|
-
onDragEnd?.();
|
|
288
322
|
// Animation on end
|
|
289
323
|
// Calculate velocity
|
|
290
324
|
const last = zoomContextRef.current.lastDragCoords;
|
|
@@ -319,87 +353,113 @@ const ImageMagnifier = ({ src, sources, width, height, zoomSrc, zoomScale = 1, z
|
|
|
319
353
|
},
|
|
320
354
|
});
|
|
321
355
|
}
|
|
322
|
-
|
|
356
|
+
onDragEnd?.({
|
|
357
|
+
velocity: { vx, vy },
|
|
358
|
+
final: { x: left, y: top },
|
|
359
|
+
});
|
|
360
|
+
}, [disableInertia, left, top, setLeft, setTop, onDragEnd]);
|
|
323
361
|
const applyImageLoad = (el) => {
|
|
324
|
-
const
|
|
362
|
+
const naturalDimensions = {
|
|
363
|
+
width: el.naturalWidth,
|
|
364
|
+
height: el.naturalHeight,
|
|
365
|
+
};
|
|
366
|
+
const bounds = getBounds(containerRef.current);
|
|
325
367
|
zoomedImgRef.current = el;
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
zoomContextRef.current.
|
|
368
|
+
zoomContextRef.current.scaledDimensions = {
|
|
369
|
+
width: naturalDimensions.width * safeZoomScale,
|
|
370
|
+
height: naturalDimensions.height * safeZoomScale,
|
|
371
|
+
};
|
|
372
|
+
zoomContextRef.current.bounds = bounds;
|
|
373
|
+
zoomContextRef.current.ratios = getRatios(bounds, naturalDimensions, safeZoomScale);
|
|
331
374
|
if (zoomContextRef.current.onLoadCallback) {
|
|
332
375
|
zoomContextRef.current.onLoadCallback();
|
|
333
376
|
zoomContextRef.current.onLoadCallback = null;
|
|
334
377
|
}
|
|
335
378
|
};
|
|
336
|
-
const handleLoad = (e) => {
|
|
379
|
+
const handleLoad = React.useCallback((e) => {
|
|
337
380
|
applyImageLoad(e.currentTarget);
|
|
338
381
|
afterZoomImgLoaded?.();
|
|
339
|
-
};
|
|
340
|
-
const handleClose = (
|
|
341
|
-
onClose?.();
|
|
382
|
+
}, [applyImageLoad, afterZoomImgLoaded]);
|
|
383
|
+
const handleClose = React.useCallback((method) => {
|
|
384
|
+
onClose?.({ triggeredBy: method });
|
|
342
385
|
zoomOut();
|
|
343
|
-
};
|
|
344
|
-
const handleClick = (e) => {
|
|
345
|
-
|
|
386
|
+
}, [onClose, zoomOut]);
|
|
387
|
+
const handleClick = React.useCallback((e, method) => {
|
|
388
|
+
if (disableMobile && isTouchEvent(e))
|
|
389
|
+
return;
|
|
390
|
+
const { x, y } = getPageCoords(e);
|
|
391
|
+
onClickImage?.({ x, y, source: isTouchEvent(e) ? 'touch' : 'mouse' });
|
|
346
392
|
if (zoomContextRef.current.wasDragging) {
|
|
347
393
|
zoomContextRef.current.wasDragging = false;
|
|
348
394
|
return;
|
|
349
395
|
}
|
|
350
396
|
if (isZoomed) {
|
|
351
397
|
if (clickToZoomOut) {
|
|
352
|
-
|
|
398
|
+
handleClose(method);
|
|
353
399
|
}
|
|
354
400
|
return;
|
|
355
401
|
} // is important to keep it to avoid issues when dragging the image with the animation
|
|
356
402
|
if (zoomedImgRef.current) {
|
|
357
403
|
applyImageLoad(zoomedImgRef.current);
|
|
358
|
-
|
|
359
|
-
zoomIn(x, y);
|
|
404
|
+
zoomIn(x, y, method);
|
|
360
405
|
}
|
|
361
406
|
else {
|
|
362
|
-
|
|
363
|
-
zoomContextRef.current.onLoadCallback = () => zoomIn(x, y);
|
|
407
|
+
zoomContextRef.current.onLoadCallback = () => zoomIn(x, y, method);
|
|
364
408
|
}
|
|
365
|
-
};
|
|
366
|
-
const handleKeyDown = (e) => {
|
|
409
|
+
}, [disableMobile, isTouchEvent, getPageCoords, onClickImage, isZoomed, clickToZoomOut, handleClose, applyImageLoad, zoomIn]);
|
|
410
|
+
const handleKeyDown = React.useCallback((e) => {
|
|
367
411
|
if ((e.key === 'Enter' || e.key === ' ') && !isZoomed) {
|
|
368
412
|
e.preventDefault();
|
|
369
413
|
const { x, y } = getPageCoords(e, containerRef.current);
|
|
370
|
-
zoomIn(x, y);
|
|
414
|
+
zoomIn(x, y, 'keyboard');
|
|
371
415
|
}
|
|
372
416
|
if (e.key === 'Escape' && isZoomed) {
|
|
373
417
|
e.preventDefault();
|
|
374
|
-
|
|
418
|
+
handleClose('keyboard');
|
|
375
419
|
}
|
|
376
|
-
};
|
|
377
|
-
const handleZoomLayerKeyDown = (e) => {
|
|
420
|
+
}, [isZoomed, getPageCoords, zoomIn, handleClose]);
|
|
421
|
+
const handleZoomLayerKeyDown = React.useCallback((e) => {
|
|
378
422
|
if (e.key === 'Escape' && isZoomed) {
|
|
379
423
|
e.preventDefault();
|
|
380
|
-
|
|
424
|
+
handleClose('keyboard');
|
|
381
425
|
}
|
|
382
|
-
};
|
|
383
|
-
const
|
|
426
|
+
}, [isZoomed, handleClose]);
|
|
427
|
+
const throttledZoomedMouseMove = React.useCallback((x, y, bounds) => {
|
|
428
|
+
zoomContextRef.current.lastMoveEvent = { x, y, bounds };
|
|
429
|
+
if (zoomContextRef.current.rafId == null) {
|
|
430
|
+
zoomContextRef.current.rafId = window.requestAnimationFrame(() => {
|
|
431
|
+
const evt = zoomContextRef.current.lastMoveEvent;
|
|
432
|
+
if (evt && onZoomedMouseMove) {
|
|
433
|
+
onZoomedMouseMove(evt);
|
|
434
|
+
}
|
|
435
|
+
zoomContextRef.current.rafId = null;
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
}, [onZoomedMouseMove]);
|
|
439
|
+
const handleMouseEnter = React.useCallback((e) => {
|
|
384
440
|
setIsActive(true);
|
|
385
441
|
setIsFading(false);
|
|
386
|
-
onMouseEnter?.();
|
|
387
|
-
if (zoomType === 'hover' && !isZoomed) {
|
|
388
|
-
handleClick(e);
|
|
442
|
+
onMouseEnter?.({ source: isTouchEvent(e) ? 'touch' : 'mouse' });
|
|
443
|
+
if (zoomType === 'hover' && !isZoomed && !(disableMobile && isTouchEvent(e))) {
|
|
444
|
+
handleClick(e, 'hover');
|
|
389
445
|
}
|
|
390
|
-
};
|
|
391
|
-
const handleMouseMove = (e) => {
|
|
392
|
-
onZoomedMouseMove?.();
|
|
446
|
+
}, [setIsActive, setIsFading, onMouseEnter, zoomType, isZoomed, disableMobile, handleClick]);
|
|
447
|
+
const handleMouseMove = React.useCallback((e) => {
|
|
393
448
|
if (moveType === 'follow' && isZoomed) {
|
|
394
|
-
|
|
449
|
+
const { x, y } = getPageCoords(e);
|
|
450
|
+
const bounds = zoomContextRef.current.bounds;
|
|
451
|
+
if (!bounds || typeof bounds.left !== 'number')
|
|
452
|
+
return;
|
|
453
|
+
throttledZoomedMouseMove(x, y, zoomContextRef.current.bounds);
|
|
454
|
+
applyMouseMove(x, y, zoomContextRef, setLeft, setTop);
|
|
395
455
|
}
|
|
396
|
-
};
|
|
397
|
-
const handleMouseLeave = (e) => {
|
|
398
|
-
onMouseLeave?.();
|
|
399
|
-
handleClose();
|
|
400
|
-
};
|
|
401
|
-
const handleFadeOut = (e, noTransition) => {
|
|
402
|
-
if (noTransition || (e.propertyName === 'opacity' && containerRef?.current?.contains(e.target))) {
|
|
456
|
+
}, [moveType, isZoomed, throttledZoomedMouseMove, setLeft, setTop]);
|
|
457
|
+
const handleMouseLeave = React.useCallback((e) => {
|
|
458
|
+
onMouseLeave?.({ source: isTouchEvent(e) ? 'touch' : 'mouse' });
|
|
459
|
+
handleClose('hover');
|
|
460
|
+
}, [onMouseLeave, handleClose]);
|
|
461
|
+
const handleFadeOut = React.useCallback((e, noTransition) => {
|
|
462
|
+
if (noTransition || (e && 'propertyName' in e && e.propertyName === 'opacity' && containerRef?.current?.contains(e.target))) {
|
|
403
463
|
if (!zoomPreload) {
|
|
404
464
|
zoomedImgRef.current = null;
|
|
405
465
|
zoomContextRef.current = getDefaults();
|
|
@@ -408,10 +468,16 @@ const ImageMagnifier = ({ src, sources, width, height, zoomSrc, zoomScale = 1, z
|
|
|
408
468
|
setIsFading(false);
|
|
409
469
|
afterZoomOut?.();
|
|
410
470
|
}
|
|
411
|
-
};
|
|
471
|
+
}, [zoomPreload, setIsActive, setIsFading, afterZoomOut]);
|
|
412
472
|
// possibly extra to be removed
|
|
413
473
|
React.useEffect(() => {
|
|
414
474
|
zoomContextRef.current = getDefaults();
|
|
475
|
+
return () => {
|
|
476
|
+
if (zoomContextRef.current.rafId != null) {
|
|
477
|
+
cancelAnimationFrame(zoomContextRef.current.rafId);
|
|
478
|
+
zoomContextRef.current.rafId = null;
|
|
479
|
+
}
|
|
480
|
+
};
|
|
415
481
|
}, []);
|
|
416
482
|
React.useEffect(() => {
|
|
417
483
|
if (isDragging && !disableDrag) {
|
|
@@ -451,9 +517,14 @@ const ImageMagnifier = ({ src, sources, width, height, zoomSrc, zoomScale = 1, z
|
|
|
451
517
|
closeButtonContent: closeButtonContent,
|
|
452
518
|
loadingPlaceholder: loadingPlaceholder,
|
|
453
519
|
errorPlaceholder: errorPlaceholder,
|
|
520
|
+
zoomScale: safeZoomScale,
|
|
454
521
|
};
|
|
455
522
|
const containerClass = [styles['c-point-focus'], containerClassName].filter(Boolean).join(' ');
|
|
456
|
-
return (jsxRuntime.jsxs("figure", { role: 'group', ref: containerRef, tabIndex: tabIndex, "data-movetype": moveType, "data-testid": 'pf-image-magnifier-container', "aria-label": containerAriaLabel ?? 'Zoomable image', className: containerClass, style: { width: width, height: height }, onClick:
|
|
523
|
+
return (jsxRuntime.jsxs("figure", { role: 'group', ref: containerRef, tabIndex: tabIndex, "data-movetype": moveType, "data-testid": 'pf-image-magnifier-container', "aria-label": containerAriaLabel ?? 'Zoomable image', className: containerClass, style: { width: width, height: height }, onClick: e => handleClick(e, 'hover'), onTouchStart: e => {
|
|
524
|
+
if (disableMobile) {
|
|
525
|
+
e.preventDefault();
|
|
526
|
+
}
|
|
527
|
+
}, onKeyDown: handleKeyDown, onMouseEnter: handleMouseEnter, onMouseMove: isZoomed ? handleMouseMove : undefined, onMouseLeave: handleMouseLeave, children: [jsxRuntime.jsx(BaseImage, { src: src, alt: alt, sources: sources, width: width, height: height, baseImageStyle: baseImageStyle, baseImageClassName: baseImageClassName, fadeDuration: fadeDuration, isZoomed: isZoomed, onError: onBaseImageError }), isActive && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [overlay && (jsxRuntime.jsx("div", { className: styles['c-point-focus__overlay'], "data-testid": 'pf-overlay', children: overlay })), jsxRuntime.jsx(ZoomFallbackBoundary, { fallback: errorPlaceholder ?? jsxRuntime.jsx(FallbackImage, {}), children: jsxRuntime.jsx(ZoomImage, { ref: zoomedImgRef, ...zoomImageProps }, isZoomed && clickToZoomOut ? 'zoomed' : 'unzoomed') })] }))] }));
|
|
457
528
|
};
|
|
458
529
|
|
|
459
530
|
module.exports = ImageMagnifier;
|