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