@plainsheet/core 0.7.7 → 0.7.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.
- package/dist/event-handlers/dragging-handler.d.ts.map +1 -1
- package/dist/initializer/bottom-sheet-defaults.d.ts.map +1 -1
- package/dist/initializer/bottom-sheet-initializer.d.ts.map +1 -1
- package/dist/initializer/bottom-sheet-props-initializer.d.ts.map +1 -1
- package/dist/plainsheet-core.cjs.js +1 -1
- package/dist/plainsheet-core.es.js +307 -274
- package/dist/plainsheet-core.umd.js +2 -2
- package/dist/types/bottom-sheet-props.type.d.ts +9 -3
- package/dist/types/bottom-sheet-props.type.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode('.pbs-root{position:fixed;left:0;bottom:0;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;width:100%;height:fit-content;max-height:100vh;z-index:2}.pbs-dialog-reset{background-color:transparent;color:inherit;border:none;outline:none;padding:0;margin:0}.pbs-backdrop{position:fixed;top:0;left:0;width:100%;height:100%;background-color:transparent;z-index:1;transition:background-color .2s ease-out}.pbs-backdrop.hidden{visibility:hidden}.pbs-backdrop.open{background-color:#454545b3}.pbs-backdrop.transparent{background-color:transparent}.pbs-container{--pbs-container-background-color: rgb(240, 240, 240);background-color:var(--pbs-container-background-color);position:relative;display:none;flex-direction:column;align-items:center;justify-content:flex-start;width:92%;height:fit-content;max-height:100vh;border-radius:10px 10px 0 0}.pbs-container.open{display:flex}.pbs-container .pbs-gap-filler{position:absolute;bottom:calc(-100vh + .5px);left:0;background-color:var(--pbs-container-background-color);content:"";width:100%;height:100vh}.pbs-handle{position:relative;display:flex;align-items:center;justify-content:center;width:100%;height:30px;cursor:pointer}.pbs-handle.hidden{display:none}.pbs-button-reset{background-color:transparent;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;border:none}button:focus.pbs-button-reset{outline:none}.pbs-handle-bar{background-color:#a8a8a8;position:relative;width:12%;height:7px;border-radius:12px}.pbs-handle-bar.hidden{display:none}.pbs-content-wrapper{position:relative;width:100%;height:fit-content;max-height:100%;overflow-y:scroll}.pbs-content-wrapper::-webkit-scrollbar{display:none}.example{-ms-overflow-style:none;scrollbar-width:none}')),document.head.appendChild(e)}}catch(n){console.error("vite-plugin-css-injected-by-js",n)}})();
|
|
2
|
-
var
|
|
3
|
-
var At = (t, n, e) => n in t ?
|
|
2
|
+
var Lt = Object.defineProperty;
|
|
3
|
+
var At = (t, n, e) => n in t ? Lt(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e;
|
|
4
4
|
var j = (t, n, e) => At(t, typeof n != "symbol" ? n + "" : n, e);
|
|
5
|
-
function
|
|
5
|
+
function H(t) {
|
|
6
6
|
return typeof t == "string";
|
|
7
7
|
}
|
|
8
8
|
function Bt(t, n) {
|
|
@@ -14,11 +14,11 @@ function $(t, n) {
|
|
|
14
14
|
function rt(t, n) {
|
|
15
15
|
t.classList.remove(Z(n));
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
|
|
17
|
+
function U(t, n, e) {
|
|
18
|
+
H(e) && (H(n) && rt(t, n), $(t, e));
|
|
19
19
|
}
|
|
20
20
|
function Z(t) {
|
|
21
|
-
return
|
|
21
|
+
return H(t) ? t.trim().replace(/\./g, "") : "";
|
|
22
22
|
}
|
|
23
23
|
function M(t) {
|
|
24
24
|
return t.map((n) => Z(n)).filter(Boolean).join(" ");
|
|
@@ -31,26 +31,26 @@ function et(t, n) {
|
|
|
31
31
|
const e = n;
|
|
32
32
|
if (Array.isArray(t)) {
|
|
33
33
|
t.forEach((r) => {
|
|
34
|
-
|
|
34
|
+
q(r, e), r.setAttribute("aria-modal", e ? "true" : "false");
|
|
35
35
|
});
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
q(t, e), t.setAttribute("aria-modal", e ? "true" : "false");
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function q(t, n) {
|
|
41
41
|
n ? ($(t, lt), rt(t, ut)) : ($(t, ut), rt(t, lt));
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function yt(t) {
|
|
44
44
|
return t instanceof HTMLElement;
|
|
45
45
|
}
|
|
46
46
|
function Y(t) {
|
|
47
47
|
return typeof t == "number" && !Number.isNaN(t);
|
|
48
48
|
}
|
|
49
49
|
function Yt(t) {
|
|
50
|
-
|
|
50
|
+
yt(t) && t.focus();
|
|
51
51
|
}
|
|
52
52
|
function It(t) {
|
|
53
|
-
if (!
|
|
53
|
+
if (!yt(t) || t.offsetParent === null || "disabled" in t && t.disabled)
|
|
54
54
|
return !1;
|
|
55
55
|
const e = t.getAttribute("tabindex"), r = Y(e) ? parseInt(e, 10) : -1, i = [
|
|
56
56
|
"INPUT",
|
|
@@ -63,17 +63,17 @@ function It(t) {
|
|
|
63
63
|
].includes(t.tagName), a = t instanceof HTMLAnchorElement && t.href !== "" || t instanceof HTMLAreaElement && t.href !== "";
|
|
64
64
|
return i || a || r > -1;
|
|
65
65
|
}
|
|
66
|
-
var
|
|
66
|
+
var T = /* @__PURE__ */ ((t) => (t.Backdrop = "pbs-backdrop", t.Root = "pbs-root", t.Container = "pbs-container", t.GapFiller = "pbs-gap-filler", t.Handle = "pbs-handle", t.HandleBar = "pbs-handle-bar", t.ContentWrapper = "pbs-content-wrapper", t))(T || {}), ot = /* @__PURE__ */ ((t) => (t.Button = "pbs-button-reset", t.Dialog = "pbs-dialog-reset", t))(ot || {}), K = /* @__PURE__ */ ((t) => (t.Hidden = "hidden", t))(K || {});
|
|
67
67
|
function x(t, n, e) {
|
|
68
68
|
const r = document.createElement(t);
|
|
69
69
|
return n.split(" ").forEach((i) => {
|
|
70
70
|
$(r, i);
|
|
71
|
-
}),
|
|
71
|
+
}), H(e) && r.setAttribute("data-testid", e), r;
|
|
72
72
|
}
|
|
73
73
|
const sn = {
|
|
74
74
|
CONTENTS_WRAPPER: Dt([
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
T.Root,
|
|
76
|
+
T.ContentWrapper
|
|
77
77
|
])
|
|
78
78
|
};
|
|
79
79
|
function dt(t, n, e, r) {
|
|
@@ -88,7 +88,7 @@ function dt(t, n, e, r) {
|
|
|
88
88
|
return 0;
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function Ct(t, n) {
|
|
92
92
|
const e = n < t, r = n > t;
|
|
93
93
|
return {
|
|
94
94
|
isUp: e,
|
|
@@ -96,10 +96,10 @@ function yt(t, n) {
|
|
|
96
96
|
stayedSame: n === t
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
|
-
function
|
|
99
|
+
function Tt(t, n) {
|
|
100
100
|
return n < t ? -(t - n) : n - t;
|
|
101
101
|
}
|
|
102
|
-
function
|
|
102
|
+
function V(t, n) {
|
|
103
103
|
return t > n ? t - n : n - t;
|
|
104
104
|
}
|
|
105
105
|
function xt(t, n) {
|
|
@@ -195,11 +195,11 @@ function ht(t, {
|
|
|
195
195
|
}) {
|
|
196
196
|
return at(e) && t >= e ? e : at(n) && t <= n ? n : t;
|
|
197
197
|
}
|
|
198
|
-
const
|
|
199
|
-
n instanceof HTMLElement && !Bt(n,
|
|
198
|
+
const Ft = (t, n, e) => {
|
|
199
|
+
n instanceof HTMLElement && !Bt(n, T.Handle) && e.scrollTop >= 1 || (t.isDragging = !0);
|
|
200
200
|
}, Mt = (t, n, e, r) => (o) => {
|
|
201
201
|
r.startY = t.getCoordinates(o).y, r.containerStartTranslate = I(n), e.onDragStart();
|
|
202
|
-
},
|
|
202
|
+
}, Pt = (t, n, e, r, o) => (i) => {
|
|
203
203
|
Rt(
|
|
204
204
|
i,
|
|
205
205
|
t,
|
|
@@ -213,31 +213,31 @@ const Pt = (t, n, e) => {
|
|
|
213
213
|
function Rt(t, n, e, r, o, i, a) {
|
|
214
214
|
if (!r.isDragging || !Y(r.startY))
|
|
215
215
|
return;
|
|
216
|
-
const
|
|
217
|
-
if (
|
|
216
|
+
const u = n.getCoordinates(t).y, s = Tt(r.startY, u), b = window.innerHeight, l = i.clientHeight, f = l - (r.containerStartTranslate.y + s);
|
|
217
|
+
if (f >= b)
|
|
218
218
|
return;
|
|
219
|
-
const p =
|
|
220
|
-
if (p.isUp && !e.expandable &&
|
|
219
|
+
const p = Ct(r.startY, u);
|
|
220
|
+
if (p.isUp && !e.expandable && f >= l || e.preventClosing && f <= l)
|
|
221
221
|
return;
|
|
222
222
|
o.start(() => {
|
|
223
223
|
Q(i, {
|
|
224
224
|
y: r.containerStartTranslate.y + s
|
|
225
225
|
});
|
|
226
226
|
}, 0);
|
|
227
|
-
const
|
|
227
|
+
const w = b - a, c = l - r.containerStartTranslate.y;
|
|
228
228
|
if (p.isUp) {
|
|
229
|
-
const
|
|
230
|
-
1 - J(
|
|
229
|
+
const y = w - c, S = w - f, k = ht(
|
|
230
|
+
1 - J(S / y, 2),
|
|
231
231
|
{
|
|
232
232
|
min: 0,
|
|
233
233
|
max: 1
|
|
234
234
|
}
|
|
235
235
|
);
|
|
236
|
-
e.onDragMove(p,
|
|
236
|
+
e.onDragMove(p, k);
|
|
237
237
|
} else if (p.isDown) {
|
|
238
|
-
const
|
|
238
|
+
const y = ht(
|
|
239
239
|
J(
|
|
240
|
-
1 -
|
|
240
|
+
1 - f / c,
|
|
241
241
|
2
|
|
242
242
|
),
|
|
243
243
|
{
|
|
@@ -245,71 +245,84 @@ function Rt(t, n, e, r, o, i, a) {
|
|
|
245
245
|
max: 1
|
|
246
246
|
}
|
|
247
247
|
);
|
|
248
|
-
e.onDragMove(p,
|
|
248
|
+
e.onDragMove(p, y);
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
|
-
const
|
|
251
|
+
const Gt = (t, n, e, r, o, i, a) => (u) => {
|
|
252
252
|
if (!r.isDragging || (r.isDragging = !1, !Y(r.startY)))
|
|
253
253
|
return;
|
|
254
254
|
e.onDragEnd();
|
|
255
|
-
const s = r.startY, b = t.getCoordinates(
|
|
256
|
-
if (
|
|
255
|
+
const s = r.startY, b = t.getCoordinates(u).y, l = I(n).y, f = Ct(s, b), p = window.innerHeight, w = n.clientHeight;
|
|
256
|
+
if (f.isUp) {
|
|
257
257
|
const c = [...e.snapPoints].sort(
|
|
258
|
-
(
|
|
259
|
-
),
|
|
260
|
-
if (!e.expandable &&
|
|
258
|
+
(k, B) => k - B
|
|
259
|
+
), y = w + -l;
|
|
260
|
+
if (!e.expandable && y >= w)
|
|
261
261
|
return;
|
|
262
|
-
for (const
|
|
263
|
-
const B =
|
|
264
|
-
if (
|
|
265
|
-
const L =
|
|
266
|
-
|
|
262
|
+
for (const k of c) {
|
|
263
|
+
const B = k * window.innerHeight;
|
|
264
|
+
if (y <= B) {
|
|
265
|
+
const L = V(
|
|
266
|
+
y,
|
|
267
267
|
B
|
|
268
268
|
);
|
|
269
269
|
a.translateContainer({
|
|
270
|
-
startY:
|
|
271
|
-
endY:
|
|
270
|
+
startY: l,
|
|
271
|
+
endY: l - L,
|
|
272
272
|
animationFrame: o,
|
|
273
273
|
bottomSheetContainer: n
|
|
274
274
|
});
|
|
275
275
|
return;
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
|
-
const
|
|
278
|
+
const S = Et(
|
|
279
279
|
p,
|
|
280
|
-
|
|
280
|
+
w,
|
|
281
281
|
e.marginTop
|
|
282
282
|
);
|
|
283
283
|
a.translateContainer({
|
|
284
|
-
startY:
|
|
285
|
-
endY:
|
|
284
|
+
startY: l,
|
|
285
|
+
endY: S,
|
|
286
286
|
animationFrame: o,
|
|
287
287
|
bottomSheetContainer: n
|
|
288
288
|
});
|
|
289
|
-
} else if (
|
|
289
|
+
} else if (f.isDown) {
|
|
290
290
|
const c = [...e.snapPoints].sort(
|
|
291
|
-
(
|
|
291
|
+
(y, S) => S - y
|
|
292
292
|
);
|
|
293
|
-
for (const
|
|
294
|
-
const
|
|
295
|
-
if (
|
|
296
|
-
const B =
|
|
297
|
-
|
|
298
|
-
|
|
293
|
+
for (const y of c) {
|
|
294
|
+
const S = y * window.innerHeight, k = w + -l;
|
|
295
|
+
if (k >= S) {
|
|
296
|
+
const B = V(
|
|
297
|
+
k,
|
|
298
|
+
S
|
|
299
299
|
);
|
|
300
300
|
a.translateContainer({
|
|
301
|
-
startY:
|
|
302
|
-
endY:
|
|
301
|
+
startY: l,
|
|
302
|
+
endY: l + B,
|
|
303
303
|
animationFrame: o,
|
|
304
304
|
bottomSheetContainer: n
|
|
305
305
|
});
|
|
306
306
|
return;
|
|
307
307
|
}
|
|
308
308
|
}
|
|
309
|
+
if (e.preventClosing) {
|
|
310
|
+
const y = w + -l;
|
|
311
|
+
if (y >= w) {
|
|
312
|
+
const S = V(y, w);
|
|
313
|
+
a.translateContainer({
|
|
314
|
+
startY: l,
|
|
315
|
+
endY: l + S,
|
|
316
|
+
animationFrame: o,
|
|
317
|
+
bottomSheetContainer: n
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
309
322
|
i();
|
|
310
323
|
}
|
|
311
324
|
};
|
|
312
|
-
var
|
|
325
|
+
var G = /* @__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))(G || {});
|
|
313
326
|
function mt(t) {
|
|
314
327
|
switch (t) {
|
|
315
328
|
case 0:
|
|
@@ -324,17 +337,17 @@ function mt(t) {
|
|
|
324
337
|
return -1;
|
|
325
338
|
}
|
|
326
339
|
}
|
|
327
|
-
const
|
|
328
|
-
eventPhase:
|
|
340
|
+
const _t = {
|
|
341
|
+
eventPhase: G.All
|
|
329
342
|
};
|
|
330
|
-
class
|
|
343
|
+
class W {
|
|
331
344
|
constructor(n) {
|
|
332
345
|
j(this, "currentTarget");
|
|
333
346
|
this.currentTarget = n;
|
|
334
347
|
}
|
|
335
348
|
addEventListeners({
|
|
336
349
|
onStart: n,
|
|
337
|
-
onStartOptions: e =
|
|
350
|
+
onStartOptions: e = _t,
|
|
338
351
|
onMove: r,
|
|
339
352
|
onEnd: o
|
|
340
353
|
}) {
|
|
@@ -349,7 +362,7 @@ class G {
|
|
|
349
362
|
n && this.currentTarget.addEventListener(
|
|
350
363
|
"touchstart",
|
|
351
364
|
(i) => {
|
|
352
|
-
if (e.eventPhase ===
|
|
365
|
+
if (e.eventPhase === G.All) {
|
|
353
366
|
n(i);
|
|
354
367
|
return;
|
|
355
368
|
}
|
|
@@ -369,7 +382,7 @@ class G {
|
|
|
369
382
|
n && this.currentTarget.addEventListener(
|
|
370
383
|
"mousedown",
|
|
371
384
|
(i) => {
|
|
372
|
-
if (e.eventPhase ===
|
|
385
|
+
if (e.eventPhase === G.All) {
|
|
373
386
|
n(i);
|
|
374
387
|
return;
|
|
375
388
|
}
|
|
@@ -425,82 +438,87 @@ function Ht(t) {
|
|
|
425
438
|
return `${n} ${n} 0px 0px`;
|
|
426
439
|
}
|
|
427
440
|
function jt(t, n) {
|
|
428
|
-
const e =
|
|
429
|
-
|
|
441
|
+
const e = Ut(t);
|
|
442
|
+
Wt(e), e.bottomSheetContainer.style.width = t.width;
|
|
430
443
|
const r = document.createElement("div");
|
|
431
444
|
r.innerHTML = t.content ?? "";
|
|
432
445
|
const o = window.innerHeight;
|
|
433
446
|
e.bottomSheetContainer.style.maxHeight = `${o}px`, e.bottomSheetContentWrapper.appendChild(r);
|
|
434
|
-
const i =
|
|
447
|
+
const i = Vt({
|
|
435
448
|
bottomSheetElements: e,
|
|
436
449
|
bottomSheetProps: t,
|
|
437
450
|
options: n
|
|
438
451
|
});
|
|
439
|
-
return t.rootStyle && Object.assign(e.bottomSheetRoot.style, t.rootStyle), t.backdropStyle && Object.assign(e.bottomSheetBackdrop.style, t.backdropStyle), t.
|
|
452
|
+
return t.rootStyle && Object.assign(e.bottomSheetRoot.style, t.rootStyle), t.backdropStyle && Object.assign(e.bottomSheetBackdrop.style, t.backdropStyle), t.containerGapFillerStyle && Object.assign(e.bottomSheetContainer.style, t.containerStyle), t.containerStyle && Object.assign(
|
|
453
|
+
e.bottomSheetContainerGapFiller.style,
|
|
454
|
+
t.containerGapFillerStyle
|
|
455
|
+
), t.handleStyle && Object.assign(e.bottomSheetHandleBar.style, t.handleStyle), t.contentWrapperStyle && Object.assign(
|
|
440
456
|
e.bottomSheetContentWrapper.style,
|
|
441
457
|
t.contentWrapperStyle
|
|
442
458
|
), { elements: e, eventHandlers: i };
|
|
443
459
|
}
|
|
444
|
-
function
|
|
460
|
+
function Ut(t) {
|
|
445
461
|
const n = x(
|
|
446
462
|
"dialog",
|
|
447
463
|
M([
|
|
448
|
-
|
|
464
|
+
T.Root,
|
|
449
465
|
ot.Dialog,
|
|
450
466
|
t.rootClass
|
|
451
467
|
]),
|
|
452
|
-
|
|
468
|
+
T.Root
|
|
453
469
|
);
|
|
454
470
|
n.ariaLabel = t.ariaLabel;
|
|
455
471
|
const e = x(
|
|
456
472
|
"section",
|
|
457
|
-
M([
|
|
458
|
-
|
|
473
|
+
M([T.Container, t.containerClass]),
|
|
474
|
+
T.Container
|
|
459
475
|
);
|
|
460
476
|
t.containerBorderRadius && (e.style.borderRadius = Ht(
|
|
461
477
|
t.containerBorderRadius
|
|
462
478
|
));
|
|
463
479
|
const r = x(
|
|
464
480
|
"div",
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
)
|
|
481
|
+
T.GapFiller,
|
|
482
|
+
T.GapFiller
|
|
483
|
+
);
|
|
484
|
+
t.containerBackgroundColor && (e.style.backgroundColor = t.containerBackgroundColor, r.style.backgroundColor = t.containerBackgroundColor);
|
|
485
|
+
const o = x(
|
|
468
486
|
"button",
|
|
469
487
|
M([
|
|
470
|
-
|
|
488
|
+
T.Handle,
|
|
471
489
|
ot.Button,
|
|
472
|
-
t.shouldShowHandle ? null :
|
|
490
|
+
t.shouldShowHandle ? null : K.Hidden,
|
|
473
491
|
t.handleClass
|
|
474
492
|
]),
|
|
475
|
-
|
|
493
|
+
T.Handle
|
|
476
494
|
);
|
|
477
495
|
o.setAttribute("type", "button"), o.ariaLabel = "bottom sheet close button";
|
|
478
496
|
const i = x(
|
|
479
497
|
"span",
|
|
480
498
|
M([
|
|
481
|
-
|
|
482
|
-
t.shouldShowHandle ? null :
|
|
499
|
+
T.HandleBar,
|
|
500
|
+
t.shouldShowHandle ? null : K.Hidden
|
|
483
501
|
]),
|
|
484
|
-
|
|
502
|
+
T.HandleBar
|
|
485
503
|
), a = x(
|
|
486
504
|
"article",
|
|
487
505
|
M([
|
|
488
|
-
|
|
506
|
+
T.ContentWrapper,
|
|
489
507
|
t.contentWrapperClass
|
|
490
508
|
]),
|
|
491
|
-
|
|
492
|
-
),
|
|
509
|
+
T.ContentWrapper
|
|
510
|
+
), u = x(
|
|
493
511
|
"div",
|
|
494
512
|
M([
|
|
495
|
-
|
|
513
|
+
T.Backdrop,
|
|
496
514
|
t.backdropClass,
|
|
497
|
-
|
|
515
|
+
K.Hidden
|
|
498
516
|
]),
|
|
499
|
-
|
|
517
|
+
T.Backdrop
|
|
500
518
|
);
|
|
501
|
-
return t.backdropColor && (
|
|
519
|
+
return t.backdropColor && (u.style.backgroundColor = t.backdropColor), t.backDropTransition && (u.style.transition = t.backDropTransition), {
|
|
502
520
|
bottomSheetRoot: n,
|
|
503
|
-
bottomSheetBackdrop:
|
|
521
|
+
bottomSheetBackdrop: u,
|
|
504
522
|
bottomSheetContainer: e,
|
|
505
523
|
bottomSheetHandle: o,
|
|
506
524
|
bottomSheetHandleBar: i,
|
|
@@ -508,7 +526,7 @@ function Wt(t) {
|
|
|
508
526
|
bottomSheetContainerGapFiller: r
|
|
509
527
|
};
|
|
510
528
|
}
|
|
511
|
-
function
|
|
529
|
+
function Wt({
|
|
512
530
|
bottomSheetRoot: t,
|
|
513
531
|
bottomSheetContainer: n,
|
|
514
532
|
bottomSheetHandle: e,
|
|
@@ -518,7 +536,7 @@ function Gt({
|
|
|
518
536
|
}) {
|
|
519
537
|
t.appendChild(n), e.appendChild(r), n.appendChild(e), n.appendChild(o), n.appendChild(i);
|
|
520
538
|
}
|
|
521
|
-
function
|
|
539
|
+
function Vt({
|
|
522
540
|
bottomSheetElements: t,
|
|
523
541
|
bottomSheetProps: n,
|
|
524
542
|
options: e
|
|
@@ -528,35 +546,35 @@ function $t({
|
|
|
528
546
|
bottomSheetContainer: o,
|
|
529
547
|
bottomSheetHandle: i,
|
|
530
548
|
bottomSheetContainerGapFiller: a,
|
|
531
|
-
bottomSheetContentWrapper:
|
|
549
|
+
bottomSheetContentWrapper: u,
|
|
532
550
|
bottomSheetBackdrop: s
|
|
533
|
-
} = t, { animationFrame: b } = e,
|
|
534
|
-
|
|
535
|
-
), p = new
|
|
551
|
+
} = t, { animationFrame: b } = e, l = new W(i), f = new W(
|
|
552
|
+
u
|
|
553
|
+
), p = new W(
|
|
536
554
|
a
|
|
537
|
-
),
|
|
538
|
-
(E,
|
|
539
|
-
const
|
|
540
|
-
if (!
|
|
555
|
+
), w = n.dragTriggers.reduce(
|
|
556
|
+
(E, O) => {
|
|
557
|
+
const C = r.querySelectorAll(O);
|
|
558
|
+
if (!C.length)
|
|
541
559
|
return E;
|
|
542
|
-
const
|
|
543
|
-
return [...E, ...
|
|
560
|
+
const F = Array.from(C).map((d) => d instanceof HTMLElement ? new W(d) : null).filter((d) => !!d);
|
|
561
|
+
return [...E, ...F];
|
|
544
562
|
},
|
|
545
563
|
[]
|
|
546
|
-
), c = new
|
|
564
|
+
), c = new W(
|
|
547
565
|
window
|
|
548
|
-
),
|
|
566
|
+
), y = Mt(
|
|
549
567
|
c,
|
|
550
568
|
o,
|
|
551
569
|
n,
|
|
552
570
|
e.draggingState
|
|
553
|
-
),
|
|
571
|
+
), S = Pt(
|
|
554
572
|
c,
|
|
555
573
|
o,
|
|
556
574
|
n,
|
|
557
575
|
e.draggingState,
|
|
558
576
|
b
|
|
559
|
-
),
|
|
577
|
+
), k = Gt(
|
|
560
578
|
c,
|
|
561
579
|
o,
|
|
562
580
|
n,
|
|
@@ -569,97 +587,97 @@ function $t({
|
|
|
569
587
|
E.target instanceof Element && !r.contains(E.target) && e.onClose();
|
|
570
588
|
}
|
|
571
589
|
function L(E) {
|
|
572
|
-
|
|
590
|
+
Ft(
|
|
573
591
|
e.draggingState,
|
|
574
592
|
E.target,
|
|
575
593
|
t.bottomSheetContentWrapper
|
|
576
594
|
);
|
|
577
595
|
}
|
|
578
596
|
function N(E) {
|
|
579
|
-
const
|
|
580
|
-
|
|
597
|
+
const O = E ?? n;
|
|
598
|
+
O.draggable && (l.addEventListeners({
|
|
581
599
|
onStart: L
|
|
582
|
-
}),
|
|
583
|
-
|
|
600
|
+
}), w.forEach((C) => {
|
|
601
|
+
C.addEventListeners({
|
|
584
602
|
onStart: L,
|
|
585
603
|
onStartOptions: {
|
|
586
|
-
eventPhase:
|
|
604
|
+
eventPhase: G.Target
|
|
587
605
|
}
|
|
588
606
|
});
|
|
589
|
-
})),
|
|
607
|
+
})), O.draggable && O.backgroundDraggable && (f.addEventListeners({
|
|
590
608
|
onStart: L,
|
|
591
609
|
onStartOptions: {
|
|
592
|
-
eventPhase:
|
|
610
|
+
eventPhase: G.Target
|
|
593
611
|
}
|
|
594
612
|
}), p.addEventListeners({
|
|
595
613
|
onStart: L
|
|
596
|
-
})),
|
|
597
|
-
onStart:
|
|
598
|
-
onMove:
|
|
599
|
-
onEnd:
|
|
600
|
-
}),
|
|
601
|
-
|
|
602
|
-
}), i.addEventListener("keyup", (
|
|
603
|
-
if (
|
|
614
|
+
})), O.draggable && c.addEventListeners({
|
|
615
|
+
onStart: y,
|
|
616
|
+
onMove: S,
|
|
617
|
+
onEnd: k
|
|
618
|
+
}), O.draggable && window.document.addEventListener("keyup", (C) => {
|
|
619
|
+
C.key === "Escape" && e.onClose();
|
|
620
|
+
}), i.addEventListener("keyup", (C) => {
|
|
621
|
+
if (C.key === "ArrowUp") {
|
|
604
622
|
e.moveUp();
|
|
605
623
|
return;
|
|
606
624
|
}
|
|
607
|
-
if (
|
|
625
|
+
if (C.key === "ArrowDown") {
|
|
608
626
|
e.moveDown();
|
|
609
627
|
return;
|
|
610
628
|
}
|
|
611
|
-
if (
|
|
612
|
-
const
|
|
629
|
+
if (C.shiftKey && C.key === "Tab") {
|
|
630
|
+
const F = nt(
|
|
613
631
|
t.bottomSheetContentWrapper
|
|
614
632
|
);
|
|
615
|
-
Yt(
|
|
633
|
+
Yt(F);
|
|
616
634
|
}
|
|
617
635
|
});
|
|
618
636
|
}
|
|
619
|
-
function
|
|
637
|
+
function X() {
|
|
620
638
|
n.shouldCloseOnOutsideClick ? s.addEventListener("click", B) : s.style.pointerEvents = "none";
|
|
621
639
|
}
|
|
622
640
|
function tt() {
|
|
623
641
|
s.removeEventListener("click", B);
|
|
624
642
|
}
|
|
625
643
|
function nt(E) {
|
|
626
|
-
let
|
|
627
|
-
for (;
|
|
628
|
-
const
|
|
629
|
-
if (It(
|
|
630
|
-
return
|
|
631
|
-
|
|
632
|
-
...
|
|
633
|
-
...Array.from(
|
|
644
|
+
let O = [...Array.from(E.childNodes).reverse()];
|
|
645
|
+
for (; O.length; ) {
|
|
646
|
+
const C = O.shift();
|
|
647
|
+
if (It(C))
|
|
648
|
+
return C;
|
|
649
|
+
C && (O = [
|
|
650
|
+
...O,
|
|
651
|
+
...Array.from(C.childNodes).reverse()
|
|
634
652
|
]);
|
|
635
653
|
}
|
|
636
654
|
return null;
|
|
637
655
|
}
|
|
638
|
-
function
|
|
639
|
-
|
|
656
|
+
function z() {
|
|
657
|
+
l.removeEventListeners({
|
|
640
658
|
onStart: L
|
|
641
|
-
}),
|
|
659
|
+
}), f.removeEventListeners({
|
|
642
660
|
onStart: L
|
|
643
661
|
}), p.removeEventListeners({
|
|
644
662
|
onStart: L
|
|
645
|
-
}),
|
|
663
|
+
}), w.forEach((E) => {
|
|
646
664
|
E.removeEventListeners({
|
|
647
665
|
onStart: L
|
|
648
666
|
});
|
|
649
667
|
}), c.removeEventListeners({
|
|
650
|
-
onStart:
|
|
651
|
-
onMove:
|
|
652
|
-
onEnd:
|
|
668
|
+
onStart: y,
|
|
669
|
+
onMove: S,
|
|
670
|
+
onEnd: k
|
|
653
671
|
});
|
|
654
672
|
}
|
|
655
673
|
return {
|
|
656
674
|
attachEventListeners: N,
|
|
657
|
-
clearEventListeners:
|
|
658
|
-
attacheOnOpenEventListeners:
|
|
675
|
+
clearEventListeners: z,
|
|
676
|
+
attacheOnOpenEventListeners: X,
|
|
659
677
|
clearOnOpenEventListeners: tt
|
|
660
678
|
};
|
|
661
679
|
}
|
|
662
|
-
class
|
|
680
|
+
class $t {
|
|
663
681
|
constructor() {
|
|
664
682
|
j(this, "animationId");
|
|
665
683
|
j(this, "isInProgress");
|
|
@@ -692,15 +710,15 @@ function Xt(t) {
|
|
|
692
710
|
animationFrame: o,
|
|
693
711
|
onEnd: i,
|
|
694
712
|
animationTimingFunction: a,
|
|
695
|
-
animationDuration:
|
|
696
|
-
} = t, s =
|
|
713
|
+
animationDuration: u
|
|
714
|
+
} = t, s = Tt(n, e);
|
|
697
715
|
o.stop();
|
|
698
716
|
let b = !1;
|
|
699
|
-
o.start((
|
|
717
|
+
o.start((l) => {
|
|
700
718
|
Q(r, {
|
|
701
|
-
y: n + s * a(
|
|
702
|
-
}), !b &&
|
|
703
|
-
},
|
|
719
|
+
y: n + s * a(l)
|
|
720
|
+
}), !b && l >= 1 && (i == null || i(), b = !0);
|
|
721
|
+
}, u);
|
|
704
722
|
}
|
|
705
723
|
const st = (t, n) => (e) => {
|
|
706
724
|
Xt({
|
|
@@ -728,7 +746,7 @@ function Kt(t, n) {
|
|
|
728
746
|
function qt(...t) {
|
|
729
747
|
console.error(t);
|
|
730
748
|
}
|
|
731
|
-
const
|
|
749
|
+
const P = {
|
|
732
750
|
EASE: "ease",
|
|
733
751
|
EASE_IN: "ease-in",
|
|
734
752
|
EASE_OUT: "ease-out",
|
|
@@ -736,7 +754,7 @@ const F = {
|
|
|
736
754
|
SPRING: "spring"
|
|
737
755
|
};
|
|
738
756
|
function Jt(t) {
|
|
739
|
-
for (const n of Object.values(
|
|
757
|
+
for (const n of Object.values(P))
|
|
740
758
|
if (n === t)
|
|
741
759
|
return !0;
|
|
742
760
|
return !1;
|
|
@@ -744,40 +762,40 @@ function Jt(t) {
|
|
|
744
762
|
function Ot(t) {
|
|
745
763
|
return !!(t instanceof Object && "p1x" in t && "p1y" in t && "p2x" in t && "p2y" in t && Y(t.p1x) && Y(t.p1y) && Y(t.p2x) && Y(t.p2y));
|
|
746
764
|
}
|
|
747
|
-
function
|
|
765
|
+
function _(t, n, e, r) {
|
|
748
766
|
return function(s) {
|
|
749
|
-
return
|
|
767
|
+
return u(i(s));
|
|
750
768
|
};
|
|
751
769
|
function i(s) {
|
|
752
|
-
let b = 0,
|
|
770
|
+
let b = 0, l = 1, f = s, p;
|
|
753
771
|
if (s === 0 || s === 1)
|
|
754
772
|
return s;
|
|
755
|
-
for (; b <
|
|
756
|
-
if (p = a(
|
|
757
|
-
return
|
|
758
|
-
s > p ? b =
|
|
773
|
+
for (; b < l; ) {
|
|
774
|
+
if (p = a(f), Math.abs(p - s) < 1e-3)
|
|
775
|
+
return f;
|
|
776
|
+
s > p ? b = f : l = f, f = (l + b) / 2;
|
|
759
777
|
}
|
|
760
|
-
return
|
|
778
|
+
return f;
|
|
761
779
|
}
|
|
762
780
|
function a(s) {
|
|
763
781
|
return 3 * t * s * Math.pow(1 - s, 2) + 3 * e * Math.pow(s, 2) * (1 - s) + Math.pow(s, 3);
|
|
764
782
|
}
|
|
765
|
-
function
|
|
783
|
+
function u(s) {
|
|
766
784
|
return 3 * n * s * Math.pow(1 - s, 2) + 3 * r * Math.pow(s, 2) * (1 - s) + Math.pow(s, 3);
|
|
767
785
|
}
|
|
768
786
|
}
|
|
769
|
-
const bt =
|
|
787
|
+
const bt = _(0.25, 0.1, 0.25, 1), Qt = _(0.42, 0, 1, 1), kt = _(0.42, 0, 0.58, 1), Zt = _(0.4, 0.1, 0.6, 1), tn = _(0.45, 1.5, 0.55, 1);
|
|
770
788
|
function nn(t) {
|
|
771
789
|
switch (t) {
|
|
772
|
-
case
|
|
790
|
+
case P.EASE:
|
|
773
791
|
return bt;
|
|
774
|
-
case
|
|
792
|
+
case P.EASE_IN:
|
|
775
793
|
return Qt;
|
|
776
|
-
case
|
|
777
|
-
return
|
|
778
|
-
case
|
|
794
|
+
case P.EASE_OUT:
|
|
795
|
+
return kt;
|
|
796
|
+
case P.EASE_IN_OUT:
|
|
779
797
|
return Zt;
|
|
780
|
-
case
|
|
798
|
+
case P.SPRING:
|
|
781
799
|
return tn;
|
|
782
800
|
default:
|
|
783
801
|
return bt;
|
|
@@ -809,6 +827,7 @@ const en = {
|
|
|
809
827
|
onDragEnd: () => {
|
|
810
828
|
},
|
|
811
829
|
expandable: !0,
|
|
830
|
+
preventClosing: !1,
|
|
812
831
|
draggable: !0,
|
|
813
832
|
backgroundDraggable: !0,
|
|
814
833
|
shouldCloseOnOutsideClick: !0,
|
|
@@ -816,6 +835,7 @@ const en = {
|
|
|
816
835
|
shouldShowHandle: !0,
|
|
817
836
|
backDropTransition: null,
|
|
818
837
|
backdropColor: null,
|
|
838
|
+
containerBackgroundColor: null,
|
|
819
839
|
containerBorderRadius: null,
|
|
820
840
|
rootClass: null,
|
|
821
841
|
containerClass: null,
|
|
@@ -828,15 +848,16 @@ const en = {
|
|
|
828
848
|
containerStyle: {},
|
|
829
849
|
handleStyle: {},
|
|
830
850
|
contentWrapperStyle: {},
|
|
831
|
-
backdropStyle: {}
|
|
851
|
+
backdropStyle: {},
|
|
852
|
+
containerGapFillerStyle: {}
|
|
832
853
|
};
|
|
833
854
|
function rn(t) {
|
|
834
855
|
const n = {
|
|
835
856
|
...en
|
|
836
857
|
}, e = Object.entries(t).reduce(
|
|
837
858
|
(o, i) => {
|
|
838
|
-
const [a,
|
|
839
|
-
return at(
|
|
859
|
+
const [a, u] = i;
|
|
860
|
+
return at(u) && (o[a] = u), o;
|
|
840
861
|
},
|
|
841
862
|
{}
|
|
842
863
|
);
|
|
@@ -848,74 +869,77 @@ function rn(t) {
|
|
|
848
869
|
function ct(t) {
|
|
849
870
|
if (Ot(t)) {
|
|
850
871
|
const { p1x: n, p1y: e, p2x: r, p2y: o } = t;
|
|
851
|
-
return
|
|
872
|
+
return _(n, e, r, o);
|
|
852
873
|
}
|
|
853
|
-
return Jt(t) ? nn(t) :
|
|
874
|
+
return Jt(t) ? nn(t) : kt;
|
|
854
875
|
}
|
|
855
876
|
function on(t, n, e, r) {
|
|
856
877
|
function o(i, a) {
|
|
857
878
|
switch (i) {
|
|
858
879
|
case "content":
|
|
859
|
-
|
|
880
|
+
H(a) && (t.bottomSheetContentWrapper.innerHTML = a);
|
|
860
881
|
break;
|
|
861
882
|
case "width":
|
|
862
|
-
|
|
883
|
+
H(a) && (t.bottomSheetContainer.style.width = a);
|
|
863
884
|
break;
|
|
864
885
|
case "shouldShowHandle":
|
|
865
|
-
pt(a) ||
|
|
886
|
+
pt(a) || q(t.bottomSheetHandle, !1);
|
|
866
887
|
break;
|
|
867
888
|
case "shouldShowBackdrop":
|
|
868
|
-
pt(a) ||
|
|
889
|
+
pt(a) || q(t.bottomSheetBackdrop, !1);
|
|
869
890
|
break;
|
|
870
891
|
case "containerBorderRadius":
|
|
871
|
-
|
|
892
|
+
H(a) && (t.bottomSheetContainer.style.borderRadius = Ht(a));
|
|
893
|
+
break;
|
|
894
|
+
case "containerBackgroundColor":
|
|
895
|
+
H(a) && (t.bottomSheetContainer.style.backgroundColor = a, t.bottomSheetContainerGapFiller.style.backgroundColor = a);
|
|
872
896
|
break;
|
|
873
897
|
case "backdropColor":
|
|
874
|
-
|
|
898
|
+
H(a) && (t.bottomSheetBackdrop.style.backgroundColor = a);
|
|
875
899
|
break;
|
|
876
900
|
case "backDropTransition":
|
|
877
|
-
|
|
901
|
+
H(a) && (t.bottomSheetBackdrop.style.transition = a);
|
|
878
902
|
break;
|
|
879
903
|
case "rootClass":
|
|
880
|
-
if (!
|
|
904
|
+
if (!H(a))
|
|
881
905
|
return;
|
|
882
|
-
|
|
906
|
+
U(
|
|
883
907
|
t.bottomSheetRoot,
|
|
884
908
|
e.rootClass,
|
|
885
909
|
a
|
|
886
910
|
);
|
|
887
911
|
break;
|
|
888
912
|
case "containerClass":
|
|
889
|
-
if (!
|
|
913
|
+
if (!H(a))
|
|
890
914
|
return;
|
|
891
|
-
|
|
915
|
+
U(
|
|
892
916
|
t.bottomSheetContainer,
|
|
893
917
|
e.containerClass,
|
|
894
918
|
a
|
|
895
919
|
);
|
|
896
920
|
break;
|
|
897
921
|
case "handleClass":
|
|
898
|
-
if (!
|
|
922
|
+
if (!H(a))
|
|
899
923
|
return;
|
|
900
|
-
|
|
924
|
+
U(
|
|
901
925
|
t.bottomSheetHandle,
|
|
902
926
|
e.handleClass,
|
|
903
927
|
a
|
|
904
928
|
);
|
|
905
929
|
break;
|
|
906
930
|
case "contentWrapperClass":
|
|
907
|
-
if (!
|
|
931
|
+
if (!H(a))
|
|
908
932
|
return;
|
|
909
|
-
|
|
933
|
+
U(
|
|
910
934
|
t.bottomSheetContentWrapper,
|
|
911
935
|
e.contentWrapperClass,
|
|
912
936
|
a
|
|
913
937
|
);
|
|
914
938
|
break;
|
|
915
939
|
case "backdropClass":
|
|
916
|
-
if (!
|
|
940
|
+
if (!H(a))
|
|
917
941
|
return;
|
|
918
|
-
|
|
942
|
+
U(
|
|
919
943
|
t.bottomSheetBackdrop,
|
|
920
944
|
e.backdropClass,
|
|
921
945
|
a
|
|
@@ -924,13 +948,16 @@ function on(t, n, e, r) {
|
|
|
924
948
|
case "expandable":
|
|
925
949
|
r.clearEventListeners(), r.attachEventListeners(e);
|
|
926
950
|
break;
|
|
951
|
+
case "preventClosing":
|
|
952
|
+
r.clearEventListeners(), r.attachEventListeners(e);
|
|
953
|
+
break;
|
|
927
954
|
case "draggable":
|
|
928
955
|
r.clearEventListeners(), r.attachEventListeners(e);
|
|
929
956
|
break;
|
|
930
957
|
case "draggingAnimationTimings":
|
|
931
958
|
if (Ot(a)) {
|
|
932
|
-
const
|
|
933
|
-
|
|
959
|
+
const u = ct(a), s = st(
|
|
960
|
+
u,
|
|
934
961
|
e.draggingAnimationDuration
|
|
935
962
|
);
|
|
936
963
|
n.translateContainer = s;
|
|
@@ -938,10 +965,10 @@ function on(t, n, e, r) {
|
|
|
938
965
|
break;
|
|
939
966
|
case "draggingAnimationDuration":
|
|
940
967
|
if (Y(a)) {
|
|
941
|
-
const
|
|
968
|
+
const u = ct(
|
|
942
969
|
e.draggingAnimationTimings
|
|
943
970
|
), s = st(
|
|
944
|
-
|
|
971
|
+
u,
|
|
945
972
|
a
|
|
946
973
|
);
|
|
947
974
|
n.translateContainer = s;
|
|
@@ -965,6 +992,12 @@ function on(t, n, e, r) {
|
|
|
965
992
|
e.containerStyle
|
|
966
993
|
);
|
|
967
994
|
break;
|
|
995
|
+
case "containerGapFillerStyle":
|
|
996
|
+
e.containerGapFillerStyle && Object.assign(
|
|
997
|
+
t.bottomSheetContainerGapFiller.style,
|
|
998
|
+
e.containerGapFillerStyle
|
|
999
|
+
);
|
|
1000
|
+
break;
|
|
968
1001
|
case "handleStyle":
|
|
969
1002
|
e.handleStyle && Object.assign(
|
|
970
1003
|
t.bottomSheetHandleBar.style,
|
|
@@ -1003,77 +1036,77 @@ function cn(t) {
|
|
|
1003
1036
|
function a() {
|
|
1004
1037
|
i.originalDocumentOverflowY && i.originalDocumentOverflowY !== "hidden" && (document.body.style.overflowY = i.originalDocumentOverflowY), i.originalDocumentOverscrollBehavior && (document.body.style.position = i.originalDocumentOverscrollBehavior);
|
|
1005
1038
|
}
|
|
1006
|
-
const
|
|
1007
|
-
animationFrame:
|
|
1039
|
+
const u = new $t(), s = {
|
|
1040
|
+
animationFrame: u,
|
|
1008
1041
|
onClose: B,
|
|
1009
1042
|
bottomSheetState: o,
|
|
1010
1043
|
draggingState: i,
|
|
1011
|
-
snapTo:
|
|
1012
|
-
moveUp:
|
|
1013
|
-
moveDown:
|
|
1014
|
-
}, { elements: b, eventHandlers:
|
|
1044
|
+
snapTo: F,
|
|
1045
|
+
moveUp: O,
|
|
1046
|
+
moveDown: C
|
|
1047
|
+
}, { elements: b, eventHandlers: l } = jt(
|
|
1015
1048
|
n,
|
|
1016
1049
|
s
|
|
1017
|
-
),
|
|
1050
|
+
), f = Kt(
|
|
1018
1051
|
n,
|
|
1019
1052
|
on(
|
|
1020
1053
|
b,
|
|
1021
1054
|
o,
|
|
1022
1055
|
n,
|
|
1023
|
-
|
|
1056
|
+
l
|
|
1024
1057
|
)
|
|
1025
|
-
), { bottomSheetBackdrop: p, bottomSheetRoot:
|
|
1026
|
-
const g =
|
|
1027
|
-
g.appendChild(
|
|
1058
|
+
), { bottomSheetBackdrop: p, bottomSheetRoot: w, bottomSheetContainer: c } = b, y = (d) => {
|
|
1059
|
+
const g = d ?? window.document.body;
|
|
1060
|
+
g.appendChild(w), g.appendChild(p);
|
|
1028
1061
|
const h = window.innerHeight;
|
|
1029
1062
|
Q(c, {
|
|
1030
1063
|
y: h
|
|
1031
|
-
}),
|
|
1032
|
-
},
|
|
1033
|
-
|
|
1034
|
-
|
|
1064
|
+
}), l.attachEventListeners(), o.isMounted = !0;
|
|
1065
|
+
}, S = () => {
|
|
1066
|
+
l.clearEventListeners(), Object.values(b).forEach((d) => {
|
|
1067
|
+
d.remove();
|
|
1035
1068
|
}), a(), o.isMounted = !1;
|
|
1036
|
-
},
|
|
1069
|
+
}, k = () => {
|
|
1037
1070
|
var D;
|
|
1038
1071
|
if (L() || qt(
|
|
1039
1072
|
'Bottom Sheet is not mounted yet. call the "mount" method first.'
|
|
1040
1073
|
), (D = t.beforeOpen) == null || D.call(t), N())
|
|
1041
1074
|
return;
|
|
1042
|
-
et(p, !0),
|
|
1075
|
+
et(p, !0), f.shouldShowBackdrop || $(p, "transparent"), et([c], !0), Q(c, {
|
|
1043
1076
|
y: c.clientHeight
|
|
1044
1077
|
});
|
|
1045
1078
|
const g = window.innerHeight, h = dt(
|
|
1046
1079
|
g,
|
|
1047
1080
|
c.clientHeight,
|
|
1048
|
-
|
|
1049
|
-
|
|
1081
|
+
f.marginTop,
|
|
1082
|
+
f.defaultPosition
|
|
1050
1083
|
), m = I(c).y;
|
|
1051
1084
|
o.translateContainer({
|
|
1052
1085
|
startY: m,
|
|
1053
1086
|
endY: h,
|
|
1054
|
-
animationFrame:
|
|
1087
|
+
animationFrame: u,
|
|
1055
1088
|
bottomSheetContainer: c,
|
|
1056
1089
|
onEnd: t.afterOpen
|
|
1057
1090
|
});
|
|
1058
1091
|
const v = document.body.style.overflowY;
|
|
1059
1092
|
i.originalDocumentOverflowY = v || "initial";
|
|
1060
|
-
const
|
|
1061
|
-
i.originalDocumentOverscrollBehavior =
|
|
1093
|
+
const A = document.body.style.overscrollBehavior;
|
|
1094
|
+
i.originalDocumentOverscrollBehavior = A || "initial", document.body.style.overflow = "hidden", document.body.style.overscrollBehavior = "contain", b.bottomSheetHandle.focus(), l.attacheOnOpenEventListeners();
|
|
1062
1095
|
};
|
|
1063
1096
|
function B() {
|
|
1064
1097
|
var h;
|
|
1065
|
-
if (
|
|
1098
|
+
if (X())
|
|
1066
1099
|
return;
|
|
1067
1100
|
(h = t.beforeClose) == null || h.call(t);
|
|
1068
|
-
const
|
|
1101
|
+
const d = I(c).y, g = c.clientHeight;
|
|
1069
1102
|
o.translateContainer({
|
|
1070
|
-
startY:
|
|
1103
|
+
startY: d,
|
|
1071
1104
|
endY: g,
|
|
1072
|
-
animationFrame:
|
|
1105
|
+
animationFrame: u,
|
|
1073
1106
|
bottomSheetContainer: c,
|
|
1074
1107
|
onEnd: () => {
|
|
1075
1108
|
var m;
|
|
1076
|
-
(m = t.afterClose) == null || m.call(t), et([p, c], !1),
|
|
1109
|
+
(m = t.afterClose) == null || m.call(t), et([p, c], !1), l.clearOnOpenEventListeners();
|
|
1077
1110
|
}
|
|
1078
1111
|
}), a();
|
|
1079
1112
|
}
|
|
@@ -1081,45 +1114,45 @@ function cn(t) {
|
|
|
1081
1114
|
return o.isMounted;
|
|
1082
1115
|
}
|
|
1083
1116
|
function N() {
|
|
1084
|
-
const
|
|
1085
|
-
return
|
|
1117
|
+
const d = I(c).y, g = window.innerHeight, h = c.clientHeight >= g ? g : c.clientHeight;
|
|
1118
|
+
return d <= h;
|
|
1086
1119
|
}
|
|
1087
|
-
function
|
|
1120
|
+
function X() {
|
|
1088
1121
|
return !N();
|
|
1089
1122
|
}
|
|
1090
1123
|
function tt() {
|
|
1091
|
-
const
|
|
1092
|
-
if (
|
|
1124
|
+
const d = I(c).y, g = c.clientHeight, h = window.innerHeight;
|
|
1125
|
+
if (d <= 5 && d >= -5)
|
|
1093
1126
|
return R.CONTENT_HEIGHT;
|
|
1094
|
-
const m = g -
|
|
1127
|
+
const m = g - d;
|
|
1095
1128
|
if (m === h / 2)
|
|
1096
1129
|
return R.MIDDLE;
|
|
1097
|
-
const v = h -
|
|
1098
|
-
return m <= v +
|
|
1130
|
+
const v = h - f.marginTop, A = 10;
|
|
1131
|
+
return m <= v + A && m >= v - A ? R.TOP : R.CLOSED;
|
|
1099
1132
|
}
|
|
1100
1133
|
function nt() {
|
|
1101
1134
|
return c.clientHeight;
|
|
1102
1135
|
}
|
|
1103
|
-
function
|
|
1136
|
+
function z(d) {
|
|
1104
1137
|
if (!N())
|
|
1105
1138
|
return;
|
|
1106
|
-
const g = I(c).y, m = c.clientHeight - g, v = window.innerHeight -
|
|
1139
|
+
const g = I(c).y, m = c.clientHeight - g, v = window.innerHeight - d, A = xt(m, v), D = V(m, v);
|
|
1107
1140
|
o.translateContainer({
|
|
1108
1141
|
startY: g,
|
|
1109
|
-
endY: g + (
|
|
1110
|
-
animationFrame:
|
|
1142
|
+
endY: g + (A.isUp ? -D : D),
|
|
1143
|
+
animationFrame: u,
|
|
1111
1144
|
bottomSheetContainer: c
|
|
1112
1145
|
});
|
|
1113
1146
|
}
|
|
1114
|
-
function E(
|
|
1147
|
+
function E(d, {
|
|
1115
1148
|
viewportHeight: g,
|
|
1116
1149
|
visibleHeight: h
|
|
1117
1150
|
}) {
|
|
1118
1151
|
let m = null;
|
|
1119
|
-
for (const v of
|
|
1120
|
-
const
|
|
1152
|
+
for (const v of d) {
|
|
1153
|
+
const A = v * g, D = V(
|
|
1121
1154
|
h,
|
|
1122
|
-
|
|
1155
|
+
A
|
|
1123
1156
|
);
|
|
1124
1157
|
(m === null || D < m) && (m = D);
|
|
1125
1158
|
}
|
|
@@ -1127,28 +1160,28 @@ function cn(t) {
|
|
|
1127
1160
|
minOffset: m
|
|
1128
1161
|
};
|
|
1129
1162
|
}
|
|
1130
|
-
function
|
|
1131
|
-
const
|
|
1132
|
-
if (!
|
|
1163
|
+
function O() {
|
|
1164
|
+
const d = [...f.snapPoints].reverse(), g = I(c).y, h = c.clientHeight, m = h - g;
|
|
1165
|
+
if (!f.expandable && m >= h)
|
|
1133
1166
|
return;
|
|
1134
|
-
const v = window.innerHeight,
|
|
1167
|
+
const v = window.innerHeight, A = ft(
|
|
1135
1168
|
"above",
|
|
1136
1169
|
{ visibleHeight: m, viewportHeight: v },
|
|
1137
|
-
|
|
1138
|
-
), { minOffset: D } = E(
|
|
1170
|
+
d
|
|
1171
|
+
), { minOffset: D } = E(A, {
|
|
1139
1172
|
visibleHeight: m,
|
|
1140
1173
|
viewportHeight: v
|
|
1141
1174
|
});
|
|
1142
|
-
if (D === null && m < v -
|
|
1175
|
+
if (D === null && m < v - f.marginTop) {
|
|
1143
1176
|
o.translateContainer({
|
|
1144
1177
|
startY: g,
|
|
1145
1178
|
endY: dt(
|
|
1146
1179
|
v,
|
|
1147
1180
|
h,
|
|
1148
|
-
|
|
1181
|
+
f.marginTop,
|
|
1149
1182
|
"top"
|
|
1150
1183
|
),
|
|
1151
|
-
animationFrame:
|
|
1184
|
+
animationFrame: u,
|
|
1152
1185
|
bottomSheetContainer: c
|
|
1153
1186
|
});
|
|
1154
1187
|
return;
|
|
@@ -1156,50 +1189,50 @@ function cn(t) {
|
|
|
1156
1189
|
Y(D) && o.translateContainer({
|
|
1157
1190
|
startY: g,
|
|
1158
1191
|
endY: g - D,
|
|
1159
|
-
animationFrame:
|
|
1192
|
+
animationFrame: u,
|
|
1160
1193
|
bottomSheetContainer: c
|
|
1161
1194
|
});
|
|
1162
1195
|
}
|
|
1163
|
-
function
|
|
1164
|
-
const
|
|
1196
|
+
function C() {
|
|
1197
|
+
const d = I(c).y, h = c.clientHeight - d;
|
|
1165
1198
|
if (h < 1)
|
|
1166
1199
|
return;
|
|
1167
1200
|
const m = window.innerHeight, v = ft(
|
|
1168
1201
|
"below",
|
|
1169
1202
|
{ visibleHeight: h, viewportHeight: m },
|
|
1170
|
-
|
|
1171
|
-
), { minOffset:
|
|
1203
|
+
f.snapPoints
|
|
1204
|
+
), { minOffset: A } = E(v, {
|
|
1172
1205
|
visibleHeight: h,
|
|
1173
1206
|
viewportHeight: m
|
|
1174
1207
|
});
|
|
1175
|
-
Y(
|
|
1176
|
-
startY:
|
|
1177
|
-
endY:
|
|
1178
|
-
animationFrame:
|
|
1208
|
+
Y(A) && o.translateContainer({
|
|
1209
|
+
startY: d,
|
|
1210
|
+
endY: d + A,
|
|
1211
|
+
animationFrame: u,
|
|
1179
1212
|
bottomSheetContainer: c
|
|
1180
1213
|
});
|
|
1181
1214
|
}
|
|
1182
|
-
function
|
|
1215
|
+
function F(d) {
|
|
1183
1216
|
const g = window.innerHeight;
|
|
1184
|
-
if (!zt(
|
|
1217
|
+
if (!zt(d))
|
|
1185
1218
|
return;
|
|
1186
|
-
const h = J(g *
|
|
1187
|
-
|
|
1219
|
+
const h = J(g * d, 2);
|
|
1220
|
+
z(h);
|
|
1188
1221
|
}
|
|
1189
1222
|
return {
|
|
1190
|
-
props:
|
|
1223
|
+
props: f,
|
|
1191
1224
|
elements: b,
|
|
1192
|
-
mount:
|
|
1193
|
-
unmount:
|
|
1194
|
-
open:
|
|
1225
|
+
mount: y,
|
|
1226
|
+
unmount: S,
|
|
1227
|
+
open: k,
|
|
1195
1228
|
close: B,
|
|
1196
1229
|
getIsMounted: L,
|
|
1197
1230
|
getIsOpen: N,
|
|
1198
|
-
getIsClosed:
|
|
1231
|
+
getIsClosed: X,
|
|
1199
1232
|
getPosition: tt,
|
|
1200
1233
|
getHeight: nt,
|
|
1201
|
-
moveTo:
|
|
1202
|
-
snapTo:
|
|
1234
|
+
moveTo: z,
|
|
1235
|
+
snapTo: F
|
|
1203
1236
|
};
|
|
1204
1237
|
}
|
|
1205
1238
|
function ln() {
|
|
@@ -1239,11 +1272,11 @@ export {
|
|
|
1239
1272
|
en as BOTTOM_SHEET_DEFAULT_PROPS,
|
|
1240
1273
|
R as BOTTOM_SHEET_POSITION,
|
|
1241
1274
|
sn as BOTTOM_SHEET_SELECTORS,
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1275
|
+
P as COMMON_ANIMATION_KEYS,
|
|
1276
|
+
T as ClassNames,
|
|
1277
|
+
G as EventPhase,
|
|
1245
1278
|
ot as ResetClassNames,
|
|
1246
|
-
|
|
1279
|
+
K as UtilClassNames,
|
|
1247
1280
|
cn as createBottomSheet,
|
|
1248
1281
|
ln as createPlaceholderBottomSheet,
|
|
1249
1282
|
mt as eventPhaseToEnum,
|