@plainsheet/react 0.4.4 → 0.4.5

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,4 +1,4 @@
1
- import { forwardRef as Dt, useRef as ot, useState as rt, useImperativeHandle as Bt, useCallback as Mt, useEffect as _, useMemo as Pt } from "react";
1
+ import { forwardRef as At, useRef as ot, useState as rt, useImperativeHandle as Bt, useCallback as Pt, useEffect as _, useMemo as Mt } from "react";
2
2
  import { createPortal as Yt } from "react-dom";
3
3
  function It(t) {
4
4
  return t != null;
@@ -14,7 +14,7 @@ function It(t) {
14
14
  }
15
15
  })();
16
16
  var Rt = Object.defineProperty, Nt = (t, e, n) => e in t ? Rt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, V = (t, e, n) => Nt(t, typeof e != "symbol" ? e + "" : e, n);
17
- function L(t) {
17
+ function x(t) {
18
18
  return typeof t == "string";
19
19
  }
20
20
  function Ft(t, e) {
@@ -27,10 +27,10 @@ function it(t, e) {
27
27
  t.classList.remove(et(e));
28
28
  }
29
29
  function $(t, e, n) {
30
- L(n) && (L(e) && it(t, e), X(t, n));
30
+ x(n) && (x(e) && it(t, e), X(t, n));
31
31
  }
32
32
  function et(t) {
33
- return L(t) ? t.trim().replace(/\./g, "") : "";
33
+ return x(t) ? t.trim().replace(/\./g, "") : "";
34
34
  }
35
35
  function R(t) {
36
36
  return t.map((e) => et(e)).filter(Boolean).join(" ");
@@ -38,7 +38,7 @@ function R(t) {
38
38
  function Wt(t) {
39
39
  return t.map((e) => e == null ? void 0 : e.trim()).filter(Boolean).map((e) => `.${e}`).join(" ");
40
40
  }
41
- const dt = "open", ht = "hidden";
41
+ const dt = "open", pt = "hidden";
42
42
  function nt(t, e) {
43
43
  const n = e;
44
44
  if (Array.isArray(t)) {
@@ -50,12 +50,12 @@ function nt(t, e) {
50
50
  J(t, n), t.setAttribute("aria-modal", n ? "true" : "false");
51
51
  }
52
52
  function J(t, e) {
53
- e ? (X(t, dt), it(t, ht)) : (X(t, ht), it(t, dt));
53
+ e ? (X(t, dt), it(t, pt)) : (X(t, pt), it(t, dt));
54
54
  }
55
55
  function Ct(t) {
56
56
  return t instanceof HTMLElement;
57
57
  }
58
- function O(t) {
58
+ function D(t) {
59
59
  return typeof t == "number" && !Number.isNaN(t);
60
60
  }
61
61
  function Ut(t) {
@@ -64,7 +64,7 @@ function Ut(t) {
64
64
  function jt(t) {
65
65
  if (!Ct(t) || t.offsetParent === null || "disabled" in t && t.disabled)
66
66
  return !1;
67
- const e = t.getAttribute("tabindex"), n = O(e) ? parseInt(e, 10) : -1, o = [
67
+ const e = t.getAttribute("tabindex"), n = D(e) ? parseInt(e, 10) : -1, o = [
68
68
  "INPUT",
69
69
  "BUTTON",
70
70
  "SELECT",
@@ -72,24 +72,24 @@ function jt(t) {
72
72
  "A",
73
73
  "AREA",
74
74
  "IFRAME"
75
- ].includes(t.tagName), i = t instanceof HTMLAnchorElement && t.href !== "" || t instanceof HTMLAreaElement && t.href !== "";
76
- return o || i || n > -1;
75
+ ].includes(t.tagName), r = t instanceof HTMLAnchorElement && t.href !== "" || t instanceof HTMLAreaElement && t.href !== "";
76
+ return o || r || n > -1;
77
77
  }
78
- var w = /* @__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))(w || {}), at = /* @__PURE__ */ ((t) => (t.Button = "pbs-button-reset", t.Dialog = "pbs-dialog-reset", t))(at || {}), K = /* @__PURE__ */ ((t) => (t.Hidden = "hidden", t))(K || {});
79
- function M(t, e, n) {
78
+ var E = /* @__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))(E || {}), at = /* @__PURE__ */ ((t) => (t.Button = "pbs-button-reset", t.Dialog = "pbs-dialog-reset", t))(at || {}), K = /* @__PURE__ */ ((t) => (t.Hidden = "hidden", t))(K || {});
79
+ function P(t, e, n) {
80
80
  const o = document.createElement(t);
81
- return e.split(" ").forEach((i) => {
82
- X(o, i);
83
- }), L(n) && o.setAttribute("data-testid", n), o;
81
+ return e.split(" ").forEach((r) => {
82
+ X(o, r);
83
+ }), x(n) && o.setAttribute("data-testid", n), o;
84
84
  }
85
85
  Wt([
86
- w.Root,
87
- w.ContentWrapper
86
+ E.Root,
87
+ E.ContentWrapper
88
88
  ]);
89
- function pt(t, e, n, o) {
89
+ function ht(t, e, n, o) {
90
90
  switch (o) {
91
91
  case "content-height":
92
- return e >= t ? wt(t, e, n) : 0;
92
+ return e >= t ? Et(t, e, n) : 0;
93
93
  case "middle":
94
94
  return -(t / 2 - e);
95
95
  case "top":
@@ -106,7 +106,7 @@ function yt(t, e) {
106
106
  stayedSame: e === t
107
107
  };
108
108
  }
109
- function Et(t, e) {
109
+ function wt(t, e) {
110
110
  return e < t ? -(t - e) : e - t;
111
111
  }
112
112
  function Q(t, e) {
@@ -122,12 +122,12 @@ function $t(t, e) {
122
122
  }
123
123
  function mt(t, e, n) {
124
124
  const o = t === "above";
125
- return n.filter((i) => {
126
- const r = i * e.viewportHeight;
127
- return o ? e.visibleHeight < r : e.visibleHeight > r;
125
+ return n.filter((r) => {
126
+ const a = r * e.viewportHeight;
127
+ return o ? e.visibleHeight < a : e.visibleHeight > a;
128
128
  });
129
129
  }
130
- function wt(t, e, n) {
130
+ function Et(t, e, n) {
131
131
  return -(t - e) + n;
132
132
  }
133
133
  function ft(t) {
@@ -140,8 +140,8 @@ function Tt(t) {
140
140
  const e = /(?<type>\w+)\((?<values>[^)]+)\)/g, n = [];
141
141
  let o;
142
142
  for (; (o = e.exec(t)) !== null; ) {
143
- const i = o[1], r = o[2].split(",").map((s) => s.trim());
144
- n.push({ type: i, values: r });
143
+ const r = o[1], a = o[2].split(",").map((i) => i.trim());
144
+ n.push({ type: r, values: a });
145
145
  }
146
146
  return n;
147
147
  }
@@ -168,14 +168,14 @@ function B(t) {
168
168
  function tt(t, { x: e, y: n }) {
169
169
  const {
170
170
  transform: o,
171
- transformValues: i
172
- } = Gt(t), r = Ht(
173
- i,
171
+ transformValues: r
172
+ } = Gt(t), a = Ht(
173
+ r,
174
174
  st
175
175
  );
176
- if (r) {
177
- const s = kt(r);
178
- t.style.transform = `translate(${e ?? s.x ?? 0}px,${n ?? s.y ?? 0}px)`;
176
+ if (a) {
177
+ const i = kt(a);
178
+ t.style.transform = `translate(${e ?? i.x ?? 0}px,${n ?? i.y ?? 0}px)`;
179
179
  return;
180
180
  }
181
181
  if (o) {
@@ -205,48 +205,48 @@ function gt(t, {
205
205
  return ct(n) && t >= n ? n : ct(e) && t <= e ? e : t;
206
206
  }
207
207
  const _t = (t, e, n) => {
208
- e instanceof HTMLElement && !Ft(e, w.Handle) && n.scrollTop >= 1 || (t.isDragging = !0);
209
- }, Xt = (t, e, n, o) => (i) => {
210
- o.startY = t.getCoordinates(i).y, o.containerStartTranslate = B(e), n.onDragStart();
211
- }, zt = (t, e, n, o, i) => (r) => {
208
+ e instanceof HTMLElement && !Ft(e, E.Handle) && n.scrollTop >= 1 || (t.isDragging = !0);
209
+ }, Xt = (t, e, n, o) => (r) => {
210
+ o.startY = t.getCoordinates(r).y, o.containerStartTranslate = B(e), n.onDragStart();
211
+ }, zt = (t, e, n, o, r) => (a) => {
212
212
  qt(
213
- r,
213
+ a,
214
214
  t,
215
215
  n,
216
216
  o,
217
- i,
217
+ r,
218
218
  e,
219
219
  n.marginTop
220
220
  );
221
221
  };
222
- function qt(t, e, n, o, i, r, s) {
223
- if (!o.isDragging || !O(o.startY))
222
+ function qt(t, e, n, o, r, a, i) {
223
+ if (!o.isDragging || !D(o.startY))
224
224
  return;
225
- const a = e.getCoordinates(t).y, d = Et(o.startY, a), p = window.innerHeight, c = r.clientHeight, m = c - (o.containerStartTranslate.y + d);
226
- if (m >= p)
225
+ const s = e.getCoordinates(t).y, u = wt(o.startY, s), h = window.innerHeight, c = a.clientHeight, m = c - (o.containerStartTranslate.y + u);
226
+ if (m >= h)
227
227
  return;
228
- const C = yt(o.startY, a);
229
- if (C.isUp && !n.expandable && m >= c)
228
+ const S = yt(o.startY, s);
229
+ if (S.isUp && !n.expandable && m >= c)
230
230
  return;
231
- i.start(() => {
232
- tt(r, {
233
- y: o.containerStartTranslate.y + d
231
+ r.start(() => {
232
+ tt(a, {
233
+ y: o.containerStartTranslate.y + u
234
234
  });
235
235
  }, 0);
236
- const l = p - s, y = c - o.containerStartTranslate.y;
237
- if (C.isUp) {
238
- const v = l - y, S = l - m, E = gt(
239
- 1 - Z(S / v, 2),
236
+ const l = h - i, C = c - o.containerStartTranslate.y;
237
+ if (S.isUp) {
238
+ const b = l - C, v = l - m, y = gt(
239
+ 1 - Z(v / b, 2),
240
240
  {
241
241
  min: 0,
242
242
  max: 1
243
243
  }
244
244
  );
245
- n.onDragMove(C, E);
246
- } else if (C.isDown) {
247
- const v = gt(
245
+ n.onDragMove(S, y);
246
+ } else if (S.isDown) {
247
+ const b = gt(
248
248
  Z(
249
- 1 - m / y,
249
+ 1 - m / C,
250
250
  2
251
251
  ),
252
252
  {
@@ -254,68 +254,68 @@ function qt(t, e, n, o, i, r, s) {
254
254
  max: 1
255
255
  }
256
256
  );
257
- n.onDragMove(C, v);
257
+ n.onDragMove(S, b);
258
258
  }
259
259
  }
260
- const Vt = (t, e, n, o, i, r, s) => (a) => {
261
- if (!o.isDragging || (o.isDragging = !1, !O(o.startY)))
260
+ const Vt = (t, e, n, o, r, a, i) => (s) => {
261
+ if (!o.isDragging || (o.isDragging = !1, !D(o.startY)))
262
262
  return;
263
263
  n.onDragEnd();
264
- const d = o.startY, p = t.getCoordinates(a).y, c = B(e).y, m = yt(d, p), C = window.innerHeight, l = e.clientHeight;
264
+ const u = o.startY, h = t.getCoordinates(s).y, c = B(e).y, m = yt(u, h), S = window.innerHeight, l = e.clientHeight;
265
265
  if (m.isUp) {
266
- const y = [...n.snapPoints].sort(
267
- (E, k) => E - k
268
- ), v = l + -c;
269
- if (!n.expandable && v >= l)
266
+ const C = [...n.snapPoints].sort(
267
+ (y, L) => y - L
268
+ ), b = l + -c;
269
+ if (!n.expandable && b >= l)
270
270
  return;
271
- for (const E of y) {
272
- const k = E * window.innerHeight;
273
- if (v <= k) {
271
+ for (const y of C) {
272
+ const L = y * window.innerHeight;
273
+ if (b <= L) {
274
274
  const T = Q(
275
- v,
276
- k
275
+ b,
276
+ L
277
277
  );
278
- s.translateContainer({
278
+ i.translateContainer({
279
279
  startY: c,
280
280
  endY: c - T,
281
- animationFrame: i,
281
+ animationFrame: r,
282
282
  bottomSheetContainer: e
283
283
  });
284
284
  return;
285
285
  }
286
286
  }
287
- const S = wt(
288
- C,
287
+ const v = Et(
288
+ S,
289
289
  l,
290
290
  n.marginTop
291
291
  );
292
- s.translateContainer({
292
+ i.translateContainer({
293
293
  startY: c,
294
- endY: S,
295
- animationFrame: i,
294
+ endY: v,
295
+ animationFrame: r,
296
296
  bottomSheetContainer: e
297
297
  });
298
298
  } else if (m.isDown) {
299
- const y = [...n.snapPoints].sort(
300
- (v, S) => S - v
299
+ const C = [...n.snapPoints].sort(
300
+ (b, v) => v - b
301
301
  );
302
- for (const v of y) {
303
- const S = v * window.innerHeight, E = l + -c;
304
- if (E >= S) {
305
- const k = Q(
306
- E,
307
- S
302
+ for (const b of C) {
303
+ const v = b * window.innerHeight, y = l + -c;
304
+ if (y >= v) {
305
+ const L = Q(
306
+ y,
307
+ v
308
308
  );
309
- s.translateContainer({
309
+ i.translateContainer({
310
310
  startY: c,
311
- endY: c + k,
312
- animationFrame: i,
311
+ endY: c + L,
312
+ animationFrame: r,
313
313
  bottomSheetContainer: e
314
314
  });
315
315
  return;
316
316
  }
317
317
  }
318
- r();
318
+ a();
319
319
  }
320
320
  };
321
321
  var W = /* @__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))(W || {});
@@ -344,50 +344,50 @@ class G {
344
344
  onStart: e,
345
345
  onStartOptions: n = Kt,
346
346
  onMove: o,
347
- onEnd: i
347
+ onEnd: r
348
348
  }) {
349
- this.addTouchEventListeners({ onStart: e, onStartOptions: n, onMove: o, onEnd: i }), this.addMouseEventListeners({ onStart: e, onStartOptions: n, onMove: o, onEnd: i });
349
+ this.addTouchEventListeners({ onStart: e, onStartOptions: n, onMove: o, onEnd: r }), this.addMouseEventListeners({ onStart: e, onStartOptions: n, onMove: o, onEnd: r });
350
350
  }
351
351
  addTouchEventListeners({
352
352
  onStart: e,
353
353
  onStartOptions: n,
354
354
  onMove: o,
355
- onEnd: i
355
+ onEnd: r
356
356
  }) {
357
357
  e && this.currentTarget.addEventListener(
358
358
  "touchstart",
359
- (r) => {
359
+ (a) => {
360
360
  if (n.eventPhase === W.All) {
361
- e(r);
361
+ e(a);
362
362
  return;
363
363
  }
364
- bt(r.eventPhase) === n.eventPhase && e(r);
364
+ bt(a.eventPhase) === n.eventPhase && e(a);
365
365
  },
366
366
  {
367
367
  passive: !0
368
368
  }
369
- ), o && this.currentTarget.addEventListener("touchmove", o), i && this.currentTarget.addEventListener("touchend", i);
369
+ ), o && this.currentTarget.addEventListener("touchmove", o), r && this.currentTarget.addEventListener("touchend", r);
370
370
  }
371
371
  addMouseEventListeners({
372
372
  onStart: e,
373
373
  onStartOptions: n,
374
374
  onMove: o,
375
- onEnd: i
375
+ onEnd: r
376
376
  }) {
377
377
  e && this.currentTarget.addEventListener(
378
378
  "mousedown",
379
- (r) => {
379
+ (a) => {
380
380
  if (n.eventPhase === W.All) {
381
- e(r);
381
+ e(a);
382
382
  return;
383
383
  }
384
- bt(r.eventPhase) === n.eventPhase && e(r);
384
+ bt(a.eventPhase) === n.eventPhase && e(a);
385
385
  },
386
386
  {
387
387
  passive: !0
388
388
  }
389
- ), o && this.currentTarget.addEventListener("mousemove", o), i && this.currentTarget.addEventListener("mouseup", (r) => {
390
- i(r);
389
+ ), o && this.currentTarget.addEventListener("mousemove", o), r && this.currentTarget.addEventListener("mouseup", (a) => {
390
+ r(a);
391
391
  });
392
392
  }
393
393
  removeEventListeners({
@@ -437,79 +437,79 @@ function Jt(t, e) {
437
437
  Zt(n), n.bottomSheetContainer.style.width = t.width;
438
438
  const o = document.createElement("div");
439
439
  o.innerHTML = t.content ?? "";
440
- const i = window.innerHeight;
441
- n.bottomSheetContainer.style.maxHeight = `${i}px`, n.bottomSheetContentWrapper.appendChild(o);
442
- const r = te({
440
+ const r = window.innerHeight;
441
+ n.bottomSheetContainer.style.maxHeight = `${r}px`, n.bottomSheetContentWrapper.appendChild(o);
442
+ const a = te({
443
443
  bottomSheetElements: n,
444
444
  bottomSheetProps: t,
445
445
  options: e
446
446
  });
447
- return { elements: n, eventHandlers: r };
447
+ return { elements: n, eventHandlers: a };
448
448
  }
449
449
  function Qt(t) {
450
- const e = M(
450
+ const e = P(
451
451
  "dialog",
452
452
  R([
453
- w.Root,
453
+ E.Root,
454
454
  at.Dialog,
455
455
  t.rootClass
456
456
  ]),
457
- w.Root
457
+ E.Root
458
458
  );
459
459
  e.ariaLabel = t.ariaLabel;
460
- const n = M(
460
+ const n = P(
461
461
  "section",
462
- R([w.Container, t.containerClass]),
463
- w.Container
462
+ R([E.Container, t.containerClass]),
463
+ E.Container
464
464
  );
465
465
  t.containerBorderRadius && (n.style.borderRadius = Lt(
466
466
  t.containerBorderRadius
467
467
  ));
468
- const o = M(
468
+ const o = P(
469
469
  "div",
470
- w.GapFiller,
471
- w.GapFiller
472
- ), i = M(
470
+ E.GapFiller,
471
+ E.GapFiller
472
+ ), r = P(
473
473
  "button",
474
474
  R([
475
- w.Handle,
475
+ E.Handle,
476
476
  at.Button,
477
477
  t.shouldShowHandle ? null : K.Hidden,
478
478
  t.handleClass
479
479
  ]),
480
- w.Handle
480
+ E.Handle
481
481
  );
482
- i.setAttribute("type", "button"), i.ariaLabel = "bottom sheet close button";
483
- const r = M(
482
+ r.setAttribute("type", "button"), r.ariaLabel = "bottom sheet close button";
483
+ const a = P(
484
484
  "span",
485
485
  R([
486
- w.HandleBar,
486
+ E.HandleBar,
487
487
  t.shouldShowHandle ? null : K.Hidden
488
488
  ]),
489
- w.HandleBar
490
- ), s = M(
489
+ E.HandleBar
490
+ ), i = P(
491
491
  "article",
492
492
  R([
493
- w.ContentWrapper,
493
+ E.ContentWrapper,
494
494
  t.contentWrapperClass
495
495
  ]),
496
- w.ContentWrapper
497
- ), a = M(
496
+ E.ContentWrapper
497
+ ), s = P(
498
498
  "div",
499
499
  R([
500
- w.Backdrop,
500
+ E.Backdrop,
501
501
  t.backdropClass,
502
502
  K.Hidden
503
503
  ]),
504
- w.Backdrop
504
+ E.Backdrop
505
505
  );
506
- return t.backdropColor && (a.style.backgroundColor = t.backdropColor), t.backDropTransition && (a.style.transition = t.backDropTransition), {
506
+ return t.backdropColor && (s.style.backgroundColor = t.backdropColor), t.backDropTransition && (s.style.transition = t.backDropTransition), {
507
507
  bottomSheetRoot: e,
508
- bottomSheetBackdrop: a,
508
+ bottomSheetBackdrop: s,
509
509
  bottomSheetContainer: n,
510
- bottomSheetHandle: i,
511
- bottomSheetHandleBar: r,
512
- bottomSheetContentWrapper: s,
510
+ bottomSheetHandle: r,
511
+ bottomSheetHandleBar: a,
512
+ bottomSheetContentWrapper: i,
513
513
  bottomSheetContainerGapFiller: o
514
514
  };
515
515
  }
@@ -518,10 +518,10 @@ function Zt({
518
518
  bottomSheetContainer: e,
519
519
  bottomSheetHandle: n,
520
520
  bottomSheetHandleBar: o,
521
- bottomSheetContentWrapper: i,
522
- bottomSheetContainerGapFiller: r
521
+ bottomSheetContentWrapper: r,
522
+ bottomSheetContainerGapFiller: a
523
523
  }) {
524
- t.appendChild(e), n.appendChild(o), e.appendChild(n), e.appendChild(i), e.appendChild(r);
524
+ t.appendChild(e), n.appendChild(o), e.appendChild(n), e.appendChild(r), e.appendChild(a);
525
525
  }
526
526
  function te({
527
527
  bottomSheetElements: t,
@@ -530,111 +530,112 @@ function te({
530
530
  }) {
531
531
  const {
532
532
  bottomSheetRoot: o,
533
- bottomSheetContainer: i,
534
- bottomSheetHandle: r,
535
- bottomSheetContainerGapFiller: s,
536
- bottomSheetContentWrapper: a,
537
- bottomSheetBackdrop: d
538
- } = t, { animationFrame: p } = n, c = new G(r), m = new G(
539
- a
540
- ), C = new G(
533
+ bottomSheetContainer: r,
534
+ bottomSheetHandle: a,
535
+ bottomSheetContainerGapFiller: i,
536
+ bottomSheetContentWrapper: s,
537
+ bottomSheetBackdrop: u
538
+ } = t, { animationFrame: h } = n, c = new G(a), m = new G(
541
539
  s
540
+ ), S = new G(
541
+ i
542
542
  ), l = e.dragTriggers.reduce(
543
- (b, A) => {
544
- const D = o.querySelectorAll(A);
545
- if (!D.length)
546
- return b;
547
- const h = Array.from(D).map((u) => u instanceof HTMLElement ? new G(u) : null).filter((u) => !!u);
548
- return [...b, ...h];
543
+ (k, O) => {
544
+ const w = o.querySelectorAll(O);
545
+ if (!w.length)
546
+ return k;
547
+ const p = Array.from(w).map((d) => d instanceof HTMLElement ? new G(d) : null).filter((d) => !!d);
548
+ return [...k, ...p];
549
549
  },
550
550
  []
551
- ), y = new G(
551
+ ), C = new G(
552
552
  window
553
- ), v = Xt(
554
- y,
555
- i,
553
+ ), b = Xt(
554
+ C,
555
+ r,
556
556
  e,
557
557
  n.draggingState
558
- ), S = zt(
559
- y,
560
- i,
558
+ ), v = zt(
559
+ C,
560
+ r,
561
561
  e,
562
562
  n.draggingState,
563
- p
564
- ), E = Vt(
565
- y,
566
- i,
563
+ h
564
+ ), y = Vt(
565
+ C,
566
+ r,
567
567
  e,
568
568
  n.draggingState,
569
- p,
569
+ h,
570
570
  n.onClose,
571
571
  n.bottomSheetState
572
572
  );
573
- function k(b) {
574
- b.target instanceof Element && !o.contains(b.target) && n.onClose();
573
+ function L(k) {
574
+ k.target instanceof Element && !o.contains(k.target) && n.onClose();
575
575
  }
576
- function T(b) {
576
+ function T(k) {
577
577
  _t(
578
578
  n.draggingState,
579
- b.target,
579
+ k.target,
580
580
  t.bottomSheetContentWrapper
581
581
  );
582
582
  }
583
- function P() {
584
- e.draggable && (c.addEventListeners({
583
+ function M(k) {
584
+ const O = k ?? e;
585
+ O.draggable && (c.addEventListeners({
585
586
  onStart: T
586
- }), l.forEach((b) => {
587
- b.addEventListeners({
587
+ }), l.forEach((w) => {
588
+ w.addEventListeners({
588
589
  onStart: T,
589
590
  onStartOptions: {
590
591
  eventPhase: W.Target
591
592
  }
592
593
  });
593
- })), e.draggable && e.backgroundDraggable && (m.addEventListeners({
594
+ })), O.draggable && O.backgroundDraggable && (m.addEventListeners({
594
595
  onStart: T,
595
596
  onStartOptions: {
596
597
  eventPhase: W.Target
597
598
  }
598
- }), C.addEventListeners({
599
+ }), S.addEventListeners({
599
600
  onStart: T
600
- })), e.draggable && y.addEventListeners({
601
- onStart: v,
602
- onMove: S,
603
- onEnd: E
604
- }), e.draggable && window.document.addEventListener("keyup", (b) => {
605
- b.key === "Escape" && n.onClose();
606
- }), r.addEventListener("keyup", (b) => {
607
- if (b.key === "ArrowUp") {
601
+ })), O.draggable && C.addEventListeners({
602
+ onStart: b,
603
+ onMove: v,
604
+ onEnd: y
605
+ }), O.draggable && window.document.addEventListener("keyup", (w) => {
606
+ w.key === "Escape" && n.onClose();
607
+ }), a.addEventListener("keyup", (w) => {
608
+ if (w.key === "ArrowUp") {
608
609
  n.moveUp();
609
610
  return;
610
611
  }
611
- if (b.key === "ArrowDown") {
612
+ if (w.key === "ArrowDown") {
612
613
  n.moveDown();
613
614
  return;
614
615
  }
615
- if (b.shiftKey && b.key === "Tab") {
616
- const A = Y(
616
+ if (w.shiftKey && w.key === "Tab") {
617
+ const p = Y(
617
618
  t.bottomSheetContentWrapper
618
619
  );
619
- Ut(A);
620
+ Ut(p);
620
621
  }
621
622
  });
622
623
  }
623
624
  function z() {
624
- e.shouldCloseOnOutsideClick ? d.addEventListener("click", k) : d.style.pointerEvents = "none";
625
+ e.shouldCloseOnOutsideClick ? u.addEventListener("click", L) : u.style.pointerEvents = "none";
625
626
  }
626
627
  function j() {
627
- d.removeEventListener("click", k);
628
+ u.removeEventListener("click", L);
628
629
  }
629
- function Y(b) {
630
- let A = [...Array.from(b.childNodes).reverse()];
631
- for (; A.length; ) {
632
- const D = A.shift();
633
- if (jt(D))
634
- return D;
635
- D && (A = [
636
- ...A,
637
- ...Array.from(D.childNodes).reverse()
630
+ function Y(k) {
631
+ let O = [...Array.from(k.childNodes).reverse()];
632
+ for (; O.length; ) {
633
+ const w = O.shift();
634
+ if (jt(w))
635
+ return w;
636
+ w && (O = [
637
+ ...O,
638
+ ...Array.from(w.childNodes).reverse()
638
639
  ]);
639
640
  }
640
641
  return null;
@@ -644,20 +645,20 @@ function te({
644
645
  onStart: T
645
646
  }), m.removeEventListeners({
646
647
  onStart: T
647
- }), C.removeEventListeners({
648
+ }), S.removeEventListeners({
648
649
  onStart: T
649
- }), l.forEach((b) => {
650
- b.removeEventListeners({
650
+ }), l.forEach((k) => {
651
+ k.removeEventListeners({
651
652
  onStart: T
652
653
  });
653
- }), y.removeEventListeners({
654
- onStart: v,
655
- onMove: S,
656
- onEnd: E
654
+ }), C.removeEventListeners({
655
+ onStart: b,
656
+ onMove: v,
657
+ onEnd: y
657
658
  });
658
659
  }
659
660
  return {
660
- attachEventListeners: P,
661
+ attachEventListeners: M,
661
662
  clearEventListeners: q,
662
663
  attacheOnOpenEventListeners: z,
663
664
  clearOnOpenEventListeners: j
@@ -674,15 +675,15 @@ class ee {
674
675
  */
675
676
  start(e, n, o = !1) {
676
677
  this.isInProgress = !0;
677
- const i = (r) => {
678
- this.startedAt || (this.startedAt = r);
679
- const s = r - this.startedAt, a = n === 0 ? 1 : Z(s / n, 2), d = a >= 1 && !o;
680
- e(a), d ? this.stop() : this.animationId = requestAnimationFrame(i);
678
+ const r = (a) => {
679
+ this.startedAt || (this.startedAt = a);
680
+ const i = a - this.startedAt, s = n === 0 ? 1 : Z(i / n, 2), u = s >= 1 && !o;
681
+ e(s), u ? this.stop() : this.animationId = requestAnimationFrame(r);
681
682
  };
682
- this.animationId = requestAnimationFrame(i);
683
+ this.animationId = requestAnimationFrame(r);
683
684
  }
684
685
  stop() {
685
- this.isInProgress = !1, this.startedAt = null, O(this.animationId) && cancelAnimationFrame(this.animationId);
686
+ this.isInProgress = !1, this.startedAt = null, D(this.animationId) && cancelAnimationFrame(this.animationId);
686
687
  }
687
688
  }
688
689
  function ne(t) {
@@ -690,18 +691,18 @@ function ne(t) {
690
691
  startY: e,
691
692
  endY: n,
692
693
  bottomSheetContainer: o,
693
- animationFrame: i,
694
- onEnd: r,
695
- animationTimingFunction: s,
696
- animationDuration: a
697
- } = t, d = Et(e, n);
698
- i.stop();
699
- let p = !1;
700
- i.start((c) => {
694
+ animationFrame: r,
695
+ onEnd: a,
696
+ animationTimingFunction: i,
697
+ animationDuration: s
698
+ } = t, u = wt(e, n);
699
+ r.stop();
700
+ let h = !1;
701
+ r.start((c) => {
701
702
  tt(o, {
702
- y: e + d * s(c)
703
- }), !p && c >= 1 && (r == null || r(), p = !0);
704
- }, a);
703
+ y: e + u * i(c)
704
+ }), !h && c >= 1 && (a == null || a(), h = !0);
705
+ }, s);
705
706
  }
706
707
  const lt = (t, e) => (n) => {
707
708
  ne({
@@ -716,12 +717,12 @@ const lt = (t, e) => (n) => {
716
717
  CLOSED: "closed"
717
718
  };
718
719
  function oe(t) {
719
- return !(!O(t) || t > 1 || t < 0);
720
+ return !(!D(t) || t > 1 || t < 0);
720
721
  }
721
722
  function re(t, e) {
722
723
  const n = {
723
- set(o, i, r, s) {
724
- return e(i, r), Reflect.set(o, i, r, s);
724
+ set(o, r, a, i) {
725
+ return e(r, a), Reflect.set(o, r, a, i);
725
726
  }
726
727
  };
727
728
  return new Proxy(t, n);
@@ -743,28 +744,28 @@ function ae(t) {
743
744
  return !1;
744
745
  }
745
746
  function Ot(t) {
746
- return !!(t instanceof Object && "p1x" in t && "p1y" in t && "p2x" in t && "p2y" in t && O(t.p1x) && O(t.p1y) && O(t.p2x) && O(t.p2y));
747
+ return !!(t instanceof Object && "p1x" in t && "p1y" in t && "p2x" in t && "p2y" in t && D(t.p1x) && D(t.p1y) && D(t.p2x) && D(t.p2y));
747
748
  }
748
749
  function U(t, e, n, o) {
749
- return function(a) {
750
- return s(i(a));
750
+ return function(s) {
751
+ return i(r(s));
751
752
  };
752
- function i(a) {
753
- let d = 0, p = 1, c = a, m;
754
- if (a === 0 || a === 1)
755
- return a;
756
- for (; d < p; ) {
757
- if (m = r(c), Math.abs(m - a) < 1e-3)
753
+ function r(s) {
754
+ let u = 0, h = 1, c = s, m;
755
+ if (s === 0 || s === 1)
756
+ return s;
757
+ for (; u < h; ) {
758
+ if (m = a(c), Math.abs(m - s) < 1e-3)
758
759
  return c;
759
- a > m ? d = c : p = c, c = (p + d) / 2;
760
+ s > m ? u = c : h = c, c = (h + u) / 2;
760
761
  }
761
762
  return c;
762
763
  }
763
- function r(a) {
764
- return 3 * t * a * Math.pow(1 - a, 2) + 3 * n * Math.pow(a, 2) * (1 - a) + Math.pow(a, 3);
764
+ function a(s) {
765
+ return 3 * t * s * Math.pow(1 - s, 2) + 3 * n * Math.pow(s, 2) * (1 - s) + Math.pow(s, 3);
765
766
  }
766
- function s(a) {
767
- return 3 * e * a * Math.pow(1 - a, 2) + 3 * o * Math.pow(a, 2) * (1 - a) + Math.pow(a, 3);
767
+ function i(s) {
768
+ return 3 * e * s * Math.pow(1 - s, 2) + 3 * o * Math.pow(s, 2) * (1 - s) + Math.pow(s, 3);
768
769
  }
769
770
  }
770
771
  const vt = U(0.25, 0.1, 0.25, 1), se = U(0.42, 0, 1, 1), xt = 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);
@@ -826,13 +827,13 @@ const de = {
826
827
  draggingAnimationTimings: "ease-in-out",
827
828
  draggingAnimationDuration: 180
828
829
  };
829
- function he(t) {
830
+ function pe(t) {
830
831
  const e = {
831
832
  ...de
832
833
  }, n = Object.entries(t).reduce(
833
- (o, i) => {
834
- const [r, s] = i;
835
- return ct(s) && (o[r] = s), o;
834
+ (o, r) => {
835
+ const [a, i] = r;
836
+ return ct(i) && (o[a] = i), o;
836
837
  },
837
838
  {}
838
839
  );
@@ -843,106 +844,112 @@ function he(t) {
843
844
  }
844
845
  function ut(t) {
845
846
  if (Ot(t)) {
846
- const { p1x: e, p1y: n, p2x: o, p2y: i } = t;
847
- return U(e, n, o, i);
847
+ const { p1x: e, p1y: n, p2x: o, p2y: r } = t;
848
+ return U(e, n, o, r);
848
849
  }
849
850
  return ae(t) ? ue(t) : xt;
850
851
  }
851
- function pe(t, e, n) {
852
- function o(i, r) {
853
- switch (i) {
852
+ function he(t, e, n, o) {
853
+ function r(a, i) {
854
+ switch (a) {
854
855
  case "content":
855
- L(r) && (t.bottomSheetContentWrapper.innerHTML = r);
856
+ x(i) && (t.bottomSheetContentWrapper.innerHTML = i);
856
857
  break;
857
858
  case "width":
858
- L(r) && (t.bottomSheetContainer.style.width = r);
859
+ x(i) && (t.bottomSheetContainer.style.width = i);
859
860
  break;
860
861
  case "shouldShowHandle":
861
- St(r) || J(t.bottomSheetHandle, !1);
862
+ St(i) || J(t.bottomSheetHandle, !1);
862
863
  break;
863
864
  case "shouldShowBackdrop":
864
- St(r) || J(t.bottomSheetBackdrop, !1);
865
+ St(i) || J(t.bottomSheetBackdrop, !1);
865
866
  break;
866
867
  case "containerBorderRadius":
867
- L(r) && (t.bottomSheetContainer.style.borderRadius = Lt(r));
868
+ x(i) && (t.bottomSheetContainer.style.borderRadius = Lt(i));
868
869
  break;
869
870
  case "backdropColor":
870
- L(r) && (t.bottomSheetBackdrop.style.backgroundColor = r);
871
+ x(i) && (t.bottomSheetBackdrop.style.backgroundColor = i);
871
872
  break;
872
873
  case "backDropTransition":
873
- L(r) && (t.bottomSheetBackdrop.style.transition = r);
874
+ x(i) && (t.bottomSheetBackdrop.style.transition = i);
874
875
  break;
875
876
  case "rootClass":
876
- if (!L(r))
877
+ if (!x(i))
877
878
  return;
878
879
  $(
879
880
  t.bottomSheetRoot,
880
881
  n.rootClass,
881
- r
882
+ i
882
883
  );
883
884
  break;
884
885
  case "containerClass":
885
- if (!L(r))
886
+ if (!x(i))
886
887
  return;
887
888
  $(
888
889
  t.bottomSheetContainer,
889
890
  n.containerClass,
890
- r
891
+ i
891
892
  );
892
893
  break;
893
894
  case "handleClass":
894
- if (!L(r))
895
+ if (!x(i))
895
896
  return;
896
897
  $(
897
898
  t.bottomSheetHandle,
898
899
  n.handleClass,
899
- r
900
+ i
900
901
  );
901
902
  break;
902
903
  case "contentWrapperClass":
903
- if (!L(r))
904
+ if (!x(i))
904
905
  return;
905
906
  $(
906
907
  t.bottomSheetContentWrapper,
907
908
  n.contentWrapperClass,
908
- r
909
+ i
909
910
  );
910
911
  break;
911
912
  case "backdropClass":
912
- if (!L(r))
913
+ if (!x(i))
913
914
  return;
914
915
  $(
915
916
  t.bottomSheetBackdrop,
916
917
  n.backdropClass,
917
- r
918
+ i
918
919
  );
919
920
  break;
921
+ case "expandable":
922
+ o.clearEventListeners(), o.attachEventListeners(n);
923
+ break;
924
+ case "draggable":
925
+ o.clearEventListeners(), o.attachEventListeners(n);
926
+ break;
920
927
  case "draggingAnimationTimings":
921
- if (Ot(r)) {
922
- const s = ut(r), a = lt(
928
+ if (Ot(i)) {
929
+ const s = ut(i), u = lt(
923
930
  s,
924
931
  n.draggingAnimationDuration
925
932
  );
926
- e.translateContainer = a;
933
+ e.translateContainer = u;
927
934
  }
928
935
  break;
929
936
  case "draggingAnimationDuration":
930
- if (O(r)) {
937
+ if (D(i)) {
931
938
  const s = ut(
932
939
  n.draggingAnimationTimings
933
- ), a = lt(
940
+ ), u = lt(
934
941
  s,
935
- r
942
+ i
936
943
  );
937
- e.translateContainer = a;
944
+ e.translateContainer = u;
938
945
  }
939
946
  break;
940
947
  }
941
948
  }
942
- return o;
949
+ return r;
943
950
  }
944
951
  function me(t) {
945
- const e = he(t), n = ut(
952
+ const e = pe(t), n = ut(
946
953
  t.draggingAnimationTimings
947
954
  ), o = {
948
955
  isMounted: !1,
@@ -950,7 +957,7 @@ function me(t) {
950
957
  n,
951
958
  e.draggingAnimationDuration
952
959
  )
953
- }, i = {
960
+ }, r = {
954
961
  startY: null,
955
962
  containerStartTranslate: {
956
963
  x: 0,
@@ -960,45 +967,50 @@ function me(t) {
960
967
  originalDocumentOverflowY: null,
961
968
  originalDocumentOverscrollBehavior: null
962
969
  };
963
- function r() {
964
- i.originalDocumentOverflowY && i.originalDocumentOverflowY !== "hidden" && (document.body.style.overflowY = i.originalDocumentOverflowY), i.originalDocumentOverscrollBehavior && (document.body.style.position = i.originalDocumentOverscrollBehavior);
970
+ function a() {
971
+ r.originalDocumentOverflowY && r.originalDocumentOverflowY !== "hidden" && (document.body.style.overflowY = r.originalDocumentOverflowY), r.originalDocumentOverscrollBehavior && (document.body.style.position = r.originalDocumentOverscrollBehavior);
965
972
  }
966
- const s = new ee(), a = {
967
- animationFrame: s,
968
- onClose: E,
973
+ const i = new ee(), s = {
974
+ animationFrame: i,
975
+ onClose: y,
969
976
  bottomSheetState: o,
970
- draggingState: i,
971
- snapTo: D,
972
- moveUp: b,
973
- moveDown: A
974
- }, { elements: d, eventHandlers: p } = Jt(
977
+ draggingState: r,
978
+ snapTo: w,
979
+ moveUp: k,
980
+ moveDown: O
981
+ }, { elements: u, eventHandlers: h } = Jt(
975
982
  e,
976
- a
983
+ s
977
984
  ), c = re(
978
985
  e,
979
- pe(d, o, e)
980
- ), { bottomSheetBackdrop: m, bottomSheetRoot: C, bottomSheetContainer: l } = d, y = (h) => {
981
- const u = h ?? window.document.body;
982
- u.appendChild(C), u.appendChild(m);
986
+ he(
987
+ u,
988
+ o,
989
+ e,
990
+ h
991
+ )
992
+ ), { bottomSheetBackdrop: m, bottomSheetRoot: S, bottomSheetContainer: l } = u, C = (p) => {
993
+ const d = p ?? window.document.body;
994
+ d.appendChild(S), d.appendChild(m);
983
995
  const f = window.innerHeight;
984
996
  tt(l, {
985
997
  y: f
986
- }), p.attachEventListeners(), o.isMounted = !0;
998
+ }), h.attachEventListeners(), o.isMounted = !0;
999
+ }, b = () => {
1000
+ h.clearEventListeners(), Object.values(u).forEach((p) => {
1001
+ p.remove();
1002
+ }), a(), o.isMounted = !1;
987
1003
  }, v = () => {
988
- p.clearEventListeners(), Object.values(d).forEach((h) => {
989
- h.remove();
990
- }), r(), o.isMounted = !1;
991
- }, S = () => {
992
- var h;
993
- if (k() || ie(
1004
+ var p;
1005
+ if (L() || ie(
994
1006
  'Bottom Sheet is not mounted yet. call the "mount" method first.'
995
- ), (h = t.beforeOpen) == null || h.call(t), T())
1007
+ ), (p = t.beforeOpen) == null || p.call(t), T())
996
1008
  return;
997
1009
  nt(m, !0), c.shouldShowBackdrop || X(m, "transparent"), nt([l], !0), tt(l, {
998
1010
  y: l.clientHeight
999
1011
  });
1000
- const u = window.innerHeight, f = pt(
1001
- u,
1012
+ const d = window.innerHeight, f = ht(
1013
+ d,
1002
1014
  l.clientHeight,
1003
1015
  c.marginTop,
1004
1016
  c.defaultPosition
@@ -1006,75 +1018,75 @@ function me(t) {
1006
1018
  o.translateContainer({
1007
1019
  startY: g,
1008
1020
  endY: f,
1009
- animationFrame: s,
1021
+ animationFrame: i,
1010
1022
  bottomSheetContainer: l,
1011
1023
  onEnd: t.afterOpen
1012
1024
  });
1013
1025
  const H = document.body.style.overflowY;
1014
- i.originalDocumentOverflowY = H || "initial";
1015
- const x = document.body.style.overscrollBehavior;
1016
- i.originalDocumentOverscrollBehavior = x || "initial", document.body.style.overflow = "hidden", document.body.style.overscrollBehavior = "contain", d.bottomSheetHandle.focus(), p.attacheOnOpenEventListeners();
1026
+ r.originalDocumentOverflowY = H || "initial";
1027
+ const A = document.body.style.overscrollBehavior;
1028
+ r.originalDocumentOverscrollBehavior = A || "initial", document.body.style.overflow = "hidden", document.body.style.overscrollBehavior = "contain", u.bottomSheetHandle.focus(), h.attacheOnOpenEventListeners();
1017
1029
  };
1018
- function E() {
1019
- var h;
1020
- if (P())
1030
+ function y() {
1031
+ var p;
1032
+ if (M())
1021
1033
  return;
1022
- (h = t.beforeClose) == null || h.call(t);
1023
- const u = B(l).y, f = l.clientHeight;
1034
+ (p = t.beforeClose) == null || p.call(t);
1035
+ const d = B(l).y, f = l.clientHeight;
1024
1036
  o.translateContainer({
1025
- startY: u,
1037
+ startY: d,
1026
1038
  endY: f,
1027
- animationFrame: s,
1039
+ animationFrame: i,
1028
1040
  bottomSheetContainer: l,
1029
1041
  onEnd: () => {
1030
1042
  var g;
1031
- (g = t.afterClose) == null || g.call(t), nt([m, l], !1), p.clearOnOpenEventListeners();
1043
+ (g = t.afterClose) == null || g.call(t), nt([m, l], !1), h.clearOnOpenEventListeners();
1032
1044
  }
1033
- }), r();
1045
+ }), a();
1034
1046
  }
1035
- function k() {
1047
+ function L() {
1036
1048
  return o.isMounted;
1037
1049
  }
1038
1050
  function T() {
1039
- const h = B(l).y, u = window.innerHeight, f = l.clientHeight >= u ? u : l.clientHeight;
1040
- return h <= f;
1051
+ const p = B(l).y, d = window.innerHeight, f = l.clientHeight >= d ? d : l.clientHeight;
1052
+ return p <= f;
1041
1053
  }
1042
- function P() {
1054
+ function M() {
1043
1055
  return !T();
1044
1056
  }
1045
1057
  function z() {
1046
- const h = B(l).y, u = l.clientHeight, f = window.innerHeight;
1047
- if (h <= 5 && h >= -5)
1058
+ const p = B(l).y, d = l.clientHeight, f = window.innerHeight;
1059
+ if (p <= 5 && p >= -5)
1048
1060
  return F.CONTENT_HEIGHT;
1049
- const g = u - h;
1061
+ const g = d - p;
1050
1062
  if (g === f / 2)
1051
1063
  return F.MIDDLE;
1052
- const H = f - c.marginTop, x = 10;
1053
- return g <= H + x && g >= H - x ? F.TOP : F.CLOSED;
1064
+ const H = f - c.marginTop, A = 10;
1065
+ return g <= H + A && g >= H - A ? F.TOP : F.CLOSED;
1054
1066
  }
1055
1067
  function j() {
1056
1068
  return l.clientHeight;
1057
1069
  }
1058
- function Y(h) {
1070
+ function Y(p) {
1059
1071
  if (!T())
1060
1072
  return;
1061
- const u = B(l).y, f = l.clientHeight - u, g = window.innerHeight - h, H = $t(f, g), x = Q(f, g);
1073
+ const d = B(l).y, f = l.clientHeight - d, g = window.innerHeight - p, H = $t(f, g), A = Q(f, g);
1062
1074
  o.translateContainer({
1063
- startY: u,
1064
- endY: u + (H.isUp ? -x : x),
1065
- animationFrame: s,
1075
+ startY: d,
1076
+ endY: d + (H.isUp ? -A : A),
1077
+ animationFrame: i,
1066
1078
  bottomSheetContainer: l
1067
1079
  });
1068
1080
  }
1069
- function q(h, {
1070
- viewportHeight: u,
1081
+ function q(p, {
1082
+ viewportHeight: d,
1071
1083
  visibleHeight: f
1072
1084
  }) {
1073
1085
  let g = null;
1074
- for (const H of h) {
1075
- const x = H * u, I = Q(
1086
+ for (const H of p) {
1087
+ const A = H * d, I = Q(
1076
1088
  f,
1077
- x
1089
+ A
1078
1090
  );
1079
1091
  (g === null || I < g) && (g = I);
1080
1092
  }
@@ -1082,82 +1094,82 @@ function me(t) {
1082
1094
  minOffset: g
1083
1095
  };
1084
1096
  }
1085
- function b() {
1086
- const h = [...c.snapPoints].reverse(), u = B(l).y, f = l.clientHeight, g = f - u;
1097
+ function k() {
1098
+ const p = [...c.snapPoints].reverse(), d = B(l).y, f = l.clientHeight, g = f - d;
1087
1099
  if (!c.expandable && g >= f)
1088
1100
  return;
1089
- const H = window.innerHeight, x = mt(
1101
+ const H = window.innerHeight, A = mt(
1090
1102
  "above",
1091
1103
  { visibleHeight: g, viewportHeight: H },
1092
- h
1093
- ), { minOffset: I } = q(x, {
1104
+ p
1105
+ ), { minOffset: I } = q(A, {
1094
1106
  visibleHeight: g,
1095
1107
  viewportHeight: H
1096
1108
  });
1097
1109
  if (I === null && g < H - c.marginTop) {
1098
1110
  o.translateContainer({
1099
- startY: u,
1100
- endY: pt(
1111
+ startY: d,
1112
+ endY: ht(
1101
1113
  H,
1102
1114
  f,
1103
1115
  c.marginTop,
1104
1116
  "top"
1105
1117
  ),
1106
- animationFrame: s,
1118
+ animationFrame: i,
1107
1119
  bottomSheetContainer: l
1108
1120
  });
1109
1121
  return;
1110
1122
  }
1111
- O(I) && o.translateContainer({
1112
- startY: u,
1113
- endY: u - I,
1114
- animationFrame: s,
1123
+ D(I) && o.translateContainer({
1124
+ startY: d,
1125
+ endY: d - I,
1126
+ animationFrame: i,
1115
1127
  bottomSheetContainer: l
1116
1128
  });
1117
1129
  }
1118
- function A() {
1119
- const h = B(l).y, u = l.clientHeight - h;
1120
- if (u < 1)
1130
+ function O() {
1131
+ const p = B(l).y, d = l.clientHeight - p;
1132
+ if (d < 1)
1121
1133
  return;
1122
1134
  const f = window.innerHeight, g = mt(
1123
1135
  "below",
1124
- { visibleHeight: u, viewportHeight: f },
1136
+ { visibleHeight: d, viewportHeight: f },
1125
1137
  c.snapPoints
1126
1138
  ), { minOffset: H } = q(g, {
1127
- visibleHeight: u,
1139
+ visibleHeight: d,
1128
1140
  viewportHeight: f
1129
1141
  });
1130
- O(H) && o.translateContainer({
1131
- startY: h,
1132
- endY: h + H,
1133
- animationFrame: s,
1142
+ D(H) && o.translateContainer({
1143
+ startY: p,
1144
+ endY: p + H,
1145
+ animationFrame: i,
1134
1146
  bottomSheetContainer: l
1135
1147
  });
1136
1148
  }
1137
- function D(h) {
1138
- const u = window.innerHeight;
1139
- if (!oe(h))
1149
+ function w(p) {
1150
+ const d = window.innerHeight;
1151
+ if (!oe(p))
1140
1152
  return;
1141
- const f = Z(u * h, 2);
1153
+ const f = Z(d * p, 2);
1142
1154
  Y(f);
1143
1155
  }
1144
1156
  return {
1145
1157
  props: c,
1146
- elements: d,
1147
- mount: y,
1148
- unmount: v,
1149
- open: S,
1150
- close: E,
1151
- getIsMounted: k,
1158
+ elements: u,
1159
+ mount: C,
1160
+ unmount: b,
1161
+ open: v,
1162
+ close: y,
1163
+ getIsMounted: L,
1152
1164
  getIsOpen: T,
1153
- getIsClosed: P,
1165
+ getIsClosed: M,
1154
1166
  getPosition: z,
1155
1167
  getHeight: j,
1156
1168
  moveTo: Y,
1157
- snapTo: D
1169
+ snapTo: w
1158
1170
  };
1159
1171
  }
1160
- function At() {
1172
+ function Dt() {
1161
1173
  return {
1162
1174
  elements: {
1163
1175
  bottomSheetRoot: void 0,
@@ -1190,115 +1202,115 @@ function At() {
1190
1202
  }
1191
1203
  };
1192
1204
  }
1193
- const fe = At(), Se = Dt(
1205
+ const fe = Dt(), Se = At(
1194
1206
  function(e, n) {
1195
1207
  const {
1196
1208
  children: o,
1197
- isOpen: i,
1198
- setIsOpen: r,
1199
- afterClose: s,
1200
- mountingPointRef: a,
1201
- ...d
1202
- } = e, p = ot(fe), [c, m] = rt(
1203
- p.current
1209
+ isOpen: r,
1210
+ setIsOpen: a,
1211
+ afterClose: i,
1212
+ mountingPointRef: s,
1213
+ ...u
1214
+ } = e, h = ot(fe), [c, m] = rt(
1215
+ h.current
1204
1216
  );
1205
1217
  Bt(
1206
1218
  n,
1207
1219
  () => c,
1208
1220
  [c]
1209
1221
  );
1210
- const C = Mt(() => {
1211
- r(!1), s == null || s();
1212
- }, [s]);
1213
- _(() => {
1214
- i ? c.open() : c.close();
1222
+ const S = Pt(() => {
1223
+ a(!1), i == null || i();
1215
1224
  }, [i]);
1225
+ _(() => {
1226
+ r ? c.open() : c.close();
1227
+ }, [r]);
1216
1228
  const l = ot(null);
1217
1229
  return _(
1218
1230
  function() {
1219
- var E;
1220
- if (a && !a.current)
1231
+ var y;
1232
+ if (s && !s.current)
1221
1233
  return;
1222
- const v = It((E = e.mountingPointRef) == null ? void 0 : E.current) ? e.mountingPointRef.current : window.document.body;
1223
- if (!v || c.getIsMounted())
1234
+ const b = It((y = e.mountingPointRef) == null ? void 0 : y.current) ? e.mountingPointRef.current : window.document.body;
1235
+ if (!b || c.getIsMounted())
1224
1236
  return;
1225
- const S = me({
1237
+ const v = me({
1226
1238
  content: "",
1227
- ...d,
1228
- afterClose: C
1239
+ ...u,
1240
+ afterClose: S
1229
1241
  });
1230
- return S.mount(v), l.current = S.elements.bottomSheetContentWrapper ?? null, p.current = S, m(S), () => {
1242
+ return v.mount(b), l.current = v.elements.bottomSheetContentWrapper ?? null, h.current = v, m(v), () => {
1231
1243
  c.unmount();
1232
1244
  };
1233
1245
  },
1234
- [e.mountingPointRef, d, C]
1246
+ [e.mountingPointRef, u, S]
1235
1247
  ), _(
1236
1248
  function() {
1237
- Object.assign(p.current.props, {
1238
- ...d
1239
- }), m(p.current);
1249
+ Object.assign(h.current.props, {
1250
+ ...u
1251
+ }), m(h.current);
1240
1252
  },
1241
- [d]
1253
+ [u]
1242
1254
  ), _(function() {
1243
1255
  return () => {
1244
- p.current.unmount();
1256
+ h.current.unmount();
1245
1257
  };
1246
1258
  }, []), l.current ? Yt(
1247
1259
  e.children,
1248
1260
  l.current
1249
1261
  ) : null;
1250
1262
  }
1251
- ), ge = At();
1263
+ ), ge = Dt();
1252
1264
  function Ce(t = {}) {
1253
- const e = ot(ge), [n, o] = rt(!1), [i, r] = rt(e.current);
1265
+ const e = ot(ge), [n, o] = rt(!1), [r, a] = rt(e.current);
1254
1266
  _(() => {
1255
- r(e.current);
1267
+ a(e.current);
1256
1268
  }, [e.current]);
1257
1269
  const {
1258
- beforeOpen: s,
1259
- afterOpen: a,
1260
- beforeClose: d,
1261
- afterClose: p,
1270
+ beforeOpen: i,
1271
+ afterOpen: s,
1272
+ beforeClose: u,
1273
+ afterClose: h,
1262
1274
  onDragStart: c,
1263
1275
  onDragMove: m,
1264
- onDragEnd: C,
1276
+ onDragEnd: S,
1265
1277
  ...l
1266
- } = t, y = () => {
1267
- s == null || s();
1278
+ } = t, C = () => {
1279
+ i == null || i();
1280
+ }, b = () => {
1281
+ s == null || s(), o(!0);
1268
1282
  }, v = () => {
1269
- a == null || a(), o(!0);
1270
- }, S = () => {
1271
- d == null || d();
1272
- }, E = () => {
1273
- p == null || p(), o(!1);
1274
- }, k = () => {
1283
+ u == null || u();
1284
+ }, y = () => {
1285
+ h == null || h(), o(!1);
1286
+ }, L = () => {
1275
1287
  c == null || c();
1276
1288
  }, T = (j, Y) => {
1277
1289
  m == null || m(j, Y);
1278
- }, P = () => {
1279
- C == null || C();
1290
+ }, M = () => {
1291
+ S == null || S();
1280
1292
  };
1281
1293
  return {
1282
- props: Pt(() => ({
1294
+ props: Mt(() => ({
1283
1295
  ref: e,
1284
1296
  isOpen: n,
1285
1297
  setIsOpen: o,
1286
- beforeOpen: y,
1287
- afterOpen: v,
1288
- beforeClose: S,
1289
- afterClose: E,
1290
- onDragStart: k,
1298
+ beforeOpen: C,
1299
+ afterOpen: b,
1300
+ beforeClose: v,
1301
+ afterClose: y,
1302
+ onDragStart: L,
1291
1303
  onDragMove: T,
1292
- onDragEnd: P,
1304
+ onDragEnd: M,
1293
1305
  ...l
1294
1306
  }), [e.current, n, o, t]),
1295
- instance: i,
1307
+ instance: r,
1296
1308
  isOpen: n,
1297
1309
  setIsOpen: o
1298
1310
  };
1299
1311
  }
1300
1312
  export {
1301
1313
  Se as BottomSheet,
1302
- At as createPlaceholderBottomSheet,
1314
+ Dt as createPlaceholderBottomSheet,
1303
1315
  Ce as useBottomSheet
1304
1316
  };