react-spring-carousel 3.0.0-beta067 → 3.0.0-beta070

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.
Files changed (43) hide show
  1. package/dist/index.cjs +1 -0
  2. package/dist/index.d.ts +3 -0
  3. package/dist/index.js +18 -0
  4. package/dist/index2.cjs +1 -0
  5. package/dist/index2.js +10 -0
  6. package/dist/{types/modules → modules}/index.d.ts +3 -3
  7. package/dist/{types/modules → modules}/useEventsModule.d.ts +51 -51
  8. package/dist/{types/modules → modules}/useFullscreenModule.d.ts +12 -12
  9. package/dist/{types/modules → modules}/useThumbsModule.d.ts +14 -14
  10. package/dist/types/{types/common.d.ts → common.d.ts} +34 -34
  11. package/dist/types/index.d.ts +4 -3
  12. package/dist/types/{types/useSpringCarousel.types.d.ts → useSpringCarousel.types.d.ts} +102 -102
  13. package/dist/types/{types/useTransitionCarousel.types.d.ts → useTransitionCarousel.types.d.ts} +33 -33
  14. package/dist/useFullscreenModule-55ea7b9d.js +38 -0
  15. package/dist/useFullscreenModule-be189d5b.cjs +1 -0
  16. package/dist/useSpringCarousel.cjs +1 -0
  17. package/dist/{types/useSpringCarousel.d.ts → useSpringCarousel.d.ts} +18 -18
  18. package/dist/useSpringCarousel.js +658 -0
  19. package/dist/useThumbsModule-0c05dcf5.cjs +27 -0
  20. package/dist/useThumbsModule-db93025f.js +753 -0
  21. package/dist/useTransitionCarousel.cjs +1 -0
  22. package/dist/{types/useTransitionCarousel.d.ts → useTransitionCarousel.d.ts} +5 -5
  23. package/dist/useTransitionCarousel.js +257 -0
  24. package/package.json +37 -48
  25. package/README.md +0 -54
  26. package/dist/cjs/index.js +0 -2
  27. package/dist/cjs/index.js.map +0 -1
  28. package/dist/esm/index.js +0 -2
  29. package/dist/esm/index.js.map +0 -1
  30. package/dist/esm/index2.js +0 -2
  31. package/dist/esm/index2.js.map +0 -1
  32. package/dist/esm/useFullscreenModule-519d337d.js +0 -2
  33. package/dist/esm/useFullscreenModule-519d337d.js.map +0 -1
  34. package/dist/esm/useSpringCarousel.js +0 -2
  35. package/dist/esm/useSpringCarousel.js.map +0 -1
  36. package/dist/esm/useThumbsModule-faa196f9.js +0 -2
  37. package/dist/esm/useThumbsModule-faa196f9.js.map +0 -1
  38. package/dist/esm/useTransitionCarousel.js +0 -2
  39. package/dist/esm/useTransitionCarousel.js.map +0 -1
  40. package/dist/types/mockedItems.d.ts +0 -2
  41. package/dist/types/types/index.d.ts +0 -4
  42. package/dist/umd/index.js +0 -2
  43. package/dist/umd/index.js.map +0 -1
