@plainsheet/react 0.4.10 → 0.4.12
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/README.md +8 -7
- package/dist/index.d.ts +3 -2
- package/dist/plainsheet-react.cjs.js +1 -1
- package/dist/plainsheet-react.es.js +236 -243
- package/dist/plainsheet-react.umd.js +1 -1
- package/package.json +3 -3
|
@@ -1,19 +1,19 @@
|
|
|
1
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
|
|
3
|
-
function
|
|
2
|
+
import { createPortal as Ft } from "react-dom";
|
|
3
|
+
function It(t) {
|
|
4
4
|
return t != null;
|
|
5
5
|
}
|
|
6
6
|
(function() {
|
|
7
7
|
try {
|
|
8
8
|
if (typeof document < "u") {
|
|
9
9
|
var t = document.createElement("style");
|
|
10
|
-
t.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(t);
|
|
10
|
+
t.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;flex-shrink:0;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(t);
|
|
11
11
|
}
|
|
12
12
|
} catch (e) {
|
|
13
13
|
console.error("vite-plugin-css-injected-by-js", e);
|
|
14
14
|
}
|
|
15
15
|
})();
|
|
16
|
-
var
|
|
16
|
+
var Pt = Object.defineProperty, Rt = (t, e, n) => e in t ? Pt(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
17
|
function L(t) {
|
|
18
18
|
return typeof t == "string";
|
|
19
19
|
}
|
|
@@ -35,9 +35,6 @@ function nt(t) {
|
|
|
35
35
|
function R(t) {
|
|
36
36
|
return t.map((e) => nt(e)).filter(Boolean).join(" ");
|
|
37
37
|
}
|
|
38
|
-
function Nt(t) {
|
|
39
|
-
return t.map((e) => e == null ? void 0 : e.trim()).filter(Boolean).map((e) => `.${e}`).join(" ");
|
|
40
|
-
}
|
|
41
38
|
const pt = "open", ht = "hidden";
|
|
42
39
|
function ot(t, e) {
|
|
43
40
|
const n = e;
|
|
@@ -58,10 +55,10 @@ function Ct(t) {
|
|
|
58
55
|
function A(t) {
|
|
59
56
|
return typeof t == "number" && !Number.isNaN(t);
|
|
60
57
|
}
|
|
61
|
-
function
|
|
58
|
+
function Nt(t) {
|
|
62
59
|
Ct(t) && t.focus();
|
|
63
60
|
}
|
|
64
|
-
function
|
|
61
|
+
function jt(t) {
|
|
65
62
|
if (!Ct(t) || t.offsetParent === null || "disabled" in t && t.disabled)
|
|
66
63
|
return !1;
|
|
67
64
|
const e = t.getAttribute("tabindex"), n = A(e) ? parseInt(e, 10) : -1, o = [
|
|
@@ -75,17 +72,13 @@ function Gt(t) {
|
|
|
75
72
|
].includes(t.tagName), r = t instanceof HTMLAnchorElement && t.href !== "" || t instanceof HTMLAreaElement && t.href !== "";
|
|
76
73
|
return o || r || n > -1;
|
|
77
74
|
}
|
|
78
|
-
var
|
|
75
|
+
var H = /* @__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))(H || {}), st = /* @__PURE__ */ ((t) => (t.Button = "pbs-button-reset", t.Dialog = "pbs-dialog-reset", t))(st || {}), Q = /* @__PURE__ */ ((t) => (t.Hidden = "hidden", t))(Q || {});
|
|
79
76
|
function M(t, e, n) {
|
|
80
77
|
const o = document.createElement(t);
|
|
81
78
|
return e.split(" ").forEach((r) => {
|
|
82
79
|
K(o, r);
|
|
83
80
|
}), L(n) && o.setAttribute("data-testid", n), o;
|
|
84
81
|
}
|
|
85
|
-
Nt([
|
|
86
|
-
k.Root,
|
|
87
|
-
k.ContentWrapper
|
|
88
|
-
]);
|
|
89
82
|
function mt(t, e, n, o) {
|
|
90
83
|
switch (o) {
|
|
91
84
|
case "content-height":
|
|
@@ -112,7 +105,7 @@ function wt(t, e) {
|
|
|
112
105
|
function V(t, e) {
|
|
113
106
|
return t > e ? t - e : e - t;
|
|
114
107
|
}
|
|
115
|
-
function
|
|
108
|
+
function Gt(t, e) {
|
|
116
109
|
const n = t < e, o = t > e;
|
|
117
110
|
return {
|
|
118
111
|
isUp: n,
|
|
@@ -120,7 +113,7 @@ function Ut(t, e) {
|
|
|
120
113
|
stayedSame: t === e
|
|
121
114
|
};
|
|
122
115
|
}
|
|
123
|
-
function
|
|
116
|
+
function bt(t, e, n) {
|
|
124
117
|
const o = t === "above";
|
|
125
118
|
return n.filter((r) => {
|
|
126
119
|
const i = r * e.viewportHeight;
|
|
@@ -130,7 +123,7 @@ function ft(t, e, n) {
|
|
|
130
123
|
function kt(t, e, n) {
|
|
131
124
|
return -(t - e) + n;
|
|
132
125
|
}
|
|
133
|
-
function
|
|
126
|
+
function ft(t) {
|
|
134
127
|
return Number(t.replace("px", ""));
|
|
135
128
|
}
|
|
136
129
|
function tt(t, ...e) {
|
|
@@ -145,7 +138,7 @@ function Tt(t) {
|
|
|
145
138
|
}
|
|
146
139
|
return n;
|
|
147
140
|
}
|
|
148
|
-
function
|
|
141
|
+
function Ut(t) {
|
|
149
142
|
const e = t.style.transform, n = Tt(e);
|
|
150
143
|
return { transform: e, transformValues: n };
|
|
151
144
|
}
|
|
@@ -169,7 +162,7 @@ function et(t, { x: e, y: n }) {
|
|
|
169
162
|
const {
|
|
170
163
|
transform: o,
|
|
171
164
|
transformValues: r
|
|
172
|
-
} =
|
|
165
|
+
} = Ut(t), i = Ht(
|
|
173
166
|
r,
|
|
174
167
|
ct
|
|
175
168
|
);
|
|
@@ -191,8 +184,8 @@ function Ot(t) {
|
|
|
191
184
|
);
|
|
192
185
|
const e = t.values[0], n = t.values[1];
|
|
193
186
|
return {
|
|
194
|
-
x:
|
|
195
|
-
y:
|
|
187
|
+
x: ft(e) ?? 0,
|
|
188
|
+
y: ft(n) ?? 0
|
|
196
189
|
};
|
|
197
190
|
}
|
|
198
191
|
function lt(t) {
|
|
@@ -204,12 +197,12 @@ function gt(t, {
|
|
|
204
197
|
}) {
|
|
205
198
|
return lt(n) && t >= n ? n : lt(e) && t <= e ? e : t;
|
|
206
199
|
}
|
|
207
|
-
const
|
|
208
|
-
e instanceof HTMLElement && !Wt(e,
|
|
209
|
-
},
|
|
200
|
+
const $t = (t, e, n) => {
|
|
201
|
+
e instanceof HTMLElement && !Wt(e, H.Handle) && n.scrollTop >= 1 || (t.isDragging = !0);
|
|
202
|
+
}, _t = (t, e, n, o) => (r) => {
|
|
210
203
|
o.startY = t.getCoordinates(r).y, o.containerStartTranslate = D(e), n.onDragStart();
|
|
211
|
-
},
|
|
212
|
-
|
|
204
|
+
}, Xt = (t, e, n, o, r) => (i) => {
|
|
205
|
+
zt(
|
|
213
206
|
i,
|
|
214
207
|
t,
|
|
215
208
|
n,
|
|
@@ -219,23 +212,23 @@ const _t = (t, e, n) => {
|
|
|
219
212
|
n.marginTop
|
|
220
213
|
);
|
|
221
214
|
};
|
|
222
|
-
function
|
|
215
|
+
function zt(t, e, n, o, r, i, a) {
|
|
223
216
|
if (!o.isDragging || !A(o.startY))
|
|
224
217
|
return;
|
|
225
|
-
const l = e.getCoordinates(t).y, u = wt(o.startY, l), h = window.innerHeight,
|
|
226
|
-
if (
|
|
218
|
+
const l = e.getCoordinates(t).y, u = wt(o.startY, l), h = window.innerHeight, s = i.clientHeight, b = s - (o.containerStartTranslate.y + u);
|
|
219
|
+
if (b >= h)
|
|
227
220
|
return;
|
|
228
221
|
const y = Et(o.startY, l);
|
|
229
|
-
if (y.isUp && !n.expandable &&
|
|
222
|
+
if (y.isUp && !n.expandable && b >= s || n.preventClosing && b <= s)
|
|
230
223
|
return;
|
|
231
224
|
r.start(() => {
|
|
232
225
|
et(i, {
|
|
233
226
|
y: o.containerStartTranslate.y + u
|
|
234
227
|
});
|
|
235
228
|
}, 0);
|
|
236
|
-
const
|
|
229
|
+
const c = h - a, C = s - o.containerStartTranslate.y;
|
|
237
230
|
if (y.isUp) {
|
|
238
|
-
const v =
|
|
231
|
+
const v = c - C, S = c - b, E = gt(
|
|
239
232
|
1 - tt(S / v, 2),
|
|
240
233
|
{
|
|
241
234
|
min: 0,
|
|
@@ -246,7 +239,7 @@ function qt(t, e, n, o, r, i, a) {
|
|
|
246
239
|
} else if (y.isDown) {
|
|
247
240
|
const v = gt(
|
|
248
241
|
tt(
|
|
249
|
-
1 -
|
|
242
|
+
1 - b / C,
|
|
250
243
|
2
|
|
251
244
|
),
|
|
252
245
|
{
|
|
@@ -257,17 +250,17 @@ function qt(t, e, n, o, r, i, a) {
|
|
|
257
250
|
n.onDragMove(y, v);
|
|
258
251
|
}
|
|
259
252
|
}
|
|
260
|
-
const
|
|
253
|
+
const qt = (t, e, n, o, r, i, a) => (l) => {
|
|
261
254
|
if (!o.isDragging || (o.isDragging = !1, !A(o.startY)))
|
|
262
255
|
return;
|
|
263
256
|
n.onDragEnd();
|
|
264
|
-
const u = o.startY, h = t.getCoordinates(l).y,
|
|
265
|
-
if (
|
|
257
|
+
const u = o.startY, h = t.getCoordinates(l).y, s = D(e).y, b = Et(u, h), y = window.innerHeight, c = e.clientHeight;
|
|
258
|
+
if (b.isUp) {
|
|
259
|
+
if (!n.expandable)
|
|
260
|
+
return;
|
|
266
261
|
const C = [...n.snapPoints].sort(
|
|
267
262
|
(E, x) => E - x
|
|
268
|
-
), v =
|
|
269
|
-
if (!n.expandable && v >= s)
|
|
270
|
-
return;
|
|
263
|
+
), v = c + -s;
|
|
271
264
|
for (const E of C) {
|
|
272
265
|
const x = E * window.innerHeight;
|
|
273
266
|
if (v <= x) {
|
|
@@ -276,8 +269,8 @@ const Vt = (t, e, n, o, r, i, a) => (l) => {
|
|
|
276
269
|
x
|
|
277
270
|
);
|
|
278
271
|
a.translateContainer({
|
|
279
|
-
startY:
|
|
280
|
-
endY:
|
|
272
|
+
startY: s,
|
|
273
|
+
endY: s - w,
|
|
281
274
|
animationFrame: r,
|
|
282
275
|
bottomSheetContainer: e
|
|
283
276
|
});
|
|
@@ -286,29 +279,29 @@ const Vt = (t, e, n, o, r, i, a) => (l) => {
|
|
|
286
279
|
}
|
|
287
280
|
const S = kt(
|
|
288
281
|
y,
|
|
289
|
-
|
|
282
|
+
c,
|
|
290
283
|
n.marginTop
|
|
291
284
|
);
|
|
292
285
|
a.translateContainer({
|
|
293
|
-
startY:
|
|
286
|
+
startY: s,
|
|
294
287
|
endY: S,
|
|
295
288
|
animationFrame: r,
|
|
296
289
|
bottomSheetContainer: e
|
|
297
290
|
});
|
|
298
|
-
} else if (
|
|
291
|
+
} else if (b.isDown) {
|
|
299
292
|
const C = [...n.snapPoints].sort(
|
|
300
293
|
(v, S) => S - v
|
|
301
294
|
);
|
|
302
295
|
for (const v of C) {
|
|
303
|
-
const S = v * window.innerHeight, E =
|
|
296
|
+
const S = v * window.innerHeight, E = c + -s;
|
|
304
297
|
if (E >= S) {
|
|
305
298
|
const x = V(
|
|
306
299
|
E,
|
|
307
300
|
S
|
|
308
301
|
);
|
|
309
302
|
a.translateContainer({
|
|
310
|
-
startY:
|
|
311
|
-
endY:
|
|
303
|
+
startY: s,
|
|
304
|
+
endY: s + x,
|
|
312
305
|
animationFrame: r,
|
|
313
306
|
bottomSheetContainer: e
|
|
314
307
|
});
|
|
@@ -316,12 +309,12 @@ const Vt = (t, e, n, o, r, i, a) => (l) => {
|
|
|
316
309
|
}
|
|
317
310
|
}
|
|
318
311
|
if (n.preventClosing) {
|
|
319
|
-
const v =
|
|
320
|
-
if (v >=
|
|
321
|
-
const S = V(v,
|
|
312
|
+
const v = c + -s;
|
|
313
|
+
if (v >= c) {
|
|
314
|
+
const S = V(v, c);
|
|
322
315
|
a.translateContainer({
|
|
323
|
-
startY:
|
|
324
|
-
endY:
|
|
316
|
+
startY: s,
|
|
317
|
+
endY: s + S,
|
|
325
318
|
animationFrame: r,
|
|
326
319
|
bottomSheetContainer: e
|
|
327
320
|
});
|
|
@@ -346,7 +339,7 @@ function vt(t) {
|
|
|
346
339
|
return -1;
|
|
347
340
|
}
|
|
348
341
|
}
|
|
349
|
-
const
|
|
342
|
+
const Vt = {
|
|
350
343
|
eventPhase: j.All
|
|
351
344
|
};
|
|
352
345
|
class X {
|
|
@@ -355,7 +348,7 @@ class X {
|
|
|
355
348
|
}
|
|
356
349
|
addEventListeners({
|
|
357
350
|
onStart: e,
|
|
358
|
-
onStartOptions: n =
|
|
351
|
+
onStartOptions: n = Vt,
|
|
359
352
|
onMove: o,
|
|
360
353
|
onEnd: r
|
|
361
354
|
}) {
|
|
@@ -445,14 +438,14 @@ function Lt(t) {
|
|
|
445
438
|
const e = t;
|
|
446
439
|
return `${e} ${e} 0px 0px`;
|
|
447
440
|
}
|
|
448
|
-
function
|
|
449
|
-
const n =
|
|
450
|
-
|
|
441
|
+
function Kt(t, e) {
|
|
442
|
+
const n = Jt(t);
|
|
443
|
+
Qt(n), n.bottomSheetContainer.style.width = t.width;
|
|
451
444
|
const o = document.createElement("div");
|
|
452
445
|
o.innerHTML = t.content ?? "";
|
|
453
446
|
const r = window.innerHeight;
|
|
454
447
|
n.bottomSheetContainer.style.maxHeight = `${r}px`, n.bottomSheetContentWrapper.appendChild(o);
|
|
455
|
-
const i =
|
|
448
|
+
const i = Zt({
|
|
456
449
|
bottomSheetElements: n,
|
|
457
450
|
bottomSheetProps: t,
|
|
458
451
|
options: e
|
|
@@ -465,64 +458,64 @@ function Jt(t, e) {
|
|
|
465
458
|
t.contentWrapperStyle
|
|
466
459
|
), { elements: n, eventHandlers: i };
|
|
467
460
|
}
|
|
468
|
-
function
|
|
461
|
+
function Jt(t) {
|
|
469
462
|
const e = M(
|
|
470
463
|
"dialog",
|
|
471
464
|
R([
|
|
472
|
-
|
|
465
|
+
H.Root,
|
|
473
466
|
st.Dialog,
|
|
474
467
|
t.rootClass
|
|
475
468
|
]),
|
|
476
|
-
|
|
469
|
+
H.Root
|
|
477
470
|
);
|
|
478
471
|
e.ariaLabel = t.ariaLabel;
|
|
479
472
|
const n = M(
|
|
480
473
|
"section",
|
|
481
|
-
R([
|
|
482
|
-
|
|
474
|
+
R([H.Container, t.containerClass]),
|
|
475
|
+
H.Container
|
|
483
476
|
);
|
|
484
477
|
t.containerBorderRadius && (n.style.borderRadius = Lt(
|
|
485
478
|
t.containerBorderRadius
|
|
486
479
|
));
|
|
487
480
|
const o = M(
|
|
488
481
|
"div",
|
|
489
|
-
|
|
490
|
-
|
|
482
|
+
H.GapFiller,
|
|
483
|
+
H.GapFiller
|
|
491
484
|
);
|
|
492
485
|
t.containerBackgroundColor && (n.style.backgroundColor = t.containerBackgroundColor, o.style.backgroundColor = t.containerBackgroundColor);
|
|
493
486
|
const r = M(
|
|
494
487
|
"button",
|
|
495
488
|
R([
|
|
496
|
-
|
|
489
|
+
H.Handle,
|
|
497
490
|
st.Button,
|
|
498
491
|
t.shouldShowHandle ? null : Q.Hidden,
|
|
499
492
|
t.handleClass
|
|
500
493
|
]),
|
|
501
|
-
|
|
494
|
+
H.Handle
|
|
502
495
|
);
|
|
503
496
|
r.setAttribute("type", "button"), r.ariaLabel = "bottom sheet close button";
|
|
504
497
|
const i = M(
|
|
505
498
|
"span",
|
|
506
499
|
R([
|
|
507
|
-
|
|
500
|
+
H.HandleBar,
|
|
508
501
|
t.shouldShowHandle ? null : Q.Hidden
|
|
509
502
|
]),
|
|
510
|
-
|
|
503
|
+
H.HandleBar
|
|
511
504
|
), a = M(
|
|
512
505
|
"article",
|
|
513
506
|
R([
|
|
514
|
-
|
|
507
|
+
H.ContentWrapper,
|
|
515
508
|
t.contentWrapperClass
|
|
516
509
|
]),
|
|
517
|
-
|
|
510
|
+
H.ContentWrapper
|
|
518
511
|
), l = M(
|
|
519
512
|
"div",
|
|
520
513
|
R([
|
|
521
|
-
|
|
514
|
+
H.Backdrop,
|
|
522
515
|
t.backdropClass,
|
|
523
516
|
Q.Hidden
|
|
524
517
|
]),
|
|
525
|
-
|
|
518
|
+
H.Backdrop
|
|
526
519
|
);
|
|
527
520
|
return t.backdropColor && (l.style.backgroundColor = t.backdropColor), t.backDropTransition && (l.style.transition = t.backDropTransition), {
|
|
528
521
|
bottomSheetRoot: e,
|
|
@@ -534,7 +527,7 @@ function Qt(t) {
|
|
|
534
527
|
bottomSheetContainerGapFiller: o
|
|
535
528
|
};
|
|
536
529
|
}
|
|
537
|
-
function
|
|
530
|
+
function Qt({
|
|
538
531
|
bottomSheetRoot: t,
|
|
539
532
|
bottomSheetContainer: e,
|
|
540
533
|
bottomSheetHandle: n,
|
|
@@ -544,7 +537,7 @@ function Zt({
|
|
|
544
537
|
}) {
|
|
545
538
|
t.appendChild(e), n.appendChild(o), e.appendChild(n), e.appendChild(r), e.appendChild(i);
|
|
546
539
|
}
|
|
547
|
-
function
|
|
540
|
+
function Zt({
|
|
548
541
|
bottomSheetElements: t,
|
|
549
542
|
bottomSheetProps: e,
|
|
550
543
|
options: n
|
|
@@ -556,26 +549,26 @@ function te({
|
|
|
556
549
|
bottomSheetContainerGapFiller: a,
|
|
557
550
|
bottomSheetContentWrapper: l,
|
|
558
551
|
bottomSheetBackdrop: u
|
|
559
|
-
} = t, { animationFrame: h } = n,
|
|
552
|
+
} = t, { animationFrame: h } = n, s = new X(i), b = new X(
|
|
560
553
|
l
|
|
561
554
|
), y = new X(
|
|
562
555
|
a
|
|
563
556
|
);
|
|
564
|
-
let
|
|
557
|
+
let c = [];
|
|
565
558
|
const C = new X(
|
|
566
559
|
window
|
|
567
|
-
), v =
|
|
560
|
+
), v = _t(
|
|
568
561
|
C,
|
|
569
562
|
r,
|
|
570
563
|
e,
|
|
571
564
|
n.draggingState
|
|
572
|
-
), S =
|
|
565
|
+
), S = Xt(
|
|
573
566
|
C,
|
|
574
567
|
r,
|
|
575
568
|
e,
|
|
576
569
|
n.draggingState,
|
|
577
570
|
h
|
|
578
|
-
), E =
|
|
571
|
+
), E = qt(
|
|
579
572
|
C,
|
|
580
573
|
r,
|
|
581
574
|
e,
|
|
@@ -584,19 +577,19 @@ function te({
|
|
|
584
577
|
n.onClose,
|
|
585
578
|
n.bottomSheetState
|
|
586
579
|
);
|
|
587
|
-
function x(
|
|
588
|
-
|
|
580
|
+
function x(k) {
|
|
581
|
+
k.target instanceof Element && !o.contains(k.target) && n.onClose();
|
|
589
582
|
}
|
|
590
|
-
function w(
|
|
591
|
-
|
|
583
|
+
function w(k) {
|
|
584
|
+
$t(
|
|
592
585
|
n.draggingState,
|
|
593
|
-
|
|
586
|
+
k.target,
|
|
594
587
|
t.bottomSheetContentWrapper
|
|
595
588
|
);
|
|
596
589
|
}
|
|
597
|
-
function Y(
|
|
598
|
-
const O =
|
|
599
|
-
O.draggable && O.backgroundDraggable && (
|
|
590
|
+
function Y(k) {
|
|
591
|
+
const O = k ?? e;
|
|
592
|
+
O.draggable && O.backgroundDraggable && (b.addEventListeners({
|
|
600
593
|
onStart: w,
|
|
601
594
|
onStartOptions: {
|
|
602
595
|
eventPhase: j.Target
|
|
@@ -607,41 +600,41 @@ function te({
|
|
|
607
600
|
onStart: v,
|
|
608
601
|
onMove: S,
|
|
609
602
|
onEnd: E
|
|
610
|
-
}), O.draggable && window.document.addEventListener("keyup", (
|
|
611
|
-
|
|
612
|
-
}), i.addEventListener("keyup", (
|
|
613
|
-
if (
|
|
603
|
+
}), O.draggable && window.document.addEventListener("keyup", (f) => {
|
|
604
|
+
f.key === "Escape" && n.onClose();
|
|
605
|
+
}), i.addEventListener("keyup", (f) => {
|
|
606
|
+
if (f.key === "ArrowUp") {
|
|
614
607
|
n.moveUp();
|
|
615
608
|
return;
|
|
616
609
|
}
|
|
617
|
-
if (
|
|
610
|
+
if (f.key === "ArrowDown") {
|
|
618
611
|
n.moveDown();
|
|
619
612
|
return;
|
|
620
613
|
}
|
|
621
|
-
if (
|
|
622
|
-
const d =
|
|
614
|
+
if (f.shiftKey && f.key === "Tab") {
|
|
615
|
+
const d = F(
|
|
623
616
|
t.bottomSheetContentWrapper
|
|
624
617
|
);
|
|
625
|
-
|
|
618
|
+
Nt(d);
|
|
626
619
|
}
|
|
627
620
|
});
|
|
628
621
|
}
|
|
629
|
-
function U(
|
|
630
|
-
const O =
|
|
631
|
-
e.shouldCloseOnOutsideClick && !e.preventClosing ? u.addEventListener("click", x) : u.style.pointerEvents = "none", O.draggable && (
|
|
622
|
+
function U(k) {
|
|
623
|
+
const O = k ?? e;
|
|
624
|
+
e.shouldCloseOnOutsideClick && !e.preventClosing ? u.addEventListener("click", x) : u.style.pointerEvents = "none", O.draggable && (s.addEventListeners({
|
|
632
625
|
onStart: w
|
|
633
|
-
}),
|
|
634
|
-
|
|
626
|
+
}), c.forEach((f) => {
|
|
627
|
+
f.removeEventListeners({
|
|
635
628
|
onStart: w
|
|
636
629
|
});
|
|
637
|
-
}),
|
|
630
|
+
}), c = e.dragTriggers.reduce((f, d) => {
|
|
638
631
|
const p = o.querySelectorAll(d);
|
|
639
632
|
if (!p.length)
|
|
640
|
-
return
|
|
633
|
+
return f;
|
|
641
634
|
const g = Array.from(p).map((m) => m instanceof HTMLElement ? new X(m) : null).filter((m) => !!m);
|
|
642
|
-
return [...
|
|
643
|
-
}, []),
|
|
644
|
-
|
|
635
|
+
return [...f, ...g];
|
|
636
|
+
}, []), c.forEach((f) => {
|
|
637
|
+
f.addEventListeners({
|
|
645
638
|
onStart: w,
|
|
646
639
|
onStartOptions: {
|
|
647
640
|
eventPhase: j.Target
|
|
@@ -652,28 +645,28 @@ function te({
|
|
|
652
645
|
function $() {
|
|
653
646
|
u.removeEventListener("click", x);
|
|
654
647
|
}
|
|
655
|
-
function
|
|
656
|
-
let O = [...Array.from(
|
|
648
|
+
function F(k) {
|
|
649
|
+
let O = [...Array.from(k.childNodes).reverse()];
|
|
657
650
|
for (; O.length; ) {
|
|
658
|
-
const
|
|
659
|
-
if (
|
|
660
|
-
return
|
|
661
|
-
|
|
651
|
+
const f = O.shift();
|
|
652
|
+
if (jt(f))
|
|
653
|
+
return f;
|
|
654
|
+
f && (O = [
|
|
662
655
|
...O,
|
|
663
|
-
...Array.from(
|
|
656
|
+
...Array.from(f.childNodes).reverse()
|
|
664
657
|
]);
|
|
665
658
|
}
|
|
666
659
|
return null;
|
|
667
660
|
}
|
|
668
|
-
function
|
|
669
|
-
|
|
661
|
+
function I() {
|
|
662
|
+
s.removeEventListeners({
|
|
670
663
|
onStart: w
|
|
671
|
-
}),
|
|
664
|
+
}), b.removeEventListeners({
|
|
672
665
|
onStart: w
|
|
673
666
|
}), y.removeEventListeners({
|
|
674
667
|
onStart: w
|
|
675
|
-
}),
|
|
676
|
-
|
|
668
|
+
}), c.forEach((k) => {
|
|
669
|
+
k.removeEventListeners({
|
|
677
670
|
onStart: w
|
|
678
671
|
});
|
|
679
672
|
}), C.removeEventListeners({
|
|
@@ -684,12 +677,12 @@ function te({
|
|
|
684
677
|
}
|
|
685
678
|
return {
|
|
686
679
|
attachEventListeners: Y,
|
|
687
|
-
clearEventListeners:
|
|
680
|
+
clearEventListeners: I,
|
|
688
681
|
attacheOnOpenEventListeners: U,
|
|
689
682
|
clearOnOpenEventListeners: $
|
|
690
683
|
};
|
|
691
684
|
}
|
|
692
|
-
class
|
|
685
|
+
class te {
|
|
693
686
|
constructor() {
|
|
694
687
|
J(this, "animationId"), J(this, "isInProgress"), J(this, "startedAt"), this.animationId = null, this.isInProgress = !1, this.startedAt = null;
|
|
695
688
|
}
|
|
@@ -711,7 +704,7 @@ class ee {
|
|
|
711
704
|
this.isInProgress = !1, this.startedAt = null, A(this.animationId) && cancelAnimationFrame(this.animationId);
|
|
712
705
|
}
|
|
713
706
|
}
|
|
714
|
-
function
|
|
707
|
+
function ee(t) {
|
|
715
708
|
const {
|
|
716
709
|
startY: e,
|
|
717
710
|
endY: n,
|
|
@@ -723,14 +716,14 @@ function ne(t) {
|
|
|
723
716
|
} = t, u = wt(e, n);
|
|
724
717
|
r.stop();
|
|
725
718
|
let h = !1;
|
|
726
|
-
r.start((
|
|
719
|
+
r.start((s) => {
|
|
727
720
|
et(o, {
|
|
728
|
-
y: e + u * a(
|
|
729
|
-
}), !h &&
|
|
721
|
+
y: e + u * a(s)
|
|
722
|
+
}), !h && s >= 1 && (i == null || i(), h = !0);
|
|
730
723
|
}, l);
|
|
731
724
|
}
|
|
732
725
|
const ut = (t, e) => (n) => {
|
|
733
|
-
|
|
726
|
+
ee({
|
|
734
727
|
...n,
|
|
735
728
|
animationTimingFunction: t,
|
|
736
729
|
animationDuration: e
|
|
@@ -741,10 +734,10 @@ const ut = (t, e) => (n) => {
|
|
|
741
734
|
CONTENT_HEIGHT: "content-height",
|
|
742
735
|
CLOSED: "closed"
|
|
743
736
|
};
|
|
744
|
-
function
|
|
737
|
+
function ne(t) {
|
|
745
738
|
return !(!A(t) || t > 1 || t < 0);
|
|
746
739
|
}
|
|
747
|
-
function
|
|
740
|
+
function oe(t, e) {
|
|
748
741
|
const n = {
|
|
749
742
|
set(o, r, i, a) {
|
|
750
743
|
return e(r, i), Reflect.set(o, r, i, a);
|
|
@@ -752,7 +745,7 @@ function re(t, e) {
|
|
|
752
745
|
};
|
|
753
746
|
return new Proxy(t, n);
|
|
754
747
|
}
|
|
755
|
-
function
|
|
748
|
+
function re(...t) {
|
|
756
749
|
console.error(t);
|
|
757
750
|
}
|
|
758
751
|
const W = {
|
|
@@ -762,7 +755,7 @@ const W = {
|
|
|
762
755
|
EASE_IN_OUT: "ease-in-out",
|
|
763
756
|
SPRING: "spring"
|
|
764
757
|
};
|
|
765
|
-
function
|
|
758
|
+
function ae(t) {
|
|
766
759
|
for (const e of Object.values(W))
|
|
767
760
|
if (e === t)
|
|
768
761
|
return !0;
|
|
@@ -776,15 +769,15 @@ function G(t, e, n, o) {
|
|
|
776
769
|
return a(r(l));
|
|
777
770
|
};
|
|
778
771
|
function r(l) {
|
|
779
|
-
let u = 0, h = 1,
|
|
772
|
+
let u = 0, h = 1, s = l, b;
|
|
780
773
|
if (l === 0 || l === 1)
|
|
781
774
|
return l;
|
|
782
775
|
for (; u < h; ) {
|
|
783
|
-
if (
|
|
784
|
-
return
|
|
785
|
-
l >
|
|
776
|
+
if (b = i(s), Math.abs(b - l) < 1e-3)
|
|
777
|
+
return s;
|
|
778
|
+
l > b ? u = s : h = s, s = (h + u) / 2;
|
|
786
779
|
}
|
|
787
|
-
return
|
|
780
|
+
return s;
|
|
788
781
|
}
|
|
789
782
|
function i(l) {
|
|
790
783
|
return 3 * t * l * Math.pow(1 - l, 2) + 3 * n * Math.pow(l, 2) * (1 - l) + Math.pow(l, 3);
|
|
@@ -793,19 +786,19 @@ function G(t, e, n, o) {
|
|
|
793
786
|
return 3 * e * l * Math.pow(1 - l, 2) + 3 * o * Math.pow(l, 2) * (1 - l) + Math.pow(l, 3);
|
|
794
787
|
}
|
|
795
788
|
}
|
|
796
|
-
const St = G(0.25, 0.1, 0.25, 1),
|
|
797
|
-
function
|
|
789
|
+
const St = G(0.25, 0.1, 0.25, 1), ie = G(0.42, 0, 1, 1), At = G(0.42, 0, 0.58, 1), se = G(0.4, 0.1, 0.6, 1), ce = G(0.45, 1.5, 0.55, 1);
|
|
790
|
+
function le(t) {
|
|
798
791
|
switch (t) {
|
|
799
792
|
case W.EASE:
|
|
800
793
|
return St;
|
|
801
794
|
case W.EASE_IN:
|
|
802
|
-
return
|
|
795
|
+
return ie;
|
|
803
796
|
case W.EASE_OUT:
|
|
804
797
|
return At;
|
|
805
798
|
case W.EASE_IN_OUT:
|
|
806
|
-
return
|
|
799
|
+
return se;
|
|
807
800
|
case W.SPRING:
|
|
808
|
-
return
|
|
801
|
+
return ce;
|
|
809
802
|
default:
|
|
810
803
|
return St;
|
|
811
804
|
}
|
|
@@ -813,7 +806,7 @@ function ue(t) {
|
|
|
813
806
|
function yt(t) {
|
|
814
807
|
return typeof t == "boolean";
|
|
815
808
|
}
|
|
816
|
-
const
|
|
809
|
+
const ue = {
|
|
817
810
|
ariaLabel: "Bottom sheet",
|
|
818
811
|
content: "",
|
|
819
812
|
defaultPosition: N.CONTENT_HEIGHT,
|
|
@@ -860,9 +853,9 @@ const de = {
|
|
|
860
853
|
backdropStyle: {},
|
|
861
854
|
containerGapFillerStyle: {}
|
|
862
855
|
};
|
|
863
|
-
function
|
|
856
|
+
function de(t) {
|
|
864
857
|
const e = {
|
|
865
|
-
...
|
|
858
|
+
...ue
|
|
866
859
|
}, n = Object.entries(t).reduce(
|
|
867
860
|
(o, r) => {
|
|
868
861
|
const [i, a] = r;
|
|
@@ -880,9 +873,9 @@ function dt(t) {
|
|
|
880
873
|
const { p1x: e, p1y: n, p2x: o, p2y: r } = t;
|
|
881
874
|
return G(e, n, o, r);
|
|
882
875
|
}
|
|
883
|
-
return
|
|
876
|
+
return ae(t) ? le(t) : At;
|
|
884
877
|
}
|
|
885
|
-
function
|
|
878
|
+
function pe(t, e, n, o) {
|
|
886
879
|
function r(i, a) {
|
|
887
880
|
switch (i) {
|
|
888
881
|
case "content":
|
|
@@ -1026,8 +1019,8 @@ function he(t, e, n, o) {
|
|
|
1026
1019
|
}
|
|
1027
1020
|
return r;
|
|
1028
1021
|
}
|
|
1029
|
-
function
|
|
1030
|
-
const e =
|
|
1022
|
+
function he(t) {
|
|
1023
|
+
const e = de(t), n = dt(
|
|
1031
1024
|
t.draggingAnimationTimings
|
|
1032
1025
|
), o = {
|
|
1033
1026
|
isMounted: !1,
|
|
@@ -1048,30 +1041,30 @@ function me(t) {
|
|
|
1048
1041
|
function i() {
|
|
1049
1042
|
r.originalDocumentOverflowY && r.originalDocumentOverflowY !== "hidden" && (document.body.style.overflowY = r.originalDocumentOverflowY), r.originalDocumentOverscrollBehavior && (document.body.style.position = r.originalDocumentOverscrollBehavior);
|
|
1050
1043
|
}
|
|
1051
|
-
const a = new
|
|
1044
|
+
const a = new te(), l = {
|
|
1052
1045
|
animationFrame: a,
|
|
1053
1046
|
onClose: E,
|
|
1054
1047
|
bottomSheetState: o,
|
|
1055
1048
|
draggingState: r,
|
|
1056
|
-
snapTo:
|
|
1057
|
-
moveUp:
|
|
1049
|
+
snapTo: f,
|
|
1050
|
+
moveUp: k,
|
|
1058
1051
|
moveDown: O
|
|
1059
|
-
}, { elements: u, eventHandlers: h } =
|
|
1052
|
+
}, { elements: u, eventHandlers: h } = Kt(
|
|
1060
1053
|
e,
|
|
1061
1054
|
l
|
|
1062
|
-
),
|
|
1055
|
+
), s = oe(
|
|
1063
1056
|
e,
|
|
1064
|
-
|
|
1057
|
+
pe(
|
|
1065
1058
|
u,
|
|
1066
1059
|
o,
|
|
1067
1060
|
e,
|
|
1068
1061
|
h
|
|
1069
1062
|
)
|
|
1070
|
-
), { bottomSheetBackdrop:
|
|
1063
|
+
), { bottomSheetBackdrop: b, bottomSheetRoot: y, bottomSheetContainer: c } = u, C = (d) => {
|
|
1071
1064
|
const p = d ?? window.document.body;
|
|
1072
|
-
p.appendChild(y), p.appendChild(
|
|
1065
|
+
p.appendChild(y), p.appendChild(b);
|
|
1073
1066
|
const g = window.innerHeight;
|
|
1074
|
-
et(
|
|
1067
|
+
et(c, {
|
|
1075
1068
|
y: g
|
|
1076
1069
|
}), h.attachEventListeners(), o.isMounted = !0;
|
|
1077
1070
|
}, v = () => {
|
|
@@ -1080,28 +1073,28 @@ function me(t) {
|
|
|
1080
1073
|
}), i(), o.isMounted = !1;
|
|
1081
1074
|
}, S = () => {
|
|
1082
1075
|
var d;
|
|
1083
|
-
if (x() ||
|
|
1076
|
+
if (x() || re(
|
|
1084
1077
|
'Bottom Sheet is not mounted yet. call the "mount" method first.'
|
|
1085
1078
|
), (d = t.beforeOpen) == null || d.call(t), w())
|
|
1086
1079
|
return;
|
|
1087
|
-
ot(
|
|
1088
|
-
y:
|
|
1080
|
+
ot(b, !0), s.shouldShowBackdrop || K(b, "transparent"), ot([c], !0), et(c, {
|
|
1081
|
+
y: c.clientHeight
|
|
1089
1082
|
});
|
|
1090
1083
|
const p = window.innerHeight, g = mt(
|
|
1091
1084
|
p,
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
), m = D(
|
|
1085
|
+
c.clientHeight,
|
|
1086
|
+
s.marginTop,
|
|
1087
|
+
s.defaultPosition
|
|
1088
|
+
), m = D(c).y;
|
|
1096
1089
|
o.translateContainer({
|
|
1097
1090
|
startY: m,
|
|
1098
1091
|
endY: g,
|
|
1099
1092
|
animationFrame: a,
|
|
1100
|
-
bottomSheetContainer:
|
|
1093
|
+
bottomSheetContainer: c,
|
|
1101
1094
|
onEnd: t.afterOpen
|
|
1102
1095
|
});
|
|
1103
|
-
const
|
|
1104
|
-
r.originalDocumentOverflowY =
|
|
1096
|
+
const T = document.body.style.overflowY;
|
|
1097
|
+
r.originalDocumentOverflowY = T || "initial";
|
|
1105
1098
|
const B = document.body.style.overscrollBehavior;
|
|
1106
1099
|
r.originalDocumentOverscrollBehavior = B || "initial", document.body.style.overflow = "hidden", document.body.style.overscrollBehavior = "contain", u.bottomSheetHandle.focus(), h.attacheOnOpenEventListeners();
|
|
1107
1100
|
};
|
|
@@ -1110,15 +1103,15 @@ function me(t) {
|
|
|
1110
1103
|
if (Y())
|
|
1111
1104
|
return;
|
|
1112
1105
|
(d = t.beforeClose) == null || d.call(t);
|
|
1113
|
-
const p = D(
|
|
1106
|
+
const p = D(c).y, g = c.clientHeight;
|
|
1114
1107
|
o.translateContainer({
|
|
1115
1108
|
startY: p,
|
|
1116
1109
|
endY: g,
|
|
1117
1110
|
animationFrame: a,
|
|
1118
|
-
bottomSheetContainer:
|
|
1111
|
+
bottomSheetContainer: c,
|
|
1119
1112
|
onEnd: () => {
|
|
1120
1113
|
var m;
|
|
1121
|
-
(m = t.afterClose) == null || m.call(t), ot([
|
|
1114
|
+
(m = t.afterClose) == null || m.call(t), ot([b, c], !1), h.clearOnOpenEventListeners();
|
|
1122
1115
|
}
|
|
1123
1116
|
}), i();
|
|
1124
1117
|
}
|
|
@@ -1126,113 +1119,113 @@ function me(t) {
|
|
|
1126
1119
|
return o.isMounted;
|
|
1127
1120
|
}
|
|
1128
1121
|
function w() {
|
|
1129
|
-
const d = D(
|
|
1122
|
+
const d = D(c).y, p = window.innerHeight, g = c.clientHeight >= p ? p : c.clientHeight;
|
|
1130
1123
|
return d <= g;
|
|
1131
1124
|
}
|
|
1132
1125
|
function Y() {
|
|
1133
1126
|
return !w();
|
|
1134
1127
|
}
|
|
1135
1128
|
function U() {
|
|
1136
|
-
const d = D(
|
|
1129
|
+
const d = D(c).y, p = c.clientHeight, g = window.innerHeight;
|
|
1137
1130
|
if (d <= 5 && d >= -5)
|
|
1138
1131
|
return N.CONTENT_HEIGHT;
|
|
1139
1132
|
const m = p - d;
|
|
1140
1133
|
if (m === g / 2)
|
|
1141
1134
|
return N.MIDDLE;
|
|
1142
|
-
const
|
|
1143
|
-
return m <=
|
|
1135
|
+
const T = g - s.marginTop, B = 10;
|
|
1136
|
+
return m <= T + B && m >= T - B ? N.TOP : N.CLOSED;
|
|
1144
1137
|
}
|
|
1145
1138
|
function $() {
|
|
1146
|
-
return
|
|
1139
|
+
return c.clientHeight;
|
|
1147
1140
|
}
|
|
1148
|
-
function
|
|
1141
|
+
function F(d) {
|
|
1149
1142
|
if (!w())
|
|
1150
1143
|
return;
|
|
1151
|
-
const p = D(
|
|
1144
|
+
const p = D(c).y, g = c.clientHeight - p, m = window.innerHeight - d, T = Gt(g, m), B = V(g, m);
|
|
1152
1145
|
o.translateContainer({
|
|
1153
1146
|
startY: p,
|
|
1154
|
-
endY: p + (
|
|
1147
|
+
endY: p + (T.isUp ? -B : B),
|
|
1155
1148
|
animationFrame: a,
|
|
1156
|
-
bottomSheetContainer:
|
|
1149
|
+
bottomSheetContainer: c
|
|
1157
1150
|
});
|
|
1158
1151
|
}
|
|
1159
|
-
function
|
|
1152
|
+
function I(d, {
|
|
1160
1153
|
viewportHeight: p,
|
|
1161
1154
|
visibleHeight: g
|
|
1162
1155
|
}) {
|
|
1163
1156
|
let m = null;
|
|
1164
|
-
for (const
|
|
1165
|
-
const B =
|
|
1157
|
+
for (const T of d) {
|
|
1158
|
+
const B = T * p, P = V(
|
|
1166
1159
|
g,
|
|
1167
1160
|
B
|
|
1168
1161
|
);
|
|
1169
|
-
(m === null ||
|
|
1162
|
+
(m === null || P < m) && (m = P);
|
|
1170
1163
|
}
|
|
1171
1164
|
return {
|
|
1172
1165
|
minOffset: m
|
|
1173
1166
|
};
|
|
1174
1167
|
}
|
|
1175
|
-
function
|
|
1176
|
-
const d = [...
|
|
1177
|
-
if (!
|
|
1168
|
+
function k() {
|
|
1169
|
+
const d = [...s.snapPoints].reverse(), p = D(c).y, g = c.clientHeight, m = g - p;
|
|
1170
|
+
if (!s.expandable && m >= g)
|
|
1178
1171
|
return;
|
|
1179
|
-
const
|
|
1172
|
+
const T = window.innerHeight, B = bt(
|
|
1180
1173
|
"above",
|
|
1181
|
-
{ visibleHeight: m, viewportHeight:
|
|
1174
|
+
{ visibleHeight: m, viewportHeight: T },
|
|
1182
1175
|
d
|
|
1183
|
-
), { minOffset:
|
|
1176
|
+
), { minOffset: P } = I(B, {
|
|
1184
1177
|
visibleHeight: m,
|
|
1185
|
-
viewportHeight:
|
|
1178
|
+
viewportHeight: T
|
|
1186
1179
|
});
|
|
1187
|
-
if (
|
|
1180
|
+
if (P === null && m < T - s.marginTop) {
|
|
1188
1181
|
o.translateContainer({
|
|
1189
1182
|
startY: p,
|
|
1190
1183
|
endY: mt(
|
|
1191
|
-
|
|
1184
|
+
T,
|
|
1192
1185
|
g,
|
|
1193
|
-
|
|
1186
|
+
s.marginTop,
|
|
1194
1187
|
"top"
|
|
1195
1188
|
),
|
|
1196
1189
|
animationFrame: a,
|
|
1197
|
-
bottomSheetContainer:
|
|
1190
|
+
bottomSheetContainer: c
|
|
1198
1191
|
});
|
|
1199
1192
|
return;
|
|
1200
1193
|
}
|
|
1201
|
-
A(
|
|
1194
|
+
A(P) && o.translateContainer({
|
|
1202
1195
|
startY: p,
|
|
1203
|
-
endY: p -
|
|
1196
|
+
endY: p - P,
|
|
1204
1197
|
animationFrame: a,
|
|
1205
|
-
bottomSheetContainer:
|
|
1198
|
+
bottomSheetContainer: c
|
|
1206
1199
|
});
|
|
1207
1200
|
}
|
|
1208
1201
|
function O() {
|
|
1209
|
-
const d = D(
|
|
1202
|
+
const d = D(c).y, p = c.clientHeight - d;
|
|
1210
1203
|
if (p < 1)
|
|
1211
1204
|
return;
|
|
1212
|
-
const g = window.innerHeight, m =
|
|
1205
|
+
const g = window.innerHeight, m = bt(
|
|
1213
1206
|
"below",
|
|
1214
1207
|
{ visibleHeight: p, viewportHeight: g },
|
|
1215
|
-
|
|
1216
|
-
), { minOffset:
|
|
1208
|
+
s.snapPoints
|
|
1209
|
+
), { minOffset: T } = I(m, {
|
|
1217
1210
|
visibleHeight: p,
|
|
1218
1211
|
viewportHeight: g
|
|
1219
1212
|
});
|
|
1220
|
-
A(
|
|
1213
|
+
A(T) && o.translateContainer({
|
|
1221
1214
|
startY: d,
|
|
1222
|
-
endY: d +
|
|
1215
|
+
endY: d + T,
|
|
1223
1216
|
animationFrame: a,
|
|
1224
|
-
bottomSheetContainer:
|
|
1217
|
+
bottomSheetContainer: c
|
|
1225
1218
|
});
|
|
1226
1219
|
}
|
|
1227
|
-
function
|
|
1220
|
+
function f(d) {
|
|
1228
1221
|
const p = window.innerHeight;
|
|
1229
|
-
if (!
|
|
1222
|
+
if (!ne(d))
|
|
1230
1223
|
return;
|
|
1231
1224
|
const g = tt(p * d, 2);
|
|
1232
|
-
|
|
1225
|
+
F(g);
|
|
1233
1226
|
}
|
|
1234
1227
|
return {
|
|
1235
|
-
props:
|
|
1228
|
+
props: s,
|
|
1236
1229
|
elements: u,
|
|
1237
1230
|
mount: C,
|
|
1238
1231
|
unmount: v,
|
|
@@ -1243,8 +1236,8 @@ function me(t) {
|
|
|
1243
1236
|
getIsClosed: Y,
|
|
1244
1237
|
getPosition: U,
|
|
1245
1238
|
getHeight: $,
|
|
1246
|
-
moveTo:
|
|
1247
|
-
snapTo:
|
|
1239
|
+
moveTo: F,
|
|
1240
|
+
snapTo: f
|
|
1248
1241
|
};
|
|
1249
1242
|
}
|
|
1250
1243
|
function Bt() {
|
|
@@ -1280,7 +1273,7 @@ function Bt() {
|
|
|
1280
1273
|
}
|
|
1281
1274
|
};
|
|
1282
1275
|
}
|
|
1283
|
-
const
|
|
1276
|
+
const me = Bt(), ve = Dt(
|
|
1284
1277
|
function(e, n) {
|
|
1285
1278
|
const {
|
|
1286
1279
|
children: o,
|
|
@@ -1289,36 +1282,36 @@ const fe = Bt(), Se = Dt(
|
|
|
1289
1282
|
afterClose: a,
|
|
1290
1283
|
mountingPointRef: l,
|
|
1291
1284
|
...u
|
|
1292
|
-
} = e, h = rt(
|
|
1285
|
+
} = e, h = rt(me), [s, b] = at(
|
|
1293
1286
|
h.current
|
|
1294
1287
|
);
|
|
1295
1288
|
Mt(
|
|
1296
1289
|
n,
|
|
1297
|
-
() =>
|
|
1298
|
-
[
|
|
1290
|
+
() => s,
|
|
1291
|
+
[s]
|
|
1299
1292
|
);
|
|
1300
1293
|
const y = z(() => {
|
|
1301
1294
|
i(!1), a == null || a();
|
|
1302
1295
|
}, [a]);
|
|
1303
1296
|
q(() => {
|
|
1304
|
-
r ?
|
|
1297
|
+
r ? s.open() : s.close();
|
|
1305
1298
|
}, [r]);
|
|
1306
|
-
const
|
|
1299
|
+
const c = rt(null);
|
|
1307
1300
|
return q(
|
|
1308
1301
|
function() {
|
|
1309
1302
|
var E;
|
|
1310
1303
|
if (l && !l.current)
|
|
1311
1304
|
return;
|
|
1312
|
-
const v =
|
|
1313
|
-
if (!v ||
|
|
1305
|
+
const v = It((E = e.mountingPointRef) == null ? void 0 : E.current) ? e.mountingPointRef.current : window.document.body;
|
|
1306
|
+
if (!v || s.getIsMounted())
|
|
1314
1307
|
return;
|
|
1315
|
-
const S =
|
|
1308
|
+
const S = he({
|
|
1316
1309
|
content: "",
|
|
1317
1310
|
...u,
|
|
1318
1311
|
afterClose: y
|
|
1319
1312
|
});
|
|
1320
|
-
return S.mount(v),
|
|
1321
|
-
|
|
1313
|
+
return S.mount(v), c.current = S.elements.bottomSheetContentWrapper ?? null, h.current = S, b(S), () => {
|
|
1314
|
+
s.unmount();
|
|
1322
1315
|
};
|
|
1323
1316
|
},
|
|
1324
1317
|
[e.mountingPointRef, u, y]
|
|
@@ -1326,20 +1319,20 @@ const fe = Bt(), Se = Dt(
|
|
|
1326
1319
|
function() {
|
|
1327
1320
|
Object.assign(h.current.props, {
|
|
1328
1321
|
...u
|
|
1329
|
-
}),
|
|
1322
|
+
}), b(h.current);
|
|
1330
1323
|
},
|
|
1331
1324
|
[u]
|
|
1332
1325
|
), q(function() {
|
|
1333
1326
|
return () => {
|
|
1334
1327
|
h.current.unmount();
|
|
1335
1328
|
};
|
|
1336
|
-
}, []),
|
|
1329
|
+
}, []), c.current ? Ft(
|
|
1337
1330
|
e.children,
|
|
1338
|
-
|
|
1331
|
+
c.current
|
|
1339
1332
|
) : null;
|
|
1340
1333
|
}
|
|
1341
1334
|
), be = Bt();
|
|
1342
|
-
function
|
|
1335
|
+
function Se(t = {}) {
|
|
1343
1336
|
const e = rt(be), [n, o] = at(!1), r = !n, [i, a] = at(e.current);
|
|
1344
1337
|
q(() => {
|
|
1345
1338
|
a(e.current);
|
|
@@ -1348,10 +1341,10 @@ function ye(t = {}) {
|
|
|
1348
1341
|
beforeOpen: l,
|
|
1349
1342
|
afterOpen: u,
|
|
1350
1343
|
beforeClose: h,
|
|
1351
|
-
afterClose:
|
|
1352
|
-
onDragStart:
|
|
1344
|
+
afterClose: s,
|
|
1345
|
+
onDragStart: b,
|
|
1353
1346
|
onDragMove: y,
|
|
1354
|
-
onDragEnd:
|
|
1347
|
+
onDragEnd: c,
|
|
1355
1348
|
...C
|
|
1356
1349
|
} = t, v = () => {
|
|
1357
1350
|
l == null || l();
|
|
@@ -1360,13 +1353,13 @@ function ye(t = {}) {
|
|
|
1360
1353
|
}, E = () => {
|
|
1361
1354
|
h == null || h();
|
|
1362
1355
|
}, x = () => {
|
|
1363
|
-
|
|
1356
|
+
s == null || s(), o(!1);
|
|
1364
1357
|
}, w = () => {
|
|
1365
|
-
|
|
1366
|
-
}, Y = (
|
|
1367
|
-
y == null || y(
|
|
1358
|
+
b == null || b();
|
|
1359
|
+
}, Y = (f, d) => {
|
|
1360
|
+
y == null || y(f, d);
|
|
1368
1361
|
}, U = () => {
|
|
1369
|
-
|
|
1362
|
+
c == null || c();
|
|
1370
1363
|
}, $ = Yt(() => ({
|
|
1371
1364
|
ref: e,
|
|
1372
1365
|
isOpen: n,
|
|
@@ -1379,18 +1372,18 @@ function ye(t = {}) {
|
|
|
1379
1372
|
onDragMove: Y,
|
|
1380
1373
|
onDragEnd: U,
|
|
1381
1374
|
...C
|
|
1382
|
-
}), [e.current, n, o, t]),
|
|
1375
|
+
}), [e.current, n, o, t]), F = z(() => {
|
|
1383
1376
|
o(!0);
|
|
1384
|
-
}, [o]),
|
|
1377
|
+
}, [o]), I = z(() => {
|
|
1385
1378
|
o(!1);
|
|
1386
|
-
}, [o]),
|
|
1387
|
-
(...
|
|
1388
|
-
i.moveTo(...
|
|
1379
|
+
}, [o]), k = z(
|
|
1380
|
+
(...f) => {
|
|
1381
|
+
i.moveTo(...f);
|
|
1389
1382
|
},
|
|
1390
1383
|
[i]
|
|
1391
1384
|
), O = z(
|
|
1392
|
-
(...
|
|
1393
|
-
i.snapTo(...
|
|
1385
|
+
(...f) => {
|
|
1386
|
+
i.snapTo(...f);
|
|
1394
1387
|
},
|
|
1395
1388
|
[i]
|
|
1396
1389
|
);
|
|
@@ -1400,14 +1393,14 @@ function ye(t = {}) {
|
|
|
1400
1393
|
isOpen: n,
|
|
1401
1394
|
isClosed: r,
|
|
1402
1395
|
setIsOpen: o,
|
|
1403
|
-
open:
|
|
1404
|
-
close:
|
|
1405
|
-
moveTo:
|
|
1396
|
+
open: F,
|
|
1397
|
+
close: I,
|
|
1398
|
+
moveTo: k,
|
|
1406
1399
|
snapTo: O
|
|
1407
1400
|
};
|
|
1408
1401
|
}
|
|
1409
1402
|
export {
|
|
1410
|
-
|
|
1403
|
+
ve as BottomSheet,
|
|
1411
1404
|
Bt as createPlaceholderBottomSheet,
|
|
1412
|
-
|
|
1405
|
+
Se as useBottomSheet
|
|
1413
1406
|
};
|