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