@@ -0,0 +1,658 @@
1
+ import { u as Ve, a as De, j as F } from "./useThumbsModule-db93025f.js";
2
+ import { useSpring as qe, config as B, useIsomorphicLayoutEffect as ze } from "@react-spring/web";
3
+ import { createContext as Be, useRef as v, useCallback as He, useEffect as N, useContext as Oe } from "react";
4
+ import { useDrag as Xe } from "@use-gesture/react";
5
+ import { u as Ye } from "./useFullscreenModule-55ea7b9d.js";
6
+ import Je from "resize-observer-polyfill";
7
+ import "screenfull";
8
+ function tt({
9
+ items: n,
10
+ init: p = !0,
11
+ withThumbs: le,
12
+ thumbsSlideAxis: he = "x",
13
+ itemsPerSlide: se = 1,
14
+ slideType: k = "fixed",
15
+ gutter: R = 0,
16
+ withLoop: o = !1,
17
+ startEndGutter: C = 0,
18
+ carouselSlideAxis: u = "x",
19
+ disableGestures: ae = !1,
20
+ draggingSlideTreshold: U,
21
+ slideWhenThresholdIsReached: fe = !1,
22
+ freeScroll: c,
23
+ enableFreeScrollDrag: pe,
24
+ initialStartingPosition: Z,
25
+ prepareThumbsData: xe,
26
+ initialActiveItem: T = 0,
27
+ animateWhenActiveItemChange: ye = !0,
28
+ getControllerRef: _
29
+ }) {
30
+ const b = se > n.length ? n.length : se, H = v(!1), O = v(U ?? 0), M = v("initial"), G = v("initial"), L = v(
31
+ "initial"
32
+ ), g = v(T), s = v(T === 0), l = v(
33
+ k === "fixed" && T === n.length - 1
34
+ ), a = v(null), h = v(null), A = v(!0), S = v(0), ee = v(0), f = v(0), Ie = v(o), Te = v(k), be = v(c), W = v(!1), X = He(() => o ? [
35
+ ...n.map((e) => ({
36
+ ...e,
37
+ id: `prev-repeated-item-${e.id}`
38
+ })),
39
+ ...n,
40
+ ...n.map((e) => ({
41
+ ...e,
42
+ id: `next-repeated-item-${e.id}`
43
+ }))
44
+ ] : [...n], [n, o])(), [$, x] = qe(
45
+ () => ({
46
+ val: 0,
47
+ pause: !p,
48
+ onChange: ({ value: e }) => {
49
+ c && a.current ? (u === "x" ? a.current.scrollLeft = Math.abs(e.val) : a.current.scrollTop = Math.abs(e.val), Q()) : h.current && (u === "x" ? h.current.style.transform = `translate3d(${e.val}px, 0px,0px)` : h.current.style.transform = `translate3d(0px,${e.val}px,0px)`);
50
+ }
51
+ }),
52
+ [c]
53
+ ), { emitEvent: Y, useListenToCustomEvent: J } = Ve(), { thumbsFragment: Me, handleScroll: we } = De({
54
+ withThumbs: !!le,
55
+ thumbsSlideAxis: he,
56
+ prepareThumbsData: xe,
57
+ items: n,
58
+ renderThumbFnProps: {
59
+ getIsActiveItem: ie,
60
+ getIsPrevItem: ue,
61
+ useListenToCustomEvent: J,
62
+ getIsNextItem: ce
63
+ }
64
+ }), { enterFullscreen: de, exitFullscreen: me, getIsFullscreen: ve } = Ye({
65
+ mainCarouselWrapperRef: a,
66
+ handleResize: () => K(),
67
+ onFullScreenChange: (e) => {
68
+ Y({
69
+ eventName: "onFullscreenChange",
70
+ isFullscreen: e
71
+ });
72
+ }
73
+ });
74
+ function Ce(e) {
75
+ return k === "fixed" && !c ? {
76
+ marginRight: `${e ? 0 : R}px`,
77
+ flex: `1 0 calc(100% / ${b} - ${R * (b - 1) / b}px)`
78
+ } : {
79
+ marginRight: `${e ? 0 : R}px`
80
+ };
81
+ }
82
+ function d() {
83
+ var r;
84
+ const e = (r = a.current) == null ? void 0 : r.querySelector(
85
+ ".use-spring-carousel-item"
86
+ );
87
+ if (!e)
88
+ throw Error("No carousel items available!");
89
+ return e.getBoundingClientRect()[u === "x" ? "width" : "height"] + R;
90
+ }
91
+ function P({
92
+ from: e,
93
+ to: r,
94
+ nextActiveItem: t,
95
+ immediate: i = !1,
96
+ slideMode: I
97
+ }) {
98
+ G.current = I, typeof t == "number" && (c || (g.current = t), Y({
99
+ eventName: "onSlideStartChange",
100
+ slideActionType: M.current,
101
+ slideMode: G.current,
102
+ nextItem: {
103
+ startReached: s.current,
104
+ endReached: l.current,
105
+ index: c ? -1 : g.current,
106
+ id: c ? "" : n[g.current].id
107
+ }
108
+ })), f.current = r, x.start({
109
+ immediate: i,
110
+ from: {
111
+ val: e
112
+ },
113
+ to: {
114
+ val: r
115
+ },
116
+ config: {
117
+ ...B.default,
118
+ velocity: $.val.velocity
119
+ },
120
+ onRest(D) {
121
+ !i && D.finished && Y({
122
+ eventName: "onSlideChange",
123
+ slideActionType: M.current,
124
+ slideMode: G.current,
125
+ currentItem: {
126
+ startReached: s.current,
127
+ endReached: l.current,
128
+ index: c ? -1 : g.current,
129
+ id: c ? "" : n[g.current].id
130
+ }
131
+ });
132
+ }
133
+ }), le && !i && we(g.current);
134
+ }
135
+ function m() {
136
+ var e;
137
+ return o ? d() * n.length : Math.round(
138
+ Number(
139
+ (e = h.current) == null ? void 0 : e[u === "x" ? "scrollWidth" : "scrollHeight"]
140
+ ) - h.current.getBoundingClientRect()[u === "x" ? "width" : "height"] - C * 2
141
+ );
142
+ }
143
+ function ke() {
144
+ const e = `calc(100% - ${C * 2}px)`;
145
+ return {
146
+ width: u === "x" ? e : "100%",
147
+ height: u === "y" ? e : "100%"
148
+ };
149
+ }
150
+ function te() {
151
+ var r;
152
+ const e = (r = h.current) == null ? void 0 : r.querySelector(
153
+ ".use-spring-carousel-item"
154
+ );
155
+ if (!e)
156
+ throw Error("No carousel items available!");
157
+ return e.getBoundingClientRect()[u === "x" ? "width" : "height"] + R;
158
+ }
159
+ function re(e) {
160
+ const r = u === "x" ? "left" : "top", t = h.current;
161
+ t && (o ? (t.style.top = "0px", t.style.left = "0px", t.style[r] = `-${e - C}px`, s.current = !1, l.current = !1) : (t.style.left = "0px", t.style.top = "0px"));
162
+ }
163
+ function K(e = !1) {
164
+ if (h.current && e && (h.current.style.transform = "translate3d(0px, 0px,0px)", h.current.style.left = "0", h.current.style.top = "0"), k === "fixed" && re(
165
+ Z === "center" ? te() * n.length - d() * Math.round((b - 1) / 2) : Z === "end" ? te() * n.length - d() * Math.round(b - 1) : te() * n.length
166
+ ), k === "fluid") {
167
+ if (l.current && m() !== Math.abs(f.current) && !o) {
168
+ const r = -m();
169
+ f.current = r, x.start({
170
+ immediate: !0,
171
+ val: f.current
172
+ });
173
+ return;
174
+ }
175
+ if (Math.abs(f.current) > 0 && m() !== Math.abs(f.current) && !o && !c && L.current === "backward") {
176
+ const r = S.current - m(), t = f.current + r;
177
+ return x.start({
178
+ immediate: !0,
179
+ val: t
180
+ }), () => {
181
+ f.current = t;
182
+ };
183
+ }
184
+ return;
185
+ }
186
+ if (!c && k === "fixed") {
187
+ const r = -(d() * g.current);
188
+ if (Math.abs(r) > m() && !o) {
189
+ const t = -m();
190
+ l.current = !0, f.current = t, x.start({
191
+ immediate: !0,
192
+ val: f.current
193
+ });
194
+ } else
195
+ f.current = r, x.start({
196
+ immediate: !0,
197
+ val: r
198
+ });
199
+ setTimeout(() => {
200
+ H.current = !1;
201
+ }, 0);
202
+ }
203
+ }
204
+ function w() {
205
+ return c && a.current ? a.current[u === "x" ? "scrollLeft" : "scrollTop"] : $.val.get();
206
+ }
207
+ function z(e, r) {
208
+ if (c && e === "next") {
209
+ const t = f.current + d();
210
+ return t > m() ? m() : t;
211
+ }
212
+ if (c && e === "prev") {
213
+ const t = f.current - d();
214
+ return t < 0 ? 0 : t;
215
+ }
216
+ return e === "next" ? typeof r == "number" ? -(r * d()) : f.current - d() : typeof r == "number" ? -(r * d()) : f.current + d();
217
+ }
218
+ function j({ type: e, index: r, immediate: t }) {
219
+ if (!p || W.current || s.current && !o)
220
+ return;
221
+ l.current && (L.current = "backward"), M.current = "prev", l.current = !1;
222
+ const i = typeof r == "number" ? r : g.current - 1;
223
+ if (c && Q(), !o) {
224
+ const I = c ? z("prev", r) - d() / 3 < 0 : z("prev", r) + d() / 3 > 0;
225
+ if (s.current)
226
+ return;
227
+ if (I) {
228
+ s.current = !0, l.current = !1, P({
229
+ slideMode: e,
230
+ from: w(),
231
+ to: 0,
232
+ nextActiveItem: 0,
233
+ immediate: t
234
+ });
235
+ return;
236
+ }
237
+ }
238
+ if (o && (s.current || i < 0)) {
239
+ s.current = !1, l.current = !0, P({
240
+ slideMode: e,
241
+ from: w() - d() * n.length,
242
+ to: -(d() * n.length) + d(),
243
+ nextActiveItem: n.length - 1,
244
+ immediate: t
245
+ });
246
+ return;
247
+ }
248
+ i === 0 && (s.current = !0), (i === n.length - 1 || i === -1) && (l.current = !0), P({
249
+ slideMode: e,
250
+ from: w(),
251
+ to: z("prev", r),
252
+ nextActiveItem: i,
253
+ immediate: t
254
+ });
255
+ }
256
+ function E({ type: e, index: r, immediate: t }) {
257
+ if (!p || W.current || l.current && !o)
258
+ return;
259
+ s.current && (L.current = "forward"), M.current = "next", s.current = !1;
260
+ const i = r || g.current + 1;
261
+ if (c && Q(), !o) {
262
+ const I = Math.abs(z("next", r)) > m() - d() / 3;
263
+ if (l.current)
264
+ return;
265
+ if (I) {
266
+ s.current = !1, l.current = !0, P({
267
+ slideMode: e,
268
+ from: w(),
269
+ to: c ? m() : -m(),
270
+ nextActiveItem: i,
271
+ immediate: t
272
+ });
273
+ return;
274
+ }
275
+ }
276
+ if (o && (l.current || i > n.length - 1)) {
277
+ l.current = !1, s.current = !0, P({
278
+ slideMode: e,
279
+ from: w() + d() * n.length,
280
+ to: 0,
281
+ nextActiveItem: 0,
282
+ immediate: t
283
+ });
284
+ return;
285
+ }
286
+ i === 0 && (s.current = !0), i === n.length - 1 && (l.current = !0), P({
287
+ slideMode: e,
288
+ from: w(),
289
+ to: z("next", r),
290
+ nextActiveItem: i,
291
+ immediate: t
292
+ });
293
+ }
294
+ function $e() {
295
+ U ? O.current = U : O.current = Math.floor(d() / 2 / 2);
296
+ }
297
+ function ge() {
298
+ !A.current && h.current && (S.current = m(), Ie.current = o, Te.current = k, be.current = c, ee.current = window.innerWidth, f.current = 0, ne({ id: 0, immediate: !0, shouldReset: !0 }), $e(), K());
299
+ }
300
+ const Fe = Xe(
301
+ (e) => {
302
+ const r = e.dragging, t = e.offset[u === "x" ? 0 : 1], i = e.movement[u === "x" ? 0 : 1], I = e.direction[u === "x" ? 0 : 1], D = i > O.current, q = i < -O.current, Ee = m();
303
+ if (r) {
304
+ if (I > 0 ? M.current = "prev" : M.current = "next", Y({
305
+ ...e,
306
+ eventName: "onDrag",
307
+ slideActionType: M.current
308
+ }), c) {
309
+ if (t > 0) {
310
+ x.start({
311
+ from: {
312
+ val: w()
313
+ },
314
+ to: {
315
+ val: 0
316
+ },
317
+ config: {
318
+ velocity: e.velocity,
319
+ friction: 50,
320
+ tension: 1e3
321
+ }
322
+ }), e.cancel();
323
+ return;
324
+ }
325
+ x.start({
326
+ from: {
327
+ val: w()
328
+ },
329
+ to: {
330
+ val: -t
331
+ },
332
+ config: {
333
+ velocity: e.velocity,
334
+ friction: 50,
335
+ tension: 1e3
336
+ }
337
+ });
338
+ return;
339
+ }
340
+ x.start({
341
+ val: t,
342
+ config: {
343
+ velocity: e.velocity,
344
+ friction: 50,
345
+ tension: 1e3
346
+ }
347
+ }), fe && q ? (E({ type: "drag" }), e.cancel()) : fe && D && (j({ type: "drag" }), e.cancel()), Ee - Math.abs(t) < -(d() * 2) && e.cancel();
348
+ return;
349
+ }
350
+ if (e.last && c && t > 0) {
351
+ x.start({
352
+ from: {
353
+ val: w()
354
+ },
355
+ to: {
356
+ val: 0
357
+ },
358
+ config: {
359
+ velocity: e.velocity,
360
+ friction: 50,
361
+ tension: 1e3
362
+ }
363
+ });
364
+ return;
365
+ }
366
+ e.last && !e.canceled && c && (M.current === "prev" && j({ type: "drag" }), M.current === "next" && E({ type: "drag" })), e.last && !e.canceled && !c && (q ? !o && l.current ? x.start({
367
+ val: -m(),
368
+ config: {
369
+ ...B.default,
370
+ velocity: e.velocity
371
+ }
372
+ }) : E({ type: "drag" }) : D ? !o && s.current ? x.start({
373
+ val: 0,
374
+ config: {
375
+ ...B.default,
376
+ velocity: e.velocity
377
+ }
378
+ }) : j({ type: "drag" }) : x.start({
379
+ val: f.current,
380
+ config: {
381
+ ...B.default,
382
+ velocity: e.velocity
383
+ }
384
+ })), e.last && e.canceled && x.start({
385
+ val: f.current,
386
+ config: {
387
+ ...B.default,
388
+ velocity: e.velocity
389
+ }
390
+ });
391
+ },
392
+ {
393
+ enabled: p && !ae && !c || !!c && !!pe,
394
+ axis: u,
395
+ from: () => c && a.current ? [
396
+ -a.current.scrollLeft,
397
+ -a.current.scrollTop
398
+ ] : u === "x" ? [$.val.get(), $.val.get()] : [$.val.get(), $.val.get()]
399
+ }
400
+ );
401
+ function Ne() {
402
+ return c ? u === "x" ? {
403
+ overflowX: "auto"
404
+ } : {
405
+ overflowY: "auto"
406
+ } : {};
407
+ }
408
+ function Q() {
409
+ a.current && (f.current = a.current[u === "x" ? "scrollLeft" : "scrollTop"], a.current[u === "x" ? "scrollLeft" : "scrollTop"] === 0 && (s.current = !0, l.current = !1), a.current[u === "x" ? "scrollLeft" : "scrollTop"] > 0 && a.current[u === "x" ? "scrollLeft" : "scrollTop"] < m() && (s.current = !1, l.current = !1), a.current[u === "x" ? "scrollLeft" : "scrollTop"] === m() && (s.current = !1, l.current = !0));
410
+ }
411
+ function Re() {
412
+ return c ? {
413
+ onWheel() {
414
+ $.val.stop(), Q();
415
+ }
416
+ } : {};
417
+ }
418
+ function V(e, r) {
419
+ let t = 0;
420
+ if (typeof e == "string" ? t = n.findIndex((i) => i.id === e) : t = e, t < 0 || t >= n.length) {
421
+ if (r)
422
+ throw new Error(r);
423
+ console.error(
424
+ `The item doesn't exist; check that the id provided - ${e} - is correct.`
425
+ ), t = -1;
426
+ }
427
+ return t;
428
+ }
429
+ function ne({
430
+ id: e,
431
+ immediate: r,
432
+ shouldReset: t,
433
+ type: i
434
+ }) {
435
+ if (!p || W.current)
436
+ return;
437
+ s.current = !1, l.current = !1;
438
+ const I = V(
439
+ e,
440
+ "The item you want to slide to doesn't exist; check the provided id."
441
+ );
442
+ if (I === g.current && !t)
443
+ return;
444
+ const D = V(n[g.current].id), q = V(n[I].id);
445
+ q > D ? E({
446
+ type: i || t ? "initial" : "click",
447
+ index: q,
448
+ immediate: r
449
+ }) : j({
450
+ type: i || t ? "initial" : "click",
451
+ index: q,
452
+ immediate: r
453
+ });
454
+ }
455
+ function ce(e) {
456
+ const r = V(e, "The item doesn't exist; check the provided id."), t = g.current;
457
+ return o && t === n.length - 1 ? r === 0 : r === t + 1;
458
+ }
459
+ function ue(e) {
460
+ const r = V(e, "The item doesn't exist; check the provided id."), t = g.current;
461
+ return o && t === 0 ? r === n.length - 1 : r === t - 1;
462
+ }
463
+ function ie(e) {
464
+ return V(
465
+ e,
466
+ "The item you want to check doesn't exist; check the provided id."
467
+ ) === g.current;
468
+ }
469
+ function We() {
470
+ return ae ? "unset" : u === "x" ? "pan-y" : "pan-x";
471
+ }
472
+ const y = c ? {
473
+ useListenToCustomEvent: J,
474
+ enterFullscreen: de,
475
+ exitFullscreen: me,
476
+ getIsFullscreen: ve,
477
+ slideToPrevItem: (e = !0) => {
478
+ j({
479
+ type: "click",
480
+ immediate: !e
481
+ });
482
+ },
483
+ slideToNextItem: (e = !0) => {
484
+ E({
485
+ type: "click",
486
+ immediate: !e
487
+ });
488
+ }
489
+ } : {
490
+ useListenToCustomEvent: J,
491
+ enterFullscreen: de,
492
+ exitFullscreen: me,
493
+ getIsFullscreen: ve,
494
+ slideToPrevItem: (e = !0) => {
495
+ j({
496
+ type: "click",
497
+ immediate: !e
498
+ });
499
+ },
500
+ slideToNextItem: (e = !0) => {
501
+ E({
502
+ type: "click",
503
+ immediate: !e
504
+ });
505
+ },
506
+ slideToItem: (e, r = !0) => {
507
+ ne({ id: e, immediate: !r });
508
+ },
509
+ getIsNextItem: ce,
510
+ getIsPrevItem: ue,
511
+ getIsActiveItem: ie
512
+ };
513
+ ze(() => {
514
+ h.current && p && (H.current = !0, ge());
515
+ }, [p]), N(() => {
516
+ g.current !== T && ne({
517
+ id: T,
518
+ immediate: !ye
519
+ });
520
+ }, [T]), N(() => {
521
+ if (p) {
522
+ if (T > n.length - 1)
523
+ throw new Error(
524
+ `initialActiveItem (${T}) is greater than the total quantity available items (${n.length}).`
525
+ );
526
+ b > n.length && console.warn(
527
+ `itemsPerSlide (${b}) is greater than the total quantity available items (${n.length}). Fallback to ${n.length})`
528
+ );
529
+ }
530
+ }, [T, n.length, b, p]), N(() => {
531
+ ee.current = window.innerWidth;
532
+ }, []), N(() => {
533
+ p && (H.current = !0, ge());
534
+ }, [Z, b, C, R, p, o]), N(() => {
535
+ if (!p)
536
+ return;
537
+ function e() {
538
+ document.hidden ? W.current = !0 : W.current = !1;
539
+ }
540
+ return document.addEventListener("visibilitychange", e), () => {
541
+ document.removeEventListener("visibilitychange", e);
542
+ };
543
+ }, [p]), N(() => {
544
+ if (a.current) {
545
+ let e;
546
+ const r = new Je(() => {
547
+ if (A.current) {
548
+ A.current = !1;
549
+ return;
550
+ }
551
+ if (!W.current && !H.current) {
552
+ ee.current = window.innerWidth;
553
+ const t = K();
554
+ window.clearTimeout(e), e = setTimeout(() => {
555
+ S.current = m(), typeof t == "function" && t();
556
+ }, 100);
557
+ }
558
+ });
559
+ return r.observe(a.current), () => {
560
+ r.disconnect();
561
+ };
562
+ }
563
+ }, [K, m]), N(() => {
564
+ _ && _({
565
+ slideToNextItem: y.slideToNextItem,
566
+ slideToPrevItem: y.slideToPrevItem,
567
+ slideToItem: y == null ? void 0 : y.slideToItem
568
+ });
569
+ }, [_, y.slideToItem, y.slideToNextItem, y.slideToPrevItem]);
570
+ const Pe = /* @__PURE__ */ F.jsx(oe.Provider, { value: y, children: Me }), je = /* @__PURE__ */ F.jsx(oe.Provider, { value: y, children: /* @__PURE__ */ F.jsx(
571
+ "div",
572
+ {
573
+ className: "use-spring-carousel-main-wrapper",
574
+ ref: a,
575
+ ...Re(),
576
+ style: {
577
+ display: "flex",
578
+ position: "relative",
579
+ width: "100%",
580
+ height: "100%",
581
+ ...Ne()
582
+ },
583
+ children: /* @__PURE__ */ F.jsxs(
584
+ "div",
585
+ {
586
+ className: "use-spring-carousel-track-wrapper",
587
+ ref: h,
588
+ ...Fe(),
589
+ style: {
590
+ position: "relative",
591
+ display: "flex",
592
+ flexDirection: u === "x" ? "row" : "column",
593
+ touchAction: We(),
594
+ ...ke()
595
+ },
596
+ children: [
597
+ (c || !o) && C ? /* @__PURE__ */ F.jsx(
598
+ "div",
599
+ {
600
+ style: {
601
+ flexShrink: 0,
602
+ width: C
603
+ }
604
+ }
605
+ ) : null,
606
+ X.map((e, r) => /* @__PURE__ */ F.jsx(
607
+ "div",
608
+ {
609
+ className: "use-spring-carousel-item",
610
+ "data-testid": "use-spring-carousel-item-wrapper",
611
+ style: {
612
+ display: "flex",
613
+ position: "relative",
614
+ flex: "1",
615
+ ...Ce(
616
+ r === X.findIndex(
617
+ (t) => t.id === X[X.length - 1].id
618
+ )
619
+ )
620
+ },
621
+ children: typeof e.renderItem == "function" ? e.renderItem({
622
+ getIsActiveItem: ie,
623
+ getIsNextItem: ce,
624
+ getIsPrevItem: ue,
625
+ useListenToCustomEvent: J
626
+ }) : e.renderItem
627
+ },
628
+ `${e.id}-${r}`
629
+ )),
630
+ (c || !o) && C ? /* @__PURE__ */ F.jsx(
631
+ "div",
632
+ {
633
+ style: {
634
+ flexShrink: 0,
635
+ width: C
636
+ }
637
+ }
638
+ ) : null
639
+ ]
640
+ }
641
+ )
642
+ }
643
+ ) });
644
+ return { ...y, carouselFragment: je, thumbsFragment: Pe };
645
+ }
646
+ const oe = Be(
647
+ void 0
648
+ );
649
+ function rt() {
650
+ const n = Oe(oe);
651
+ if (!n)
652
+ throw new Error("useSpringCarouselContext must be used within the carousel.");
653
+ return n;
654
+ }
655
+ export {
656
+ tt as useSpringCarousel,
657
+ rt as useSpringCarouselContext
658
+ };