@plainsheet/react 0.4.9 → 0.4.10

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.
@@ -222,31 +222,31 @@ const _t = (t, e, n) => {
222
222
  function qt(t, e, n, o, r, i, a) {
223
223
  if (!o.isDragging || !A(o.startY))
224
224
  return;
225
- const c = e.getCoordinates(t).y, u = wt(o.startY, c), h = window.innerHeight, s = i.clientHeight, m = s - (o.containerStartTranslate.y + u);
226
- if (m >= h)
225
+ const l = e.getCoordinates(t).y, u = wt(o.startY, l), h = window.innerHeight, c = i.clientHeight, f = c - (o.containerStartTranslate.y + u);
226
+ if (f >= h)
227
227
  return;
228
- const C = Et(o.startY, c);
229
- if (C.isUp && !n.expandable && m >= s || n.preventClosing && m <= s)
228
+ const y = Et(o.startY, l);
229
+ if (y.isUp && !n.expandable && f >= c || n.preventClosing && f <= c)
230
230
  return;
231
231
  r.start(() => {
232
232
  et(i, {
233
233
  y: o.containerStartTranslate.y + u
234
234
  });
235
235
  }, 0);
236
- const l = h - a, E = s - o.containerStartTranslate.y;
237
- if (C.isUp) {
238
- const f = l - E, S = l - m, w = gt(
239
- 1 - tt(S / f, 2),
236
+ const s = h - a, C = c - o.containerStartTranslate.y;
237
+ if (y.isUp) {
238
+ const v = s - C, S = s - f, E = gt(
239
+ 1 - tt(S / v, 2),
240
240
  {
241
241
  min: 0,
242
242
  max: 1
243
243
  }
244
244
  );
245
- n.onDragMove(C, w);
246
- } else if (C.isDown) {
247
- const f = gt(
245
+ n.onDragMove(y, E);
246
+ } else if (y.isDown) {
247
+ const v = gt(
248
248
  tt(
249
- 1 - m / E,
249
+ 1 - f / C,
250
250
  2
251
251
  ),
252
252
  {
@@ -254,30 +254,30 @@ function qt(t, e, n, o, r, i, a) {
254
254
  max: 1
255
255
  }
256
256
  );
257
- n.onDragMove(C, f);
257
+ n.onDragMove(y, v);
258
258
  }
259
259
  }
260
- const Vt = (t, e, n, o, r, i, a) => (c) => {
260
+ const Vt = (t, e, n, o, r, i, a) => (l) => {
261
261
  if (!o.isDragging || (o.isDragging = !1, !A(o.startY)))
262
262
  return;
263
263
  n.onDragEnd();
264
- const u = o.startY, h = t.getCoordinates(c).y, s = D(e).y, m = Et(u, h), C = window.innerHeight, l = e.clientHeight;
265
- if (m.isUp) {
266
- const E = [...n.snapPoints].sort(
267
- (w, x) => w - x
268
- ), f = l + -s;
269
- if (!n.expandable && f >= l)
264
+ const u = o.startY, h = t.getCoordinates(l).y, c = D(e).y, f = Et(u, h), y = window.innerHeight, s = e.clientHeight;
265
+ if (f.isUp) {
266
+ const C = [...n.snapPoints].sort(
267
+ (E, x) => E - x
268
+ ), v = s + -c;
269
+ if (!n.expandable && v >= s)
270
270
  return;
271
- for (const w of E) {
272
- const x = w * window.innerHeight;
273
- if (f <= x) {
274
- const T = V(
275
- f,
271
+ for (const E of C) {
272
+ const x = E * window.innerHeight;
273
+ if (v <= x) {
274
+ const w = V(
275
+ v,
276
276
  x
277
277
  );
278
278
  a.translateContainer({
279
- startY: s,
280
- endY: s - T,
279
+ startY: c,
280
+ endY: c - w,
281
281
  animationFrame: r,
282
282
  bottomSheetContainer: e
283
283
  });
@@ -285,30 +285,30 @@ const Vt = (t, e, n, o, r, i, a) => (c) => {
285
285
  }
286
286
  }
287
287
  const S = kt(
288
- C,
289
- l,
288
+ y,
289
+ s,
290
290
  n.marginTop
291
291
  );
292
292
  a.translateContainer({
293
- startY: s,
293
+ startY: c,
294
294
  endY: S,
295
295
  animationFrame: r,
296
296
  bottomSheetContainer: e
297
297
  });
298
- } else if (m.isDown) {
299
- const E = [...n.snapPoints].sort(
300
- (f, S) => S - f
298
+ } else if (f.isDown) {
299
+ const C = [...n.snapPoints].sort(
300
+ (v, S) => S - v
301
301
  );
302
- for (const f of E) {
303
- const S = f * window.innerHeight, w = l + -s;
304
- if (w >= S) {
302
+ for (const v of C) {
303
+ const S = v * window.innerHeight, E = s + -c;
304
+ if (E >= S) {
305
305
  const x = V(
306
- w,
306
+ E,
307
307
  S
308
308
  );
309
309
  a.translateContainer({
310
- startY: s,
311
- endY: s + x,
310
+ startY: c,
311
+ endY: c + x,
312
312
  animationFrame: r,
313
313
  bottomSheetContainer: e
314
314
  });
@@ -316,12 +316,12 @@ const Vt = (t, e, n, o, r, i, a) => (c) => {
316
316
  }
317
317
  }
318
318
  if (n.preventClosing) {
319
- const f = l + -s;
320
- if (f >= l) {
321
- const S = V(f, l);
319
+ const v = s + -c;
320
+ if (v >= s) {
321
+ const S = V(v, s);
322
322
  a.translateContainer({
323
- startY: s,
324
- endY: s + S,
323
+ startY: c,
324
+ endY: c + S,
325
325
  animationFrame: r,
326
326
  bottomSheetContainer: e
327
327
  });
@@ -332,7 +332,7 @@ const Vt = (t, e, n, o, r, i, a) => (c) => {
332
332
  }
333
333
  };
334
334
  var j = /* @__PURE__ */ ((t) => (t[t.All = -1] = "All", t[t.None = 0] = "None", t[t.Capture = 1] = "Capture", t[t.Target = 2] = "Target", t[t.Bubble = 3] = "Bubble", t))(j || {});
335
- function St(t) {
335
+ function vt(t) {
336
336
  switch (t) {
337
337
  case 0:
338
338
  return 0;
@@ -374,7 +374,7 @@ class X {
374
374
  e(i);
375
375
  return;
376
376
  }
377
- St(i.eventPhase) === n.eventPhase && e(i);
377
+ vt(i.eventPhase) === n.eventPhase && e(i);
378
378
  },
379
379
  {
380
380
  passive: !0
@@ -394,7 +394,7 @@ class X {
394
394
  e(i);
395
395
  return;
396
396
  }
397
- St(i.eventPhase) === n.eventPhase && e(i);
397
+ vt(i.eventPhase) === n.eventPhase && e(i);
398
398
  },
399
399
  {
400
400
  passive: !0
@@ -515,7 +515,7 @@ function Qt(t) {
515
515
  t.contentWrapperClass
516
516
  ]),
517
517
  k.ContentWrapper
518
- ), c = M(
518
+ ), l = M(
519
519
  "div",
520
520
  R([
521
521
  k.Backdrop,
@@ -524,9 +524,9 @@ function Qt(t) {
524
524
  ]),
525
525
  k.Backdrop
526
526
  );
527
- return t.backdropColor && (c.style.backgroundColor = t.backdropColor), t.backDropTransition && (c.style.transition = t.backDropTransition), {
527
+ return t.backdropColor && (l.style.backgroundColor = t.backdropColor), t.backDropTransition && (l.style.transition = t.backDropTransition), {
528
528
  bottomSheetRoot: e,
529
- bottomSheetBackdrop: c,
529
+ bottomSheetBackdrop: l,
530
530
  bottomSheetContainer: n,
531
531
  bottomSheetHandle: r,
532
532
  bottomSheetHandleBar: i,
@@ -554,36 +554,29 @@ function te({
554
554
  bottomSheetContainer: r,
555
555
  bottomSheetHandle: i,
556
556
  bottomSheetContainerGapFiller: a,
557
- bottomSheetContentWrapper: c,
557
+ bottomSheetContentWrapper: l,
558
558
  bottomSheetBackdrop: u
559
- } = t, { animationFrame: h } = n, s = new X(i), m = new X(
560
- c
561
- ), C = new X(
559
+ } = t, { animationFrame: h } = n, c = new X(i), f = new X(
560
+ l
561
+ ), y = new X(
562
562
  a
563
- ), l = e.dragTriggers.reduce(
564
- (H, y) => {
565
- const v = o.querySelectorAll(y);
566
- if (!v.length)
567
- return H;
568
- const p = Array.from(v).map((d) => d instanceof HTMLElement ? new X(d) : null).filter((d) => !!d);
569
- return [...H, ...p];
570
- },
571
- []
572
- ), E = new X(
563
+ );
564
+ let s = [];
565
+ const C = new X(
573
566
  window
574
- ), f = Xt(
575
- E,
567
+ ), v = Xt(
568
+ C,
576
569
  r,
577
570
  e,
578
571
  n.draggingState
579
572
  ), S = zt(
580
- E,
573
+ C,
581
574
  r,
582
575
  e,
583
576
  n.draggingState,
584
577
  h
585
- ), w = Vt(
586
- E,
578
+ ), E = Vt(
579
+ C,
587
580
  r,
588
581
  e,
589
582
  n.draggingState,
@@ -591,91 +584,102 @@ function te({
591
584
  n.onClose,
592
585
  n.bottomSheetState
593
586
  );
594
- function x(H) {
595
- H.target instanceof Element && !o.contains(H.target) && n.onClose();
587
+ function x(T) {
588
+ T.target instanceof Element && !o.contains(T.target) && n.onClose();
596
589
  }
597
- function T(H) {
590
+ function w(T) {
598
591
  _t(
599
592
  n.draggingState,
600
- H.target,
593
+ T.target,
601
594
  t.bottomSheetContentWrapper
602
595
  );
603
596
  }
604
- function Y(H) {
605
- const y = H ?? e;
606
- y.draggable && (s.addEventListeners({
607
- onStart: T
608
- }), l.forEach((v) => {
609
- v.addEventListeners({
610
- onStart: T,
611
- onStartOptions: {
612
- eventPhase: j.Target
613
- }
614
- });
615
- })), y.draggable && y.backgroundDraggable && (m.addEventListeners({
616
- onStart: T,
597
+ function Y(T) {
598
+ const O = T ?? e;
599
+ O.draggable && O.backgroundDraggable && (f.addEventListeners({
600
+ onStart: w,
617
601
  onStartOptions: {
618
602
  eventPhase: j.Target
619
603
  }
620
- }), C.addEventListeners({
621
- onStart: T
622
- })), y.draggable && E.addEventListeners({
623
- onStart: f,
604
+ }), y.addEventListeners({
605
+ onStart: w
606
+ })), O.draggable && C.addEventListeners({
607
+ onStart: v,
624
608
  onMove: S,
625
- onEnd: w
626
- }), y.draggable && window.document.addEventListener("keyup", (v) => {
627
- v.key === "Escape" && n.onClose();
628
- }), i.addEventListener("keyup", (v) => {
629
- if (v.key === "ArrowUp") {
609
+ onEnd: E
610
+ }), O.draggable && window.document.addEventListener("keyup", (b) => {
611
+ b.key === "Escape" && n.onClose();
612
+ }), i.addEventListener("keyup", (b) => {
613
+ if (b.key === "ArrowUp") {
630
614
  n.moveUp();
631
615
  return;
632
616
  }
633
- if (v.key === "ArrowDown") {
617
+ if (b.key === "ArrowDown") {
634
618
  n.moveDown();
635
619
  return;
636
620
  }
637
- if (v.shiftKey && v.key === "Tab") {
638
- const p = P(
621
+ if (b.shiftKey && b.key === "Tab") {
622
+ const d = P(
639
623
  t.bottomSheetContentWrapper
640
624
  );
641
- jt(p);
625
+ jt(d);
642
626
  }
643
627
  });
644
628
  }
645
- function U() {
646
- e.shouldCloseOnOutsideClick ? u.addEventListener("click", x) : u.style.pointerEvents = "none";
629
+ function U(T) {
630
+ const O = T ?? e;
631
+ e.shouldCloseOnOutsideClick && !e.preventClosing ? u.addEventListener("click", x) : u.style.pointerEvents = "none", O.draggable && (c.addEventListeners({
632
+ onStart: w
633
+ }), s.forEach((b) => {
634
+ b.removeEventListeners({
635
+ onStart: w
636
+ });
637
+ }), s = e.dragTriggers.reduce((b, d) => {
638
+ const p = o.querySelectorAll(d);
639
+ if (!p.length)
640
+ return b;
641
+ const g = Array.from(p).map((m) => m instanceof HTMLElement ? new X(m) : null).filter((m) => !!m);
642
+ return [...b, ...g];
643
+ }, []), s.forEach((b) => {
644
+ b.addEventListeners({
645
+ onStart: w,
646
+ onStartOptions: {
647
+ eventPhase: j.Target
648
+ }
649
+ });
650
+ }));
647
651
  }
648
652
  function $() {
649
653
  u.removeEventListener("click", x);
650
654
  }
651
- function P(H) {
652
- let y = [...Array.from(H.childNodes).reverse()];
653
- for (; y.length; ) {
654
- const v = y.shift();
655
- if (Gt(v))
656
- return v;
657
- v && (y = [
658
- ...y,
659
- ...Array.from(v.childNodes).reverse()
655
+ function P(T) {
656
+ let O = [...Array.from(T.childNodes).reverse()];
657
+ for (; O.length; ) {
658
+ const b = O.shift();
659
+ if (Gt(b))
660
+ return b;
661
+ b && (O = [
662
+ ...O,
663
+ ...Array.from(b.childNodes).reverse()
660
664
  ]);
661
665
  }
662
666
  return null;
663
667
  }
664
668
  function F() {
665
- s.removeEventListeners({
666
- onStart: T
667
- }), m.removeEventListeners({
668
- onStart: T
669
- }), C.removeEventListeners({
670
- onStart: T
671
- }), l.forEach((H) => {
672
- H.removeEventListeners({
673
- onStart: T
669
+ c.removeEventListeners({
670
+ onStart: w
671
+ }), f.removeEventListeners({
672
+ onStart: w
673
+ }), y.removeEventListeners({
674
+ onStart: w
675
+ }), s.forEach((T) => {
676
+ T.removeEventListeners({
677
+ onStart: w
674
678
  });
675
- }), E.removeEventListeners({
676
- onStart: f,
679
+ }), C.removeEventListeners({
680
+ onStart: v,
677
681
  onMove: S,
678
- onEnd: w
682
+ onEnd: E
679
683
  });
680
684
  }
681
685
  return {
@@ -698,8 +702,8 @@ class ee {
698
702
  this.isInProgress = !0;
699
703
  const r = (i) => {
700
704
  this.startedAt || (this.startedAt = i);
701
- const a = i - this.startedAt, c = n === 0 ? 1 : tt(a / n, 2), u = c >= 1 && !o;
702
- e(c), u ? this.stop() : this.animationId = requestAnimationFrame(r);
705
+ const a = i - this.startedAt, l = n === 0 ? 1 : tt(a / n, 2), u = l >= 1 && !o;
706
+ e(l), u ? this.stop() : this.animationId = requestAnimationFrame(r);
703
707
  };
704
708
  this.animationId = requestAnimationFrame(r);
705
709
  }
@@ -715,15 +719,15 @@ function ne(t) {
715
719
  animationFrame: r,
716
720
  onEnd: i,
717
721
  animationTimingFunction: a,
718
- animationDuration: c
722
+ animationDuration: l
719
723
  } = t, u = wt(e, n);
720
724
  r.stop();
721
725
  let h = !1;
722
- r.start((s) => {
726
+ r.start((c) => {
723
727
  et(o, {
724
- y: e + u * a(s)
725
- }), !h && s >= 1 && (i == null || i(), h = !0);
726
- }, c);
728
+ y: e + u * a(c)
729
+ }), !h && c >= 1 && (i == null || i(), h = !0);
730
+ }, l);
727
731
  }
728
732
  const ut = (t, e) => (n) => {
729
733
  ne({
@@ -768,32 +772,32 @@ function xt(t) {
768
772
  return !!(t instanceof Object && "p1x" in t && "p1y" in t && "p2x" in t && "p2y" in t && A(t.p1x) && A(t.p1y) && A(t.p2x) && A(t.p2y));
769
773
  }
770
774
  function G(t, e, n, o) {
771
- return function(c) {
772
- return a(r(c));
775
+ return function(l) {
776
+ return a(r(l));
773
777
  };
774
- function r(c) {
775
- let u = 0, h = 1, s = c, m;
776
- if (c === 0 || c === 1)
777
- return c;
778
+ function r(l) {
779
+ let u = 0, h = 1, c = l, f;
780
+ if (l === 0 || l === 1)
781
+ return l;
778
782
  for (; u < h; ) {
779
- if (m = i(s), Math.abs(m - c) < 1e-3)
780
- return s;
781
- c > m ? u = s : h = s, s = (h + u) / 2;
783
+ if (f = i(c), Math.abs(f - l) < 1e-3)
784
+ return c;
785
+ l > f ? u = c : h = c, c = (h + u) / 2;
782
786
  }
783
- return s;
787
+ return c;
784
788
  }
785
- function i(c) {
786
- return 3 * t * c * Math.pow(1 - c, 2) + 3 * n * Math.pow(c, 2) * (1 - c) + Math.pow(c, 3);
789
+ function i(l) {
790
+ return 3 * t * l * Math.pow(1 - l, 2) + 3 * n * Math.pow(l, 2) * (1 - l) + Math.pow(l, 3);
787
791
  }
788
- function a(c) {
789
- return 3 * e * c * Math.pow(1 - c, 2) + 3 * o * Math.pow(c, 2) * (1 - c) + Math.pow(c, 3);
792
+ function a(l) {
793
+ return 3 * e * l * Math.pow(1 - l, 2) + 3 * o * Math.pow(l, 2) * (1 - l) + Math.pow(l, 3);
790
794
  }
791
795
  }
792
- const vt = G(0.25, 0.1, 0.25, 1), se = G(0.42, 0, 1, 1), At = G(0.42, 0, 0.58, 1), ce = G(0.4, 0.1, 0.6, 1), le = G(0.45, 1.5, 0.55, 1);
796
+ const St = G(0.25, 0.1, 0.25, 1), se = G(0.42, 0, 1, 1), At = G(0.42, 0, 0.58, 1), ce = G(0.4, 0.1, 0.6, 1), le = G(0.45, 1.5, 0.55, 1);
793
797
  function ue(t) {
794
798
  switch (t) {
795
799
  case W.EASE:
796
- return vt;
800
+ return St;
797
801
  case W.EASE_IN:
798
802
  return se;
799
803
  case W.EASE_OUT:
@@ -803,7 +807,7 @@ function ue(t) {
803
807
  case W.SPRING:
804
808
  return le;
805
809
  default:
806
- return vt;
810
+ return St;
807
811
  }
808
812
  }
809
813
  function yt(t) {
@@ -959,10 +963,13 @@ function he(t, e, n, o) {
959
963
  case "draggable":
960
964
  o.clearEventListeners(), o.attachEventListeners(n);
961
965
  break;
966
+ case "dragTriggers":
967
+ o.clearEventListeners(), o.attachEventListeners(n);
968
+ break;
962
969
  case "draggingAnimationTimings":
963
970
  if (xt(a)) {
964
- const c = dt(a), u = ut(
965
- c,
971
+ const l = dt(a), u = ut(
972
+ l,
966
973
  n.draggingAnimationDuration
967
974
  );
968
975
  e.translateContainer = u;
@@ -970,10 +977,10 @@ function he(t, e, n, o) {
970
977
  break;
971
978
  case "draggingAnimationDuration":
972
979
  if (A(a)) {
973
- const c = dt(
980
+ const l = dt(
974
981
  n.draggingAnimationTimings
975
982
  ), u = ut(
976
- c,
983
+ l,
977
984
  a
978
985
  );
979
986
  e.translateContainer = u;
@@ -1041,18 +1048,18 @@ function me(t) {
1041
1048
  function i() {
1042
1049
  r.originalDocumentOverflowY && r.originalDocumentOverflowY !== "hidden" && (document.body.style.overflowY = r.originalDocumentOverflowY), r.originalDocumentOverscrollBehavior && (document.body.style.position = r.originalDocumentOverscrollBehavior);
1043
1050
  }
1044
- const a = new ee(), c = {
1051
+ const a = new ee(), l = {
1045
1052
  animationFrame: a,
1046
- onClose: w,
1053
+ onClose: E,
1047
1054
  bottomSheetState: o,
1048
1055
  draggingState: r,
1049
- snapTo: v,
1050
- moveUp: H,
1051
- moveDown: y
1056
+ snapTo: b,
1057
+ moveUp: T,
1058
+ moveDown: O
1052
1059
  }, { elements: u, eventHandlers: h } = Jt(
1053
1060
  e,
1054
- c
1055
- ), s = re(
1061
+ l
1062
+ ), c = re(
1056
1063
  e,
1057
1064
  he(
1058
1065
  u,
@@ -1060,184 +1067,184 @@ function me(t) {
1060
1067
  e,
1061
1068
  h
1062
1069
  )
1063
- ), { bottomSheetBackdrop: m, bottomSheetRoot: C, bottomSheetContainer: l } = u, E = (p) => {
1064
- const d = p ?? window.document.body;
1065
- d.appendChild(C), d.appendChild(m);
1066
- const b = window.innerHeight;
1067
- et(l, {
1068
- y: b
1070
+ ), { bottomSheetBackdrop: f, bottomSheetRoot: y, bottomSheetContainer: s } = u, C = (d) => {
1071
+ const p = d ?? window.document.body;
1072
+ p.appendChild(y), p.appendChild(f);
1073
+ const g = window.innerHeight;
1074
+ et(s, {
1075
+ y: g
1069
1076
  }), h.attachEventListeners(), o.isMounted = !0;
1070
- }, f = () => {
1071
- h.clearEventListeners(), Object.values(u).forEach((p) => {
1072
- p.remove();
1077
+ }, v = () => {
1078
+ h.clearEventListeners(), Object.values(u).forEach((d) => {
1079
+ d.remove();
1073
1080
  }), i(), o.isMounted = !1;
1074
1081
  }, S = () => {
1075
- var p;
1082
+ var d;
1076
1083
  if (x() || ae(
1077
1084
  'Bottom Sheet is not mounted yet. call the "mount" method first.'
1078
- ), (p = t.beforeOpen) == null || p.call(t), T())
1085
+ ), (d = t.beforeOpen) == null || d.call(t), w())
1079
1086
  return;
1080
- ot(m, !0), s.shouldShowBackdrop || K(m, "transparent"), ot([l], !0), et(l, {
1081
- y: l.clientHeight
1087
+ ot(f, !0), c.shouldShowBackdrop || K(f, "transparent"), ot([s], !0), et(s, {
1088
+ y: s.clientHeight
1082
1089
  });
1083
- const d = window.innerHeight, b = mt(
1084
- d,
1085
- l.clientHeight,
1086
- s.marginTop,
1087
- s.defaultPosition
1088
- ), g = D(l).y;
1090
+ const p = window.innerHeight, g = mt(
1091
+ p,
1092
+ s.clientHeight,
1093
+ c.marginTop,
1094
+ c.defaultPosition
1095
+ ), m = D(s).y;
1089
1096
  o.translateContainer({
1090
- startY: g,
1091
- endY: b,
1097
+ startY: m,
1098
+ endY: g,
1092
1099
  animationFrame: a,
1093
- bottomSheetContainer: l,
1100
+ bottomSheetContainer: s,
1094
1101
  onEnd: t.afterOpen
1095
1102
  });
1096
- const O = document.body.style.overflowY;
1097
- r.originalDocumentOverflowY = O || "initial";
1103
+ const H = document.body.style.overflowY;
1104
+ r.originalDocumentOverflowY = H || "initial";
1098
1105
  const B = document.body.style.overscrollBehavior;
1099
1106
  r.originalDocumentOverscrollBehavior = B || "initial", document.body.style.overflow = "hidden", document.body.style.overscrollBehavior = "contain", u.bottomSheetHandle.focus(), h.attacheOnOpenEventListeners();
1100
1107
  };
1101
- function w() {
1102
- var p;
1108
+ function E() {
1109
+ var d;
1103
1110
  if (Y())
1104
1111
  return;
1105
- (p = t.beforeClose) == null || p.call(t);
1106
- const d = D(l).y, b = l.clientHeight;
1112
+ (d = t.beforeClose) == null || d.call(t);
1113
+ const p = D(s).y, g = s.clientHeight;
1107
1114
  o.translateContainer({
1108
- startY: d,
1109
- endY: b,
1115
+ startY: p,
1116
+ endY: g,
1110
1117
  animationFrame: a,
1111
- bottomSheetContainer: l,
1118
+ bottomSheetContainer: s,
1112
1119
  onEnd: () => {
1113
- var g;
1114
- (g = t.afterClose) == null || g.call(t), ot([m, l], !1), h.clearOnOpenEventListeners();
1120
+ var m;
1121
+ (m = t.afterClose) == null || m.call(t), ot([f, s], !1), h.clearOnOpenEventListeners();
1115
1122
  }
1116
1123
  }), i();
1117
1124
  }
1118
1125
  function x() {
1119
1126
  return o.isMounted;
1120
1127
  }
1121
- function T() {
1122
- const p = D(l).y, d = window.innerHeight, b = l.clientHeight >= d ? d : l.clientHeight;
1123
- return p <= b;
1128
+ function w() {
1129
+ const d = D(s).y, p = window.innerHeight, g = s.clientHeight >= p ? p : s.clientHeight;
1130
+ return d <= g;
1124
1131
  }
1125
1132
  function Y() {
1126
- return !T();
1133
+ return !w();
1127
1134
  }
1128
1135
  function U() {
1129
- const p = D(l).y, d = l.clientHeight, b = window.innerHeight;
1130
- if (p <= 5 && p >= -5)
1136
+ const d = D(s).y, p = s.clientHeight, g = window.innerHeight;
1137
+ if (d <= 5 && d >= -5)
1131
1138
  return N.CONTENT_HEIGHT;
1132
- const g = d - p;
1133
- if (g === b / 2)
1139
+ const m = p - d;
1140
+ if (m === g / 2)
1134
1141
  return N.MIDDLE;
1135
- const O = b - s.marginTop, B = 10;
1136
- return g <= O + B && g >= O - B ? N.TOP : N.CLOSED;
1142
+ const H = g - c.marginTop, B = 10;
1143
+ return m <= H + B && m >= H - B ? N.TOP : N.CLOSED;
1137
1144
  }
1138
1145
  function $() {
1139
- return l.clientHeight;
1146
+ return s.clientHeight;
1140
1147
  }
1141
- function P(p) {
1142
- if (!T())
1148
+ function P(d) {
1149
+ if (!w())
1143
1150
  return;
1144
- const d = D(l).y, b = l.clientHeight - d, g = window.innerHeight - p, O = Ut(b, g), B = V(b, g);
1151
+ const p = D(s).y, g = s.clientHeight - p, m = window.innerHeight - d, H = Ut(g, m), B = V(g, m);
1145
1152
  o.translateContainer({
1146
- startY: d,
1147
- endY: d + (O.isUp ? -B : B),
1153
+ startY: p,
1154
+ endY: p + (H.isUp ? -B : B),
1148
1155
  animationFrame: a,
1149
- bottomSheetContainer: l
1156
+ bottomSheetContainer: s
1150
1157
  });
1151
1158
  }
1152
- function F(p, {
1153
- viewportHeight: d,
1154
- visibleHeight: b
1159
+ function F(d, {
1160
+ viewportHeight: p,
1161
+ visibleHeight: g
1155
1162
  }) {
1156
- let g = null;
1157
- for (const O of p) {
1158
- const B = O * d, I = V(
1159
- b,
1163
+ let m = null;
1164
+ for (const H of d) {
1165
+ const B = H * p, I = V(
1166
+ g,
1160
1167
  B
1161
1168
  );
1162
- (g === null || I < g) && (g = I);
1169
+ (m === null || I < m) && (m = I);
1163
1170
  }
1164
1171
  return {
1165
- minOffset: g
1172
+ minOffset: m
1166
1173
  };
1167
1174
  }
1168
- function H() {
1169
- const p = [...s.snapPoints].reverse(), d = D(l).y, b = l.clientHeight, g = b - d;
1170
- if (!s.expandable && g >= b)
1175
+ function T() {
1176
+ const d = [...c.snapPoints].reverse(), p = D(s).y, g = s.clientHeight, m = g - p;
1177
+ if (!c.expandable && m >= g)
1171
1178
  return;
1172
- const O = window.innerHeight, B = ft(
1179
+ const H = window.innerHeight, B = ft(
1173
1180
  "above",
1174
- { visibleHeight: g, viewportHeight: O },
1175
- p
1181
+ { visibleHeight: m, viewportHeight: H },
1182
+ d
1176
1183
  ), { minOffset: I } = F(B, {
1177
- visibleHeight: g,
1178
- viewportHeight: O
1184
+ visibleHeight: m,
1185
+ viewportHeight: H
1179
1186
  });
1180
- if (I === null && g < O - s.marginTop) {
1187
+ if (I === null && m < H - c.marginTop) {
1181
1188
  o.translateContainer({
1182
- startY: d,
1189
+ startY: p,
1183
1190
  endY: mt(
1184
- O,
1185
- b,
1186
- s.marginTop,
1191
+ H,
1192
+ g,
1193
+ c.marginTop,
1187
1194
  "top"
1188
1195
  ),
1189
1196
  animationFrame: a,
1190
- bottomSheetContainer: l
1197
+ bottomSheetContainer: s
1191
1198
  });
1192
1199
  return;
1193
1200
  }
1194
1201
  A(I) && o.translateContainer({
1195
- startY: d,
1196
- endY: d - I,
1202
+ startY: p,
1203
+ endY: p - I,
1197
1204
  animationFrame: a,
1198
- bottomSheetContainer: l
1205
+ bottomSheetContainer: s
1199
1206
  });
1200
1207
  }
1201
- function y() {
1202
- const p = D(l).y, d = l.clientHeight - p;
1203
- if (d < 1)
1208
+ function O() {
1209
+ const d = D(s).y, p = s.clientHeight - d;
1210
+ if (p < 1)
1204
1211
  return;
1205
- const b = window.innerHeight, g = ft(
1212
+ const g = window.innerHeight, m = ft(
1206
1213
  "below",
1207
- { visibleHeight: d, viewportHeight: b },
1208
- s.snapPoints
1209
- ), { minOffset: O } = F(g, {
1210
- visibleHeight: d,
1211
- viewportHeight: b
1214
+ { visibleHeight: p, viewportHeight: g },
1215
+ c.snapPoints
1216
+ ), { minOffset: H } = F(m, {
1217
+ visibleHeight: p,
1218
+ viewportHeight: g
1212
1219
  });
1213
- A(O) && o.translateContainer({
1214
- startY: p,
1215
- endY: p + O,
1220
+ A(H) && o.translateContainer({
1221
+ startY: d,
1222
+ endY: d + H,
1216
1223
  animationFrame: a,
1217
- bottomSheetContainer: l
1224
+ bottomSheetContainer: s
1218
1225
  });
1219
1226
  }
1220
- function v(p) {
1221
- const d = window.innerHeight;
1222
- if (!oe(p))
1227
+ function b(d) {
1228
+ const p = window.innerHeight;
1229
+ if (!oe(d))
1223
1230
  return;
1224
- const b = tt(d * p, 2);
1225
- P(b);
1231
+ const g = tt(p * d, 2);
1232
+ P(g);
1226
1233
  }
1227
1234
  return {
1228
- props: s,
1235
+ props: c,
1229
1236
  elements: u,
1230
- mount: E,
1231
- unmount: f,
1237
+ mount: C,
1238
+ unmount: v,
1232
1239
  open: S,
1233
- close: w,
1240
+ close: E,
1234
1241
  getIsMounted: x,
1235
- getIsOpen: T,
1242
+ getIsOpen: w,
1236
1243
  getIsClosed: Y,
1237
1244
  getPosition: U,
1238
1245
  getHeight: $,
1239
1246
  moveTo: P,
1240
- snapTo: v
1247
+ snapTo: b
1241
1248
  };
1242
1249
  }
1243
1250
  function Bt() {
@@ -1273,133 +1280,134 @@ function Bt() {
1273
1280
  }
1274
1281
  };
1275
1282
  }
1276
- const fe = Bt(), ve = Dt(
1283
+ const fe = Bt(), Se = Dt(
1277
1284
  function(e, n) {
1278
1285
  const {
1279
1286
  children: o,
1280
1287
  isOpen: r,
1281
1288
  setIsOpen: i,
1282
1289
  afterClose: a,
1283
- mountingPointRef: c,
1290
+ mountingPointRef: l,
1284
1291
  ...u
1285
- } = e, h = rt(fe), [s, m] = at(
1292
+ } = e, h = rt(fe), [c, f] = at(
1286
1293
  h.current
1287
1294
  );
1288
1295
  Mt(
1289
1296
  n,
1290
- () => s,
1291
- [s]
1297
+ () => c,
1298
+ [c]
1292
1299
  );
1293
- const C = z(() => {
1300
+ const y = z(() => {
1294
1301
  i(!1), a == null || a();
1295
1302
  }, [a]);
1296
1303
  q(() => {
1297
- r ? s.open() : s.close();
1304
+ r ? c.open() : c.close();
1298
1305
  }, [r]);
1299
- const l = rt(null);
1306
+ const s = rt(null);
1300
1307
  return q(
1301
1308
  function() {
1302
- var w;
1303
- if (c && !c.current)
1309
+ var E;
1310
+ if (l && !l.current)
1304
1311
  return;
1305
- const f = Ft((w = e.mountingPointRef) == null ? void 0 : w.current) ? e.mountingPointRef.current : window.document.body;
1306
- if (!f || s.getIsMounted())
1312
+ const v = Ft((E = e.mountingPointRef) == null ? void 0 : E.current) ? e.mountingPointRef.current : window.document.body;
1313
+ if (!v || c.getIsMounted())
1307
1314
  return;
1308
1315
  const S = me({
1309
1316
  content: "",
1310
1317
  ...u,
1311
- afterClose: C
1318
+ afterClose: y
1312
1319
  });
1313
- return S.mount(f), l.current = S.elements.bottomSheetContentWrapper ?? null, h.current = S, m(S), () => {
1314
- s.unmount();
1320
+ return S.mount(v), s.current = S.elements.bottomSheetContentWrapper ?? null, h.current = S, f(S), () => {
1321
+ c.unmount();
1315
1322
  };
1316
1323
  },
1317
- [e.mountingPointRef, u, C]
1324
+ [e.mountingPointRef, u, y]
1318
1325
  ), q(
1319
1326
  function() {
1320
1327
  Object.assign(h.current.props, {
1321
1328
  ...u
1322
- }), m(h.current);
1329
+ }), f(h.current);
1323
1330
  },
1324
1331
  [u]
1325
1332
  ), q(function() {
1326
1333
  return () => {
1327
1334
  h.current.unmount();
1328
1335
  };
1329
- }, []), l.current ? Pt(
1336
+ }, []), s.current ? Pt(
1330
1337
  e.children,
1331
- l.current
1338
+ s.current
1332
1339
  ) : null;
1333
1340
  }
1334
1341
  ), be = Bt();
1335
1342
  function ye(t = {}) {
1336
- const e = rt(be), [n, o] = at(!1), [r, i] = at(e.current);
1343
+ const e = rt(be), [n, o] = at(!1), r = !n, [i, a] = at(e.current);
1337
1344
  q(() => {
1338
- i(e.current);
1345
+ a(e.current);
1339
1346
  }, [e.current]);
1340
1347
  const {
1341
- beforeOpen: a,
1342
- afterOpen: c,
1343
- beforeClose: u,
1344
- afterClose: h,
1345
- onDragStart: s,
1346
- onDragMove: m,
1347
- onDragEnd: C,
1348
- ...l
1349
- } = t, E = () => {
1350
- a == null || a();
1351
- }, f = () => {
1352
- c == null || c(), o(!0);
1348
+ beforeOpen: l,
1349
+ afterOpen: u,
1350
+ beforeClose: h,
1351
+ afterClose: c,
1352
+ onDragStart: f,
1353
+ onDragMove: y,
1354
+ onDragEnd: s,
1355
+ ...C
1356
+ } = t, v = () => {
1357
+ l == null || l();
1353
1358
  }, S = () => {
1354
- u == null || u();
1355
- }, w = () => {
1356
- h == null || h(), o(!1);
1359
+ u == null || u(), o(!0);
1360
+ }, E = () => {
1361
+ h == null || h();
1357
1362
  }, x = () => {
1363
+ c == null || c(), o(!1);
1364
+ }, w = () => {
1365
+ f == null || f();
1366
+ }, Y = (b, d) => {
1367
+ y == null || y(b, d);
1368
+ }, U = () => {
1358
1369
  s == null || s();
1359
- }, T = (y, v) => {
1360
- m == null || m(y, v);
1361
- }, Y = () => {
1362
- C == null || C();
1363
- }, U = Yt(() => ({
1370
+ }, $ = Yt(() => ({
1364
1371
  ref: e,
1365
1372
  isOpen: n,
1366
1373
  setIsOpen: o,
1367
- beforeOpen: E,
1368
- afterOpen: f,
1369
- beforeClose: S,
1370
- afterClose: w,
1371
- onDragStart: x,
1372
- onDragMove: T,
1373
- onDragEnd: Y,
1374
- ...l
1375
- }), [e.current, n, o, t]), $ = z(() => {
1376
- o(!0);
1377
- }, [o]), P = z(() => {
1374
+ beforeOpen: v,
1375
+ afterOpen: S,
1376
+ beforeClose: E,
1377
+ afterClose: x,
1378
+ onDragStart: w,
1379
+ onDragMove: Y,
1380
+ onDragEnd: U,
1381
+ ...C
1382
+ }), [e.current, n, o, t]), P = z(() => {
1378
1383
  o(!0);
1379
- }, [o]), F = z(
1380
- (...y) => {
1381
- r.moveTo(...y);
1384
+ }, [o]), F = z(() => {
1385
+ o(!1);
1386
+ }, [o]), T = z(
1387
+ (...b) => {
1388
+ i.moveTo(...b);
1382
1389
  },
1383
- [r]
1384
- ), H = z(
1385
- (...y) => {
1386
- r.snapTo(...y);
1390
+ [i]
1391
+ ), O = z(
1392
+ (...b) => {
1393
+ i.snapTo(...b);
1387
1394
  },
1388
- [r]
1395
+ [i]
1389
1396
  );
1390
1397
  return {
1391
- props: U,
1392
- instance: r,
1398
+ props: $,
1399
+ instance: i,
1393
1400
  isOpen: n,
1401
+ isClosed: r,
1394
1402
  setIsOpen: o,
1395
- open: $,
1396
- close: P,
1397
- moveTo: F,
1398
- snapTo: H
1403
+ open: P,
1404
+ close: F,
1405
+ moveTo: T,
1406
+ snapTo: O
1399
1407
  };
1400
1408
  }
1401
1409
  export {
1402
- ve as BottomSheet,
1410
+ Se as BottomSheet,
1403
1411
  Bt as createPlaceholderBottomSheet,
1404
1412
  ye as useBottomSheet
1405
1413
  };