@plainsheet/react 0.4.5 → 0.4.7

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