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