react-spring-carousel 3.0.0-beta090.6 → 3.0.0-beta090.7

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.es2.js CHANGED
@@ -1,10 +1,10 @@
1
- import { u as Be, a as He, j as R } from "./useThumbsModule-4e4b7969.js";
2
- import { useSpring as ze, config as _, useIsomorphicLayoutEffect as Xe } from "@react-spring/web";
3
- import { useDrag as Ye } from "@use-gesture/react";
4
- import { useRef as m, useEffect as E, createContext as Je, useCallback as Y, useContext as Ke } from "react";
5
- import Qe from "resize-observer-polyfill";
1
+ import { u as He, a as ze, j as R } from "./useThumbsModule-4e4b7969.js";
2
+ import { useSpring as Xe, config as _, useIsomorphicLayoutEffect as Ye } from "@react-spring/web";
3
+ import { useDrag as Je } from "@use-gesture/react";
4
+ import { useRef as m, useEffect as E, createContext as Ke, useCallback as Y, useContext as Qe } from "react";
5
+ import Ue from "resize-observer-polyfill";
6
6
  import N from "screenfull";
7
- function Ue({
7
+ function Ze({
8
8
  mainCarouselWrapperRef: n,
9
9
  onFullScreenChange: v,
10
10
  handleResize: W
@@ -22,7 +22,7 @@ function Ue({
22
22
  function J(a) {
23
23
  O.current = a;
24
24
  }
25
- function y() {
25
+ function p() {
26
26
  return O.current;
27
27
  }
28
28
  function b(a) {
@@ -34,33 +34,34 @@ function Ue({
34
34
  return {
35
35
  enterFullscreen: b,
36
36
  exitFullscreen: u,
37
- getIsFullscreen: y
37
+ getIsFullscreen: p
38
38
  };
39
39
  }
40
- function tr({
40
+ function nr({
41
41
  items: n,
42
42
  init: v = !0,
43
43
  withThumbs: W,
44
44
  thumbsSlideAxis: O = "x",
45
45
  itemsPerSlide: J = 1,
46
- slideType: y = "fixed",
46
+ slideType: p = "fixed",
47
47
  gutter: b = 0,
48
48
  withLoop: u = !1,
49
49
  startEndGutter: a = 0,
50
50
  carouselSlideAxis: o = "x",
51
- disableGestures: me = !1,
51
+ disableGestures: ve = !1,
52
52
  draggingSlideTreshold: ne,
53
- slideWhenThresholdIsReached: ve = !1,
53
+ slideWhenThresholdIsReached: pe = !1,
54
54
  freeScroll: c,
55
55
  enableFreeScrollDrag: ce,
56
56
  initialStartingPosition: L,
57
- prepareThumbsData: be,
57
+ prepareThumbsData: Te,
58
58
  initialActiveItem: C = 0,
59
- animateWhenActiveItemChange: Te = !0,
59
+ animateWhenActiveItemChange: we = !0,
60
60
  getControllerRef: ue,
61
- slideGroupOfItems: j = !1
61
+ slideGroupOfItems: j = !1,
62
+ customSlideValue: oe
62
63
  }) {
63
- const w = J > n.length ? n.length : J, K = m(!1), G = m(ne ?? 0), k = m("initial"), oe = m("initial"), ie = m("initial"), p = m(C), d = m(C === 0), s = m(y === "fixed" && C === n.length - 1), f = m(null), x = m(null), se = m(0), le = m(0), g = m(0), we = m(u), Me = m(y), Ce = m(c), V = m(!1), A = Y(() => u ? [
64
+ const w = J > n.length ? n.length : J, K = m(!1), G = m(ne ?? 0), k = m("initial"), ie = m("initial"), se = m("initial"), x = m(C), d = m(C === 0), s = m(p === "fixed" && C === n.length - 1), f = m(null), I = m(null), le = m(0), fe = m(0), g = m(0), Me = m(u), Ce = m(p), ke = m(c), V = m(!1), A = Y(() => u ? [
64
65
  ...n.map((e) => ({
65
66
  ...e,
66
67
  id: `prev-repeated-item-${e.id}`
@@ -70,27 +71,27 @@ function tr({
70
71
  ...e,
71
72
  id: `next-repeated-item-${e.id}`
72
73
  }))
73
- ] : [...n], [n, u])(), [P, I] = ze(
74
+ ] : [...n], [n, u])(), [P, y] = Xe(
74
75
  () => ({
75
76
  val: 0,
76
77
  pause: !v,
77
78
  onChange: ({ value: e }) => {
78
- c && f.current ? (o === "x" ? f.current.scrollLeft = Math.abs(e.val) : f.current.scrollTop = Math.abs(e.val), te()) : x.current && (o === "x" ? x.current.style.transform = `translate3d(${e.val}px, 0px,0px)` : x.current.style.transform = `translate3d(0px,${e.val}px,0px)`);
79
+ c && f.current ? (o === "x" ? f.current.scrollLeft = Math.abs(e.val) : f.current.scrollTop = Math.abs(e.val), te()) : I.current && (o === "x" ? I.current.style.transform = `translate3d(${e.val}px, 0px,0px)` : I.current.style.transform = `translate3d(0px,${e.val}px,0px)`);
79
80
  }
80
81
  }),
81
82
  [c]
82
- ), { emitEvent: S, useListenToCustomEvent: ee } = Be(), { thumbsFragment: ke, handleScroll: Fe } = He({
83
+ ), { emitEvent: S, useListenToCustomEvent: ee } = He(), { thumbsFragment: Fe, handleScroll: $e } = ze({
83
84
  withThumbs: !!W,
84
85
  thumbsSlideAxis: O,
85
- prepareThumbsData: be,
86
+ prepareThumbsData: Te,
86
87
  items: n,
87
88
  renderThumbFnProps: {
88
- getIsActiveItem: ge,
89
- getIsPrevItem: de,
89
+ getIsActiveItem: he,
90
+ getIsPrevItem: ge,
90
91
  useListenToCustomEvent: ee,
91
- getIsNextItem: ae
92
+ getIsNextItem: de
92
93
  }
93
- }), { enterFullscreen: pe, exitFullscreen: xe, getIsFullscreen: Ie } = Ue({
94
+ }), { enterFullscreen: xe, exitFullscreen: Ie, getIsFullscreen: ye } = Ze({
94
95
  mainCarouselWrapperRef: f,
95
96
  handleResize: () => re(),
96
97
  onFullScreenChange: (e) => {
@@ -100,8 +101,8 @@ function tr({
100
101
  });
101
102
  }
102
103
  });
103
- function $e(e) {
104
- return y === "fixed" && !c ? {
104
+ function Ne(e) {
105
+ return p === "fixed" && !c ? {
105
106
  marginRight: `${e ? 0 : b}px`,
106
107
  flex: `1 0 calc(100% / ${w} - ${b * (w - 1) / w}px)`
107
108
  } : {
@@ -110,24 +111,26 @@ function tr({
110
111
  }
111
112
  const l = Y(() => {
112
113
  var r;
114
+ if (p === "fluid" && typeof oe == "number")
115
+ return oe;
113
116
  const e = j ? f.current : (r = f.current) == null ? void 0 : r.querySelector(".use-spring-carousel-item");
114
117
  if (!e)
115
118
  throw Error("No carousel items available!");
116
119
  let t = e.getBoundingClientRect()[o === "x" ? "width" : "height"];
117
120
  return j || (t += b), j && (t += b - a * 2), t;
118
- }, [o, b, j, a]);
121
+ }, [o, b, j, a, oe, p]);
119
122
  function D({ from: e, to: t, nextActiveItem: r, immediate: i = !1, slideMode: M }) {
120
- oe.current = M, typeof r == "number" && (c || (p.current = r), S({
123
+ ie.current = M, typeof r == "number" && (c || (x.current = r), S({
121
124
  eventName: "onSlideStartChange",
122
125
  slideActionType: k.current,
123
- slideMode: oe.current,
126
+ slideMode: ie.current,
124
127
  nextItem: {
125
128
  startReached: d.current,
126
129
  endReached: s.current,
127
- index: c ? -1 : p.current,
128
- id: c ? "" : n[p.current].id
130
+ index: c ? -1 : x.current,
131
+ id: c ? "" : n[x.current].id
129
132
  }
130
- })), g.current = t, I.start({
133
+ })), g.current = t, y.start({
131
134
  immediate: i,
132
135
  from: {
133
136
  val: e
@@ -143,26 +146,26 @@ function tr({
143
146
  !i && z.finished && S({
144
147
  eventName: "onSlideChange",
145
148
  slideActionType: k.current,
146
- slideMode: oe.current,
149
+ slideMode: ie.current,
147
150
  currentItem: {
148
151
  startReached: d.current,
149
152
  endReached: s.current,
150
- index: c ? -1 : p.current,
151
- id: c ? "" : n[p.current].id
153
+ index: c ? -1 : x.current,
154
+ id: c ? "" : n[x.current].id
152
155
  }
153
156
  });
154
157
  }
155
- }), W && !i && Fe(p.current);
158
+ }), W && !i && $e(x.current);
156
159
  }
157
160
  const h = Y(() => {
158
161
  var e;
159
- return x.current ? u ? l() * n.length : Math.round(
162
+ return I.current ? u ? l() * n.length : Math.round(
160
163
  Number(
161
- (e = x.current) == null ? void 0 : e[o === "x" ? "scrollWidth" : "scrollHeight"]
162
- ) - x.current.getBoundingClientRect()[o === "x" ? "width" : "height"] - a * 2
164
+ (e = I.current) == null ? void 0 : e[o === "x" ? "scrollWidth" : "scrollHeight"]
165
+ ) - I.current.getBoundingClientRect()[o === "x" ? "width" : "height"] - a * 2
163
166
  ) : 0;
164
167
  }, [o, l, n.length, a, u]);
165
- function Ne() {
168
+ function Ee() {
166
169
  const e = `calc(100% - ${a * 2}px)`;
167
170
  return {
168
171
  width: o === "x" ? e : "100%",
@@ -171,32 +174,32 @@ function tr({
171
174
  }
172
175
  const Q = Y(() => {
173
176
  var t;
174
- const e = (t = x.current) == null ? void 0 : t.querySelector(".use-spring-carousel-item");
177
+ const e = (t = I.current) == null ? void 0 : t.querySelector(".use-spring-carousel-item");
175
178
  if (!e)
176
179
  throw Error("No carousel items available!");
177
180
  return e.getBoundingClientRect()[o === "x" ? "width" : "height"] + b;
178
181
  }, [o, b]), U = Y(
179
182
  (e) => {
180
- const t = o === "x" ? "left" : "top", r = x.current;
183
+ const t = o === "x" ? "left" : "top", r = I.current;
181
184
  r && (u ? (r.style.top = "0px", r.style.left = "0px", r.style[t] = `-${e - a}px`, d.current = !1, s.current = !1) : (r.style.left = "0px", r.style.top = "0px"));
182
185
  },
183
186
  [o, a, u]
184
187
  ), re = Y(
185
188
  (e = !1) => {
186
- if (x.current && e && (x.current.style.transform = "translate3d(0px, 0px,0px)", x.current.style.left = "0", x.current.style.top = "0"), y === "fixed" && U(
189
+ if (I.current && e && (I.current.style.transform = "translate3d(0px, 0px,0px)", I.current.style.left = "0", I.current.style.top = "0"), p === "fixed" && U(
187
190
  L === "center" ? Q() * n.length - l() * Math.round((w - 1) / 2) : L === "end" ? Q() * n.length - l() * Math.round(w - 1) : Q() * n.length
188
- ), y === "fluid") {
191
+ ), p === "fluid") {
189
192
  if (U(Q() * n.length), s.current && h() !== Math.abs(g.current) && !u) {
190
193
  const t = -h();
191
- g.current = t, I.start({
194
+ g.current = t, y.start({
192
195
  immediate: !0,
193
196
  val: g.current
194
197
  });
195
198
  return;
196
199
  }
197
- if (Math.abs(g.current) > 0 && h() !== Math.abs(g.current) && !u && !c && ie.current === "backward") {
198
- const t = se.current - h(), r = g.current + t;
199
- return I.start({
200
+ if (Math.abs(g.current) > 0 && h() !== Math.abs(g.current) && !u && !c && se.current === "backward") {
201
+ const t = le.current - h(), r = g.current + t;
202
+ return y.start({
200
203
  immediate: !0,
201
204
  val: r
202
205
  }), () => {
@@ -206,16 +209,16 @@ function tr({
206
209
  console.log("here");
207
210
  return;
208
211
  }
209
- if (!c && y === "fixed") {
210
- const t = -(l() * p.current);
212
+ if (!c && p === "fixed") {
213
+ const t = -(l() * x.current);
211
214
  if (Math.abs(t) > h() && !u) {
212
215
  const r = -h();
213
- s.current = !0, g.current = r, I.start({
216
+ s.current = !0, g.current = r, y.start({
214
217
  immediate: !0,
215
218
  val: g.current
216
219
  });
217
220
  } else
218
- g.current = t, I.start({
221
+ g.current = t, y.start({
219
222
  immediate: !0,
220
223
  val: t
221
224
  });
@@ -233,8 +236,8 @@ function tr({
233
236
  n.length,
234
237
  w,
235
238
  U,
236
- I,
237
239
  y,
240
+ p,
238
241
  u
239
242
  ]
240
243
  );
@@ -255,8 +258,8 @@ function tr({
255
258
  function q({ type: e, index: t, immediate: r }) {
256
259
  if (!v || V.current || d.current && !u)
257
260
  return;
258
- s.current && (ie.current = "backward"), k.current = "prev", s.current = !1;
259
- const i = typeof t == "number" ? t : p.current - 1;
261
+ s.current && (se.current = "backward"), k.current = "prev", s.current = !1;
262
+ const i = typeof t == "number" ? t : x.current - 1;
260
263
  if (c && te(), !u) {
261
264
  const M = c ? Z("prev", t) - l() / 3 < 0 : Z("prev", t) + l() / 3 > 0;
262
265
  if (d.current)
@@ -293,8 +296,8 @@ function tr({
293
296
  function B({ type: e, index: t, immediate: r }) {
294
297
  if (!v || V.current || s.current && !u)
295
298
  return;
296
- d.current && (ie.current = "forward"), k.current = "next", d.current = !1;
297
- const i = t || p.current + 1;
299
+ d.current && (se.current = "forward"), k.current = "next", d.current = !1;
300
+ const i = t || x.current + 1;
298
301
  if (c && te(), !u) {
299
302
  const M = Math.abs(Z("next", t)) > h() - l() / 3;
300
303
  if (s.current)
@@ -328,15 +331,15 @@ function tr({
328
331
  immediate: r
329
332
  });
330
333
  }
331
- function Ee() {
334
+ function We() {
332
335
  ne ? G.current = ne : G.current = Math.floor(l() / 2 / 2);
333
336
  }
334
- function ye() {
335
- x.current && (se.current = h(), we.current = u, Me.current = y, Ce.current = c, le.current = window.innerWidth, g.current = 0, fe({ id: 0, immediate: !0, shouldReset: !0 }), Ee(), re());
337
+ function be() {
338
+ I.current && (le.current = h(), Me.current = u, Ce.current = p, ke.current = c, fe.current = window.innerWidth, g.current = 0, ae({ id: 0, immediate: !0, shouldReset: !0 }), We(), re());
336
339
  }
337
- const We = Ye(
340
+ const Pe = Je(
338
341
  (e) => {
339
- const t = e.dragging, r = e.offset[o === "x" ? 0 : 1], i = e.movement[o === "x" ? 0 : 1], M = e.direction[o === "x" ? 0 : 1], z = i > G.current, X = i < -G.current, qe = h(), $ = e.velocity;
342
+ const t = e.dragging, r = e.offset[o === "x" ? 0 : 1], i = e.movement[o === "x" ? 0 : 1], M = e.direction[o === "x" ? 0 : 1], z = i > G.current, X = i < -G.current, Be = h(), $ = e.velocity;
340
343
  if (t) {
341
344
  if (M > 0 ? k.current = "prev" : k.current = "next", S({
342
345
  ...e,
@@ -344,7 +347,7 @@ function tr({
344
347
  slideActionType: k.current
345
348
  }), c) {
346
349
  if (r > 0) {
347
- I.start({
350
+ y.start({
348
351
  from: {
349
352
  val: F()
350
353
  },
@@ -359,7 +362,7 @@ function tr({
359
362
  }), e.cancel();
360
363
  return;
361
364
  }
362
- I.start({
365
+ y.start({
363
366
  from: {
364
367
  val: F()
365
368
  },
@@ -374,18 +377,18 @@ function tr({
374
377
  });
375
378
  return;
376
379
  }
377
- I.start({
380
+ y.start({
378
381
  val: r,
379
382
  config: {
380
383
  velocity: $,
381
384
  friction: 50,
382
385
  tension: 1e3
383
386
  }
384
- }), ve && X ? (B({ type: "drag" }), e.cancel()) : ve && z && (q({ type: "drag" }), e.cancel()), qe - Math.abs(r) < -(l() * 2) && e.cancel();
387
+ }), pe && X ? (B({ type: "drag" }), e.cancel()) : pe && z && (q({ type: "drag" }), e.cancel()), Be - Math.abs(r) < -(l() * 2) && e.cancel();
385
388
  return;
386
389
  }
387
390
  if (e.last && c && r > 0) {
388
- I.start({
391
+ y.start({
389
392
  from: {
390
393
  val: F()
391
394
  },
@@ -400,25 +403,25 @@ function tr({
400
403
  });
401
404
  return;
402
405
  }
403
- e.last && !e.canceled && c && (k.current === "prev" && q({ type: "drag" }), k.current === "next" && B({ type: "drag" })), e.last && !e.canceled && !c && (X ? !u && s.current ? I.start({
406
+ e.last && !e.canceled && c && (k.current === "prev" && q({ type: "drag" }), k.current === "next" && B({ type: "drag" })), e.last && !e.canceled && !c && (X ? !u && s.current ? y.start({
404
407
  val: -h(),
405
408
  config: {
406
409
  ..._.default,
407
410
  velocity: $
408
411
  }
409
- }) : B({ type: "drag" }) : z ? !u && d.current ? I.start({
412
+ }) : B({ type: "drag" }) : z ? !u && d.current ? y.start({
410
413
  val: 0,
411
414
  config: {
412
415
  ..._.default,
413
416
  velocity: $
414
417
  }
415
- }) : q({ type: "drag" }) : I.start({
418
+ }) : q({ type: "drag" }) : y.start({
416
419
  val: g.current,
417
420
  config: {
418
421
  ..._.default,
419
422
  velocity: $
420
423
  }
421
- })), e.last && e.canceled && I.start({
424
+ })), e.last && e.canceled && y.start({
422
425
  val: g.current,
423
426
  config: {
424
427
  ..._.default,
@@ -427,7 +430,7 @@ function tr({
427
430
  });
428
431
  },
429
432
  {
430
- enabled: v && !me && !c || !!c && !!ce,
433
+ enabled: v && !ve && !c || !!c && !!ce,
431
434
  axis: o,
432
435
  from: () => c && f.current ? [
433
436
  -f.current.scrollLeft,
@@ -435,7 +438,7 @@ function tr({
435
438
  ] : o === "x" ? [P.val.get(), P.val.get()] : [P.val.get(), P.val.get()]
436
439
  }
437
440
  );
438
- function Pe() {
441
+ function Re() {
439
442
  return c ? o === "x" ? {
440
443
  overflowX: "auto"
441
444
  } : {
@@ -445,7 +448,7 @@ function tr({
445
448
  function te() {
446
449
  f.current && (g.current = f.current[o === "x" ? "scrollLeft" : "scrollTop"], f.current[o === "x" ? "scrollLeft" : "scrollTop"] === 0 && (d.current = !0, s.current = !1), f.current[o === "x" ? "scrollLeft" : "scrollTop"] > 0 && f.current[o === "x" ? "scrollLeft" : "scrollTop"] < h() && (d.current = !1, s.current = !1), f.current[o === "x" ? "scrollLeft" : "scrollTop"] === h() && (d.current = !1, s.current = !0));
447
450
  }
448
- function Re() {
451
+ function je() {
449
452
  return c ? {
450
453
  onWheel() {
451
454
  P.val.stop(), te();
@@ -461,7 +464,7 @@ function tr({
461
464
  }
462
465
  return r;
463
466
  }
464
- function fe({ id: e, immediate: t, shouldReset: r, type: i }) {
467
+ function ae({ id: e, immediate: t, shouldReset: r, type: i }) {
465
468
  if (!v || V.current)
466
469
  return;
467
470
  d.current = !1, s.current = !1;
@@ -469,9 +472,9 @@ function tr({
469
472
  e,
470
473
  "The item you want to slide to doesn't exist; check the provided id."
471
474
  );
472
- if (M === p.current && !r)
475
+ if (M === x.current && !r)
473
476
  return;
474
- const z = H(n[p.current].id), X = H(n[M].id);
477
+ const z = H(n[x.current].id), X = H(n[M].id);
475
478
  X > z ? B({
476
479
  type: i || r ? "initial" : "click",
477
480
  index: X,
@@ -482,25 +485,25 @@ function tr({
482
485
  immediate: t
483
486
  });
484
487
  }
485
- function ae(e) {
486
- const t = H(e, "The item doesn't exist; check the provided id."), r = p.current;
488
+ function de(e) {
489
+ const t = H(e, "The item doesn't exist; check the provided id."), r = x.current;
487
490
  return u && r === n.length - 1 ? t === 0 : t === r + 1;
488
491
  }
489
- function de(e) {
490
- const t = H(e, "The item doesn't exist; check the provided id."), r = p.current;
492
+ function ge(e) {
493
+ const t = H(e, "The item doesn't exist; check the provided id."), r = x.current;
491
494
  return u && r === 0 ? t === n.length - 1 : t === r - 1;
492
495
  }
493
- function ge(e) {
494
- return H(e, "The item you want to check doesn't exist; check the provided id.") === p.current;
496
+ function he(e) {
497
+ return H(e, "The item you want to check doesn't exist; check the provided id.") === x.current;
495
498
  }
496
- function je() {
497
- return me ? "unset" : o === "x" ? "pan-y" : "pan-x";
499
+ function Ve() {
500
+ return ve ? "unset" : o === "x" ? "pan-y" : "pan-x";
498
501
  }
499
502
  const T = c ? {
500
503
  useListenToCustomEvent: ee,
501
- enterFullscreen: pe,
502
- exitFullscreen: xe,
503
- getIsFullscreen: Ie,
504
+ enterFullscreen: xe,
505
+ exitFullscreen: Ie,
506
+ getIsFullscreen: ye,
504
507
  slideToPrevItem: (e = !0) => {
505
508
  q({
506
509
  type: "click",
@@ -515,9 +518,9 @@ function tr({
515
518
  }
516
519
  } : {
517
520
  useListenToCustomEvent: ee,
518
- enterFullscreen: pe,
519
- exitFullscreen: xe,
520
- getIsFullscreen: Ie,
521
+ enterFullscreen: xe,
522
+ exitFullscreen: Ie,
523
+ getIsFullscreen: ye,
521
524
  slideToPrevItem: (e = !0) => {
522
525
  q({
523
526
  type: "click",
@@ -531,18 +534,18 @@ function tr({
531
534
  });
532
535
  },
533
536
  slideToItem: (e, t = !0) => {
534
- fe({ id: e, immediate: !t });
537
+ ae({ id: e, immediate: !t });
535
538
  },
536
- getIsNextItem: ae,
537
- getIsPrevItem: de,
538
- getIsActiveItem: ge
539
+ getIsNextItem: de,
540
+ getIsPrevItem: ge,
541
+ getIsActiveItem: he
539
542
  };
540
- Xe(() => {
541
- x.current && v && (K.current = !0, ye());
543
+ Ye(() => {
544
+ I.current && v && (K.current = !0, be());
542
545
  }, [v]), E(() => {
543
- p.current !== C && (K.current = !0, fe({
546
+ x.current !== C && (K.current = !0, ae({
544
547
  id: C,
545
- immediate: !Te
548
+ immediate: !we
546
549
  }));
547
550
  }, [C]), E(() => {
548
551
  if (v) {
@@ -555,20 +558,20 @@ function tr({
555
558
  );
556
559
  }
557
560
  }, [C, n.length, w, v]), E(() => {
558
- le.current = window.innerWidth;
561
+ fe.current = window.innerWidth;
559
562
  }, []), E(() => {
560
563
  if (v) {
561
564
  if (u && c)
562
565
  throw new Error("`withLoop` and `freeScroll` can't be used together.");
563
- if (c && y === "fixed")
566
+ if (c && p === "fixed")
564
567
  throw new Error("`freeScroll` can't be used when `scrollType=fixed`.");
565
- if (ce && (y !== "fluid" || !c))
568
+ if (ce && (p !== "fluid" || !c))
566
569
  throw new Error(
567
570
  "`enableFreeScrollDrag` must be used with `slideType=fluid` and `freeScroll=true`"
568
571
  );
569
572
  if (j && c)
570
573
  throw new Error("`slideGroupOfItems` and `freeScroll` can't be used together.");
571
- K.current = !0, ye();
574
+ K.current = !0, be();
572
575
  }
573
576
  }, [
574
577
  L,
@@ -577,7 +580,7 @@ function tr({
577
580
  b,
578
581
  v,
579
582
  u,
580
- y,
583
+ p,
581
584
  c,
582
585
  ce,
583
586
  j
@@ -593,12 +596,12 @@ function tr({
593
596
  }, [v]), E(() => {
594
597
  if (f.current) {
595
598
  let e;
596
- const t = new Qe(() => {
599
+ const t = new Ue(() => {
597
600
  if (!V.current && !K.current) {
598
- le.current = window.innerWidth;
601
+ fe.current = window.innerWidth;
599
602
  const r = re();
600
603
  window.clearTimeout(e), e = setTimeout(() => {
601
- se.current = h(), typeof r == "function" && r();
604
+ le.current = h(), typeof r == "function" && r();
602
605
  }, 100);
603
606
  }
604
607
  });
@@ -613,31 +616,31 @@ function tr({
613
616
  slideToItem: T == null ? void 0 : T.slideToItem
614
617
  });
615
618
  }, [ue, T.slideToItem, T.slideToNextItem, T.slideToPrevItem]);
616
- const Ve = /* @__PURE__ */ R.jsx(he.Provider, { value: T, children: ke }), De = /* @__PURE__ */ R.jsx(he.Provider, { value: T, children: /* @__PURE__ */ R.jsx(
619
+ const De = /* @__PURE__ */ R.jsx(me.Provider, { value: T, children: Fe }), qe = /* @__PURE__ */ R.jsx(me.Provider, { value: T, children: /* @__PURE__ */ R.jsx(
617
620
  "div",
618
621
  {
619
622
  className: "use-spring-carousel-main-wrapper",
620
623
  ref: f,
621
- ...Re(),
624
+ ...je(),
622
625
  style: {
623
626
  display: "flex",
624
627
  position: "relative",
625
628
  width: "100%",
626
629
  height: "100%",
627
- ...Pe()
630
+ ...Re()
628
631
  },
629
632
  children: /* @__PURE__ */ R.jsxs(
630
633
  "div",
631
634
  {
632
635
  className: "use-spring-carousel-track-wrapper",
633
- ref: x,
634
- ...We(),
636
+ ref: I,
637
+ ...Pe(),
635
638
  style: {
636
639
  position: "relative",
637
640
  display: "flex",
638
641
  flexDirection: o === "x" ? "row" : "column",
639
- touchAction: je(),
640
- ...Ne()
642
+ touchAction: Ve(),
643
+ ...Ee()
641
644
  },
642
645
  children: [
643
646
  (c || !u) && a ? /* @__PURE__ */ R.jsx(
@@ -658,16 +661,16 @@ function tr({
658
661
  display: "flex",
659
662
  position: "relative",
660
663
  flex: "1",
661
- ...$e(
664
+ ...Ne(
662
665
  t === A.findIndex(
663
666
  (r) => r.id === A[A.length - 1].id
664
667
  )
665
668
  )
666
669
  },
667
670
  children: typeof e.renderItem == "function" ? e.renderItem({
668
- getIsActiveItem: ge,
669
- getIsNextItem: ae,
670
- getIsPrevItem: de,
671
+ getIsActiveItem: he,
672
+ getIsNextItem: de,
673
+ getIsPrevItem: ge,
671
674
  useListenToCustomEvent: ee
672
675
  }) : e.renderItem
673
676
  },
@@ -687,17 +690,17 @@ function tr({
687
690
  )
688
691
  }
689
692
  ) });
690
- return { ...T, carouselFragment: De, thumbsFragment: Ve };
693
+ return { ...T, carouselFragment: qe, thumbsFragment: De };
691
694
  }
692
- const he = Je(void 0);
693
- function nr() {
694
- const n = Ke(he);
695
+ const me = Ke(void 0);
696
+ function cr() {
697
+ const n = Qe(me);
695
698
  if (!n)
696
699
  throw new Error("useSpringCarouselContext must be used within the carousel.");
697
700
  return n;
698
701
  }
699
702
  export {
700
- tr as useSpringCarousel,
701
- nr as useSpringCarouselContext
703
+ nr as useSpringCarousel,
704
+ cr as useSpringCarouselContext
702
705
  };
703
706
  //# sourceMappingURL=index.es2.js.map