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