@helsenorge/lightbox 8.0.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2019 -0
- package/__mocks__/styleMock.d.ts +1 -0
- package/__mocks__/styleMock.js +2 -0
- package/__mocks__/styleMock.js.map +1 -0
- package/components/LightBox/LightBox.d.ts +39 -0
- package/components/LightBox/MiniSlider.d.ts +11 -0
- package/components/LightBox/index.d.ts +3 -0
- package/components/LightBox/index.js +1105 -0
- package/components/LightBox/index.js.map +1 -0
- package/components/LightBox/styles.module.scss +139 -0
- package/components/LightBox/styles.module.scss.d.ts +20 -0
- package/package.json +20 -0
|
@@ -0,0 +1,1105 @@
|
|
|
1
|
+
import c, { useRef as K, useImperativeHandle as ie, useEffect as F, useContext as pi, useState as _i } from "react";
|
|
2
|
+
import V from "classnames";
|
|
3
|
+
import L from "@helsenorge/designsystem-react/components/Icon";
|
|
4
|
+
import ee from "@helsenorge/designsystem-react/components/Icons/ChevronLeft";
|
|
5
|
+
import re from "@helsenorge/designsystem-react/components/Icons/ChevronRight";
|
|
6
|
+
import ne from "@helsenorge/designsystem-react/components/Icons/ChevronsDown";
|
|
7
|
+
import ae from "@helsenorge/designsystem-react/components/Icons/ChevronsUp";
|
|
8
|
+
import oe from "@helsenorge/designsystem-react/components/Icons/Minus";
|
|
9
|
+
import te from "@helsenorge/designsystem-react/components/Icons/PlusSmall";
|
|
10
|
+
import le from "@helsenorge/designsystem-react/components/Icons/X";
|
|
11
|
+
import { KeyboardEventKey as se, ZIndex as Z, IconSize as M } from "@helsenorge/designsystem-react/constants";
|
|
12
|
+
import { useSize as ue } from "@helsenorge/designsystem-react/hooks/useSize";
|
|
13
|
+
import { useKeyboardEvent as de } from "@helsenorge/designsystem-react";
|
|
14
|
+
import y from "./styles.module.scss";
|
|
15
|
+
var E = function(i, n) {
|
|
16
|
+
return Number(i.toFixed(n));
|
|
17
|
+
}, ve = function(i, n) {
|
|
18
|
+
return n;
|
|
19
|
+
}, C = function(i, n, e) {
|
|
20
|
+
e && typeof e == "function" && e(i, n);
|
|
21
|
+
}, fe = function(i) {
|
|
22
|
+
return -Math.cos(i * Math.PI) / 2 + 0.5;
|
|
23
|
+
}, me = function(i) {
|
|
24
|
+
return i;
|
|
25
|
+
}, pe = function(i) {
|
|
26
|
+
return i * i;
|
|
27
|
+
}, he = function(i) {
|
|
28
|
+
return i * (2 - i);
|
|
29
|
+
}, ce = function(i) {
|
|
30
|
+
return i < 0.5 ? 2 * i * i : -1 + (4 - 2 * i) * i;
|
|
31
|
+
}, ge = function(i) {
|
|
32
|
+
return i * i * i;
|
|
33
|
+
}, be = function(i) {
|
|
34
|
+
return --i * i * i + 1;
|
|
35
|
+
}, Se = function(i) {
|
|
36
|
+
return i < 0.5 ? 4 * i * i * i : (i - 1) * (2 * i - 2) * (2 * i - 2) + 1;
|
|
37
|
+
}, we = function(i) {
|
|
38
|
+
return i * i * i * i;
|
|
39
|
+
}, Ce = function(i) {
|
|
40
|
+
return 1 - --i * i * i * i;
|
|
41
|
+
}, Pe = function(i) {
|
|
42
|
+
return i < 0.5 ? 8 * i * i * i * i : 1 - 8 * --i * i * i * i;
|
|
43
|
+
}, ye = function(i) {
|
|
44
|
+
return i * i * i * i * i;
|
|
45
|
+
}, Ye = function(i) {
|
|
46
|
+
return 1 + --i * i * i * i * i;
|
|
47
|
+
}, Te = function(i) {
|
|
48
|
+
return i < 0.5 ? 16 * i * i * i * i * i : 1 + 16 * --i * i * i * i * i;
|
|
49
|
+
}, Wi = {
|
|
50
|
+
easeOut: fe,
|
|
51
|
+
linear: me,
|
|
52
|
+
easeInQuad: pe,
|
|
53
|
+
easeOutQuad: he,
|
|
54
|
+
easeInOutQuad: ce,
|
|
55
|
+
easeInCubic: ge,
|
|
56
|
+
easeOutCubic: be,
|
|
57
|
+
easeInOutCubic: Se,
|
|
58
|
+
easeInQuart: we,
|
|
59
|
+
easeOutQuart: Ce,
|
|
60
|
+
easeInOutQuart: Pe,
|
|
61
|
+
easeInQuint: ye,
|
|
62
|
+
easeOutQuint: Ye,
|
|
63
|
+
easeInOutQuint: Te
|
|
64
|
+
}, Ni = function(i) {
|
|
65
|
+
typeof i == "number" && cancelAnimationFrame(i);
|
|
66
|
+
}, _ = function(i) {
|
|
67
|
+
i.mounted && (Ni(i.animation), i.animate = !1, i.animation = null, i.velocity = null);
|
|
68
|
+
};
|
|
69
|
+
function Di(i, n, e, r) {
|
|
70
|
+
if (i.mounted) {
|
|
71
|
+
var o = (/* @__PURE__ */ new Date()).getTime(), a = 1;
|
|
72
|
+
_(i), i.animation = function() {
|
|
73
|
+
if (!i.mounted)
|
|
74
|
+
return Ni(i.animation);
|
|
75
|
+
var t = (/* @__PURE__ */ new Date()).getTime() - o, l = t / e, s = Wi[n], u = s(l);
|
|
76
|
+
t >= e ? (r(a), i.animation = null) : i.animation && (r(u), requestAnimationFrame(i.animation));
|
|
77
|
+
}, requestAnimationFrame(i.animation);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function Xe(i) {
|
|
81
|
+
var n = i.scale, e = i.positionX, r = i.positionY;
|
|
82
|
+
return !(Number.isNaN(n) || Number.isNaN(e) || Number.isNaN(r));
|
|
83
|
+
}
|
|
84
|
+
function O(i, n, e, r) {
|
|
85
|
+
var o = Xe(n);
|
|
86
|
+
if (!(!i.mounted || !o)) {
|
|
87
|
+
var a = i.setTransformState, t = i.transformState, l = t.scale, s = t.positionX, u = t.positionY, d = n.scale - l, v = n.positionX - s, f = n.positionY - u;
|
|
88
|
+
e === 0 ? a(n.scale, n.positionX, n.positionY) : Di(i, r, e, function(m) {
|
|
89
|
+
var p = l + d * m, h = s + v * m, g = u + f * m;
|
|
90
|
+
a(p, h, g);
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function Ee(i, n, e) {
|
|
95
|
+
var r = i.offsetWidth, o = i.offsetHeight, a = n.offsetWidth, t = n.offsetHeight, l = a * e, s = t * e, u = r - l, d = o - s;
|
|
96
|
+
return {
|
|
97
|
+
wrapperWidth: r,
|
|
98
|
+
wrapperHeight: o,
|
|
99
|
+
newContentWidth: l,
|
|
100
|
+
newDiffWidth: u,
|
|
101
|
+
newContentHeight: s,
|
|
102
|
+
newDiffHeight: d
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
var ze = function(i, n, e, r, o, a, t) {
|
|
106
|
+
var l = i > n ? e * (t ? 1 : 0.5) : 0, s = r > o ? a * (t ? 1 : 0.5) : 0, u = i - n - l, d = l, v = r - o - s, f = s;
|
|
107
|
+
return { minPositionX: u, maxPositionX: d, minPositionY: v, maxPositionY: f };
|
|
108
|
+
}, hi = function(i, n) {
|
|
109
|
+
var e = i.wrapperComponent, r = i.contentComponent, o = i.setup.centerZoomedOut;
|
|
110
|
+
if (!e || !r)
|
|
111
|
+
throw new Error("Components are not mounted");
|
|
112
|
+
var a = Ee(e, r, n), t = a.wrapperWidth, l = a.wrapperHeight, s = a.newContentWidth, u = a.newDiffWidth, d = a.newContentHeight, v = a.newDiffHeight, f = ze(t, s, u, l, d, v, !!o);
|
|
113
|
+
return f;
|
|
114
|
+
}, ui = function(i, n, e, r) {
|
|
115
|
+
return r ? i < n ? E(n, 2) : i > e ? E(e, 2) : E(i, 2) : E(i, 2);
|
|
116
|
+
}, Q = function(i, n) {
|
|
117
|
+
var e = hi(i, n);
|
|
118
|
+
return i.bounds = e, e;
|
|
119
|
+
};
|
|
120
|
+
function j(i, n, e, r, o, a, t) {
|
|
121
|
+
var l = e.minPositionX, s = e.minPositionY, u = e.maxPositionX, d = e.maxPositionY, v = 0, f = 0;
|
|
122
|
+
t && (v = o, f = a);
|
|
123
|
+
var m = ui(i, l - v, u + v, r), p = ui(n, s - f, d + f, r);
|
|
124
|
+
return { x: m, y: p };
|
|
125
|
+
}
|
|
126
|
+
function x(i, n, e, r, o, a) {
|
|
127
|
+
var t = i.transformState, l = t.scale, s = t.positionX, u = t.positionY, d = r - l;
|
|
128
|
+
if (typeof n != "number" || typeof e != "number")
|
|
129
|
+
return console.error("Mouse X and Y position were not provided!"), { x: s, y: u };
|
|
130
|
+
var v = s - n * d, f = u - e * d, m = j(v, f, o, a, 0, 0, null);
|
|
131
|
+
return m;
|
|
132
|
+
}
|
|
133
|
+
function q(i, n, e, r, o) {
|
|
134
|
+
var a = o ? r : 0, t = n - a;
|
|
135
|
+
return !Number.isNaN(e) && i >= e ? e : !Number.isNaN(n) && i <= t ? t : i;
|
|
136
|
+
}
|
|
137
|
+
var Pi = function(i, n) {
|
|
138
|
+
var e = i.setup.panning.excluded, r = i.isInitialized, o = i.wrapperComponent, a = n.target, t = "shadowRoot" in a && "composedPath" in n, l = t ? n.composedPath().some(function(d) {
|
|
139
|
+
return d instanceof Element ? o == null ? void 0 : o.contains(d) : !1;
|
|
140
|
+
}) : o == null ? void 0 : o.contains(a), s = r && a && l;
|
|
141
|
+
if (!s)
|
|
142
|
+
return !1;
|
|
143
|
+
var u = I(a, e);
|
|
144
|
+
return !u;
|
|
145
|
+
}, yi = function(i) {
|
|
146
|
+
var n = i.isInitialized, e = i.isPanning, r = i.setup, o = r.panning.disabled, a = n && e && !o;
|
|
147
|
+
return !!a;
|
|
148
|
+
}, Ae = function(i, n) {
|
|
149
|
+
var e = i.transformState, r = e.positionX, o = e.positionY;
|
|
150
|
+
i.isPanning = !0;
|
|
151
|
+
var a = n.clientX, t = n.clientY;
|
|
152
|
+
i.startCoords = { x: a - r, y: t - o };
|
|
153
|
+
}, _e = function(i, n) {
|
|
154
|
+
var e = n.touches, r = i.transformState, o = r.positionX, a = r.positionY;
|
|
155
|
+
i.isPanning = !0;
|
|
156
|
+
var t = e.length === 1;
|
|
157
|
+
if (t) {
|
|
158
|
+
var l = e[0].clientX, s = e[0].clientY;
|
|
159
|
+
i.startCoords = { x: l - o, y: s - a };
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
function We(i) {
|
|
163
|
+
var n = i.transformState, e = n.positionX, r = n.positionY, o = n.scale, a = i.setup, t = a.disabled, l = a.limitToBounds, s = a.centerZoomedOut, u = i.wrapperComponent;
|
|
164
|
+
if (!(t || !u || !i.bounds)) {
|
|
165
|
+
var d = i.bounds, v = d.maxPositionX, f = d.minPositionX, m = d.maxPositionY, p = d.minPositionY, h = e > v || e < f, g = r > m || r < p, S = e > v ? u.offsetWidth : i.setup.minPositionX || 0, P = r > m ? u.offsetHeight : i.setup.minPositionY || 0, w = x(i, S, P, o, i.bounds, l || s), X = w.x, T = w.y;
|
|
166
|
+
return {
|
|
167
|
+
scale: o,
|
|
168
|
+
positionX: h ? X : e,
|
|
169
|
+
positionY: g ? T : r
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
function Bi(i, n, e, r, o) {
|
|
174
|
+
var a = i.setup.limitToBounds, t = i.wrapperComponent, l = i.bounds, s = i.transformState, u = s.scale, d = s.positionX, v = s.positionY;
|
|
175
|
+
if (!(t === null || l === null || n === d && e === v)) {
|
|
176
|
+
var f = j(n, e, l, a, r, o, t), m = f.x, p = f.y;
|
|
177
|
+
i.setTransformState(u, m, p);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
var Ne = function(i, n, e) {
|
|
181
|
+
var r = i.startCoords, o = i.transformState, a = i.setup.panning, t = a.lockAxisX, l = a.lockAxisY, s = o.positionX, u = o.positionY;
|
|
182
|
+
if (!r)
|
|
183
|
+
return { x: s, y: u };
|
|
184
|
+
var d = n - r.x, v = e - r.y, f = t ? s : d, m = l ? u : v;
|
|
185
|
+
return { x: f, y: m };
|
|
186
|
+
}, B = function(i, n) {
|
|
187
|
+
var e = i.setup, r = i.transformState, o = r.scale, a = e.minScale, t = e.disablePadding;
|
|
188
|
+
return n > 0 && o >= a && !t ? n : 0;
|
|
189
|
+
}, De = function(i) {
|
|
190
|
+
var n = i.mounted, e = i.setup, r = e.disabled, o = e.velocityAnimation, a = i.transformState.scale, t = o.disabled, l = !t || a > 1 || !r || n;
|
|
191
|
+
return !!l;
|
|
192
|
+
}, Be = function(i) {
|
|
193
|
+
var n = i.mounted, e = i.velocity, r = i.bounds, o = i.setup, a = o.disabled, t = o.velocityAnimation, l = i.transformState.scale, s = t.disabled, u = !s || l > 1 || !a || n;
|
|
194
|
+
return !(!u || !e || !r);
|
|
195
|
+
};
|
|
196
|
+
function Oe(i, n) {
|
|
197
|
+
var e = i.setup.velocityAnimation, r = e.equalToMove, o = e.animationTime, a = e.sensitivity;
|
|
198
|
+
return r ? o * n * a : o;
|
|
199
|
+
}
|
|
200
|
+
function Yi(i, n, e, r, o, a, t, l, s, u) {
|
|
201
|
+
if (o) {
|
|
202
|
+
if (n > t && e > t) {
|
|
203
|
+
var d = t + (i - t) * u;
|
|
204
|
+
return d > s ? s : d < t ? t : d;
|
|
205
|
+
}
|
|
206
|
+
if (n < a && e < a) {
|
|
207
|
+
var d = a + (i - a) * u;
|
|
208
|
+
return d < l ? l : d > a ? a : d;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return r ? n : ui(i, a, t, o);
|
|
212
|
+
}
|
|
213
|
+
function ke(i, n) {
|
|
214
|
+
var e = 1;
|
|
215
|
+
return n ? Math.min(e, i.offsetWidth / window.innerWidth) : e;
|
|
216
|
+
}
|
|
217
|
+
function Ze(i, n) {
|
|
218
|
+
var e = De(i);
|
|
219
|
+
if (e) {
|
|
220
|
+
var r = i.lastMousePosition, o = i.velocityTime, a = i.setup, t = i.wrapperComponent, l = a.velocityAnimation.equalToMove, s = Date.now();
|
|
221
|
+
if (r && o && t) {
|
|
222
|
+
var u = ke(t, l), d = n.x - r.x, v = n.y - r.y, f = d / u, m = v / u, p = s - o, h = d * d + v * v, g = Math.sqrt(h) / p;
|
|
223
|
+
i.velocity = { velocityX: f, velocityY: m, total: g };
|
|
224
|
+
}
|
|
225
|
+
i.lastMousePosition = n, i.velocityTime = s;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
function Le(i) {
|
|
229
|
+
var n = i.velocity, e = i.bounds, r = i.setup, o = i.wrapperComponent, a = Be(i);
|
|
230
|
+
if (!(!a || !n || !e || !o)) {
|
|
231
|
+
var t = n.velocityX, l = n.velocityY, s = n.total, u = e.maxPositionX, d = e.minPositionX, v = e.maxPositionY, f = e.minPositionY, m = r.limitToBounds, p = r.alignmentAnimation, h = r.zoomAnimation, g = r.panning, S = g.lockAxisY, P = g.lockAxisX, w = h.animationType, X = p.sizeX, T = p.sizeY, z = p.velocityAlignmentTime, A = z, W = Oe(i, s), Y = Math.max(W, A), N = B(i, X), k = B(i, T), H = N * o.offsetWidth / 100, U = k * o.offsetHeight / 100, ei = u + H, $ = d - H, ri = v + U, ni = f - U, gi = i.transformState, ji = (/* @__PURE__ */ new Date()).getTime();
|
|
232
|
+
Di(i, w, Y, function(qi) {
|
|
233
|
+
var ai = i.transformState, Ui = ai.scale, oi = ai.positionX, ti = ai.positionY, $i = (/* @__PURE__ */ new Date()).getTime() - ji, Gi = $i / A, Ji = Wi[p.animationType], bi = 1 - Ji(Math.min(1, Gi)), Si = 1 - qi, wi = oi + t * Si, Ci = ti + l * Si, xi = Yi(wi, gi.positionX, oi, P, m, d, u, $, ei, bi), Ii = Yi(Ci, gi.positionY, ti, S, m, f, v, ni, ri, bi);
|
|
234
|
+
(oi !== wi || ti !== Ci) && i.setTransformState(Ui, xi, Ii);
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
function Ti(i, n) {
|
|
239
|
+
var e = i.transformState.scale;
|
|
240
|
+
_(i), Q(i, e), window.TouchEvent !== void 0 && n instanceof TouchEvent ? _e(i, n) : Ae(i, n);
|
|
241
|
+
}
|
|
242
|
+
function Oi(i) {
|
|
243
|
+
var n = i.transformState.scale, e = i.setup, r = e.minScale, o = e.alignmentAnimation, a = o.disabled, t = o.sizeX, l = o.sizeY, s = o.animationTime, u = o.animationType, d = a || n < r || !t && !l;
|
|
244
|
+
if (!d) {
|
|
245
|
+
var v = We(i);
|
|
246
|
+
v && O(i, v, s, u);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
function Xi(i, n, e) {
|
|
250
|
+
var r = i.startCoords, o = i.setup, a = o.alignmentAnimation, t = a.sizeX, l = a.sizeY;
|
|
251
|
+
if (r) {
|
|
252
|
+
var s = Ne(i, n, e), u = s.x, d = s.y, v = B(i, t), f = B(i, l);
|
|
253
|
+
Ze(i, { x: u, y: d }), Bi(i, u, d, v, f);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
function Me(i) {
|
|
257
|
+
if (i.isPanning) {
|
|
258
|
+
var n = i.setup.panning.velocityDisabled, e = i.velocity, r = i.wrapperComponent, o = i.contentComponent;
|
|
259
|
+
i.isPanning = !1, i.animate = !1, i.animation = null;
|
|
260
|
+
var a = r == null ? void 0 : r.getBoundingClientRect(), t = o == null ? void 0 : o.getBoundingClientRect(), l = (a == null ? void 0 : a.width) || 0, s = (a == null ? void 0 : a.height) || 0, u = (t == null ? void 0 : t.width) || 0, d = (t == null ? void 0 : t.height) || 0, v = l < u || s < d, f = !n && e && (e == null ? void 0 : e.total) > 0.1 && v;
|
|
261
|
+
f ? Le(i) : Oi(i);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
function ci(i, n, e, r) {
|
|
265
|
+
var o = i.setup, a = o.minScale, t = o.maxScale, l = o.limitToBounds, s = q(E(n, 2), a, t, 0, !1), u = Q(i, s), d = x(i, e, r, s, u, l), v = d.x, f = d.y;
|
|
266
|
+
return { scale: s, positionX: v, positionY: f };
|
|
267
|
+
}
|
|
268
|
+
function ki(i, n, e) {
|
|
269
|
+
var r = i.transformState.scale, o = i.wrapperComponent, a = i.setup, t = a.minScale, l = a.limitToBounds, s = a.zoomAnimation, u = s.disabled, d = s.animationTime, v = s.animationType, f = u || r >= t;
|
|
270
|
+
if ((r >= 1 || l) && Oi(i), !(f || !o || !i.mounted)) {
|
|
271
|
+
var m = n || o.offsetWidth / 2, p = e || o.offsetHeight / 2, h = ci(i, t, m, p);
|
|
272
|
+
h && O(i, h, d, v);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
var D = function() {
|
|
276
|
+
return D = Object.assign || function(n) {
|
|
277
|
+
for (var e, r = 1, o = arguments.length; r < o; r++) {
|
|
278
|
+
e = arguments[r];
|
|
279
|
+
for (var a in e) Object.prototype.hasOwnProperty.call(e, a) && (n[a] = e[a]);
|
|
280
|
+
}
|
|
281
|
+
return n;
|
|
282
|
+
}, D.apply(this, arguments);
|
|
283
|
+
};
|
|
284
|
+
function Ei(i, n, e) {
|
|
285
|
+
for (var r = 0, o = n.length, a; r < o; r++)
|
|
286
|
+
(a || !(r in n)) && (a || (a = Array.prototype.slice.call(n, 0, r)), a[r] = n[r]);
|
|
287
|
+
return i.concat(a || Array.prototype.slice.call(n));
|
|
288
|
+
}
|
|
289
|
+
var G = {
|
|
290
|
+
previousScale: 1,
|
|
291
|
+
scale: 1,
|
|
292
|
+
positionX: 0,
|
|
293
|
+
positionY: 0
|
|
294
|
+
}, R = {
|
|
295
|
+
disabled: !1,
|
|
296
|
+
minPositionX: null,
|
|
297
|
+
maxPositionX: null,
|
|
298
|
+
minPositionY: null,
|
|
299
|
+
maxPositionY: null,
|
|
300
|
+
minScale: 1,
|
|
301
|
+
maxScale: 8,
|
|
302
|
+
limitToBounds: !0,
|
|
303
|
+
centerZoomedOut: !1,
|
|
304
|
+
centerOnInit: !1,
|
|
305
|
+
disablePadding: !1,
|
|
306
|
+
smooth: !0,
|
|
307
|
+
wheel: {
|
|
308
|
+
step: 0.2,
|
|
309
|
+
disabled: !1,
|
|
310
|
+
smoothStep: 1e-3,
|
|
311
|
+
wheelDisabled: !1,
|
|
312
|
+
touchPadDisabled: !1,
|
|
313
|
+
activationKeys: [],
|
|
314
|
+
excluded: []
|
|
315
|
+
},
|
|
316
|
+
panning: {
|
|
317
|
+
disabled: !1,
|
|
318
|
+
velocityDisabled: !1,
|
|
319
|
+
lockAxisX: !1,
|
|
320
|
+
lockAxisY: !1,
|
|
321
|
+
allowLeftClickPan: !0,
|
|
322
|
+
allowMiddleClickPan: !0,
|
|
323
|
+
allowRightClickPan: !0,
|
|
324
|
+
wheelPanning: !1,
|
|
325
|
+
activationKeys: [],
|
|
326
|
+
excluded: []
|
|
327
|
+
},
|
|
328
|
+
pinch: {
|
|
329
|
+
step: 5,
|
|
330
|
+
disabled: !1,
|
|
331
|
+
excluded: []
|
|
332
|
+
},
|
|
333
|
+
doubleClick: {
|
|
334
|
+
disabled: !1,
|
|
335
|
+
step: 0.7,
|
|
336
|
+
mode: "zoomIn",
|
|
337
|
+
animationType: "easeOut",
|
|
338
|
+
animationTime: 200,
|
|
339
|
+
excluded: []
|
|
340
|
+
},
|
|
341
|
+
zoomAnimation: {
|
|
342
|
+
disabled: !1,
|
|
343
|
+
size: 0.4,
|
|
344
|
+
animationTime: 200,
|
|
345
|
+
animationType: "easeOut"
|
|
346
|
+
},
|
|
347
|
+
alignmentAnimation: {
|
|
348
|
+
disabled: !1,
|
|
349
|
+
sizeX: 100,
|
|
350
|
+
sizeY: 100,
|
|
351
|
+
animationTime: 200,
|
|
352
|
+
velocityAlignmentTime: 400,
|
|
353
|
+
animationType: "easeOut"
|
|
354
|
+
},
|
|
355
|
+
velocityAnimation: {
|
|
356
|
+
disabled: !1,
|
|
357
|
+
sensitivity: 1,
|
|
358
|
+
animationTime: 400,
|
|
359
|
+
animationType: "easeOut",
|
|
360
|
+
equalToMove: !0
|
|
361
|
+
}
|
|
362
|
+
}, di = {
|
|
363
|
+
wrapperClass: "react-transform-wrapper",
|
|
364
|
+
contentClass: "react-transform-component"
|
|
365
|
+
}, Zi = function(i) {
|
|
366
|
+
var n, e, r, o;
|
|
367
|
+
return {
|
|
368
|
+
previousScale: (n = i.initialScale) !== null && n !== void 0 ? n : G.scale,
|
|
369
|
+
scale: (e = i.initialScale) !== null && e !== void 0 ? e : G.scale,
|
|
370
|
+
positionX: (r = i.initialPositionX) !== null && r !== void 0 ? r : G.positionX,
|
|
371
|
+
positionY: (o = i.initialPositionY) !== null && o !== void 0 ? o : G.positionY
|
|
372
|
+
};
|
|
373
|
+
}, zi = function(i) {
|
|
374
|
+
var n = D({}, R);
|
|
375
|
+
return Object.keys(i).forEach(function(e) {
|
|
376
|
+
var r = typeof i[e] < "u", o = typeof R[e] < "u";
|
|
377
|
+
if (o && r) {
|
|
378
|
+
var a = Object.prototype.toString.call(R[e]), t = a === "[object Object]", l = a === "[object Array]";
|
|
379
|
+
t ? n[e] = D(D({}, R[e]), i[e]) : l ? n[e] = Ei(Ei([], R[e], !0), i[e]) : n[e] = i[e];
|
|
380
|
+
}
|
|
381
|
+
}), n;
|
|
382
|
+
}, Li = function(i, n, e) {
|
|
383
|
+
var r = i.transformState.scale, o = i.wrapperComponent, a = i.setup, t = a.maxScale, l = a.minScale, s = a.zoomAnimation, u = a.smooth, d = s.size;
|
|
384
|
+
if (!o)
|
|
385
|
+
throw new Error("Wrapper is not mounted");
|
|
386
|
+
var v = u ? r * Math.exp(n * e) : r + n * e, f = q(E(v, 3), l, t, d, !1);
|
|
387
|
+
return f;
|
|
388
|
+
};
|
|
389
|
+
function Mi(i, n, e, r, o) {
|
|
390
|
+
var a = i.wrapperComponent, t = i.transformState, l = t.scale, s = t.positionX, u = t.positionY;
|
|
391
|
+
if (!a)
|
|
392
|
+
return console.error("No WrapperComponent found");
|
|
393
|
+
var d = a.offsetWidth, v = a.offsetHeight, f = (d / 2 - s) / l, m = (v / 2 - u) / l, p = Li(i, n, e), h = ci(i, p, f, m);
|
|
394
|
+
if (!h)
|
|
395
|
+
return console.error("Error during zoom event. New transformation state was not calculated.");
|
|
396
|
+
O(i, h, r, o);
|
|
397
|
+
}
|
|
398
|
+
function Vi(i, n, e, r) {
|
|
399
|
+
var o = i.setup, a = i.wrapperComponent, t = o.limitToBounds, l = Zi(i.props), s = i.transformState, u = s.scale, d = s.positionX, v = s.positionY;
|
|
400
|
+
if (a) {
|
|
401
|
+
var f = hi(i, l.scale), m = j(l.positionX, l.positionY, f, t, 0, 0, a), p = {
|
|
402
|
+
scale: l.scale,
|
|
403
|
+
positionX: m.x,
|
|
404
|
+
positionY: m.y
|
|
405
|
+
};
|
|
406
|
+
u === l.scale && d === l.positionX && v === l.positionY || (r == null || r(), O(i, p, n, e));
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
function Ve(i, n, e, r) {
|
|
410
|
+
var o = i.getBoundingClientRect(), a = n.getBoundingClientRect(), t = e.getBoundingClientRect(), l = a.x * r.scale, s = a.y * r.scale;
|
|
411
|
+
return {
|
|
412
|
+
x: (o.x - t.x + l) / r.scale,
|
|
413
|
+
y: (o.y - t.y + s) / r.scale
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
function He(i, n, e) {
|
|
417
|
+
var r = i.wrapperComponent, o = i.contentComponent, a = i.transformState, t = i.setup, l = t.limitToBounds, s = t.minScale, u = t.maxScale;
|
|
418
|
+
if (!r || !o)
|
|
419
|
+
return a;
|
|
420
|
+
var d = r.getBoundingClientRect(), v = n.getBoundingClientRect(), f = Ve(n, r, o, a), m = f.x, p = f.y, h = v.width / a.scale, g = v.height / a.scale, S = r.offsetWidth / h, P = r.offsetHeight / g, w = q(e || Math.min(S, P), s, u, 0, !1), X = (d.width - h * w) / 2, T = (d.height - g * w) / 2, z = (d.left - m) * w + X, A = (d.top - p) * w + T, W = hi(i, w), Y = j(z, A, W, l, 0, 0, r), N = Y.x, k = Y.y;
|
|
421
|
+
return { positionX: N, positionY: k, scale: w };
|
|
422
|
+
}
|
|
423
|
+
var Ke = function(i) {
|
|
424
|
+
return function(n, e, r) {
|
|
425
|
+
n === void 0 && (n = 0.5), e === void 0 && (e = 300), r === void 0 && (r = "easeOut"), Mi(i, 1, n, e, r);
|
|
426
|
+
};
|
|
427
|
+
}, Qe = function(i) {
|
|
428
|
+
return function(n, e, r) {
|
|
429
|
+
n === void 0 && (n = 0.5), e === void 0 && (e = 300), r === void 0 && (r = "easeOut"), Mi(i, -1, n, e, r);
|
|
430
|
+
};
|
|
431
|
+
}, Re = function(i) {
|
|
432
|
+
return function(n, e, r, o, a) {
|
|
433
|
+
o === void 0 && (o = 300), a === void 0 && (a = "easeOut");
|
|
434
|
+
var t = i.transformState, l = t.positionX, s = t.positionY, u = t.scale, d = i.wrapperComponent, v = i.contentComponent, f = i.setup.disabled;
|
|
435
|
+
if (!(f || !d || !v)) {
|
|
436
|
+
var m = {
|
|
437
|
+
positionX: Number.isNaN(n) ? l : n,
|
|
438
|
+
positionY: Number.isNaN(e) ? s : e,
|
|
439
|
+
scale: Number.isNaN(r) ? u : r
|
|
440
|
+
};
|
|
441
|
+
O(i, m, o, a);
|
|
442
|
+
}
|
|
443
|
+
};
|
|
444
|
+
}, Fe = function(i) {
|
|
445
|
+
return function(n, e) {
|
|
446
|
+
n === void 0 && (n = 200), e === void 0 && (e = "easeOut"), Vi(i, n, e);
|
|
447
|
+
};
|
|
448
|
+
}, je = function(i) {
|
|
449
|
+
return function(n, e, r) {
|
|
450
|
+
e === void 0 && (e = 200), r === void 0 && (r = "easeOut");
|
|
451
|
+
var o = i.transformState, a = i.wrapperComponent, t = i.contentComponent;
|
|
452
|
+
if (a && t) {
|
|
453
|
+
var l = Hi(n || o.scale, a, t);
|
|
454
|
+
O(i, l, e, r);
|
|
455
|
+
}
|
|
456
|
+
};
|
|
457
|
+
}, qe = function(i) {
|
|
458
|
+
return function(n, e, r, o) {
|
|
459
|
+
r === void 0 && (r = 600), o === void 0 && (o = "easeOut"), _(i);
|
|
460
|
+
var a = i.wrapperComponent, t = typeof n == "string" ? document.getElementById(n) : n;
|
|
461
|
+
if (a && t && a.contains(t)) {
|
|
462
|
+
var l = He(i, t, e);
|
|
463
|
+
O(i, l, r, o);
|
|
464
|
+
}
|
|
465
|
+
};
|
|
466
|
+
}, vi = function(i) {
|
|
467
|
+
return {
|
|
468
|
+
instance: i,
|
|
469
|
+
zoomIn: Ke(i),
|
|
470
|
+
zoomOut: Qe(i),
|
|
471
|
+
setTransform: Re(i),
|
|
472
|
+
resetTransform: Fe(i),
|
|
473
|
+
centerView: je(i),
|
|
474
|
+
zoomToElement: qe(i)
|
|
475
|
+
};
|
|
476
|
+
}, fi = function(i) {
|
|
477
|
+
return {
|
|
478
|
+
instance: i,
|
|
479
|
+
state: i.transformState
|
|
480
|
+
};
|
|
481
|
+
}, b = function(i) {
|
|
482
|
+
var n = {};
|
|
483
|
+
return Object.assign(n, fi(i)), Object.assign(n, vi(i)), n;
|
|
484
|
+
}, li = !1;
|
|
485
|
+
function si() {
|
|
486
|
+
try {
|
|
487
|
+
var i = {
|
|
488
|
+
get passive() {
|
|
489
|
+
return li = !0, !1;
|
|
490
|
+
}
|
|
491
|
+
};
|
|
492
|
+
return i;
|
|
493
|
+
} catch {
|
|
494
|
+
return li = !1, li;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
var J = ".".concat(di.wrapperClass), I = function(i, n) {
|
|
498
|
+
return n.some(function(e) {
|
|
499
|
+
return i.matches("".concat(J, " ").concat(e, ", ").concat(J, " .").concat(e, ", ").concat(J, " ").concat(e, " *, ").concat(J, " .").concat(e, " *"));
|
|
500
|
+
});
|
|
501
|
+
}, mi = function(i) {
|
|
502
|
+
i && clearTimeout(i);
|
|
503
|
+
}, Ue = function(i, n, e) {
|
|
504
|
+
return "translate(".concat(i, "px, ").concat(n, "px) scale(").concat(e, ")");
|
|
505
|
+
}, Hi = function(i, n, e) {
|
|
506
|
+
var r = e.offsetWidth * i, o = e.offsetHeight * i, a = (n.offsetWidth - r) / 2, t = (n.offsetHeight - o) / 2;
|
|
507
|
+
return {
|
|
508
|
+
scale: i,
|
|
509
|
+
positionX: a,
|
|
510
|
+
positionY: t
|
|
511
|
+
};
|
|
512
|
+
};
|
|
513
|
+
function $e(i) {
|
|
514
|
+
return function(n) {
|
|
515
|
+
i.forEach(function(e) {
|
|
516
|
+
typeof e == "function" ? e(n) : e != null && (e.current = n);
|
|
517
|
+
});
|
|
518
|
+
};
|
|
519
|
+
}
|
|
520
|
+
var Ge = function(i, n) {
|
|
521
|
+
var e = i.setup.wheel, r = e.disabled, o = e.wheelDisabled, a = e.touchPadDisabled, t = e.excluded, l = i.isInitialized, s = i.isPanning, u = n.target, d = l && !s && !r && u;
|
|
522
|
+
if (!d || o && !n.ctrlKey || a && n.ctrlKey)
|
|
523
|
+
return !1;
|
|
524
|
+
var v = I(u, t);
|
|
525
|
+
return !v;
|
|
526
|
+
}, Je = function(i) {
|
|
527
|
+
return i ? i.deltaY < 0 ? 1 : -1 : 0;
|
|
528
|
+
};
|
|
529
|
+
function xe(i, n) {
|
|
530
|
+
var e = Je(i), r = ve(n, e);
|
|
531
|
+
return r;
|
|
532
|
+
}
|
|
533
|
+
function Ki(i, n, e) {
|
|
534
|
+
var r = n.getBoundingClientRect(), o = 0, a = 0;
|
|
535
|
+
if ("clientX" in i)
|
|
536
|
+
o = (i.clientX - r.left) / e, a = (i.clientY - r.top) / e;
|
|
537
|
+
else {
|
|
538
|
+
var t = i.touches[0];
|
|
539
|
+
o = (t.clientX - r.left) / e, a = (t.clientY - r.top) / e;
|
|
540
|
+
}
|
|
541
|
+
return (Number.isNaN(o) || Number.isNaN(a)) && console.error("No mouse or touch offset found"), {
|
|
542
|
+
x: o,
|
|
543
|
+
y: a
|
|
544
|
+
};
|
|
545
|
+
}
|
|
546
|
+
var Ie = function(i, n, e, r, o) {
|
|
547
|
+
var a = i.transformState.scale, t = i.wrapperComponent, l = i.setup, s = l.maxScale, u = l.minScale, d = l.zoomAnimation, v = l.disablePadding, f = d.size, m = d.disabled;
|
|
548
|
+
if (!t)
|
|
549
|
+
throw new Error("Wrapper is not mounted");
|
|
550
|
+
var p = a + n * e, h = r ? !1 : !m, g = q(E(p, 3), u, s, f, h && !v);
|
|
551
|
+
return g;
|
|
552
|
+
}, ir = function(i, n) {
|
|
553
|
+
var e = i.previousWheelEvent, r = i.transformState.scale, o = i.setup, a = o.maxScale, t = o.minScale;
|
|
554
|
+
return e ? r < a || r > t || Math.sign(e.deltaY) !== Math.sign(n.deltaY) || e.deltaY > 0 && e.deltaY < n.deltaY || e.deltaY < 0 && e.deltaY > n.deltaY || Math.sign(e.deltaY) !== Math.sign(n.deltaY) : !1;
|
|
555
|
+
}, er = function(i, n) {
|
|
556
|
+
var e = i.setup.pinch, r = e.disabled, o = e.excluded, a = i.isInitialized, t = n.target, l = a && !r && t;
|
|
557
|
+
if (!l)
|
|
558
|
+
return !1;
|
|
559
|
+
var s = I(t, o);
|
|
560
|
+
return !s;
|
|
561
|
+
}, rr = function(i) {
|
|
562
|
+
var n = i.setup.pinch.disabled, e = i.isInitialized, r = i.pinchStartDistance, o = e && !n && r;
|
|
563
|
+
return !!o;
|
|
564
|
+
}, nr = function(i, n, e) {
|
|
565
|
+
var r = e.getBoundingClientRect(), o = i.touches, a = E(o[0].clientX - r.left, 5), t = E(o[0].clientY - r.top, 5), l = E(o[1].clientX - r.left, 5), s = E(o[1].clientY - r.top, 5);
|
|
566
|
+
return {
|
|
567
|
+
x: (a + l) / 2 / n,
|
|
568
|
+
y: (t + s) / 2 / n
|
|
569
|
+
};
|
|
570
|
+
}, Qi = function(i) {
|
|
571
|
+
return Math.sqrt(Math.pow(i.touches[0].pageX - i.touches[1].pageX, 2) + Math.pow(i.touches[0].pageY - i.touches[1].pageY, 2));
|
|
572
|
+
}, ar = function(i, n) {
|
|
573
|
+
var e = i.pinchStartScale, r = i.pinchStartDistance, o = i.setup, a = o.maxScale, t = o.minScale, l = o.zoomAnimation, s = o.disablePadding, u = l.size, d = l.disabled;
|
|
574
|
+
if (!e || r === null || !n)
|
|
575
|
+
throw new Error("Pinch touches distance was not provided");
|
|
576
|
+
if (n < 0)
|
|
577
|
+
return i.transformState.scale;
|
|
578
|
+
var v = n / r, f = v * e;
|
|
579
|
+
return q(E(f, 2), t, a, u, !d && !s);
|
|
580
|
+
}, or = 160, tr = 100, lr = function(i, n) {
|
|
581
|
+
var e = i.props, r = e.onWheelStart, o = e.onZoomStart;
|
|
582
|
+
i.wheelStopEventTimer || (_(i), C(b(i), n, r), C(b(i), n, o));
|
|
583
|
+
}, sr = function(i, n) {
|
|
584
|
+
var e = i.props, r = e.onWheel, o = e.onZoom, a = i.contentComponent, t = i.setup, l = i.transformState, s = l.scale, u = t.limitToBounds, d = t.centerZoomedOut, v = t.zoomAnimation, f = t.wheel, m = t.disablePadding, p = t.smooth, h = v.size, g = v.disabled, S = f.step, P = f.smoothStep;
|
|
585
|
+
if (!a)
|
|
586
|
+
throw new Error("Component not mounted");
|
|
587
|
+
n.preventDefault(), n.stopPropagation();
|
|
588
|
+
var w = xe(n, null), X = p ? P * Math.abs(n.deltaY) : S, T = Ie(i, w, X, !n.ctrlKey);
|
|
589
|
+
if (s !== T) {
|
|
590
|
+
var z = Q(i, T), A = Ki(n, a, s), W = g || h === 0 || d || m, Y = u && W, N = x(i, A.x, A.y, T, z, Y), k = N.x, H = N.y;
|
|
591
|
+
i.previousWheelEvent = n, i.setTransformState(T, k, H), C(b(i), n, r), C(b(i), n, o);
|
|
592
|
+
}
|
|
593
|
+
}, ur = function(i, n) {
|
|
594
|
+
var e = i.props, r = e.onWheelStop, o = e.onZoomStop;
|
|
595
|
+
mi(i.wheelAnimationTimer), i.wheelAnimationTimer = setTimeout(function() {
|
|
596
|
+
i.mounted && (ki(i, n.x, n.y), i.wheelAnimationTimer = null);
|
|
597
|
+
}, tr);
|
|
598
|
+
var a = ir(i, n);
|
|
599
|
+
a && (mi(i.wheelStopEventTimer), i.wheelStopEventTimer = setTimeout(function() {
|
|
600
|
+
i.mounted && (i.wheelStopEventTimer = null, C(b(i), n, r), C(b(i), n, o));
|
|
601
|
+
}, or));
|
|
602
|
+
}, Ri = function(i) {
|
|
603
|
+
for (var n = 0, e = 0, r = 0; r < 2; r += 1)
|
|
604
|
+
n += i.touches[r].clientX, e += i.touches[r].clientY;
|
|
605
|
+
var o = n / 2, a = e / 2;
|
|
606
|
+
return { x: o, y: a };
|
|
607
|
+
}, dr = function(i, n) {
|
|
608
|
+
var e = Qi(n);
|
|
609
|
+
i.pinchStartDistance = e, i.lastDistance = e, i.pinchStartScale = i.transformState.scale, i.isPanning = !1;
|
|
610
|
+
var r = Ri(n);
|
|
611
|
+
i.pinchLastCenterX = r.x, i.pinchLastCenterY = r.y, _(i);
|
|
612
|
+
}, vr = function(i, n) {
|
|
613
|
+
var e = i.contentComponent, r = i.pinchStartDistance, o = i.wrapperComponent, a = i.transformState.scale, t = i.setup, l = t.limitToBounds, s = t.centerZoomedOut, u = t.zoomAnimation, d = t.alignmentAnimation, v = u.disabled, f = u.size;
|
|
614
|
+
if (!(r === null || !e)) {
|
|
615
|
+
var m = nr(n, a, e);
|
|
616
|
+
if (!(!Number.isFinite(m.x) || !Number.isFinite(m.y))) {
|
|
617
|
+
var p = Qi(n), h = ar(i, p), g = Ri(n), S = g.x - (i.pinchLastCenterX || 0), P = g.y - (i.pinchLastCenterY || 0);
|
|
618
|
+
if (!(h === a && S === 0 && P === 0)) {
|
|
619
|
+
i.pinchLastCenterX = g.x, i.pinchLastCenterY = g.y;
|
|
620
|
+
var w = Q(i, h), X = v || f === 0 || s, T = l && X, z = x(i, m.x, m.y, h, w, T), A = z.x, W = z.y;
|
|
621
|
+
i.pinchMidpoint = m, i.lastDistance = p;
|
|
622
|
+
var Y = d.sizeX, N = d.sizeY, k = B(i, Y), H = B(i, N), U = A + S, ei = W + P, $ = j(U, ei, w, l, k, H, o), ri = $.x, ni = $.y;
|
|
623
|
+
i.setTransformState(h, ri, ni);
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
}, fr = function(i) {
|
|
628
|
+
var n = i.pinchMidpoint;
|
|
629
|
+
i.velocity = null, i.lastDistance = null, i.pinchMidpoint = null, i.pinchStartScale = null, i.pinchStartDistance = null, ki(i, n == null ? void 0 : n.x, n == null ? void 0 : n.y);
|
|
630
|
+
}, Fi = function(i, n) {
|
|
631
|
+
var e = i.props.onZoomStop, r = i.setup.doubleClick.animationTime;
|
|
632
|
+
mi(i.doubleClickStopEventTimer), i.doubleClickStopEventTimer = setTimeout(function() {
|
|
633
|
+
i.doubleClickStopEventTimer = null, C(b(i), n, e);
|
|
634
|
+
}, r);
|
|
635
|
+
}, mr = function(i, n) {
|
|
636
|
+
var e = i.props, r = e.onZoomStart, o = e.onZoom, a = i.setup.doubleClick, t = a.animationTime, l = a.animationType;
|
|
637
|
+
C(b(i), n, r), Vi(i, t, l, function() {
|
|
638
|
+
return C(b(i), n, o);
|
|
639
|
+
}), Fi(i, n);
|
|
640
|
+
};
|
|
641
|
+
function pr(i, n) {
|
|
642
|
+
return i === "toggle" ? n === 1 ? 1 : -1 : i === "zoomOut" ? -1 : 1;
|
|
643
|
+
}
|
|
644
|
+
function hr(i, n) {
|
|
645
|
+
var e = i.setup, r = i.doubleClickStopEventTimer, o = i.transformState, a = i.contentComponent, t = o.scale, l = i.props, s = l.onZoomStart, u = l.onZoom, d = e.doubleClick, v = d.disabled, f = d.mode, m = d.step, p = d.animationTime, h = d.animationType;
|
|
646
|
+
if (!v && !r) {
|
|
647
|
+
if (f === "reset")
|
|
648
|
+
return mr(i, n);
|
|
649
|
+
if (!a)
|
|
650
|
+
return console.error("No ContentComponent found");
|
|
651
|
+
var g = pr(f, i.transformState.scale), S = Li(i, g, m);
|
|
652
|
+
if (t !== S) {
|
|
653
|
+
C(b(i), n, s);
|
|
654
|
+
var P = Ki(n, a, t), w = ci(i, S, P.x, P.y);
|
|
655
|
+
if (!w)
|
|
656
|
+
return console.error("Error during zoom event. New transformation state was not calculated.");
|
|
657
|
+
C(b(i), n, u), O(i, w, p, h), Fi(i, n);
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
var cr = function(i, n) {
|
|
662
|
+
var e = i.isInitialized, r = i.setup, o = i.wrapperComponent, a = r.doubleClick, t = a.disabled, l = a.excluded, s = n.target, u = o == null ? void 0 : o.contains(s), d = e && s && u && !t;
|
|
663
|
+
if (!d)
|
|
664
|
+
return !1;
|
|
665
|
+
var v = I(s, l);
|
|
666
|
+
return !v;
|
|
667
|
+
}, gr = (
|
|
668
|
+
/** @class */
|
|
669
|
+
/* @__PURE__ */ function() {
|
|
670
|
+
function i(n) {
|
|
671
|
+
var e = this;
|
|
672
|
+
this.mounted = !0, this.pinchLastCenterX = null, this.pinchLastCenterY = null, this.onChangeCallbacks = /* @__PURE__ */ new Set(), this.onInitCallbacks = /* @__PURE__ */ new Set(), this.wrapperComponent = null, this.contentComponent = null, this.isInitialized = !1, this.bounds = null, this.previousWheelEvent = null, this.wheelStopEventTimer = null, this.wheelAnimationTimer = null, this.isPanning = !1, this.isWheelPanning = !1, this.startCoords = null, this.lastTouch = null, this.distance = null, this.lastDistance = null, this.pinchStartDistance = null, this.pinchStartScale = null, this.pinchMidpoint = null, this.doubleClickStopEventTimer = null, this.velocity = null, this.velocityTime = null, this.lastMousePosition = null, this.animate = !1, this.animation = null, this.maxBounds = null, this.pressedKeys = {}, this.mount = function() {
|
|
673
|
+
e.initializeWindowEvents();
|
|
674
|
+
}, this.unmount = function() {
|
|
675
|
+
e.cleanupWindowEvents();
|
|
676
|
+
}, this.update = function(r) {
|
|
677
|
+
e.props = r, Q(e, e.transformState.scale), e.setup = zi(r);
|
|
678
|
+
}, this.initializeWindowEvents = function() {
|
|
679
|
+
var r, o, a = si(), t = (r = e.wrapperComponent) === null || r === void 0 ? void 0 : r.ownerDocument, l = t == null ? void 0 : t.defaultView;
|
|
680
|
+
(o = e.wrapperComponent) === null || o === void 0 || o.addEventListener("wheel", e.onWheelPanning, a), l == null || l.addEventListener("mousedown", e.onPanningStart, a), l == null || l.addEventListener("mousemove", e.onPanning, a), l == null || l.addEventListener("mouseup", e.onPanningStop, a), t == null || t.addEventListener("mouseleave", e.clearPanning, a), l == null || l.addEventListener("keyup", e.setKeyUnPressed, a), l == null || l.addEventListener("keydown", e.setKeyPressed, a);
|
|
681
|
+
}, this.cleanupWindowEvents = function() {
|
|
682
|
+
var r, o, a = si(), t = (r = e.wrapperComponent) === null || r === void 0 ? void 0 : r.ownerDocument, l = t == null ? void 0 : t.defaultView;
|
|
683
|
+
l == null || l.removeEventListener("mousedown", e.onPanningStart, a), l == null || l.removeEventListener("mousemove", e.onPanning, a), l == null || l.removeEventListener("mouseup", e.onPanningStop, a), t == null || t.removeEventListener("mouseleave", e.clearPanning, a), l == null || l.removeEventListener("keyup", e.setKeyUnPressed, a), l == null || l.removeEventListener("keydown", e.setKeyPressed, a), document.removeEventListener("mouseleave", e.clearPanning, a), _(e), (o = e.observer) === null || o === void 0 || o.disconnect();
|
|
684
|
+
}, this.handleInitializeWrapperEvents = function(r) {
|
|
685
|
+
var o = si();
|
|
686
|
+
r.addEventListener("wheel", e.onWheelZoom, o), r.addEventListener("dblclick", e.onDoubleClick, o), r.addEventListener("touchstart", e.onTouchPanningStart, o), r.addEventListener("touchmove", e.onTouchPanning, o), r.addEventListener("touchend", e.onTouchPanningStop, o);
|
|
687
|
+
}, this.handleInitialize = function(r) {
|
|
688
|
+
var o = e.setup.centerOnInit;
|
|
689
|
+
e.applyTransformation(), e.onInitCallbacks.forEach(function(a) {
|
|
690
|
+
return a(b(e));
|
|
691
|
+
}), o && (e.setCenter(), e.observer = new ResizeObserver(function() {
|
|
692
|
+
var a, t = r.offsetWidth, l = r.offsetHeight;
|
|
693
|
+
(t > 0 || l > 0) && (e.onInitCallbacks.forEach(function(s) {
|
|
694
|
+
return s(b(e));
|
|
695
|
+
}), e.setCenter(), (a = e.observer) === null || a === void 0 || a.disconnect());
|
|
696
|
+
}), setTimeout(function() {
|
|
697
|
+
var a;
|
|
698
|
+
(a = e.observer) === null || a === void 0 || a.disconnect();
|
|
699
|
+
}, 5e3), e.observer.observe(r));
|
|
700
|
+
}, this.onWheelZoom = function(r) {
|
|
701
|
+
var o = e.setup.disabled;
|
|
702
|
+
if (!o) {
|
|
703
|
+
var a = Ge(e, r);
|
|
704
|
+
if (a) {
|
|
705
|
+
var t = e.isPressingKeys(e.setup.wheel.activationKeys);
|
|
706
|
+
t && (lr(e, r), sr(e, r), ur(e, r));
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
}, this.onWheelPanning = function(r) {
|
|
710
|
+
var o = e.setup, a = o.disabled, t = o.wheel, l = o.panning;
|
|
711
|
+
if (!(!e.wrapperComponent || !e.contentComponent || a || !t.wheelDisabled || l.disabled || !l.wheelPanning || r.ctrlKey)) {
|
|
712
|
+
r.preventDefault(), r.stopPropagation();
|
|
713
|
+
var s = e.transformState, u = s.positionX, d = s.positionY, v = u - r.deltaX, f = d - r.deltaY, m = l.lockAxisX ? u : v, p = l.lockAxisY ? d : f, h = e.setup.alignmentAnimation, g = h.sizeX, S = h.sizeY, P = B(e, g), w = B(e, S);
|
|
714
|
+
m === u && p === d || Bi(e, m, p, P, w);
|
|
715
|
+
}
|
|
716
|
+
}, this.onPanningStart = function(r) {
|
|
717
|
+
var o = e.setup.disabled, a = e.props.onPanningStart;
|
|
718
|
+
if (!o) {
|
|
719
|
+
var t = Pi(e, r);
|
|
720
|
+
if (t) {
|
|
721
|
+
var l = e.isPressingKeys(e.setup.panning.activationKeys);
|
|
722
|
+
l && (r.button === 0 && !e.setup.panning.allowLeftClickPan || r.button === 1 && !e.setup.panning.allowMiddleClickPan || r.button === 2 && !e.setup.panning.allowRightClickPan || (r.preventDefault(), r.stopPropagation(), _(e), Ti(e, r), C(b(e), r, a)));
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
}, this.onPanning = function(r) {
|
|
726
|
+
var o = e.setup.disabled, a = e.props.onPanning;
|
|
727
|
+
if (!o) {
|
|
728
|
+
var t = yi(e);
|
|
729
|
+
if (t) {
|
|
730
|
+
var l = e.isPressingKeys(e.setup.panning.activationKeys);
|
|
731
|
+
l && (r.preventDefault(), r.stopPropagation(), Xi(e, r.clientX, r.clientY), C(b(e), r, a));
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
}, this.onPanningStop = function(r) {
|
|
735
|
+
var o = e.props.onPanningStop;
|
|
736
|
+
e.isPanning && (Me(e), C(b(e), r, o));
|
|
737
|
+
}, this.onPinchStart = function(r) {
|
|
738
|
+
var o = e.setup.disabled, a = e.props, t = a.onPinchingStart, l = a.onZoomStart;
|
|
739
|
+
if (!o) {
|
|
740
|
+
var s = er(e, r);
|
|
741
|
+
s && (dr(e, r), _(e), C(b(e), r, t), C(b(e), r, l));
|
|
742
|
+
}
|
|
743
|
+
}, this.onPinch = function(r) {
|
|
744
|
+
var o = e.setup.disabled, a = e.props, t = a.onPinching, l = a.onZoom;
|
|
745
|
+
if (!o) {
|
|
746
|
+
var s = rr(e);
|
|
747
|
+
s && (r.preventDefault(), r.stopPropagation(), vr(e, r), C(b(e), r, t), C(b(e), r, l));
|
|
748
|
+
}
|
|
749
|
+
}, this.onPinchStop = function(r) {
|
|
750
|
+
var o = e.props, a = o.onPinchingStop, t = o.onZoomStop;
|
|
751
|
+
e.pinchStartScale && (fr(e), C(b(e), r, a), C(b(e), r, t));
|
|
752
|
+
}, this.onTouchPanningStart = function(r) {
|
|
753
|
+
var o = e.setup.disabled, a = e.props.onPanningStart;
|
|
754
|
+
if (!o) {
|
|
755
|
+
var t = Pi(e, r);
|
|
756
|
+
if (t) {
|
|
757
|
+
var l = e.lastTouch && +/* @__PURE__ */ new Date() - e.lastTouch < 200;
|
|
758
|
+
if (!l) {
|
|
759
|
+
e.lastTouch = +/* @__PURE__ */ new Date(), _(e);
|
|
760
|
+
var s = r.touches, u = s.length === 1, d = s.length === 2;
|
|
761
|
+
u && (_(e), Ti(e, r), C(b(e), r, a)), d && e.onPinchStart(r);
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
}, this.onTouchPanning = function(r) {
|
|
766
|
+
var o = e.setup.disabled, a = e.props.onPanning;
|
|
767
|
+
if (e.isPanning && r.touches.length === 1) {
|
|
768
|
+
if (o)
|
|
769
|
+
return;
|
|
770
|
+
var t = yi(e);
|
|
771
|
+
if (!t)
|
|
772
|
+
return;
|
|
773
|
+
r.preventDefault(), r.stopPropagation();
|
|
774
|
+
var l = r.touches[0];
|
|
775
|
+
Xi(e, l.clientX, l.clientY), C(b(e), r, a);
|
|
776
|
+
} else r.touches.length > 1 && e.onPinch(r);
|
|
777
|
+
}, this.onTouchPanningStop = function(r) {
|
|
778
|
+
e.onPanningStop(r), e.onPinchStop(r);
|
|
779
|
+
}, this.onDoubleClick = function(r) {
|
|
780
|
+
var o = e.setup.disabled;
|
|
781
|
+
if (!o) {
|
|
782
|
+
var a = cr(e, r);
|
|
783
|
+
a && hr(e, r);
|
|
784
|
+
}
|
|
785
|
+
}, this.clearPanning = function(r) {
|
|
786
|
+
e.isPanning && e.onPanningStop(r);
|
|
787
|
+
}, this.setKeyPressed = function(r) {
|
|
788
|
+
e.pressedKeys[r.key] = !0;
|
|
789
|
+
}, this.setKeyUnPressed = function(r) {
|
|
790
|
+
e.pressedKeys[r.key] = !1;
|
|
791
|
+
}, this.isPressingKeys = function(r) {
|
|
792
|
+
return r.length ? !!r.find(function(o) {
|
|
793
|
+
return e.pressedKeys[o];
|
|
794
|
+
}) : !0;
|
|
795
|
+
}, this.setTransformState = function(r, o, a) {
|
|
796
|
+
var t = e.props.onTransformed;
|
|
797
|
+
if (!Number.isNaN(r) && !Number.isNaN(o) && !Number.isNaN(a)) {
|
|
798
|
+
r !== e.transformState.scale && (e.transformState.previousScale = e.transformState.scale, e.transformState.scale = r), e.transformState.positionX = o, e.transformState.positionY = a, e.applyTransformation();
|
|
799
|
+
var l = b(e);
|
|
800
|
+
e.onChangeCallbacks.forEach(function(s) {
|
|
801
|
+
return s(l);
|
|
802
|
+
}), C(l, { scale: r, positionX: o, positionY: a }, t);
|
|
803
|
+
} else
|
|
804
|
+
console.error("Detected NaN set state values");
|
|
805
|
+
}, this.setCenter = function() {
|
|
806
|
+
if (e.wrapperComponent && e.contentComponent) {
|
|
807
|
+
var r = Hi(e.transformState.scale, e.wrapperComponent, e.contentComponent);
|
|
808
|
+
e.setTransformState(r.scale, r.positionX, r.positionY);
|
|
809
|
+
}
|
|
810
|
+
}, this.handleTransformStyles = function(r, o, a) {
|
|
811
|
+
return e.props.customTransform ? e.props.customTransform(r, o, a) : Ue(r, o, a);
|
|
812
|
+
}, this.applyTransformation = function() {
|
|
813
|
+
if (!(!e.mounted || !e.contentComponent)) {
|
|
814
|
+
var r = e.transformState, o = r.scale, a = r.positionX, t = r.positionY, l = e.handleTransformStyles(a, t, o);
|
|
815
|
+
e.contentComponent.style.transform = l;
|
|
816
|
+
}
|
|
817
|
+
}, this.getContext = function() {
|
|
818
|
+
return b(e);
|
|
819
|
+
}, this.onChange = function(r) {
|
|
820
|
+
return e.onChangeCallbacks.has(r) || e.onChangeCallbacks.add(r), function() {
|
|
821
|
+
e.onChangeCallbacks.delete(r);
|
|
822
|
+
};
|
|
823
|
+
}, this.onInit = function(r) {
|
|
824
|
+
return e.onInitCallbacks.has(r) || e.onInitCallbacks.add(r), function() {
|
|
825
|
+
e.onInitCallbacks.delete(r);
|
|
826
|
+
};
|
|
827
|
+
}, this.init = function(r, o) {
|
|
828
|
+
e.cleanupWindowEvents(), e.wrapperComponent = r, e.contentComponent = o, Q(e, e.transformState.scale), e.handleInitializeWrapperEvents(r), e.handleInitialize(o), e.initializeWindowEvents(), e.isInitialized = !0;
|
|
829
|
+
var a = b(e);
|
|
830
|
+
C(a, void 0, e.props.onInit);
|
|
831
|
+
}, this.props = n, this.setup = zi(this.props), this.transformState = Zi(this.props);
|
|
832
|
+
}
|
|
833
|
+
return i;
|
|
834
|
+
}()
|
|
835
|
+
), ii = c.createContext(null), br = function(i, n) {
|
|
836
|
+
return typeof i == "function" ? i(n) : i;
|
|
837
|
+
}, Sr = c.forwardRef(function(i, n) {
|
|
838
|
+
var e = K(new gr(i)).current, r = br(i.children, vi(e));
|
|
839
|
+
return ie(n, function() {
|
|
840
|
+
return vi(e);
|
|
841
|
+
}, [e]), F(function() {
|
|
842
|
+
e.update(i);
|
|
843
|
+
}, [e, i]), c.createElement(ii.Provider, { value: e }, r);
|
|
844
|
+
});
|
|
845
|
+
c.forwardRef(function(i, n) {
|
|
846
|
+
var e = K(null), r = pi(ii);
|
|
847
|
+
return F(function() {
|
|
848
|
+
return r.onChange(function(o) {
|
|
849
|
+
if (e.current) {
|
|
850
|
+
var a = 0, t = 0;
|
|
851
|
+
e.current.style.transform = r.handleTransformStyles(a, t, 1 / o.instance.transformState.scale);
|
|
852
|
+
}
|
|
853
|
+
});
|
|
854
|
+
}, [r]), c.createElement("div", D({}, i, { ref: $e([e, n]) }));
|
|
855
|
+
});
|
|
856
|
+
function wr(i, n) {
|
|
857
|
+
n === void 0 && (n = {});
|
|
858
|
+
var e = n.insertAt;
|
|
859
|
+
if (!(typeof document > "u")) {
|
|
860
|
+
var r = document.head || document.getElementsByTagName("head")[0], o = document.createElement("style");
|
|
861
|
+
o.type = "text/css", e === "top" && r.firstChild ? r.insertBefore(o, r.firstChild) : r.appendChild(o), o.styleSheet ? o.styleSheet.cssText = i : o.appendChild(document.createTextNode(i));
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
var Cr = `.transform-component-module_wrapper__SPB86 {
|
|
865
|
+
position: relative;
|
|
866
|
+
width: -moz-fit-content;
|
|
867
|
+
width: fit-content;
|
|
868
|
+
height: -moz-fit-content;
|
|
869
|
+
height: fit-content;
|
|
870
|
+
overflow: hidden;
|
|
871
|
+
-webkit-touch-callout: none; /* iOS Safari */
|
|
872
|
+
-webkit-user-select: none; /* Safari */
|
|
873
|
+
-khtml-user-select: none; /* Konqueror HTML */
|
|
874
|
+
-moz-user-select: none; /* Firefox */
|
|
875
|
+
-ms-user-select: none; /* Internet Explorer/Edge */
|
|
876
|
+
user-select: none;
|
|
877
|
+
margin: 0;
|
|
878
|
+
padding: 0;
|
|
879
|
+
}
|
|
880
|
+
.transform-component-module_content__FBWxo {
|
|
881
|
+
display: flex;
|
|
882
|
+
flex-wrap: wrap;
|
|
883
|
+
width: -moz-fit-content;
|
|
884
|
+
width: fit-content;
|
|
885
|
+
height: -moz-fit-content;
|
|
886
|
+
height: fit-content;
|
|
887
|
+
margin: 0;
|
|
888
|
+
padding: 0;
|
|
889
|
+
transform-origin: 0% 0%;
|
|
890
|
+
}
|
|
891
|
+
.transform-component-module_content__FBWxo img {
|
|
892
|
+
pointer-events: none;
|
|
893
|
+
}
|
|
894
|
+
`, Ai = { wrapper: "transform-component-module_wrapper__SPB86", content: "transform-component-module_content__FBWxo" };
|
|
895
|
+
wr(Cr);
|
|
896
|
+
var Pr = function(i) {
|
|
897
|
+
var n = i.children, e = i.wrapperClass, r = e === void 0 ? "" : e, o = i.contentClass, a = o === void 0 ? "" : o, t = i.wrapperStyle, l = i.contentStyle, s = i.wrapperProps, u = s === void 0 ? {} : s, d = i.contentProps, v = d === void 0 ? {} : d, f = pi(ii), m = f.init, p = f.cleanupWindowEvents, h = K(null), g = K(null);
|
|
898
|
+
return F(function() {
|
|
899
|
+
var S = h.current, P = g.current;
|
|
900
|
+
return S !== null && P !== null && m && (m == null || m(S, P)), function() {
|
|
901
|
+
p == null || p();
|
|
902
|
+
};
|
|
903
|
+
}, []), c.createElement(
|
|
904
|
+
"div",
|
|
905
|
+
D({}, u, { ref: h, className: "".concat(di.wrapperClass, " ").concat(Ai.wrapper, " ").concat(r), style: t }),
|
|
906
|
+
c.createElement("div", D({}, v, { ref: g, className: "".concat(di.contentClass, " ").concat(Ai.content, " ").concat(a), style: l }), n)
|
|
907
|
+
);
|
|
908
|
+
}, yr = function() {
|
|
909
|
+
var i = pi(ii);
|
|
910
|
+
if (!i)
|
|
911
|
+
throw new Error("Transform context must be placed inside TransformWrapper");
|
|
912
|
+
return i;
|
|
913
|
+
};
|
|
914
|
+
function Yr(i) {
|
|
915
|
+
var n = yr(), e = _i(i(fi(n))), r = e[0], o = e[1];
|
|
916
|
+
return F(function() {
|
|
917
|
+
var a = !0, t = n.onChange(function(l) {
|
|
918
|
+
a && o(i(fi(l.instance)));
|
|
919
|
+
});
|
|
920
|
+
return function() {
|
|
921
|
+
t(), a = !1;
|
|
922
|
+
};
|
|
923
|
+
}, [i, n]), r;
|
|
924
|
+
}
|
|
925
|
+
const Tr = (i) => {
|
|
926
|
+
const n = (e) => {
|
|
927
|
+
e.preventDefault();
|
|
928
|
+
const r = parseFloat(e.target.value);
|
|
929
|
+
i.onChange(r);
|
|
930
|
+
};
|
|
931
|
+
return /* @__PURE__ */ c.createElement("div", { className: i.className }, /* @__PURE__ */ c.createElement(
|
|
932
|
+
"input",
|
|
933
|
+
{
|
|
934
|
+
onChange: n,
|
|
935
|
+
type: "range",
|
|
936
|
+
min: i.minValue,
|
|
937
|
+
max: i.maxValue,
|
|
938
|
+
value: i.value,
|
|
939
|
+
"aria-valuenow": i.value,
|
|
940
|
+
"aria-valuemin": i.minValue,
|
|
941
|
+
"aria-valuemax": i.maxValue,
|
|
942
|
+
"aria-label": i.ariaLabel,
|
|
943
|
+
step: 0.1
|
|
944
|
+
}
|
|
945
|
+
));
|
|
946
|
+
}, Hr = ({
|
|
947
|
+
ariaLabelCloseButton: i,
|
|
948
|
+
ariaLabelLeftArrow: n,
|
|
949
|
+
ariaLabelLightBox: e,
|
|
950
|
+
ariaLabelRightArrow: r,
|
|
951
|
+
ariaLabelCloseTextBox: o,
|
|
952
|
+
ariaLabelOpenTextBox: a,
|
|
953
|
+
ariaLabelZoomIn: t,
|
|
954
|
+
ariaLabelZoomOut: l,
|
|
955
|
+
ariaLabelZoomSlider: s,
|
|
956
|
+
closeTextAfterSeconds: u,
|
|
957
|
+
imageAlt: d,
|
|
958
|
+
imageSrc: v,
|
|
959
|
+
imageText: f,
|
|
960
|
+
onClose: m,
|
|
961
|
+
onLeftArrowClick: p,
|
|
962
|
+
onRightArrowClick: h,
|
|
963
|
+
testId: g
|
|
964
|
+
}) => {
|
|
965
|
+
const [S, P] = c.useState(!0), w = K(null), X = K(null), { height: T = 0 } = ue(X) || {}, [z, A] = _i(1);
|
|
966
|
+
de(w, m, [se.Escape]);
|
|
967
|
+
const W = (Y) => {
|
|
968
|
+
z !== Y && A(Y);
|
|
969
|
+
};
|
|
970
|
+
return F(() => {
|
|
971
|
+
if (!u) return;
|
|
972
|
+
const Y = setTimeout(() => {
|
|
973
|
+
P(!1);
|
|
974
|
+
}, u * 1e3);
|
|
975
|
+
return () => clearTimeout(Y);
|
|
976
|
+
}, []), /* @__PURE__ */ c.createElement(
|
|
977
|
+
"div",
|
|
978
|
+
{
|
|
979
|
+
"data-testid": g,
|
|
980
|
+
className: y.lightBox,
|
|
981
|
+
style: { zIndex: Z.OverlayScreen },
|
|
982
|
+
role: "dialog",
|
|
983
|
+
"aria-modal": !0,
|
|
984
|
+
"aria-label": e,
|
|
985
|
+
ref: w
|
|
986
|
+
},
|
|
987
|
+
/* @__PURE__ */ c.createElement(
|
|
988
|
+
"button",
|
|
989
|
+
{
|
|
990
|
+
onClick: m,
|
|
991
|
+
"aria-label": i,
|
|
992
|
+
"data-testid": "closeButton",
|
|
993
|
+
className: V(y.button, y["close-button"]),
|
|
994
|
+
style: { zIndex: Z.LightBoxButtons }
|
|
995
|
+
},
|
|
996
|
+
/* @__PURE__ */ c.createElement(L, { svgIcon: le, color: "white", size: M.XSmall })
|
|
997
|
+
),
|
|
998
|
+
p && /* @__PURE__ */ c.createElement(
|
|
999
|
+
"button",
|
|
1000
|
+
{
|
|
1001
|
+
className: V(y.button, y["arrow-button"], y["arrow-button--left"]),
|
|
1002
|
+
onClick: p,
|
|
1003
|
+
"aria-label": n,
|
|
1004
|
+
"data-testid": "leftArrow",
|
|
1005
|
+
style: { zIndex: Z.LightBoxButtons }
|
|
1006
|
+
},
|
|
1007
|
+
/* @__PURE__ */ c.createElement(L, { svgIcon: ee, color: "white", size: M.XSmall })
|
|
1008
|
+
),
|
|
1009
|
+
h && /* @__PURE__ */ c.createElement(
|
|
1010
|
+
"button",
|
|
1011
|
+
{
|
|
1012
|
+
className: V(y.button, y["arrow-button"], y["arrow-button--right"]),
|
|
1013
|
+
onClick: h,
|
|
1014
|
+
"aria-label": r,
|
|
1015
|
+
"data-testid": "rightarrow",
|
|
1016
|
+
style: { zIndex: Z.LightBoxButtons }
|
|
1017
|
+
},
|
|
1018
|
+
/* @__PURE__ */ c.createElement(L, { svgIcon: re, color: "white", size: M.XSmall })
|
|
1019
|
+
),
|
|
1020
|
+
f && /* @__PURE__ */ c.createElement(
|
|
1021
|
+
"div",
|
|
1022
|
+
{
|
|
1023
|
+
className: y["image-text-box"],
|
|
1024
|
+
style: { bottom: S ? "0" : "-" + T + "px", transition: "0.5s", zIndex: Z.LightBoxButtons }
|
|
1025
|
+
},
|
|
1026
|
+
/* @__PURE__ */ c.createElement(
|
|
1027
|
+
"button",
|
|
1028
|
+
{
|
|
1029
|
+
className: V(y.button, y["image-text-box__button"]),
|
|
1030
|
+
onClick: () => P(!S),
|
|
1031
|
+
style: { zIndex: Z.LightBoxButtons },
|
|
1032
|
+
"aria-label": S ? o : a,
|
|
1033
|
+
"aria-expanded": S
|
|
1034
|
+
},
|
|
1035
|
+
S ? /* @__PURE__ */ c.createElement(L, { svgIcon: ne, color: "white", size: M.XSmall }) : /* @__PURE__ */ c.createElement(L, { svgIcon: ae, color: "white", size: M.XSmall })
|
|
1036
|
+
),
|
|
1037
|
+
/* @__PURE__ */ c.createElement("div", null, /* @__PURE__ */ c.createElement("p", { ref: X, className: y["image-text-box__text"] }, f), /* @__PURE__ */ c.createElement("div", { className: y["image-text-box__overflow-border"] }))
|
|
1038
|
+
),
|
|
1039
|
+
/* @__PURE__ */ c.createElement(Sr, { initialScale: 1, maxScale: 4, doubleClick: { mode: "toggle", step: 4 } }, ({ setTransform: Y }) => /* @__PURE__ */ c.createElement(c.Fragment, null, /* @__PURE__ */ c.createElement(
|
|
1040
|
+
Xr,
|
|
1041
|
+
{
|
|
1042
|
+
transform: Y,
|
|
1043
|
+
updateStates: W,
|
|
1044
|
+
zoom: z,
|
|
1045
|
+
ariaLabelZoomIn: t,
|
|
1046
|
+
ariaLabelZoomOut: l,
|
|
1047
|
+
ariaLabelZoomSlider: s
|
|
1048
|
+
}
|
|
1049
|
+
), /* @__PURE__ */ c.createElement(
|
|
1050
|
+
Pr,
|
|
1051
|
+
{
|
|
1052
|
+
wrapperStyle: {
|
|
1053
|
+
zIndex: 1,
|
|
1054
|
+
width: "100%",
|
|
1055
|
+
height: "100%"
|
|
1056
|
+
},
|
|
1057
|
+
contentStyle: {
|
|
1058
|
+
width: "100%",
|
|
1059
|
+
height: "100%"
|
|
1060
|
+
}
|
|
1061
|
+
},
|
|
1062
|
+
/* @__PURE__ */ c.createElement("img", { src: v, alt: d })
|
|
1063
|
+
)))
|
|
1064
|
+
);
|
|
1065
|
+
}, Xr = ({
|
|
1066
|
+
transform: i,
|
|
1067
|
+
updateStates: n,
|
|
1068
|
+
zoom: e,
|
|
1069
|
+
ariaLabelZoomIn: r,
|
|
1070
|
+
ariaLabelZoomOut: o,
|
|
1071
|
+
ariaLabelZoomSlider: a
|
|
1072
|
+
}) => {
|
|
1073
|
+
Yr(({ state: u }) => {
|
|
1074
|
+
n(u.scale);
|
|
1075
|
+
});
|
|
1076
|
+
const t = (u) => {
|
|
1077
|
+
const d = document.getElementsByClassName("react-transform-component")[0], v = window.getComputedStyle(d), f = new WebKitCSSMatrix(v.transform), m = (u - e) / e + 1, p = (f.m41 - window.innerWidth / 2 * (1 - e / u)) * m, h = (f.m42 - window.innerHeight / 2 * (1 - e / u)) * m;
|
|
1078
|
+
return [p, h];
|
|
1079
|
+
}, l = (u) => {
|
|
1080
|
+
if (u === void 0 || u === e) return;
|
|
1081
|
+
u < 1 && (u = 1), u > 4 && (u = 4);
|
|
1082
|
+
const [d, v] = t(u);
|
|
1083
|
+
i(d, v, u, 1);
|
|
1084
|
+
}, s = (u) => {
|
|
1085
|
+
if (u === void 0 || u === e) return;
|
|
1086
|
+
u < 1 && (u = 1), u > 4 && (u = 4);
|
|
1087
|
+
const [d, v] = t(u);
|
|
1088
|
+
i(d, v, u);
|
|
1089
|
+
};
|
|
1090
|
+
return /* @__PURE__ */ c.createElement("div", { className: V(y["zoom-buttons"]), style: { zIndex: Z.LightBoxButtons } }, /* @__PURE__ */ c.createElement("button", { className: V(y.button), onClick: () => s(e - 0.5), "aria-label": o }, /* @__PURE__ */ c.createElement(L, { svgIcon: oe, color: "white", size: M.XSmall })), /* @__PURE__ */ c.createElement(
|
|
1091
|
+
Tr,
|
|
1092
|
+
{
|
|
1093
|
+
className: y.slider,
|
|
1094
|
+
minValue: 1,
|
|
1095
|
+
maxValue: 4,
|
|
1096
|
+
onChange: l,
|
|
1097
|
+
value: e,
|
|
1098
|
+
ariaLabel: a
|
|
1099
|
+
}
|
|
1100
|
+
), /* @__PURE__ */ c.createElement("button", { className: V(y.button), onClick: () => s(e + 0.5), "aria-label": r }, /* @__PURE__ */ c.createElement(L, { svgIcon: te, color: "white", size: M.XSmall })));
|
|
1101
|
+
};
|
|
1102
|
+
export {
|
|
1103
|
+
Hr as default
|
|
1104
|
+
};
|
|
1105
|
+
//# sourceMappingURL=index.js.map
|