@plainsheet/react 0.4.8 → 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.
@@ -1,6 +1,6 @@
1
- import { forwardRef as Bt, useRef as rt, useState as at, useImperativeHandle as Mt, useCallback as z, useEffect as q, useMemo as Pt } from "react";
2
- import { createPortal as Yt } from "react-dom";
3
- function It(t) {
1
+ import { forwardRef as Dt, useRef as rt, useState as at, useImperativeHandle as Mt, useCallback as z, useEffect as q, useMemo as Yt } from "react";
2
+ import { createPortal as Pt } from "react-dom";
3
+ function Ft(t) {
4
4
  return t != null;
5
5
  }
6
6
  (function() {
@@ -13,11 +13,11 @@ function It(t) {
13
13
  console.error("vite-plugin-css-injected-by-js", e);
14
14
  }
15
15
  })();
16
- var Rt = Object.defineProperty, Wt = (t, e, n) => e in t ? Rt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, J = (t, e, n) => Wt(t, typeof e != "symbol" ? e + "" : e, n);
17
- function x(t) {
16
+ var It = Object.defineProperty, Rt = (t, e, n) => e in t ? It(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, J = (t, e, n) => Rt(t, typeof e != "symbol" ? e + "" : e, n);
17
+ function L(t) {
18
18
  return typeof t == "string";
19
19
  }
20
- function Nt(t, e) {
20
+ function Wt(t, e) {
21
21
  return t.classList.contains(nt(e));
22
22
  }
23
23
  function K(t, e) {
@@ -27,15 +27,15 @@ function it(t, e) {
27
27
  t.classList.remove(nt(e));
28
28
  }
29
29
  function _(t, e, n) {
30
- x(n) && (x(e) && it(t, e), K(t, n));
30
+ L(n) && (L(e) && it(t, e), K(t, n));
31
31
  }
32
32
  function nt(t) {
33
- return x(t) ? t.trim().replace(/\./g, "") : "";
33
+ return L(t) ? t.trim().replace(/\./g, "") : "";
34
34
  }
35
- function W(t) {
35
+ function R(t) {
36
36
  return t.map((e) => nt(e)).filter(Boolean).join(" ");
37
37
  }
38
- function Ft(t) {
38
+ function Nt(t) {
39
39
  return t.map((e) => e == null ? void 0 : e.trim()).filter(Boolean).map((e) => `.${e}`).join(" ");
40
40
  }
41
41
  const pt = "open", ht = "hidden";
@@ -61,7 +61,7 @@ function A(t) {
61
61
  function jt(t) {
62
62
  Ct(t) && t.focus();
63
63
  }
64
- function Ut(t) {
64
+ function Gt(t) {
65
65
  if (!Ct(t) || t.offsetParent === null || "disabled" in t && t.disabled)
66
66
  return !1;
67
67
  const e = t.getAttribute("tabindex"), n = A(e) ? parseInt(e, 10) : -1, o = [
@@ -75,21 +75,21 @@ function Ut(t) {
75
75
  ].includes(t.tagName), r = t instanceof HTMLAnchorElement && t.href !== "" || t instanceof HTMLAreaElement && t.href !== "";
76
76
  return o || r || n > -1;
77
77
  }
78
- var T = /* @__PURE__ */ ((t) => (t.Backdrop = "pbs-backdrop", t.Root = "pbs-root", t.Container = "pbs-container", t.GapFiller = "pbs-gap-filler", t.Handle = "pbs-handle", t.HandleBar = "pbs-handle-bar", t.ContentWrapper = "pbs-content-wrapper", t))(T || {}), st = /* @__PURE__ */ ((t) => (t.Button = "pbs-button-reset", t.Dialog = "pbs-dialog-reset", t))(st || {}), Q = /* @__PURE__ */ ((t) => (t.Hidden = "hidden", t))(Q || {});
78
+ var k = /* @__PURE__ */ ((t) => (t.Backdrop = "pbs-backdrop", t.Root = "pbs-root", t.Container = "pbs-container", t.GapFiller = "pbs-gap-filler", t.Handle = "pbs-handle", t.HandleBar = "pbs-handle-bar", t.ContentWrapper = "pbs-content-wrapper", t))(k || {}), st = /* @__PURE__ */ ((t) => (t.Button = "pbs-button-reset", t.Dialog = "pbs-dialog-reset", t))(st || {}), Q = /* @__PURE__ */ ((t) => (t.Hidden = "hidden", t))(Q || {});
79
79
  function M(t, e, n) {
80
80
  const o = document.createElement(t);
81
81
  return e.split(" ").forEach((r) => {
82
82
  K(o, r);
83
- }), x(n) && o.setAttribute("data-testid", n), o;
83
+ }), L(n) && o.setAttribute("data-testid", n), o;
84
84
  }
85
- Ft([
86
- T.Root,
87
- T.ContentWrapper
85
+ Nt([
86
+ k.Root,
87
+ k.ContentWrapper
88
88
  ]);
89
89
  function mt(t, e, n, o) {
90
90
  switch (o) {
91
91
  case "content-height":
92
- return e >= t ? Tt(t, e, n) : 0;
92
+ return e >= t ? kt(t, e, n) : 0;
93
93
  case "middle":
94
94
  return -(t / 2 - e);
95
95
  case "top":
@@ -112,7 +112,7 @@ function wt(t, e) {
112
112
  function V(t, e) {
113
113
  return t > e ? t - e : e - t;
114
114
  }
115
- function $t(t, e) {
115
+ function Ut(t, e) {
116
116
  const n = t < e, o = t > e;
117
117
  return {
118
118
  isUp: n,
@@ -120,23 +120,23 @@ function $t(t, e) {
120
120
  stayedSame: t === e
121
121
  };
122
122
  }
123
- function bt(t, e, n) {
123
+ function ft(t, e, n) {
124
124
  const o = t === "above";
125
125
  return n.filter((r) => {
126
126
  const i = r * e.viewportHeight;
127
127
  return o ? e.visibleHeight < i : e.visibleHeight > i;
128
128
  });
129
129
  }
130
- function Tt(t, e, n) {
130
+ function kt(t, e, n) {
131
131
  return -(t - e) + n;
132
132
  }
133
- function ft(t) {
133
+ function bt(t) {
134
134
  return Number(t.replace("px", ""));
135
135
  }
136
136
  function tt(t, ...e) {
137
137
  return Number(t.toFixed(...e));
138
138
  }
139
- function kt(t) {
139
+ function Tt(t) {
140
140
  const e = /(?<type>\w+)\((?<values>[^)]+)\)/g, n = [];
141
141
  let o;
142
142
  for (; (o = e.exec(t)) !== null; ) {
@@ -145,8 +145,8 @@ function kt(t) {
145
145
  }
146
146
  return n;
147
147
  }
148
- function Gt(t) {
149
- const e = t.style.transform, n = kt(e);
148
+ function $t(t) {
149
+ const e = t.style.transform, n = Tt(e);
150
150
  return { transform: e, transformValues: n };
151
151
  }
152
152
  function Ht(t, e) {
@@ -155,8 +155,8 @@ function Ht(t, e) {
155
155
  ) || null;
156
156
  }
157
157
  const ct = "translate";
158
- function B(t) {
159
- const e = t.style.transform, n = kt(e), o = Ht(
158
+ function D(t) {
159
+ const e = t.style.transform, n = Tt(e), o = Ht(
160
160
  n,
161
161
  ct
162
162
  );
@@ -169,7 +169,7 @@ function et(t, { x: e, y: n }) {
169
169
  const {
170
170
  transform: o,
171
171
  transformValues: r
172
- } = Gt(t), i = Ht(
172
+ } = $t(t), i = Ht(
173
173
  r,
174
174
  ct
175
175
  );
@@ -191,8 +191,8 @@ function Ot(t) {
191
191
  );
192
192
  const e = t.values[0], n = t.values[1];
193
193
  return {
194
- x: ft(e) ?? 0,
195
- y: ft(n) ?? 0
194
+ x: bt(e) ?? 0,
195
+ y: bt(n) ?? 0
196
196
  };
197
197
  }
198
198
  function lt(t) {
@@ -205,9 +205,9 @@ function gt(t, {
205
205
  return lt(n) && t >= n ? n : lt(e) && t <= e ? e : t;
206
206
  }
207
207
  const _t = (t, e, n) => {
208
- e instanceof HTMLElement && !Nt(e, T.Handle) && n.scrollTop >= 1 || (t.isDragging = !0);
208
+ e instanceof HTMLElement && !Wt(e, k.Handle) && n.scrollTop >= 1 || (t.isDragging = !0);
209
209
  }, Xt = (t, e, n, o) => (r) => {
210
- o.startY = t.getCoordinates(r).y, o.containerStartTranslate = B(e), n.onDragStart();
210
+ o.startY = t.getCoordinates(r).y, o.containerStartTranslate = D(e), n.onDragStart();
211
211
  }, zt = (t, e, n, o, r) => (i) => {
212
212
  qt(
213
213
  i,
@@ -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 b = l - E, v = l - m, w = gt(
239
- 1 - tt(v / b, 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 b = 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,61 +254,61 @@ function qt(t, e, n, o, r, i, a) {
254
254
  max: 1
255
255
  }
256
256
  );
257
- n.onDragMove(C, b);
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 = B(e).y, m = Et(u, h), C = window.innerHeight, l = e.clientHeight;
265
- if (m.isUp) {
266
- const E = [...n.snapPoints].sort(
267
- (w, L) => w - L
268
- ), b = l + -s;
269
- if (!n.expandable && b >= 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 L = w * window.innerHeight;
273
- if (b <= L) {
274
- const k = V(
275
- b,
276
- L
271
+ for (const E of C) {
272
+ const x = E * window.innerHeight;
273
+ if (v <= x) {
274
+ const w = V(
275
+ v,
276
+ x
277
277
  );
278
278
  a.translateContainer({
279
- startY: s,
280
- endY: s - k,
279
+ startY: c,
280
+ endY: c - w,
281
281
  animationFrame: r,
282
282
  bottomSheetContainer: e
283
283
  });
284
284
  return;
285
285
  }
286
286
  }
287
- const v = Tt(
288
- C,
289
- l,
287
+ const S = kt(
288
+ y,
289
+ s,
290
290
  n.marginTop
291
291
  );
292
292
  a.translateContainer({
293
- startY: s,
294
- endY: v,
293
+ startY: c,
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
- (b, v) => v - b
298
+ } else if (f.isDown) {
299
+ const C = [...n.snapPoints].sort(
300
+ (v, S) => S - v
301
301
  );
302
- for (const b of E) {
303
- const v = b * window.innerHeight, w = l + -s;
304
- if (w >= v) {
305
- const L = V(
306
- w,
307
- v
302
+ for (const v of C) {
303
+ const S = v * window.innerHeight, E = s + -c;
304
+ if (E >= S) {
305
+ const x = V(
306
+ E,
307
+ S
308
308
  );
309
309
  a.translateContainer({
310
- startY: s,
311
- endY: s + L,
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 b = l + -s;
320
- if (b >= l) {
321
- const v = V(b, 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 + v,
323
+ startY: c,
324
+ endY: c + S,
325
325
  animationFrame: r,
326
326
  bottomSheetContainer: e
327
327
  });
@@ -457,7 +457,10 @@ function Jt(t, e) {
457
457
  bottomSheetProps: t,
458
458
  options: e
459
459
  });
460
- return t.rootStyle && Object.assign(n.bottomSheetRoot.style, t.rootStyle), t.backdropStyle && Object.assign(n.bottomSheetBackdrop.style, t.backdropStyle), t.containerStyle && Object.assign(n.bottomSheetContainer.style, t.containerStyle), t.handleStyle && Object.assign(n.bottomSheetHandleBar.style, t.handleStyle), t.contentWrapperStyle && Object.assign(
460
+ return t.rootStyle && Object.assign(n.bottomSheetRoot.style, t.rootStyle), t.backdropStyle && Object.assign(n.bottomSheetBackdrop.style, t.backdropStyle), t.containerGapFillerStyle && Object.assign(n.bottomSheetContainer.style, t.containerStyle), t.containerStyle && Object.assign(
461
+ n.bottomSheetContainerGapFiller.style,
462
+ t.containerGapFillerStyle
463
+ ), t.handleStyle && Object.assign(n.bottomSheetHandleBar.style, t.handleStyle), t.contentWrapperStyle && Object.assign(
461
464
  n.bottomSheetContentWrapper.style,
462
465
  t.contentWrapperStyle
463
466
  ), { elements: n, eventHandlers: i };
@@ -465,63 +468,65 @@ function Jt(t, e) {
465
468
  function Qt(t) {
466
469
  const e = M(
467
470
  "dialog",
468
- W([
469
- T.Root,
471
+ R([
472
+ k.Root,
470
473
  st.Dialog,
471
474
  t.rootClass
472
475
  ]),
473
- T.Root
476
+ k.Root
474
477
  );
475
478
  e.ariaLabel = t.ariaLabel;
476
479
  const n = M(
477
480
  "section",
478
- W([T.Container, t.containerClass]),
479
- T.Container
481
+ R([k.Container, t.containerClass]),
482
+ k.Container
480
483
  );
481
484
  t.containerBorderRadius && (n.style.borderRadius = Lt(
482
485
  t.containerBorderRadius
483
486
  ));
484
487
  const o = M(
485
488
  "div",
486
- T.GapFiller,
487
- T.GapFiller
488
- ), r = M(
489
+ k.GapFiller,
490
+ k.GapFiller
491
+ );
492
+ t.containerBackgroundColor && (n.style.backgroundColor = t.containerBackgroundColor, o.style.backgroundColor = t.containerBackgroundColor);
493
+ const r = M(
489
494
  "button",
490
- W([
491
- T.Handle,
495
+ R([
496
+ k.Handle,
492
497
  st.Button,
493
498
  t.shouldShowHandle ? null : Q.Hidden,
494
499
  t.handleClass
495
500
  ]),
496
- T.Handle
501
+ k.Handle
497
502
  );
498
503
  r.setAttribute("type", "button"), r.ariaLabel = "bottom sheet close button";
499
504
  const i = M(
500
505
  "span",
501
- W([
502
- T.HandleBar,
506
+ R([
507
+ k.HandleBar,
503
508
  t.shouldShowHandle ? null : Q.Hidden
504
509
  ]),
505
- T.HandleBar
510
+ k.HandleBar
506
511
  ), a = M(
507
512
  "article",
508
- W([
509
- T.ContentWrapper,
513
+ R([
514
+ k.ContentWrapper,
510
515
  t.contentWrapperClass
511
516
  ]),
512
- T.ContentWrapper
513
- ), c = M(
517
+ k.ContentWrapper
518
+ ), l = M(
514
519
  "div",
515
- W([
516
- T.Backdrop,
520
+ R([
521
+ k.Backdrop,
517
522
  t.backdropClass,
518
523
  Q.Hidden
519
524
  ]),
520
- T.Backdrop
525
+ k.Backdrop
521
526
  );
522
- 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), {
523
528
  bottomSheetRoot: e,
524
- bottomSheetBackdrop: c,
529
+ bottomSheetBackdrop: l,
525
530
  bottomSheetContainer: n,
526
531
  bottomSheetHandle: r,
527
532
  bottomSheetHandleBar: i,
@@ -549,36 +554,29 @@ function te({
549
554
  bottomSheetContainer: r,
550
555
  bottomSheetHandle: i,
551
556
  bottomSheetContainerGapFiller: a,
552
- bottomSheetContentWrapper: c,
557
+ bottomSheetContentWrapper: l,
553
558
  bottomSheetBackdrop: u
554
- } = t, { animationFrame: h } = n, s = new X(i), m = new X(
555
- c
556
- ), C = new X(
559
+ } = t, { animationFrame: h } = n, c = new X(i), f = new X(
560
+ l
561
+ ), y = new X(
557
562
  a
558
- ), l = e.dragTriggers.reduce(
559
- (H, y) => {
560
- const S = o.querySelectorAll(y);
561
- if (!S.length)
562
- return H;
563
- const p = Array.from(S).map((d) => d instanceof HTMLElement ? new X(d) : null).filter((d) => !!d);
564
- return [...H, ...p];
565
- },
566
- []
567
- ), E = new X(
563
+ );
564
+ let s = [];
565
+ const C = new X(
568
566
  window
569
- ), b = Xt(
570
- E,
567
+ ), v = Xt(
568
+ C,
571
569
  r,
572
570
  e,
573
571
  n.draggingState
574
- ), v = zt(
575
- E,
572
+ ), S = zt(
573
+ C,
576
574
  r,
577
575
  e,
578
576
  n.draggingState,
579
577
  h
580
- ), w = Vt(
581
- E,
578
+ ), E = Vt(
579
+ C,
582
580
  r,
583
581
  e,
584
582
  n.draggingState,
@@ -586,98 +584,109 @@ function te({
586
584
  n.onClose,
587
585
  n.bottomSheetState
588
586
  );
589
- function L(H) {
590
- 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();
591
589
  }
592
- function k(H) {
590
+ function w(T) {
593
591
  _t(
594
592
  n.draggingState,
595
- H.target,
593
+ T.target,
596
594
  t.bottomSheetContentWrapper
597
595
  );
598
596
  }
599
- function P(H) {
600
- const y = H ?? e;
601
- y.draggable && (s.addEventListeners({
602
- onStart: k
603
- }), l.forEach((S) => {
604
- S.addEventListeners({
605
- onStart: k,
606
- onStartOptions: {
607
- eventPhase: j.Target
608
- }
609
- });
610
- })), y.draggable && y.backgroundDraggable && (m.addEventListeners({
611
- onStart: k,
597
+ function Y(T) {
598
+ const O = T ?? e;
599
+ O.draggable && O.backgroundDraggable && (f.addEventListeners({
600
+ onStart: w,
612
601
  onStartOptions: {
613
602
  eventPhase: j.Target
614
603
  }
615
- }), C.addEventListeners({
616
- onStart: k
617
- })), y.draggable && E.addEventListeners({
618
- onStart: b,
619
- onMove: v,
620
- onEnd: w
621
- }), y.draggable && window.document.addEventListener("keyup", (S) => {
622
- S.key === "Escape" && n.onClose();
623
- }), i.addEventListener("keyup", (S) => {
624
- if (S.key === "ArrowUp") {
604
+ }), y.addEventListeners({
605
+ onStart: w
606
+ })), O.draggable && C.addEventListeners({
607
+ onStart: v,
608
+ onMove: S,
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") {
625
614
  n.moveUp();
626
615
  return;
627
616
  }
628
- if (S.key === "ArrowDown") {
617
+ if (b.key === "ArrowDown") {
629
618
  n.moveDown();
630
619
  return;
631
620
  }
632
- if (S.shiftKey && S.key === "Tab") {
633
- const p = Y(
621
+ if (b.shiftKey && b.key === "Tab") {
622
+ const d = P(
634
623
  t.bottomSheetContentWrapper
635
624
  );
636
- jt(p);
625
+ jt(d);
637
626
  }
638
627
  });
639
628
  }
640
- function $() {
641
- e.shouldCloseOnOutsideClick ? u.addEventListener("click", L) : 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
+ }));
642
651
  }
643
- function G() {
644
- u.removeEventListener("click", L);
652
+ function $() {
653
+ u.removeEventListener("click", x);
645
654
  }
646
- function Y(H) {
647
- let y = [...Array.from(H.childNodes).reverse()];
648
- for (; y.length; ) {
649
- const S = y.shift();
650
- if (Ut(S))
651
- return S;
652
- S && (y = [
653
- ...y,
654
- ...Array.from(S.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()
655
664
  ]);
656
665
  }
657
666
  return null;
658
667
  }
659
- function I() {
660
- s.removeEventListeners({
661
- onStart: k
662
- }), m.removeEventListeners({
663
- onStart: k
664
- }), C.removeEventListeners({
665
- onStart: k
666
- }), l.forEach((H) => {
667
- H.removeEventListeners({
668
- onStart: k
668
+ function F() {
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
669
678
  });
670
- }), E.removeEventListeners({
671
- onStart: b,
672
- onMove: v,
673
- onEnd: w
679
+ }), C.removeEventListeners({
680
+ onStart: v,
681
+ onMove: S,
682
+ onEnd: E
674
683
  });
675
684
  }
676
685
  return {
677
- attachEventListeners: P,
678
- clearEventListeners: I,
679
- attacheOnOpenEventListeners: $,
680
- clearOnOpenEventListeners: G
686
+ attachEventListeners: Y,
687
+ clearEventListeners: F,
688
+ attacheOnOpenEventListeners: U,
689
+ clearOnOpenEventListeners: $
681
690
  };
682
691
  }
683
692
  class ee {
@@ -693,8 +702,8 @@ class ee {
693
702
  this.isInProgress = !0;
694
703
  const r = (i) => {
695
704
  this.startedAt || (this.startedAt = i);
696
- const a = i - this.startedAt, c = n === 0 ? 1 : tt(a / n, 2), u = c >= 1 && !o;
697
- 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);
698
707
  };
699
708
  this.animationId = requestAnimationFrame(r);
700
709
  }
@@ -710,15 +719,15 @@ function ne(t) {
710
719
  animationFrame: r,
711
720
  onEnd: i,
712
721
  animationTimingFunction: a,
713
- animationDuration: c
722
+ animationDuration: l
714
723
  } = t, u = wt(e, n);
715
724
  r.stop();
716
725
  let h = !1;
717
- r.start((s) => {
726
+ r.start((c) => {
718
727
  et(o, {
719
- y: e + u * a(s)
720
- }), !h && s >= 1 && (i == null || i(), h = !0);
721
- }, c);
728
+ y: e + u * a(c)
729
+ }), !h && c >= 1 && (i == null || i(), h = !0);
730
+ }, l);
722
731
  }
723
732
  const ut = (t, e) => (n) => {
724
733
  ne({
@@ -726,7 +735,7 @@ const ut = (t, e) => (n) => {
726
735
  animationTimingFunction: t,
727
736
  animationDuration: e
728
737
  });
729
- }, F = {
738
+ }, N = {
730
739
  TOP: "top",
731
740
  MIDDLE: "middle",
732
741
  CONTENT_HEIGHT: "content-height",
@@ -746,7 +755,7 @@ function re(t, e) {
746
755
  function ae(...t) {
747
756
  console.error(t);
748
757
  }
749
- const N = {
758
+ const W = {
750
759
  EASE: "ease",
751
760
  EASE_IN: "ease-in",
752
761
  EASE_OUT: "ease-out",
@@ -754,7 +763,7 @@ const N = {
754
763
  SPRING: "spring"
755
764
  };
756
765
  function ie(t) {
757
- for (const e of Object.values(N))
766
+ for (const e of Object.values(W))
758
767
  if (e === t)
759
768
  return !0;
760
769
  return !1;
@@ -762,40 +771,40 @@ function ie(t) {
762
771
  function xt(t) {
763
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));
764
773
  }
765
- function U(t, e, n, o) {
766
- return function(c) {
767
- return a(r(c));
774
+ function G(t, e, n, o) {
775
+ return function(l) {
776
+ return a(r(l));
768
777
  };
769
- function r(c) {
770
- let u = 0, h = 1, s = c, m;
771
- if (c === 0 || c === 1)
772
- return c;
778
+ function r(l) {
779
+ let u = 0, h = 1, c = l, f;
780
+ if (l === 0 || l === 1)
781
+ return l;
773
782
  for (; u < h; ) {
774
- if (m = i(s), Math.abs(m - c) < 1e-3)
775
- return s;
776
- 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;
777
786
  }
778
- return s;
787
+ return c;
779
788
  }
780
- function i(c) {
781
- 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);
782
791
  }
783
- function a(c) {
784
- 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);
785
794
  }
786
795
  }
787
- const St = U(0.25, 0.1, 0.25, 1), se = U(0.42, 0, 1, 1), At = U(0.42, 0, 0.58, 1), ce = U(0.4, 0.1, 0.6, 1), le = U(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);
788
797
  function ue(t) {
789
798
  switch (t) {
790
- case N.EASE:
799
+ case W.EASE:
791
800
  return St;
792
- case N.EASE_IN:
801
+ case W.EASE_IN:
793
802
  return se;
794
- case N.EASE_OUT:
803
+ case W.EASE_OUT:
795
804
  return At;
796
- case N.EASE_IN_OUT:
805
+ case W.EASE_IN_OUT:
797
806
  return ce;
798
- case N.SPRING:
807
+ case W.SPRING:
799
808
  return le;
800
809
  default:
801
810
  return St;
@@ -807,7 +816,7 @@ function yt(t) {
807
816
  const de = {
808
817
  ariaLabel: "Bottom sheet",
809
818
  content: "",
810
- defaultPosition: F.CONTENT_HEIGHT,
819
+ defaultPosition: N.CONTENT_HEIGHT,
811
820
  marginTop: 20,
812
821
  snapPoints: [],
813
822
  width: "92%",
@@ -835,6 +844,7 @@ const de = {
835
844
  shouldShowHandle: !0,
836
845
  backDropTransition: null,
837
846
  backdropColor: null,
847
+ containerBackgroundColor: null,
838
848
  containerBorderRadius: null,
839
849
  rootClass: null,
840
850
  containerClass: null,
@@ -847,7 +857,8 @@ const de = {
847
857
  containerStyle: {},
848
858
  handleStyle: {},
849
859
  contentWrapperStyle: {},
850
- backdropStyle: {}
860
+ backdropStyle: {},
861
+ containerGapFillerStyle: {}
851
862
  };
852
863
  function pe(t) {
853
864
  const e = {
@@ -867,7 +878,7 @@ function pe(t) {
867
878
  function dt(t) {
868
879
  if (xt(t)) {
869
880
  const { p1x: e, p1y: n, p2x: o, p2y: r } = t;
870
- return U(e, n, o, r);
881
+ return G(e, n, o, r);
871
882
  }
872
883
  return ie(t) ? ue(t) : At;
873
884
  }
@@ -875,10 +886,10 @@ function he(t, e, n, o) {
875
886
  function r(i, a) {
876
887
  switch (i) {
877
888
  case "content":
878
- x(a) && (t.bottomSheetContentWrapper.innerHTML = a);
889
+ L(a) && (t.bottomSheetContentWrapper.innerHTML = a);
879
890
  break;
880
891
  case "width":
881
- x(a) && (t.bottomSheetContainer.style.width = a);
892
+ L(a) && (t.bottomSheetContainer.style.width = a);
882
893
  break;
883
894
  case "shouldShowHandle":
884
895
  yt(a) || Z(t.bottomSheetHandle, !1);
@@ -887,16 +898,19 @@ function he(t, e, n, o) {
887
898
  yt(a) || Z(t.bottomSheetBackdrop, !1);
888
899
  break;
889
900
  case "containerBorderRadius":
890
- x(a) && (t.bottomSheetContainer.style.borderRadius = Lt(a));
901
+ L(a) && (t.bottomSheetContainer.style.borderRadius = Lt(a));
902
+ break;
903
+ case "containerBackgroundColor":
904
+ L(a) && (t.bottomSheetContainer.style.backgroundColor = a, t.bottomSheetContainerGapFiller.style.backgroundColor = a);
891
905
  break;
892
906
  case "backdropColor":
893
- x(a) && (t.bottomSheetBackdrop.style.backgroundColor = a);
907
+ L(a) && (t.bottomSheetBackdrop.style.backgroundColor = a);
894
908
  break;
895
909
  case "backDropTransition":
896
- x(a) && (t.bottomSheetBackdrop.style.transition = a);
910
+ L(a) && (t.bottomSheetBackdrop.style.transition = a);
897
911
  break;
898
912
  case "rootClass":
899
- if (!x(a))
913
+ if (!L(a))
900
914
  return;
901
915
  _(
902
916
  t.bottomSheetRoot,
@@ -905,7 +919,7 @@ function he(t, e, n, o) {
905
919
  );
906
920
  break;
907
921
  case "containerClass":
908
- if (!x(a))
922
+ if (!L(a))
909
923
  return;
910
924
  _(
911
925
  t.bottomSheetContainer,
@@ -914,7 +928,7 @@ function he(t, e, n, o) {
914
928
  );
915
929
  break;
916
930
  case "handleClass":
917
- if (!x(a))
931
+ if (!L(a))
918
932
  return;
919
933
  _(
920
934
  t.bottomSheetHandle,
@@ -923,7 +937,7 @@ function he(t, e, n, o) {
923
937
  );
924
938
  break;
925
939
  case "contentWrapperClass":
926
- if (!x(a))
940
+ if (!L(a))
927
941
  return;
928
942
  _(
929
943
  t.bottomSheetContentWrapper,
@@ -932,7 +946,7 @@ function he(t, e, n, o) {
932
946
  );
933
947
  break;
934
948
  case "backdropClass":
935
- if (!x(a))
949
+ if (!L(a))
936
950
  return;
937
951
  _(
938
952
  t.bottomSheetBackdrop,
@@ -949,10 +963,13 @@ function he(t, e, n, o) {
949
963
  case "draggable":
950
964
  o.clearEventListeners(), o.attachEventListeners(n);
951
965
  break;
966
+ case "dragTriggers":
967
+ o.clearEventListeners(), o.attachEventListeners(n);
968
+ break;
952
969
  case "draggingAnimationTimings":
953
970
  if (xt(a)) {
954
- const c = dt(a), u = ut(
955
- c,
971
+ const l = dt(a), u = ut(
972
+ l,
956
973
  n.draggingAnimationDuration
957
974
  );
958
975
  e.translateContainer = u;
@@ -960,10 +977,10 @@ function he(t, e, n, o) {
960
977
  break;
961
978
  case "draggingAnimationDuration":
962
979
  if (A(a)) {
963
- const c = dt(
980
+ const l = dt(
964
981
  n.draggingAnimationTimings
965
982
  ), u = ut(
966
- c,
983
+ l,
967
984
  a
968
985
  );
969
986
  e.translateContainer = u;
@@ -987,6 +1004,12 @@ function he(t, e, n, o) {
987
1004
  n.containerStyle
988
1005
  );
989
1006
  break;
1007
+ case "containerGapFillerStyle":
1008
+ n.containerGapFillerStyle && Object.assign(
1009
+ t.bottomSheetContainerGapFiller.style,
1010
+ n.containerGapFillerStyle
1011
+ );
1012
+ break;
990
1013
  case "handleStyle":
991
1014
  n.handleStyle && Object.assign(
992
1015
  t.bottomSheetHandleBar.style,
@@ -1025,18 +1048,18 @@ function me(t) {
1025
1048
  function i() {
1026
1049
  r.originalDocumentOverflowY && r.originalDocumentOverflowY !== "hidden" && (document.body.style.overflowY = r.originalDocumentOverflowY), r.originalDocumentOverscrollBehavior && (document.body.style.position = r.originalDocumentOverscrollBehavior);
1027
1050
  }
1028
- const a = new ee(), c = {
1051
+ const a = new ee(), l = {
1029
1052
  animationFrame: a,
1030
- onClose: w,
1053
+ onClose: E,
1031
1054
  bottomSheetState: o,
1032
1055
  draggingState: r,
1033
- snapTo: S,
1034
- moveUp: H,
1035
- moveDown: y
1056
+ snapTo: b,
1057
+ moveUp: T,
1058
+ moveDown: O
1036
1059
  }, { elements: u, eventHandlers: h } = Jt(
1037
1060
  e,
1038
- c
1039
- ), s = re(
1061
+ l
1062
+ ), c = re(
1040
1063
  e,
1041
1064
  he(
1042
1065
  u,
@@ -1044,187 +1067,187 @@ function me(t) {
1044
1067
  e,
1045
1068
  h
1046
1069
  )
1047
- ), { bottomSheetBackdrop: m, bottomSheetRoot: C, bottomSheetContainer: l } = u, E = (p) => {
1048
- const d = p ?? window.document.body;
1049
- d.appendChild(C), d.appendChild(m);
1050
- const f = window.innerHeight;
1051
- et(l, {
1052
- y: f
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
1053
1076
  }), h.attachEventListeners(), o.isMounted = !0;
1054
- }, b = () => {
1055
- h.clearEventListeners(), Object.values(u).forEach((p) => {
1056
- p.remove();
1057
- }), i(), o.isMounted = !1;
1058
1077
  }, v = () => {
1059
- var p;
1060
- if (L() || ae(
1078
+ h.clearEventListeners(), Object.values(u).forEach((d) => {
1079
+ d.remove();
1080
+ }), i(), o.isMounted = !1;
1081
+ }, S = () => {
1082
+ var d;
1083
+ if (x() || ae(
1061
1084
  'Bottom Sheet is not mounted yet. call the "mount" method first.'
1062
- ), (p = t.beforeOpen) == null || p.call(t), k())
1085
+ ), (d = t.beforeOpen) == null || d.call(t), w())
1063
1086
  return;
1064
- ot(m, !0), s.shouldShowBackdrop || K(m, "transparent"), ot([l], !0), et(l, {
1065
- y: l.clientHeight
1087
+ ot(f, !0), c.shouldShowBackdrop || K(f, "transparent"), ot([s], !0), et(s, {
1088
+ y: s.clientHeight
1066
1089
  });
1067
- const d = window.innerHeight, f = mt(
1068
- d,
1069
- l.clientHeight,
1070
- s.marginTop,
1071
- s.defaultPosition
1072
- ), g = B(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;
1073
1096
  o.translateContainer({
1074
- startY: g,
1075
- endY: f,
1097
+ startY: m,
1098
+ endY: g,
1076
1099
  animationFrame: a,
1077
- bottomSheetContainer: l,
1100
+ bottomSheetContainer: s,
1078
1101
  onEnd: t.afterOpen
1079
1102
  });
1080
- const O = document.body.style.overflowY;
1081
- r.originalDocumentOverflowY = O || "initial";
1082
- const D = document.body.style.overscrollBehavior;
1083
- r.originalDocumentOverscrollBehavior = D || "initial", document.body.style.overflow = "hidden", document.body.style.overscrollBehavior = "contain", u.bottomSheetHandle.focus(), h.attacheOnOpenEventListeners();
1103
+ const H = document.body.style.overflowY;
1104
+ r.originalDocumentOverflowY = H || "initial";
1105
+ const B = document.body.style.overscrollBehavior;
1106
+ r.originalDocumentOverscrollBehavior = B || "initial", document.body.style.overflow = "hidden", document.body.style.overscrollBehavior = "contain", u.bottomSheetHandle.focus(), h.attacheOnOpenEventListeners();
1084
1107
  };
1085
- function w() {
1086
- var p;
1087
- if (P())
1108
+ function E() {
1109
+ var d;
1110
+ if (Y())
1088
1111
  return;
1089
- (p = t.beforeClose) == null || p.call(t);
1090
- const d = B(l).y, f = l.clientHeight;
1112
+ (d = t.beforeClose) == null || d.call(t);
1113
+ const p = D(s).y, g = s.clientHeight;
1091
1114
  o.translateContainer({
1092
- startY: d,
1093
- endY: f,
1115
+ startY: p,
1116
+ endY: g,
1094
1117
  animationFrame: a,
1095
- bottomSheetContainer: l,
1118
+ bottomSheetContainer: s,
1096
1119
  onEnd: () => {
1097
- var g;
1098
- (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();
1099
1122
  }
1100
1123
  }), i();
1101
1124
  }
1102
- function L() {
1125
+ function x() {
1103
1126
  return o.isMounted;
1104
1127
  }
1105
- function k() {
1106
- const p = B(l).y, d = window.innerHeight, f = l.clientHeight >= d ? d : l.clientHeight;
1107
- return p <= f;
1128
+ function w() {
1129
+ const d = D(s).y, p = window.innerHeight, g = s.clientHeight >= p ? p : s.clientHeight;
1130
+ return d <= g;
1131
+ }
1132
+ function Y() {
1133
+ return !w();
1108
1134
  }
1109
- function P() {
1110
- return !k();
1135
+ function U() {
1136
+ const d = D(s).y, p = s.clientHeight, g = window.innerHeight;
1137
+ if (d <= 5 && d >= -5)
1138
+ return N.CONTENT_HEIGHT;
1139
+ const m = p - d;
1140
+ if (m === g / 2)
1141
+ return N.MIDDLE;
1142
+ const H = g - c.marginTop, B = 10;
1143
+ return m <= H + B && m >= H - B ? N.TOP : N.CLOSED;
1111
1144
  }
1112
1145
  function $() {
1113
- const p = B(l).y, d = l.clientHeight, f = window.innerHeight;
1114
- if (p <= 5 && p >= -5)
1115
- return F.CONTENT_HEIGHT;
1116
- const g = d - p;
1117
- if (g === f / 2)
1118
- return F.MIDDLE;
1119
- const O = f - s.marginTop, D = 10;
1120
- return g <= O + D && g >= O - D ? F.TOP : F.CLOSED;
1121
- }
1122
- function G() {
1123
- return l.clientHeight;
1146
+ return s.clientHeight;
1124
1147
  }
1125
- function Y(p) {
1126
- if (!k())
1148
+ function P(d) {
1149
+ if (!w())
1127
1150
  return;
1128
- const d = B(l).y, f = l.clientHeight - d, g = window.innerHeight - p, O = $t(f, g), D = V(f, g);
1151
+ const p = D(s).y, g = s.clientHeight - p, m = window.innerHeight - d, H = Ut(g, m), B = V(g, m);
1129
1152
  o.translateContainer({
1130
- startY: d,
1131
- endY: d + (O.isUp ? -D : D),
1153
+ startY: p,
1154
+ endY: p + (H.isUp ? -B : B),
1132
1155
  animationFrame: a,
1133
- bottomSheetContainer: l
1156
+ bottomSheetContainer: s
1134
1157
  });
1135
1158
  }
1136
- function I(p, {
1137
- viewportHeight: d,
1138
- visibleHeight: f
1159
+ function F(d, {
1160
+ viewportHeight: p,
1161
+ visibleHeight: g
1139
1162
  }) {
1140
- let g = null;
1141
- for (const O of p) {
1142
- const D = O * d, R = V(
1143
- f,
1144
- D
1163
+ let m = null;
1164
+ for (const H of d) {
1165
+ const B = H * p, I = V(
1166
+ g,
1167
+ B
1145
1168
  );
1146
- (g === null || R < g) && (g = R);
1169
+ (m === null || I < m) && (m = I);
1147
1170
  }
1148
1171
  return {
1149
- minOffset: g
1172
+ minOffset: m
1150
1173
  };
1151
1174
  }
1152
- function H() {
1153
- const p = [...s.snapPoints].reverse(), d = B(l).y, f = l.clientHeight, g = f - d;
1154
- if (!s.expandable && g >= f)
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)
1155
1178
  return;
1156
- const O = window.innerHeight, D = bt(
1179
+ const H = window.innerHeight, B = ft(
1157
1180
  "above",
1158
- { visibleHeight: g, viewportHeight: O },
1159
- p
1160
- ), { minOffset: R } = I(D, {
1161
- visibleHeight: g,
1162
- viewportHeight: O
1181
+ { visibleHeight: m, viewportHeight: H },
1182
+ d
1183
+ ), { minOffset: I } = F(B, {
1184
+ visibleHeight: m,
1185
+ viewportHeight: H
1163
1186
  });
1164
- if (R === null && g < O - s.marginTop) {
1187
+ if (I === null && m < H - c.marginTop) {
1165
1188
  o.translateContainer({
1166
- startY: d,
1189
+ startY: p,
1167
1190
  endY: mt(
1168
- O,
1169
- f,
1170
- s.marginTop,
1191
+ H,
1192
+ g,
1193
+ c.marginTop,
1171
1194
  "top"
1172
1195
  ),
1173
1196
  animationFrame: a,
1174
- bottomSheetContainer: l
1197
+ bottomSheetContainer: s
1175
1198
  });
1176
1199
  return;
1177
1200
  }
1178
- A(R) && o.translateContainer({
1179
- startY: d,
1180
- endY: d - R,
1201
+ A(I) && o.translateContainer({
1202
+ startY: p,
1203
+ endY: p - I,
1181
1204
  animationFrame: a,
1182
- bottomSheetContainer: l
1205
+ bottomSheetContainer: s
1183
1206
  });
1184
1207
  }
1185
- function y() {
1186
- const p = B(l).y, d = l.clientHeight - p;
1187
- if (d < 1)
1208
+ function O() {
1209
+ const d = D(s).y, p = s.clientHeight - d;
1210
+ if (p < 1)
1188
1211
  return;
1189
- const f = window.innerHeight, g = bt(
1212
+ const g = window.innerHeight, m = ft(
1190
1213
  "below",
1191
- { visibleHeight: d, viewportHeight: f },
1192
- s.snapPoints
1193
- ), { minOffset: O } = I(g, {
1194
- visibleHeight: d,
1195
- viewportHeight: f
1214
+ { visibleHeight: p, viewportHeight: g },
1215
+ c.snapPoints
1216
+ ), { minOffset: H } = F(m, {
1217
+ visibleHeight: p,
1218
+ viewportHeight: g
1196
1219
  });
1197
- A(O) && o.translateContainer({
1198
- startY: p,
1199
- endY: p + O,
1220
+ A(H) && o.translateContainer({
1221
+ startY: d,
1222
+ endY: d + H,
1200
1223
  animationFrame: a,
1201
- bottomSheetContainer: l
1224
+ bottomSheetContainer: s
1202
1225
  });
1203
1226
  }
1204
- function S(p) {
1205
- const d = window.innerHeight;
1206
- if (!oe(p))
1227
+ function b(d) {
1228
+ const p = window.innerHeight;
1229
+ if (!oe(d))
1207
1230
  return;
1208
- const f = tt(d * p, 2);
1209
- Y(f);
1231
+ const g = tt(p * d, 2);
1232
+ P(g);
1210
1233
  }
1211
1234
  return {
1212
- props: s,
1235
+ props: c,
1213
1236
  elements: u,
1214
- mount: E,
1215
- unmount: b,
1216
- open: v,
1217
- close: w,
1218
- getIsMounted: L,
1219
- getIsOpen: k,
1220
- getIsClosed: P,
1221
- getPosition: $,
1222
- getHeight: G,
1223
- moveTo: Y,
1224
- snapTo: S
1237
+ mount: C,
1238
+ unmount: v,
1239
+ open: S,
1240
+ close: E,
1241
+ getIsMounted: x,
1242
+ getIsOpen: w,
1243
+ getIsClosed: Y,
1244
+ getPosition: U,
1245
+ getHeight: $,
1246
+ moveTo: P,
1247
+ snapTo: b
1225
1248
  };
1226
1249
  }
1227
- function Dt() {
1250
+ function Bt() {
1228
1251
  return {
1229
1252
  elements: {
1230
1253
  bottomSheetRoot: void 0,
@@ -1247,7 +1270,7 @@ function Dt() {
1247
1270
  getHeight: () => 0,
1248
1271
  getIsOpen: () => !1,
1249
1272
  getIsClosed: () => !0,
1250
- getPosition: () => F.CLOSED,
1273
+ getPosition: () => N.CLOSED,
1251
1274
  moveTo: () => {
1252
1275
  },
1253
1276
  snapTo: () => {
@@ -1257,133 +1280,134 @@ function Dt() {
1257
1280
  }
1258
1281
  };
1259
1282
  }
1260
- const be = Dt(), Se = Bt(
1283
+ const fe = Bt(), Se = Dt(
1261
1284
  function(e, n) {
1262
1285
  const {
1263
1286
  children: o,
1264
1287
  isOpen: r,
1265
1288
  setIsOpen: i,
1266
1289
  afterClose: a,
1267
- mountingPointRef: c,
1290
+ mountingPointRef: l,
1268
1291
  ...u
1269
- } = e, h = rt(be), [s, m] = at(
1292
+ } = e, h = rt(fe), [c, f] = at(
1270
1293
  h.current
1271
1294
  );
1272
1295
  Mt(
1273
1296
  n,
1274
- () => s,
1275
- [s]
1297
+ () => c,
1298
+ [c]
1276
1299
  );
1277
- const C = z(() => {
1300
+ const y = z(() => {
1278
1301
  i(!1), a == null || a();
1279
1302
  }, [a]);
1280
1303
  q(() => {
1281
- r ? s.open() : s.close();
1304
+ r ? c.open() : c.close();
1282
1305
  }, [r]);
1283
- const l = rt(null);
1306
+ const s = rt(null);
1284
1307
  return q(
1285
1308
  function() {
1286
- var w;
1287
- if (c && !c.current)
1309
+ var E;
1310
+ if (l && !l.current)
1288
1311
  return;
1289
- const b = It((w = e.mountingPointRef) == null ? void 0 : w.current) ? e.mountingPointRef.current : window.document.body;
1290
- if (!b || 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())
1291
1314
  return;
1292
- const v = me({
1315
+ const S = me({
1293
1316
  content: "",
1294
1317
  ...u,
1295
- afterClose: C
1318
+ afterClose: y
1296
1319
  });
1297
- return v.mount(b), l.current = v.elements.bottomSheetContentWrapper ?? null, h.current = v, m(v), () => {
1298
- s.unmount();
1320
+ return S.mount(v), s.current = S.elements.bottomSheetContentWrapper ?? null, h.current = S, f(S), () => {
1321
+ c.unmount();
1299
1322
  };
1300
1323
  },
1301
- [e.mountingPointRef, u, C]
1324
+ [e.mountingPointRef, u, y]
1302
1325
  ), q(
1303
1326
  function() {
1304
1327
  Object.assign(h.current.props, {
1305
1328
  ...u
1306
- }), m(h.current);
1329
+ }), f(h.current);
1307
1330
  },
1308
1331
  [u]
1309
1332
  ), q(function() {
1310
1333
  return () => {
1311
1334
  h.current.unmount();
1312
1335
  };
1313
- }, []), l.current ? Yt(
1336
+ }, []), s.current ? Pt(
1314
1337
  e.children,
1315
- l.current
1338
+ s.current
1316
1339
  ) : null;
1317
1340
  }
1318
- ), fe = Dt();
1341
+ ), be = Bt();
1319
1342
  function ye(t = {}) {
1320
- const e = rt(fe), [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);
1321
1344
  q(() => {
1322
- i(e.current);
1345
+ a(e.current);
1323
1346
  }, [e.current]);
1324
1347
  const {
1325
- beforeOpen: a,
1326
- afterOpen: c,
1327
- beforeClose: u,
1328
- afterClose: h,
1329
- onDragStart: s,
1330
- onDragMove: m,
1331
- onDragEnd: C,
1332
- ...l
1333
- } = t, E = () => {
1334
- a == null || a();
1335
- }, b = () => {
1336
- c == null || c(), o(!0);
1337
- }, v = () => {
1338
- u == null || u();
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();
1358
+ }, S = () => {
1359
+ u == null || u(), o(!0);
1360
+ }, E = () => {
1361
+ h == null || h();
1362
+ }, x = () => {
1363
+ c == null || c(), o(!1);
1339
1364
  }, w = () => {
1340
- h == null || h(), o(!1);
1341
- }, L = () => {
1365
+ f == null || f();
1366
+ }, Y = (b, d) => {
1367
+ y == null || y(b, d);
1368
+ }, U = () => {
1342
1369
  s == null || s();
1343
- }, k = (y, S) => {
1344
- m == null || m(y, S);
1345
- }, P = () => {
1346
- C == null || C();
1347
- }, $ = Pt(() => ({
1370
+ }, $ = Yt(() => ({
1348
1371
  ref: e,
1349
1372
  isOpen: n,
1350
1373
  setIsOpen: o,
1351
- beforeOpen: E,
1352
- afterOpen: b,
1353
- beforeClose: v,
1354
- afterClose: w,
1355
- onDragStart: L,
1356
- onDragMove: k,
1357
- onDragEnd: P,
1358
- ...l
1359
- }), [e.current, n, o, t]), G = z(() => {
1360
- o(!0);
1361
- }, [o]), Y = 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(() => {
1362
1383
  o(!0);
1363
- }, [o]), I = z(
1364
- (...y) => {
1365
- r.moveTo(...y);
1384
+ }, [o]), F = z(() => {
1385
+ o(!1);
1386
+ }, [o]), T = z(
1387
+ (...b) => {
1388
+ i.moveTo(...b);
1366
1389
  },
1367
- [r]
1368
- ), H = z(
1369
- (...y) => {
1370
- r.snapTo(...y);
1390
+ [i]
1391
+ ), O = z(
1392
+ (...b) => {
1393
+ i.snapTo(...b);
1371
1394
  },
1372
- [r]
1395
+ [i]
1373
1396
  );
1374
1397
  return {
1375
1398
  props: $,
1376
- instance: r,
1399
+ instance: i,
1377
1400
  isOpen: n,
1401
+ isClosed: r,
1378
1402
  setIsOpen: o,
1379
- open: G,
1380
- close: Y,
1381
- moveTo: I,
1382
- snapTo: H
1403
+ open: P,
1404
+ close: F,
1405
+ moveTo: T,
1406
+ snapTo: O
1383
1407
  };
1384
1408
  }
1385
1409
  export {
1386
1410
  Se as BottomSheet,
1387
- Dt as createPlaceholderBottomSheet,
1411
+ Bt as createPlaceholderBottomSheet,
1388
1412
  ye as useBottomSheet
1389
1413
  };