react-spring-carousel 3.0.0-beta090.5 → 3.0.0-beta090.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +27 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +1725 -12
- package/dist/index.es.js.map +1 -1
- package/dist/types/types/common.d.ts +2 -0
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/types/useSpringCarousel.types.d.ts +81 -57
- package/dist/types/types/useThumbsModule.types.d.ts +3 -2
- package/dist/types/types/useTransitionCarousel.types.d.ts +6 -2
- package/dist/types/useSpringCarousel.d.ts +8 -14
- package/package.json +17 -16
- package/dist/index.cjs2.js +0 -2
- package/dist/index.cjs2.js.map +0 -1
- package/dist/index.cjs3.js +0 -2
- package/dist/index.cjs3.js.map +0 -1
- package/dist/index.es2.js +0 -702
- package/dist/index.es2.js.map +0 -1
- package/dist/index.es3.js +0 -255
- package/dist/index.es3.js.map +0 -1
- package/dist/useThumbsModule-09d1d442.cjs +0 -28
- package/dist/useThumbsModule-09d1d442.cjs.map +0 -1
- package/dist/useThumbsModule-4e4b7969.js +0 -754
- package/dist/useThumbsModule-4e4b7969.js.map +0 -1
package/dist/index.es.js
CHANGED
|
@@ -1,15 +1,1728 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import "
|
|
4
|
-
import "
|
|
5
|
-
import "
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import lr, { useRef as O, useEffect as he, createContext as fr, useCallback as Me, Fragment as Er, useContext as dr, useState as Tr } from "react";
|
|
2
|
+
import { useSpring as vr, config as Ie, useIsomorphicLayoutEffect as Rr, useTransition as wr, a as _r } from "@react-spring/web";
|
|
3
|
+
import { useDrag as hr } from "@use-gesture/react";
|
|
4
|
+
import Cr from "resize-observer-polyfill";
|
|
5
|
+
import Ee from "screenfull";
|
|
6
|
+
var L = {}, Ir = {
|
|
7
|
+
get exports() {
|
|
8
|
+
return L;
|
|
9
|
+
},
|
|
10
|
+
set exports(n) {
|
|
11
|
+
L = n;
|
|
12
|
+
}
|
|
13
|
+
}, He = {};
|
|
14
|
+
/**
|
|
15
|
+
* @license React
|
|
16
|
+
* react-jsx-runtime.production.min.js
|
|
17
|
+
*
|
|
18
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
19
|
+
*
|
|
20
|
+
* This source code is licensed under the MIT license found in the
|
|
21
|
+
* LICENSE file in the root directory of this source tree.
|
|
22
|
+
*/
|
|
23
|
+
var cr;
|
|
24
|
+
function kr() {
|
|
25
|
+
if (cr)
|
|
26
|
+
return He;
|
|
27
|
+
cr = 1;
|
|
28
|
+
var n = lr, m = Symbol.for("react.element"), p = Symbol.for("react.fragment"), $ = Object.prototype.hasOwnProperty, B = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, v = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
29
|
+
function R(l, f, d) {
|
|
30
|
+
var N, A = {}, C = null, u = null;
|
|
31
|
+
d !== void 0 && (C = "" + d), f.key !== void 0 && (C = "" + f.key), f.ref !== void 0 && (u = f.ref);
|
|
32
|
+
for (N in f)
|
|
33
|
+
$.call(f, N) && !v.hasOwnProperty(N) && (A[N] = f[N]);
|
|
34
|
+
if (l && l.defaultProps)
|
|
35
|
+
for (N in f = l.defaultProps, f)
|
|
36
|
+
A[N] === void 0 && (A[N] = f[N]);
|
|
37
|
+
return { $$typeof: m, type: l, key: C, ref: u, props: A, _owner: B.current };
|
|
38
|
+
}
|
|
39
|
+
return He.Fragment = p, He.jsx = R, He.jsxs = R, He;
|
|
40
|
+
}
|
|
41
|
+
var Je = {};
|
|
42
|
+
/**
|
|
43
|
+
* @license React
|
|
44
|
+
* react-jsx-runtime.development.js
|
|
45
|
+
*
|
|
46
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
47
|
+
*
|
|
48
|
+
* This source code is licensed under the MIT license found in the
|
|
49
|
+
* LICENSE file in the root directory of this source tree.
|
|
50
|
+
*/
|
|
51
|
+
var sr;
|
|
52
|
+
function Pr() {
|
|
53
|
+
return sr || (sr = 1, process.env.NODE_ENV !== "production" && function() {
|
|
54
|
+
var n = lr, m = Symbol.for("react.element"), p = Symbol.for("react.portal"), $ = Symbol.for("react.fragment"), B = Symbol.for("react.strict_mode"), v = Symbol.for("react.profiler"), R = Symbol.for("react.provider"), l = Symbol.for("react.context"), f = Symbol.for("react.forward_ref"), d = Symbol.for("react.suspense"), N = Symbol.for("react.suspense_list"), A = Symbol.for("react.memo"), C = Symbol.for("react.lazy"), u = Symbol.for("react.offscreen"), q = Symbol.iterator, y = "@@iterator";
|
|
55
|
+
function ae(e) {
|
|
56
|
+
if (e === null || typeof e != "object")
|
|
57
|
+
return null;
|
|
58
|
+
var t = q && e[q] || e[y];
|
|
59
|
+
return typeof t == "function" ? t : null;
|
|
60
|
+
}
|
|
61
|
+
var F = n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
62
|
+
function j(e) {
|
|
63
|
+
{
|
|
64
|
+
for (var t = arguments.length, i = new Array(t > 1 ? t - 1 : 0), s = 1; s < t; s++)
|
|
65
|
+
i[s - 1] = arguments[s];
|
|
66
|
+
te("error", e, i);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
function te(e, t, i) {
|
|
70
|
+
{
|
|
71
|
+
var s = F.ReactDebugCurrentFrame, E = s.getStackAddendum();
|
|
72
|
+
E !== "" && (t += "%s", i = i.concat([E]));
|
|
73
|
+
var _ = i.map(function(g) {
|
|
74
|
+
return String(g);
|
|
75
|
+
});
|
|
76
|
+
_.unshift("Warning: " + t), Function.prototype.apply.call(console[e], console, _);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
var Ne = !1, ne = !1, Y = !1, ie = !1, oe = !1, z;
|
|
80
|
+
z = Symbol.for("react.module.reference");
|
|
81
|
+
function Te(e) {
|
|
82
|
+
return !!(typeof e == "string" || typeof e == "function" || e === $ || e === v || oe || e === B || e === d || e === N || ie || e === u || Ne || ne || Y || typeof e == "object" && e !== null && (e.$$typeof === C || e.$$typeof === A || e.$$typeof === R || e.$$typeof === l || e.$$typeof === f || // This needs to include all possible module reference object
|
|
83
|
+
// types supported by any Flight configuration anywhere since
|
|
84
|
+
// we don't know which Flight build this will end up being used
|
|
85
|
+
// with.
|
|
86
|
+
e.$$typeof === z || e.getModuleId !== void 0));
|
|
87
|
+
}
|
|
88
|
+
function Q(e, t, i) {
|
|
89
|
+
var s = e.displayName;
|
|
90
|
+
if (s)
|
|
91
|
+
return s;
|
|
92
|
+
var E = t.displayName || t.name || "";
|
|
93
|
+
return E !== "" ? i + "(" + E + ")" : i;
|
|
94
|
+
}
|
|
95
|
+
function D(e) {
|
|
96
|
+
return e.displayName || "Context";
|
|
97
|
+
}
|
|
98
|
+
function x(e) {
|
|
99
|
+
if (e == null)
|
|
100
|
+
return null;
|
|
101
|
+
if (typeof e.tag == "number" && j("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
|
|
102
|
+
return e.displayName || e.name || null;
|
|
103
|
+
if (typeof e == "string")
|
|
104
|
+
return e;
|
|
105
|
+
switch (e) {
|
|
106
|
+
case $:
|
|
107
|
+
return "Fragment";
|
|
108
|
+
case p:
|
|
109
|
+
return "Portal";
|
|
110
|
+
case v:
|
|
111
|
+
return "Profiler";
|
|
112
|
+
case B:
|
|
113
|
+
return "StrictMode";
|
|
114
|
+
case d:
|
|
115
|
+
return "Suspense";
|
|
116
|
+
case N:
|
|
117
|
+
return "SuspenseList";
|
|
118
|
+
}
|
|
119
|
+
if (typeof e == "object")
|
|
120
|
+
switch (e.$$typeof) {
|
|
121
|
+
case l:
|
|
122
|
+
var t = e;
|
|
123
|
+
return D(t) + ".Consumer";
|
|
124
|
+
case R:
|
|
125
|
+
var i = e;
|
|
126
|
+
return D(i._context) + ".Provider";
|
|
127
|
+
case f:
|
|
128
|
+
return Q(e, e.render, "ForwardRef");
|
|
129
|
+
case A:
|
|
130
|
+
var s = e.displayName || null;
|
|
131
|
+
return s !== null ? s : x(e.type) || "Memo";
|
|
132
|
+
case C: {
|
|
133
|
+
var E = e, _ = E._payload, g = E._init;
|
|
134
|
+
try {
|
|
135
|
+
return x(g(_));
|
|
136
|
+
} catch {
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
var b = Object.assign, w = 0, M, me, pe, c, T, I, X;
|
|
144
|
+
function H() {
|
|
145
|
+
}
|
|
146
|
+
H.__reactDisabledLog = !0;
|
|
147
|
+
function ze() {
|
|
148
|
+
{
|
|
149
|
+
if (w === 0) {
|
|
150
|
+
M = console.log, me = console.info, pe = console.warn, c = console.error, T = console.group, I = console.groupCollapsed, X = console.groupEnd;
|
|
151
|
+
var e = {
|
|
152
|
+
configurable: !0,
|
|
153
|
+
enumerable: !0,
|
|
154
|
+
value: H,
|
|
155
|
+
writable: !0
|
|
156
|
+
};
|
|
157
|
+
Object.defineProperties(console, {
|
|
158
|
+
info: e,
|
|
159
|
+
log: e,
|
|
160
|
+
warn: e,
|
|
161
|
+
error: e,
|
|
162
|
+
group: e,
|
|
163
|
+
groupCollapsed: e,
|
|
164
|
+
groupEnd: e
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
w++;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
function ke() {
|
|
171
|
+
{
|
|
172
|
+
if (w--, w === 0) {
|
|
173
|
+
var e = {
|
|
174
|
+
configurable: !0,
|
|
175
|
+
enumerable: !0,
|
|
176
|
+
writable: !0
|
|
177
|
+
};
|
|
178
|
+
Object.defineProperties(console, {
|
|
179
|
+
log: b({}, e, {
|
|
180
|
+
value: M
|
|
181
|
+
}),
|
|
182
|
+
info: b({}, e, {
|
|
183
|
+
value: me
|
|
184
|
+
}),
|
|
185
|
+
warn: b({}, e, {
|
|
186
|
+
value: pe
|
|
187
|
+
}),
|
|
188
|
+
error: b({}, e, {
|
|
189
|
+
value: c
|
|
190
|
+
}),
|
|
191
|
+
group: b({}, e, {
|
|
192
|
+
value: T
|
|
193
|
+
}),
|
|
194
|
+
groupCollapsed: b({}, e, {
|
|
195
|
+
value: I
|
|
196
|
+
}),
|
|
197
|
+
groupEnd: b({}, e, {
|
|
198
|
+
value: X
|
|
199
|
+
})
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
w < 0 && j("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
var G = F.ReactCurrentDispatcher, U;
|
|
206
|
+
function ue(e, t, i) {
|
|
207
|
+
{
|
|
208
|
+
if (U === void 0)
|
|
209
|
+
try {
|
|
210
|
+
throw Error();
|
|
211
|
+
} catch (E) {
|
|
212
|
+
var s = E.stack.trim().match(/\n( *(at )?)/);
|
|
213
|
+
U = s && s[1] || "";
|
|
214
|
+
}
|
|
215
|
+
return `
|
|
216
|
+
` + U + e;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
var ge = !1, Pe;
|
|
220
|
+
{
|
|
221
|
+
var Ge = typeof WeakMap == "function" ? WeakMap : Map;
|
|
222
|
+
Pe = new Ge();
|
|
223
|
+
}
|
|
224
|
+
function Ve(e, t) {
|
|
225
|
+
if (!e || ge)
|
|
226
|
+
return "";
|
|
227
|
+
{
|
|
228
|
+
var i = Pe.get(e);
|
|
229
|
+
if (i !== void 0)
|
|
230
|
+
return i;
|
|
231
|
+
}
|
|
232
|
+
var s;
|
|
233
|
+
ge = !0;
|
|
234
|
+
var E = Error.prepareStackTrace;
|
|
235
|
+
Error.prepareStackTrace = void 0;
|
|
236
|
+
var _;
|
|
237
|
+
_ = G.current, G.current = null, ze();
|
|
238
|
+
try {
|
|
239
|
+
if (t) {
|
|
240
|
+
var g = function() {
|
|
241
|
+
throw Error();
|
|
242
|
+
};
|
|
243
|
+
if (Object.defineProperty(g.prototype, "props", {
|
|
244
|
+
set: function() {
|
|
245
|
+
throw Error();
|
|
246
|
+
}
|
|
247
|
+
}), typeof Reflect == "object" && Reflect.construct) {
|
|
248
|
+
try {
|
|
249
|
+
Reflect.construct(g, []);
|
|
250
|
+
} catch (ve) {
|
|
251
|
+
s = ve;
|
|
252
|
+
}
|
|
253
|
+
Reflect.construct(e, [], g);
|
|
254
|
+
} else {
|
|
255
|
+
try {
|
|
256
|
+
g.call();
|
|
257
|
+
} catch (ve) {
|
|
258
|
+
s = ve;
|
|
259
|
+
}
|
|
260
|
+
e.call(g.prototype);
|
|
261
|
+
}
|
|
262
|
+
} else {
|
|
263
|
+
try {
|
|
264
|
+
throw Error();
|
|
265
|
+
} catch (ve) {
|
|
266
|
+
s = ve;
|
|
267
|
+
}
|
|
268
|
+
e();
|
|
269
|
+
}
|
|
270
|
+
} catch (ve) {
|
|
271
|
+
if (ve && s && typeof ve.stack == "string") {
|
|
272
|
+
for (var h = ve.stack.split(`
|
|
273
|
+
`), J = s.stack.split(`
|
|
274
|
+
`), V = h.length - 1, S = J.length - 1; V >= 1 && S >= 0 && h[V] !== J[S]; )
|
|
275
|
+
S--;
|
|
276
|
+
for (; V >= 1 && S >= 0; V--, S--)
|
|
277
|
+
if (h[V] !== J[S]) {
|
|
278
|
+
if (V !== 1 || S !== 1)
|
|
279
|
+
do
|
|
280
|
+
if (V--, S--, S < 0 || h[V] !== J[S]) {
|
|
281
|
+
var Z = `
|
|
282
|
+
` + h[V].replace(" at new ", " at ");
|
|
283
|
+
return e.displayName && Z.includes("<anonymous>") && (Z = Z.replace("<anonymous>", e.displayName)), typeof e == "function" && Pe.set(e, Z), Z;
|
|
284
|
+
}
|
|
285
|
+
while (V >= 1 && S >= 0);
|
|
286
|
+
break;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
} finally {
|
|
290
|
+
ge = !1, G.current = _, ke(), Error.prepareStackTrace = E;
|
|
291
|
+
}
|
|
292
|
+
var De = e ? e.displayName || e.name : "", ur = De ? ue(De) : "";
|
|
293
|
+
return typeof e == "function" && Pe.set(e, ur), ur;
|
|
294
|
+
}
|
|
295
|
+
function Xe(e, t, i) {
|
|
296
|
+
return Ve(e, !1);
|
|
297
|
+
}
|
|
298
|
+
function Ke(e) {
|
|
299
|
+
var t = e.prototype;
|
|
300
|
+
return !!(t && t.isReactComponent);
|
|
301
|
+
}
|
|
302
|
+
function Fe(e, t, i) {
|
|
303
|
+
if (e == null)
|
|
304
|
+
return "";
|
|
305
|
+
if (typeof e == "function")
|
|
306
|
+
return Ve(e, Ke(e));
|
|
307
|
+
if (typeof e == "string")
|
|
308
|
+
return ue(e);
|
|
309
|
+
switch (e) {
|
|
310
|
+
case d:
|
|
311
|
+
return ue("Suspense");
|
|
312
|
+
case N:
|
|
313
|
+
return ue("SuspenseList");
|
|
314
|
+
}
|
|
315
|
+
if (typeof e == "object")
|
|
316
|
+
switch (e.$$typeof) {
|
|
317
|
+
case f:
|
|
318
|
+
return Xe(e.render);
|
|
319
|
+
case A:
|
|
320
|
+
return Fe(e.type, t, i);
|
|
321
|
+
case C: {
|
|
322
|
+
var s = e, E = s._payload, _ = s._init;
|
|
323
|
+
try {
|
|
324
|
+
return Fe(_(E), t, i);
|
|
325
|
+
} catch {
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
return "";
|
|
330
|
+
}
|
|
331
|
+
var k = Object.prototype.hasOwnProperty, ce = {}, W = F.ReactDebugCurrentFrame;
|
|
332
|
+
function je(e) {
|
|
333
|
+
if (e) {
|
|
334
|
+
var t = e._owner, i = Fe(e.type, e._source, t ? t.type : null);
|
|
335
|
+
W.setExtraStackFrame(i);
|
|
336
|
+
} else
|
|
337
|
+
W.setExtraStackFrame(null);
|
|
338
|
+
}
|
|
339
|
+
function Re(e, t, i, s, E) {
|
|
340
|
+
{
|
|
341
|
+
var _ = Function.call.bind(k);
|
|
342
|
+
for (var g in e)
|
|
343
|
+
if (_(e, g)) {
|
|
344
|
+
var h = void 0;
|
|
345
|
+
try {
|
|
346
|
+
if (typeof e[g] != "function") {
|
|
347
|
+
var J = Error((s || "React class") + ": " + i + " type `" + g + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[g] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
348
|
+
throw J.name = "Invariant Violation", J;
|
|
349
|
+
}
|
|
350
|
+
h = e[g](t, g, s, i, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
351
|
+
} catch (V) {
|
|
352
|
+
h = V;
|
|
353
|
+
}
|
|
354
|
+
h && !(h instanceof Error) && (je(E), j("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", s || "React class", i, g, typeof h), je(null)), h instanceof Error && !(h.message in ce) && (ce[h.message] = !0, je(E), j("Failed %s type: %s", i, h.message), je(null));
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
var we = Array.isArray;
|
|
359
|
+
function ye(e) {
|
|
360
|
+
return we(e);
|
|
361
|
+
}
|
|
362
|
+
function ee(e) {
|
|
363
|
+
{
|
|
364
|
+
var t = typeof Symbol == "function" && Symbol.toStringTag, i = t && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
365
|
+
return i;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
function _e(e) {
|
|
369
|
+
try {
|
|
370
|
+
return se(e), !1;
|
|
371
|
+
} catch {
|
|
372
|
+
return !0;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
function se(e) {
|
|
376
|
+
return "" + e;
|
|
377
|
+
}
|
|
378
|
+
function le(e) {
|
|
379
|
+
if (_e(e))
|
|
380
|
+
return j("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", ee(e)), se(e);
|
|
381
|
+
}
|
|
382
|
+
var Ce = F.ReactCurrentOwner, Ze = {
|
|
383
|
+
key: !0,
|
|
384
|
+
ref: !0,
|
|
385
|
+
__self: !0,
|
|
386
|
+
__source: !0
|
|
387
|
+
}, er, Qe, Se;
|
|
388
|
+
Se = {};
|
|
389
|
+
function Oe(e) {
|
|
390
|
+
if (k.call(e, "ref")) {
|
|
391
|
+
var t = Object.getOwnPropertyDescriptor(e, "ref").get;
|
|
392
|
+
if (t && t.isReactWarning)
|
|
393
|
+
return !1;
|
|
394
|
+
}
|
|
395
|
+
return e.ref !== void 0;
|
|
396
|
+
}
|
|
397
|
+
function rr(e) {
|
|
398
|
+
if (k.call(e, "key")) {
|
|
399
|
+
var t = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
400
|
+
if (t && t.isReactWarning)
|
|
401
|
+
return !1;
|
|
402
|
+
}
|
|
403
|
+
return e.key !== void 0;
|
|
404
|
+
}
|
|
405
|
+
function xe(e, t) {
|
|
406
|
+
if (typeof e.ref == "string" && Ce.current && t && Ce.current.stateNode !== t) {
|
|
407
|
+
var i = x(Ce.current.type);
|
|
408
|
+
Se[i] || (j('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', x(Ce.current.type), e.ref), Se[i] = !0);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
function Ye(e, t) {
|
|
412
|
+
{
|
|
413
|
+
var i = function() {
|
|
414
|
+
er || (er = !0, j("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", t));
|
|
415
|
+
};
|
|
416
|
+
i.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
417
|
+
get: i,
|
|
418
|
+
configurable: !0
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
function Ue(e, t) {
|
|
423
|
+
{
|
|
424
|
+
var i = function() {
|
|
425
|
+
Qe || (Qe = !0, j("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", t));
|
|
426
|
+
};
|
|
427
|
+
i.isReactWarning = !0, Object.defineProperty(e, "ref", {
|
|
428
|
+
get: i,
|
|
429
|
+
configurable: !0
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
var Be = function(e, t, i, s, E, _, g) {
|
|
434
|
+
var h = {
|
|
435
|
+
// This tag allows us to uniquely identify this as a React Element
|
|
436
|
+
$$typeof: m,
|
|
437
|
+
// Built-in properties that belong on the element
|
|
438
|
+
type: e,
|
|
439
|
+
key: t,
|
|
440
|
+
ref: i,
|
|
441
|
+
props: g,
|
|
442
|
+
// Record the component responsible for creating this element.
|
|
443
|
+
_owner: _
|
|
444
|
+
};
|
|
445
|
+
return h._store = {}, Object.defineProperty(h._store, "validated", {
|
|
446
|
+
configurable: !1,
|
|
447
|
+
enumerable: !1,
|
|
448
|
+
writable: !0,
|
|
449
|
+
value: !1
|
|
450
|
+
}), Object.defineProperty(h, "_self", {
|
|
451
|
+
configurable: !1,
|
|
452
|
+
enumerable: !1,
|
|
453
|
+
writable: !1,
|
|
454
|
+
value: s
|
|
455
|
+
}), Object.defineProperty(h, "_source", {
|
|
456
|
+
configurable: !1,
|
|
457
|
+
enumerable: !1,
|
|
458
|
+
writable: !1,
|
|
459
|
+
value: E
|
|
460
|
+
}), Object.freeze && (Object.freeze(h.props), Object.freeze(h)), h;
|
|
461
|
+
};
|
|
462
|
+
function qe(e, t, i, s, E) {
|
|
463
|
+
{
|
|
464
|
+
var _, g = {}, h = null, J = null;
|
|
465
|
+
i !== void 0 && (le(i), h = "" + i), rr(t) && (le(t.key), h = "" + t.key), Oe(t) && (J = t.ref, xe(t, E));
|
|
466
|
+
for (_ in t)
|
|
467
|
+
k.call(t, _) && !Ze.hasOwnProperty(_) && (g[_] = t[_]);
|
|
468
|
+
if (e && e.defaultProps) {
|
|
469
|
+
var V = e.defaultProps;
|
|
470
|
+
for (_ in V)
|
|
471
|
+
g[_] === void 0 && (g[_] = V[_]);
|
|
472
|
+
}
|
|
473
|
+
if (h || J) {
|
|
474
|
+
var S = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
475
|
+
h && Ye(g, S), J && Ue(g, S);
|
|
476
|
+
}
|
|
477
|
+
return Be(e, h, J, E, s, Ce.current, g);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
var Ae = F.ReactCurrentOwner, $e = F.ReactDebugCurrentFrame;
|
|
481
|
+
function be(e) {
|
|
482
|
+
if (e) {
|
|
483
|
+
var t = e._owner, i = Fe(e.type, e._source, t ? t.type : null);
|
|
484
|
+
$e.setExtraStackFrame(i);
|
|
485
|
+
} else
|
|
486
|
+
$e.setExtraStackFrame(null);
|
|
487
|
+
}
|
|
488
|
+
var Le;
|
|
489
|
+
Le = !1;
|
|
490
|
+
function r(e) {
|
|
491
|
+
return typeof e == "object" && e !== null && e.$$typeof === m;
|
|
492
|
+
}
|
|
493
|
+
function o() {
|
|
494
|
+
{
|
|
495
|
+
if (Ae.current) {
|
|
496
|
+
var e = x(Ae.current.type);
|
|
497
|
+
if (e)
|
|
498
|
+
return `
|
|
499
|
+
|
|
500
|
+
Check the render method of \`` + e + "`.";
|
|
501
|
+
}
|
|
502
|
+
return "";
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
function a(e) {
|
|
506
|
+
{
|
|
507
|
+
if (e !== void 0) {
|
|
508
|
+
var t = e.fileName.replace(/^.*[\\\/]/, ""), i = e.lineNumber;
|
|
509
|
+
return `
|
|
510
|
+
|
|
511
|
+
Check your code at ` + t + ":" + i + ".";
|
|
512
|
+
}
|
|
513
|
+
return "";
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
var P = {};
|
|
517
|
+
function K(e) {
|
|
518
|
+
{
|
|
519
|
+
var t = o();
|
|
520
|
+
if (!t) {
|
|
521
|
+
var i = typeof e == "string" ? e : e.displayName || e.name;
|
|
522
|
+
i && (t = `
|
|
523
|
+
|
|
524
|
+
Check the top-level render call using <` + i + ">.");
|
|
525
|
+
}
|
|
526
|
+
return t;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
function fe(e, t) {
|
|
530
|
+
{
|
|
531
|
+
if (!e._store || e._store.validated || e.key != null)
|
|
532
|
+
return;
|
|
533
|
+
e._store.validated = !0;
|
|
534
|
+
var i = K(t);
|
|
535
|
+
if (P[i])
|
|
536
|
+
return;
|
|
537
|
+
P[i] = !0;
|
|
538
|
+
var s = "";
|
|
539
|
+
e && e._owner && e._owner !== Ae.current && (s = " It was passed a child from " + x(e._owner.type) + "."), be(e), j('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', i, s), be(null);
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
function de(e, t) {
|
|
543
|
+
{
|
|
544
|
+
if (typeof e != "object")
|
|
545
|
+
return;
|
|
546
|
+
if (ye(e))
|
|
547
|
+
for (var i = 0; i < e.length; i++) {
|
|
548
|
+
var s = e[i];
|
|
549
|
+
r(s) && fe(s, t);
|
|
550
|
+
}
|
|
551
|
+
else if (r(e))
|
|
552
|
+
e._store && (e._store.validated = !0);
|
|
553
|
+
else if (e) {
|
|
554
|
+
var E = ae(e);
|
|
555
|
+
if (typeof E == "function" && E !== e.entries)
|
|
556
|
+
for (var _ = E.call(e), g; !(g = _.next()).done; )
|
|
557
|
+
r(g.value) && fe(g.value, t);
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
function tr(e) {
|
|
562
|
+
{
|
|
563
|
+
var t = e.type;
|
|
564
|
+
if (t == null || typeof t == "string")
|
|
565
|
+
return;
|
|
566
|
+
var i;
|
|
567
|
+
if (typeof t == "function")
|
|
568
|
+
i = t.propTypes;
|
|
569
|
+
else if (typeof t == "object" && (t.$$typeof === f || // Note: Memo only checks outer props here.
|
|
570
|
+
// Inner props are checked in the reconciler.
|
|
571
|
+
t.$$typeof === A))
|
|
572
|
+
i = t.propTypes;
|
|
573
|
+
else
|
|
574
|
+
return;
|
|
575
|
+
if (i) {
|
|
576
|
+
var s = x(t);
|
|
577
|
+
Re(i, e.props, "prop", s, e);
|
|
578
|
+
} else if (t.PropTypes !== void 0 && !Le) {
|
|
579
|
+
Le = !0;
|
|
580
|
+
var E = x(t);
|
|
581
|
+
j("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", E || "Unknown");
|
|
582
|
+
}
|
|
583
|
+
typeof t.getDefaultProps == "function" && !t.getDefaultProps.isReactClassApproved && j("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
function re(e) {
|
|
587
|
+
{
|
|
588
|
+
for (var t = Object.keys(e.props), i = 0; i < t.length; i++) {
|
|
589
|
+
var s = t[i];
|
|
590
|
+
if (s !== "children" && s !== "key") {
|
|
591
|
+
be(e), j("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", s), be(null);
|
|
592
|
+
break;
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
e.ref !== null && (be(e), j("Invalid attribute `ref` supplied to `React.Fragment`."), be(null));
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
function nr(e, t, i, s, E, _) {
|
|
599
|
+
{
|
|
600
|
+
var g = Te(e);
|
|
601
|
+
if (!g) {
|
|
602
|
+
var h = "";
|
|
603
|
+
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (h += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
604
|
+
var J = a(E);
|
|
605
|
+
J ? h += J : h += o();
|
|
606
|
+
var V;
|
|
607
|
+
e === null ? V = "null" : ye(e) ? V = "array" : e !== void 0 && e.$$typeof === m ? (V = "<" + (x(e.type) || "Unknown") + " />", h = " Did you accidentally export a JSX literal instead of a component?") : V = typeof e, j("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", V, h);
|
|
608
|
+
}
|
|
609
|
+
var S = qe(e, t, i, E, _);
|
|
610
|
+
if (S == null)
|
|
611
|
+
return S;
|
|
612
|
+
if (g) {
|
|
613
|
+
var Z = t.children;
|
|
614
|
+
if (Z !== void 0)
|
|
615
|
+
if (s)
|
|
616
|
+
if (ye(Z)) {
|
|
617
|
+
for (var De = 0; De < Z.length; De++)
|
|
618
|
+
de(Z[De], e);
|
|
619
|
+
Object.freeze && Object.freeze(Z);
|
|
620
|
+
} else
|
|
621
|
+
j("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
622
|
+
else
|
|
623
|
+
de(Z, e);
|
|
624
|
+
}
|
|
625
|
+
return e === $ ? re(S) : tr(S), S;
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
function gr(e, t, i) {
|
|
629
|
+
return nr(e, t, i, !0);
|
|
630
|
+
}
|
|
631
|
+
function yr(e, t, i) {
|
|
632
|
+
return nr(e, t, i, !1);
|
|
633
|
+
}
|
|
634
|
+
var xr = yr, br = gr;
|
|
635
|
+
Je.Fragment = $, Je.jsx = xr, Je.jsxs = br;
|
|
636
|
+
}()), Je;
|
|
637
|
+
}
|
|
638
|
+
(function(n) {
|
|
639
|
+
process.env.NODE_ENV === "production" ? n.exports = kr() : n.exports = Pr();
|
|
640
|
+
})(Ir);
|
|
641
|
+
const ir = "RSC::Event";
|
|
642
|
+
function mr() {
|
|
643
|
+
const n = O(null);
|
|
644
|
+
function m($) {
|
|
645
|
+
he(() => {
|
|
646
|
+
n.current || (n.current = document.createElement("div"));
|
|
647
|
+
function B(v) {
|
|
648
|
+
$(v.detail);
|
|
649
|
+
}
|
|
650
|
+
if (n.current)
|
|
651
|
+
return n.current.addEventListener(ir, B, !1), () => {
|
|
652
|
+
var v;
|
|
653
|
+
(v = n.current) == null || v.removeEventListener(ir, B, !1);
|
|
654
|
+
};
|
|
655
|
+
}, [$]);
|
|
656
|
+
}
|
|
657
|
+
function p($) {
|
|
658
|
+
if (n.current) {
|
|
659
|
+
const B = new CustomEvent(ir, {
|
|
660
|
+
detail: $
|
|
661
|
+
});
|
|
662
|
+
n.current.dispatchEvent(B);
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
return {
|
|
666
|
+
useListenToCustomEvent: m,
|
|
667
|
+
emitEvent: p
|
|
668
|
+
};
|
|
669
|
+
}
|
|
670
|
+
function Fr({
|
|
671
|
+
mainCarouselWrapperRef: n,
|
|
672
|
+
onFullScreenChange: m,
|
|
673
|
+
handleResize: p
|
|
674
|
+
}) {
|
|
675
|
+
const $ = O(!1);
|
|
676
|
+
he(() => {
|
|
677
|
+
function f() {
|
|
678
|
+
document.fullscreenElement && (B(!0), m(!0), p && p()), document.fullscreenElement || (B(!1), m(!1), p && p());
|
|
679
|
+
}
|
|
680
|
+
if (Ee.isEnabled)
|
|
681
|
+
return Ee.on("change", f), () => {
|
|
682
|
+
Ee.isEnabled && Ee.off("change", f);
|
|
683
|
+
};
|
|
684
|
+
}, []);
|
|
685
|
+
function B(f) {
|
|
686
|
+
$.current = f;
|
|
687
|
+
}
|
|
688
|
+
function v() {
|
|
689
|
+
return $.current;
|
|
690
|
+
}
|
|
691
|
+
function R(f) {
|
|
692
|
+
Ee.isEnabled && Ee.request(f || n.current);
|
|
693
|
+
}
|
|
694
|
+
function l() {
|
|
695
|
+
Ee.isEnabled && Ee.exit();
|
|
696
|
+
}
|
|
697
|
+
return {
|
|
698
|
+
enterFullscreen: R,
|
|
699
|
+
exitFullscreen: l,
|
|
700
|
+
getIsFullscreen: v
|
|
701
|
+
};
|
|
702
|
+
}
|
|
703
|
+
function jr(n) {
|
|
704
|
+
const m = n.getBoundingClientRect();
|
|
705
|
+
return m.top >= 0 && m.left >= 0 && m.bottom <= (window.innerHeight || document.documentElement.clientHeight) && m.right <= (window.innerWidth || document.documentElement.clientWidth);
|
|
706
|
+
}
|
|
707
|
+
function pr({
|
|
708
|
+
thumbsSlideAxis: n = "x",
|
|
709
|
+
withThumbs: m = !1,
|
|
710
|
+
prepareThumbsData: p,
|
|
711
|
+
items: $,
|
|
712
|
+
renderThumbFnProps: B
|
|
713
|
+
}) {
|
|
714
|
+
const v = O(null), [R, l] = vr(() => ({
|
|
715
|
+
val: 0
|
|
716
|
+
}));
|
|
717
|
+
function f() {
|
|
718
|
+
var C;
|
|
719
|
+
return v.current ? Math.round(
|
|
720
|
+
Number((C = v.current) == null ? void 0 : C[n === "x" ? "scrollWidth" : "scrollHeight"]) - v.current.getBoundingClientRect()[n === "x" ? "width" : "height"]
|
|
721
|
+
) : 0;
|
|
722
|
+
}
|
|
723
|
+
function d(C) {
|
|
724
|
+
var y;
|
|
725
|
+
function u() {
|
|
726
|
+
return v.current ? v.current.querySelector(
|
|
727
|
+
`#thumb-item-${$[C].id}`
|
|
728
|
+
) : null;
|
|
729
|
+
}
|
|
730
|
+
const q = u();
|
|
731
|
+
if (q && v.current && !jr(q)) {
|
|
732
|
+
const ae = q.offsetLeft, F = ae > f() ? f() : ae;
|
|
733
|
+
l.start({
|
|
734
|
+
from: {
|
|
735
|
+
val: ((y = v.current) == null ? void 0 : y[n === "x" ? "scrollLeft" : "scrollTop"]) ?? 0
|
|
736
|
+
},
|
|
737
|
+
to: {
|
|
738
|
+
val: F
|
|
739
|
+
},
|
|
740
|
+
onChange: ({ value: j }) => {
|
|
741
|
+
v.current && (v.current[n === "x" ? "scrollLeft" : "scrollTop"] = Math.abs(
|
|
742
|
+
j.val
|
|
743
|
+
));
|
|
744
|
+
}
|
|
745
|
+
});
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
function N() {
|
|
749
|
+
function C(u) {
|
|
750
|
+
return u.map((q) => ({
|
|
751
|
+
id: q.id,
|
|
752
|
+
renderThumb: q.renderThumb
|
|
753
|
+
}));
|
|
754
|
+
}
|
|
755
|
+
return p ? p(C($)) : C($);
|
|
756
|
+
}
|
|
757
|
+
return {
|
|
758
|
+
thumbsFragment: m ? /* @__PURE__ */ L.jsx(
|
|
759
|
+
"div",
|
|
760
|
+
{
|
|
761
|
+
className: "use-spring-carousel-thumbs-wrapper",
|
|
762
|
+
ref: v,
|
|
763
|
+
onWheel: () => R.val.stop(),
|
|
764
|
+
style: {
|
|
765
|
+
display: "flex",
|
|
766
|
+
flex: "1",
|
|
767
|
+
position: "relative",
|
|
768
|
+
width: "100%",
|
|
769
|
+
height: "100%",
|
|
770
|
+
flexDirection: n === "x" ? "row" : "column",
|
|
771
|
+
...n === "x" ? { overflowX: "auto" } : {
|
|
772
|
+
overflowY: "auto",
|
|
773
|
+
maxHeight: "100%"
|
|
774
|
+
}
|
|
775
|
+
},
|
|
776
|
+
children: N().map(({ id: C, renderThumb: u }) => {
|
|
777
|
+
const q = `thumb-item-${C}`;
|
|
778
|
+
return /* @__PURE__ */ L.jsx("div", { id: q, className: "thumb-item", children: typeof u == "function" ? u(B) : u }, q);
|
|
779
|
+
})
|
|
780
|
+
}
|
|
781
|
+
) : null,
|
|
782
|
+
handleScroll: d
|
|
783
|
+
};
|
|
784
|
+
}
|
|
785
|
+
function Nr({
|
|
786
|
+
items: n,
|
|
787
|
+
init: m = !0,
|
|
788
|
+
withThumbs: p,
|
|
789
|
+
thumbsSlideAxis: $ = "x",
|
|
790
|
+
itemsPerSlide: B = 1,
|
|
791
|
+
slideType: v = "fixed",
|
|
792
|
+
gutter: R = 0,
|
|
793
|
+
withLoop: l = !1,
|
|
794
|
+
startEndGutter: f = 0,
|
|
795
|
+
carouselSlideAxis: d = "x",
|
|
796
|
+
disableGestures: N = !1,
|
|
797
|
+
draggingSlideTreshold: A,
|
|
798
|
+
slideWhenThresholdIsReached: C = !1,
|
|
799
|
+
freeScroll: u,
|
|
800
|
+
enableFreeScrollDrag: q,
|
|
801
|
+
initialStartingPosition: y,
|
|
802
|
+
prepareThumbsData: ae,
|
|
803
|
+
initialActiveItem: F = 0,
|
|
804
|
+
animateWhenActiveItemChange: j = !0,
|
|
805
|
+
slideGroupOfItems: te = !1,
|
|
806
|
+
__unstable_stretch_tems__: Ne = !0,
|
|
807
|
+
slideAmount: ne
|
|
808
|
+
}) {
|
|
809
|
+
const Y = B, ie = O(!1), oe = O(A ?? 0), z = O("initial"), Te = O("initial"), Q = O("initial"), D = O(F), x = O(F === 0), b = O(v === "fixed" && F === n.length - 1), w = O(null), M = O(null), me = O(0), pe = O(0), c = O(0), T = O(l), I = O(v), X = O(u), H = O(!1), ke = Me(() => l ? [
|
|
810
|
+
...n.map((r) => ({
|
|
811
|
+
...r,
|
|
812
|
+
id: `prev-repeated-item-${r.id}`
|
|
813
|
+
})),
|
|
814
|
+
...n,
|
|
815
|
+
...n.map((r) => ({
|
|
816
|
+
...r,
|
|
817
|
+
id: `next-repeated-item-${r.id}`
|
|
818
|
+
}))
|
|
819
|
+
] : [...n], [n, l])(), [G, U] = vr(
|
|
820
|
+
() => ({
|
|
821
|
+
val: 0,
|
|
822
|
+
pause: !m,
|
|
823
|
+
onChange: ({ value: r }) => {
|
|
824
|
+
u && w.current ? (d === "x" ? w.current.scrollLeft = Math.abs(r.val) : w.current.scrollTop = Math.abs(r.val), Oe()) : M.current && (d === "x" ? M.current.style.transform = `translate3d(${r.val}px, 0px,0px)` : M.current.style.transform = `translate3d(0px,${r.val}px,0px)`);
|
|
825
|
+
}
|
|
826
|
+
}),
|
|
827
|
+
[u]
|
|
828
|
+
), { emitEvent: ue, useListenToCustomEvent: ge } = mr(), { thumbsFragment: Pe, handleScroll: Ge } = pr({
|
|
829
|
+
withThumbs: !!p,
|
|
830
|
+
thumbsSlideAxis: $,
|
|
831
|
+
prepareThumbsData: ae,
|
|
832
|
+
items: n,
|
|
833
|
+
renderThumbFnProps: {
|
|
834
|
+
getIsActiveItem: qe,
|
|
835
|
+
getIsPrevItem: Be,
|
|
836
|
+
useListenToCustomEvent: ge,
|
|
837
|
+
getIsNextItem: Ue
|
|
838
|
+
}
|
|
839
|
+
}), { enterFullscreen: Ve, exitFullscreen: Xe, getIsFullscreen: Ke } = Fr({
|
|
840
|
+
mainCarouselWrapperRef: w,
|
|
841
|
+
handleResize: () => ye(),
|
|
842
|
+
onFullScreenChange: (r) => {
|
|
843
|
+
ue({
|
|
844
|
+
eventName: "onFullscreenChange",
|
|
845
|
+
isFullscreen: r
|
|
846
|
+
});
|
|
847
|
+
}
|
|
848
|
+
});
|
|
849
|
+
function Fe(r) {
|
|
850
|
+
return v === "fixed" && !u ? {
|
|
851
|
+
marginRight: `${r ? 0 : R}px`,
|
|
852
|
+
flex: `${Ne ? "1" : "0"} 0 calc(100% / ${Y} - ${R * (Y - 1) / Y}px)`
|
|
853
|
+
} : {
|
|
854
|
+
marginRight: `${r ? 0 : R}px`
|
|
855
|
+
};
|
|
856
|
+
}
|
|
857
|
+
const k = Me(() => {
|
|
858
|
+
var a;
|
|
859
|
+
if (typeof ne == "number" && ne > 0 && (v === "fluid" || u))
|
|
860
|
+
return ne;
|
|
861
|
+
const r = te ? w.current : (a = w.current) == null ? void 0 : a.querySelector(".use-spring-carousel-item");
|
|
862
|
+
if (!r)
|
|
863
|
+
throw Error("No carousel items available!");
|
|
864
|
+
let o = r.getBoundingClientRect()[d === "x" ? "width" : "height"];
|
|
865
|
+
return te || (o += R), te && (o += R - f * 2), o;
|
|
866
|
+
}, [
|
|
867
|
+
d,
|
|
868
|
+
u,
|
|
869
|
+
R,
|
|
870
|
+
ne,
|
|
871
|
+
te,
|
|
872
|
+
v,
|
|
873
|
+
f
|
|
874
|
+
]);
|
|
875
|
+
function ce({ from: r, to: o, nextActiveItem: a, immediate: P = !1, slideMode: K }) {
|
|
876
|
+
Te.current = K, typeof a == "number" && (u || (D.current = a), ue({
|
|
877
|
+
eventName: "onSlideStartChange",
|
|
878
|
+
slideActionType: z.current,
|
|
879
|
+
slideMode: Te.current,
|
|
880
|
+
nextItem: {
|
|
881
|
+
startReached: x.current,
|
|
882
|
+
endReached: b.current,
|
|
883
|
+
index: u ? -1 : D.current,
|
|
884
|
+
id: u ? "" : n[D.current].id
|
|
885
|
+
}
|
|
886
|
+
})), c.current = o, U.start({
|
|
887
|
+
immediate: P,
|
|
888
|
+
from: {
|
|
889
|
+
val: r
|
|
890
|
+
},
|
|
891
|
+
to: {
|
|
892
|
+
val: o
|
|
893
|
+
},
|
|
894
|
+
config: {
|
|
895
|
+
...Ie.default,
|
|
896
|
+
velocity: G.val.velocity
|
|
897
|
+
},
|
|
898
|
+
onRest(fe) {
|
|
899
|
+
!P && fe.finished && ue({
|
|
900
|
+
eventName: "onSlideChange",
|
|
901
|
+
slideActionType: z.current,
|
|
902
|
+
slideMode: Te.current,
|
|
903
|
+
currentItem: {
|
|
904
|
+
startReached: x.current,
|
|
905
|
+
endReached: b.current,
|
|
906
|
+
index: u ? -1 : D.current,
|
|
907
|
+
id: u ? "" : n[D.current].id
|
|
908
|
+
}
|
|
909
|
+
});
|
|
910
|
+
}
|
|
911
|
+
}), p && !P && Ge(D.current);
|
|
912
|
+
}
|
|
913
|
+
const W = Me(() => {
|
|
914
|
+
var r;
|
|
915
|
+
return M.current ? l ? k() * n.length : Math.round(
|
|
916
|
+
Number(
|
|
917
|
+
(r = M.current) == null ? void 0 : r[d === "x" ? "scrollWidth" : "scrollHeight"]
|
|
918
|
+
) - M.current.getBoundingClientRect()[d === "x" ? "width" : "height"] - f * 2
|
|
919
|
+
) : 0;
|
|
920
|
+
}, [d, k, n.length, f, l]);
|
|
921
|
+
function je() {
|
|
922
|
+
const r = `calc(100% - ${f * 2}px)`;
|
|
923
|
+
return {
|
|
924
|
+
width: d === "x" ? r : "100%",
|
|
925
|
+
height: d === "y" ? r : "100%"
|
|
926
|
+
};
|
|
927
|
+
}
|
|
928
|
+
const Re = Me(() => {
|
|
929
|
+
var o;
|
|
930
|
+
const r = (o = M.current) == null ? void 0 : o.querySelector(".use-spring-carousel-item");
|
|
931
|
+
if (!r)
|
|
932
|
+
throw Error("No carousel items available!");
|
|
933
|
+
return r.getBoundingClientRect()[d === "x" ? "width" : "height"] + R;
|
|
934
|
+
}, [d, R]), we = Me(
|
|
935
|
+
(r) => {
|
|
936
|
+
const o = d === "x" ? "left" : "top", a = M.current;
|
|
937
|
+
a && (l ? (a.style.top = "0px", a.style.left = "0px", a.style[o] = `-${r - f}px`, x.current = !1, b.current = !1) : (a.style.left = "0px", a.style.top = "0px"));
|
|
938
|
+
},
|
|
939
|
+
[d, f, l]
|
|
940
|
+
), ye = Me(
|
|
941
|
+
(r = !1) => {
|
|
942
|
+
if (M.current && r && (M.current.style.transform = "translate3d(0px, 0px,0px)", M.current.style.left = "0", M.current.style.top = "0"), v === "fixed" && we(
|
|
943
|
+
y === "center" ? Re() * n.length - k() * Math.round((Y - 1) / 2) : y === "end" ? Re() * n.length - k() * Math.round(Y - 1) : Re() * n.length
|
|
944
|
+
), v === "fluid") {
|
|
945
|
+
if (we(Re() * n.length), b.current && W() !== Math.abs(c.current) && !l) {
|
|
946
|
+
const o = -W();
|
|
947
|
+
c.current = o, U.start({
|
|
948
|
+
immediate: !0,
|
|
949
|
+
val: c.current
|
|
950
|
+
});
|
|
951
|
+
return;
|
|
952
|
+
}
|
|
953
|
+
if (Math.abs(c.current) > 0 && W() !== Math.abs(c.current) && !l && !u && Q.current === "backward") {
|
|
954
|
+
const o = me.current - W(), a = c.current + o;
|
|
955
|
+
return U.start({
|
|
956
|
+
immediate: !0,
|
|
957
|
+
val: a
|
|
958
|
+
}), () => {
|
|
959
|
+
c.current = a;
|
|
960
|
+
};
|
|
961
|
+
}
|
|
962
|
+
return;
|
|
963
|
+
}
|
|
964
|
+
if (!u && v === "fixed") {
|
|
965
|
+
const o = -(k() * D.current);
|
|
966
|
+
if (Math.abs(o) > W() && !l) {
|
|
967
|
+
const a = -W();
|
|
968
|
+
b.current = !0, c.current = a, U.start({
|
|
969
|
+
immediate: !0,
|
|
970
|
+
val: c.current
|
|
971
|
+
});
|
|
972
|
+
} else
|
|
973
|
+
c.current = o, U.start({
|
|
974
|
+
immediate: !0,
|
|
975
|
+
val: o
|
|
976
|
+
});
|
|
977
|
+
setTimeout(() => {
|
|
978
|
+
ie.current = !1;
|
|
979
|
+
}, 0);
|
|
980
|
+
}
|
|
981
|
+
},
|
|
982
|
+
[
|
|
983
|
+
u,
|
|
984
|
+
Re,
|
|
985
|
+
k,
|
|
986
|
+
W,
|
|
987
|
+
y,
|
|
988
|
+
n.length,
|
|
989
|
+
Y,
|
|
990
|
+
we,
|
|
991
|
+
U,
|
|
992
|
+
v,
|
|
993
|
+
l
|
|
994
|
+
]
|
|
995
|
+
);
|
|
996
|
+
function ee() {
|
|
997
|
+
return u && w.current ? w.current[d === "x" ? "scrollLeft" : "scrollTop"] : G.val.get();
|
|
998
|
+
}
|
|
999
|
+
function _e(r, o) {
|
|
1000
|
+
if (u && r === "next") {
|
|
1001
|
+
const a = c.current + k();
|
|
1002
|
+
return a > W() ? W() : a;
|
|
1003
|
+
}
|
|
1004
|
+
if (u && r === "prev") {
|
|
1005
|
+
const a = c.current - k();
|
|
1006
|
+
return a < 0 ? 0 : a;
|
|
1007
|
+
}
|
|
1008
|
+
return r === "next" ? typeof o == "number" ? -(o * k()) : c.current - k() : typeof o == "number" ? -(o * k()) : c.current + k();
|
|
1009
|
+
}
|
|
1010
|
+
function se({ type: r, index: o, immediate: a }) {
|
|
1011
|
+
if (!m || H.current || x.current && !l)
|
|
1012
|
+
return;
|
|
1013
|
+
b.current && (Q.current = "backward"), z.current = "prev", b.current = !1;
|
|
1014
|
+
const P = typeof o == "number" ? o : D.current - 1;
|
|
1015
|
+
if (u && Oe(), !l) {
|
|
1016
|
+
const K = u ? _e("prev", o) - k() / 3 < 0 : _e("prev", o) + k() / 3 > 0;
|
|
1017
|
+
if (x.current)
|
|
1018
|
+
return;
|
|
1019
|
+
if (K) {
|
|
1020
|
+
x.current = !0, b.current = !1, ce({
|
|
1021
|
+
slideMode: r,
|
|
1022
|
+
from: ee(),
|
|
1023
|
+
to: 0,
|
|
1024
|
+
nextActiveItem: 0,
|
|
1025
|
+
immediate: a
|
|
1026
|
+
});
|
|
1027
|
+
return;
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
if (l && (x.current || P < 0)) {
|
|
1031
|
+
x.current = !1, b.current = !0, ce({
|
|
1032
|
+
slideMode: r,
|
|
1033
|
+
from: ee() - k() * n.length,
|
|
1034
|
+
to: -(k() * n.length) + k(),
|
|
1035
|
+
nextActiveItem: n.length - 1,
|
|
1036
|
+
immediate: a
|
|
1037
|
+
});
|
|
1038
|
+
return;
|
|
1039
|
+
}
|
|
1040
|
+
P === 0 && (x.current = !0), (P === n.length - 1 || P === -1) && (b.current = !0), ce({
|
|
1041
|
+
slideMode: r,
|
|
1042
|
+
from: ee(),
|
|
1043
|
+
to: _e("prev", o),
|
|
1044
|
+
nextActiveItem: P,
|
|
1045
|
+
immediate: a
|
|
1046
|
+
});
|
|
1047
|
+
}
|
|
1048
|
+
function le({ type: r, index: o, immediate: a }) {
|
|
1049
|
+
if (!m || H.current || b.current && !l)
|
|
1050
|
+
return;
|
|
1051
|
+
x.current && (Q.current = "forward"), z.current = "next", x.current = !1;
|
|
1052
|
+
const P = o || D.current + 1;
|
|
1053
|
+
if (u && Oe(), !l) {
|
|
1054
|
+
const K = Math.abs(_e("next", o)) > W() - k() / 3;
|
|
1055
|
+
if (b.current)
|
|
1056
|
+
return;
|
|
1057
|
+
if (K) {
|
|
1058
|
+
x.current = !1, b.current = !0, ce({
|
|
1059
|
+
slideMode: r,
|
|
1060
|
+
from: ee(),
|
|
1061
|
+
to: u ? W() : -W(),
|
|
1062
|
+
nextActiveItem: P,
|
|
1063
|
+
immediate: a
|
|
1064
|
+
});
|
|
1065
|
+
return;
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
if (l && (b.current || P > n.length - 1)) {
|
|
1069
|
+
b.current = !1, x.current = !0, ce({
|
|
1070
|
+
slideMode: r,
|
|
1071
|
+
from: ee() + k() * n.length,
|
|
1072
|
+
to: 0,
|
|
1073
|
+
nextActiveItem: 0,
|
|
1074
|
+
immediate: a
|
|
1075
|
+
});
|
|
1076
|
+
return;
|
|
1077
|
+
}
|
|
1078
|
+
P === 0 && (x.current = !0), P === n.length - 1 && (b.current = !0), ce({
|
|
1079
|
+
slideMode: r,
|
|
1080
|
+
from: ee(),
|
|
1081
|
+
to: _e("next", o),
|
|
1082
|
+
nextActiveItem: P,
|
|
1083
|
+
immediate: a
|
|
1084
|
+
});
|
|
1085
|
+
}
|
|
1086
|
+
function Ce() {
|
|
1087
|
+
A ? oe.current = A : oe.current = Math.floor(k() / 2 / 2);
|
|
1088
|
+
}
|
|
1089
|
+
function Ze() {
|
|
1090
|
+
M.current && (me.current = W(), T.current = l, I.current = v, X.current = u, pe.current = window.innerWidth, c.current = 0, Ye({ id: D.current, immediate: !0, shouldReset: !0 }), Ce(), ye());
|
|
1091
|
+
}
|
|
1092
|
+
const Qe = hr(
|
|
1093
|
+
(r) => {
|
|
1094
|
+
const o = r.dragging, a = r.offset[d === "x" ? 0 : 1], P = r.movement[d === "x" ? 0 : 1], K = r.direction[d === "x" ? 0 : 1], fe = P > oe.current, de = P < -oe.current, tr = W(), re = r.velocity;
|
|
1095
|
+
if (o) {
|
|
1096
|
+
if (K > 0 ? z.current = "prev" : z.current = "next", ue({
|
|
1097
|
+
...r,
|
|
1098
|
+
eventName: "onDrag",
|
|
1099
|
+
slideActionType: z.current
|
|
1100
|
+
}), u) {
|
|
1101
|
+
if (a > 0) {
|
|
1102
|
+
U.start({
|
|
1103
|
+
from: {
|
|
1104
|
+
val: ee()
|
|
1105
|
+
},
|
|
1106
|
+
to: {
|
|
1107
|
+
val: 0
|
|
1108
|
+
},
|
|
1109
|
+
config: {
|
|
1110
|
+
velocity: re,
|
|
1111
|
+
friction: 50,
|
|
1112
|
+
tension: 1e3
|
|
1113
|
+
}
|
|
1114
|
+
}), r.cancel();
|
|
1115
|
+
return;
|
|
1116
|
+
}
|
|
1117
|
+
U.start({
|
|
1118
|
+
from: {
|
|
1119
|
+
val: ee()
|
|
1120
|
+
},
|
|
1121
|
+
to: {
|
|
1122
|
+
val: -a
|
|
1123
|
+
},
|
|
1124
|
+
config: {
|
|
1125
|
+
velocity: re,
|
|
1126
|
+
friction: 50,
|
|
1127
|
+
tension: 1e3
|
|
1128
|
+
}
|
|
1129
|
+
});
|
|
1130
|
+
return;
|
|
1131
|
+
}
|
|
1132
|
+
U.start({
|
|
1133
|
+
val: a,
|
|
1134
|
+
config: {
|
|
1135
|
+
velocity: re,
|
|
1136
|
+
friction: 50,
|
|
1137
|
+
tension: 1e3
|
|
1138
|
+
}
|
|
1139
|
+
}), C && de ? (le({ type: "drag" }), r.cancel()) : C && fe && (se({ type: "drag" }), r.cancel()), tr - Math.abs(a) < -(k() * 2) && r.cancel();
|
|
1140
|
+
return;
|
|
1141
|
+
}
|
|
1142
|
+
if (r.last && u && a > 0) {
|
|
1143
|
+
U.start({
|
|
1144
|
+
from: {
|
|
1145
|
+
val: ee()
|
|
1146
|
+
},
|
|
1147
|
+
to: {
|
|
1148
|
+
val: 0
|
|
1149
|
+
},
|
|
1150
|
+
config: {
|
|
1151
|
+
velocity: re,
|
|
1152
|
+
friction: 50,
|
|
1153
|
+
tension: 1e3
|
|
1154
|
+
}
|
|
1155
|
+
});
|
|
1156
|
+
return;
|
|
1157
|
+
}
|
|
1158
|
+
r.last && !r.canceled && u && (z.current === "prev" && se({ type: "drag" }), z.current === "next" && le({ type: "drag" })), r.last && !r.canceled && !u && (Y === n.length ? U.start({
|
|
1159
|
+
val: c.current,
|
|
1160
|
+
config: {
|
|
1161
|
+
...Ie.default,
|
|
1162
|
+
velocity: re
|
|
1163
|
+
}
|
|
1164
|
+
}) : de ? !l && b.current ? U.start({
|
|
1165
|
+
val: -W(),
|
|
1166
|
+
config: {
|
|
1167
|
+
...Ie.default,
|
|
1168
|
+
velocity: re
|
|
1169
|
+
}
|
|
1170
|
+
}) : le({ type: "drag" }) : fe ? !l && x.current ? U.start({
|
|
1171
|
+
val: 0,
|
|
1172
|
+
config: {
|
|
1173
|
+
...Ie.default,
|
|
1174
|
+
velocity: re
|
|
1175
|
+
}
|
|
1176
|
+
}) : se({ type: "drag" }) : U.start({
|
|
1177
|
+
val: c.current,
|
|
1178
|
+
config: {
|
|
1179
|
+
...Ie.default,
|
|
1180
|
+
velocity: re
|
|
1181
|
+
}
|
|
1182
|
+
})), r.last && r.canceled && U.start({
|
|
1183
|
+
val: c.current,
|
|
1184
|
+
config: {
|
|
1185
|
+
...Ie.default,
|
|
1186
|
+
velocity: re
|
|
1187
|
+
}
|
|
1188
|
+
});
|
|
1189
|
+
},
|
|
1190
|
+
{
|
|
1191
|
+
enabled: m && !N && !u || !!u && !!q,
|
|
1192
|
+
axis: d,
|
|
1193
|
+
from: () => u && w.current ? [
|
|
1194
|
+
-w.current.scrollLeft,
|
|
1195
|
+
-w.current.scrollTop
|
|
1196
|
+
] : d === "x" ? [G.val.get(), G.val.get()] : [G.val.get(), G.val.get()]
|
|
1197
|
+
}
|
|
1198
|
+
);
|
|
1199
|
+
function Se() {
|
|
1200
|
+
return u ? d === "x" ? {
|
|
1201
|
+
overflowX: "auto"
|
|
1202
|
+
} : {
|
|
1203
|
+
overflowY: "auto"
|
|
1204
|
+
} : {};
|
|
1205
|
+
}
|
|
1206
|
+
function Oe() {
|
|
1207
|
+
w.current && (c.current = w.current[d === "x" ? "scrollLeft" : "scrollTop"], w.current[d === "x" ? "scrollLeft" : "scrollTop"] === 0 && (x.current = !0, b.current = !1), w.current[d === "x" ? "scrollLeft" : "scrollTop"] > 0 && w.current[d === "x" ? "scrollLeft" : "scrollTop"] < W() && (x.current = !1, b.current = !1), w.current[d === "x" ? "scrollLeft" : "scrollTop"] === W() && (x.current = !1, b.current = !0));
|
|
1208
|
+
}
|
|
1209
|
+
function rr() {
|
|
1210
|
+
return u ? {
|
|
1211
|
+
onWheel() {
|
|
1212
|
+
G.val.stop(), Oe();
|
|
1213
|
+
}
|
|
1214
|
+
} : {};
|
|
1215
|
+
}
|
|
1216
|
+
function xe(r, o) {
|
|
1217
|
+
let a = 0;
|
|
1218
|
+
if (typeof r == "string" ? a = n.findIndex((P) => P.id === r) : a = r, a < 0 || a >= n.length) {
|
|
1219
|
+
if (o)
|
|
1220
|
+
throw new Error(o);
|
|
1221
|
+
console.error(`The item doesn't exist; check that the id provided - ${r} - is correct.`), a = -1;
|
|
1222
|
+
}
|
|
1223
|
+
return a;
|
|
1224
|
+
}
|
|
1225
|
+
function Ye({ id: r, immediate: o, shouldReset: a, type: P }) {
|
|
1226
|
+
if (!m || H.current)
|
|
1227
|
+
return;
|
|
1228
|
+
x.current = !1, b.current = !1;
|
|
1229
|
+
const K = xe(
|
|
1230
|
+
r,
|
|
1231
|
+
"The item you want to slide to doesn't exist; check the provided id."
|
|
1232
|
+
);
|
|
1233
|
+
if (K === D.current && !a)
|
|
1234
|
+
return;
|
|
1235
|
+
const fe = xe(n[D.current].id), de = xe(n[K].id);
|
|
1236
|
+
de > fe ? le({
|
|
1237
|
+
type: P || a ? "initial" : "click",
|
|
1238
|
+
index: de,
|
|
1239
|
+
immediate: o
|
|
1240
|
+
}) : se({
|
|
1241
|
+
type: P || a ? "initial" : "click",
|
|
1242
|
+
index: de,
|
|
1243
|
+
immediate: o
|
|
1244
|
+
});
|
|
1245
|
+
}
|
|
1246
|
+
function Ue(r) {
|
|
1247
|
+
const o = xe(r, "The item doesn't exist; check the provided id."), a = D.current;
|
|
1248
|
+
return l && a === n.length - 1 ? o === 0 : o === a + 1;
|
|
1249
|
+
}
|
|
1250
|
+
function Be(r) {
|
|
1251
|
+
const o = xe(r, "The item doesn't exist; check the provided id."), a = D.current;
|
|
1252
|
+
return l && a === 0 ? o === n.length - 1 : o === a - 1;
|
|
1253
|
+
}
|
|
1254
|
+
function qe(r) {
|
|
1255
|
+
return xe(r, "The item you want to check doesn't exist; check the provided id.") === D.current;
|
|
1256
|
+
}
|
|
1257
|
+
function Ae() {
|
|
1258
|
+
return N ? "unset" : d === "x" ? "pan-y" : "pan-x";
|
|
1259
|
+
}
|
|
1260
|
+
const $e = u ? {
|
|
1261
|
+
useListenToCustomEvent: ge,
|
|
1262
|
+
enterFullscreen: Ve,
|
|
1263
|
+
exitFullscreen: Xe,
|
|
1264
|
+
getIsFullscreen: Ke,
|
|
1265
|
+
slideToPrevItem: (r = !0) => {
|
|
1266
|
+
se({
|
|
1267
|
+
type: "click",
|
|
1268
|
+
immediate: !r
|
|
1269
|
+
});
|
|
1270
|
+
},
|
|
1271
|
+
slideToNextItem: (r = !0) => {
|
|
1272
|
+
le({
|
|
1273
|
+
type: "click",
|
|
1274
|
+
immediate: !r
|
|
1275
|
+
});
|
|
1276
|
+
}
|
|
1277
|
+
} : {
|
|
1278
|
+
useListenToCustomEvent: ge,
|
|
1279
|
+
enterFullscreen: Ve,
|
|
1280
|
+
exitFullscreen: Xe,
|
|
1281
|
+
getIsFullscreen: Ke,
|
|
1282
|
+
slideToPrevItem: (r = !0) => {
|
|
1283
|
+
se({
|
|
1284
|
+
type: "click",
|
|
1285
|
+
immediate: !r
|
|
1286
|
+
});
|
|
1287
|
+
},
|
|
1288
|
+
slideToNextItem: (r = !0) => {
|
|
1289
|
+
le({
|
|
1290
|
+
type: "click",
|
|
1291
|
+
immediate: !r
|
|
1292
|
+
});
|
|
1293
|
+
},
|
|
1294
|
+
slideToItem: (r, o = !0) => {
|
|
1295
|
+
Ye({ id: r, immediate: !o });
|
|
1296
|
+
},
|
|
1297
|
+
getIsNextItem: Ue,
|
|
1298
|
+
getIsPrevItem: Be,
|
|
1299
|
+
getIsActiveItem: qe
|
|
1300
|
+
};
|
|
1301
|
+
Rr(() => {
|
|
1302
|
+
M.current && m && (ie.current = !0, Ze());
|
|
1303
|
+
}, [m]), he(() => {
|
|
1304
|
+
D.current !== F && (ie.current = !0, Ye({
|
|
1305
|
+
id: F,
|
|
1306
|
+
immediate: !j
|
|
1307
|
+
}));
|
|
1308
|
+
}, [F]), he(() => {
|
|
1309
|
+
if (m) {
|
|
1310
|
+
if (F > n.length - 1)
|
|
1311
|
+
throw new Error(
|
|
1312
|
+
`initialActiveItem (${F}) is greater than the total quantity available items (${n.length}).`
|
|
1313
|
+
);
|
|
1314
|
+
Y > n.length && console.warn(
|
|
1315
|
+
`itemsPerSlide (${Y}) is greater than the total quantity available items (${n.length}). Fallback to ${n.length})`
|
|
1316
|
+
);
|
|
1317
|
+
}
|
|
1318
|
+
}, [F, n.length, Y, m]), he(() => {
|
|
1319
|
+
pe.current = window.innerWidth;
|
|
1320
|
+
}, []), he(() => {
|
|
1321
|
+
if (m) {
|
|
1322
|
+
if (l && u)
|
|
1323
|
+
throw new Error("`withLoop` and `freeScroll` can't be used together.");
|
|
1324
|
+
if (u && v === "fixed")
|
|
1325
|
+
throw new Error("`freeScroll` can't be used when `scrollType: fixed`.");
|
|
1326
|
+
if (q && (v !== "fluid" || !u))
|
|
1327
|
+
throw new Error(
|
|
1328
|
+
"`enableFreeScrollDrag` must be used with `slideType: fluid` and `freeScroll=true`"
|
|
1329
|
+
);
|
|
1330
|
+
if (te && u)
|
|
1331
|
+
throw new Error("`slideGroupOfItems` and `freeScroll` can't be used together.");
|
|
1332
|
+
if (typeof ne == "number" && ne > 0 && v === "fixed")
|
|
1333
|
+
throw new Error("`slideAmount` must be used with `slideType: fluid`");
|
|
1334
|
+
ie.current = !0, Ze();
|
|
1335
|
+
}
|
|
1336
|
+
}, [
|
|
1337
|
+
y,
|
|
1338
|
+
Y,
|
|
1339
|
+
f,
|
|
1340
|
+
R,
|
|
1341
|
+
m,
|
|
1342
|
+
l,
|
|
1343
|
+
v,
|
|
1344
|
+
u,
|
|
1345
|
+
q,
|
|
1346
|
+
te
|
|
1347
|
+
]), he(() => {
|
|
1348
|
+
if (!m)
|
|
1349
|
+
return;
|
|
1350
|
+
function r() {
|
|
1351
|
+
document.hidden ? H.current = !0 : H.current = !1;
|
|
1352
|
+
}
|
|
1353
|
+
return document.addEventListener("visibilitychange", r), () => {
|
|
1354
|
+
document.removeEventListener("visibilitychange", r);
|
|
1355
|
+
};
|
|
1356
|
+
}, [m]), he(() => {
|
|
1357
|
+
if (w.current) {
|
|
1358
|
+
let r;
|
|
1359
|
+
const o = new Cr(() => {
|
|
1360
|
+
if (!H.current && !ie.current) {
|
|
1361
|
+
pe.current = window.innerWidth;
|
|
1362
|
+
const a = ye();
|
|
1363
|
+
window.clearTimeout(r), r = setTimeout(() => {
|
|
1364
|
+
me.current = W(), typeof a == "function" && a();
|
|
1365
|
+
}, 100);
|
|
1366
|
+
}
|
|
1367
|
+
});
|
|
1368
|
+
return o.observe(w.current), () => {
|
|
1369
|
+
o.disconnect();
|
|
1370
|
+
};
|
|
1371
|
+
}
|
|
1372
|
+
}, [ye, W]);
|
|
1373
|
+
const be = /* @__PURE__ */ L.jsx(ar.Provider, { value: $e, children: Pe }), Le = /* @__PURE__ */ L.jsx(ar.Provider, { value: $e, children: /* @__PURE__ */ L.jsx(
|
|
1374
|
+
"div",
|
|
1375
|
+
{
|
|
1376
|
+
className: "use-spring-carousel-main-wrapper",
|
|
1377
|
+
ref: w,
|
|
1378
|
+
...rr(),
|
|
1379
|
+
style: {
|
|
1380
|
+
display: "flex",
|
|
1381
|
+
position: "relative",
|
|
1382
|
+
width: "100%",
|
|
1383
|
+
height: "100%",
|
|
1384
|
+
...Se()
|
|
1385
|
+
},
|
|
1386
|
+
children: /* @__PURE__ */ L.jsxs(
|
|
1387
|
+
"div",
|
|
1388
|
+
{
|
|
1389
|
+
className: "use-spring-carousel-track-wrapper",
|
|
1390
|
+
ref: M,
|
|
1391
|
+
...Qe(),
|
|
1392
|
+
style: {
|
|
1393
|
+
position: "relative",
|
|
1394
|
+
display: "flex",
|
|
1395
|
+
flexDirection: d === "x" ? "row" : "column",
|
|
1396
|
+
touchAction: Ae(),
|
|
1397
|
+
...je()
|
|
1398
|
+
},
|
|
1399
|
+
children: [
|
|
1400
|
+
(u || !l) && f ? /* @__PURE__ */ L.jsx(
|
|
1401
|
+
"div",
|
|
1402
|
+
{
|
|
1403
|
+
style: {
|
|
1404
|
+
flexShrink: 0,
|
|
1405
|
+
width: f
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1408
|
+
) : null,
|
|
1409
|
+
ke.map((r, o) => /* @__PURE__ */ L.jsx(Er, { children: /* @__PURE__ */ L.jsx(
|
|
1410
|
+
"div",
|
|
1411
|
+
{
|
|
1412
|
+
className: "use-spring-carousel-item",
|
|
1413
|
+
"data-testid": "use-spring-carousel-item-wrapper",
|
|
1414
|
+
style: {
|
|
1415
|
+
display: "flex",
|
|
1416
|
+
position: "relative",
|
|
1417
|
+
...v === "fixed" ? { flex: "1" } : {},
|
|
1418
|
+
...Fe(
|
|
1419
|
+
o === ke.findIndex(
|
|
1420
|
+
(a) => a.id === ke[ke.length - 1].id
|
|
1421
|
+
)
|
|
1422
|
+
)
|
|
1423
|
+
},
|
|
1424
|
+
children: typeof r.renderItem == "function" ? r.renderItem({
|
|
1425
|
+
getIsActiveItem: qe,
|
|
1426
|
+
getIsNextItem: Ue,
|
|
1427
|
+
getIsPrevItem: Be,
|
|
1428
|
+
useListenToCustomEvent: ge
|
|
1429
|
+
}) : r.renderItem
|
|
1430
|
+
}
|
|
1431
|
+
) }, `${r.id}-${o}`)),
|
|
1432
|
+
(u || !l) && f ? /* @__PURE__ */ L.jsx(
|
|
1433
|
+
"div",
|
|
1434
|
+
{
|
|
1435
|
+
style: {
|
|
1436
|
+
flexShrink: 0,
|
|
1437
|
+
width: f
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
) : null
|
|
1441
|
+
]
|
|
1442
|
+
}
|
|
1443
|
+
)
|
|
1444
|
+
}
|
|
1445
|
+
) });
|
|
1446
|
+
return { ...$e, carouselFragment: Le, thumbsFragment: be };
|
|
1447
|
+
}
|
|
1448
|
+
const ar = fr(void 0);
|
|
1449
|
+
function Vr() {
|
|
1450
|
+
const n = dr(ar);
|
|
1451
|
+
if (!n)
|
|
1452
|
+
throw new Error("useSpringCarouselContext must be used within the carousel.");
|
|
1453
|
+
return n;
|
|
1454
|
+
}
|
|
1455
|
+
const We = {
|
|
1456
|
+
initial: {
|
|
1457
|
+
opacity: 1,
|
|
1458
|
+
position: "relative"
|
|
1459
|
+
},
|
|
1460
|
+
from: {
|
|
1461
|
+
opacity: 0,
|
|
1462
|
+
position: "relative"
|
|
1463
|
+
},
|
|
1464
|
+
enter: {
|
|
1465
|
+
position: "relative",
|
|
1466
|
+
opacity: 1
|
|
1467
|
+
},
|
|
1468
|
+
leave: {
|
|
1469
|
+
opacity: 1,
|
|
1470
|
+
position: "absolute"
|
|
1471
|
+
}
|
|
1472
|
+
};
|
|
1473
|
+
function Sr({
|
|
1474
|
+
init: n = !0,
|
|
1475
|
+
disableGestures: m = !1,
|
|
1476
|
+
items: p,
|
|
1477
|
+
springConfig: $ = Ie.default,
|
|
1478
|
+
exitBeforeEnter: B = !1,
|
|
1479
|
+
trail: v,
|
|
1480
|
+
withLoop: R = !1,
|
|
1481
|
+
activeItem: l,
|
|
1482
|
+
toPrevItemSpringProps: f = We,
|
|
1483
|
+
toNextItemSpringProps: d = We,
|
|
1484
|
+
draggingSlideTreshold: N = 50,
|
|
1485
|
+
thumbsSlideAxis: A = "x"
|
|
1486
|
+
}) {
|
|
1487
|
+
const C = O("next"), u = O("initial"), q = O(null), [y, ae] = Tr(l ?? 0), { emitEvent: F, useListenToCustomEvent: j } = mr(), { handleScroll: te, thumbsFragment: Ne } = pr({
|
|
1488
|
+
thumbsSlideAxis: A,
|
|
1489
|
+
items: p,
|
|
1490
|
+
renderThumbFnProps: {
|
|
1491
|
+
getIsNextItem: D,
|
|
1492
|
+
getIsPrevItem: x,
|
|
1493
|
+
useListenToCustomEvent: j,
|
|
1494
|
+
activeItem: {
|
|
1495
|
+
index: y,
|
|
1496
|
+
id: p[y].id
|
|
1497
|
+
}
|
|
1498
|
+
}
|
|
1499
|
+
});
|
|
1500
|
+
function ne() {
|
|
1501
|
+
return C.current === "prev" ? {
|
|
1502
|
+
initial: {
|
|
1503
|
+
...f.initial
|
|
1504
|
+
},
|
|
1505
|
+
from: {
|
|
1506
|
+
...f.from
|
|
1507
|
+
},
|
|
1508
|
+
enter: {
|
|
1509
|
+
...f.enter
|
|
1510
|
+
},
|
|
1511
|
+
leave: {
|
|
1512
|
+
...f.leave
|
|
1513
|
+
}
|
|
1514
|
+
} : C.current === "next" ? {
|
|
1515
|
+
initial: {
|
|
1516
|
+
...d.initial
|
|
1517
|
+
},
|
|
1518
|
+
from: {
|
|
1519
|
+
...d.from
|
|
1520
|
+
},
|
|
1521
|
+
enter: {
|
|
1522
|
+
...d.enter
|
|
1523
|
+
},
|
|
1524
|
+
leave: {
|
|
1525
|
+
...d.leave
|
|
1526
|
+
}
|
|
1527
|
+
} : {
|
|
1528
|
+
initial: {
|
|
1529
|
+
...We.initial
|
|
1530
|
+
},
|
|
1531
|
+
from: {
|
|
1532
|
+
...We.from
|
|
1533
|
+
},
|
|
1534
|
+
enter: {
|
|
1535
|
+
...We.enter
|
|
1536
|
+
},
|
|
1537
|
+
leave: {
|
|
1538
|
+
...We.leave
|
|
1539
|
+
}
|
|
1540
|
+
};
|
|
1541
|
+
}
|
|
1542
|
+
he(() => {
|
|
1543
|
+
typeof l == "number" && l !== y && ae(l);
|
|
1544
|
+
}, [l]);
|
|
1545
|
+
function Y({ to: c, slideType: T, slideMode: I }) {
|
|
1546
|
+
C.current = T, u.current = I, F({
|
|
1547
|
+
eventName: "onSlideStartChange",
|
|
1548
|
+
slideActionType: C.current,
|
|
1549
|
+
slideMode: u.current,
|
|
1550
|
+
nextItem: {
|
|
1551
|
+
index: c,
|
|
1552
|
+
id: p[c].id,
|
|
1553
|
+
startReached: c === 0,
|
|
1554
|
+
endReached: c === p.length - 1
|
|
1555
|
+
}
|
|
1556
|
+
}), ae(c), te(y);
|
|
1557
|
+
}
|
|
1558
|
+
function ie(c) {
|
|
1559
|
+
if (!n)
|
|
1560
|
+
return;
|
|
1561
|
+
const T = y === 0;
|
|
1562
|
+
!R && T || Y(R && T ? {
|
|
1563
|
+
to: p.length - 1,
|
|
1564
|
+
slideType: "prev",
|
|
1565
|
+
slideMode: c
|
|
1566
|
+
} : {
|
|
1567
|
+
to: y - 1,
|
|
1568
|
+
slideType: "prev",
|
|
1569
|
+
slideMode: c
|
|
1570
|
+
});
|
|
1571
|
+
}
|
|
1572
|
+
function oe(c) {
|
|
1573
|
+
if (!n)
|
|
1574
|
+
return;
|
|
1575
|
+
const T = y === p.length - 1;
|
|
1576
|
+
!R && T || Y(R && T ? {
|
|
1577
|
+
to: 0,
|
|
1578
|
+
slideType: "next",
|
|
1579
|
+
slideMode: c
|
|
1580
|
+
} : {
|
|
1581
|
+
to: y + 1,
|
|
1582
|
+
slideType: "next",
|
|
1583
|
+
slideMode: c
|
|
1584
|
+
});
|
|
1585
|
+
}
|
|
1586
|
+
const z = wr(y, {
|
|
1587
|
+
config: $,
|
|
1588
|
+
key: null,
|
|
1589
|
+
trail: v,
|
|
1590
|
+
exitBeforeEnter: B,
|
|
1591
|
+
...ne(),
|
|
1592
|
+
onRest(c, T, I) {
|
|
1593
|
+
c.finished && I === y && F({
|
|
1594
|
+
eventName: "onSlideChange",
|
|
1595
|
+
slideActionType: C.current,
|
|
1596
|
+
slideMode: u.current,
|
|
1597
|
+
currentItem: {
|
|
1598
|
+
index: y,
|
|
1599
|
+
id: p[y].id,
|
|
1600
|
+
startReached: y === 0,
|
|
1601
|
+
endReached: y === p.length - 1
|
|
1602
|
+
}
|
|
1603
|
+
});
|
|
1604
|
+
}
|
|
1605
|
+
}), Te = hr(
|
|
1606
|
+
({ last: c, movement: [T] }) => {
|
|
1607
|
+
if (c) {
|
|
1608
|
+
const I = T > N, X = T < -N, H = y === 0, ze = y === p.length - 1;
|
|
1609
|
+
if (X) {
|
|
1610
|
+
if (!R && ze)
|
|
1611
|
+
return;
|
|
1612
|
+
F({
|
|
1613
|
+
eventName: "onLeftSwipe"
|
|
1614
|
+
}), oe("swipe");
|
|
1615
|
+
} else if (I) {
|
|
1616
|
+
if (!R && H)
|
|
1617
|
+
return;
|
|
1618
|
+
F({
|
|
1619
|
+
eventName: "onRightSwipe"
|
|
1620
|
+
}), ie("swipe");
|
|
1621
|
+
}
|
|
1622
|
+
}
|
|
1623
|
+
},
|
|
1624
|
+
{
|
|
1625
|
+
enabled: !m
|
|
1626
|
+
}
|
|
1627
|
+
);
|
|
1628
|
+
function Q(c, T) {
|
|
1629
|
+
let I = 0;
|
|
1630
|
+
if (typeof c == "string" ? I = p.findIndex((X) => X.id === c) : I = c, I < 0 || I >= p.length) {
|
|
1631
|
+
if (T)
|
|
1632
|
+
throw new Error(T);
|
|
1633
|
+
console.error(`The item doesn't exist; check that the id provided - ${c} - is correct.`), I = -1;
|
|
1634
|
+
}
|
|
1635
|
+
return I;
|
|
1636
|
+
}
|
|
1637
|
+
function D(c) {
|
|
1638
|
+
const T = Q(c, "The item doesn't exist; check the provided id."), I = y;
|
|
1639
|
+
return R && I === p.length - 1 ? T === 0 : T === I + 1;
|
|
1640
|
+
}
|
|
1641
|
+
function x(c) {
|
|
1642
|
+
const T = Q(c, "The item doesn't exist; check the provided id."), I = y;
|
|
1643
|
+
return R && I === 0 ? T === p.length - 1 : T === I - 1;
|
|
1644
|
+
}
|
|
1645
|
+
const b = z((c, T, I, X) => {
|
|
1646
|
+
const H = p[T].renderItem;
|
|
1647
|
+
return /* @__PURE__ */ L.jsx(
|
|
1648
|
+
_r.div,
|
|
1649
|
+
{
|
|
1650
|
+
id: `use-transition-carousel-item-${X}`,
|
|
1651
|
+
className: "use-transition-carousel-item",
|
|
1652
|
+
style: {
|
|
1653
|
+
...c,
|
|
1654
|
+
flex: "1 0 100%",
|
|
1655
|
+
width: "100%",
|
|
1656
|
+
height: "100%"
|
|
1657
|
+
},
|
|
1658
|
+
children: typeof H == "function" ? H({
|
|
1659
|
+
useListenToCustomEvent: j,
|
|
1660
|
+
getIsNextItem: D,
|
|
1661
|
+
getIsPrevItem: x,
|
|
1662
|
+
activeItem: {
|
|
1663
|
+
index: y,
|
|
1664
|
+
id: p[y].id
|
|
1665
|
+
}
|
|
1666
|
+
}) : H
|
|
1667
|
+
}
|
|
1668
|
+
);
|
|
1669
|
+
});
|
|
1670
|
+
function w() {
|
|
1671
|
+
return m ? "unset" : "pan-y";
|
|
1672
|
+
}
|
|
1673
|
+
const M = {
|
|
1674
|
+
useListenToCustomEvent: j,
|
|
1675
|
+
slideToPrevItem: () => ie("click"),
|
|
1676
|
+
slideToNextItem: () => oe("click"),
|
|
1677
|
+
activeItem: y,
|
|
1678
|
+
slideToItem: (c) => {
|
|
1679
|
+
const T = Q(
|
|
1680
|
+
c,
|
|
1681
|
+
"The item you want to slide to doesn't exist; check the provided id."
|
|
1682
|
+
);
|
|
1683
|
+
if (c === y)
|
|
1684
|
+
return;
|
|
1685
|
+
const I = Q(p[y].id), X = Q(p[T].id);
|
|
1686
|
+
Y({
|
|
1687
|
+
to: X,
|
|
1688
|
+
slideType: X > I ? "next" : "prev",
|
|
1689
|
+
slideMode: "click"
|
|
1690
|
+
});
|
|
1691
|
+
}
|
|
1692
|
+
}, me = /* @__PURE__ */ L.jsx(or.Provider, { value: M, children: Ne }), pe = /* @__PURE__ */ L.jsx(or.Provider, { value: M, children: /* @__PURE__ */ L.jsx(
|
|
1693
|
+
"div",
|
|
1694
|
+
{
|
|
1695
|
+
className: "use-transition-carousel-wrapper",
|
|
1696
|
+
ref: q,
|
|
1697
|
+
...Te(),
|
|
1698
|
+
style: {
|
|
1699
|
+
display: "flex",
|
|
1700
|
+
position: "relative",
|
|
1701
|
+
width: "100%",
|
|
1702
|
+
height: "100%",
|
|
1703
|
+
overflow: "hidden",
|
|
1704
|
+
touchAction: w()
|
|
1705
|
+
},
|
|
1706
|
+
children: b
|
|
1707
|
+
}
|
|
1708
|
+
) });
|
|
1709
|
+
return {
|
|
1710
|
+
...M,
|
|
1711
|
+
carouselFragment: pe,
|
|
1712
|
+
thumbsFragment: me
|
|
1713
|
+
};
|
|
1714
|
+
}
|
|
1715
|
+
const or = fr(void 0);
|
|
1716
|
+
function Yr() {
|
|
1717
|
+
const n = dr(or);
|
|
1718
|
+
if (!n)
|
|
1719
|
+
throw new Error("useTransitionCarouselContext must be used within the carousel.");
|
|
1720
|
+
return n;
|
|
1721
|
+
}
|
|
9
1722
|
export {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1723
|
+
Nr as useSpringCarousel,
|
|
1724
|
+
Vr as useSpringCarouselContext,
|
|
1725
|
+
Sr as useTransitionCarousel,
|
|
1726
|
+
Yr as useTransitionCarouselContext
|
|
14
1727
|
};
|
|
15
1728
|
//# sourceMappingURL=index.es.js.map
|